| 1 |
/*! |
| 2 |
* Bootstrap v4.6.2 (https://getbootstrap.com/) |
| 3 |
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) |
| 4 |
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
| 5 |
*/ |
| 6 |
(function (global, factory) { |
| 7 |
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery')) : |
| 8 |
typeof define === 'function' && define.amd ? define(['exports', 'jquery'], factory) : |
| 9 |
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.bootstrap = {}, global.jQuery)); |
| 10 |
})(this, (function (exports, $) { 'use strict'; |
| 11 |
|
| 12 |
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } |
| 13 |
|
| 14 |
var $__default = /*#__PURE__*/_interopDefaultLegacy($); |
| 15 |
|
| 16 |
function _defineProperties(target, props) { |
| 17 |
for (var i = 0; i < props.length; i++) { |
| 18 |
var descriptor = props[i]; |
| 19 |
descriptor.enumerable = descriptor.enumerable || false; |
| 20 |
descriptor.configurable = true; |
| 21 |
if ("value" in descriptor) descriptor.writable = true; |
| 22 |
Object.defineProperty(target, descriptor.key, descriptor); |
| 23 |
} |
| 24 |
} |
| 25 |
|
| 26 |
function _createClass(Constructor, protoProps, staticProps) { |
| 27 |
if (protoProps) _defineProperties(Constructor.prototype, protoProps); |
| 28 |
if (staticProps) _defineProperties(Constructor, staticProps); |
| 29 |
Object.defineProperty(Constructor, "prototype", { |
| 30 |
writable: false |
| 31 |
}); |
| 32 |
return Constructor; |
| 33 |
} |
| 34 |
|
| 35 |
function _extends$1() { |
| 36 |
_extends$1 = Object.assign ? Object.assign.bind() : function (target) { |
| 37 |
for (var i = 1; i < arguments.length; i++) { |
| 38 |
var source = arguments[i]; |
| 39 |
|
| 40 |
for (var key in source) { |
| 41 |
if (Object.prototype.hasOwnProperty.call(source, key)) { |
| 42 |
target[key] = source[key]; |
| 43 |
} |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
return target; |
| 48 |
}; |
| 49 |
return _extends$1.apply(this, arguments); |
| 50 |
} |
| 51 |
|
| 52 |
function _inheritsLoose(subClass, superClass) { |
| 53 |
subClass.prototype = Object.create(superClass.prototype); |
| 54 |
subClass.prototype.constructor = subClass; |
| 55 |
|
| 56 |
_setPrototypeOf(subClass, superClass); |
| 57 |
} |
| 58 |
|
| 59 |
function _setPrototypeOf(o, p) { |
| 60 |
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { |
| 61 |
o.__proto__ = p; |
| 62 |
return o; |
| 63 |
}; |
| 64 |
return _setPrototypeOf(o, p); |
| 65 |
} |
| 66 |
|
| 67 |
/** |
| 68 |
* -------------------------------------------------------------------------- |
| 69 |
* Bootstrap (v4.6.2): util.js |
| 70 |
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
| 71 |
* -------------------------------------------------------------------------- |
| 72 |
*/ |
| 73 |
/** |
| 74 |
* Private TransitionEnd Helpers |
| 75 |
*/ |
| 76 |
|
| 77 |
var TRANSITION_END = 'transitionend'; |
| 78 |
var MAX_UID = 1000000; |
| 79 |
var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) |
| 80 |
|
| 81 |
function toType(obj) { |
| 82 |
if (obj === null || typeof obj === 'undefined') { |
| 83 |
return "" + obj; |
| 84 |
} |
| 85 |
|
| 86 |
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); |
| 87 |
} |
| 88 |
|
| 89 |
function getSpecialTransitionEndEvent() { |
| 90 |
return { |
| 91 |
bindType: TRANSITION_END, |
| 92 |
delegateType: TRANSITION_END, |
| 93 |
handle: function handle(event) { |
| 94 |
if ($__default["default"](event.target).is(this)) { |
| 95 |
return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params |
| 96 |
} |
| 97 |
|
| 98 |
return undefined; |
| 99 |
} |
| 100 |
}; |
| 101 |
} |
| 102 |
|
| 103 |
function transitionEndEmulator(duration) { |
| 104 |
var _this = this; |
| 105 |
|
| 106 |
var called = false; |
| 107 |
$__default["default"](this).one(Util.TRANSITION_END, function () { |
| 108 |
called = true; |
| 109 |
}); |
| 110 |
setTimeout(function () { |
| 111 |
if (!called) { |
| 112 |
Util.triggerTransitionEnd(_this); |
| 113 |
} |
| 114 |
}, duration); |
| 115 |
return this; |
| 116 |
} |
| 117 |
|
| 118 |
function setTransitionEndSupport() { |
| 119 |
$__default["default"].fn.emulateTransitionEnd = transitionEndEmulator; |
| 120 |
$__default["default"].event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); |
| 121 |
} |
| 122 |
/** |
| 123 |
* Public Util API |
| 124 |
*/ |
| 125 |
|
| 126 |
|
| 127 |
var Util = { |
| 128 |
TRANSITION_END: 'bsTransitionEnd', |
| 129 |
getUID: function getUID(prefix) { |
| 130 |
do { |
| 131 |
// eslint-disable-next-line no-bitwise |
| 132 |
prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here |
| 133 |
} while (document.getElementById(prefix)); |
| 134 |
|
| 135 |
return prefix; |
| 136 |
}, |
| 137 |
getSelectorFromElement: function getSelectorFromElement(element) { |
| 138 |
var selector = element.getAttribute('data-target'); |
| 139 |
|
| 140 |
if (!selector || selector === '#') { |
| 141 |
var hrefAttr = element.getAttribute('href'); |
| 142 |
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; |
| 143 |
} |
| 144 |
|
| 145 |
try { |
| 146 |
return document.querySelector(selector) ? selector : null; |
| 147 |
} catch (_) { |
| 148 |
return null; |
| 149 |
} |
| 150 |
}, |
| 151 |
getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { |
| 152 |
if (!element) { |
| 153 |
return 0; |
| 154 |
} // Get transition-duration of the element |
| 155 |
|
| 156 |
|
| 157 |
var transitionDuration = $__default["default"](element).css('transition-duration'); |
| 158 |
var transitionDelay = $__default["default"](element).css('transition-delay'); |
| 159 |
var floatTransitionDuration = parseFloat(transitionDuration); |
| 160 |
var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found |
| 161 |
|
| 162 |
if (!floatTransitionDuration && !floatTransitionDelay) { |
| 163 |
return 0; |
| 164 |
} // If multiple durations are defined, take the first |
| 165 |
|
| 166 |
|
| 167 |
transitionDuration = transitionDuration.split(',')[0]; |
| 168 |
transitionDelay = transitionDelay.split(',')[0]; |
| 169 |
return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; |
| 170 |
}, |
| 171 |
reflow: function reflow(element) { |
| 172 |
return element.offsetHeight; |
| 173 |
}, |
| 174 |
triggerTransitionEnd: function triggerTransitionEnd(element) { |
| 175 |
$__default["default"](element).trigger(TRANSITION_END); |
| 176 |
}, |
| 177 |
supportsTransitionEnd: function supportsTransitionEnd() { |
| 178 |
return Boolean(TRANSITION_END); |
| 179 |
}, |
| 180 |
isElement: function isElement(obj) { |
| 181 |
return (obj[0] || obj).nodeType; |
| 182 |
}, |
| 183 |
typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { |
| 184 |
for (var property in configTypes) { |
| 185 |
if (Object.prototype.hasOwnProperty.call(configTypes, property)) { |
| 186 |
var expectedTypes = configTypes[property]; |
| 187 |
var value = config[property]; |
| 188 |
var valueType = value && Util.isElement(value) ? 'element' : toType(value); |
| 189 |
|
| 190 |
if (!new RegExp(expectedTypes).test(valueType)) { |
| 191 |
throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); |
| 192 |
} |
| 193 |
} |
| 194 |
} |
| 195 |
}, |
| 196 |
findShadowRoot: function findShadowRoot(element) { |
| 197 |
if (!document.documentElement.attachShadow) { |
| 198 |
return null; |
| 199 |
} // Can find the shadow root otherwise it'll return the document |
| 200 |
|
| 201 |
|
| 202 |
if (typeof element.getRootNode === 'function') { |
| 203 |
var root = element.getRootNode(); |
| 204 |
return root instanceof ShadowRoot ? root : null; |
| 205 |
} |
| 206 |
|
| 207 |
if (element instanceof ShadowRoot) { |
| 208 |
return element; |
| 209 |
} // when we don't find a shadow root |
| 210 |
|
| 211 |
|
| 212 |
if (!element.parentNode) { |
| 213 |
return null; |
| 214 |
} |
| 215 |
|
| 216 |
return Util.findShadowRoot(element.parentNode); |
| 217 |
}, |
| 218 |
jQueryDetection: function jQueryDetection() { |
| 219 |
if (typeof $__default["default"] === 'undefined') { |
| 220 |
throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); |
| 221 |
} |
| 222 |
|
| 223 |
var version = $__default["default"].fn.jquery.split(' ')[0].split('.'); |
| 224 |
var minMajor = 1; |
| 225 |
var ltMajor = 2; |
| 226 |
var minMinor = 9; |
| 227 |
var minPatch = 1; |
| 228 |
var maxMajor = 4; |
| 229 |
|
| 230 |
if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { |
| 231 |
throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0'); |
| 232 |
} |
| 233 |
} |
| 234 |
}; |
| 235 |
Util.jQueryDetection(); |
| 236 |
setTransitionEndSupport(); |
| 237 |
|
| 238 |
/** |
| 239 |
* Constants |
| 240 |
*/ |
| 241 |
|
| 242 |
var NAME$a = 'alert'; |
| 243 |
var VERSION$a = '4.6.2'; |
| 244 |
var DATA_KEY$a = 'bs.alert'; |
| 245 |
var EVENT_KEY$a = "." + DATA_KEY$a; |
| 246 |
var DATA_API_KEY$7 = '.data-api'; |
| 247 |
var JQUERY_NO_CONFLICT$a = $__default["default"].fn[NAME$a]; |
| 248 |
var CLASS_NAME_ALERT = 'alert'; |
| 249 |
var CLASS_NAME_FADE$5 = 'fade'; |
| 250 |
var CLASS_NAME_SHOW$7 = 'show'; |
| 251 |
var EVENT_CLOSE = "close" + EVENT_KEY$a; |
| 252 |
var EVENT_CLOSED = "closed" + EVENT_KEY$a; |
| 253 |
var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$a + DATA_API_KEY$7; |
| 254 |
var SELECTOR_DISMISS = '[data-dismiss="alert"]'; |
| 255 |
/** |
| 256 |
* Class definition |
| 257 |
*/ |
| 258 |
|
| 259 |
var Alert = /*#__PURE__*/function () { |
| 260 |
function Alert(element) { |
| 261 |
this._element = element; |
| 262 |
} // Getters |
| 263 |
|
| 264 |
|
| 265 |
var _proto = Alert.prototype; |
| 266 |
|
| 267 |
// Public |
| 268 |
_proto.close = function close(element) { |
| 269 |
var rootElement = this._element; |
| 270 |
|
| 271 |
if (element) { |
| 272 |
rootElement = this._getRootElement(element); |
| 273 |
} |
| 274 |
|
| 275 |
var customEvent = this._triggerCloseEvent(rootElement); |
| 276 |
|
| 277 |
if (customEvent.isDefaultPrevented()) { |
| 278 |
return; |
| 279 |
} |
| 280 |
|
| 281 |
this._removeElement(rootElement); |
| 282 |
}; |
| 283 |
|
| 284 |
_proto.dispose = function dispose() { |
| 285 |
$__default["default"].removeData(this._element, DATA_KEY$a); |
| 286 |
this._element = null; |
| 287 |
} // Private |
| 288 |
; |
| 289 |
|
| 290 |
_proto._getRootElement = function _getRootElement(element) { |
| 291 |
var selector = Util.getSelectorFromElement(element); |
| 292 |
var parent = false; |
| 293 |
|
| 294 |
if (selector) { |
| 295 |
parent = document.querySelector(selector); |
| 296 |
} |
| 297 |
|
| 298 |
if (!parent) { |
| 299 |
parent = $__default["default"](element).closest("." + CLASS_NAME_ALERT)[0]; |
| 300 |
} |
| 301 |
|
| 302 |
return parent; |
| 303 |
}; |
| 304 |
|
| 305 |
_proto._triggerCloseEvent = function _triggerCloseEvent(element) { |
| 306 |
var closeEvent = $__default["default"].Event(EVENT_CLOSE); |
| 307 |
$__default["default"](element).trigger(closeEvent); |
| 308 |
return closeEvent; |
| 309 |
}; |
| 310 |
|
| 311 |
_proto._removeElement = function _removeElement(element) { |
| 312 |
var _this = this; |
| 313 |
|
| 314 |
$__default["default"](element).removeClass(CLASS_NAME_SHOW$7); |
| 315 |
|
| 316 |
if (!$__default["default"](element).hasClass(CLASS_NAME_FADE$5)) { |
| 317 |
this._destroyElement(element); |
| 318 |
|
| 319 |
return; |
| 320 |
} |
| 321 |
|
| 322 |
var transitionDuration = Util.getTransitionDurationFromElement(element); |
| 323 |
$__default["default"](element).one(Util.TRANSITION_END, function (event) { |
| 324 |
return _this._destroyElement(element, event); |
| 325 |
}).emulateTransitionEnd(transitionDuration); |
| 326 |
}; |
| 327 |
|
| 328 |
_proto._destroyElement = function _destroyElement(element) { |
| 329 |
$__default["default"](element).detach().trigger(EVENT_CLOSED).remove(); |
| 330 |
} // Static |
| 331 |
; |
| 332 |
|
| 333 |
Alert._jQueryInterface = function _jQueryInterface(config) { |
| 334 |
return this.each(function () { |
| 335 |
var $element = $__default["default"](this); |
| 336 |
var data = $element.data(DATA_KEY$a); |
| 337 |
|
| 338 |
if (!data) { |
| 339 |
data = new Alert(this); |
| 340 |
$element.data(DATA_KEY$a, data); |
| 341 |
} |
| 342 |
|
| 343 |
if (config === 'close') { |
| 344 |
data[config](this); |
| 345 |
} |
| 346 |
}); |
| 347 |
}; |
| 348 |
|
| 349 |
Alert._handleDismiss = function _handleDismiss(alertInstance) { |
| 350 |
return function (event) { |
| 351 |
if (event) { |
| 352 |
event.preventDefault(); |
| 353 |
} |
| 354 |
|
| 355 |
alertInstance.close(this); |
| 356 |
}; |
| 357 |
}; |
| 358 |
|
| 359 |
_createClass(Alert, null, [{ |
| 360 |
key: "VERSION", |
| 361 |
get: function get() { |
| 362 |
return VERSION$a; |
| 363 |
} |
| 364 |
}]); |
| 365 |
|
| 366 |
return Alert; |
| 367 |
}(); |
| 368 |
/** |
| 369 |
* Data API implementation |
| 370 |
*/ |
| 371 |
|
| 372 |
|
| 373 |
$__default["default"](document).on(EVENT_CLICK_DATA_API$6, SELECTOR_DISMISS, Alert._handleDismiss(new Alert())); |
| 374 |
/** |
| 375 |
* jQuery |
| 376 |
*/ |
| 377 |
|
| 378 |
$__default["default"].fn[NAME$a] = Alert._jQueryInterface; |
| 379 |
$__default["default"].fn[NAME$a].Constructor = Alert; |
| 380 |
|
| 381 |
$__default["default"].fn[NAME$a].noConflict = function () { |
| 382 |
$__default["default"].fn[NAME$a] = JQUERY_NO_CONFLICT$a; |
| 383 |
return Alert._jQueryInterface; |
| 384 |
}; |
| 385 |
|
| 386 |
/** |
| 387 |
* Constants |
| 388 |
*/ |
| 389 |
|
| 390 |
var NAME$9 = 'button'; |
| 391 |
var VERSION$9 = '4.6.2'; |
| 392 |
var DATA_KEY$9 = 'bs.button'; |
| 393 |
var EVENT_KEY$9 = "." + DATA_KEY$9; |
| 394 |
var DATA_API_KEY$6 = '.data-api'; |
| 395 |
var JQUERY_NO_CONFLICT$9 = $__default["default"].fn[NAME$9]; |
| 396 |
var CLASS_NAME_ACTIVE$3 = 'active'; |
| 397 |
var CLASS_NAME_BUTTON = 'btn'; |
| 398 |
var CLASS_NAME_FOCUS = 'focus'; |
| 399 |
var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$9 + DATA_API_KEY$6; |
| 400 |
var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY$9 + DATA_API_KEY$6 + " " + ("blur" + EVENT_KEY$9 + DATA_API_KEY$6); |
| 401 |
var EVENT_LOAD_DATA_API$2 = "load" + EVENT_KEY$9 + DATA_API_KEY$6; |
| 402 |
var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]'; |
| 403 |
var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]'; |
| 404 |
var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="button"]'; |
| 405 |
var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn'; |
| 406 |
var SELECTOR_INPUT = 'input:not([type="hidden"])'; |
| 407 |
var SELECTOR_ACTIVE$2 = '.active'; |
| 408 |
var SELECTOR_BUTTON = '.btn'; |
| 409 |
/** |
| 410 |
* Class definition |
| 411 |
*/ |
| 412 |
|
| 413 |
var Button = /*#__PURE__*/function () { |
| 414 |
function Button(element) { |
| 415 |
this._element = element; |
| 416 |
this.shouldAvoidTriggerChange = false; |
| 417 |
} // Getters |
| 418 |
|
| 419 |
|
| 420 |
var _proto = Button.prototype; |
| 421 |
|
| 422 |
// Public |
| 423 |
_proto.toggle = function toggle() { |
| 424 |
var triggerChangeEvent = true; |
| 425 |
var addAriaPressed = true; |
| 426 |
var rootElement = $__default["default"](this._element).closest(SELECTOR_DATA_TOGGLES)[0]; |
| 427 |
|
| 428 |
if (rootElement) { |
| 429 |
var input = this._element.querySelector(SELECTOR_INPUT); |
| 430 |
|
| 431 |
if (input) { |
| 432 |
if (input.type === 'radio') { |
| 433 |
if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE$3)) { |
| 434 |
triggerChangeEvent = false; |
| 435 |
} else { |
| 436 |
var activeElement = rootElement.querySelector(SELECTOR_ACTIVE$2); |
| 437 |
|
| 438 |
if (activeElement) { |
| 439 |
$__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$3); |
| 440 |
} |
| 441 |
} |
| 442 |
} |
| 443 |
|
| 444 |
if (triggerChangeEvent) { |
| 445 |
// if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input |
| 446 |
if (input.type === 'checkbox' || input.type === 'radio') { |
| 447 |
input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE$3); |
| 448 |
} |
| 449 |
|
| 450 |
if (!this.shouldAvoidTriggerChange) { |
| 451 |
$__default["default"](input).trigger('change'); |
| 452 |
} |
| 453 |
} |
| 454 |
|
| 455 |
input.focus(); |
| 456 |
addAriaPressed = false; |
| 457 |
} |
| 458 |
} |
| 459 |
|
| 460 |
if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) { |
| 461 |
if (addAriaPressed) { |
| 462 |
this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE$3)); |
| 463 |
} |
| 464 |
|
| 465 |
if (triggerChangeEvent) { |
| 466 |
$__default["default"](this._element).toggleClass(CLASS_NAME_ACTIVE$3); |
| 467 |
} |
| 468 |
} |
| 469 |
}; |
| 470 |
|
| 471 |
_proto.dispose = function dispose() { |
| 472 |
$__default["default"].removeData(this._element, DATA_KEY$9); |
| 473 |
this._element = null; |
| 474 |
} // Static |
| 475 |
; |
| 476 |
|
| 477 |
Button._jQueryInterface = function _jQueryInterface(config, avoidTriggerChange) { |
| 478 |
return this.each(function () { |
| 479 |
var $element = $__default["default"](this); |
| 480 |
var data = $element.data(DATA_KEY$9); |
| 481 |
|
| 482 |
if (!data) { |
| 483 |
data = new Button(this); |
| 484 |
$element.data(DATA_KEY$9, data); |
| 485 |
} |
| 486 |
|
| 487 |
data.shouldAvoidTriggerChange = avoidTriggerChange; |
| 488 |
|
| 489 |
if (config === 'toggle') { |
| 490 |
data[config](); |
| 491 |
} |
| 492 |
}); |
| 493 |
}; |
| 494 |
|
| 495 |
_createClass(Button, null, [{ |
| 496 |
key: "VERSION", |
| 497 |
get: function get() { |
| 498 |
return VERSION$9; |
| 499 |
} |
| 500 |
}]); |
| 501 |
|
| 502 |
return Button; |
| 503 |
}(); |
| 504 |
/** |
| 505 |
* Data API implementation |
| 506 |
*/ |
| 507 |
|
| 508 |
|
| 509 |
$__default["default"](document).on(EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE_CARROT, function (event) { |
| 510 |
var button = event.target; |
| 511 |
var initialButton = button; |
| 512 |
|
| 513 |
if (!$__default["default"](button).hasClass(CLASS_NAME_BUTTON)) { |
| 514 |
button = $__default["default"](button).closest(SELECTOR_BUTTON)[0]; |
| 515 |
} |
| 516 |
|
| 517 |
if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) { |
| 518 |
event.preventDefault(); // work around Firefox bug #1540995 |
| 519 |
} else { |
| 520 |
var inputBtn = button.querySelector(SELECTOR_INPUT); |
| 521 |
|
| 522 |
if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) { |
| 523 |
event.preventDefault(); // work around Firefox bug #1540995 |
| 524 |
|
| 525 |
return; |
| 526 |
} |
| 527 |
|
| 528 |
if (initialButton.tagName === 'INPUT' || button.tagName !== 'LABEL') { |
| 529 |
Button._jQueryInterface.call($__default["default"](button), 'toggle', initialButton.tagName === 'INPUT'); |
| 530 |
} |
| 531 |
} |
| 532 |
}).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { |
| 533 |
var button = $__default["default"](event.target).closest(SELECTOR_BUTTON)[0]; |
| 534 |
$__default["default"](button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type)); |
| 535 |
}); |
| 536 |
$__default["default"](window).on(EVENT_LOAD_DATA_API$2, function () { |
| 537 |
// ensure correct active class is set to match the controls' actual values/states |
| 538 |
// find all checkboxes/readio buttons inside data-toggle groups |
| 539 |
var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS)); |
| 540 |
|
| 541 |
for (var i = 0, len = buttons.length; i < len; i++) { |
| 542 |
var button = buttons[i]; |
| 543 |
var input = button.querySelector(SELECTOR_INPUT); |
| 544 |
|
| 545 |
if (input.checked || input.hasAttribute('checked')) { |
| 546 |
button.classList.add(CLASS_NAME_ACTIVE$3); |
| 547 |
} else { |
| 548 |
button.classList.remove(CLASS_NAME_ACTIVE$3); |
| 549 |
} |
| 550 |
} // find all button toggles |
| 551 |
|
| 552 |
|
| 553 |
buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$4)); |
| 554 |
|
| 555 |
for (var _i = 0, _len = buttons.length; _i < _len; _i++) { |
| 556 |
var _button = buttons[_i]; |
| 557 |
|
| 558 |
if (_button.getAttribute('aria-pressed') === 'true') { |
| 559 |
_button.classList.add(CLASS_NAME_ACTIVE$3); |
| 560 |
} else { |
| 561 |
_button.classList.remove(CLASS_NAME_ACTIVE$3); |
| 562 |
} |
| 563 |
} |
| 564 |
}); |
| 565 |
/** |
| 566 |
* jQuery |
| 567 |
*/ |
| 568 |
|
| 569 |
$__default["default"].fn[NAME$9] = Button._jQueryInterface; |
| 570 |
$__default["default"].fn[NAME$9].Constructor = Button; |
| 571 |
|
| 572 |
$__default["default"].fn[NAME$9].noConflict = function () { |
| 573 |
$__default["default"].fn[NAME$9] = JQUERY_NO_CONFLICT$9; |
| 574 |
return Button._jQueryInterface; |
| 575 |
}; |
| 576 |
|
| 577 |
/** |
| 578 |
* Constants |
| 579 |
*/ |
| 580 |
|
| 581 |
var NAME$8 = 'carousel'; |
| 582 |
var VERSION$8 = '4.6.2'; |
| 583 |
var DATA_KEY$8 = 'bs.carousel'; |
| 584 |
var EVENT_KEY$8 = "." + DATA_KEY$8; |
| 585 |
var DATA_API_KEY$5 = '.data-api'; |
| 586 |
var JQUERY_NO_CONFLICT$8 = $__default["default"].fn[NAME$8]; |
| 587 |
var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key |
| 588 |
|
| 589 |
var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key |
| 590 |
|
| 591 |
var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch |
| 592 |
|
| 593 |
var SWIPE_THRESHOLD = 40; |
| 594 |
var CLASS_NAME_CAROUSEL = 'carousel'; |
| 595 |
var CLASS_NAME_ACTIVE$2 = 'active'; |
| 596 |
var CLASS_NAME_SLIDE = 'slide'; |
| 597 |
var CLASS_NAME_RIGHT = 'carousel-item-right'; |
| 598 |
var CLASS_NAME_LEFT = 'carousel-item-left'; |
| 599 |
var CLASS_NAME_NEXT = 'carousel-item-next'; |
| 600 |
var CLASS_NAME_PREV = 'carousel-item-prev'; |
| 601 |
var CLASS_NAME_POINTER_EVENT = 'pointer-event'; |
| 602 |
var DIRECTION_NEXT = 'next'; |
| 603 |
var DIRECTION_PREV = 'prev'; |
| 604 |
var DIRECTION_LEFT = 'left'; |
| 605 |
var DIRECTION_RIGHT = 'right'; |
| 606 |
var EVENT_SLIDE = "slide" + EVENT_KEY$8; |
| 607 |
var EVENT_SLID = "slid" + EVENT_KEY$8; |
| 608 |
var EVENT_KEYDOWN = "keydown" + EVENT_KEY$8; |
| 609 |
var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$8; |
| 610 |
var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$8; |
| 611 |
var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$8; |
| 612 |
var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$8; |
| 613 |
var EVENT_TOUCHEND = "touchend" + EVENT_KEY$8; |
| 614 |
var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$8; |
| 615 |
var EVENT_POINTERUP = "pointerup" + EVENT_KEY$8; |
| 616 |
var EVENT_DRAG_START = "dragstart" + EVENT_KEY$8; |
| 617 |
var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$8 + DATA_API_KEY$5; |
| 618 |
var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$8 + DATA_API_KEY$5; |
| 619 |
var SELECTOR_ACTIVE$1 = '.active'; |
| 620 |
var SELECTOR_ACTIVE_ITEM = '.active.carousel-item'; |
| 621 |
var SELECTOR_ITEM = '.carousel-item'; |
| 622 |
var SELECTOR_ITEM_IMG = '.carousel-item img'; |
| 623 |
var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; |
| 624 |
var SELECTOR_INDICATORS = '.carousel-indicators'; |
| 625 |
var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]'; |
| 626 |
var SELECTOR_DATA_RIDE = '[data-ride="carousel"]'; |
| 627 |
var Default$7 = { |
| 628 |
interval: 5000, |
| 629 |
keyboard: true, |
| 630 |
slide: false, |
| 631 |
pause: 'hover', |
| 632 |
wrap: true, |
| 633 |
touch: true |
| 634 |
}; |
| 635 |
var DefaultType$7 = { |
| 636 |
interval: '(number|boolean)', |
| 637 |
keyboard: 'boolean', |
| 638 |
slide: '(boolean|string)', |
| 639 |
pause: '(string|boolean)', |
| 640 |
wrap: 'boolean', |
| 641 |
touch: 'boolean' |
| 642 |
}; |
| 643 |
var PointerType = { |
| 644 |
TOUCH: 'touch', |
| 645 |
PEN: 'pen' |
| 646 |
}; |
| 647 |
/** |
| 648 |
* Class definition |
| 649 |
*/ |
| 650 |
|
| 651 |
var Carousel = /*#__PURE__*/function () { |
| 652 |
function Carousel(element, config) { |
| 653 |
this._items = null; |
| 654 |
this._interval = null; |
| 655 |
this._activeElement = null; |
| 656 |
this._isPaused = false; |
| 657 |
this._isSliding = false; |
| 658 |
this.touchTimeout = null; |
| 659 |
this.touchStartX = 0; |
| 660 |
this.touchDeltaX = 0; |
| 661 |
this._config = this._getConfig(config); |
| 662 |
this._element = element; |
| 663 |
this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS); |
| 664 |
this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; |
| 665 |
this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); |
| 666 |
|
| 667 |
this._addEventListeners(); |
| 668 |
} // Getters |
| 669 |
|
| 670 |
|
| 671 |
var _proto = Carousel.prototype; |
| 672 |
|
| 673 |
// Public |
| 674 |
_proto.next = function next() { |
| 675 |
if (!this._isSliding) { |
| 676 |
this._slide(DIRECTION_NEXT); |
| 677 |
} |
| 678 |
}; |
| 679 |
|
| 680 |
_proto.nextWhenVisible = function nextWhenVisible() { |
| 681 |
var $element = $__default["default"](this._element); // Don't call next when the page isn't visible |
| 682 |
// or the carousel or its parent isn't visible |
| 683 |
|
| 684 |
if (!document.hidden && $element.is(':visible') && $element.css('visibility') !== 'hidden') { |
| 685 |
this.next(); |
| 686 |
} |
| 687 |
}; |
| 688 |
|
| 689 |
_proto.prev = function prev() { |
| 690 |
if (!this._isSliding) { |
| 691 |
this._slide(DIRECTION_PREV); |
| 692 |
} |
| 693 |
}; |
| 694 |
|
| 695 |
_proto.pause = function pause(event) { |
| 696 |
if (!event) { |
| 697 |
this._isPaused = true; |
| 698 |
} |
| 699 |
|
| 700 |
if (this._element.querySelector(SELECTOR_NEXT_PREV)) { |
| 701 |
Util.triggerTransitionEnd(this._element); |
| 702 |
this.cycle(true); |
| 703 |
} |
| 704 |
|
| 705 |
clearInterval(this._interval); |
| 706 |
this._interval = null; |
| 707 |
}; |
| 708 |
|
| 709 |
_proto.cycle = function cycle(event) { |
| 710 |
if (!event) { |
| 711 |
this._isPaused = false; |
| 712 |
} |
| 713 |
|
| 714 |
if (this._interval) { |
| 715 |
clearInterval(this._interval); |
| 716 |
this._interval = null; |
| 717 |
} |
| 718 |
|
| 719 |
if (this._config.interval && !this._isPaused) { |
| 720 |
this._updateInterval(); |
| 721 |
|
| 722 |
this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); |
| 723 |
} |
| 724 |
}; |
| 725 |
|
| 726 |
_proto.to = function to(index) { |
| 727 |
var _this = this; |
| 728 |
|
| 729 |
this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); |
| 730 |
|
| 731 |
var activeIndex = this._getItemIndex(this._activeElement); |
| 732 |
|
| 733 |
if (index > this._items.length - 1 || index < 0) { |
| 734 |
return; |
| 735 |
} |
| 736 |
|
| 737 |
if (this._isSliding) { |
| 738 |
$__default["default"](this._element).one(EVENT_SLID, function () { |
| 739 |
return _this.to(index); |
| 740 |
}); |
| 741 |
return; |
| 742 |
} |
| 743 |
|
| 744 |
if (activeIndex === index) { |
| 745 |
this.pause(); |
| 746 |
this.cycle(); |
| 747 |
return; |
| 748 |
} |
| 749 |
|
| 750 |
var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV; |
| 751 |
|
| 752 |
this._slide(direction, this._items[index]); |
| 753 |
}; |
| 754 |
|
| 755 |
_proto.dispose = function dispose() { |
| 756 |
$__default["default"](this._element).off(EVENT_KEY$8); |
| 757 |
$__default["default"].removeData(this._element, DATA_KEY$8); |
| 758 |
this._items = null; |
| 759 |
this._config = null; |
| 760 |
this._element = null; |
| 761 |
this._interval = null; |
| 762 |
this._isPaused = null; |
| 763 |
this._isSliding = null; |
| 764 |
this._activeElement = null; |
| 765 |
this._indicatorsElement = null; |
| 766 |
} // Private |
| 767 |
; |
| 768 |
|
| 769 |
_proto._getConfig = function _getConfig(config) { |
| 770 |
config = _extends$1({}, Default$7, config); |
| 771 |
Util.typeCheckConfig(NAME$8, config, DefaultType$7); |
| 772 |
return config; |
| 773 |
}; |
| 774 |
|
| 775 |
_proto._handleSwipe = function _handleSwipe() { |
| 776 |
var absDeltax = Math.abs(this.touchDeltaX); |
| 777 |
|
| 778 |
if (absDeltax <= SWIPE_THRESHOLD) { |
| 779 |
return; |
| 780 |
} |
| 781 |
|
| 782 |
var direction = absDeltax / this.touchDeltaX; |
| 783 |
this.touchDeltaX = 0; // swipe left |
| 784 |
|
| 785 |
if (direction > 0) { |
| 786 |
this.prev(); |
| 787 |
} // swipe right |
| 788 |
|
| 789 |
|
| 790 |
if (direction < 0) { |
| 791 |
this.next(); |
| 792 |
} |
| 793 |
}; |
| 794 |
|
| 795 |
_proto._addEventListeners = function _addEventListeners() { |
| 796 |
var _this2 = this; |
| 797 |
|
| 798 |
if (this._config.keyboard) { |
| 799 |
$__default["default"](this._element).on(EVENT_KEYDOWN, function (event) { |
| 800 |
return _this2._keydown(event); |
| 801 |
}); |
| 802 |
} |
| 803 |
|
| 804 |
if (this._config.pause === 'hover') { |
| 805 |
$__default["default"](this._element).on(EVENT_MOUSEENTER, function (event) { |
| 806 |
return _this2.pause(event); |
| 807 |
}).on(EVENT_MOUSELEAVE, function (event) { |
| 808 |
return _this2.cycle(event); |
| 809 |
}); |
| 810 |
} |
| 811 |
|
| 812 |
if (this._config.touch) { |
| 813 |
this._addTouchEventListeners(); |
| 814 |
} |
| 815 |
}; |
| 816 |
|
| 817 |
_proto._addTouchEventListeners = function _addTouchEventListeners() { |
| 818 |
var _this3 = this; |
| 819 |
|
| 820 |
if (!this._touchSupported) { |
| 821 |
return; |
| 822 |
} |
| 823 |
|
| 824 |
var start = function start(event) { |
| 825 |
if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { |
| 826 |
_this3.touchStartX = event.originalEvent.clientX; |
| 827 |
} else if (!_this3._pointerEvent) { |
| 828 |
_this3.touchStartX = event.originalEvent.touches[0].clientX; |
| 829 |
} |
| 830 |
}; |
| 831 |
|
| 832 |
var move = function move(event) { |
| 833 |
// ensure swiping with one touch and not pinching |
| 834 |
_this3.touchDeltaX = event.originalEvent.touches && event.originalEvent.touches.length > 1 ? 0 : event.originalEvent.touches[0].clientX - _this3.touchStartX; |
| 835 |
}; |
| 836 |
|
| 837 |
var end = function end(event) { |
| 838 |
if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { |
| 839 |
_this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX; |
| 840 |
} |
| 841 |
|
| 842 |
_this3._handleSwipe(); |
| 843 |
|
| 844 |
if (_this3._config.pause === 'hover') { |
| 845 |
// If it's a touch-enabled device, mouseenter/leave are fired as |
| 846 |
// part of the mouse compatibility events on first tap - the carousel |
| 847 |
// would stop cycling until user tapped out of it; |
| 848 |
// here, we listen for touchend, explicitly pause the carousel |
| 849 |
// (as if it's the second time we tap on it, mouseenter compat event |
| 850 |
// is NOT fired) and after a timeout (to allow for mouse compatibility |
| 851 |
// events to fire) we explicitly restart cycling |
| 852 |
_this3.pause(); |
| 853 |
|
| 854 |
if (_this3.touchTimeout) { |
| 855 |
clearTimeout(_this3.touchTimeout); |
| 856 |
} |
| 857 |
|
| 858 |
_this3.touchTimeout = setTimeout(function (event) { |
| 859 |
return _this3.cycle(event); |
| 860 |
}, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); |
| 861 |
} |
| 862 |
}; |
| 863 |
|
| 864 |
$__default["default"](this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) { |
| 865 |
return e.preventDefault(); |
| 866 |
}); |
| 867 |
|
| 868 |
if (this._pointerEvent) { |
| 869 |
$__default["default"](this._element).on(EVENT_POINTERDOWN, function (event) { |
| 870 |
return start(event); |
| 871 |
}); |
| 872 |
$__default["default"](this._element).on(EVENT_POINTERUP, function (event) { |
| 873 |
return end(event); |
| 874 |
}); |
| 875 |
|
| 876 |
this._element.classList.add(CLASS_NAME_POINTER_EVENT); |
| 877 |
} else { |
| 878 |
$__default["default"](this._element).on(EVENT_TOUCHSTART, function (event) { |
| 879 |
return start(event); |
| 880 |
}); |
| 881 |
$__default["default"](this._element).on(EVENT_TOUCHMOVE, function (event) { |
| 882 |
return move(event); |
| 883 |
}); |
| 884 |
$__default["default"](this._element).on(EVENT_TOUCHEND, function (event) { |
| 885 |
return end(event); |
| 886 |
}); |
| 887 |
} |
| 888 |
}; |
| 889 |
|
| 890 |
_proto._keydown = function _keydown(event) { |
| 891 |
if (/input|textarea/i.test(event.target.tagName)) { |
| 892 |
return; |
| 893 |
} |
| 894 |
|
| 895 |
switch (event.which) { |
| 896 |
case ARROW_LEFT_KEYCODE: |
| 897 |
event.preventDefault(); |
| 898 |
this.prev(); |
| 899 |
break; |
| 900 |
|
| 901 |
case ARROW_RIGHT_KEYCODE: |
| 902 |
event.preventDefault(); |
| 903 |
this.next(); |
| 904 |
break; |
| 905 |
} |
| 906 |
}; |
| 907 |
|
| 908 |
_proto._getItemIndex = function _getItemIndex(element) { |
| 909 |
this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : []; |
| 910 |
return this._items.indexOf(element); |
| 911 |
}; |
| 912 |
|
| 913 |
_proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { |
| 914 |
var isNextDirection = direction === DIRECTION_NEXT; |
| 915 |
var isPrevDirection = direction === DIRECTION_PREV; |
| 916 |
|
| 917 |
var activeIndex = this._getItemIndex(activeElement); |
| 918 |
|
| 919 |
var lastItemIndex = this._items.length - 1; |
| 920 |
var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; |
| 921 |
|
| 922 |
if (isGoingToWrap && !this._config.wrap) { |
| 923 |
return activeElement; |
| 924 |
} |
| 925 |
|
| 926 |
var delta = direction === DIRECTION_PREV ? -1 : 1; |
| 927 |
var itemIndex = (activeIndex + delta) % this._items.length; |
| 928 |
return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; |
| 929 |
}; |
| 930 |
|
| 931 |
_proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { |
| 932 |
var targetIndex = this._getItemIndex(relatedTarget); |
| 933 |
|
| 934 |
var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM)); |
| 935 |
|
| 936 |
var slideEvent = $__default["default"].Event(EVENT_SLIDE, { |
| 937 |
relatedTarget: relatedTarget, |
| 938 |
direction: eventDirectionName, |
| 939 |
from: fromIndex, |
| 940 |
to: targetIndex |
| 941 |
}); |
| 942 |
$__default["default"](this._element).trigger(slideEvent); |
| 943 |
return slideEvent; |
| 944 |
}; |
| 945 |
|
| 946 |
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { |
| 947 |
if (this._indicatorsElement) { |
| 948 |
var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1)); |
| 949 |
$__default["default"](indicators).removeClass(CLASS_NAME_ACTIVE$2); |
| 950 |
|
| 951 |
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; |
| 952 |
|
| 953 |
if (nextIndicator) { |
| 954 |
$__default["default"](nextIndicator).addClass(CLASS_NAME_ACTIVE$2); |
| 955 |
} |
| 956 |
} |
| 957 |
}; |
| 958 |
|
| 959 |
_proto._updateInterval = function _updateInterval() { |
| 960 |
var element = this._activeElement || this._element.querySelector(SELECTOR_ACTIVE_ITEM); |
| 961 |
|
| 962 |
if (!element) { |
| 963 |
return; |
| 964 |
} |
| 965 |
|
| 966 |
var elementInterval = parseInt(element.getAttribute('data-interval'), 10); |
| 967 |
|
| 968 |
if (elementInterval) { |
| 969 |
this._config.defaultInterval = this._config.defaultInterval || this._config.interval; |
| 970 |
this._config.interval = elementInterval; |
| 971 |
} else { |
| 972 |
this._config.interval = this._config.defaultInterval || this._config.interval; |
| 973 |
} |
| 974 |
}; |
| 975 |
|
| 976 |
_proto._slide = function _slide(direction, element) { |
| 977 |
var _this4 = this; |
| 978 |
|
| 979 |
var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); |
| 980 |
|
| 981 |
var activeElementIndex = this._getItemIndex(activeElement); |
| 982 |
|
| 983 |
var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); |
| 984 |
|
| 985 |
var nextElementIndex = this._getItemIndex(nextElement); |
| 986 |
|
| 987 |
var isCycling = Boolean(this._interval); |
| 988 |
var directionalClassName; |
| 989 |
var orderClassName; |
| 990 |
var eventDirectionName; |
| 991 |
|
| 992 |
if (direction === DIRECTION_NEXT) { |
| 993 |
directionalClassName = CLASS_NAME_LEFT; |
| 994 |
orderClassName = CLASS_NAME_NEXT; |
| 995 |
eventDirectionName = DIRECTION_LEFT; |
| 996 |
} else { |
| 997 |
directionalClassName = CLASS_NAME_RIGHT; |
| 998 |
orderClassName = CLASS_NAME_PREV; |
| 999 |
eventDirectionName = DIRECTION_RIGHT; |
| 1000 |
} |
| 1001 |
|
| 1002 |
if (nextElement && $__default["default"](nextElement).hasClass(CLASS_NAME_ACTIVE$2)) { |
| 1003 |
this._isSliding = false; |
| 1004 |
return; |
| 1005 |
} |
| 1006 |
|
| 1007 |
var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); |
| 1008 |
|
| 1009 |
if (slideEvent.isDefaultPrevented()) { |
| 1010 |
return; |
| 1011 |
} |
| 1012 |
|
| 1013 |
if (!activeElement || !nextElement) { |
| 1014 |
// Some weirdness is happening, so we bail |
| 1015 |
return; |
| 1016 |
} |
| 1017 |
|
| 1018 |
this._isSliding = true; |
| 1019 |
|
| 1020 |
if (isCycling) { |
| 1021 |
this.pause(); |
| 1022 |
} |
| 1023 |
|
| 1024 |
this._setActiveIndicatorElement(nextElement); |
| 1025 |
|
| 1026 |
this._activeElement = nextElement; |
| 1027 |
var slidEvent = $__default["default"].Event(EVENT_SLID, { |
| 1028 |
relatedTarget: nextElement, |
| 1029 |
direction: eventDirectionName, |
| 1030 |
from: activeElementIndex, |
| 1031 |
to: nextElementIndex |
| 1032 |
}); |
| 1033 |
|
| 1034 |
if ($__default["default"](this._element).hasClass(CLASS_NAME_SLIDE)) { |
| 1035 |
$__default["default"](nextElement).addClass(orderClassName); |
| 1036 |
Util.reflow(nextElement); |
| 1037 |
$__default["default"](activeElement).addClass(directionalClassName); |
| 1038 |
$__default["default"](nextElement).addClass(directionalClassName); |
| 1039 |
var transitionDuration = Util.getTransitionDurationFromElement(activeElement); |
| 1040 |
$__default["default"](activeElement).one(Util.TRANSITION_END, function () { |
| 1041 |
$__default["default"](nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE$2); |
| 1042 |
$__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$2 + " " + orderClassName + " " + directionalClassName); |
| 1043 |
_this4._isSliding = false; |
| 1044 |
setTimeout(function () { |
| 1045 |
return $__default["default"](_this4._element).trigger(slidEvent); |
| 1046 |
}, 0); |
| 1047 |
}).emulateTransitionEnd(transitionDuration); |
| 1048 |
} else { |
| 1049 |
$__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$2); |
| 1050 |
$__default["default"](nextElement).addClass(CLASS_NAME_ACTIVE$2); |
| 1051 |
this._isSliding = false; |
| 1052 |
$__default["default"](this._element).trigger(slidEvent); |
| 1053 |
} |
| 1054 |
|
| 1055 |
if (isCycling) { |
| 1056 |
this.cycle(); |
| 1057 |
} |
| 1058 |
} // Static |
| 1059 |
; |
| 1060 |
|
| 1061 |
Carousel._jQueryInterface = function _jQueryInterface(config) { |
| 1062 |
return this.each(function () { |
| 1063 |
var data = $__default["default"](this).data(DATA_KEY$8); |
| 1064 |
|
| 1065 |
var _config = _extends$1({}, Default$7, $__default["default"](this).data()); |
| 1066 |
|
| 1067 |
if (typeof config === 'object') { |
| 1068 |
_config = _extends$1({}, _config, config); |
| 1069 |
} |
| 1070 |
|
| 1071 |
var action = typeof config === 'string' ? config : _config.slide; |
| 1072 |
|
| 1073 |
if (!data) { |
| 1074 |
data = new Carousel(this, _config); |
| 1075 |
$__default["default"](this).data(DATA_KEY$8, data); |
| 1076 |
} |
| 1077 |
|
| 1078 |
if (typeof config === 'number') { |
| 1079 |
data.to(config); |
| 1080 |
} else if (typeof action === 'string') { |
| 1081 |
if (typeof data[action] === 'undefined') { |
| 1082 |
throw new TypeError("No method named \"" + action + "\""); |
| 1083 |
} |
| 1084 |
|
| 1085 |
data[action](); |
| 1086 |
} else if (_config.interval && _config.ride) { |
| 1087 |
data.pause(); |
| 1088 |
data.cycle(); |
| 1089 |
} |
| 1090 |
}); |
| 1091 |
}; |
| 1092 |
|
| 1093 |
Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { |
| 1094 |
var selector = Util.getSelectorFromElement(this); |
| 1095 |
|
| 1096 |
if (!selector) { |
| 1097 |
return; |
| 1098 |
} |
| 1099 |
|
| 1100 |
var target = $__default["default"](selector)[0]; |
| 1101 |
|
| 1102 |
if (!target || !$__default["default"](target).hasClass(CLASS_NAME_CAROUSEL)) { |
| 1103 |
return; |
| 1104 |
} |
| 1105 |
|
| 1106 |
var config = _extends$1({}, $__default["default"](target).data(), $__default["default"](this).data()); |
| 1107 |
|
| 1108 |
var slideIndex = this.getAttribute('data-slide-to'); |
| 1109 |
|
| 1110 |
if (slideIndex) { |
| 1111 |
config.interval = false; |
| 1112 |
} |
| 1113 |
|
| 1114 |
Carousel._jQueryInterface.call($__default["default"](target), config); |
| 1115 |
|
| 1116 |
if (slideIndex) { |
| 1117 |
$__default["default"](target).data(DATA_KEY$8).to(slideIndex); |
| 1118 |
} |
| 1119 |
|
| 1120 |
event.preventDefault(); |
| 1121 |
}; |
| 1122 |
|
| 1123 |
_createClass(Carousel, null, [{ |
| 1124 |
key: "VERSION", |
| 1125 |
get: function get() { |
| 1126 |
return VERSION$8; |
| 1127 |
} |
| 1128 |
}, { |
| 1129 |
key: "Default", |
| 1130 |
get: function get() { |
| 1131 |
return Default$7; |
| 1132 |
} |
| 1133 |
}]); |
| 1134 |
|
| 1135 |
return Carousel; |
| 1136 |
}(); |
| 1137 |
/** |
| 1138 |
* Data API implementation |
| 1139 |
*/ |
| 1140 |
|
| 1141 |
|
| 1142 |
$__default["default"](document).on(EVENT_CLICK_DATA_API$4, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler); |
| 1143 |
$__default["default"](window).on(EVENT_LOAD_DATA_API$1, function () { |
| 1144 |
var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE)); |
| 1145 |
|
| 1146 |
for (var i = 0, len = carousels.length; i < len; i++) { |
| 1147 |
var $carousel = $__default["default"](carousels[i]); |
| 1148 |
|
| 1149 |
Carousel._jQueryInterface.call($carousel, $carousel.data()); |
| 1150 |
} |
| 1151 |
}); |
| 1152 |
/** |
| 1153 |
* jQuery |
| 1154 |
*/ |
| 1155 |
|
| 1156 |
$__default["default"].fn[NAME$8] = Carousel._jQueryInterface; |
| 1157 |
$__default["default"].fn[NAME$8].Constructor = Carousel; |
| 1158 |
|
| 1159 |
$__default["default"].fn[NAME$8].noConflict = function () { |
| 1160 |
$__default["default"].fn[NAME$8] = JQUERY_NO_CONFLICT$8; |
| 1161 |
return Carousel._jQueryInterface; |
| 1162 |
}; |
| 1163 |
|
| 1164 |
/** |
| 1165 |
* Constants |
| 1166 |
*/ |
| 1167 |
|
| 1168 |
var NAME$7 = 'collapse'; |
| 1169 |
var VERSION$7 = '4.6.2'; |
| 1170 |
var DATA_KEY$7 = 'bs.collapse'; |
| 1171 |
var EVENT_KEY$7 = "." + DATA_KEY$7; |
| 1172 |
var DATA_API_KEY$4 = '.data-api'; |
| 1173 |
var JQUERY_NO_CONFLICT$7 = $__default["default"].fn[NAME$7]; |
| 1174 |
var CLASS_NAME_SHOW$6 = 'show'; |
| 1175 |
var CLASS_NAME_COLLAPSE = 'collapse'; |
| 1176 |
var CLASS_NAME_COLLAPSING = 'collapsing'; |
| 1177 |
var CLASS_NAME_COLLAPSED = 'collapsed'; |
| 1178 |
var DIMENSION_WIDTH = 'width'; |
| 1179 |
var DIMENSION_HEIGHT = 'height'; |
| 1180 |
var EVENT_SHOW$4 = "show" + EVENT_KEY$7; |
| 1181 |
var EVENT_SHOWN$4 = "shown" + EVENT_KEY$7; |
| 1182 |
var EVENT_HIDE$4 = "hide" + EVENT_KEY$7; |
| 1183 |
var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$7; |
| 1184 |
var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$7 + DATA_API_KEY$4; |
| 1185 |
var SELECTOR_ACTIVES = '.show, .collapsing'; |
| 1186 |
var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="collapse"]'; |
| 1187 |
var Default$6 = { |
| 1188 |
toggle: true, |
| 1189 |
parent: '' |
| 1190 |
}; |
| 1191 |
var DefaultType$6 = { |
| 1192 |
toggle: 'boolean', |
| 1193 |
parent: '(string|element)' |
| 1194 |
}; |
| 1195 |
/** |
| 1196 |
* Class definition |
| 1197 |
*/ |
| 1198 |
|
| 1199 |
var Collapse = /*#__PURE__*/function () { |
| 1200 |
function Collapse(element, config) { |
| 1201 |
this._isTransitioning = false; |
| 1202 |
this._element = element; |
| 1203 |
this._config = this._getConfig(config); |
| 1204 |
this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); |
| 1205 |
var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$3)); |
| 1206 |
|
| 1207 |
for (var i = 0, len = toggleList.length; i < len; i++) { |
| 1208 |
var elem = toggleList[i]; |
| 1209 |
var selector = Util.getSelectorFromElement(elem); |
| 1210 |
var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { |
| 1211 |
return foundElem === element; |
| 1212 |
}); |
| 1213 |
|
| 1214 |
if (selector !== null && filterElement.length > 0) { |
| 1215 |
this._selector = selector; |
| 1216 |
|
| 1217 |
this._triggerArray.push(elem); |
| 1218 |
} |
| 1219 |
} |
| 1220 |
|
| 1221 |
this._parent = this._config.parent ? this._getParent() : null; |
| 1222 |
|
| 1223 |
if (!this._config.parent) { |
| 1224 |
this._addAriaAndCollapsedClass(this._element, this._triggerArray); |
| 1225 |
} |
| 1226 |
|
| 1227 |
if (this._config.toggle) { |
| 1228 |
this.toggle(); |
| 1229 |
} |
| 1230 |
} // Getters |
| 1231 |
|
| 1232 |
|
| 1233 |
var _proto = Collapse.prototype; |
| 1234 |
|
| 1235 |
// Public |
| 1236 |
_proto.toggle = function toggle() { |
| 1237 |
if ($__default["default"](this._element).hasClass(CLASS_NAME_SHOW$6)) { |
| 1238 |
this.hide(); |
| 1239 |
} else { |
| 1240 |
this.show(); |
| 1241 |
} |
| 1242 |
}; |
| 1243 |
|
| 1244 |
_proto.show = function show() { |
| 1245 |
var _this = this; |
| 1246 |
|
| 1247 |
if (this._isTransitioning || $__default["default"](this._element).hasClass(CLASS_NAME_SHOW$6)) { |
| 1248 |
return; |
| 1249 |
} |
| 1250 |
|
| 1251 |
var actives; |
| 1252 |
var activesData; |
| 1253 |
|
| 1254 |
if (this._parent) { |
| 1255 |
actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) { |
| 1256 |
if (typeof _this._config.parent === 'string') { |
| 1257 |
return elem.getAttribute('data-parent') === _this._config.parent; |
| 1258 |
} |
| 1259 |
|
| 1260 |
return elem.classList.contains(CLASS_NAME_COLLAPSE); |
| 1261 |
}); |
| 1262 |
|
| 1263 |
if (actives.length === 0) { |
| 1264 |
actives = null; |
| 1265 |
} |
| 1266 |
} |
| 1267 |
|
| 1268 |
if (actives) { |
| 1269 |
activesData = $__default["default"](actives).not(this._selector).data(DATA_KEY$7); |
| 1270 |
|
| 1271 |
if (activesData && activesData._isTransitioning) { |
| 1272 |
return; |
| 1273 |
} |
| 1274 |
} |
| 1275 |
|
| 1276 |
var startEvent = $__default["default"].Event(EVENT_SHOW$4); |
| 1277 |
$__default["default"](this._element).trigger(startEvent); |
| 1278 |
|
| 1279 |
if (startEvent.isDefaultPrevented()) { |
| 1280 |
return; |
| 1281 |
} |
| 1282 |
|
| 1283 |
if (actives) { |
| 1284 |
Collapse._jQueryInterface.call($__default["default"](actives).not(this._selector), 'hide'); |
| 1285 |
|
| 1286 |
if (!activesData) { |
| 1287 |
$__default["default"](actives).data(DATA_KEY$7, null); |
| 1288 |
} |
| 1289 |
} |
| 1290 |
|
| 1291 |
var dimension = this._getDimension(); |
| 1292 |
|
| 1293 |
$__default["default"](this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING); |
| 1294 |
this._element.style[dimension] = 0; |
| 1295 |
|
| 1296 |
if (this._triggerArray.length) { |
| 1297 |
$__default["default"](this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true); |
| 1298 |
} |
| 1299 |
|
| 1300 |
this.setTransitioning(true); |
| 1301 |
|
| 1302 |
var complete = function complete() { |
| 1303 |
$__default["default"](_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$6); |
| 1304 |
_this._element.style[dimension] = ''; |
| 1305 |
|
| 1306 |
_this.setTransitioning(false); |
| 1307 |
|
| 1308 |
$__default["default"](_this._element).trigger(EVENT_SHOWN$4); |
| 1309 |
}; |
| 1310 |
|
| 1311 |
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); |
| 1312 |
var scrollSize = "scroll" + capitalizedDimension; |
| 1313 |
var transitionDuration = Util.getTransitionDurationFromElement(this._element); |
| 1314 |
$__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); |
| 1315 |
this._element.style[dimension] = this._element[scrollSize] + "px"; |
| 1316 |
}; |
| 1317 |
|
| 1318 |
_proto.hide = function hide() { |
| 1319 |
var _this2 = this; |
| 1320 |
|
| 1321 |
if (this._isTransitioning || !$__default["default"](this._element).hasClass(CLASS_NAME_SHOW$6)) { |
| 1322 |
return; |
| 1323 |
} |
| 1324 |
|
| 1325 |
var startEvent = $__default["default"].Event(EVENT_HIDE$4); |
| 1326 |
$__default["default"](this._element).trigger(startEvent); |
| 1327 |
|
| 1328 |
if (startEvent.isDefaultPrevented()) { |
| 1329 |
return; |
| 1330 |
} |
| 1331 |
|
| 1332 |
var dimension = this._getDimension(); |
| 1333 |
|
| 1334 |
this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; |
| 1335 |
Util.reflow(this._element); |
| 1336 |
$__default["default"](this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$6); |
| 1337 |
var triggerArrayLength = this._triggerArray.length; |
| 1338 |
|
| 1339 |
if (triggerArrayLength > 0) { |
| 1340 |
for (var i = 0; i < triggerArrayLength; i++) { |
| 1341 |
var trigger = this._triggerArray[i]; |
| 1342 |
var selector = Util.getSelectorFromElement(trigger); |
| 1343 |
|
| 1344 |
if (selector !== null) { |
| 1345 |
var $elem = $__default["default"]([].slice.call(document.querySelectorAll(selector))); |
| 1346 |
|
| 1347 |
if (!$elem.hasClass(CLASS_NAME_SHOW$6)) { |
| 1348 |
$__default["default"](trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false); |
| 1349 |
} |
| 1350 |
} |
| 1351 |
} |
| 1352 |
} |
| 1353 |
|
| 1354 |
this.setTransitioning(true); |
| 1355 |
|
| 1356 |
var complete = function complete() { |
| 1357 |
_this2.setTransitioning(false); |
| 1358 |
|
| 1359 |
$__default["default"](_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN$4); |
| 1360 |
}; |
| 1361 |
|
| 1362 |
this._element.style[dimension] = ''; |
| 1363 |
var transitionDuration = Util.getTransitionDurationFromElement(this._element); |
| 1364 |
$__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); |
| 1365 |
}; |
| 1366 |
|
| 1367 |
_proto.setTransitioning = function setTransitioning(isTransitioning) { |
| 1368 |
this._isTransitioning = isTransitioning; |
| 1369 |
}; |
| 1370 |
|
| 1371 |
_proto.dispose = function dispose() { |
| 1372 |
$__default["default"].removeData(this._element, DATA_KEY$7); |
| 1373 |
this._config = null; |
| 1374 |
this._parent = null; |
| 1375 |
this._element = null; |
| 1376 |
this._triggerArray = null; |
| 1377 |
this._isTransitioning = null; |
| 1378 |
} // Private |
| 1379 |
; |
| 1380 |
|
| 1381 |
_proto._getConfig = function _getConfig(config) { |
| 1382 |
config = _extends$1({}, Default$6, config); |
| 1383 |
config.toggle = Boolean(config.toggle); // Coerce string values |
| 1384 |
|
| 1385 |
Util.typeCheckConfig(NAME$7, config, DefaultType$6); |
| 1386 |
return config; |
| 1387 |
}; |
| 1388 |
|
| 1389 |
_proto._getDimension = function _getDimension() { |
| 1390 |
var hasWidth = $__default["default"](this._element).hasClass(DIMENSION_WIDTH); |
| 1391 |
return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT; |
| 1392 |
}; |
| 1393 |
|
| 1394 |
_proto._getParent = function _getParent() { |
| 1395 |
var _this3 = this; |
| 1396 |
|
| 1397 |
var parent; |
| 1398 |
|
| 1399 |
if (Util.isElement(this._config.parent)) { |
| 1400 |
parent = this._config.parent; // It's a jQuery object |
| 1401 |
|
| 1402 |
if (typeof this._config.parent.jquery !== 'undefined') { |
| 1403 |
parent = this._config.parent[0]; |
| 1404 |
} |
| 1405 |
} else { |
| 1406 |
parent = document.querySelector(this._config.parent); |
| 1407 |
} |
| 1408 |
|
| 1409 |
var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; |
| 1410 |
var children = [].slice.call(parent.querySelectorAll(selector)); |
| 1411 |
$__default["default"](children).each(function (i, element) { |
| 1412 |
_this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); |
| 1413 |
}); |
| 1414 |
return parent; |
| 1415 |
}; |
| 1416 |
|
| 1417 |
_proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { |
| 1418 |
var isOpen = $__default["default"](element).hasClass(CLASS_NAME_SHOW$6); |
| 1419 |
|
| 1420 |
if (triggerArray.length) { |
| 1421 |
$__default["default"](triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen); |
| 1422 |
} |
| 1423 |
} // Static |
| 1424 |
; |
| 1425 |
|
| 1426 |
Collapse._getTargetFromElement = function _getTargetFromElement(element) { |
| 1427 |
var selector = Util.getSelectorFromElement(element); |
| 1428 |
return selector ? document.querySelector(selector) : null; |
| 1429 |
}; |
| 1430 |
|
| 1431 |
Collapse._jQueryInterface = function _jQueryInterface(config) { |
| 1432 |
return this.each(function () { |
| 1433 |
var $element = $__default["default"](this); |
| 1434 |
var data = $element.data(DATA_KEY$7); |
| 1435 |
|
| 1436 |
var _config = _extends$1({}, Default$6, $element.data(), typeof config === 'object' && config ? config : {}); |
| 1437 |
|
| 1438 |
if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) { |
| 1439 |
_config.toggle = false; |
| 1440 |
} |
| 1441 |
|
| 1442 |
if (!data) { |
| 1443 |
data = new Collapse(this, _config); |
| 1444 |
$element.data(DATA_KEY$7, data); |
| 1445 |
} |
| 1446 |
|
| 1447 |
if (typeof config === 'string') { |
| 1448 |
if (typeof data[config] === 'undefined') { |
| 1449 |
throw new TypeError("No method named \"" + config + "\""); |
| 1450 |
} |
| 1451 |
|
| 1452 |
data[config](); |
| 1453 |
} |
| 1454 |
}); |
| 1455 |
}; |
| 1456 |
|
| 1457 |
_createClass(Collapse, null, [{ |
| 1458 |
key: "VERSION", |
| 1459 |
get: function get() { |
| 1460 |
return VERSION$7; |
| 1461 |
} |
| 1462 |
}, { |
| 1463 |
key: "Default", |
| 1464 |
get: function get() { |
| 1465 |
return Default$6; |
| 1466 |
} |
| 1467 |
}]); |
| 1468 |
|
| 1469 |
return Collapse; |
| 1470 |
}(); |
| 1471 |
/** |
| 1472 |
* Data API implementation |
| 1473 |
*/ |
| 1474 |
|
| 1475 |
|
| 1476 |
$__default["default"](document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) { |
| 1477 |
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element |
| 1478 |
if (event.currentTarget.tagName === 'A') { |
| 1479 |
event.preventDefault(); |
| 1480 |
} |
| 1481 |
|
| 1482 |
var $trigger = $__default["default"](this); |
| 1483 |
var selector = Util.getSelectorFromElement(this); |
| 1484 |
var selectors = [].slice.call(document.querySelectorAll(selector)); |
| 1485 |
$__default["default"](selectors).each(function () { |
| 1486 |
var $target = $__default["default"](this); |
| 1487 |
var data = $target.data(DATA_KEY$7); |
| 1488 |
var config = data ? 'toggle' : $trigger.data(); |
| 1489 |
|
| 1490 |
Collapse._jQueryInterface.call($target, config); |
| 1491 |
}); |
| 1492 |
}); |
| 1493 |
/** |
| 1494 |
* jQuery |
| 1495 |
*/ |
| 1496 |
|
| 1497 |
$__default["default"].fn[NAME$7] = Collapse._jQueryInterface; |
| 1498 |
$__default["default"].fn[NAME$7].Constructor = Collapse; |
| 1499 |
|
| 1500 |
$__default["default"].fn[NAME$7].noConflict = function () { |
| 1501 |
$__default["default"].fn[NAME$7] = JQUERY_NO_CONFLICT$7; |
| 1502 |
return Collapse._jQueryInterface; |
| 1503 |
}; |
| 1504 |
|
| 1505 |
/**! |
| 1506 |
* @fileOverview Kickass library to create and place poppers near their reference elements. |
| 1507 |
* @version 1.16.1 |
| 1508 |
* @license |
| 1509 |
* Copyright (c) 2016 Federico Zivolo and contributors |
| 1510 |
* |
| 1511 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
| 1512 |
* of this software and associated documentation files (the "Software"), to deal |
| 1513 |
* in the Software without restriction, including without limitation the rights |
| 1514 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 1515 |
* copies of the Software, and to permit persons to whom the Software is |
| 1516 |
* furnished to do so, subject to the following conditions: |
| 1517 |
* |
| 1518 |
* The above copyright notice and this permission notice shall be included in all |
| 1519 |
* copies or substantial portions of the Software. |
| 1520 |
* |
| 1521 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 1522 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 1523 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 1524 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 1525 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 1526 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 1527 |
* SOFTWARE. |
| 1528 |
*/ |
| 1529 |
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined'; |
| 1530 |
|
| 1531 |
var timeoutDuration = function () { |
| 1532 |
var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; |
| 1533 |
for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { |
| 1534 |
if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { |
| 1535 |
return 1; |
| 1536 |
} |
| 1537 |
} |
| 1538 |
return 0; |
| 1539 |
}(); |
| 1540 |
|
| 1541 |
function microtaskDebounce(fn) { |
| 1542 |
var called = false; |
| 1543 |
return function () { |
| 1544 |
if (called) { |
| 1545 |
return; |
| 1546 |
} |
| 1547 |
called = true; |
| 1548 |
window.Promise.resolve().then(function () { |
| 1549 |
called = false; |
| 1550 |
fn(); |
| 1551 |
}); |
| 1552 |
}; |
| 1553 |
} |
| 1554 |
|
| 1555 |
function taskDebounce(fn) { |
| 1556 |
var scheduled = false; |
| 1557 |
return function () { |
| 1558 |
if (!scheduled) { |
| 1559 |
scheduled = true; |
| 1560 |
setTimeout(function () { |
| 1561 |
scheduled = false; |
| 1562 |
fn(); |
| 1563 |
}, timeoutDuration); |
| 1564 |
} |
| 1565 |
}; |
| 1566 |
} |
| 1567 |
|
| 1568 |
var supportsMicroTasks = isBrowser && window.Promise; |
| 1569 |
|
| 1570 |
/** |
| 1571 |
* Create a debounced version of a method, that's asynchronously deferred |
| 1572 |
* but called in the minimum time possible. |
| 1573 |
* |
| 1574 |
* @method |
| 1575 |
* @memberof Popper.Utils |
| 1576 |
* @argument {Function} fn |
| 1577 |
* @returns {Function} |
| 1578 |
*/ |
| 1579 |
var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; |
| 1580 |
|
| 1581 |
/** |
| 1582 |
* Check if the given variable is a function |
| 1583 |
* @method |
| 1584 |
* @memberof Popper.Utils |
| 1585 |
* @argument {Any} functionToCheck - variable to check |
| 1586 |
* @returns {Boolean} answer to: is a function? |
| 1587 |
*/ |
| 1588 |
function isFunction(functionToCheck) { |
| 1589 |
var getType = {}; |
| 1590 |
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; |
| 1591 |
} |
| 1592 |
|
| 1593 |
/** |
| 1594 |
* Get CSS computed property of the given element |
| 1595 |
* @method |
| 1596 |
* @memberof Popper.Utils |
| 1597 |
* @argument {Eement} element |
| 1598 |
* @argument {String} property |
| 1599 |
*/ |
| 1600 |
function getStyleComputedProperty(element, property) { |
| 1601 |
if (element.nodeType !== 1) { |
| 1602 |
return []; |
| 1603 |
} |
| 1604 |
// NOTE: 1 DOM access here |
| 1605 |
var window = element.ownerDocument.defaultView; |
| 1606 |
var css = window.getComputedStyle(element, null); |
| 1607 |
return property ? css[property] : css; |
| 1608 |
} |
| 1609 |
|
| 1610 |
/** |
| 1611 |
* Returns the parentNode or the host of the element |
| 1612 |
* @method |
| 1613 |
* @memberof Popper.Utils |
| 1614 |
* @argument {Element} element |
| 1615 |
* @returns {Element} parent |
| 1616 |
*/ |
| 1617 |
function getParentNode(element) { |
| 1618 |
if (element.nodeName === 'HTML') { |
| 1619 |
return element; |
| 1620 |
} |
| 1621 |
return element.parentNode || element.host; |
| 1622 |
} |
| 1623 |
|
| 1624 |
/** |
| 1625 |
* Returns the scrolling parent of the given element |
| 1626 |
* @method |
| 1627 |
* @memberof Popper.Utils |
| 1628 |
* @argument {Element} element |
| 1629 |
* @returns {Element} scroll parent |
| 1630 |
*/ |
| 1631 |
function getScrollParent(element) { |
| 1632 |
// Return body, `getScroll` will take care to get the correct `scrollTop` from it |
| 1633 |
if (!element) { |
| 1634 |
return document.body; |
| 1635 |
} |
| 1636 |
|
| 1637 |
switch (element.nodeName) { |
| 1638 |
case 'HTML': |
| 1639 |
case 'BODY': |
| 1640 |
return element.ownerDocument.body; |
| 1641 |
case '#document': |
| 1642 |
return element.body; |
| 1643 |
} |
| 1644 |
|
| 1645 |
// Firefox want us to check `-x` and `-y` variations as well |
| 1646 |
|
| 1647 |
var _getStyleComputedProp = getStyleComputedProperty(element), |
| 1648 |
overflow = _getStyleComputedProp.overflow, |
| 1649 |
overflowX = _getStyleComputedProp.overflowX, |
| 1650 |
overflowY = _getStyleComputedProp.overflowY; |
| 1651 |
|
| 1652 |
if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { |
| 1653 |
return element; |
| 1654 |
} |
| 1655 |
|
| 1656 |
return getScrollParent(getParentNode(element)); |
| 1657 |
} |
| 1658 |
|
| 1659 |
/** |
| 1660 |
* Returns the reference node of the reference object, or the reference object itself. |
| 1661 |
* @method |
| 1662 |
* @memberof Popper.Utils |
| 1663 |
* @param {Element|Object} reference - the reference element (the popper will be relative to this) |
| 1664 |
* @returns {Element} parent |
| 1665 |
*/ |
| 1666 |
function getReferenceNode(reference) { |
| 1667 |
return reference && reference.referenceNode ? reference.referenceNode : reference; |
| 1668 |
} |
| 1669 |
|
| 1670 |
var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); |
| 1671 |
var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); |
| 1672 |
|
| 1673 |
/** |
| 1674 |
* Determines if the browser is Internet Explorer |
| 1675 |
* @method |
| 1676 |
* @memberof Popper.Utils |
| 1677 |
* @param {Number} version to check |
| 1678 |
* @returns {Boolean} isIE |
| 1679 |
*/ |
| 1680 |
function isIE(version) { |
| 1681 |
if (version === 11) { |
| 1682 |
return isIE11; |
| 1683 |
} |
| 1684 |
if (version === 10) { |
| 1685 |
return isIE10; |
| 1686 |
} |
| 1687 |
return isIE11 || isIE10; |
| 1688 |
} |
| 1689 |
|
| 1690 |
/** |
| 1691 |
* Returns the offset parent of the given element |
| 1692 |
* @method |
| 1693 |
* @memberof Popper.Utils |
| 1694 |
* @argument {Element} element |
| 1695 |
* @returns {Element} offset parent |
| 1696 |
*/ |
| 1697 |
function getOffsetParent(element) { |
| 1698 |
if (!element) { |
| 1699 |
return document.documentElement; |
| 1700 |
} |
| 1701 |
|
| 1702 |
var noOffsetParent = isIE(10) ? document.body : null; |
| 1703 |
|
| 1704 |
// NOTE: 1 DOM access here |
| 1705 |
var offsetParent = element.offsetParent || null; |
| 1706 |
// Skip hidden elements which don't have an offsetParent |
| 1707 |
while (offsetParent === noOffsetParent && element.nextElementSibling) { |
| 1708 |
offsetParent = (element = element.nextElementSibling).offsetParent; |
| 1709 |
} |
| 1710 |
|
| 1711 |
var nodeName = offsetParent && offsetParent.nodeName; |
| 1712 |
|
| 1713 |
if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { |
| 1714 |
return element ? element.ownerDocument.documentElement : document.documentElement; |
| 1715 |
} |
| 1716 |
|
| 1717 |
// .offsetParent will return the closest TH, TD or TABLE in case |
| 1718 |
// no offsetParent is present, I hate this job... |
| 1719 |
if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { |
| 1720 |
return getOffsetParent(offsetParent); |
| 1721 |
} |
| 1722 |
|
| 1723 |
return offsetParent; |
| 1724 |
} |
| 1725 |
|
| 1726 |
function isOffsetContainer(element) { |
| 1727 |
var nodeName = element.nodeName; |
| 1728 |
|
| 1729 |
if (nodeName === 'BODY') { |
| 1730 |
return false; |
| 1731 |
} |
| 1732 |
return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; |
| 1733 |
} |
| 1734 |
|
| 1735 |
/** |
| 1736 |
* Finds the root node (document, shadowDOM root) of the given element |
| 1737 |
* @method |
| 1738 |
* @memberof Popper.Utils |
| 1739 |
* @argument {Element} node |
| 1740 |
* @returns {Element} root node |
| 1741 |
*/ |
| 1742 |
function getRoot(node) { |
| 1743 |
if (node.parentNode !== null) { |
| 1744 |
return getRoot(node.parentNode); |
| 1745 |
} |
| 1746 |
|
| 1747 |
return node; |
| 1748 |
} |
| 1749 |
|
| 1750 |
/** |
| 1751 |
* Finds the offset parent common to the two provided nodes |
| 1752 |
* @method |
| 1753 |
* @memberof Popper.Utils |
| 1754 |
* @argument {Element} element1 |
| 1755 |
* @argument {Element} element2 |
| 1756 |
* @returns {Element} common offset parent |
| 1757 |
*/ |
| 1758 |
function findCommonOffsetParent(element1, element2) { |
| 1759 |
// This check is needed to avoid errors in case one of the elements isn't defined for any reason |
| 1760 |
if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { |
| 1761 |
return document.documentElement; |
| 1762 |
} |
| 1763 |
|
| 1764 |
// Here we make sure to give as "start" the element that comes first in the DOM |
| 1765 |
var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; |
| 1766 |
var start = order ? element1 : element2; |
| 1767 |
var end = order ? element2 : element1; |
| 1768 |
|
| 1769 |
// Get common ancestor container |
| 1770 |
var range = document.createRange(); |
| 1771 |
range.setStart(start, 0); |
| 1772 |
range.setEnd(end, 0); |
| 1773 |
var commonAncestorContainer = range.commonAncestorContainer; |
| 1774 |
|
| 1775 |
// Both nodes are inside #document |
| 1776 |
|
| 1777 |
if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { |
| 1778 |
if (isOffsetContainer(commonAncestorContainer)) { |
| 1779 |
return commonAncestorContainer; |
| 1780 |
} |
| 1781 |
|
| 1782 |
return getOffsetParent(commonAncestorContainer); |
| 1783 |
} |
| 1784 |
|
| 1785 |
// one of the nodes is inside shadowDOM, find which one |
| 1786 |
var element1root = getRoot(element1); |
| 1787 |
if (element1root.host) { |
| 1788 |
return findCommonOffsetParent(element1root.host, element2); |
| 1789 |
} else { |
| 1790 |
return findCommonOffsetParent(element1, getRoot(element2).host); |
| 1791 |
} |
| 1792 |
} |
| 1793 |
|
| 1794 |
/** |
| 1795 |
* Gets the scroll value of the given element in the given side (top and left) |
| 1796 |
* @method |
| 1797 |
* @memberof Popper.Utils |
| 1798 |
* @argument {Element} element |
| 1799 |
* @argument {String} side `top` or `left` |
| 1800 |
* @returns {number} amount of scrolled pixels |
| 1801 |
*/ |
| 1802 |
function getScroll(element) { |
| 1803 |
var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; |
| 1804 |
|
| 1805 |
var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; |
| 1806 |
var nodeName = element.nodeName; |
| 1807 |
|
| 1808 |
if (nodeName === 'BODY' || nodeName === 'HTML') { |
| 1809 |
var html = element.ownerDocument.documentElement; |
| 1810 |
var scrollingElement = element.ownerDocument.scrollingElement || html; |
| 1811 |
return scrollingElement[upperSide]; |
| 1812 |
} |
| 1813 |
|
| 1814 |
return element[upperSide]; |
| 1815 |
} |
| 1816 |
|
| 1817 |
/* |
| 1818 |
* Sum or subtract the element scroll values (left and top) from a given rect object |
| 1819 |
* @method |
| 1820 |
* @memberof Popper.Utils |
| 1821 |
* @param {Object} rect - Rect object you want to change |
| 1822 |
* @param {HTMLElement} element - The element from the function reads the scroll values |
| 1823 |
* @param {Boolean} subtract - set to true if you want to subtract the scroll values |
| 1824 |
* @return {Object} rect - The modifier rect object |
| 1825 |
*/ |
| 1826 |
function includeScroll(rect, element) { |
| 1827 |
var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; |
| 1828 |
|
| 1829 |
var scrollTop = getScroll(element, 'top'); |
| 1830 |
var scrollLeft = getScroll(element, 'left'); |
| 1831 |
var modifier = subtract ? -1 : 1; |
| 1832 |
rect.top += scrollTop * modifier; |
| 1833 |
rect.bottom += scrollTop * modifier; |
| 1834 |
rect.left += scrollLeft * modifier; |
| 1835 |
rect.right += scrollLeft * modifier; |
| 1836 |
return rect; |
| 1837 |
} |
| 1838 |
|
| 1839 |
/* |
| 1840 |
* Helper to detect borders of a given element |
| 1841 |
* @method |
| 1842 |
* @memberof Popper.Utils |
| 1843 |
* @param {CSSStyleDeclaration} styles |
| 1844 |
* Result of `getStyleComputedProperty` on the given element |
| 1845 |
* @param {String} axis - `x` or `y` |
| 1846 |
* @return {number} borders - The borders size of the given axis |
| 1847 |
*/ |
| 1848 |
|
| 1849 |
function getBordersSize(styles, axis) { |
| 1850 |
var sideA = axis === 'x' ? 'Left' : 'Top'; |
| 1851 |
var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; |
| 1852 |
|
| 1853 |
return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']); |
| 1854 |
} |
| 1855 |
|
| 1856 |
function getSize(axis, body, html, computedStyle) { |
| 1857 |
return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0); |
| 1858 |
} |
| 1859 |
|
| 1860 |
function getWindowSizes(document) { |
| 1861 |
var body = document.body; |
| 1862 |
var html = document.documentElement; |
| 1863 |
var computedStyle = isIE(10) && getComputedStyle(html); |
| 1864 |
|
| 1865 |
return { |
| 1866 |
height: getSize('Height', body, html, computedStyle), |
| 1867 |
width: getSize('Width', body, html, computedStyle) |
| 1868 |
}; |
| 1869 |
} |
| 1870 |
|
| 1871 |
var classCallCheck = function (instance, Constructor) { |
| 1872 |
if (!(instance instanceof Constructor)) { |
| 1873 |
throw new TypeError("Cannot call a class as a function"); |
| 1874 |
} |
| 1875 |
}; |
| 1876 |
|
| 1877 |
var createClass = function () { |
| 1878 |
function defineProperties(target, props) { |
| 1879 |
for (var i = 0; i < props.length; i++) { |
| 1880 |
var descriptor = props[i]; |
| 1881 |
descriptor.enumerable = descriptor.enumerable || false; |
| 1882 |
descriptor.configurable = true; |
| 1883 |
if ("value" in descriptor) descriptor.writable = true; |
| 1884 |
Object.defineProperty(target, descriptor.key, descriptor); |
| 1885 |
} |
| 1886 |
} |
| 1887 |
|
| 1888 |
return function (Constructor, protoProps, staticProps) { |
| 1889 |
if (protoProps) defineProperties(Constructor.prototype, protoProps); |
| 1890 |
if (staticProps) defineProperties(Constructor, staticProps); |
| 1891 |
return Constructor; |
| 1892 |
}; |
| 1893 |
}(); |
| 1894 |
|
| 1895 |
|
| 1896 |
|
| 1897 |
|
| 1898 |
|
| 1899 |
var defineProperty = function (obj, key, value) { |
| 1900 |
if (key in obj) { |
| 1901 |
Object.defineProperty(obj, key, { |
| 1902 |
value: value, |
| 1903 |
enumerable: true, |
| 1904 |
configurable: true, |
| 1905 |
writable: true |
| 1906 |
}); |
| 1907 |
} else { |
| 1908 |
obj[key] = value; |
| 1909 |
} |
| 1910 |
|
| 1911 |
return obj; |
| 1912 |
}; |
| 1913 |
|
| 1914 |
var _extends = Object.assign || function (target) { |
| 1915 |
for (var i = 1; i < arguments.length; i++) { |
| 1916 |
var source = arguments[i]; |
| 1917 |
|
| 1918 |
for (var key in source) { |
| 1919 |
if (Object.prototype.hasOwnProperty.call(source, key)) { |
| 1920 |
target[key] = source[key]; |
| 1921 |
} |
| 1922 |
} |
| 1923 |
} |
| 1924 |
|
| 1925 |
return target; |
| 1926 |
}; |
| 1927 |
|
| 1928 |
/** |
| 1929 |
* Given element offsets, generate an output similar to getBoundingClientRect |
| 1930 |
* @method |
| 1931 |
* @memberof Popper.Utils |
| 1932 |
* @argument {Object} offsets |
| 1933 |
* @returns {Object} ClientRect like output |
| 1934 |
*/ |
| 1935 |
function getClientRect(offsets) { |
| 1936 |
return _extends({}, offsets, { |
| 1937 |
right: offsets.left + offsets.width, |
| 1938 |
bottom: offsets.top + offsets.height |
| 1939 |
}); |
| 1940 |
} |
| 1941 |
|
| 1942 |
/** |
| 1943 |
* Get bounding client rect of given element |
| 1944 |
* @method |
| 1945 |
* @memberof Popper.Utils |
| 1946 |
* @param {HTMLElement} element |
| 1947 |
* @return {Object} client rect |
| 1948 |
*/ |
| 1949 |
function getBoundingClientRect(element) { |
| 1950 |
var rect = {}; |
| 1951 |
|
| 1952 |
// IE10 10 FIX: Please, don't ask, the element isn't |
| 1953 |
// considered in DOM in some circumstances... |
| 1954 |
// This isn't reproducible in IE10 compatibility mode of IE11 |
| 1955 |
try { |
| 1956 |
if (isIE(10)) { |
| 1957 |
rect = element.getBoundingClientRect(); |
| 1958 |
var scrollTop = getScroll(element, 'top'); |
| 1959 |
var scrollLeft = getScroll(element, 'left'); |
| 1960 |
rect.top += scrollTop; |
| 1961 |
rect.left += scrollLeft; |
| 1962 |
rect.bottom += scrollTop; |
| 1963 |
rect.right += scrollLeft; |
| 1964 |
} else { |
| 1965 |
rect = element.getBoundingClientRect(); |
| 1966 |
} |
| 1967 |
} catch (e) {} |
| 1968 |
|
| 1969 |
var result = { |
| 1970 |
left: rect.left, |
| 1971 |
top: rect.top, |
| 1972 |
width: rect.right - rect.left, |
| 1973 |
height: rect.bottom - rect.top |
| 1974 |
}; |
| 1975 |
|
| 1976 |
// subtract scrollbar size from sizes |
| 1977 |
var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; |
| 1978 |
var width = sizes.width || element.clientWidth || result.width; |
| 1979 |
var height = sizes.height || element.clientHeight || result.height; |
| 1980 |
|
| 1981 |
var horizScrollbar = element.offsetWidth - width; |
| 1982 |
var vertScrollbar = element.offsetHeight - height; |
| 1983 |
|
| 1984 |
// if an hypothetical scrollbar is detected, we must be sure it's not a `border` |
| 1985 |
// we make this check conditional for performance reasons |
| 1986 |
if (horizScrollbar || vertScrollbar) { |
| 1987 |
var styles = getStyleComputedProperty(element); |
| 1988 |
horizScrollbar -= getBordersSize(styles, 'x'); |
| 1989 |
vertScrollbar -= getBordersSize(styles, 'y'); |
| 1990 |
|
| 1991 |
result.width -= horizScrollbar; |
| 1992 |
result.height -= vertScrollbar; |
| 1993 |
} |
| 1994 |
|
| 1995 |
return getClientRect(result); |
| 1996 |
} |
| 1997 |
|
| 1998 |
function getOffsetRectRelativeToArbitraryNode(children, parent) { |
| 1999 |
var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; |
| 2000 |
|
| 2001 |
var isIE10 = isIE(10); |
| 2002 |
var isHTML = parent.nodeName === 'HTML'; |
| 2003 |
var childrenRect = getBoundingClientRect(children); |
| 2004 |
var parentRect = getBoundingClientRect(parent); |
| 2005 |
var scrollParent = getScrollParent(children); |
| 2006 |
|
| 2007 |
var styles = getStyleComputedProperty(parent); |
| 2008 |
var borderTopWidth = parseFloat(styles.borderTopWidth); |
| 2009 |
var borderLeftWidth = parseFloat(styles.borderLeftWidth); |
| 2010 |
|
| 2011 |
// In cases where the parent is fixed, we must ignore negative scroll in offset calc |
| 2012 |
if (fixedPosition && isHTML) { |
| 2013 |
parentRect.top = Math.max(parentRect.top, 0); |
| 2014 |
parentRect.left = Math.max(parentRect.left, 0); |
| 2015 |
} |
| 2016 |
var offsets = getClientRect({ |
| 2017 |
top: childrenRect.top - parentRect.top - borderTopWidth, |
| 2018 |
left: childrenRect.left - parentRect.left - borderLeftWidth, |
| 2019 |
width: childrenRect.width, |
| 2020 |
height: childrenRect.height |
| 2021 |
}); |
| 2022 |
offsets.marginTop = 0; |
| 2023 |
offsets.marginLeft = 0; |
| 2024 |
|
| 2025 |
// Subtract margins of documentElement in case it's being used as parent |
| 2026 |
// we do this only on HTML because it's the only element that behaves |
| 2027 |
// differently when margins are applied to it. The margins are included in |
| 2028 |
// the box of the documentElement, in the other cases not. |
| 2029 |
if (!isIE10 && isHTML) { |
| 2030 |
var marginTop = parseFloat(styles.marginTop); |
| 2031 |
var marginLeft = parseFloat(styles.marginLeft); |
| 2032 |
|
| 2033 |
offsets.top -= borderTopWidth - marginTop; |
| 2034 |
offsets.bottom -= borderTopWidth - marginTop; |
| 2035 |
offsets.left -= borderLeftWidth - marginLeft; |
| 2036 |
offsets.right -= borderLeftWidth - marginLeft; |
| 2037 |
|
| 2038 |
// Attach marginTop and marginLeft because in some circumstances we may need them |
| 2039 |
offsets.marginTop = marginTop; |
| 2040 |
offsets.marginLeft = marginLeft; |
| 2041 |
} |
| 2042 |
|
| 2043 |
if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { |
| 2044 |
offsets = includeScroll(offsets, parent); |
| 2045 |
} |
| 2046 |
|
| 2047 |
return offsets; |
| 2048 |
} |
| 2049 |
|
| 2050 |
function getViewportOffsetRectRelativeToArtbitraryNode(element) { |
| 2051 |
var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; |
| 2052 |
|
| 2053 |
var html = element.ownerDocument.documentElement; |
| 2054 |
var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); |
| 2055 |
var width = Math.max(html.clientWidth, window.innerWidth || 0); |
| 2056 |
var height = Math.max(html.clientHeight, window.innerHeight || 0); |
| 2057 |
|
| 2058 |
var scrollTop = !excludeScroll ? getScroll(html) : 0; |
| 2059 |
var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; |
| 2060 |
|
| 2061 |
var offset = { |
| 2062 |
top: scrollTop - relativeOffset.top + relativeOffset.marginTop, |
| 2063 |
left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, |
| 2064 |
width: width, |
| 2065 |
height: height |
| 2066 |
}; |
| 2067 |
|
| 2068 |
return getClientRect(offset); |
| 2069 |
} |
| 2070 |
|
| 2071 |
/** |
| 2072 |
* Check if the given element is fixed or is inside a fixed parent |
| 2073 |
* @method |
| 2074 |
* @memberof Popper.Utils |
| 2075 |
* @argument {Element} element |
| 2076 |
* @argument {Element} customContainer |
| 2077 |
* @returns {Boolean} answer to "isFixed?" |
| 2078 |
*/ |
| 2079 |
function isFixed(element) { |
| 2080 |
var nodeName = element.nodeName; |
| 2081 |
if (nodeName === 'BODY' || nodeName === 'HTML') { |
| 2082 |
return false; |
| 2083 |
} |
| 2084 |
if (getStyleComputedProperty(element, 'position') === 'fixed') { |
| 2085 |
return true; |
| 2086 |
} |
| 2087 |
var parentNode = getParentNode(element); |
| 2088 |
if (!parentNode) { |
| 2089 |
return false; |
| 2090 |
} |
| 2091 |
return isFixed(parentNode); |
| 2092 |
} |
| 2093 |
|
| 2094 |
/** |
| 2095 |
* Finds the first parent of an element that has a transformed property defined |
| 2096 |
* @method |
| 2097 |
* @memberof Popper.Utils |
| 2098 |
* @argument {Element} element |
| 2099 |
* @returns {Element} first transformed parent or documentElement |
| 2100 |
*/ |
| 2101 |
|
| 2102 |
function getFixedPositionOffsetParent(element) { |
| 2103 |
// This check is needed to avoid errors in case one of the elements isn't defined for any reason |
| 2104 |
if (!element || !element.parentElement || isIE()) { |
| 2105 |
return document.documentElement; |
| 2106 |
} |
| 2107 |
var el = element.parentElement; |
| 2108 |
while (el && getStyleComputedProperty(el, 'transform') === 'none') { |
| 2109 |
el = el.parentElement; |
| 2110 |
} |
| 2111 |
return el || document.documentElement; |
| 2112 |
} |
| 2113 |
|
| 2114 |
/** |
| 2115 |
* Computed the boundaries limits and return them |
| 2116 |
* @method |
| 2117 |
* @memberof Popper.Utils |
| 2118 |
* @param {HTMLElement} popper |
| 2119 |
* @param {HTMLElement} reference |
| 2120 |
* @param {number} padding |
| 2121 |
* @param {HTMLElement} boundariesElement - Element used to define the boundaries |
| 2122 |
* @param {Boolean} fixedPosition - Is in fixed position mode |
| 2123 |
* @returns {Object} Coordinates of the boundaries |
| 2124 |
*/ |
| 2125 |
function getBoundaries(popper, reference, padding, boundariesElement) { |
| 2126 |
var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; |
| 2127 |
|
| 2128 |
// NOTE: 1 DOM access here |
| 2129 |
|
| 2130 |
var boundaries = { top: 0, left: 0 }; |
| 2131 |
var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); |
| 2132 |
|
| 2133 |
// Handle viewport case |
| 2134 |
if (boundariesElement === 'viewport') { |
| 2135 |
boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); |
| 2136 |
} else { |
| 2137 |
// Handle other cases based on DOM element used as boundaries |
| 2138 |
var boundariesNode = void 0; |
| 2139 |
if (boundariesElement === 'scrollParent') { |
| 2140 |
boundariesNode = getScrollParent(getParentNode(reference)); |
| 2141 |
if (boundariesNode.nodeName === 'BODY') { |
| 2142 |
boundariesNode = popper.ownerDocument.documentElement; |
| 2143 |
} |
| 2144 |
} else if (boundariesElement === 'window') { |
| 2145 |
boundariesNode = popper.ownerDocument.documentElement; |
| 2146 |
} else { |
| 2147 |
boundariesNode = boundariesElement; |
| 2148 |
} |
| 2149 |
|
| 2150 |
var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); |
| 2151 |
|
| 2152 |
// In case of HTML, we need a different computation |
| 2153 |
if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { |
| 2154 |
var _getWindowSizes = getWindowSizes(popper.ownerDocument), |
| 2155 |
height = _getWindowSizes.height, |
| 2156 |
width = _getWindowSizes.width; |
| 2157 |
|
| 2158 |
boundaries.top += offsets.top - offsets.marginTop; |
| 2159 |
boundaries.bottom = height + offsets.top; |
| 2160 |
boundaries.left += offsets.left - offsets.marginLeft; |
| 2161 |
boundaries.right = width + offsets.left; |
| 2162 |
} else { |
| 2163 |
// for all the other DOM elements, this one is good |
| 2164 |
boundaries = offsets; |
| 2165 |
} |
| 2166 |
} |
| 2167 |
|
| 2168 |
// Add paddings |
| 2169 |
padding = padding || 0; |
| 2170 |
var isPaddingNumber = typeof padding === 'number'; |
| 2171 |
boundaries.left += isPaddingNumber ? padding : padding.left || 0; |
| 2172 |
boundaries.top += isPaddingNumber ? padding : padding.top || 0; |
| 2173 |
boundaries.right -= isPaddingNumber ? padding : padding.right || 0; |
| 2174 |
boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; |
| 2175 |
|
| 2176 |
return boundaries; |
| 2177 |
} |
| 2178 |
|
| 2179 |
function getArea(_ref) { |
| 2180 |
var width = _ref.width, |
| 2181 |
height = _ref.height; |
| 2182 |
|
| 2183 |
return width * height; |
| 2184 |
} |
| 2185 |
|
| 2186 |
/** |
| 2187 |
* Utility used to transform the `auto` placement to the placement with more |
| 2188 |
* available space. |
| 2189 |
* @method |
| 2190 |
* @memberof Popper.Utils |
| 2191 |
* @argument {Object} data - The data object generated by update method |
| 2192 |
* @argument {Object} options - Modifiers configuration and options |
| 2193 |
* @returns {Object} The data object, properly modified |
| 2194 |
*/ |
| 2195 |
function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { |
| 2196 |
var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; |
| 2197 |
|
| 2198 |
if (placement.indexOf('auto') === -1) { |
| 2199 |
return placement; |
| 2200 |
} |
| 2201 |
|
| 2202 |
var boundaries = getBoundaries(popper, reference, padding, boundariesElement); |
| 2203 |
|
| 2204 |
var rects = { |
| 2205 |
top: { |
| 2206 |
width: boundaries.width, |
| 2207 |
height: refRect.top - boundaries.top |
| 2208 |
}, |
| 2209 |
right: { |
| 2210 |
width: boundaries.right - refRect.right, |
| 2211 |
height: boundaries.height |
| 2212 |
}, |
| 2213 |
bottom: { |
| 2214 |
width: boundaries.width, |
| 2215 |
height: boundaries.bottom - refRect.bottom |
| 2216 |
}, |
| 2217 |
left: { |
| 2218 |
width: refRect.left - boundaries.left, |
| 2219 |
height: boundaries.height |
| 2220 |
} |
| 2221 |
}; |
| 2222 |
|
| 2223 |
var sortedAreas = Object.keys(rects).map(function (key) { |
| 2224 |
return _extends({ |
| 2225 |
key: key |
| 2226 |
}, rects[key], { |
| 2227 |
area: getArea(rects[key]) |
| 2228 |
}); |
| 2229 |
}).sort(function (a, b) { |
| 2230 |
return b.area - a.area; |
| 2231 |
}); |
| 2232 |
|
| 2233 |
var filteredAreas = sortedAreas.filter(function (_ref2) { |
| 2234 |
var width = _ref2.width, |
| 2235 |
height = _ref2.height; |
| 2236 |
return width >= popper.clientWidth && height >= popper.clientHeight; |
| 2237 |
}); |
| 2238 |
|
| 2239 |
var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; |
| 2240 |
|
| 2241 |
var variation = placement.split('-')[1]; |
| 2242 |
|
| 2243 |
return computedPlacement + (variation ? '-' + variation : ''); |
| 2244 |
} |
| 2245 |
|
| 2246 |
/** |
| 2247 |
* Get offsets to the reference element |
| 2248 |
* @method |
| 2249 |
* @memberof Popper.Utils |
| 2250 |
* @param {Object} state |
| 2251 |
* @param {Element} popper - the popper element |
| 2252 |
* @param {Element} reference - the reference element (the popper will be relative to this) |
| 2253 |
* @param {Element} fixedPosition - is in fixed position mode |
| 2254 |
* @returns {Object} An object containing the offsets which will be applied to the popper |
| 2255 |
*/ |
| 2256 |
function getReferenceOffsets(state, popper, reference) { |
| 2257 |
var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; |
| 2258 |
|
| 2259 |
var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); |
| 2260 |
return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); |
| 2261 |
} |
| 2262 |
|
| 2263 |
/** |
| 2264 |
* Get the outer sizes of the given element (offset size + margins) |
| 2265 |
* @method |
| 2266 |
* @memberof Popper.Utils |
| 2267 |
* @argument {Element} element |
| 2268 |
* @returns {Object} object containing width and height properties |
| 2269 |
*/ |
| 2270 |
function getOuterSizes(element) { |
| 2271 |
var window = element.ownerDocument.defaultView; |
| 2272 |
var styles = window.getComputedStyle(element); |
| 2273 |
var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); |
| 2274 |
var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); |
| 2275 |
var result = { |
| 2276 |
width: element.offsetWidth + y, |
| 2277 |
height: element.offsetHeight + x |
| 2278 |
}; |
| 2279 |
return result; |
| 2280 |
} |
| 2281 |
|
| 2282 |
/** |
| 2283 |
* Get the opposite placement of the given one |
| 2284 |
* @method |
| 2285 |
* @memberof Popper.Utils |
| 2286 |
* @argument {String} placement |
| 2287 |
* @returns {String} flipped placement |
| 2288 |
*/ |
| 2289 |
function getOppositePlacement(placement) { |
| 2290 |
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; |
| 2291 |
return placement.replace(/left|right|bottom|top/g, function (matched) { |
| 2292 |
return hash[matched]; |
| 2293 |
}); |
| 2294 |
} |
| 2295 |
|
| 2296 |
/** |
| 2297 |
* Get offsets to the popper |
| 2298 |
* @method |
| 2299 |
* @memberof Popper.Utils |
| 2300 |
* @param {Object} position - CSS position the Popper will get applied |
| 2301 |
* @param {HTMLElement} popper - the popper element |
| 2302 |
* @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) |
| 2303 |
* @param {String} placement - one of the valid placement options |
| 2304 |
* @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper |
| 2305 |
*/ |
| 2306 |
function getPopperOffsets(popper, referenceOffsets, placement) { |
| 2307 |
placement = placement.split('-')[0]; |
| 2308 |
|
| 2309 |
// Get popper node sizes |
| 2310 |
var popperRect = getOuterSizes(popper); |
| 2311 |
|
| 2312 |
// Add position, width and height to our offsets object |
| 2313 |
var popperOffsets = { |
| 2314 |
width: popperRect.width, |
| 2315 |
height: popperRect.height |
| 2316 |
}; |
| 2317 |
|
| 2318 |
// depending by the popper placement we have to compute its offsets slightly differently |
| 2319 |
var isHoriz = ['right', 'left'].indexOf(placement) !== -1; |
| 2320 |
var mainSide = isHoriz ? 'top' : 'left'; |
| 2321 |
var secondarySide = isHoriz ? 'left' : 'top'; |
| 2322 |
var measurement = isHoriz ? 'height' : 'width'; |
| 2323 |
var secondaryMeasurement = !isHoriz ? 'height' : 'width'; |
| 2324 |
|
| 2325 |
popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; |
| 2326 |
if (placement === secondarySide) { |
| 2327 |
popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; |
| 2328 |
} else { |
| 2329 |
popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; |
| 2330 |
} |
| 2331 |
|
| 2332 |
return popperOffsets; |
| 2333 |
} |
| 2334 |
|
| 2335 |
/** |
| 2336 |
* Mimics the `find` method of Array |
| 2337 |
* @method |
| 2338 |
* @memberof Popper.Utils |
| 2339 |
* @argument {Array} arr |
| 2340 |
* @argument prop |
| 2341 |
* @argument value |
| 2342 |
* @returns index or -1 |
| 2343 |
*/ |
| 2344 |
function find(arr, check) { |
| 2345 |
// use native find if supported |
| 2346 |
if (Array.prototype.find) { |
| 2347 |
return arr.find(check); |
| 2348 |
} |
| 2349 |
|
| 2350 |
// use `filter` to obtain the same behavior of `find` |
| 2351 |
return arr.filter(check)[0]; |
| 2352 |
} |
| 2353 |
|
| 2354 |
/** |
| 2355 |
* Return the index of the matching object |
| 2356 |
* @method |
| 2357 |
* @memberof Popper.Utils |
| 2358 |
* @argument {Array} arr |
| 2359 |
* @argument prop |
| 2360 |
* @argument value |
| 2361 |
* @returns index or -1 |
| 2362 |
*/ |
| 2363 |
function findIndex(arr, prop, value) { |
| 2364 |
// use native findIndex if supported |
| 2365 |
if (Array.prototype.findIndex) { |
| 2366 |
return arr.findIndex(function (cur) { |
| 2367 |
return cur[prop] === value; |
| 2368 |
}); |
| 2369 |
} |
| 2370 |
|
| 2371 |
// use `find` + `indexOf` if `findIndex` isn't supported |
| 2372 |
var match = find(arr, function (obj) { |
| 2373 |
return obj[prop] === value; |
| 2374 |
}); |
| 2375 |
return arr.indexOf(match); |
| 2376 |
} |
| 2377 |
|
| 2378 |
/** |
| 2379 |
* Loop trough the list of modifiers and run them in order, |
| 2380 |
* each of them will then edit the data object. |
| 2381 |
* @method |
| 2382 |
* @memberof Popper.Utils |
| 2383 |
* @param {dataObject} data |
| 2384 |
* @param {Array} modifiers |
| 2385 |
* @param {String} ends - Optional modifier name used as stopper |
| 2386 |
* @returns {dataObject} |
| 2387 |
*/ |
| 2388 |
function runModifiers(modifiers, data, ends) { |
| 2389 |
var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); |
| 2390 |
|
| 2391 |
modifiersToRun.forEach(function (modifier) { |
| 2392 |
if (modifier['function']) { |
| 2393 |
// eslint-disable-line dot-notation |
| 2394 |
console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); |
| 2395 |
} |
| 2396 |
var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation |
| 2397 |
if (modifier.enabled && isFunction(fn)) { |
| 2398 |
// Add properties to offsets to make them a complete clientRect object |
| 2399 |
// we do this before each modifier to make sure the previous one doesn't |
| 2400 |
// mess with these values |
| 2401 |
data.offsets.popper = getClientRect(data.offsets.popper); |
| 2402 |
data.offsets.reference = getClientRect(data.offsets.reference); |
| 2403 |
|
| 2404 |
data = fn(data, modifier); |
| 2405 |
} |
| 2406 |
}); |
| 2407 |
|
| 2408 |
return data; |
| 2409 |
} |
| 2410 |
|
| 2411 |
/** |
| 2412 |
* Updates the position of the popper, computing the new offsets and applying |
| 2413 |
* the new style.<br /> |
| 2414 |
* Prefer `scheduleUpdate` over `update` because of performance reasons. |
| 2415 |
* @method |
| 2416 |
* @memberof Popper |
| 2417 |
*/ |
| 2418 |
function update() { |
| 2419 |
// if popper is destroyed, don't perform any further update |
| 2420 |
if (this.state.isDestroyed) { |
| 2421 |
return; |
| 2422 |
} |
| 2423 |
|
| 2424 |
var data = { |
| 2425 |
instance: this, |
| 2426 |
styles: {}, |
| 2427 |
arrowStyles: {}, |
| 2428 |
attributes: {}, |
| 2429 |
flipped: false, |
| 2430 |
offsets: {} |
| 2431 |
}; |
| 2432 |
|
| 2433 |
// compute reference element offsets |
| 2434 |
data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); |
| 2435 |
|
| 2436 |
// compute auto placement, store placement inside the data object, |
| 2437 |
// modifiers will be able to edit `placement` if needed |
| 2438 |
// and refer to originalPlacement to know the original value |
| 2439 |
data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); |
| 2440 |
|
| 2441 |
// store the computed placement inside `originalPlacement` |
| 2442 |
data.originalPlacement = data.placement; |
| 2443 |
|
| 2444 |
data.positionFixed = this.options.positionFixed; |
| 2445 |
|
| 2446 |
// compute the popper offsets |
| 2447 |
data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); |
| 2448 |
|
| 2449 |
data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; |
| 2450 |
|
| 2451 |
// run the modifiers |
| 2452 |
data = runModifiers(this.modifiers, data); |
| 2453 |
|
| 2454 |
// the first `update` will call `onCreate` callback |
| 2455 |
// the other ones will call `onUpdate` callback |
| 2456 |
if (!this.state.isCreated) { |
| 2457 |
this.state.isCreated = true; |
| 2458 |
this.options.onCreate(data); |
| 2459 |
} else { |
| 2460 |
this.options.onUpdate(data); |
| 2461 |
} |
| 2462 |
} |
| 2463 |
|
| 2464 |
/** |
| 2465 |
* Helper used to know if the given modifier is enabled. |
| 2466 |
* @method |
| 2467 |
* @memberof Popper.Utils |
| 2468 |
* @returns {Boolean} |
| 2469 |
*/ |
| 2470 |
function isModifierEnabled(modifiers, modifierName) { |
| 2471 |
return modifiers.some(function (_ref) { |
| 2472 |
var name = _ref.name, |
| 2473 |
enabled = _ref.enabled; |
| 2474 |
return enabled && name === modifierName; |
| 2475 |
}); |
| 2476 |
} |
| 2477 |
|
| 2478 |
/** |
| 2479 |
* Get the prefixed supported property name |
| 2480 |
* @method |
| 2481 |
* @memberof Popper.Utils |
| 2482 |
* @argument {String} property (camelCase) |
| 2483 |
* @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) |
| 2484 |
*/ |
| 2485 |
function getSupportedPropertyName(property) { |
| 2486 |
var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; |
| 2487 |
var upperProp = property.charAt(0).toUpperCase() + property.slice(1); |
| 2488 |
|
| 2489 |
for (var i = 0; i < prefixes.length; i++) { |
| 2490 |
var prefix = prefixes[i]; |
| 2491 |
var toCheck = prefix ? '' + prefix + upperProp : property; |
| 2492 |
if (typeof document.body.style[toCheck] !== 'undefined') { |
| 2493 |
return toCheck; |
| 2494 |
} |
| 2495 |
} |
| 2496 |
return null; |
| 2497 |
} |
| 2498 |
|
| 2499 |
/** |
| 2500 |
* Destroys the popper. |
| 2501 |
* @method |
| 2502 |
* @memberof Popper |
| 2503 |
*/ |
| 2504 |
function destroy() { |
| 2505 |
this.state.isDestroyed = true; |
| 2506 |
|
| 2507 |
// touch DOM only if `applyStyle` modifier is enabled |
| 2508 |
if (isModifierEnabled(this.modifiers, 'applyStyle')) { |
| 2509 |
this.popper.removeAttribute('x-placement'); |
| 2510 |
this.popper.style.position = ''; |
| 2511 |
this.popper.style.top = ''; |
| 2512 |
this.popper.style.left = ''; |
| 2513 |
this.popper.style.right = ''; |
| 2514 |
this.popper.style.bottom = ''; |
| 2515 |
this.popper.style.willChange = ''; |
| 2516 |
this.popper.style[getSupportedPropertyName('transform')] = ''; |
| 2517 |
} |
| 2518 |
|
| 2519 |
this.disableEventListeners(); |
| 2520 |
|
| 2521 |
// remove the popper if user explicitly asked for the deletion on destroy |
| 2522 |
// do not use `remove` because IE11 doesn't support it |
| 2523 |
if (this.options.removeOnDestroy) { |
| 2524 |
this.popper.parentNode.removeChild(this.popper); |
| 2525 |
} |
| 2526 |
return this; |
| 2527 |
} |
| 2528 |
|
| 2529 |
/** |
| 2530 |
* Get the window associated with the element |
| 2531 |
* @argument {Element} element |
| 2532 |
* @returns {Window} |
| 2533 |
*/ |
| 2534 |
function getWindow(element) { |
| 2535 |
var ownerDocument = element.ownerDocument; |
| 2536 |
return ownerDocument ? ownerDocument.defaultView : window; |
| 2537 |
} |
| 2538 |
|
| 2539 |
function attachToScrollParents(scrollParent, event, callback, scrollParents) { |
| 2540 |
var isBody = scrollParent.nodeName === 'BODY'; |
| 2541 |
var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; |
| 2542 |
target.addEventListener(event, callback, { passive: true }); |
| 2543 |
|
| 2544 |
if (!isBody) { |
| 2545 |
attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); |
| 2546 |
} |
| 2547 |
scrollParents.push(target); |
| 2548 |
} |
| 2549 |
|
| 2550 |
/** |
| 2551 |
* Setup needed event listeners used to update the popper position |
| 2552 |
* @method |
| 2553 |
* @memberof Popper.Utils |
| 2554 |
* @private |
| 2555 |
*/ |
| 2556 |
function setupEventListeners(reference, options, state, updateBound) { |
| 2557 |
// Resize event listener on window |
| 2558 |
state.updateBound = updateBound; |
| 2559 |
getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); |
| 2560 |
|
| 2561 |
// Scroll event listener on scroll parents |
| 2562 |
var scrollElement = getScrollParent(reference); |
| 2563 |
attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); |
| 2564 |
state.scrollElement = scrollElement; |
| 2565 |
state.eventsEnabled = true; |
| 2566 |
|
| 2567 |
return state; |
| 2568 |
} |
| 2569 |
|
| 2570 |
/** |
| 2571 |
* It will add resize/scroll events and start recalculating |
| 2572 |
* position of the popper element when they are triggered. |
| 2573 |
* @method |
| 2574 |
* @memberof Popper |
| 2575 |
*/ |
| 2576 |
function enableEventListeners() { |
| 2577 |
if (!this.state.eventsEnabled) { |
| 2578 |
this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); |
| 2579 |
} |
| 2580 |
} |
| 2581 |
|
| 2582 |
/** |
| 2583 |
* Remove event listeners used to update the popper position |
| 2584 |
* @method |
| 2585 |
* @memberof Popper.Utils |
| 2586 |
* @private |
| 2587 |
*/ |
| 2588 |
function removeEventListeners(reference, state) { |
| 2589 |
// Remove resize event listener on window |
| 2590 |
getWindow(reference).removeEventListener('resize', state.updateBound); |
| 2591 |
|
| 2592 |
// Remove scroll event listener on scroll parents |
| 2593 |
state.scrollParents.forEach(function (target) { |
| 2594 |
target.removeEventListener('scroll', state.updateBound); |
| 2595 |
}); |
| 2596 |
|
| 2597 |
// Reset state |
| 2598 |
state.updateBound = null; |
| 2599 |
state.scrollParents = []; |
| 2600 |
state.scrollElement = null; |
| 2601 |
state.eventsEnabled = false; |
| 2602 |
return state; |
| 2603 |
} |
| 2604 |
|
| 2605 |
/** |
| 2606 |
* It will remove resize/scroll events and won't recalculate popper position |
| 2607 |
* when they are triggered. It also won't trigger `onUpdate` callback anymore, |
| 2608 |
* unless you call `update` method manually. |
| 2609 |
* @method |
| 2610 |
* @memberof Popper |
| 2611 |
*/ |
| 2612 |
function disableEventListeners() { |
| 2613 |
if (this.state.eventsEnabled) { |
| 2614 |
cancelAnimationFrame(this.scheduleUpdate); |
| 2615 |
this.state = removeEventListeners(this.reference, this.state); |
| 2616 |
} |
| 2617 |
} |
| 2618 |
|
| 2619 |
/** |
| 2620 |
* Tells if a given input is a number |
| 2621 |
* @method |
| 2622 |
* @memberof Popper.Utils |
| 2623 |
* @param {*} input to check |
| 2624 |
* @return {Boolean} |
| 2625 |
*/ |
| 2626 |
function isNumeric(n) { |
| 2627 |
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); |
| 2628 |
} |
| 2629 |
|
| 2630 |
/** |
| 2631 |
* Set the style to the given popper |
| 2632 |
* @method |
| 2633 |
* @memberof Popper.Utils |
| 2634 |
* @argument {Element} element - Element to apply the style to |
| 2635 |
* @argument {Object} styles |
| 2636 |
* Object with a list of properties and values which will be applied to the element |
| 2637 |
*/ |
| 2638 |
function setStyles(element, styles) { |
| 2639 |
Object.keys(styles).forEach(function (prop) { |
| 2640 |
var unit = ''; |
| 2641 |
// add unit if the value is numeric and is one of the following |
| 2642 |
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { |
| 2643 |
unit = 'px'; |
| 2644 |
} |
| 2645 |
element.style[prop] = styles[prop] + unit; |
| 2646 |
}); |
| 2647 |
} |
| 2648 |
|
| 2649 |
/** |
| 2650 |
* Set the attributes to the given popper |
| 2651 |
* @method |
| 2652 |
* @memberof Popper.Utils |
| 2653 |
* @argument {Element} element - Element to apply the attributes to |
| 2654 |
* @argument {Object} styles |
| 2655 |
* Object with a list of properties and values which will be applied to the element |
| 2656 |
*/ |
| 2657 |
function setAttributes(element, attributes) { |
| 2658 |
Object.keys(attributes).forEach(function (prop) { |
| 2659 |
var value = attributes[prop]; |
| 2660 |
if (value !== false) { |
| 2661 |
element.setAttribute(prop, attributes[prop]); |
| 2662 |
} else { |
| 2663 |
element.removeAttribute(prop); |
| 2664 |
} |
| 2665 |
}); |
| 2666 |
} |
| 2667 |
|
| 2668 |
/** |
| 2669 |
* @function |
| 2670 |
* @memberof Modifiers |
| 2671 |
* @argument {Object} data - The data object generated by `update` method |
| 2672 |
* @argument {Object} data.styles - List of style properties - values to apply to popper element |
| 2673 |
* @argument {Object} data.attributes - List of attribute properties - values to apply to popper element |
| 2674 |
* @argument {Object} options - Modifiers configuration and options |
| 2675 |
* @returns {Object} The same data object |
| 2676 |
*/ |
| 2677 |
function applyStyle(data) { |
| 2678 |
// any property present in `data.styles` will be applied to the popper, |
| 2679 |
// in this way we can make the 3rd party modifiers add custom styles to it |
| 2680 |
// Be aware, modifiers could override the properties defined in the previous |
| 2681 |
// lines of this modifier! |
| 2682 |
setStyles(data.instance.popper, data.styles); |
| 2683 |
|
| 2684 |
// any property present in `data.attributes` will be applied to the popper, |
| 2685 |
// they will be set as HTML attributes of the element |
| 2686 |
setAttributes(data.instance.popper, data.attributes); |
| 2687 |
|
| 2688 |
// if arrowElement is defined and arrowStyles has some properties |
| 2689 |
if (data.arrowElement && Object.keys(data.arrowStyles).length) { |
| 2690 |
setStyles(data.arrowElement, data.arrowStyles); |
| 2691 |
} |
| 2692 |
|
| 2693 |
return data; |
| 2694 |
} |
| 2695 |
|
| 2696 |
/** |
| 2697 |
* Set the x-placement attribute before everything else because it could be used |
| 2698 |
* to add margins to the popper margins needs to be calculated to get the |
| 2699 |
* correct popper offsets. |
| 2700 |
* @method |
| 2701 |
* @memberof Popper.modifiers |
| 2702 |
* @param {HTMLElement} reference - The reference element used to position the popper |
| 2703 |
* @param {HTMLElement} popper - The HTML element used as popper |
| 2704 |
* @param {Object} options - Popper.js options |
| 2705 |
*/ |
| 2706 |
function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { |
| 2707 |
// compute reference element offsets |
| 2708 |
var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); |
| 2709 |
|
| 2710 |
// compute auto placement, store placement inside the data object, |
| 2711 |
// modifiers will be able to edit `placement` if needed |
| 2712 |
// and refer to originalPlacement to know the original value |
| 2713 |
var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); |
| 2714 |
|
| 2715 |
popper.setAttribute('x-placement', placement); |
| 2716 |
|
| 2717 |
// Apply `position` to popper before anything else because |
| 2718 |
// without the position applied we can't guarantee correct computations |
| 2719 |
setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); |
| 2720 |
|
| 2721 |
return options; |
| 2722 |
} |
| 2723 |
|
| 2724 |
/** |
| 2725 |
* @function |
| 2726 |
* @memberof Popper.Utils |
| 2727 |
* @argument {Object} data - The data object generated by `update` method |
| 2728 |
* @argument {Boolean} shouldRound - If the offsets should be rounded at all |
| 2729 |
* @returns {Object} The popper's position offsets rounded |
| 2730 |
* |
| 2731 |
* The tale of pixel-perfect positioning. It's still not 100% perfect, but as |
| 2732 |
* good as it can be within reason. |
| 2733 |
* Discussion here: https://github.com/FezVrasta/popper.js/pull/715 |
| 2734 |
* |
| 2735 |
* Low DPI screens cause a popper to be blurry if not using full pixels (Safari |
| 2736 |
* as well on High DPI screens). |
| 2737 |
* |
| 2738 |
* Firefox prefers no rounding for positioning and does not have blurriness on |
| 2739 |
* high DPI screens. |
| 2740 |
* |
| 2741 |
* Only horizontal placement and left/right values need to be considered. |
| 2742 |
*/ |
| 2743 |
function getRoundedOffsets(data, shouldRound) { |
| 2744 |
var _data$offsets = data.offsets, |
| 2745 |
popper = _data$offsets.popper, |
| 2746 |
reference = _data$offsets.reference; |
| 2747 |
var round = Math.round, |
| 2748 |
floor = Math.floor; |
| 2749 |
|
| 2750 |
var noRound = function noRound(v) { |
| 2751 |
return v; |
| 2752 |
}; |
| 2753 |
|
| 2754 |
var referenceWidth = round(reference.width); |
| 2755 |
var popperWidth = round(popper.width); |
| 2756 |
|
| 2757 |
var isVertical = ['left', 'right'].indexOf(data.placement) !== -1; |
| 2758 |
var isVariation = data.placement.indexOf('-') !== -1; |
| 2759 |
var sameWidthParity = referenceWidth % 2 === popperWidth % 2; |
| 2760 |
var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; |
| 2761 |
|
| 2762 |
var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; |
| 2763 |
var verticalToInteger = !shouldRound ? noRound : round; |
| 2764 |
|
| 2765 |
return { |
| 2766 |
left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), |
| 2767 |
top: verticalToInteger(popper.top), |
| 2768 |
bottom: verticalToInteger(popper.bottom), |
| 2769 |
right: horizontalToInteger(popper.right) |
| 2770 |
}; |
| 2771 |
} |
| 2772 |
|
| 2773 |
var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); |
| 2774 |
|
| 2775 |
/** |
| 2776 |
* @function |
| 2777 |
* @memberof Modifiers |
| 2778 |
* @argument {Object} data - The data object generated by `update` method |
| 2779 |
* @argument {Object} options - Modifiers configuration and options |
| 2780 |
* @returns {Object} The data object, properly modified |
| 2781 |
*/ |
| 2782 |
function computeStyle(data, options) { |
| 2783 |
var x = options.x, |
| 2784 |
y = options.y; |
| 2785 |
var popper = data.offsets.popper; |
| 2786 |
|
| 2787 |
// Remove this legacy support in Popper.js v2 |
| 2788 |
|
| 2789 |
var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { |
| 2790 |
return modifier.name === 'applyStyle'; |
| 2791 |
}).gpuAcceleration; |
| 2792 |
if (legacyGpuAccelerationOption !== undefined) { |
| 2793 |
console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); |
| 2794 |
} |
| 2795 |
var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; |
| 2796 |
|
| 2797 |
var offsetParent = getOffsetParent(data.instance.popper); |
| 2798 |
var offsetParentRect = getBoundingClientRect(offsetParent); |
| 2799 |
|
| 2800 |
// Styles |
| 2801 |
var styles = { |
| 2802 |
position: popper.position |
| 2803 |
}; |
| 2804 |
|
| 2805 |
var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); |
| 2806 |
|
| 2807 |
var sideA = x === 'bottom' ? 'top' : 'bottom'; |
| 2808 |
var sideB = y === 'right' ? 'left' : 'right'; |
| 2809 |
|
| 2810 |
// if gpuAcceleration is set to `true` and transform is supported, |
| 2811 |
// we use `translate3d` to apply the position to the popper we |
| 2812 |
// automatically use the supported prefixed version if needed |
| 2813 |
var prefixedProperty = getSupportedPropertyName('transform'); |
| 2814 |
|
| 2815 |
// now, let's make a step back and look at this code closely (wtf?) |
| 2816 |
// If the content of the popper grows once it's been positioned, it |
| 2817 |
// may happen that the popper gets misplaced because of the new content |
| 2818 |
// overflowing its reference element |
| 2819 |
// To avoid this problem, we provide two options (x and y), which allow |
| 2820 |
// the consumer to define the offset origin. |
| 2821 |
// If we position a popper on top of a reference element, we can set |
| 2822 |
// `x` to `top` to make the popper grow towards its top instead of |
| 2823 |
// its bottom. |
| 2824 |
var left = void 0, |
| 2825 |
top = void 0; |
| 2826 |
if (sideA === 'bottom') { |
| 2827 |
// when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) |
| 2828 |
// and not the bottom of the html element |
| 2829 |
if (offsetParent.nodeName === 'HTML') { |
| 2830 |
top = -offsetParent.clientHeight + offsets.bottom; |
| 2831 |
} else { |
| 2832 |
top = -offsetParentRect.height + offsets.bottom; |
| 2833 |
} |
| 2834 |
} else { |
| 2835 |
top = offsets.top; |
| 2836 |
} |
| 2837 |
if (sideB === 'right') { |
| 2838 |
if (offsetParent.nodeName === 'HTML') { |
| 2839 |
left = -offsetParent.clientWidth + offsets.right; |
| 2840 |
} else { |
| 2841 |
left = -offsetParentRect.width + offsets.right; |
| 2842 |
} |
| 2843 |
} else { |
| 2844 |
left = offsets.left; |
| 2845 |
} |
| 2846 |
if (gpuAcceleration && prefixedProperty) { |
| 2847 |
styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; |
| 2848 |
styles[sideA] = 0; |
| 2849 |
styles[sideB] = 0; |
| 2850 |
styles.willChange = 'transform'; |
| 2851 |
} else { |
| 2852 |
// othwerise, we use the standard `top`, `left`, `bottom` and `right` properties |
| 2853 |
var invertTop = sideA === 'bottom' ? -1 : 1; |
| 2854 |
var invertLeft = sideB === 'right' ? -1 : 1; |
| 2855 |
styles[sideA] = top * invertTop; |
| 2856 |
styles[sideB] = left * invertLeft; |
| 2857 |
styles.willChange = sideA + ', ' + sideB; |
| 2858 |
} |
| 2859 |
|
| 2860 |
// Attributes |
| 2861 |
var attributes = { |
| 2862 |
'x-placement': data.placement |
| 2863 |
}; |
| 2864 |
|
| 2865 |
// Update `data` attributes, styles and arrowStyles |
| 2866 |
data.attributes = _extends({}, attributes, data.attributes); |
| 2867 |
data.styles = _extends({}, styles, data.styles); |
| 2868 |
data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); |
| 2869 |
|
| 2870 |
return data; |
| 2871 |
} |
| 2872 |
|
| 2873 |
/** |
| 2874 |
* Helper used to know if the given modifier depends from another one.<br /> |
| 2875 |
* It checks if the needed modifier is listed and enabled. |
| 2876 |
* @method |
| 2877 |
* @memberof Popper.Utils |
| 2878 |
* @param {Array} modifiers - list of modifiers |
| 2879 |
* @param {String} requestingName - name of requesting modifier |
| 2880 |
* @param {String} requestedName - name of requested modifier |
| 2881 |
* @returns {Boolean} |
| 2882 |
*/ |
| 2883 |
function isModifierRequired(modifiers, requestingName, requestedName) { |
| 2884 |
var requesting = find(modifiers, function (_ref) { |
| 2885 |
var name = _ref.name; |
| 2886 |
return name === requestingName; |
| 2887 |
}); |
| 2888 |
|
| 2889 |
var isRequired = !!requesting && modifiers.some(function (modifier) { |
| 2890 |
return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; |
| 2891 |
}); |
| 2892 |
|
| 2893 |
if (!isRequired) { |
| 2894 |
var _requesting = '`' + requestingName + '`'; |
| 2895 |
var requested = '`' + requestedName + '`'; |
| 2896 |
console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); |
| 2897 |
} |
| 2898 |
return isRequired; |
| 2899 |
} |
| 2900 |
|
| 2901 |
/** |
| 2902 |
* @function |
| 2903 |
* @memberof Modifiers |
| 2904 |
* @argument {Object} data - The data object generated by update method |
| 2905 |
* @argument {Object} options - Modifiers configuration and options |
| 2906 |
* @returns {Object} The data object, properly modified |
| 2907 |
*/ |
| 2908 |
function arrow(data, options) { |
| 2909 |
var _data$offsets$arrow; |
| 2910 |
|
| 2911 |
// arrow depends on keepTogether in order to work |
| 2912 |
if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { |
| 2913 |
return data; |
| 2914 |
} |
| 2915 |
|
| 2916 |
var arrowElement = options.element; |
| 2917 |
|
| 2918 |
// if arrowElement is a string, suppose it's a CSS selector |
| 2919 |
if (typeof arrowElement === 'string') { |
| 2920 |
arrowElement = data.instance.popper.querySelector(arrowElement); |
| 2921 |
|
| 2922 |
// if arrowElement is not found, don't run the modifier |
| 2923 |
if (!arrowElement) { |
| 2924 |
return data; |
| 2925 |
} |
| 2926 |
} else { |
| 2927 |
// if the arrowElement isn't a query selector we must check that the |
| 2928 |
// provided DOM node is child of its popper node |
| 2929 |
if (!data.instance.popper.contains(arrowElement)) { |
| 2930 |
console.warn('WARNING: `arrow.element` must be child of its popper element!'); |
| 2931 |
return data; |
| 2932 |
} |
| 2933 |
} |
| 2934 |
|
| 2935 |
var placement = data.placement.split('-')[0]; |
| 2936 |
var _data$offsets = data.offsets, |
| 2937 |
popper = _data$offsets.popper, |
| 2938 |
reference = _data$offsets.reference; |
| 2939 |
|
| 2940 |
var isVertical = ['left', 'right'].indexOf(placement) !== -1; |
| 2941 |
|
| 2942 |
var len = isVertical ? 'height' : 'width'; |
| 2943 |
var sideCapitalized = isVertical ? 'Top' : 'Left'; |
| 2944 |
var side = sideCapitalized.toLowerCase(); |
| 2945 |
var altSide = isVertical ? 'left' : 'top'; |
| 2946 |
var opSide = isVertical ? 'bottom' : 'right'; |
| 2947 |
var arrowElementSize = getOuterSizes(arrowElement)[len]; |
| 2948 |
|
| 2949 |
// |
| 2950 |
// extends keepTogether behavior making sure the popper and its |
| 2951 |
// reference have enough pixels in conjunction |
| 2952 |
// |
| 2953 |
|
| 2954 |
// top/left side |
| 2955 |
if (reference[opSide] - arrowElementSize < popper[side]) { |
| 2956 |
data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); |
| 2957 |
} |
| 2958 |
// bottom/right side |
| 2959 |
if (reference[side] + arrowElementSize > popper[opSide]) { |
| 2960 |
data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; |
| 2961 |
} |
| 2962 |
data.offsets.popper = getClientRect(data.offsets.popper); |
| 2963 |
|
| 2964 |
// compute center of the popper |
| 2965 |
var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; |
| 2966 |
|
| 2967 |
// Compute the sideValue using the updated popper offsets |
| 2968 |
// take popper margin in account because we don't have this info available |
| 2969 |
var css = getStyleComputedProperty(data.instance.popper); |
| 2970 |
var popperMarginSide = parseFloat(css['margin' + sideCapitalized]); |
| 2971 |
var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']); |
| 2972 |
var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; |
| 2973 |
|
| 2974 |
// prevent arrowElement from being placed not contiguously to its popper |
| 2975 |
sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); |
| 2976 |
|
| 2977 |
data.arrowElement = arrowElement; |
| 2978 |
data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); |
| 2979 |
|
| 2980 |
return data; |
| 2981 |
} |
| 2982 |
|
| 2983 |
/** |
| 2984 |
* Get the opposite placement variation of the given one |
| 2985 |
* @method |
| 2986 |
* @memberof Popper.Utils |
| 2987 |
* @argument {String} placement variation |
| 2988 |
* @returns {String} flipped placement variation |
| 2989 |
*/ |
| 2990 |
function getOppositeVariation(variation) { |
| 2991 |
if (variation === 'end') { |
| 2992 |
return 'start'; |
| 2993 |
} else if (variation === 'start') { |
| 2994 |
return 'end'; |
| 2995 |
} |
| 2996 |
return variation; |
| 2997 |
} |
| 2998 |
|
| 2999 |
/** |
| 3000 |
* List of accepted placements to use as values of the `placement` option.<br /> |
| 3001 |
* Valid placements are: |
| 3002 |
* - `auto` |
| 3003 |
* - `top` |
| 3004 |
* - `right` |
| 3005 |
* - `bottom` |
| 3006 |
* - `left` |
| 3007 |
* |
| 3008 |
* Each placement can have a variation from this list: |
| 3009 |
* - `-start` |
| 3010 |
* - `-end` |
| 3011 |
* |
| 3012 |
* Variations are interpreted easily if you think of them as the left to right |
| 3013 |
* written languages. Horizontally (`top` and `bottom`), `start` is left and `end` |
| 3014 |
* is right.<br /> |
| 3015 |
* Vertically (`left` and `right`), `start` is top and `end` is bottom. |
| 3016 |
* |
| 3017 |
* Some valid examples are: |
| 3018 |
* - `top-end` (on top of reference, right aligned) |
| 3019 |
* - `right-start` (on right of reference, top aligned) |
| 3020 |
* - `bottom` (on bottom, centered) |
| 3021 |
* - `auto-end` (on the side with more space available, alignment depends by placement) |
| 3022 |
* |
| 3023 |
* @static |
| 3024 |
* @type {Array} |
| 3025 |
* @enum {String} |
| 3026 |
* @readonly |
| 3027 |
* @method placements |
| 3028 |
* @memberof Popper |
| 3029 |
*/ |
| 3030 |
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']; |
| 3031 |
|
| 3032 |
// Get rid of `auto` `auto-start` and `auto-end` |
| 3033 |
var validPlacements = placements.slice(3); |
| 3034 |
|
| 3035 |
/** |
| 3036 |
* Given an initial placement, returns all the subsequent placements |
| 3037 |
* clockwise (or counter-clockwise). |
| 3038 |
* |
| 3039 |
* @method |
| 3040 |
* @memberof Popper.Utils |
| 3041 |
* @argument {String} placement - A valid placement (it accepts variations) |
| 3042 |
* @argument {Boolean} counter - Set to true to walk the placements counterclockwise |
| 3043 |
* @returns {Array} placements including their variations |
| 3044 |
*/ |
| 3045 |
function clockwise(placement) { |
| 3046 |
var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; |
| 3047 |
|
| 3048 |
var index = validPlacements.indexOf(placement); |
| 3049 |
var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); |
| 3050 |
return counter ? arr.reverse() : arr; |
| 3051 |
} |
| 3052 |
|
| 3053 |
var BEHAVIORS = { |
| 3054 |
FLIP: 'flip', |
| 3055 |
CLOCKWISE: 'clockwise', |
| 3056 |
COUNTERCLOCKWISE: 'counterclockwise' |
| 3057 |
}; |
| 3058 |
|
| 3059 |
/** |
| 3060 |
* @function |
| 3061 |
* @memberof Modifiers |
| 3062 |
* @argument {Object} data - The data object generated by update method |
| 3063 |
* @argument {Object} options - Modifiers configuration and options |
| 3064 |
* @returns {Object} The data object, properly modified |
| 3065 |
*/ |
| 3066 |
function flip(data, options) { |
| 3067 |
// if `inner` modifier is enabled, we can't use the `flip` modifier |
| 3068 |
if (isModifierEnabled(data.instance.modifiers, 'inner')) { |
| 3069 |
return data; |
| 3070 |
} |
| 3071 |
|
| 3072 |
if (data.flipped && data.placement === data.originalPlacement) { |
| 3073 |
// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides |
| 3074 |
return data; |
| 3075 |
} |
| 3076 |
|
| 3077 |
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); |
| 3078 |
|
| 3079 |
var placement = data.placement.split('-')[0]; |
| 3080 |
var placementOpposite = getOppositePlacement(placement); |
| 3081 |
var variation = data.placement.split('-')[1] || ''; |
| 3082 |
|
| 3083 |
var flipOrder = []; |
| 3084 |
|
| 3085 |
switch (options.behavior) { |
| 3086 |
case BEHAVIORS.FLIP: |
| 3087 |
flipOrder = [placement, placementOpposite]; |
| 3088 |
break; |
| 3089 |
case BEHAVIORS.CLOCKWISE: |
| 3090 |
flipOrder = clockwise(placement); |
| 3091 |
break; |
| 3092 |
case BEHAVIORS.COUNTERCLOCKWISE: |
| 3093 |
flipOrder = clockwise(placement, true); |
| 3094 |
break; |
| 3095 |
default: |
| 3096 |
flipOrder = options.behavior; |
| 3097 |
} |
| 3098 |
|
| 3099 |
flipOrder.forEach(function (step, index) { |
| 3100 |
if (placement !== step || flipOrder.length === index + 1) { |
| 3101 |
return data; |
| 3102 |
} |
| 3103 |
|
| 3104 |
placement = data.placement.split('-')[0]; |
| 3105 |
placementOpposite = getOppositePlacement(placement); |
| 3106 |
|
| 3107 |
var popperOffsets = data.offsets.popper; |
| 3108 |
var refOffsets = data.offsets.reference; |
| 3109 |
|
| 3110 |
// using floor because the reference offsets may contain decimals we are not going to consider here |
| 3111 |
var floor = Math.floor; |
| 3112 |
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); |
| 3113 |
|
| 3114 |
var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); |
| 3115 |
var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); |
| 3116 |
var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); |
| 3117 |
var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); |
| 3118 |
|
| 3119 |
var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; |
| 3120 |
|
| 3121 |
// flip the variation if required |
| 3122 |
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; |
| 3123 |
|
| 3124 |
// flips variation if reference element overflows boundaries |
| 3125 |
var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); |
| 3126 |
|
| 3127 |
// flips variation if popper content overflows boundaries |
| 3128 |
var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop); |
| 3129 |
|
| 3130 |
var flippedVariation = flippedVariationByRef || flippedVariationByContent; |
| 3131 |
|
| 3132 |
if (overlapsRef || overflowsBoundaries || flippedVariation) { |
| 3133 |
// this boolean to detect any flip loop |
| 3134 |
data.flipped = true; |
| 3135 |
|
| 3136 |
if (overlapsRef || overflowsBoundaries) { |
| 3137 |
placement = flipOrder[index + 1]; |
| 3138 |
} |
| 3139 |
|
| 3140 |
if (flippedVariation) { |
| 3141 |
variation = getOppositeVariation(variation); |
| 3142 |
} |
| 3143 |
|
| 3144 |
data.placement = placement + (variation ? '-' + variation : ''); |
| 3145 |
|
| 3146 |
// this object contains `position`, we want to preserve it along with |
| 3147 |
// any additional property we may add in the future |
| 3148 |
data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); |
| 3149 |
|
| 3150 |
data = runModifiers(data.instance.modifiers, data, 'flip'); |
| 3151 |
} |
| 3152 |
}); |
| 3153 |
return data; |
| 3154 |
} |
| 3155 |
|
| 3156 |
/** |
| 3157 |
* @function |
| 3158 |
* @memberof Modifiers |
| 3159 |
* @argument {Object} data - The data object generated by update method |
| 3160 |
* @argument {Object} options - Modifiers configuration and options |
| 3161 |
* @returns {Object} The data object, properly modified |
| 3162 |
*/ |
| 3163 |
function keepTogether(data) { |
| 3164 |
var _data$offsets = data.offsets, |
| 3165 |
popper = _data$offsets.popper, |
| 3166 |
reference = _data$offsets.reference; |
| 3167 |
|
| 3168 |
var placement = data.placement.split('-')[0]; |
| 3169 |
var floor = Math.floor; |
| 3170 |
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; |
| 3171 |
var side = isVertical ? 'right' : 'bottom'; |
| 3172 |
var opSide = isVertical ? 'left' : 'top'; |
| 3173 |
var measurement = isVertical ? 'width' : 'height'; |
| 3174 |
|
| 3175 |
if (popper[side] < floor(reference[opSide])) { |
| 3176 |
data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; |
| 3177 |
} |
| 3178 |
if (popper[opSide] > floor(reference[side])) { |
| 3179 |
data.offsets.popper[opSide] = floor(reference[side]); |
| 3180 |
} |
| 3181 |
|
| 3182 |
return data; |
| 3183 |
} |
| 3184 |
|
| 3185 |
/** |
| 3186 |
* Converts a string containing value + unit into a px value number |
| 3187 |
* @function |
| 3188 |
* @memberof {modifiers~offset} |
| 3189 |
* @private |
| 3190 |
* @argument {String} str - Value + unit string |
| 3191 |
* @argument {String} measurement - `height` or `width` |
| 3192 |
* @argument {Object} popperOffsets |
| 3193 |
* @argument {Object} referenceOffsets |
| 3194 |
* @returns {Number|String} |
| 3195 |
* Value in pixels, or original string if no values were extracted |
| 3196 |
*/ |
| 3197 |
function toValue(str, measurement, popperOffsets, referenceOffsets) { |
| 3198 |
// separate value from unit |
| 3199 |
var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); |
| 3200 |
var value = +split[1]; |
| 3201 |
var unit = split[2]; |
| 3202 |
|
| 3203 |
// If it's not a number it's an operator, I guess |
| 3204 |
if (!value) { |
| 3205 |
return str; |
| 3206 |
} |
| 3207 |
|
| 3208 |
if (unit.indexOf('%') === 0) { |
| 3209 |
var element = void 0; |
| 3210 |
switch (unit) { |
| 3211 |
case '%p': |
| 3212 |
element = popperOffsets; |
| 3213 |
break; |
| 3214 |
case '%': |
| 3215 |
case '%r': |
| 3216 |
default: |
| 3217 |
element = referenceOffsets; |
| 3218 |
} |
| 3219 |
|
| 3220 |
var rect = getClientRect(element); |
| 3221 |
return rect[measurement] / 100 * value; |
| 3222 |
} else if (unit === 'vh' || unit === 'vw') { |
| 3223 |
// if is a vh or vw, we calculate the size based on the viewport |
| 3224 |
var size = void 0; |
| 3225 |
if (unit === 'vh') { |
| 3226 |
size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); |
| 3227 |
} else { |
| 3228 |
size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); |
| 3229 |
} |
| 3230 |
return size / 100 * value; |
| 3231 |
} else { |
| 3232 |
// if is an explicit pixel unit, we get rid of the unit and keep the value |
| 3233 |
// if is an implicit unit, it's px, and we return just the value |
| 3234 |
return value; |
| 3235 |
} |
| 3236 |
} |
| 3237 |
|
| 3238 |
/** |
| 3239 |
* Parse an `offset` string to extrapolate `x` and `y` numeric offsets. |
| 3240 |
* @function |
| 3241 |
* @memberof {modifiers~offset} |
| 3242 |
* @private |
| 3243 |
* @argument {String} offset |
| 3244 |
* @argument {Object} popperOffsets |
| 3245 |
* @argument {Object} referenceOffsets |
| 3246 |
* @argument {String} basePlacement |
| 3247 |
* @returns {Array} a two cells array with x and y offsets in numbers |
| 3248 |
*/ |
| 3249 |
function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { |
| 3250 |
var offsets = [0, 0]; |
| 3251 |
|
| 3252 |
// Use height if placement is left or right and index is 0 otherwise use width |
| 3253 |
// in this way the first offset will use an axis and the second one |
| 3254 |
// will use the other one |
| 3255 |
var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; |
| 3256 |
|
| 3257 |
// Split the offset string to obtain a list of values and operands |
| 3258 |
// The regex addresses values with the plus or minus sign in front (+10, -20, etc) |
| 3259 |
var fragments = offset.split(/(\+|\-)/).map(function (frag) { |
| 3260 |
return frag.trim(); |
| 3261 |
}); |
| 3262 |
|
| 3263 |
// Detect if the offset string contains a pair of values or a single one |
| 3264 |
// they could be separated by comma or space |
| 3265 |
var divider = fragments.indexOf(find(fragments, function (frag) { |
| 3266 |
return frag.search(/,|\s/) !== -1; |
| 3267 |
})); |
| 3268 |
|
| 3269 |
if (fragments[divider] && fragments[divider].indexOf(',') === -1) { |
| 3270 |
console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); |
| 3271 |
} |
| 3272 |
|
| 3273 |
// If divider is found, we divide the list of values and operands to divide |
| 3274 |
// them by ofset X and Y. |
| 3275 |
var splitRegex = /\s*,\s*|\s+/; |
| 3276 |
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]; |
| 3277 |
|
| 3278 |
// Convert the values with units to absolute pixels to allow our computations |
| 3279 |
ops = ops.map(function (op, index) { |
| 3280 |
// Most of the units rely on the orientation of the popper |
| 3281 |
var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; |
| 3282 |
var mergeWithPrevious = false; |
| 3283 |
return op |
| 3284 |
// This aggregates any `+` or `-` sign that aren't considered operators |
| 3285 |
// e.g.: 10 + +5 => [10, +, +5] |
| 3286 |
.reduce(function (a, b) { |
| 3287 |
if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { |
| 3288 |
a[a.length - 1] = b; |
| 3289 |
mergeWithPrevious = true; |
| 3290 |
return a; |
| 3291 |
} else if (mergeWithPrevious) { |
| 3292 |
a[a.length - 1] += b; |
| 3293 |
mergeWithPrevious = false; |
| 3294 |
return a; |
| 3295 |
} else { |
| 3296 |
return a.concat(b); |
| 3297 |
} |
| 3298 |
}, []) |
| 3299 |
// Here we convert the string values into number values (in px) |
| 3300 |
.map(function (str) { |
| 3301 |
return toValue(str, measurement, popperOffsets, referenceOffsets); |
| 3302 |
}); |
| 3303 |
}); |
| 3304 |
|
| 3305 |
// Loop trough the offsets arrays and execute the operations |
| 3306 |
ops.forEach(function (op, index) { |
| 3307 |
op.forEach(function (frag, index2) { |
| 3308 |
if (isNumeric(frag)) { |
| 3309 |
offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); |
| 3310 |
} |
| 3311 |
}); |
| 3312 |
}); |
| 3313 |
return offsets; |
| 3314 |
} |
| 3315 |
|
| 3316 |
/** |
| 3317 |
* @function |
| 3318 |
* @memberof Modifiers |
| 3319 |
* @argument {Object} data - The data object generated by update method |
| 3320 |
* @argument {Object} options - Modifiers configuration and options |
| 3321 |
* @argument {Number|String} options.offset=0 |
| 3322 |
* The offset value as described in the modifier description |
| 3323 |
* @returns {Object} The data object, properly modified |
| 3324 |
*/ |
| 3325 |
function offset(data, _ref) { |
| 3326 |
var offset = _ref.offset; |
| 3327 |
var placement = data.placement, |
| 3328 |
_data$offsets = data.offsets, |
| 3329 |
popper = _data$offsets.popper, |
| 3330 |
reference = _data$offsets.reference; |
| 3331 |
|
| 3332 |
var basePlacement = placement.split('-')[0]; |
| 3333 |
|
| 3334 |
var offsets = void 0; |
| 3335 |
if (isNumeric(+offset)) { |
| 3336 |
offsets = [+offset, 0]; |
| 3337 |
} else { |
| 3338 |
offsets = parseOffset(offset, popper, reference, basePlacement); |
| 3339 |
} |
| 3340 |
|
| 3341 |
if (basePlacement === 'left') { |
| 3342 |
popper.top += offsets[0]; |
| 3343 |
popper.left -= offsets[1]; |
| 3344 |
} else if (basePlacement === 'right') { |
| 3345 |
popper.top += offsets[0]; |
| 3346 |
popper.left += offsets[1]; |
| 3347 |
} else if (basePlacement === 'top') { |
| 3348 |
popper.left += offsets[0]; |
| 3349 |
popper.top -= offsets[1]; |
| 3350 |
} else if (basePlacement === 'bottom') { |
| 3351 |
popper.left += offsets[0]; |
| 3352 |
popper.top += offsets[1]; |
| 3353 |
} |
| 3354 |
|
| 3355 |
data.popper = popper; |
| 3356 |
return data; |
| 3357 |
} |
| 3358 |
|
| 3359 |
/** |
| 3360 |
* @function |
| 3361 |
* @memberof Modifiers |
| 3362 |
* @argument {Object} data - The data object generated by `update` method |
| 3363 |
* @argument {Object} options - Modifiers configuration and options |
| 3364 |
* @returns {Object} The data object, properly modified |
| 3365 |
*/ |
| 3366 |
function preventOverflow(data, options) { |
| 3367 |
var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); |
| 3368 |
|
| 3369 |
// If offsetParent is the reference element, we really want to |
| 3370 |
// go one step up and use the next offsetParent as reference to |
| 3371 |
// avoid to make this modifier completely useless and look like broken |
| 3372 |
if (data.instance.reference === boundariesElement) { |
| 3373 |
boundariesElement = getOffsetParent(boundariesElement); |
| 3374 |
} |
| 3375 |
|
| 3376 |
// NOTE: DOM access here |
| 3377 |
// resets the popper's position so that the document size can be calculated excluding |
| 3378 |
// the size of the popper element itself |
| 3379 |
var transformProp = getSupportedPropertyName('transform'); |
| 3380 |
var popperStyles = data.instance.popper.style; // assignment to help minification |
| 3381 |
var top = popperStyles.top, |
| 3382 |
left = popperStyles.left, |
| 3383 |
transform = popperStyles[transformProp]; |
| 3384 |
|
| 3385 |
popperStyles.top = ''; |
| 3386 |
popperStyles.left = ''; |
| 3387 |
popperStyles[transformProp] = ''; |
| 3388 |
|
| 3389 |
var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); |
| 3390 |
|
| 3391 |
// NOTE: DOM access here |
| 3392 |
// restores the original style properties after the offsets have been computed |
| 3393 |
popperStyles.top = top; |
| 3394 |
popperStyles.left = left; |
| 3395 |
popperStyles[transformProp] = transform; |
| 3396 |
|
| 3397 |
options.boundaries = boundaries; |
| 3398 |
|
| 3399 |
var order = options.priority; |
| 3400 |
var popper = data.offsets.popper; |
| 3401 |
|
| 3402 |
var check = { |
| 3403 |
primary: function primary(placement) { |
| 3404 |
var value = popper[placement]; |
| 3405 |
if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { |
| 3406 |
value = Math.max(popper[placement], boundaries[placement]); |
| 3407 |
} |
| 3408 |
return defineProperty({}, placement, value); |
| 3409 |
}, |
| 3410 |
secondary: function secondary(placement) { |
| 3411 |
var mainSide = placement === 'right' ? 'left' : 'top'; |
| 3412 |
var value = popper[mainSide]; |
| 3413 |
if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { |
| 3414 |
value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); |
| 3415 |
} |
| 3416 |
return defineProperty({}, mainSide, value); |
| 3417 |
} |
| 3418 |
}; |
| 3419 |
|
| 3420 |
order.forEach(function (placement) { |
| 3421 |
var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; |
| 3422 |
popper = _extends({}, popper, check[side](placement)); |
| 3423 |
}); |
| 3424 |
|
| 3425 |
data.offsets.popper = popper; |
| 3426 |
|
| 3427 |
return data; |
| 3428 |
} |
| 3429 |
|
| 3430 |
/** |
| 3431 |
* @function |
| 3432 |
* @memberof Modifiers |
| 3433 |
* @argument {Object} data - The data object generated by `update` method |
| 3434 |
* @argument {Object} options - Modifiers configuration and options |
| 3435 |
* @returns {Object} The data object, properly modified |
| 3436 |
*/ |
| 3437 |
function shift(data) { |
| 3438 |
var placement = data.placement; |
| 3439 |
var basePlacement = placement.split('-')[0]; |
| 3440 |
var shiftvariation = placement.split('-')[1]; |
| 3441 |
|
| 3442 |
// if shift shiftvariation is specified, run the modifier |
| 3443 |
if (shiftvariation) { |
| 3444 |
var _data$offsets = data.offsets, |
| 3445 |
reference = _data$offsets.reference, |
| 3446 |
popper = _data$offsets.popper; |
| 3447 |
|
| 3448 |
var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; |
| 3449 |
var side = isVertical ? 'left' : 'top'; |
| 3450 |
var measurement = isVertical ? 'width' : 'height'; |
| 3451 |
|
| 3452 |
var shiftOffsets = { |
| 3453 |
start: defineProperty({}, side, reference[side]), |
| 3454 |
end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) |
| 3455 |
}; |
| 3456 |
|
| 3457 |
data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); |
| 3458 |
} |
| 3459 |
|
| 3460 |
return data; |
| 3461 |
} |
| 3462 |
|
| 3463 |
/** |
| 3464 |
* @function |
| 3465 |
* @memberof Modifiers |
| 3466 |
* @argument {Object} data - The data object generated by update method |
| 3467 |
* @argument {Object} options - Modifiers configuration and options |
| 3468 |
* @returns {Object} The data object, properly modified |
| 3469 |
*/ |
| 3470 |
function hide(data) { |
| 3471 |
if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { |
| 3472 |
return data; |
| 3473 |
} |
| 3474 |
|
| 3475 |
var refRect = data.offsets.reference; |
| 3476 |
var bound = find(data.instance.modifiers, function (modifier) { |
| 3477 |
return modifier.name === 'preventOverflow'; |
| 3478 |
}).boundaries; |
| 3479 |
|
| 3480 |
if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { |
| 3481 |
// Avoid unnecessary DOM access if visibility hasn't changed |
| 3482 |
if (data.hide === true) { |
| 3483 |
return data; |
| 3484 |
} |
| 3485 |
|
| 3486 |
data.hide = true; |
| 3487 |
data.attributes['x-out-of-boundaries'] = ''; |
| 3488 |
} else { |
| 3489 |
// Avoid unnecessary DOM access if visibility hasn't changed |
| 3490 |
if (data.hide === false) { |
| 3491 |
return data; |
| 3492 |
} |
| 3493 |
|
| 3494 |
data.hide = false; |
| 3495 |
data.attributes['x-out-of-boundaries'] = false; |
| 3496 |
} |
| 3497 |
|
| 3498 |
return data; |
| 3499 |
} |
| 3500 |
|
| 3501 |
/** |
| 3502 |
* @function |
| 3503 |
* @memberof Modifiers |
| 3504 |
* @argument {Object} data - The data object generated by `update` method |
| 3505 |
* @argument {Object} options - Modifiers configuration and options |
| 3506 |
* @returns {Object} The data object, properly modified |
| 3507 |
*/ |
| 3508 |
function inner(data) { |
| 3509 |
var placement = data.placement; |
| 3510 |
var basePlacement = placement.split('-')[0]; |
| 3511 |
var _data$offsets = data.offsets, |
| 3512 |
popper = _data$offsets.popper, |
| 3513 |
reference = _data$offsets.reference; |
| 3514 |
|
| 3515 |
var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; |
| 3516 |
|
| 3517 |
var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; |
| 3518 |
|
| 3519 |
popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); |
| 3520 |
|
| 3521 |
data.placement = getOppositePlacement(placement); |
| 3522 |
data.offsets.popper = getClientRect(popper); |
| 3523 |
|
| 3524 |
return data; |
| 3525 |
} |
| 3526 |
|
| 3527 |
/** |
| 3528 |
* Modifier function, each modifier can have a function of this type assigned |
| 3529 |
* to its `fn` property.<br /> |
| 3530 |
* These functions will be called on each update, this means that you must |
| 3531 |
* make sure they are performant enough to avoid performance bottlenecks. |
| 3532 |
* |
| 3533 |
* @function ModifierFn |
| 3534 |
* @argument {dataObject} data - The data object generated by `update` method |
| 3535 |
* @argument {Object} options - Modifiers configuration and options |
| 3536 |
* @returns {dataObject} The data object, properly modified |
| 3537 |
*/ |
| 3538 |
|
| 3539 |
/** |
| 3540 |
* Modifiers are plugins used to alter the behavior of your poppers.<br /> |
| 3541 |
* Popper.js uses a set of 9 modifiers to provide all the basic functionalities |
| 3542 |
* needed by the library. |
| 3543 |
* |
| 3544 |
* Usually you don't want to override the `order`, `fn` and `onLoad` props. |
| 3545 |
* All the other properties are configurations that could be tweaked. |
| 3546 |
* @namespace modifiers |
| 3547 |
*/ |
| 3548 |
var modifiers = { |
| 3549 |
/** |
| 3550 |
* Modifier used to shift the popper on the start or end of its reference |
| 3551 |
* element.<br /> |
| 3552 |
* It will read the variation of the `placement` property.<br /> |
| 3553 |
* It can be one either `-end` or `-start`. |
| 3554 |
* @memberof modifiers |
| 3555 |
* @inner |
| 3556 |
*/ |
| 3557 |
shift: { |
| 3558 |
/** @prop {number} order=100 - Index used to define the order of execution */ |
| 3559 |
order: 100, |
| 3560 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
| 3561 |
enabled: true, |
| 3562 |
/** @prop {ModifierFn} */ |
| 3563 |
fn: shift |
| 3564 |
}, |
| 3565 |
|
| 3566 |
/** |
| 3567 |
* The `offset` modifier can shift your popper on both its axis. |
| 3568 |
* |
| 3569 |
* It accepts the following units: |
| 3570 |
* - `px` or unit-less, interpreted as pixels |
| 3571 |
* - `%` or `%r`, percentage relative to the length of the reference element |
| 3572 |
* - `%p`, percentage relative to the length of the popper element |
| 3573 |
* - `vw`, CSS viewport width unit |
| 3574 |
* - `vh`, CSS viewport height unit |
| 3575 |
* |
| 3576 |
* For length is intended the main axis relative to the placement of the popper.<br /> |
| 3577 |
* This means that if the placement is `top` or `bottom`, the length will be the |
| 3578 |
* `width`. In case of `left` or `right`, it will be the `height`. |
| 3579 |
* |
| 3580 |
* You can provide a single value (as `Number` or `String`), or a pair of values |
| 3581 |
* as `String` divided by a comma or one (or more) white spaces.<br /> |
| 3582 |
* The latter is a deprecated method because it leads to confusion and will be |
| 3583 |
* removed in v2.<br /> |
| 3584 |
* Additionally, it accepts additions and subtractions between different units. |
| 3585 |
* Note that multiplications and divisions aren't supported. |
| 3586 |
* |
| 3587 |
* Valid examples are: |
| 3588 |
* ``` |
| 3589 |
* 10 |
| 3590 |
* '10%' |
| 3591 |
* '10, 10' |
| 3592 |
* '10%, 10' |
| 3593 |
* '10 + 10%' |
| 3594 |
* '10 - 5vh + 3%' |
| 3595 |
* '-10px + 5vh, 5px - 6%' |
| 3596 |
* ``` |
| 3597 |
* > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap |
| 3598 |
* > with their reference element, unfortunately, you will have to disable the `flip` modifier. |
| 3599 |
* > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). |
| 3600 |
* |
| 3601 |
* @memberof modifiers |
| 3602 |
* @inner |
| 3603 |
*/ |
| 3604 |
offset: { |
| 3605 |
/** @prop {number} order=200 - Index used to define the order of execution */ |
| 3606 |
order: 200, |
| 3607 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
| 3608 |
enabled: true, |
| 3609 |
/** @prop {ModifierFn} */ |
| 3610 |
fn: offset, |
| 3611 |
/** @prop {Number|String} offset=0 |
| 3612 |
* The offset value as described in the modifier description |
| 3613 |
*/ |
| 3614 |
offset: 0 |
| 3615 |
}, |
| 3616 |
|
| 3617 |
/** |
| 3618 |
* Modifier used to prevent the popper from being positioned outside the boundary. |
| 3619 |
* |
| 3620 |
* A scenario exists where the reference itself is not within the boundaries.<br /> |
| 3621 |
* We can say it has "escaped the boundaries" — or just "escaped".<br /> |
| 3622 |
* In this case we need to decide whether the popper should either: |
| 3623 |
* |
| 3624 |
* - detach from the reference and remain "trapped" in the boundaries, or |
| 3625 |
* - if it should ignore the boundary and "escape with its reference" |
| 3626 |
* |
| 3627 |
* When `escapeWithReference` is set to`true` and reference is completely |
| 3628 |
* outside its boundaries, the popper will overflow (or completely leave) |
| 3629 |
* the boundaries in order to remain attached to the edge of the reference. |
| 3630 |
* |
| 3631 |
* @memberof modifiers |
| 3632 |
* @inner |
| 3633 |
*/ |
| 3634 |
preventOverflow: { |
| 3635 |
/** @prop {number} order=300 - Index used to define the order of execution */ |
| 3636 |
order: 300, |
| 3637 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
| 3638 |
enabled: true, |
| 3639 |
/** @prop {ModifierFn} */ |
| 3640 |
fn: preventOverflow, |
| 3641 |
/** |
| 3642 |
* @prop {Array} [priority=['left','right','top','bottom']] |
| 3643 |
* Popper will try to prevent overflow following these priorities by default, |
| 3644 |
* then, it could overflow on the left and on top of the `boundariesElement` |
| 3645 |
*/ |
| 3646 |
priority: ['left', 'right', 'top', 'bottom'], |
| 3647 |
/** |
| 3648 |
* @prop {number} padding=5 |
| 3649 |
* Amount of pixel used to define a minimum distance between the boundaries |
| 3650 |
* and the popper. This makes sure the popper always has a little padding |
| 3651 |
* between the edges of its container |
| 3652 |
*/ |
| 3653 |
padding: 5, |
| 3654 |
/** |
| 3655 |
* @prop {String|HTMLElement} boundariesElement='scrollParent' |
| 3656 |
* Boundaries used by the modifier. Can be `scrollParent`, `window`, |
| 3657 |
* `viewport` or any DOM element. |
| 3658 |
*/ |
| 3659 |
boundariesElement: 'scrollParent' |
| 3660 |
}, |
| 3661 |
|
| 3662 |
/** |
| 3663 |
* Modifier used to make sure the reference and its popper stay near each other |
| 3664 |
* without leaving any gap between the two. Especially useful when the arrow is |
| 3665 |
* enabled and you want to ensure that it points to its reference element. |
| 3666 |
* It cares only about the first axis. You can still have poppers with margin |
| 3667 |
* between the popper and its reference element. |
| 3668 |
* @memberof modifiers |
| 3669 |
* @inner |
| 3670 |
*/ |
| 3671 |
keepTogether: { |
| 3672 |
/** @prop {number} order=400 - Index used to define the order of execution */ |
| 3673 |
order: 400, |
| 3674 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
| 3675 |
enabled: true, |
| 3676 |
/** @prop {ModifierFn} */ |
| 3677 |
fn: keepTogether |
| 3678 |
}, |
| 3679 |
|
| 3680 |
/** |
| 3681 |
* This modifier is used to move the `arrowElement` of the popper to make |
| 3682 |
* sure it is positioned between the reference element and its popper element. |
| 3683 |
* It will read the outer size of the `arrowElement` node to detect how many |
| 3684 |
* pixels of conjunction are needed. |
| 3685 |
* |
| 3686 |
* It has no effect if no `arrowElement` is provided. |
| 3687 |
* @memberof modifiers |
| 3688 |
* @inner |
| 3689 |
*/ |
| 3690 |
arrow: { |
| 3691 |
/** @prop {number} order=500 - Index used to define the order of execution */ |
| 3692 |
order: 500, |
| 3693 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
| 3694 |
enabled: true, |
| 3695 |
/** @prop {ModifierFn} */ |
| 3696 |
fn: arrow, |
| 3697 |
/** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ |
| 3698 |
element: '[x-arrow]' |
| 3699 |
}, |
| 3700 |
|
| 3701 |
/** |
| 3702 |
* Modifier used to flip the popper's placement when it starts to overlap its |
| 3703 |
* reference element. |
| 3704 |
* |
| 3705 |
* Requires the `preventOverflow` modifier before it in order to work. |
| 3706 |
* |
| 3707 |
* **NOTE:** this modifier will interrupt the current update cycle and will |
| 3708 |
* restart it if it detects the need to flip the placement. |
| 3709 |
* @memberof modifiers |
| 3710 |
* @inner |
| 3711 |
*/ |
| 3712 |
flip: { |
| 3713 |
/** @prop {number} order=600 - Index used to define the order of execution */ |
| 3714 |
order: 600, |
| 3715 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
| 3716 |
enabled: true, |
| 3717 |
/** @prop {ModifierFn} */ |
| 3718 |
fn: flip, |
| 3719 |
/** |
| 3720 |
* @prop {String|Array} behavior='flip' |
| 3721 |
* The behavior used to change the popper's placement. It can be one of |
| 3722 |
* `flip`, `clockwise`, `counterclockwise` or an array with a list of valid |
| 3723 |
* placements (with optional variations) |
| 3724 |
*/ |
| 3725 |
behavior: 'flip', |
| 3726 |
/** |
| 3727 |
* @prop {number} padding=5 |
| 3728 |
* The popper will flip if it hits the edges of the `boundariesElement` |
| 3729 |
*/ |
| 3730 |
padding: 5, |
| 3731 |
/** |
| 3732 |
* @prop {String|HTMLElement} boundariesElement='viewport' |
| 3733 |
* The element which will define the boundaries of the popper position. |
| 3734 |
* The popper will never be placed outside of the defined boundaries |
| 3735 |
* (except if `keepTogether` is enabled) |
| 3736 |
*/ |
| 3737 |
boundariesElement: 'viewport', |
| 3738 |
/** |
| 3739 |
* @prop {Boolean} flipVariations=false |
| 3740 |
* The popper will switch placement variation between `-start` and `-end` when |
| 3741 |
* the reference element overlaps its boundaries. |
| 3742 |
* |
| 3743 |
* The original placement should have a set variation. |
| 3744 |
*/ |
| 3745 |
flipVariations: false, |
| 3746 |
/** |
| 3747 |
* @prop {Boolean} flipVariationsByContent=false |
| 3748 |
* The popper will switch placement variation between `-start` and `-end` when |
| 3749 |
* the popper element overlaps its reference boundaries. |
| 3750 |
* |
| 3751 |
* The original placement should have a set variation. |
| 3752 |
*/ |
| 3753 |
flipVariationsByContent: false |
| 3754 |
}, |
| 3755 |
|
| 3756 |
/** |
| 3757 |
* Modifier used to make the popper flow toward the inner of the reference element. |
| 3758 |
* By default, when this modifier is disabled, the popper will be placed outside |
| 3759 |
* the reference element. |
| 3760 |
* @memberof modifiers |
| 3761 |
* @inner |
| 3762 |
*/ |
| 3763 |
inner: { |
| 3764 |
/** @prop {number} order=700 - Index used to define the order of execution */ |
| 3765 |
order: 700, |
| 3766 |
/** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ |
| 3767 |
enabled: false, |
| 3768 |
/** @prop {ModifierFn} */ |
| 3769 |
fn: inner |
| 3770 |
}, |
| 3771 |
|
| 3772 |
/** |
| 3773 |
* Modifier used to hide the popper when its reference element is outside of the |
| 3774 |
* popper boundaries. It will set a `x-out-of-boundaries` attribute which can |
| 3775 |
* be used to hide with a CSS selector the popper when its reference is |
| 3776 |
* out of boundaries. |
| 3777 |
* |
| 3778 |
* Requires the `preventOverflow` modifier before it in order to work. |
| 3779 |
* @memberof modifiers |
| 3780 |
* @inner |
| 3781 |
*/ |
| 3782 |
hide: { |
| 3783 |
/** @prop {number} order=800 - Index used to define the order of execution */ |
| 3784 |
order: 800, |
| 3785 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
| 3786 |
enabled: true, |
| 3787 |
/** @prop {ModifierFn} */ |
| 3788 |
fn: hide |
| 3789 |
}, |
| 3790 |
|
| 3791 |
/** |
| 3792 |
* Computes the style that will be applied to the popper element to gets |
| 3793 |
* properly positioned. |
| 3794 |
* |
| 3795 |
* Note that this modifier will not touch the DOM, it just prepares the styles |
| 3796 |
* so that `applyStyle` modifier can apply it. This separation is useful |
| 3797 |
* in case you need to replace `applyStyle` with a custom implementation. |
| 3798 |
* |
| 3799 |
* This modifier has `850` as `order` value to maintain backward compatibility |
| 3800 |
* with previous versions of Popper.js. Expect the modifiers ordering method |
| 3801 |
* to change in future major versions of the library. |
| 3802 |
* |
| 3803 |
* @memberof modifiers |
| 3804 |
* @inner |
| 3805 |
*/ |
| 3806 |
computeStyle: { |
| 3807 |
/** @prop {number} order=850 - Index used to define the order of execution */ |
| 3808 |
order: 850, |
| 3809 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
| 3810 |
enabled: true, |
| 3811 |
/** @prop {ModifierFn} */ |
| 3812 |
fn: computeStyle, |
| 3813 |
/** |
| 3814 |
* @prop {Boolean} gpuAcceleration=true |
| 3815 |
* If true, it uses the CSS 3D transformation to position the popper. |
| 3816 |
* Otherwise, it will use the `top` and `left` properties |
| 3817 |
*/ |
| 3818 |
gpuAcceleration: true, |
| 3819 |
/** |
| 3820 |
* @prop {string} [x='bottom'] |
| 3821 |
* Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. |
| 3822 |
* Change this if your popper should grow in a direction different from `bottom` |
| 3823 |
*/ |
| 3824 |
x: 'bottom', |
| 3825 |
/** |
| 3826 |
* @prop {string} [x='left'] |
| 3827 |
* Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. |
| 3828 |
* Change this if your popper should grow in a direction different from `right` |
| 3829 |
*/ |
| 3830 |
y: 'right' |
| 3831 |
}, |
| 3832 |
|
| 3833 |
/** |
| 3834 |
* Applies the computed styles to the popper element. |
| 3835 |
* |
| 3836 |
* All the DOM manipulations are limited to this modifier. This is useful in case |
| 3837 |
* you want to integrate Popper.js inside a framework or view library and you |
| 3838 |
* want to delegate all the DOM manipulations to it. |
| 3839 |
* |
| 3840 |
* Note that if you disable this modifier, you must make sure the popper element |
| 3841 |
* has its position set to `absolute` before Popper.js can do its work! |
| 3842 |
* |
| 3843 |
* Just disable this modifier and define your own to achieve the desired effect. |
| 3844 |
* |
| 3845 |
* @memberof modifiers |
| 3846 |
* @inner |
| 3847 |
*/ |
| 3848 |
applyStyle: { |
| 3849 |
/** @prop {number} order=900 - Index used to define the order of execution */ |
| 3850 |
order: 900, |
| 3851 |
/** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ |
| 3852 |
enabled: true, |
| 3853 |
/** @prop {ModifierFn} */ |
| 3854 |
fn: applyStyle, |
| 3855 |
/** @prop {Function} */ |
| 3856 |
onLoad: applyStyleOnLoad, |
| 3857 |
/** |
| 3858 |
* @deprecated since version 1.10.0, the property moved to `computeStyle` modifier |
| 3859 |
* @prop {Boolean} gpuAcceleration=true |
| 3860 |
* If true, it uses the CSS 3D transformation to position the popper. |
| 3861 |
* Otherwise, it will use the `top` and `left` properties |
| 3862 |
*/ |
| 3863 |
gpuAcceleration: undefined |
| 3864 |
} |
| 3865 |
}; |
| 3866 |
|
| 3867 |
/** |
| 3868 |
* The `dataObject` is an object containing all the information used by Popper.js. |
| 3869 |
* This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. |
| 3870 |
* @name dataObject |
| 3871 |
* @property {Object} data.instance The Popper.js instance |
| 3872 |
* @property {String} data.placement Placement applied to popper |
| 3873 |
* @property {String} data.originalPlacement Placement originally defined on init |
| 3874 |
* @property {Boolean} data.flipped True if popper has been flipped by flip modifier |
| 3875 |
* @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper |
| 3876 |
* @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier |
| 3877 |
* @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) |
| 3878 |
* @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) |
| 3879 |
* @property {Object} data.boundaries Offsets of the popper boundaries |
| 3880 |
* @property {Object} data.offsets The measurements of popper, reference and arrow elements |
| 3881 |
* @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values |
| 3882 |
* @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values |
| 3883 |
* @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 |
| 3884 |
*/ |
| 3885 |
|
| 3886 |
/** |
| 3887 |
* Default options provided to Popper.js constructor.<br /> |
| 3888 |
* These can be overridden using the `options` argument of Popper.js.<br /> |
| 3889 |
* To override an option, simply pass an object with the same |
| 3890 |
* structure of the `options` object, as the 3rd argument. For example: |
| 3891 |
* ``` |
| 3892 |
* new Popper(ref, pop, { |
| 3893 |
* modifiers: { |
| 3894 |
* preventOverflow: { enabled: false } |
| 3895 |
* } |
| 3896 |
* }) |
| 3897 |
* ``` |
| 3898 |
* @type {Object} |
| 3899 |
* @static |
| 3900 |
* @memberof Popper |
| 3901 |
*/ |
| 3902 |
var Defaults = { |
| 3903 |
/** |
| 3904 |
* Popper's placement. |
| 3905 |
* @prop {Popper.placements} placement='bottom' |
| 3906 |
*/ |
| 3907 |
placement: 'bottom', |
| 3908 |
|
| 3909 |
/** |
| 3910 |
* Set this to true if you want popper to position it self in 'fixed' mode |
| 3911 |
* @prop {Boolean} positionFixed=false |
| 3912 |
*/ |
| 3913 |
positionFixed: false, |
| 3914 |
|
| 3915 |
/** |
| 3916 |
* Whether events (resize, scroll) are initially enabled. |
| 3917 |
* @prop {Boolean} eventsEnabled=true |
| 3918 |
*/ |
| 3919 |
eventsEnabled: true, |
| 3920 |
|
| 3921 |
/** |
| 3922 |
* Set to true if you want to automatically remove the popper when |
| 3923 |
* you call the `destroy` method. |
| 3924 |
* @prop {Boolean} removeOnDestroy=false |
| 3925 |
*/ |
| 3926 |
removeOnDestroy: false, |
| 3927 |
|
| 3928 |
/** |
| 3929 |
* Callback called when the popper is created.<br /> |
| 3930 |
* By default, it is set to no-op.<br /> |
| 3931 |
* Access Popper.js instance with `data.instance`. |
| 3932 |
* @prop {onCreate} |
| 3933 |
*/ |
| 3934 |
onCreate: function onCreate() {}, |
| 3935 |
|
| 3936 |
/** |
| 3937 |
* Callback called when the popper is updated. This callback is not called |
| 3938 |
* on the initialization/creation of the popper, but only on subsequent |
| 3939 |
* updates.<br /> |
| 3940 |
* By default, it is set to no-op.<br /> |
| 3941 |
* Access Popper.js instance with `data.instance`. |
| 3942 |
* @prop {onUpdate} |
| 3943 |
*/ |
| 3944 |
onUpdate: function onUpdate() {}, |
| 3945 |
|
| 3946 |
/** |
| 3947 |
* List of modifiers used to modify the offsets before they are applied to the popper. |
| 3948 |
* They provide most of the functionalities of Popper.js. |
| 3949 |
* @prop {modifiers} |
| 3950 |
*/ |
| 3951 |
modifiers: modifiers |
| 3952 |
}; |
| 3953 |
|
| 3954 |
/** |
| 3955 |
* @callback onCreate |
| 3956 |
* @param {dataObject} data |
| 3957 |
*/ |
| 3958 |
|
| 3959 |
/** |
| 3960 |
* @callback onUpdate |
| 3961 |
* @param {dataObject} data |
| 3962 |
*/ |
| 3963 |
|
| 3964 |
// Utils |
| 3965 |
// Methods |
| 3966 |
var Popper = function () { |
| 3967 |
/** |
| 3968 |
* Creates a new Popper.js instance. |
| 3969 |
* @class Popper |
| 3970 |
* @param {Element|referenceObject} reference - The reference element used to position the popper |
| 3971 |
* @param {Element} popper - The HTML / XML element used as the popper |
| 3972 |
* @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) |
| 3973 |
* @return {Object} instance - The generated Popper.js instance |
| 3974 |
*/ |
| 3975 |
function Popper(reference, popper) { |
| 3976 |
var _this = this; |
| 3977 |
|
| 3978 |
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
| 3979 |
classCallCheck(this, Popper); |
| 3980 |
|
| 3981 |
this.scheduleUpdate = function () { |
| 3982 |
return requestAnimationFrame(_this.update); |
| 3983 |
}; |
| 3984 |
|
| 3985 |
// make update() debounced, so that it only runs at most once-per-tick |
| 3986 |
this.update = debounce(this.update.bind(this)); |
| 3987 |
|
| 3988 |
// with {} we create a new object with the options inside it |
| 3989 |
this.options = _extends({}, Popper.Defaults, options); |
| 3990 |
|
| 3991 |
// init state |
| 3992 |
this.state = { |
| 3993 |
isDestroyed: false, |
| 3994 |
isCreated: false, |
| 3995 |
scrollParents: [] |
| 3996 |
}; |
| 3997 |
|
| 3998 |
// get reference and popper elements (allow jQuery wrappers) |
| 3999 |
this.reference = reference && reference.jquery ? reference[0] : reference; |
| 4000 |
this.popper = popper && popper.jquery ? popper[0] : popper; |
| 4001 |
|
| 4002 |
// Deep merge modifiers options |
| 4003 |
this.options.modifiers = {}; |
| 4004 |
Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { |
| 4005 |
_this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); |
| 4006 |
}); |
| 4007 |
|
| 4008 |
// Refactoring modifiers' list (Object => Array) |
| 4009 |
this.modifiers = Object.keys(this.options.modifiers).map(function (name) { |
| 4010 |
return _extends({ |
| 4011 |
name: name |
| 4012 |
}, _this.options.modifiers[name]); |
| 4013 |
}) |
| 4014 |
// sort the modifiers by order |
| 4015 |
.sort(function (a, b) { |
| 4016 |
return a.order - b.order; |
| 4017 |
}); |
| 4018 |
|
| 4019 |
// modifiers have the ability to execute arbitrary code when Popper.js get inited |
| 4020 |
// such code is executed in the same order of its modifier |
| 4021 |
// they could add new properties to their options configuration |
| 4022 |
// BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! |
| 4023 |
this.modifiers.forEach(function (modifierOptions) { |
| 4024 |
if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { |
| 4025 |
modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); |
| 4026 |
} |
| 4027 |
}); |
| 4028 |
|
| 4029 |
// fire the first update to position the popper in the right place |
| 4030 |
this.update(); |
| 4031 |
|
| 4032 |
var eventsEnabled = this.options.eventsEnabled; |
| 4033 |
if (eventsEnabled) { |
| 4034 |
// setup event listeners, they will take care of update the position in specific situations |
| 4035 |
this.enableEventListeners(); |
| 4036 |
} |
| 4037 |
|
| 4038 |
this.state.eventsEnabled = eventsEnabled; |
| 4039 |
} |
| 4040 |
|
| 4041 |
// We can't use class properties because they don't get listed in the |
| 4042 |
// class prototype and break stuff like Sinon stubs |
| 4043 |
|
| 4044 |
|
| 4045 |
createClass(Popper, [{ |
| 4046 |
key: 'update', |
| 4047 |
value: function update$$1() { |
| 4048 |
return update.call(this); |
| 4049 |
} |
| 4050 |
}, { |
| 4051 |
key: 'destroy', |
| 4052 |
value: function destroy$$1() { |
| 4053 |
return destroy.call(this); |
| 4054 |
} |
| 4055 |
}, { |
| 4056 |
key: 'enableEventListeners', |
| 4057 |
value: function enableEventListeners$$1() { |
| 4058 |
return enableEventListeners.call(this); |
| 4059 |
} |
| 4060 |
}, { |
| 4061 |
key: 'disableEventListeners', |
| 4062 |
value: function disableEventListeners$$1() { |
| 4063 |
return disableEventListeners.call(this); |
| 4064 |
} |
| 4065 |
|
| 4066 |
/** |
| 4067 |
* Schedules an update. It will run on the next UI update available. |
| 4068 |
* @method scheduleUpdate |
| 4069 |
* @memberof Popper |
| 4070 |
*/ |
| 4071 |
|
| 4072 |
|
| 4073 |
/** |
| 4074 |
* Collection of utilities useful when writing custom modifiers. |
| 4075 |
* Starting from version 1.7, this method is available only if you |
| 4076 |
* include `popper-utils.js` before `popper.js`. |
| 4077 |
* |
| 4078 |
* **DEPRECATION**: This way to access PopperUtils is deprecated |
| 4079 |
* and will be removed in v2! Use the PopperUtils module directly instead. |
| 4080 |
* Due to the high instability of the methods contained in Utils, we can't |
| 4081 |
* guarantee them to follow semver. Use them at your own risk! |
| 4082 |
* @static |
| 4083 |
* @private |
| 4084 |
* @type {Object} |
| 4085 |
* @deprecated since version 1.8 |
| 4086 |
* @member Utils |
| 4087 |
* @memberof Popper |
| 4088 |
*/ |
| 4089 |
|
| 4090 |
}]); |
| 4091 |
return Popper; |
| 4092 |
}(); |
| 4093 |
|
| 4094 |
/** |
| 4095 |
* The `referenceObject` is an object that provides an interface compatible with Popper.js |
| 4096 |
* and lets you use it as replacement of a real DOM node.<br /> |
| 4097 |
* You can use this method to position a popper relatively to a set of coordinates |
| 4098 |
* in case you don't have a DOM node to use as reference. |
| 4099 |
* |
| 4100 |
* ``` |
| 4101 |
* new Popper(referenceObject, popperNode); |
| 4102 |
* ``` |
| 4103 |
* |
| 4104 |
* NB: This feature isn't supported in Internet Explorer 10. |
| 4105 |
* @name referenceObject |
| 4106 |
* @property {Function} data.getBoundingClientRect |
| 4107 |
* A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. |
| 4108 |
* @property {number} data.clientWidth |
| 4109 |
* An ES6 getter that will return the width of the virtual reference element. |
| 4110 |
* @property {number} data.clientHeight |
| 4111 |
* An ES6 getter that will return the height of the virtual reference element. |
| 4112 |
*/ |
| 4113 |
|
| 4114 |
|
| 4115 |
Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; |
| 4116 |
Popper.placements = placements; |
| 4117 |
Popper.Defaults = Defaults; |
| 4118 |
|
| 4119 |
var Popper$1 = Popper; |
| 4120 |
|
| 4121 |
/** |
| 4122 |
* Constants |
| 4123 |
*/ |
| 4124 |
|
| 4125 |
var NAME$6 = 'dropdown'; |
| 4126 |
var VERSION$6 = '4.6.2'; |
| 4127 |
var DATA_KEY$6 = 'bs.dropdown'; |
| 4128 |
var EVENT_KEY$6 = "." + DATA_KEY$6; |
| 4129 |
var DATA_API_KEY$3 = '.data-api'; |
| 4130 |
var JQUERY_NO_CONFLICT$6 = $__default["default"].fn[NAME$6]; |
| 4131 |
var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key |
| 4132 |
|
| 4133 |
var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key |
| 4134 |
|
| 4135 |
var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key |
| 4136 |
|
| 4137 |
var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key |
| 4138 |
|
| 4139 |
var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key |
| 4140 |
|
| 4141 |
var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) |
| 4142 |
|
| 4143 |
var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE$1); |
| 4144 |
var CLASS_NAME_DISABLED$1 = 'disabled'; |
| 4145 |
var CLASS_NAME_SHOW$5 = 'show'; |
| 4146 |
var CLASS_NAME_DROPUP = 'dropup'; |
| 4147 |
var CLASS_NAME_DROPRIGHT = 'dropright'; |
| 4148 |
var CLASS_NAME_DROPLEFT = 'dropleft'; |
| 4149 |
var CLASS_NAME_MENURIGHT = 'dropdown-menu-right'; |
| 4150 |
var CLASS_NAME_POSITION_STATIC = 'position-static'; |
| 4151 |
var EVENT_HIDE$3 = "hide" + EVENT_KEY$6; |
| 4152 |
var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$6; |
| 4153 |
var EVENT_SHOW$3 = "show" + EVENT_KEY$6; |
| 4154 |
var EVENT_SHOWN$3 = "shown" + EVENT_KEY$6; |
| 4155 |
var EVENT_CLICK = "click" + EVENT_KEY$6; |
| 4156 |
var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$6 + DATA_API_KEY$3; |
| 4157 |
var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$6 + DATA_API_KEY$3; |
| 4158 |
var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$6 + DATA_API_KEY$3; |
| 4159 |
var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]'; |
| 4160 |
var SELECTOR_FORM_CHILD = '.dropdown form'; |
| 4161 |
var SELECTOR_MENU = '.dropdown-menu'; |
| 4162 |
var SELECTOR_NAVBAR_NAV = '.navbar-nav'; |
| 4163 |
var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; |
| 4164 |
var PLACEMENT_TOP = 'top-start'; |
| 4165 |
var PLACEMENT_TOPEND = 'top-end'; |
| 4166 |
var PLACEMENT_BOTTOM = 'bottom-start'; |
| 4167 |
var PLACEMENT_BOTTOMEND = 'bottom-end'; |
| 4168 |
var PLACEMENT_RIGHT = 'right-start'; |
| 4169 |
var PLACEMENT_LEFT = 'left-start'; |
| 4170 |
var Default$5 = { |
| 4171 |
offset: 0, |
| 4172 |
flip: true, |
| 4173 |
boundary: 'scrollParent', |
| 4174 |
reference: 'toggle', |
| 4175 |
display: 'dynamic', |
| 4176 |
popperConfig: null |
| 4177 |
}; |
| 4178 |
var DefaultType$5 = { |
| 4179 |
offset: '(number|string|function)', |
| 4180 |
flip: 'boolean', |
| 4181 |
boundary: '(string|element)', |
| 4182 |
reference: '(string|element)', |
| 4183 |
display: 'string', |
| 4184 |
popperConfig: '(null|object)' |
| 4185 |
}; |
| 4186 |
/** |
| 4187 |
* Class definition |
| 4188 |
*/ |
| 4189 |
|
| 4190 |
var Dropdown = /*#__PURE__*/function () { |
| 4191 |
function Dropdown(element, config) { |
| 4192 |
this._element = element; |
| 4193 |
this._popper = null; |
| 4194 |
this._config = this._getConfig(config); |
| 4195 |
this._menu = this._getMenuElement(); |
| 4196 |
this._inNavbar = this._detectNavbar(); |
| 4197 |
|
| 4198 |
this._addEventListeners(); |
| 4199 |
} // Getters |
| 4200 |
|
| 4201 |
|
| 4202 |
var _proto = Dropdown.prototype; |
| 4203 |
|
| 4204 |
// Public |
| 4205 |
_proto.toggle = function toggle() { |
| 4206 |
if (this._element.disabled || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED$1)) { |
| 4207 |
return; |
| 4208 |
} |
| 4209 |
|
| 4210 |
var isActive = $__default["default"](this._menu).hasClass(CLASS_NAME_SHOW$5); |
| 4211 |
|
| 4212 |
Dropdown._clearMenus(); |
| 4213 |
|
| 4214 |
if (isActive) { |
| 4215 |
return; |
| 4216 |
} |
| 4217 |
|
| 4218 |
this.show(true); |
| 4219 |
}; |
| 4220 |
|
| 4221 |
_proto.show = function show(usePopper) { |
| 4222 |
if (usePopper === void 0) { |
| 4223 |
usePopper = false; |
| 4224 |
} |
| 4225 |
|
| 4226 |
if (this._element.disabled || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED$1) || $__default["default"](this._menu).hasClass(CLASS_NAME_SHOW$5)) { |
| 4227 |
return; |
| 4228 |
} |
| 4229 |
|
| 4230 |
var relatedTarget = { |
| 4231 |
relatedTarget: this._element |
| 4232 |
}; |
| 4233 |
var showEvent = $__default["default"].Event(EVENT_SHOW$3, relatedTarget); |
| 4234 |
|
| 4235 |
var parent = Dropdown._getParentFromElement(this._element); |
| 4236 |
|
| 4237 |
$__default["default"](parent).trigger(showEvent); |
| 4238 |
|
| 4239 |
if (showEvent.isDefaultPrevented()) { |
| 4240 |
return; |
| 4241 |
} // Totally disable Popper for Dropdowns in Navbar |
| 4242 |
|
| 4243 |
|
| 4244 |
if (!this._inNavbar && usePopper) { |
| 4245 |
// Check for Popper dependency |
| 4246 |
if (typeof Popper$1 === 'undefined') { |
| 4247 |
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)'); |
| 4248 |
} |
| 4249 |
|
| 4250 |
var referenceElement = this._element; |
| 4251 |
|
| 4252 |
if (this._config.reference === 'parent') { |
| 4253 |
referenceElement = parent; |
| 4254 |
} else if (Util.isElement(this._config.reference)) { |
| 4255 |
referenceElement = this._config.reference; // Check if it's jQuery element |
| 4256 |
|
| 4257 |
if (typeof this._config.reference.jquery !== 'undefined') { |
| 4258 |
referenceElement = this._config.reference[0]; |
| 4259 |
} |
| 4260 |
} // If boundary is not `scrollParent`, then set position to `static` |
| 4261 |
// to allow the menu to "escape" the scroll parent's boundaries |
| 4262 |
// https://github.com/twbs/bootstrap/issues/24251 |
| 4263 |
|
| 4264 |
|
| 4265 |
if (this._config.boundary !== 'scrollParent') { |
| 4266 |
$__default["default"](parent).addClass(CLASS_NAME_POSITION_STATIC); |
| 4267 |
} |
| 4268 |
|
| 4269 |
this._popper = new Popper$1(referenceElement, this._menu, this._getPopperConfig()); |
| 4270 |
} // If this is a touch-enabled device we add extra |
| 4271 |
// empty mouseover listeners to the body's immediate children; |
| 4272 |
// only needed because of broken event delegation on iOS |
| 4273 |
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html |
| 4274 |
|
| 4275 |
|
| 4276 |
if ('ontouchstart' in document.documentElement && $__default["default"](parent).closest(SELECTOR_NAVBAR_NAV).length === 0) { |
| 4277 |
$__default["default"](document.body).children().on('mouseover', null, $__default["default"].noop); |
| 4278 |
} |
| 4279 |
|
| 4280 |
this._element.focus(); |
| 4281 |
|
| 4282 |
this._element.setAttribute('aria-expanded', true); |
| 4283 |
|
| 4284 |
$__default["default"](this._menu).toggleClass(CLASS_NAME_SHOW$5); |
| 4285 |
$__default["default"](parent).toggleClass(CLASS_NAME_SHOW$5).trigger($__default["default"].Event(EVENT_SHOWN$3, relatedTarget)); |
| 4286 |
}; |
| 4287 |
|
| 4288 |
_proto.hide = function hide() { |
| 4289 |
if (this._element.disabled || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED$1) || !$__default["default"](this._menu).hasClass(CLASS_NAME_SHOW$5)) { |
| 4290 |
return; |
| 4291 |
} |
| 4292 |
|
| 4293 |
var relatedTarget = { |
| 4294 |
relatedTarget: this._element |
| 4295 |
}; |
| 4296 |
var hideEvent = $__default["default"].Event(EVENT_HIDE$3, relatedTarget); |
| 4297 |
|
| 4298 |
var parent = Dropdown._getParentFromElement(this._element); |
| 4299 |
|
| 4300 |
$__default["default"](parent).trigger(hideEvent); |
| 4301 |
|
| 4302 |
if (hideEvent.isDefaultPrevented()) { |
| 4303 |
return; |
| 4304 |
} |
| 4305 |
|
| 4306 |
if (this._popper) { |
| 4307 |
this._popper.destroy(); |
| 4308 |
} |
| 4309 |
|
| 4310 |
$__default["default"](this._menu).toggleClass(CLASS_NAME_SHOW$5); |
| 4311 |
$__default["default"](parent).toggleClass(CLASS_NAME_SHOW$5).trigger($__default["default"].Event(EVENT_HIDDEN$3, relatedTarget)); |
| 4312 |
}; |
| 4313 |
|
| 4314 |
_proto.dispose = function dispose() { |
| 4315 |
$__default["default"].removeData(this._element, DATA_KEY$6); |
| 4316 |
$__default["default"](this._element).off(EVENT_KEY$6); |
| 4317 |
this._element = null; |
| 4318 |
this._menu = null; |
| 4319 |
|
| 4320 |
if (this._popper !== null) { |
| 4321 |
this._popper.destroy(); |
| 4322 |
|
| 4323 |
this._popper = null; |
| 4324 |
} |
| 4325 |
}; |
| 4326 |
|
| 4327 |
_proto.update = function update() { |
| 4328 |
this._inNavbar = this._detectNavbar(); |
| 4329 |
|
| 4330 |
if (this._popper !== null) { |
| 4331 |
this._popper.scheduleUpdate(); |
| 4332 |
} |
| 4333 |
} // Private |
| 4334 |
; |
| 4335 |
|
| 4336 |
_proto._addEventListeners = function _addEventListeners() { |
| 4337 |
var _this = this; |
| 4338 |
|
| 4339 |
$__default["default"](this._element).on(EVENT_CLICK, function (event) { |
| 4340 |
event.preventDefault(); |
| 4341 |
event.stopPropagation(); |
| 4342 |
|
| 4343 |
_this.toggle(); |
| 4344 |
}); |
| 4345 |
}; |
| 4346 |
|
| 4347 |
_proto._getConfig = function _getConfig(config) { |
| 4348 |
config = _extends$1({}, this.constructor.Default, $__default["default"](this._element).data(), config); |
| 4349 |
Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType); |
| 4350 |
return config; |
| 4351 |
}; |
| 4352 |
|
| 4353 |
_proto._getMenuElement = function _getMenuElement() { |
| 4354 |
if (!this._menu) { |
| 4355 |
var parent = Dropdown._getParentFromElement(this._element); |
| 4356 |
|
| 4357 |
if (parent) { |
| 4358 |
this._menu = parent.querySelector(SELECTOR_MENU); |
| 4359 |
} |
| 4360 |
} |
| 4361 |
|
| 4362 |
return this._menu; |
| 4363 |
}; |
| 4364 |
|
| 4365 |
_proto._getPlacement = function _getPlacement() { |
| 4366 |
var $parentDropdown = $__default["default"](this._element.parentNode); |
| 4367 |
var placement = PLACEMENT_BOTTOM; // Handle dropup |
| 4368 |
|
| 4369 |
if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) { |
| 4370 |
placement = $__default["default"](this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP; |
| 4371 |
} else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) { |
| 4372 |
placement = PLACEMENT_RIGHT; |
| 4373 |
} else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) { |
| 4374 |
placement = PLACEMENT_LEFT; |
| 4375 |
} else if ($__default["default"](this._menu).hasClass(CLASS_NAME_MENURIGHT)) { |
| 4376 |
placement = PLACEMENT_BOTTOMEND; |
| 4377 |
} |
| 4378 |
|
| 4379 |
return placement; |
| 4380 |
}; |
| 4381 |
|
| 4382 |
_proto._detectNavbar = function _detectNavbar() { |
| 4383 |
return $__default["default"](this._element).closest('.navbar').length > 0; |
| 4384 |
}; |
| 4385 |
|
| 4386 |
_proto._getOffset = function _getOffset() { |
| 4387 |
var _this2 = this; |
| 4388 |
|
| 4389 |
var offset = {}; |
| 4390 |
|
| 4391 |
if (typeof this._config.offset === 'function') { |
| 4392 |
offset.fn = function (data) { |
| 4393 |
data.offsets = _extends$1({}, data.offsets, _this2._config.offset(data.offsets, _this2._element)); |
| 4394 |
return data; |
| 4395 |
}; |
| 4396 |
} else { |
| 4397 |
offset.offset = this._config.offset; |
| 4398 |
} |
| 4399 |
|
| 4400 |
return offset; |
| 4401 |
}; |
| 4402 |
|
| 4403 |
_proto._getPopperConfig = function _getPopperConfig() { |
| 4404 |
var popperConfig = { |
| 4405 |
placement: this._getPlacement(), |
| 4406 |
modifiers: { |
| 4407 |
offset: this._getOffset(), |
| 4408 |
flip: { |
| 4409 |
enabled: this._config.flip |
| 4410 |
}, |
| 4411 |
preventOverflow: { |
| 4412 |
boundariesElement: this._config.boundary |
| 4413 |
} |
| 4414 |
} |
| 4415 |
}; // Disable Popper if we have a static display |
| 4416 |
|
| 4417 |
if (this._config.display === 'static') { |
| 4418 |
popperConfig.modifiers.applyStyle = { |
| 4419 |
enabled: false |
| 4420 |
}; |
| 4421 |
} |
| 4422 |
|
| 4423 |
return _extends$1({}, popperConfig, this._config.popperConfig); |
| 4424 |
} // Static |
| 4425 |
; |
| 4426 |
|
| 4427 |
Dropdown._jQueryInterface = function _jQueryInterface(config) { |
| 4428 |
return this.each(function () { |
| 4429 |
var data = $__default["default"](this).data(DATA_KEY$6); |
| 4430 |
|
| 4431 |
var _config = typeof config === 'object' ? config : null; |
| 4432 |
|
| 4433 |
if (!data) { |
| 4434 |
data = new Dropdown(this, _config); |
| 4435 |
$__default["default"](this).data(DATA_KEY$6, data); |
| 4436 |
} |
| 4437 |
|
| 4438 |
if (typeof config === 'string') { |
| 4439 |
if (typeof data[config] === 'undefined') { |
| 4440 |
throw new TypeError("No method named \"" + config + "\""); |
| 4441 |
} |
| 4442 |
|
| 4443 |
data[config](); |
| 4444 |
} |
| 4445 |
}); |
| 4446 |
}; |
| 4447 |
|
| 4448 |
Dropdown._clearMenus = function _clearMenus(event) { |
| 4449 |
if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { |
| 4450 |
return; |
| 4451 |
} |
| 4452 |
|
| 4453 |
var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2)); |
| 4454 |
|
| 4455 |
for (var i = 0, len = toggles.length; i < len; i++) { |
| 4456 |
var parent = Dropdown._getParentFromElement(toggles[i]); |
| 4457 |
|
| 4458 |
var context = $__default["default"](toggles[i]).data(DATA_KEY$6); |
| 4459 |
var relatedTarget = { |
| 4460 |
relatedTarget: toggles[i] |
| 4461 |
}; |
| 4462 |
|
| 4463 |
if (event && event.type === 'click') { |
| 4464 |
relatedTarget.clickEvent = event; |
| 4465 |
} |
| 4466 |
|
| 4467 |
if (!context) { |
| 4468 |
continue; |
| 4469 |
} |
| 4470 |
|
| 4471 |
var dropdownMenu = context._menu; |
| 4472 |
|
| 4473 |
if (!$__default["default"](parent).hasClass(CLASS_NAME_SHOW$5)) { |
| 4474 |
continue; |
| 4475 |
} |
| 4476 |
|
| 4477 |
if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $__default["default"].contains(parent, event.target)) { |
| 4478 |
continue; |
| 4479 |
} |
| 4480 |
|
| 4481 |
var hideEvent = $__default["default"].Event(EVENT_HIDE$3, relatedTarget); |
| 4482 |
$__default["default"](parent).trigger(hideEvent); |
| 4483 |
|
| 4484 |
if (hideEvent.isDefaultPrevented()) { |
| 4485 |
continue; |
| 4486 |
} // If this is a touch-enabled device we remove the extra |
| 4487 |
// empty mouseover listeners we added for iOS support |
| 4488 |
|
| 4489 |
|
| 4490 |
if ('ontouchstart' in document.documentElement) { |
| 4491 |
$__default["default"](document.body).children().off('mouseover', null, $__default["default"].noop); |
| 4492 |
} |
| 4493 |
|
| 4494 |
toggles[i].setAttribute('aria-expanded', 'false'); |
| 4495 |
|
| 4496 |
if (context._popper) { |
| 4497 |
context._popper.destroy(); |
| 4498 |
} |
| 4499 |
|
| 4500 |
$__default["default"](dropdownMenu).removeClass(CLASS_NAME_SHOW$5); |
| 4501 |
$__default["default"](parent).removeClass(CLASS_NAME_SHOW$5).trigger($__default["default"].Event(EVENT_HIDDEN$3, relatedTarget)); |
| 4502 |
} |
| 4503 |
}; |
| 4504 |
|
| 4505 |
Dropdown._getParentFromElement = function _getParentFromElement(element) { |
| 4506 |
var parent; |
| 4507 |
var selector = Util.getSelectorFromElement(element); |
| 4508 |
|
| 4509 |
if (selector) { |
| 4510 |
parent = document.querySelector(selector); |
| 4511 |
} |
| 4512 |
|
| 4513 |
return parent || element.parentNode; |
| 4514 |
} // eslint-disable-next-line complexity |
| 4515 |
; |
| 4516 |
|
| 4517 |
Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { |
| 4518 |
// If not input/textarea: |
| 4519 |
// - And not a key in REGEXP_KEYDOWN => not a dropdown command |
| 4520 |
// If input/textarea: |
| 4521 |
// - If space key => not a dropdown command |
| 4522 |
// - If key is other than escape |
| 4523 |
// - If key is not up or down => not a dropdown command |
| 4524 |
// - If trigger inside the menu => not a dropdown command |
| 4525 |
if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE$1 && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $__default["default"](event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { |
| 4526 |
return; |
| 4527 |
} |
| 4528 |
|
| 4529 |
if (this.disabled || $__default["default"](this).hasClass(CLASS_NAME_DISABLED$1)) { |
| 4530 |
return; |
| 4531 |
} |
| 4532 |
|
| 4533 |
var parent = Dropdown._getParentFromElement(this); |
| 4534 |
|
| 4535 |
var isActive = $__default["default"](parent).hasClass(CLASS_NAME_SHOW$5); |
| 4536 |
|
| 4537 |
if (!isActive && event.which === ESCAPE_KEYCODE$1) { |
| 4538 |
return; |
| 4539 |
} |
| 4540 |
|
| 4541 |
event.preventDefault(); |
| 4542 |
event.stopPropagation(); |
| 4543 |
|
| 4544 |
if (!isActive || event.which === ESCAPE_KEYCODE$1 || event.which === SPACE_KEYCODE) { |
| 4545 |
if (event.which === ESCAPE_KEYCODE$1) { |
| 4546 |
$__default["default"](parent.querySelector(SELECTOR_DATA_TOGGLE$2)).trigger('focus'); |
| 4547 |
} |
| 4548 |
|
| 4549 |
$__default["default"](this).trigger('click'); |
| 4550 |
return; |
| 4551 |
} |
| 4552 |
|
| 4553 |
var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) { |
| 4554 |
return $__default["default"](item).is(':visible'); |
| 4555 |
}); |
| 4556 |
|
| 4557 |
if (items.length === 0) { |
| 4558 |
return; |
| 4559 |
} |
| 4560 |
|
| 4561 |
var index = items.indexOf(event.target); |
| 4562 |
|
| 4563 |
if (event.which === ARROW_UP_KEYCODE && index > 0) { |
| 4564 |
// Up |
| 4565 |
index--; |
| 4566 |
} |
| 4567 |
|
| 4568 |
if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { |
| 4569 |
// Down |
| 4570 |
index++; |
| 4571 |
} |
| 4572 |
|
| 4573 |
if (index < 0) { |
| 4574 |
index = 0; |
| 4575 |
} |
| 4576 |
|
| 4577 |
items[index].focus(); |
| 4578 |
}; |
| 4579 |
|
| 4580 |
_createClass(Dropdown, null, [{ |
| 4581 |
key: "VERSION", |
| 4582 |
get: function get() { |
| 4583 |
return VERSION$6; |
| 4584 |
} |
| 4585 |
}, { |
| 4586 |
key: "Default", |
| 4587 |
get: function get() { |
| 4588 |
return Default$5; |
| 4589 |
} |
| 4590 |
}, { |
| 4591 |
key: "DefaultType", |
| 4592 |
get: function get() { |
| 4593 |
return DefaultType$5; |
| 4594 |
} |
| 4595 |
}]); |
| 4596 |
|
| 4597 |
return Dropdown; |
| 4598 |
}(); |
| 4599 |
/** |
| 4600 |
* Data API implementation |
| 4601 |
*/ |
| 4602 |
|
| 4603 |
|
| 4604 |
$__default["default"](document).on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown._dataApiKeydownHandler).on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler).on(EVENT_CLICK_DATA_API$2 + " " + EVENT_KEYUP_DATA_API, Dropdown._clearMenus).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { |
| 4605 |
event.preventDefault(); |
| 4606 |
event.stopPropagation(); |
| 4607 |
|
| 4608 |
Dropdown._jQueryInterface.call($__default["default"](this), 'toggle'); |
| 4609 |
}).on(EVENT_CLICK_DATA_API$2, SELECTOR_FORM_CHILD, function (e) { |
| 4610 |
e.stopPropagation(); |
| 4611 |
}); |
| 4612 |
/** |
| 4613 |
* jQuery |
| 4614 |
*/ |
| 4615 |
|
| 4616 |
$__default["default"].fn[NAME$6] = Dropdown._jQueryInterface; |
| 4617 |
$__default["default"].fn[NAME$6].Constructor = Dropdown; |
| 4618 |
|
| 4619 |
$__default["default"].fn[NAME$6].noConflict = function () { |
| 4620 |
$__default["default"].fn[NAME$6] = JQUERY_NO_CONFLICT$6; |
| 4621 |
return Dropdown._jQueryInterface; |
| 4622 |
}; |
| 4623 |
|
| 4624 |
/** |
| 4625 |
* Constants |
| 4626 |
*/ |
| 4627 |
|
| 4628 |
var NAME$5 = 'modal'; |
| 4629 |
var VERSION$5 = '4.6.2'; |
| 4630 |
var DATA_KEY$5 = 'bs.modal'; |
| 4631 |
var EVENT_KEY$5 = "." + DATA_KEY$5; |
| 4632 |
var DATA_API_KEY$2 = '.data-api'; |
| 4633 |
var JQUERY_NO_CONFLICT$5 = $__default["default"].fn[NAME$5]; |
| 4634 |
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key |
| 4635 |
|
| 4636 |
var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable'; |
| 4637 |
var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure'; |
| 4638 |
var CLASS_NAME_BACKDROP = 'modal-backdrop'; |
| 4639 |
var CLASS_NAME_OPEN = 'modal-open'; |
| 4640 |
var CLASS_NAME_FADE$4 = 'fade'; |
| 4641 |
var CLASS_NAME_SHOW$4 = 'show'; |
| 4642 |
var CLASS_NAME_STATIC = 'modal-static'; |
| 4643 |
var EVENT_HIDE$2 = "hide" + EVENT_KEY$5; |
| 4644 |
var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5; |
| 4645 |
var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5; |
| 4646 |
var EVENT_SHOW$2 = "show" + EVENT_KEY$5; |
| 4647 |
var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5; |
| 4648 |
var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5; |
| 4649 |
var EVENT_RESIZE = "resize" + EVENT_KEY$5; |
| 4650 |
var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$5; |
| 4651 |
var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5; |
| 4652 |
var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5; |
| 4653 |
var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5; |
| 4654 |
var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$5 + DATA_API_KEY$2; |
| 4655 |
var SELECTOR_DIALOG = '.modal-dialog'; |
| 4656 |
var SELECTOR_MODAL_BODY = '.modal-body'; |
| 4657 |
var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="modal"]'; |
| 4658 |
var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="modal"]'; |
| 4659 |
var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; |
| 4660 |
var SELECTOR_STICKY_CONTENT = '.sticky-top'; |
| 4661 |
var Default$4 = { |
| 4662 |
backdrop: true, |
| 4663 |
keyboard: true, |
| 4664 |
focus: true, |
| 4665 |
show: true |
| 4666 |
}; |
| 4667 |
var DefaultType$4 = { |
| 4668 |
backdrop: '(boolean|string)', |
| 4669 |
keyboard: 'boolean', |
| 4670 |
focus: 'boolean', |
| 4671 |
show: 'boolean' |
| 4672 |
}; |
| 4673 |
/** |
| 4674 |
* Class definition |
| 4675 |
*/ |
| 4676 |
|
| 4677 |
var Modal = /*#__PURE__*/function () { |
| 4678 |
function Modal(element, config) { |
| 4679 |
this._config = this._getConfig(config); |
| 4680 |
this._element = element; |
| 4681 |
this._dialog = element.querySelector(SELECTOR_DIALOG); |
| 4682 |
this._backdrop = null; |
| 4683 |
this._isShown = false; |
| 4684 |
this._isBodyOverflowing = false; |
| 4685 |
this._ignoreBackdropClick = false; |
| 4686 |
this._isTransitioning = false; |
| 4687 |
this._scrollbarWidth = 0; |
| 4688 |
} // Getters |
| 4689 |
|
| 4690 |
|
| 4691 |
var _proto = Modal.prototype; |
| 4692 |
|
| 4693 |
// Public |
| 4694 |
_proto.toggle = function toggle(relatedTarget) { |
| 4695 |
return this._isShown ? this.hide() : this.show(relatedTarget); |
| 4696 |
}; |
| 4697 |
|
| 4698 |
_proto.show = function show(relatedTarget) { |
| 4699 |
var _this = this; |
| 4700 |
|
| 4701 |
if (this._isShown || this._isTransitioning) { |
| 4702 |
return; |
| 4703 |
} |
| 4704 |
|
| 4705 |
var showEvent = $__default["default"].Event(EVENT_SHOW$2, { |
| 4706 |
relatedTarget: relatedTarget |
| 4707 |
}); |
| 4708 |
$__default["default"](this._element).trigger(showEvent); |
| 4709 |
|
| 4710 |
if (showEvent.isDefaultPrevented()) { |
| 4711 |
return; |
| 4712 |
} |
| 4713 |
|
| 4714 |
this._isShown = true; |
| 4715 |
|
| 4716 |
if ($__default["default"](this._element).hasClass(CLASS_NAME_FADE$4)) { |
| 4717 |
this._isTransitioning = true; |
| 4718 |
} |
| 4719 |
|
| 4720 |
this._checkScrollbar(); |
| 4721 |
|
| 4722 |
this._setScrollbar(); |
| 4723 |
|
| 4724 |
this._adjustDialog(); |
| 4725 |
|
| 4726 |
this._setEscapeEvent(); |
| 4727 |
|
| 4728 |
this._setResizeEvent(); |
| 4729 |
|
| 4730 |
$__default["default"](this._element).on(EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function (event) { |
| 4731 |
return _this.hide(event); |
| 4732 |
}); |
| 4733 |
$__default["default"](this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () { |
| 4734 |
$__default["default"](_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) { |
| 4735 |
if ($__default["default"](event.target).is(_this._element)) { |
| 4736 |
_this._ignoreBackdropClick = true; |
| 4737 |
} |
| 4738 |
}); |
| 4739 |
}); |
| 4740 |
|
| 4741 |
this._showBackdrop(function () { |
| 4742 |
return _this._showElement(relatedTarget); |
| 4743 |
}); |
| 4744 |
}; |
| 4745 |
|
| 4746 |
_proto.hide = function hide(event) { |
| 4747 |
var _this2 = this; |
| 4748 |
|
| 4749 |
if (event) { |
| 4750 |
event.preventDefault(); |
| 4751 |
} |
| 4752 |
|
| 4753 |
if (!this._isShown || this._isTransitioning) { |
| 4754 |
return; |
| 4755 |
} |
| 4756 |
|
| 4757 |
var hideEvent = $__default["default"].Event(EVENT_HIDE$2); |
| 4758 |
$__default["default"](this._element).trigger(hideEvent); |
| 4759 |
|
| 4760 |
if (!this._isShown || hideEvent.isDefaultPrevented()) { |
| 4761 |
return; |
| 4762 |
} |
| 4763 |
|
| 4764 |
this._isShown = false; |
| 4765 |
var transition = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4); |
| 4766 |
|
| 4767 |
if (transition) { |
| 4768 |
this._isTransitioning = true; |
| 4769 |
} |
| 4770 |
|
| 4771 |
this._setEscapeEvent(); |
| 4772 |
|
| 4773 |
this._setResizeEvent(); |
| 4774 |
|
| 4775 |
$__default["default"](document).off(EVENT_FOCUSIN); |
| 4776 |
$__default["default"](this._element).removeClass(CLASS_NAME_SHOW$4); |
| 4777 |
$__default["default"](this._element).off(EVENT_CLICK_DISMISS$1); |
| 4778 |
$__default["default"](this._dialog).off(EVENT_MOUSEDOWN_DISMISS); |
| 4779 |
|
| 4780 |
if (transition) { |
| 4781 |
var transitionDuration = Util.getTransitionDurationFromElement(this._element); |
| 4782 |
$__default["default"](this._element).one(Util.TRANSITION_END, function (event) { |
| 4783 |
return _this2._hideModal(event); |
| 4784 |
}).emulateTransitionEnd(transitionDuration); |
| 4785 |
} else { |
| 4786 |
this._hideModal(); |
| 4787 |
} |
| 4788 |
}; |
| 4789 |
|
| 4790 |
_proto.dispose = function dispose() { |
| 4791 |
[window, this._element, this._dialog].forEach(function (htmlElement) { |
| 4792 |
return $__default["default"](htmlElement).off(EVENT_KEY$5); |
| 4793 |
}); |
| 4794 |
/** |
| 4795 |
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` |
| 4796 |
* Do not move `document` in `htmlElements` array |
| 4797 |
* It will remove `EVENT_CLICK_DATA_API` event that should remain |
| 4798 |
*/ |
| 4799 |
|
| 4800 |
$__default["default"](document).off(EVENT_FOCUSIN); |
| 4801 |
$__default["default"].removeData(this._element, DATA_KEY$5); |
| 4802 |
this._config = null; |
| 4803 |
this._element = null; |
| 4804 |
this._dialog = null; |
| 4805 |
this._backdrop = null; |
| 4806 |
this._isShown = null; |
| 4807 |
this._isBodyOverflowing = null; |
| 4808 |
this._ignoreBackdropClick = null; |
| 4809 |
this._isTransitioning = null; |
| 4810 |
this._scrollbarWidth = null; |
| 4811 |
}; |
| 4812 |
|
| 4813 |
_proto.handleUpdate = function handleUpdate() { |
| 4814 |
this._adjustDialog(); |
| 4815 |
} // Private |
| 4816 |
; |
| 4817 |
|
| 4818 |
_proto._getConfig = function _getConfig(config) { |
| 4819 |
config = _extends$1({}, Default$4, config); |
| 4820 |
Util.typeCheckConfig(NAME$5, config, DefaultType$4); |
| 4821 |
return config; |
| 4822 |
}; |
| 4823 |
|
| 4824 |
_proto._triggerBackdropTransition = function _triggerBackdropTransition() { |
| 4825 |
var _this3 = this; |
| 4826 |
|
| 4827 |
var hideEventPrevented = $__default["default"].Event(EVENT_HIDE_PREVENTED); |
| 4828 |
$__default["default"](this._element).trigger(hideEventPrevented); |
| 4829 |
|
| 4830 |
if (hideEventPrevented.isDefaultPrevented()) { |
| 4831 |
return; |
| 4832 |
} |
| 4833 |
|
| 4834 |
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; |
| 4835 |
|
| 4836 |
if (!isModalOverflowing) { |
| 4837 |
this._element.style.overflowY = 'hidden'; |
| 4838 |
} |
| 4839 |
|
| 4840 |
this._element.classList.add(CLASS_NAME_STATIC); |
| 4841 |
|
| 4842 |
var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog); |
| 4843 |
$__default["default"](this._element).off(Util.TRANSITION_END); |
| 4844 |
$__default["default"](this._element).one(Util.TRANSITION_END, function () { |
| 4845 |
_this3._element.classList.remove(CLASS_NAME_STATIC); |
| 4846 |
|
| 4847 |
if (!isModalOverflowing) { |
| 4848 |
$__default["default"](_this3._element).one(Util.TRANSITION_END, function () { |
| 4849 |
_this3._element.style.overflowY = ''; |
| 4850 |
}).emulateTransitionEnd(_this3._element, modalTransitionDuration); |
| 4851 |
} |
| 4852 |
}).emulateTransitionEnd(modalTransitionDuration); |
| 4853 |
|
| 4854 |
this._element.focus(); |
| 4855 |
}; |
| 4856 |
|
| 4857 |
_proto._showElement = function _showElement(relatedTarget) { |
| 4858 |
var _this4 = this; |
| 4859 |
|
| 4860 |
var transition = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4); |
| 4861 |
var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null; |
| 4862 |
|
| 4863 |
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { |
| 4864 |
// Don't move modal's DOM position |
| 4865 |
document.body.appendChild(this._element); |
| 4866 |
} |
| 4867 |
|
| 4868 |
this._element.style.display = 'block'; |
| 4869 |
|
| 4870 |
this._element.removeAttribute('aria-hidden'); |
| 4871 |
|
| 4872 |
this._element.setAttribute('aria-modal', true); |
| 4873 |
|
| 4874 |
this._element.setAttribute('role', 'dialog'); |
| 4875 |
|
| 4876 |
if ($__default["default"](this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) { |
| 4877 |
modalBody.scrollTop = 0; |
| 4878 |
} else { |
| 4879 |
this._element.scrollTop = 0; |
| 4880 |
} |
| 4881 |
|
| 4882 |
if (transition) { |
| 4883 |
Util.reflow(this._element); |
| 4884 |
} |
| 4885 |
|
| 4886 |
$__default["default"](this._element).addClass(CLASS_NAME_SHOW$4); |
| 4887 |
|
| 4888 |
if (this._config.focus) { |
| 4889 |
this._enforceFocus(); |
| 4890 |
} |
| 4891 |
|
| 4892 |
var shownEvent = $__default["default"].Event(EVENT_SHOWN$2, { |
| 4893 |
relatedTarget: relatedTarget |
| 4894 |
}); |
| 4895 |
|
| 4896 |
var transitionComplete = function transitionComplete() { |
| 4897 |
if (_this4._config.focus) { |
| 4898 |
_this4._element.focus(); |
| 4899 |
} |
| 4900 |
|
| 4901 |
_this4._isTransitioning = false; |
| 4902 |
$__default["default"](_this4._element).trigger(shownEvent); |
| 4903 |
}; |
| 4904 |
|
| 4905 |
if (transition) { |
| 4906 |
var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); |
| 4907 |
$__default["default"](this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); |
| 4908 |
} else { |
| 4909 |
transitionComplete(); |
| 4910 |
} |
| 4911 |
}; |
| 4912 |
|
| 4913 |
_proto._enforceFocus = function _enforceFocus() { |
| 4914 |
var _this5 = this; |
| 4915 |
|
| 4916 |
$__default["default"](document).off(EVENT_FOCUSIN) // Guard against infinite focus loop |
| 4917 |
.on(EVENT_FOCUSIN, function (event) { |
| 4918 |
if (document !== event.target && _this5._element !== event.target && $__default["default"](_this5._element).has(event.target).length === 0) { |
| 4919 |
_this5._element.focus(); |
| 4920 |
} |
| 4921 |
}); |
| 4922 |
}; |
| 4923 |
|
| 4924 |
_proto._setEscapeEvent = function _setEscapeEvent() { |
| 4925 |
var _this6 = this; |
| 4926 |
|
| 4927 |
if (this._isShown) { |
| 4928 |
$__default["default"](this._element).on(EVENT_KEYDOWN_DISMISS, function (event) { |
| 4929 |
if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE) { |
| 4930 |
event.preventDefault(); |
| 4931 |
|
| 4932 |
_this6.hide(); |
| 4933 |
} else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE) { |
| 4934 |
_this6._triggerBackdropTransition(); |
| 4935 |
} |
| 4936 |
}); |
| 4937 |
} else if (!this._isShown) { |
| 4938 |
$__default["default"](this._element).off(EVENT_KEYDOWN_DISMISS); |
| 4939 |
} |
| 4940 |
}; |
| 4941 |
|
| 4942 |
_proto._setResizeEvent = function _setResizeEvent() { |
| 4943 |
var _this7 = this; |
| 4944 |
|
| 4945 |
if (this._isShown) { |
| 4946 |
$__default["default"](window).on(EVENT_RESIZE, function (event) { |
| 4947 |
return _this7.handleUpdate(event); |
| 4948 |
}); |
| 4949 |
} else { |
| 4950 |
$__default["default"](window).off(EVENT_RESIZE); |
| 4951 |
} |
| 4952 |
}; |
| 4953 |
|
| 4954 |
_proto._hideModal = function _hideModal() { |
| 4955 |
var _this8 = this; |
| 4956 |
|
| 4957 |
this._element.style.display = 'none'; |
| 4958 |
|
| 4959 |
this._element.setAttribute('aria-hidden', true); |
| 4960 |
|
| 4961 |
this._element.removeAttribute('aria-modal'); |
| 4962 |
|
| 4963 |
this._element.removeAttribute('role'); |
| 4964 |
|
| 4965 |
this._isTransitioning = false; |
| 4966 |
|
| 4967 |
this._showBackdrop(function () { |
| 4968 |
$__default["default"](document.body).removeClass(CLASS_NAME_OPEN); |
| 4969 |
|
| 4970 |
_this8._resetAdjustments(); |
| 4971 |
|
| 4972 |
_this8._resetScrollbar(); |
| 4973 |
|
| 4974 |
$__default["default"](_this8._element).trigger(EVENT_HIDDEN$2); |
| 4975 |
}); |
| 4976 |
}; |
| 4977 |
|
| 4978 |
_proto._removeBackdrop = function _removeBackdrop() { |
| 4979 |
if (this._backdrop) { |
| 4980 |
$__default["default"](this._backdrop).remove(); |
| 4981 |
this._backdrop = null; |
| 4982 |
} |
| 4983 |
}; |
| 4984 |
|
| 4985 |
_proto._showBackdrop = function _showBackdrop(callback) { |
| 4986 |
var _this9 = this; |
| 4987 |
|
| 4988 |
var animate = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4) ? CLASS_NAME_FADE$4 : ''; |
| 4989 |
|
| 4990 |
if (this._isShown && this._config.backdrop) { |
| 4991 |
this._backdrop = document.createElement('div'); |
| 4992 |
this._backdrop.className = CLASS_NAME_BACKDROP; |
| 4993 |
|
| 4994 |
if (animate) { |
| 4995 |
this._backdrop.classList.add(animate); |
| 4996 |
} |
| 4997 |
|
| 4998 |
$__default["default"](this._backdrop).appendTo(document.body); |
| 4999 |
$__default["default"](this._element).on(EVENT_CLICK_DISMISS$1, function (event) { |
| 5000 |
if (_this9._ignoreBackdropClick) { |
| 5001 |
_this9._ignoreBackdropClick = false; |
| 5002 |
return; |
| 5003 |
} |
| 5004 |
|
| 5005 |
if (event.target !== event.currentTarget) { |
| 5006 |
return; |
| 5007 |
} |
| 5008 |
|
| 5009 |
if (_this9._config.backdrop === 'static') { |
| 5010 |
_this9._triggerBackdropTransition(); |
| 5011 |
} else { |
| 5012 |
_this9.hide(); |
| 5013 |
} |
| 5014 |
}); |
| 5015 |
|
| 5016 |
if (animate) { |
| 5017 |
Util.reflow(this._backdrop); |
| 5018 |
} |
| 5019 |
|
| 5020 |
$__default["default"](this._backdrop).addClass(CLASS_NAME_SHOW$4); |
| 5021 |
|
| 5022 |
if (!callback) { |
| 5023 |
return; |
| 5024 |
} |
| 5025 |
|
| 5026 |
if (!animate) { |
| 5027 |
callback(); |
| 5028 |
return; |
| 5029 |
} |
| 5030 |
|
| 5031 |
var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); |
| 5032 |
$__default["default"](this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); |
| 5033 |
} else if (!this._isShown && this._backdrop) { |
| 5034 |
$__default["default"](this._backdrop).removeClass(CLASS_NAME_SHOW$4); |
| 5035 |
|
| 5036 |
var callbackRemove = function callbackRemove() { |
| 5037 |
_this9._removeBackdrop(); |
| 5038 |
|
| 5039 |
if (callback) { |
| 5040 |
callback(); |
| 5041 |
} |
| 5042 |
}; |
| 5043 |
|
| 5044 |
if ($__default["default"](this._element).hasClass(CLASS_NAME_FADE$4)) { |
| 5045 |
var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); |
| 5046 |
|
| 5047 |
$__default["default"](this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); |
| 5048 |
} else { |
| 5049 |
callbackRemove(); |
| 5050 |
} |
| 5051 |
} else if (callback) { |
| 5052 |
callback(); |
| 5053 |
} |
| 5054 |
} // ---------------------------------------------------------------------- |
| 5055 |
// the following methods are used to handle overflowing modals |
| 5056 |
// todo (fat): these should probably be refactored out of modal.js |
| 5057 |
// ---------------------------------------------------------------------- |
| 5058 |
; |
| 5059 |
|
| 5060 |
_proto._adjustDialog = function _adjustDialog() { |
| 5061 |
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; |
| 5062 |
|
| 5063 |
if (!this._isBodyOverflowing && isModalOverflowing) { |
| 5064 |
this._element.style.paddingLeft = this._scrollbarWidth + "px"; |
| 5065 |
} |
| 5066 |
|
| 5067 |
if (this._isBodyOverflowing && !isModalOverflowing) { |
| 5068 |
this._element.style.paddingRight = this._scrollbarWidth + "px"; |
| 5069 |
} |
| 5070 |
}; |
| 5071 |
|
| 5072 |
_proto._resetAdjustments = function _resetAdjustments() { |
| 5073 |
this._element.style.paddingLeft = ''; |
| 5074 |
this._element.style.paddingRight = ''; |
| 5075 |
}; |
| 5076 |
|
| 5077 |
_proto._checkScrollbar = function _checkScrollbar() { |
| 5078 |
var rect = document.body.getBoundingClientRect(); |
| 5079 |
this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth; |
| 5080 |
this._scrollbarWidth = this._getScrollbarWidth(); |
| 5081 |
}; |
| 5082 |
|
| 5083 |
_proto._setScrollbar = function _setScrollbar() { |
| 5084 |
var _this10 = this; |
| 5085 |
|
| 5086 |
if (this._isBodyOverflowing) { |
| 5087 |
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set |
| 5088 |
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set |
| 5089 |
var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT)); |
| 5090 |
var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding |
| 5091 |
|
| 5092 |
$__default["default"](fixedContent).each(function (index, element) { |
| 5093 |
var actualPadding = element.style.paddingRight; |
| 5094 |
var calculatedPadding = $__default["default"](element).css('padding-right'); |
| 5095 |
$__default["default"](element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px"); |
| 5096 |
}); // Adjust sticky content margin |
| 5097 |
|
| 5098 |
$__default["default"](stickyContent).each(function (index, element) { |
| 5099 |
var actualMargin = element.style.marginRight; |
| 5100 |
var calculatedMargin = $__default["default"](element).css('margin-right'); |
| 5101 |
$__default["default"](element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px"); |
| 5102 |
}); // Adjust body padding |
| 5103 |
|
| 5104 |
var actualPadding = document.body.style.paddingRight; |
| 5105 |
var calculatedPadding = $__default["default"](document.body).css('padding-right'); |
| 5106 |
$__default["default"](document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); |
| 5107 |
} |
| 5108 |
|
| 5109 |
$__default["default"](document.body).addClass(CLASS_NAME_OPEN); |
| 5110 |
}; |
| 5111 |
|
| 5112 |
_proto._resetScrollbar = function _resetScrollbar() { |
| 5113 |
// Restore fixed content padding |
| 5114 |
var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT)); |
| 5115 |
$__default["default"](fixedContent).each(function (index, element) { |
| 5116 |
var padding = $__default["default"](element).data('padding-right'); |
| 5117 |
$__default["default"](element).removeData('padding-right'); |
| 5118 |
element.style.paddingRight = padding ? padding : ''; |
| 5119 |
}); // Restore sticky content |
| 5120 |
|
| 5121 |
var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT)); |
| 5122 |
$__default["default"](elements).each(function (index, element) { |
| 5123 |
var margin = $__default["default"](element).data('margin-right'); |
| 5124 |
|
| 5125 |
if (typeof margin !== 'undefined') { |
| 5126 |
$__default["default"](element).css('margin-right', margin).removeData('margin-right'); |
| 5127 |
} |
| 5128 |
}); // Restore body padding |
| 5129 |
|
| 5130 |
var padding = $__default["default"](document.body).data('padding-right'); |
| 5131 |
$__default["default"](document.body).removeData('padding-right'); |
| 5132 |
document.body.style.paddingRight = padding ? padding : ''; |
| 5133 |
}; |
| 5134 |
|
| 5135 |
_proto._getScrollbarWidth = function _getScrollbarWidth() { |
| 5136 |
// thx d.walsh |
| 5137 |
var scrollDiv = document.createElement('div'); |
| 5138 |
scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER; |
| 5139 |
document.body.appendChild(scrollDiv); |
| 5140 |
var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; |
| 5141 |
document.body.removeChild(scrollDiv); |
| 5142 |
return scrollbarWidth; |
| 5143 |
} // Static |
| 5144 |
; |
| 5145 |
|
| 5146 |
Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { |
| 5147 |
return this.each(function () { |
| 5148 |
var data = $__default["default"](this).data(DATA_KEY$5); |
| 5149 |
|
| 5150 |
var _config = _extends$1({}, Default$4, $__default["default"](this).data(), typeof config === 'object' && config ? config : {}); |
| 5151 |
|
| 5152 |
if (!data) { |
| 5153 |
data = new Modal(this, _config); |
| 5154 |
$__default["default"](this).data(DATA_KEY$5, data); |
| 5155 |
} |
| 5156 |
|
| 5157 |
if (typeof config === 'string') { |
| 5158 |
if (typeof data[config] === 'undefined') { |
| 5159 |
throw new TypeError("No method named \"" + config + "\""); |
| 5160 |
} |
| 5161 |
|
| 5162 |
data[config](relatedTarget); |
| 5163 |
} else if (_config.show) { |
| 5164 |
data.show(relatedTarget); |
| 5165 |
} |
| 5166 |
}); |
| 5167 |
}; |
| 5168 |
|
| 5169 |
_createClass(Modal, null, [{ |
| 5170 |
key: "VERSION", |
| 5171 |
get: function get() { |
| 5172 |
return VERSION$5; |
| 5173 |
} |
| 5174 |
}, { |
| 5175 |
key: "Default", |
| 5176 |
get: function get() { |
| 5177 |
return Default$4; |
| 5178 |
} |
| 5179 |
}]); |
| 5180 |
|
| 5181 |
return Modal; |
| 5182 |
}(); |
| 5183 |
/** |
| 5184 |
* Data API implementation |
| 5185 |
*/ |
| 5186 |
|
| 5187 |
|
| 5188 |
$__default["default"](document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) { |
| 5189 |
var _this11 = this; |
| 5190 |
|
| 5191 |
var target; |
| 5192 |
var selector = Util.getSelectorFromElement(this); |
| 5193 |
|
| 5194 |
if (selector) { |
| 5195 |
target = document.querySelector(selector); |
| 5196 |
} |
| 5197 |
|
| 5198 |
var config = $__default["default"](target).data(DATA_KEY$5) ? 'toggle' : _extends$1({}, $__default["default"](target).data(), $__default["default"](this).data()); |
| 5199 |
|
| 5200 |
if (this.tagName === 'A' || this.tagName === 'AREA') { |
| 5201 |
event.preventDefault(); |
| 5202 |
} |
| 5203 |
|
| 5204 |
var $target = $__default["default"](target).one(EVENT_SHOW$2, function (showEvent) { |
| 5205 |
if (showEvent.isDefaultPrevented()) { |
| 5206 |
// Only register focus restorer if modal will actually get shown |
| 5207 |
return; |
| 5208 |
} |
| 5209 |
|
| 5210 |
$target.one(EVENT_HIDDEN$2, function () { |
| 5211 |
if ($__default["default"](_this11).is(':visible')) { |
| 5212 |
_this11.focus(); |
| 5213 |
} |
| 5214 |
}); |
| 5215 |
}); |
| 5216 |
|
| 5217 |
Modal._jQueryInterface.call($__default["default"](target), config, this); |
| 5218 |
}); |
| 5219 |
/** |
| 5220 |
* jQuery |
| 5221 |
*/ |
| 5222 |
|
| 5223 |
$__default["default"].fn[NAME$5] = Modal._jQueryInterface; |
| 5224 |
$__default["default"].fn[NAME$5].Constructor = Modal; |
| 5225 |
|
| 5226 |
$__default["default"].fn[NAME$5].noConflict = function () { |
| 5227 |
$__default["default"].fn[NAME$5] = JQUERY_NO_CONFLICT$5; |
| 5228 |
return Modal._jQueryInterface; |
| 5229 |
}; |
| 5230 |
|
| 5231 |
/** |
| 5232 |
* -------------------------------------------------------------------------- |
| 5233 |
* Bootstrap (v4.6.2): tools/sanitizer.js |
| 5234 |
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) |
| 5235 |
* -------------------------------------------------------------------------- |
| 5236 |
*/ |
| 5237 |
var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; |
| 5238 |
var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; |
| 5239 |
var DefaultWhitelist = { |
| 5240 |
// Global attributes allowed on any supplied element below. |
| 5241 |
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], |
| 5242 |
a: ['target', 'href', 'title', 'rel'], |
| 5243 |
area: [], |
| 5244 |
b: [], |
| 5245 |
br: [], |
| 5246 |
col: [], |
| 5247 |
code: [], |
| 5248 |
div: [], |
| 5249 |
em: [], |
| 5250 |
hr: [], |
| 5251 |
h1: [], |
| 5252 |
h2: [], |
| 5253 |
h3: [], |
| 5254 |
h4: [], |
| 5255 |
h5: [], |
| 5256 |
h6: [], |
| 5257 |
i: [], |
| 5258 |
img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], |
| 5259 |
li: [], |
| 5260 |
ol: [], |
| 5261 |
p: [], |
| 5262 |
pre: [], |
| 5263 |
s: [], |
| 5264 |
small: [], |
| 5265 |
span: [], |
| 5266 |
sub: [], |
| 5267 |
sup: [], |
| 5268 |
strong: [], |
| 5269 |
u: [], |
| 5270 |
ul: [] |
| 5271 |
}; |
| 5272 |
/** |
| 5273 |
* A pattern that recognizes a commonly useful subset of URLs that are safe. |
| 5274 |
* |
| 5275 |
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts |
| 5276 |
*/ |
| 5277 |
|
| 5278 |
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i; |
| 5279 |
/** |
| 5280 |
* A pattern that matches safe data URLs. Only matches image, video and audio types. |
| 5281 |
* |
| 5282 |
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts |
| 5283 |
*/ |
| 5284 |
|
| 5285 |
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; |
| 5286 |
|
| 5287 |
function allowedAttribute(attr, allowedAttributeList) { |
| 5288 |
var attrName = attr.nodeName.toLowerCase(); |
| 5289 |
|
| 5290 |
if (allowedAttributeList.indexOf(attrName) !== -1) { |
| 5291 |
if (uriAttrs.indexOf(attrName) !== -1) { |
| 5292 |
return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)); |
| 5293 |
} |
| 5294 |
|
| 5295 |
return true; |
| 5296 |
} |
| 5297 |
|
| 5298 |
var regExp = allowedAttributeList.filter(function (attrRegex) { |
| 5299 |
return attrRegex instanceof RegExp; |
| 5300 |
}); // Check if a regular expression validates the attribute. |
| 5301 |
|
| 5302 |
for (var i = 0, len = regExp.length; i < len; i++) { |
| 5303 |
if (regExp[i].test(attrName)) { |
| 5304 |
return true; |
| 5305 |
} |
| 5306 |
} |
| 5307 |
|
| 5308 |
return false; |
| 5309 |
} |
| 5310 |
|
| 5311 |
function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { |
| 5312 |
if (unsafeHtml.length === 0) { |
| 5313 |
return unsafeHtml; |
| 5314 |
} |
| 5315 |
|
| 5316 |
if (sanitizeFn && typeof sanitizeFn === 'function') { |
| 5317 |
return sanitizeFn(unsafeHtml); |
| 5318 |
} |
| 5319 |
|
| 5320 |
var domParser = new window.DOMParser(); |
| 5321 |
var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); |
| 5322 |
var whitelistKeys = Object.keys(whiteList); |
| 5323 |
var elements = [].slice.call(createdDocument.body.querySelectorAll('*')); |
| 5324 |
|
| 5325 |
var _loop = function _loop(i, len) { |
| 5326 |
var el = elements[i]; |
| 5327 |
var elName = el.nodeName.toLowerCase(); |
| 5328 |
|
| 5329 |
if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { |
| 5330 |
el.parentNode.removeChild(el); |
| 5331 |
return "continue"; |
| 5332 |
} |
| 5333 |
|
| 5334 |
var attributeList = [].slice.call(el.attributes); // eslint-disable-next-line unicorn/prefer-spread |
| 5335 |
|
| 5336 |
var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); |
| 5337 |
attributeList.forEach(function (attr) { |
| 5338 |
if (!allowedAttribute(attr, whitelistedAttributes)) { |
| 5339 |
el.removeAttribute(attr.nodeName); |
| 5340 |
} |
| 5341 |
}); |
| 5342 |
}; |
| 5343 |
|
| 5344 |
for (var i = 0, len = elements.length; i < len; i++) { |
| 5345 |
var _ret = _loop(i); |
| 5346 |
|
| 5347 |
if (_ret === "continue") continue; |
| 5348 |
} |
| 5349 |
|
| 5350 |
return createdDocument.body.innerHTML; |
| 5351 |
} |
| 5352 |
|
| 5353 |
/** |
| 5354 |
* Constants |
| 5355 |
*/ |
| 5356 |
|
| 5357 |
var NAME$4 = 'tooltip'; |
| 5358 |
var VERSION$4 = '4.6.2'; |
| 5359 |
var DATA_KEY$4 = 'bs.tooltip'; |
| 5360 |
var EVENT_KEY$4 = "." + DATA_KEY$4; |
| 5361 |
var JQUERY_NO_CONFLICT$4 = $__default["default"].fn[NAME$4]; |
| 5362 |
var CLASS_PREFIX$1 = 'bs-tooltip'; |
| 5363 |
var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); |
| 5364 |
var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; |
| 5365 |
var CLASS_NAME_FADE$3 = 'fade'; |
| 5366 |
var CLASS_NAME_SHOW$3 = 'show'; |
| 5367 |
var HOVER_STATE_SHOW = 'show'; |
| 5368 |
var HOVER_STATE_OUT = 'out'; |
| 5369 |
var SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; |
| 5370 |
var SELECTOR_ARROW = '.arrow'; |
| 5371 |
var TRIGGER_HOVER = 'hover'; |
| 5372 |
var TRIGGER_FOCUS = 'focus'; |
| 5373 |
var TRIGGER_CLICK = 'click'; |
| 5374 |
var TRIGGER_MANUAL = 'manual'; |
| 5375 |
var AttachmentMap = { |
| 5376 |
AUTO: 'auto', |
| 5377 |
TOP: 'top', |
| 5378 |
RIGHT: 'right', |
| 5379 |
BOTTOM: 'bottom', |
| 5380 |
LEFT: 'left' |
| 5381 |
}; |
| 5382 |
var Default$3 = { |
| 5383 |
animation: true, |
| 5384 |
template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', |
| 5385 |
trigger: 'hover focus', |
| 5386 |
title: '', |
| 5387 |
delay: 0, |
| 5388 |
html: false, |
| 5389 |
selector: false, |
| 5390 |
placement: 'top', |
| 5391 |
offset: 0, |
| 5392 |
container: false, |
| 5393 |
fallbackPlacement: 'flip', |
| 5394 |
boundary: 'scrollParent', |
| 5395 |
customClass: '', |
| 5396 |
sanitize: true, |
| 5397 |
sanitizeFn: null, |
| 5398 |
whiteList: DefaultWhitelist, |
| 5399 |
popperConfig: null |
| 5400 |
}; |
| 5401 |
var DefaultType$3 = { |
| 5402 |
animation: 'boolean', |
| 5403 |
template: 'string', |
| 5404 |
title: '(string|element|function)', |
| 5405 |
trigger: 'string', |
| 5406 |
delay: '(number|object)', |
| 5407 |
html: 'boolean', |
| 5408 |
selector: '(string|boolean)', |
| 5409 |
placement: '(string|function)', |
| 5410 |
offset: '(number|string|function)', |
| 5411 |
container: '(string|element|boolean)', |
| 5412 |
fallbackPlacement: '(string|array)', |
| 5413 |
boundary: '(string|element)', |
| 5414 |
customClass: '(string|function)', |
| 5415 |
sanitize: 'boolean', |
| 5416 |
sanitizeFn: '(null|function)', |
| 5417 |
whiteList: 'object', |
| 5418 |
popperConfig: '(null|object)' |
| 5419 |
}; |
| 5420 |
var Event$1 = { |
| 5421 |
HIDE: "hide" + EVENT_KEY$4, |
| 5422 |
HIDDEN: "hidden" + EVENT_KEY$4, |
| 5423 |
SHOW: "show" + EVENT_KEY$4, |
| 5424 |
SHOWN: "shown" + EVENT_KEY$4, |
| 5425 |
INSERTED: "inserted" + EVENT_KEY$4, |
| 5426 |
CLICK: "click" + EVENT_KEY$4, |
| 5427 |
FOCUSIN: "focusin" + EVENT_KEY$4, |
| 5428 |
FOCUSOUT: "focusout" + EVENT_KEY$4, |
| 5429 |
MOUSEENTER: "mouseenter" + EVENT_KEY$4, |
| 5430 |
MOUSELEAVE: "mouseleave" + EVENT_KEY$4 |
| 5431 |
}; |
| 5432 |
/** |
| 5433 |
* Class definition |
| 5434 |
*/ |
| 5435 |
|
| 5436 |
var Tooltip = /*#__PURE__*/function () { |
| 5437 |
function Tooltip(element, config) { |
| 5438 |
if (typeof Popper$1 === 'undefined') { |
| 5439 |
throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); |
| 5440 |
} // Private |
| 5441 |
|
| 5442 |
|
| 5443 |
this._isEnabled = true; |
| 5444 |
this._timeout = 0; |
| 5445 |
this._hoverState = ''; |
| 5446 |
this._activeTrigger = {}; |
| 5447 |
this._popper = null; // Protected |
| 5448 |
|
| 5449 |
this.element = element; |
| 5450 |
this.config = this._getConfig(config); |
| 5451 |
this.tip = null; |
| 5452 |
|
| 5453 |
this._setListeners(); |
| 5454 |
} // Getters |
| 5455 |
|
| 5456 |
|
| 5457 |
var _proto = Tooltip.prototype; |
| 5458 |
|
| 5459 |
// Public |
| 5460 |
_proto.enable = function enable() { |
| 5461 |
this._isEnabled = true; |
| 5462 |
}; |
| 5463 |
|
| 5464 |
_proto.disable = function disable() { |
| 5465 |
this._isEnabled = false; |
| 5466 |
}; |
| 5467 |
|
| 5468 |
_proto.toggleEnabled = function toggleEnabled() { |
| 5469 |
this._isEnabled = !this._isEnabled; |
| 5470 |
}; |
| 5471 |
|
| 5472 |
_proto.toggle = function toggle(event) { |
| 5473 |
if (!this._isEnabled) { |
| 5474 |
return; |
| 5475 |
} |
| 5476 |
|
| 5477 |
if (event) { |
| 5478 |
var dataKey = this.constructor.DATA_KEY; |
| 5479 |
var context = $__default["default"](event.currentTarget).data(dataKey); |
| 5480 |
|
| 5481 |
if (!context) { |
| 5482 |
context = new this.constructor(event.currentTarget, this._getDelegateConfig()); |
| 5483 |
$__default["default"](event.currentTarget).data(dataKey, context); |
| 5484 |
} |
| 5485 |
|
| 5486 |
context._activeTrigger.click = !context._activeTrigger.click; |
| 5487 |
|
| 5488 |
if (context._isWithActiveTrigger()) { |
| 5489 |
context._enter(null, context); |
| 5490 |
} else { |
| 5491 |
context._leave(null, context); |
| 5492 |
} |
| 5493 |
} else { |
| 5494 |
if ($__default["default"](this.getTipElement()).hasClass(CLASS_NAME_SHOW$3)) { |
| 5495 |
this._leave(null, this); |
| 5496 |
|
| 5497 |
return; |
| 5498 |
} |
| 5499 |
|
| 5500 |
this._enter(null, this); |
| 5501 |
} |
| 5502 |
}; |
| 5503 |
|
| 5504 |
_proto.dispose = function dispose() { |
| 5505 |
clearTimeout(this._timeout); |
| 5506 |
$__default["default"].removeData(this.element, this.constructor.DATA_KEY); |
| 5507 |
$__default["default"](this.element).off(this.constructor.EVENT_KEY); |
| 5508 |
$__default["default"](this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler); |
| 5509 |
|
| 5510 |
if (this.tip) { |
| 5511 |
$__default["default"](this.tip).remove(); |
| 5512 |
} |
| 5513 |
|
| 5514 |
this._isEnabled = null; |
| 5515 |
this._timeout = null; |
| 5516 |
this._hoverState = null; |
| 5517 |
this._activeTrigger = null; |
| 5518 |
|
| 5519 |
if (this._popper) { |
| 5520 |
this._popper.destroy(); |
| 5521 |
} |
| 5522 |
|
| 5523 |
this._popper = null; |
| 5524 |
this.element = null; |
| 5525 |
this.config = null; |
| 5526 |
this.tip = null; |
| 5527 |
}; |
| 5528 |
|
| 5529 |
_proto.show = function show() { |
| 5530 |
var _this = this; |
| 5531 |
|
| 5532 |
if ($__default["default"](this.element).css('display') === 'none') { |
| 5533 |
throw new Error('Please use show on visible elements'); |
| 5534 |
} |
| 5535 |
|
| 5536 |
var showEvent = $__default["default"].Event(this.constructor.Event.SHOW); |
| 5537 |
|
| 5538 |
if (this.isWithContent() && this._isEnabled) { |
| 5539 |
$__default["default"](this.element).trigger(showEvent); |
| 5540 |
var shadowRoot = Util.findShadowRoot(this.element); |
| 5541 |
var isInTheDom = $__default["default"].contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); |
| 5542 |
|
| 5543 |
if (showEvent.isDefaultPrevented() || !isInTheDom) { |
| 5544 |
return; |
| 5545 |
} |
| 5546 |
|
| 5547 |
var tip = this.getTipElement(); |
| 5548 |
var tipId = Util.getUID(this.constructor.NAME); |
| 5549 |
tip.setAttribute('id', tipId); |
| 5550 |
this.element.setAttribute('aria-describedby', tipId); |
| 5551 |
this.setContent(); |
| 5552 |
|
| 5553 |
if (this.config.animation) { |
| 5554 |
$__default["default"](tip).addClass(CLASS_NAME_FADE$3); |
| 5555 |
} |
| 5556 |
|
| 5557 |
var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; |
| 5558 |
|
| 5559 |
var attachment = this._getAttachment(placement); |
| 5560 |
|
| 5561 |
this.addAttachmentClass(attachment); |
| 5562 |
|
| 5563 |
var container = this._getContainer(); |
| 5564 |
|
| 5565 |
$__default["default"](tip).data(this.constructor.DATA_KEY, this); |
| 5566 |
|
| 5567 |
if (!$__default["default"].contains(this.element.ownerDocument.documentElement, this.tip)) { |
| 5568 |
$__default["default"](tip).appendTo(container); |
| 5569 |
} |
| 5570 |
|
| 5571 |
$__default["default"](this.element).trigger(this.constructor.Event.INSERTED); |
| 5572 |
this._popper = new Popper$1(this.element, tip, this._getPopperConfig(attachment)); |
| 5573 |
$__default["default"](tip).addClass(CLASS_NAME_SHOW$3); |
| 5574 |
$__default["default"](tip).addClass(this.config.customClass); // If this is a touch-enabled device we add extra |
| 5575 |
// empty mouseover listeners to the body's immediate children; |
| 5576 |
// only needed because of broken event delegation on iOS |
| 5577 |
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html |
| 5578 |
|
| 5579 |
if ('ontouchstart' in document.documentElement) { |
| 5580 |
$__default["default"](document.body).children().on('mouseover', null, $__default["default"].noop); |
| 5581 |
} |
| 5582 |
|
| 5583 |
var complete = function complete() { |
| 5584 |
if (_this.config.animation) { |
| 5585 |
_this._fixTransition(); |
| 5586 |
} |
| 5587 |
|
| 5588 |
var prevHoverState = _this._hoverState; |
| 5589 |
_this._hoverState = null; |
| 5590 |
$__default["default"](_this.element).trigger(_this.constructor.Event.SHOWN); |
| 5591 |
|
| 5592 |
if (prevHoverState === HOVER_STATE_OUT) { |
| 5593 |
_this._leave(null, _this); |
| 5594 |
} |
| 5595 |
}; |
| 5596 |
|
| 5597 |
if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE$3)) { |
| 5598 |
var transitionDuration = Util.getTransitionDurationFromElement(this.tip); |
| 5599 |
$__default["default"](this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); |
| 5600 |
} else { |
| 5601 |
complete(); |
| 5602 |
} |
| 5603 |
} |
| 5604 |
}; |
| 5605 |
|
| 5606 |
_proto.hide = function hide(callback) { |
| 5607 |
var _this2 = this; |
| 5608 |
|
| 5609 |
var tip = this.getTipElement(); |
| 5610 |
var hideEvent = $__default["default"].Event(this.constructor.Event.HIDE); |
| 5611 |
|
| 5612 |
var complete = function complete() { |
| 5613 |
if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) { |
| 5614 |
tip.parentNode.removeChild(tip); |
| 5615 |
} |
| 5616 |
|
| 5617 |
_this2._cleanTipClass(); |
| 5618 |
|
| 5619 |
_this2.element.removeAttribute('aria-describedby'); |
| 5620 |
|
| 5621 |
$__default["default"](_this2.element).trigger(_this2.constructor.Event.HIDDEN); |
| 5622 |
|
| 5623 |
if (_this2._popper !== null) { |
| 5624 |
_this2._popper.destroy(); |
| 5625 |
} |
| 5626 |
|
| 5627 |
if (callback) { |
| 5628 |
callback(); |
| 5629 |
} |
| 5630 |
}; |
| 5631 |
|
| 5632 |
$__default["default"](this.element).trigger(hideEvent); |
| 5633 |
|
| 5634 |
if (hideEvent.isDefaultPrevented()) { |
| 5635 |
return; |
| 5636 |
} |
| 5637 |
|
| 5638 |
$__default["default"](tip).removeClass(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra |
| 5639 |
// empty mouseover listeners we added for iOS support |
| 5640 |
|
| 5641 |
if ('ontouchstart' in document.documentElement) { |
| 5642 |
$__default["default"](document.body).children().off('mouseover', null, $__default["default"].noop); |
| 5643 |
} |
| 5644 |
|
| 5645 |
this._activeTrigger[TRIGGER_CLICK] = false; |
| 5646 |
this._activeTrigger[TRIGGER_FOCUS] = false; |
| 5647 |
this._activeTrigger[TRIGGER_HOVER] = false; |
| 5648 |
|
| 5649 |
if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE$3)) { |
| 5650 |
var transitionDuration = Util.getTransitionDurationFromElement(tip); |
| 5651 |
$__default["default"](tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); |
| 5652 |
} else { |
| 5653 |
complete(); |
| 5654 |
} |
| 5655 |
|
| 5656 |
this._hoverState = ''; |
| 5657 |
}; |
| 5658 |
|
| 5659 |
_proto.update = function update() { |
| 5660 |
if (this._popper !== null) { |
| 5661 |
this._popper.scheduleUpdate(); |
| 5662 |
} |
| 5663 |
} // Protected |
| 5664 |
; |
| 5665 |
|
| 5666 |
_proto.isWithContent = function isWithContent() { |
| 5667 |
return Boolean(this.getTitle()); |
| 5668 |
}; |
| 5669 |
|
| 5670 |
_proto.addAttachmentClass = function addAttachmentClass(attachment) { |
| 5671 |
$__default["default"](this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment); |
| 5672 |
}; |
| 5673 |
|
| 5674 |
_proto.getTipElement = function getTipElement() { |
| 5675 |
this.tip = this.tip || $__default["default"](this.config.template)[0]; |
| 5676 |
return this.tip; |
| 5677 |
}; |
| 5678 |
|
| 5679 |
_proto.setContent = function setContent() { |
| 5680 |
var tip = this.getTipElement(); |
| 5681 |
this.setElementContent($__default["default"](tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle()); |
| 5682 |
$__default["default"](tip).removeClass(CLASS_NAME_FADE$3 + " " + CLASS_NAME_SHOW$3); |
| 5683 |
}; |
| 5684 |
|
| 5685 |
_proto.setElementContent = function setElementContent($element, content) { |
| 5686 |
if (typeof content === 'object' && (content.nodeType || content.jquery)) { |
| 5687 |
// Content is a DOM node or a jQuery |
| 5688 |
if (this.config.html) { |
| 5689 |
if (!$__default["default"](content).parent().is($element)) { |
| 5690 |
$element.empty().append(content); |
| 5691 |
} |
| 5692 |
} else { |
| 5693 |
$element.text($__default["default"](content).text()); |
| 5694 |
} |
| 5695 |
|
| 5696 |
return; |
| 5697 |
} |
| 5698 |
|
| 5699 |
if (this.config.html) { |
| 5700 |
if (this.config.sanitize) { |
| 5701 |
content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); |
| 5702 |
} |
| 5703 |
|
| 5704 |
$element.html(content); |
| 5705 |
} else { |
| 5706 |
$element.text(content); |
| 5707 |
} |
| 5708 |
}; |
| 5709 |
|
| 5710 |
_proto.getTitle = function getTitle() { |
| 5711 |
var title = this.element.getAttribute('data-original-title'); |
| 5712 |
|
| 5713 |
if (!title) { |
| 5714 |
title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; |
| 5715 |
} |
| 5716 |
|
| 5717 |
return title; |
| 5718 |
} // Private |
| 5719 |
; |
| 5720 |
|
| 5721 |
_proto._getPopperConfig = function _getPopperConfig(attachment) { |
| 5722 |
var _this3 = this; |
| 5723 |
|
| 5724 |
var defaultBsConfig = { |
| 5725 |
placement: attachment, |
| 5726 |
modifiers: { |
| 5727 |
offset: this._getOffset(), |
| 5728 |
flip: { |
| 5729 |
behavior: this.config.fallbackPlacement |
| 5730 |
}, |
| 5731 |
arrow: { |
| 5732 |
element: SELECTOR_ARROW |
| 5733 |
}, |
| 5734 |
preventOverflow: { |
| 5735 |
boundariesElement: this.config.boundary |
| 5736 |
} |
| 5737 |
}, |
| 5738 |
onCreate: function onCreate(data) { |
| 5739 |
if (data.originalPlacement !== data.placement) { |
| 5740 |
_this3._handlePopperPlacementChange(data); |
| 5741 |
} |
| 5742 |
}, |
| 5743 |
onUpdate: function onUpdate(data) { |
| 5744 |
return _this3._handlePopperPlacementChange(data); |
| 5745 |
} |
| 5746 |
}; |
| 5747 |
return _extends$1({}, defaultBsConfig, this.config.popperConfig); |
| 5748 |
}; |
| 5749 |
|
| 5750 |
_proto._getOffset = function _getOffset() { |
| 5751 |
var _this4 = this; |
| 5752 |
|
| 5753 |
var offset = {}; |
| 5754 |
|
| 5755 |
if (typeof this.config.offset === 'function') { |
| 5756 |
offset.fn = function (data) { |
| 5757 |
data.offsets = _extends$1({}, data.offsets, _this4.config.offset(data.offsets, _this4.element)); |
| 5758 |
return data; |
| 5759 |
}; |
| 5760 |
} else { |
| 5761 |
offset.offset = this.config.offset; |
| 5762 |
} |
| 5763 |
|
| 5764 |
return offset; |
| 5765 |
}; |
| 5766 |
|
| 5767 |
_proto._getContainer = function _getContainer() { |
| 5768 |
if (this.config.container === false) { |
| 5769 |
return document.body; |
| 5770 |
} |
| 5771 |
|
| 5772 |
if (Util.isElement(this.config.container)) { |
| 5773 |
return $__default["default"](this.config.container); |
| 5774 |
} |
| 5775 |
|
| 5776 |
return $__default["default"](document).find(this.config.container); |
| 5777 |
}; |
| 5778 |
|
| 5779 |
_proto._getAttachment = function _getAttachment(placement) { |
| 5780 |
return AttachmentMap[placement.toUpperCase()]; |
| 5781 |
}; |
| 5782 |
|
| 5783 |
_proto._setListeners = function _setListeners() { |
| 5784 |
var _this5 = this; |
| 5785 |
|
| 5786 |
var triggers = this.config.trigger.split(' '); |
| 5787 |
triggers.forEach(function (trigger) { |
| 5788 |
if (trigger === 'click') { |
| 5789 |
$__default["default"](_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) { |
| 5790 |
return _this5.toggle(event); |
| 5791 |
}); |
| 5792 |
} else if (trigger !== TRIGGER_MANUAL) { |
| 5793 |
var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN; |
| 5794 |
var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT; |
| 5795 |
$__default["default"](_this5.element).on(eventIn, _this5.config.selector, function (event) { |
| 5796 |
return _this5._enter(event); |
| 5797 |
}).on(eventOut, _this5.config.selector, function (event) { |
| 5798 |
return _this5._leave(event); |
| 5799 |
}); |
| 5800 |
} |
| 5801 |
}); |
| 5802 |
|
| 5803 |
this._hideModalHandler = function () { |
| 5804 |
if (_this5.element) { |
| 5805 |
_this5.hide(); |
| 5806 |
} |
| 5807 |
}; |
| 5808 |
|
| 5809 |
$__default["default"](this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler); |
| 5810 |
|
| 5811 |
if (this.config.selector) { |
| 5812 |
this.config = _extends$1({}, this.config, { |
| 5813 |
trigger: 'manual', |
| 5814 |
selector: '' |
| 5815 |
}); |
| 5816 |
} else { |
| 5817 |
this._fixTitle(); |
| 5818 |
} |
| 5819 |
}; |
| 5820 |
|
| 5821 |
_proto._fixTitle = function _fixTitle() { |
| 5822 |
var titleType = typeof this.element.getAttribute('data-original-title'); |
| 5823 |
|
| 5824 |
if (this.element.getAttribute('title') || titleType !== 'string') { |
| 5825 |
this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); |
| 5826 |
this.element.setAttribute('title', ''); |
| 5827 |
} |
| 5828 |
}; |
| 5829 |
|
| 5830 |
_proto._enter = function _enter(event, context) { |
| 5831 |
var dataKey = this.constructor.DATA_KEY; |
| 5832 |
context = context || $__default["default"](event.currentTarget).data(dataKey); |
| 5833 |
|
| 5834 |
if (!context) { |
| 5835 |
context = new this.constructor(event.currentTarget, this._getDelegateConfig()); |
| 5836 |
$__default["default"](event.currentTarget).data(dataKey, context); |
| 5837 |
} |
| 5838 |
|
| 5839 |
if (event) { |
| 5840 |
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; |
| 5841 |
} |
| 5842 |
|
| 5843 |
if ($__default["default"](context.getTipElement()).hasClass(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) { |
| 5844 |
context._hoverState = HOVER_STATE_SHOW; |
| 5845 |
return; |
| 5846 |
} |
| 5847 |
|
| 5848 |
clearTimeout(context._timeout); |
| 5849 |
context._hoverState = HOVER_STATE_SHOW; |
| 5850 |
|
| 5851 |
if (!context.config.delay || !context.config.delay.show) { |
| 5852 |
context.show(); |
| 5853 |
return; |
| 5854 |
} |
| 5855 |
|
| 5856 |
context._timeout = setTimeout(function () { |
| 5857 |
if (context._hoverState === HOVER_STATE_SHOW) { |
| 5858 |
context.show(); |
| 5859 |
} |
| 5860 |
}, context.config.delay.show); |
| 5861 |
}; |
| 5862 |
|
| 5863 |
_proto._leave = function _leave(event, context) { |
| 5864 |
var dataKey = this.constructor.DATA_KEY; |
| 5865 |
context = context || $__default["default"](event.currentTarget).data(dataKey); |
| 5866 |
|
| 5867 |
if (!context) { |
| 5868 |
context = new this.constructor(event.currentTarget, this._getDelegateConfig()); |
| 5869 |
$__default["default"](event.currentTarget).data(dataKey, context); |
| 5870 |
} |
| 5871 |
|
| 5872 |
if (event) { |
| 5873 |
context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false; |
| 5874 |
} |
| 5875 |
|
| 5876 |
if (context._isWithActiveTrigger()) { |
| 5877 |
return; |
| 5878 |
} |
| 5879 |
|
| 5880 |
clearTimeout(context._timeout); |
| 5881 |
context._hoverState = HOVER_STATE_OUT; |
| 5882 |
|
| 5883 |
if (!context.config.delay || !context.config.delay.hide) { |
| 5884 |
context.hide(); |
| 5885 |
return; |
| 5886 |
} |
| 5887 |
|
| 5888 |
context._timeout = setTimeout(function () { |
| 5889 |
if (context._hoverState === HOVER_STATE_OUT) { |
| 5890 |
context.hide(); |
| 5891 |
} |
| 5892 |
}, context.config.delay.hide); |
| 5893 |
}; |
| 5894 |
|
| 5895 |
_proto._isWithActiveTrigger = function _isWithActiveTrigger() { |
| 5896 |
for (var trigger in this._activeTrigger) { |
| 5897 |
if (this._activeTrigger[trigger]) { |
| 5898 |
return true; |
| 5899 |
} |
| 5900 |
} |
| 5901 |
|
| 5902 |
return false; |
| 5903 |
}; |
| 5904 |
|
| 5905 |
_proto._getConfig = function _getConfig(config) { |
| 5906 |
var dataAttributes = $__default["default"](this.element).data(); |
| 5907 |
Object.keys(dataAttributes).forEach(function (dataAttr) { |
| 5908 |
if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { |
| 5909 |
delete dataAttributes[dataAttr]; |
| 5910 |
} |
| 5911 |
}); |
| 5912 |
config = _extends$1({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); |
| 5913 |
|
| 5914 |
if (typeof config.delay === 'number') { |
| 5915 |
config.delay = { |
| 5916 |
show: config.delay, |
| 5917 |
hide: config.delay |
| 5918 |
}; |
| 5919 |
} |
| 5920 |
|
| 5921 |
if (typeof config.title === 'number') { |
| 5922 |
config.title = config.title.toString(); |
| 5923 |
} |
| 5924 |
|
| 5925 |
if (typeof config.content === 'number') { |
| 5926 |
config.content = config.content.toString(); |
| 5927 |
} |
| 5928 |
|
| 5929 |
Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); |
| 5930 |
|
| 5931 |
if (config.sanitize) { |
| 5932 |
config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); |
| 5933 |
} |
| 5934 |
|
| 5935 |
return config; |
| 5936 |
}; |
| 5937 |
|
| 5938 |
_proto._getDelegateConfig = function _getDelegateConfig() { |
| 5939 |
var config = {}; |
| 5940 |
|
| 5941 |
if (this.config) { |
| 5942 |
for (var key in this.config) { |
| 5943 |
if (this.constructor.Default[key] !== this.config[key]) { |
| 5944 |
config[key] = this.config[key]; |
| 5945 |
} |
| 5946 |
} |
| 5947 |
} |
| 5948 |
|
| 5949 |
return config; |
| 5950 |
}; |
| 5951 |
|
| 5952 |
_proto._cleanTipClass = function _cleanTipClass() { |
| 5953 |
var $tip = $__default["default"](this.getTipElement()); |
| 5954 |
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1); |
| 5955 |
|
| 5956 |
if (tabClass !== null && tabClass.length) { |
| 5957 |
$tip.removeClass(tabClass.join('')); |
| 5958 |
} |
| 5959 |
}; |
| 5960 |
|
| 5961 |
_proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { |
| 5962 |
this.tip = popperData.instance.popper; |
| 5963 |
|
| 5964 |
this._cleanTipClass(); |
| 5965 |
|
| 5966 |
this.addAttachmentClass(this._getAttachment(popperData.placement)); |
| 5967 |
}; |
| 5968 |
|
| 5969 |
_proto._fixTransition = function _fixTransition() { |
| 5970 |
var tip = this.getTipElement(); |
| 5971 |
var initConfigAnimation = this.config.animation; |
| 5972 |
|
| 5973 |
if (tip.getAttribute('x-placement') !== null) { |
| 5974 |
return; |
| 5975 |
} |
| 5976 |
|
| 5977 |
$__default["default"](tip).removeClass(CLASS_NAME_FADE$3); |
| 5978 |
this.config.animation = false; |
| 5979 |
this.hide(); |
| 5980 |
this.show(); |
| 5981 |
this.config.animation = initConfigAnimation; |
| 5982 |
} // Static |
| 5983 |
; |
| 5984 |
|
| 5985 |
Tooltip._jQueryInterface = function _jQueryInterface(config) { |
| 5986 |
return this.each(function () { |
| 5987 |
var $element = $__default["default"](this); |
| 5988 |
var data = $element.data(DATA_KEY$4); |
| 5989 |
|
| 5990 |
var _config = typeof config === 'object' && config; |
| 5991 |
|
| 5992 |
if (!data && /dispose|hide/.test(config)) { |
| 5993 |
return; |
| 5994 |
} |
| 5995 |
|
| 5996 |
if (!data) { |
| 5997 |
data = new Tooltip(this, _config); |
| 5998 |
$element.data(DATA_KEY$4, data); |
| 5999 |
} |
| 6000 |
|
| 6001 |
if (typeof config === 'string') { |
| 6002 |
if (typeof data[config] === 'undefined') { |
| 6003 |
throw new TypeError("No method named \"" + config + "\""); |
| 6004 |
} |
| 6005 |
|
| 6006 |
data[config](); |
| 6007 |
} |
| 6008 |
}); |
| 6009 |
}; |
| 6010 |
|
| 6011 |
_createClass(Tooltip, null, [{ |
| 6012 |
key: "VERSION", |
| 6013 |
get: function get() { |
| 6014 |
return VERSION$4; |
| 6015 |
} |
| 6016 |
}, { |
| 6017 |
key: "Default", |
| 6018 |
get: function get() { |
| 6019 |
return Default$3; |
| 6020 |
} |
| 6021 |
}, { |
| 6022 |
key: "NAME", |
| 6023 |
get: function get() { |
| 6024 |
return NAME$4; |
| 6025 |
} |
| 6026 |
}, { |
| 6027 |
key: "DATA_KEY", |
| 6028 |
get: function get() { |
| 6029 |
return DATA_KEY$4; |
| 6030 |
} |
| 6031 |
}, { |
| 6032 |
key: "Event", |
| 6033 |
get: function get() { |
| 6034 |
return Event$1; |
| 6035 |
} |
| 6036 |
}, { |
| 6037 |
key: "EVENT_KEY", |
| 6038 |
get: function get() { |
| 6039 |
return EVENT_KEY$4; |
| 6040 |
} |
| 6041 |
}, { |
| 6042 |
key: "DefaultType", |
| 6043 |
get: function get() { |
| 6044 |
return DefaultType$3; |
| 6045 |
} |
| 6046 |
}]); |
| 6047 |
|
| 6048 |
return Tooltip; |
| 6049 |
}(); |
| 6050 |
/** |
| 6051 |
* jQuery |
| 6052 |
*/ |
| 6053 |
|
| 6054 |
|
| 6055 |
$__default["default"].fn[NAME$4] = Tooltip._jQueryInterface; |
| 6056 |
$__default["default"].fn[NAME$4].Constructor = Tooltip; |
| 6057 |
|
| 6058 |
$__default["default"].fn[NAME$4].noConflict = function () { |
| 6059 |
$__default["default"].fn[NAME$4] = JQUERY_NO_CONFLICT$4; |
| 6060 |
return Tooltip._jQueryInterface; |
| 6061 |
}; |
| 6062 |
|
| 6063 |
/** |
| 6064 |
* Constants |
| 6065 |
*/ |
| 6066 |
|
| 6067 |
var NAME$3 = 'popover'; |
| 6068 |
var VERSION$3 = '4.6.2'; |
| 6069 |
var DATA_KEY$3 = 'bs.popover'; |
| 6070 |
var EVENT_KEY$3 = "." + DATA_KEY$3; |
| 6071 |
var JQUERY_NO_CONFLICT$3 = $__default["default"].fn[NAME$3]; |
| 6072 |
var CLASS_PREFIX = 'bs-popover'; |
| 6073 |
var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); |
| 6074 |
var CLASS_NAME_FADE$2 = 'fade'; |
| 6075 |
var CLASS_NAME_SHOW$2 = 'show'; |
| 6076 |
var SELECTOR_TITLE = '.popover-header'; |
| 6077 |
var SELECTOR_CONTENT = '.popover-body'; |
| 6078 |
|
| 6079 |
var Default$2 = _extends$1({}, Tooltip.Default, { |
| 6080 |
placement: 'right', |
| 6081 |
trigger: 'click', |
| 6082 |
content: '', |
| 6083 |
template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' |
| 6084 |
}); |
| 6085 |
|
| 6086 |
var DefaultType$2 = _extends$1({}, Tooltip.DefaultType, { |
| 6087 |
content: '(string|element|function)' |
| 6088 |
}); |
| 6089 |
|
| 6090 |
var Event = { |
| 6091 |
HIDE: "hide" + EVENT_KEY$3, |
| 6092 |
HIDDEN: "hidden" + EVENT_KEY$3, |
| 6093 |
SHOW: "show" + EVENT_KEY$3, |
| 6094 |
SHOWN: "shown" + EVENT_KEY$3, |
| 6095 |
INSERTED: "inserted" + EVENT_KEY$3, |
| 6096 |
CLICK: "click" + EVENT_KEY$3, |
| 6097 |
FOCUSIN: "focusin" + EVENT_KEY$3, |
| 6098 |
FOCUSOUT: "focusout" + EVENT_KEY$3, |
| 6099 |
MOUSEENTER: "mouseenter" + EVENT_KEY$3, |
| 6100 |
MOUSELEAVE: "mouseleave" + EVENT_KEY$3 |
| 6101 |
}; |
| 6102 |
/** |
| 6103 |
* Class definition |
| 6104 |
*/ |
| 6105 |
|
| 6106 |
var Popover = /*#__PURE__*/function (_Tooltip) { |
| 6107 |
_inheritsLoose(Popover, _Tooltip); |
| 6108 |
|
| 6109 |
function Popover() { |
| 6110 |
return _Tooltip.apply(this, arguments) || this; |
| 6111 |
} |
| 6112 |
|
| 6113 |
var _proto = Popover.prototype; |
| 6114 |
|
| 6115 |
// Overrides |
| 6116 |
_proto.isWithContent = function isWithContent() { |
| 6117 |
return this.getTitle() || this._getContent(); |
| 6118 |
}; |
| 6119 |
|
| 6120 |
_proto.addAttachmentClass = function addAttachmentClass(attachment) { |
| 6121 |
$__default["default"](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); |
| 6122 |
}; |
| 6123 |
|
| 6124 |
_proto.getTipElement = function getTipElement() { |
| 6125 |
this.tip = this.tip || $__default["default"](this.config.template)[0]; |
| 6126 |
return this.tip; |
| 6127 |
}; |
| 6128 |
|
| 6129 |
_proto.setContent = function setContent() { |
| 6130 |
var $tip = $__default["default"](this.getTipElement()); // We use append for html objects to maintain js events |
| 6131 |
|
| 6132 |
this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle()); |
| 6133 |
|
| 6134 |
var content = this._getContent(); |
| 6135 |
|
| 6136 |
if (typeof content === 'function') { |
| 6137 |
content = content.call(this.element); |
| 6138 |
} |
| 6139 |
|
| 6140 |
this.setElementContent($tip.find(SELECTOR_CONTENT), content); |
| 6141 |
$tip.removeClass(CLASS_NAME_FADE$2 + " " + CLASS_NAME_SHOW$2); |
| 6142 |
} // Private |
| 6143 |
; |
| 6144 |
|
| 6145 |
_proto._getContent = function _getContent() { |
| 6146 |
return this.element.getAttribute('data-content') || this.config.content; |
| 6147 |
}; |
| 6148 |
|
| 6149 |
_proto._cleanTipClass = function _cleanTipClass() { |
| 6150 |
var $tip = $__default["default"](this.getTipElement()); |
| 6151 |
var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); |
| 6152 |
|
| 6153 |
if (tabClass !== null && tabClass.length > 0) { |
| 6154 |
$tip.removeClass(tabClass.join('')); |
| 6155 |
} |
| 6156 |
} // Static |
| 6157 |
; |
| 6158 |
|
| 6159 |
Popover._jQueryInterface = function _jQueryInterface(config) { |
| 6160 |
return this.each(function () { |
| 6161 |
var data = $__default["default"](this).data(DATA_KEY$3); |
| 6162 |
|
| 6163 |
var _config = typeof config === 'object' ? config : null; |
| 6164 |
|
| 6165 |
if (!data && /dispose|hide/.test(config)) { |
| 6166 |
return; |
| 6167 |
} |
| 6168 |
|
| 6169 |
if (!data) { |
| 6170 |
data = new Popover(this, _config); |
| 6171 |
$__default["default"](this).data(DATA_KEY$3, data); |
| 6172 |
} |
| 6173 |
|
| 6174 |
if (typeof config === 'string') { |
| 6175 |
if (typeof data[config] === 'undefined') { |
| 6176 |
throw new TypeError("No method named \"" + config + "\""); |
| 6177 |
} |
| 6178 |
|
| 6179 |
data[config](); |
| 6180 |
} |
| 6181 |
}); |
| 6182 |
}; |
| 6183 |
|
| 6184 |
_createClass(Popover, null, [{ |
| 6185 |
key: "VERSION", |
| 6186 |
get: // Getters |
| 6187 |
function get() { |
| 6188 |
return VERSION$3; |
| 6189 |
} |
| 6190 |
}, { |
| 6191 |
key: "Default", |
| 6192 |
get: function get() { |
| 6193 |
return Default$2; |
| 6194 |
} |
| 6195 |
}, { |
| 6196 |
key: "NAME", |
| 6197 |
get: function get() { |
| 6198 |
return NAME$3; |
| 6199 |
} |
| 6200 |
}, { |
| 6201 |
key: "DATA_KEY", |
| 6202 |
get: function get() { |
| 6203 |
return DATA_KEY$3; |
| 6204 |
} |
| 6205 |
}, { |
| 6206 |
key: "Event", |
| 6207 |
get: function get() { |
| 6208 |
return Event; |
| 6209 |
} |
| 6210 |
}, { |
| 6211 |
key: "EVENT_KEY", |
| 6212 |
get: function get() { |
| 6213 |
return EVENT_KEY$3; |
| 6214 |
} |
| 6215 |
}, { |
| 6216 |
key: "DefaultType", |
| 6217 |
get: function get() { |
| 6218 |
return DefaultType$2; |
| 6219 |
} |
| 6220 |
}]); |
| 6221 |
|
| 6222 |
return Popover; |
| 6223 |
}(Tooltip); |
| 6224 |
/** |
| 6225 |
* jQuery |
| 6226 |
*/ |
| 6227 |
|
| 6228 |
|
| 6229 |
$__default["default"].fn[NAME$3] = Popover._jQueryInterface; |
| 6230 |
$__default["default"].fn[NAME$3].Constructor = Popover; |
| 6231 |
|
| 6232 |
$__default["default"].fn[NAME$3].noConflict = function () { |
| 6233 |
$__default["default"].fn[NAME$3] = JQUERY_NO_CONFLICT$3; |
| 6234 |
return Popover._jQueryInterface; |
| 6235 |
}; |
| 6236 |
|
| 6237 |
/** |
| 6238 |
* Constants |
| 6239 |
*/ |
| 6240 |
|
| 6241 |
var NAME$2 = 'scrollspy'; |
| 6242 |
var VERSION$2 = '4.6.2'; |
| 6243 |
var DATA_KEY$2 = 'bs.scrollspy'; |
| 6244 |
var EVENT_KEY$2 = "." + DATA_KEY$2; |
| 6245 |
var DATA_API_KEY$1 = '.data-api'; |
| 6246 |
var JQUERY_NO_CONFLICT$2 = $__default["default"].fn[NAME$2]; |
| 6247 |
var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; |
| 6248 |
var CLASS_NAME_ACTIVE$1 = 'active'; |
| 6249 |
var EVENT_ACTIVATE = "activate" + EVENT_KEY$2; |
| 6250 |
var EVENT_SCROLL = "scroll" + EVENT_KEY$2; |
| 6251 |
var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$2 + DATA_API_KEY$1; |
| 6252 |
var METHOD_OFFSET = 'offset'; |
| 6253 |
var METHOD_POSITION = 'position'; |
| 6254 |
var SELECTOR_DATA_SPY = '[data-spy="scroll"]'; |
| 6255 |
var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group'; |
| 6256 |
var SELECTOR_NAV_LINKS = '.nav-link'; |
| 6257 |
var SELECTOR_NAV_ITEMS = '.nav-item'; |
| 6258 |
var SELECTOR_LIST_ITEMS = '.list-group-item'; |
| 6259 |
var SELECTOR_DROPDOWN$1 = '.dropdown'; |
| 6260 |
var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item'; |
| 6261 |
var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; |
| 6262 |
var Default$1 = { |
| 6263 |
offset: 10, |
| 6264 |
method: 'auto', |
| 6265 |
target: '' |
| 6266 |
}; |
| 6267 |
var DefaultType$1 = { |
| 6268 |
offset: 'number', |
| 6269 |
method: 'string', |
| 6270 |
target: '(string|element)' |
| 6271 |
}; |
| 6272 |
/** |
| 6273 |
* Class definition |
| 6274 |
*/ |
| 6275 |
|
| 6276 |
var ScrollSpy = /*#__PURE__*/function () { |
| 6277 |
function ScrollSpy(element, config) { |
| 6278 |
var _this = this; |
| 6279 |
|
| 6280 |
this._element = element; |
| 6281 |
this._scrollElement = element.tagName === 'BODY' ? window : element; |
| 6282 |
this._config = this._getConfig(config); |
| 6283 |
this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS); |
| 6284 |
this._offsets = []; |
| 6285 |
this._targets = []; |
| 6286 |
this._activeTarget = null; |
| 6287 |
this._scrollHeight = 0; |
| 6288 |
$__default["default"](this._scrollElement).on(EVENT_SCROLL, function (event) { |
| 6289 |
return _this._process(event); |
| 6290 |
}); |
| 6291 |
this.refresh(); |
| 6292 |
|
| 6293 |
this._process(); |
| 6294 |
} // Getters |
| 6295 |
|
| 6296 |
|
| 6297 |
var _proto = ScrollSpy.prototype; |
| 6298 |
|
| 6299 |
// Public |
| 6300 |
_proto.refresh = function refresh() { |
| 6301 |
var _this2 = this; |
| 6302 |
|
| 6303 |
var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION; |
| 6304 |
var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; |
| 6305 |
var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0; |
| 6306 |
this._offsets = []; |
| 6307 |
this._targets = []; |
| 6308 |
this._scrollHeight = this._getScrollHeight(); |
| 6309 |
var targets = [].slice.call(document.querySelectorAll(this._selector)); |
| 6310 |
targets.map(function (element) { |
| 6311 |
var target; |
| 6312 |
var targetSelector = Util.getSelectorFromElement(element); |
| 6313 |
|
| 6314 |
if (targetSelector) { |
| 6315 |
target = document.querySelector(targetSelector); |
| 6316 |
} |
| 6317 |
|
| 6318 |
if (target) { |
| 6319 |
var targetBCR = target.getBoundingClientRect(); |
| 6320 |
|
| 6321 |
if (targetBCR.width || targetBCR.height) { |
| 6322 |
// TODO (fat): remove sketch reliance on jQuery position/offset |
| 6323 |
return [$__default["default"](target)[offsetMethod]().top + offsetBase, targetSelector]; |
| 6324 |
} |
| 6325 |
} |
| 6326 |
|
| 6327 |
return null; |
| 6328 |
}).filter(Boolean).sort(function (a, b) { |
| 6329 |
return a[0] - b[0]; |
| 6330 |
}).forEach(function (item) { |
| 6331 |
_this2._offsets.push(item[0]); |
| 6332 |
|
| 6333 |
_this2._targets.push(item[1]); |
| 6334 |
}); |
| 6335 |
}; |
| 6336 |
|
| 6337 |
_proto.dispose = function dispose() { |
| 6338 |
$__default["default"].removeData(this._element, DATA_KEY$2); |
| 6339 |
$__default["default"](this._scrollElement).off(EVENT_KEY$2); |
| 6340 |
this._element = null; |
| 6341 |
this._scrollElement = null; |
| 6342 |
this._config = null; |
| 6343 |
this._selector = null; |
| 6344 |
this._offsets = null; |
| 6345 |
this._targets = null; |
| 6346 |
this._activeTarget = null; |
| 6347 |
this._scrollHeight = null; |
| 6348 |
} // Private |
| 6349 |
; |
| 6350 |
|
| 6351 |
_proto._getConfig = function _getConfig(config) { |
| 6352 |
config = _extends$1({}, Default$1, typeof config === 'object' && config ? config : {}); |
| 6353 |
|
| 6354 |
if (typeof config.target !== 'string' && Util.isElement(config.target)) { |
| 6355 |
var id = $__default["default"](config.target).attr('id'); |
| 6356 |
|
| 6357 |
if (!id) { |
| 6358 |
id = Util.getUID(NAME$2); |
| 6359 |
$__default["default"](config.target).attr('id', id); |
| 6360 |
} |
| 6361 |
|
| 6362 |
config.target = "#" + id; |
| 6363 |
} |
| 6364 |
|
| 6365 |
Util.typeCheckConfig(NAME$2, config, DefaultType$1); |
| 6366 |
return config; |
| 6367 |
}; |
| 6368 |
|
| 6369 |
_proto._getScrollTop = function _getScrollTop() { |
| 6370 |
return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; |
| 6371 |
}; |
| 6372 |
|
| 6373 |
_proto._getScrollHeight = function _getScrollHeight() { |
| 6374 |
return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); |
| 6375 |
}; |
| 6376 |
|
| 6377 |
_proto._getOffsetHeight = function _getOffsetHeight() { |
| 6378 |
return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; |
| 6379 |
}; |
| 6380 |
|
| 6381 |
_proto._process = function _process() { |
| 6382 |
var scrollTop = this._getScrollTop() + this._config.offset; |
| 6383 |
|
| 6384 |
var scrollHeight = this._getScrollHeight(); |
| 6385 |
|
| 6386 |
var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); |
| 6387 |
|
| 6388 |
if (this._scrollHeight !== scrollHeight) { |
| 6389 |
this.refresh(); |
| 6390 |
} |
| 6391 |
|
| 6392 |
if (scrollTop >= maxScroll) { |
| 6393 |
var target = this._targets[this._targets.length - 1]; |
| 6394 |
|
| 6395 |
if (this._activeTarget !== target) { |
| 6396 |
this._activate(target); |
| 6397 |
} |
| 6398 |
|
| 6399 |
return; |
| 6400 |
} |
| 6401 |
|
| 6402 |
if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { |
| 6403 |
this._activeTarget = null; |
| 6404 |
|
| 6405 |
this._clear(); |
| 6406 |
|
| 6407 |
return; |
| 6408 |
} |
| 6409 |
|
| 6410 |
for (var i = this._offsets.length; i--;) { |
| 6411 |
var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); |
| 6412 |
|
| 6413 |
if (isActiveTarget) { |
| 6414 |
this._activate(this._targets[i]); |
| 6415 |
} |
| 6416 |
} |
| 6417 |
}; |
| 6418 |
|
| 6419 |
_proto._activate = function _activate(target) { |
| 6420 |
this._activeTarget = target; |
| 6421 |
|
| 6422 |
this._clear(); |
| 6423 |
|
| 6424 |
var queries = this._selector.split(',').map(function (selector) { |
| 6425 |
return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]"; |
| 6426 |
}); |
| 6427 |
|
| 6428 |
var $link = $__default["default"]([].slice.call(document.querySelectorAll(queries.join(',')))); |
| 6429 |
|
| 6430 |
if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) { |
| 6431 |
$link.closest(SELECTOR_DROPDOWN$1).find(SELECTOR_DROPDOWN_TOGGLE$1).addClass(CLASS_NAME_ACTIVE$1); |
| 6432 |
$link.addClass(CLASS_NAME_ACTIVE$1); |
| 6433 |
} else { |
| 6434 |
// Set triggered link as active |
| 6435 |
$link.addClass(CLASS_NAME_ACTIVE$1); // Set triggered links parents as active |
| 6436 |
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor |
| 6437 |
|
| 6438 |
$link.parents(SELECTOR_NAV_LIST_GROUP$1).prev(SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).addClass(CLASS_NAME_ACTIVE$1); // Handle special case when .nav-link is inside .nav-item |
| 6439 |
|
| 6440 |
$link.parents(SELECTOR_NAV_LIST_GROUP$1).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE$1); |
| 6441 |
} |
| 6442 |
|
| 6443 |
$__default["default"](this._scrollElement).trigger(EVENT_ACTIVATE, { |
| 6444 |
relatedTarget: target |
| 6445 |
}); |
| 6446 |
}; |
| 6447 |
|
| 6448 |
_proto._clear = function _clear() { |
| 6449 |
[].slice.call(document.querySelectorAll(this._selector)).filter(function (node) { |
| 6450 |
return node.classList.contains(CLASS_NAME_ACTIVE$1); |
| 6451 |
}).forEach(function (node) { |
| 6452 |
return node.classList.remove(CLASS_NAME_ACTIVE$1); |
| 6453 |
}); |
| 6454 |
} // Static |
| 6455 |
; |
| 6456 |
|
| 6457 |
ScrollSpy._jQueryInterface = function _jQueryInterface(config) { |
| 6458 |
return this.each(function () { |
| 6459 |
var data = $__default["default"](this).data(DATA_KEY$2); |
| 6460 |
|
| 6461 |
var _config = typeof config === 'object' && config; |
| 6462 |
|
| 6463 |
if (!data) { |
| 6464 |
data = new ScrollSpy(this, _config); |
| 6465 |
$__default["default"](this).data(DATA_KEY$2, data); |
| 6466 |
} |
| 6467 |
|
| 6468 |
if (typeof config === 'string') { |
| 6469 |
if (typeof data[config] === 'undefined') { |
| 6470 |
throw new TypeError("No method named \"" + config + "\""); |
| 6471 |
} |
| 6472 |
|
| 6473 |
data[config](); |
| 6474 |
} |
| 6475 |
}); |
| 6476 |
}; |
| 6477 |
|
| 6478 |
_createClass(ScrollSpy, null, [{ |
| 6479 |
key: "VERSION", |
| 6480 |
get: function get() { |
| 6481 |
return VERSION$2; |
| 6482 |
} |
| 6483 |
}, { |
| 6484 |
key: "Default", |
| 6485 |
get: function get() { |
| 6486 |
return Default$1; |
| 6487 |
} |
| 6488 |
}]); |
| 6489 |
|
| 6490 |
return ScrollSpy; |
| 6491 |
}(); |
| 6492 |
/** |
| 6493 |
* Data API implementation |
| 6494 |
*/ |
| 6495 |
|
| 6496 |
|
| 6497 |
$__default["default"](window).on(EVENT_LOAD_DATA_API, function () { |
| 6498 |
var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY)); |
| 6499 |
var scrollSpysLength = scrollSpys.length; |
| 6500 |
|
| 6501 |
for (var i = scrollSpysLength; i--;) { |
| 6502 |
var $spy = $__default["default"](scrollSpys[i]); |
| 6503 |
|
| 6504 |
ScrollSpy._jQueryInterface.call($spy, $spy.data()); |
| 6505 |
} |
| 6506 |
}); |
| 6507 |
/** |
| 6508 |
* jQuery |
| 6509 |
*/ |
| 6510 |
|
| 6511 |
$__default["default"].fn[NAME$2] = ScrollSpy._jQueryInterface; |
| 6512 |
$__default["default"].fn[NAME$2].Constructor = ScrollSpy; |
| 6513 |
|
| 6514 |
$__default["default"].fn[NAME$2].noConflict = function () { |
| 6515 |
$__default["default"].fn[NAME$2] = JQUERY_NO_CONFLICT$2; |
| 6516 |
return ScrollSpy._jQueryInterface; |
| 6517 |
}; |
| 6518 |
|
| 6519 |
/** |
| 6520 |
* Constants |
| 6521 |
*/ |
| 6522 |
|
| 6523 |
var NAME$1 = 'tab'; |
| 6524 |
var VERSION$1 = '4.6.2'; |
| 6525 |
var DATA_KEY$1 = 'bs.tab'; |
| 6526 |
var EVENT_KEY$1 = "." + DATA_KEY$1; |
| 6527 |
var DATA_API_KEY = '.data-api'; |
| 6528 |
var JQUERY_NO_CONFLICT$1 = $__default["default"].fn[NAME$1]; |
| 6529 |
var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'; |
| 6530 |
var CLASS_NAME_ACTIVE = 'active'; |
| 6531 |
var CLASS_NAME_DISABLED = 'disabled'; |
| 6532 |
var CLASS_NAME_FADE$1 = 'fade'; |
| 6533 |
var CLASS_NAME_SHOW$1 = 'show'; |
| 6534 |
var EVENT_HIDE$1 = "hide" + EVENT_KEY$1; |
| 6535 |
var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$1; |
| 6536 |
var EVENT_SHOW$1 = "show" + EVENT_KEY$1; |
| 6537 |
var EVENT_SHOWN$1 = "shown" + EVENT_KEY$1; |
| 6538 |
var EVENT_CLICK_DATA_API = "click" + EVENT_KEY$1 + DATA_API_KEY; |
| 6539 |
var SELECTOR_DROPDOWN = '.dropdown'; |
| 6540 |
var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; |
| 6541 |
var SELECTOR_ACTIVE = '.active'; |
| 6542 |
var SELECTOR_ACTIVE_UL = '> li > .active'; |
| 6543 |
var SELECTOR_DATA_TOGGLE = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]'; |
| 6544 |
var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; |
| 6545 |
var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active'; |
| 6546 |
/** |
| 6547 |
* Class definition |
| 6548 |
*/ |
| 6549 |
|
| 6550 |
var Tab = /*#__PURE__*/function () { |
| 6551 |
function Tab(element) { |
| 6552 |
this._element = element; |
| 6553 |
} // Getters |
| 6554 |
|
| 6555 |
|
| 6556 |
var _proto = Tab.prototype; |
| 6557 |
|
| 6558 |
// Public |
| 6559 |
_proto.show = function show() { |
| 6560 |
var _this = this; |
| 6561 |
|
| 6562 |
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $__default["default"](this._element).hasClass(CLASS_NAME_ACTIVE) || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED) || this._element.hasAttribute('disabled')) { |
| 6563 |
return; |
| 6564 |
} |
| 6565 |
|
| 6566 |
var target; |
| 6567 |
var previous; |
| 6568 |
var listElement = $__default["default"](this._element).closest(SELECTOR_NAV_LIST_GROUP)[0]; |
| 6569 |
var selector = Util.getSelectorFromElement(this._element); |
| 6570 |
|
| 6571 |
if (listElement) { |
| 6572 |
var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE; |
| 6573 |
previous = $__default["default"].makeArray($__default["default"](listElement).find(itemSelector)); |
| 6574 |
previous = previous[previous.length - 1]; |
| 6575 |
} |
| 6576 |
|
| 6577 |
var hideEvent = $__default["default"].Event(EVENT_HIDE$1, { |
| 6578 |
relatedTarget: this._element |
| 6579 |
}); |
| 6580 |
var showEvent = $__default["default"].Event(EVENT_SHOW$1, { |
| 6581 |
relatedTarget: previous |
| 6582 |
}); |
| 6583 |
|
| 6584 |
if (previous) { |
| 6585 |
$__default["default"](previous).trigger(hideEvent); |
| 6586 |
} |
| 6587 |
|
| 6588 |
$__default["default"](this._element).trigger(showEvent); |
| 6589 |
|
| 6590 |
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { |
| 6591 |
return; |
| 6592 |
} |
| 6593 |
|
| 6594 |
if (selector) { |
| 6595 |
target = document.querySelector(selector); |
| 6596 |
} |
| 6597 |
|
| 6598 |
this._activate(this._element, listElement); |
| 6599 |
|
| 6600 |
var complete = function complete() { |
| 6601 |
var hiddenEvent = $__default["default"].Event(EVENT_HIDDEN$1, { |
| 6602 |
relatedTarget: _this._element |
| 6603 |
}); |
| 6604 |
var shownEvent = $__default["default"].Event(EVENT_SHOWN$1, { |
| 6605 |
relatedTarget: previous |
| 6606 |
}); |
| 6607 |
$__default["default"](previous).trigger(hiddenEvent); |
| 6608 |
$__default["default"](_this._element).trigger(shownEvent); |
| 6609 |
}; |
| 6610 |
|
| 6611 |
if (target) { |
| 6612 |
this._activate(target, target.parentNode, complete); |
| 6613 |
} else { |
| 6614 |
complete(); |
| 6615 |
} |
| 6616 |
}; |
| 6617 |
|
| 6618 |
_proto.dispose = function dispose() { |
| 6619 |
$__default["default"].removeData(this._element, DATA_KEY$1); |
| 6620 |
this._element = null; |
| 6621 |
} // Private |
| 6622 |
; |
| 6623 |
|
| 6624 |
_proto._activate = function _activate(element, container, callback) { |
| 6625 |
var _this2 = this; |
| 6626 |
|
| 6627 |
var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $__default["default"](container).find(SELECTOR_ACTIVE_UL) : $__default["default"](container).children(SELECTOR_ACTIVE); |
| 6628 |
var active = activeElements[0]; |
| 6629 |
var isTransitioning = callback && active && $__default["default"](active).hasClass(CLASS_NAME_FADE$1); |
| 6630 |
|
| 6631 |
var complete = function complete() { |
| 6632 |
return _this2._transitionComplete(element, active, callback); |
| 6633 |
}; |
| 6634 |
|
| 6635 |
if (active && isTransitioning) { |
| 6636 |
var transitionDuration = Util.getTransitionDurationFromElement(active); |
| 6637 |
$__default["default"](active).removeClass(CLASS_NAME_SHOW$1).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); |
| 6638 |
} else { |
| 6639 |
complete(); |
| 6640 |
} |
| 6641 |
}; |
| 6642 |
|
| 6643 |
_proto._transitionComplete = function _transitionComplete(element, active, callback) { |
| 6644 |
if (active) { |
| 6645 |
$__default["default"](active).removeClass(CLASS_NAME_ACTIVE); |
| 6646 |
var dropdownChild = $__default["default"](active.parentNode).find(SELECTOR_DROPDOWN_ACTIVE_CHILD)[0]; |
| 6647 |
|
| 6648 |
if (dropdownChild) { |
| 6649 |
$__default["default"](dropdownChild).removeClass(CLASS_NAME_ACTIVE); |
| 6650 |
} |
| 6651 |
|
| 6652 |
if (active.getAttribute('role') === 'tab') { |
| 6653 |
active.setAttribute('aria-selected', false); |
| 6654 |
} |
| 6655 |
} |
| 6656 |
|
| 6657 |
$__default["default"](element).addClass(CLASS_NAME_ACTIVE); |
| 6658 |
|
| 6659 |
if (element.getAttribute('role') === 'tab') { |
| 6660 |
element.setAttribute('aria-selected', true); |
| 6661 |
} |
| 6662 |
|
| 6663 |
Util.reflow(element); |
| 6664 |
|
| 6665 |
if (element.classList.contains(CLASS_NAME_FADE$1)) { |
| 6666 |
element.classList.add(CLASS_NAME_SHOW$1); |
| 6667 |
} |
| 6668 |
|
| 6669 |
var parent = element.parentNode; |
| 6670 |
|
| 6671 |
if (parent && parent.nodeName === 'LI') { |
| 6672 |
parent = parent.parentNode; |
| 6673 |
} |
| 6674 |
|
| 6675 |
if (parent && $__default["default"](parent).hasClass(CLASS_NAME_DROPDOWN_MENU)) { |
| 6676 |
var dropdownElement = $__default["default"](element).closest(SELECTOR_DROPDOWN)[0]; |
| 6677 |
|
| 6678 |
if (dropdownElement) { |
| 6679 |
var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE)); |
| 6680 |
$__default["default"](dropdownToggleList).addClass(CLASS_NAME_ACTIVE); |
| 6681 |
} |
| 6682 |
|
| 6683 |
element.setAttribute('aria-expanded', true); |
| 6684 |
} |
| 6685 |
|
| 6686 |
if (callback) { |
| 6687 |
callback(); |
| 6688 |
} |
| 6689 |
} // Static |
| 6690 |
; |
| 6691 |
|
| 6692 |
Tab._jQueryInterface = function _jQueryInterface(config) { |
| 6693 |
return this.each(function () { |
| 6694 |
var $this = $__default["default"](this); |
| 6695 |
var data = $this.data(DATA_KEY$1); |
| 6696 |
|
| 6697 |
if (!data) { |
| 6698 |
data = new Tab(this); |
| 6699 |
$this.data(DATA_KEY$1, data); |
| 6700 |
} |
| 6701 |
|
| 6702 |
if (typeof config === 'string') { |
| 6703 |
if (typeof data[config] === 'undefined') { |
| 6704 |
throw new TypeError("No method named \"" + config + "\""); |
| 6705 |
} |
| 6706 |
|
| 6707 |
data[config](); |
| 6708 |
} |
| 6709 |
}); |
| 6710 |
}; |
| 6711 |
|
| 6712 |
_createClass(Tab, null, [{ |
| 6713 |
key: "VERSION", |
| 6714 |
get: function get() { |
| 6715 |
return VERSION$1; |
| 6716 |
} |
| 6717 |
}]); |
| 6718 |
|
| 6719 |
return Tab; |
| 6720 |
}(); |
| 6721 |
/** |
| 6722 |
* Data API implementation |
| 6723 |
*/ |
| 6724 |
|
| 6725 |
|
| 6726 |
$__default["default"](document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { |
| 6727 |
event.preventDefault(); |
| 6728 |
|
| 6729 |
Tab._jQueryInterface.call($__default["default"](this), 'show'); |
| 6730 |
}); |
| 6731 |
/** |
| 6732 |
* jQuery |
| 6733 |
*/ |
| 6734 |
|
| 6735 |
$__default["default"].fn[NAME$1] = Tab._jQueryInterface; |
| 6736 |
$__default["default"].fn[NAME$1].Constructor = Tab; |
| 6737 |
|
| 6738 |
$__default["default"].fn[NAME$1].noConflict = function () { |
| 6739 |
$__default["default"].fn[NAME$1] = JQUERY_NO_CONFLICT$1; |
| 6740 |
return Tab._jQueryInterface; |
| 6741 |
}; |
| 6742 |
|
| 6743 |
/** |
| 6744 |
* Constants |
| 6745 |
*/ |
| 6746 |
|
| 6747 |
var NAME = 'toast'; |
| 6748 |
var VERSION = '4.6.2'; |
| 6749 |
var DATA_KEY = 'bs.toast'; |
| 6750 |
var EVENT_KEY = "." + DATA_KEY; |
| 6751 |
var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME]; |
| 6752 |
var CLASS_NAME_FADE = 'fade'; |
| 6753 |
var CLASS_NAME_HIDE = 'hide'; |
| 6754 |
var CLASS_NAME_SHOW = 'show'; |
| 6755 |
var CLASS_NAME_SHOWING = 'showing'; |
| 6756 |
var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY; |
| 6757 |
var EVENT_HIDE = "hide" + EVENT_KEY; |
| 6758 |
var EVENT_HIDDEN = "hidden" + EVENT_KEY; |
| 6759 |
var EVENT_SHOW = "show" + EVENT_KEY; |
| 6760 |
var EVENT_SHOWN = "shown" + EVENT_KEY; |
| 6761 |
var SELECTOR_DATA_DISMISS = '[data-dismiss="toast"]'; |
| 6762 |
var Default = { |
| 6763 |
animation: true, |
| 6764 |
autohide: true, |
| 6765 |
delay: 500 |
| 6766 |
}; |
| 6767 |
var DefaultType = { |
| 6768 |
animation: 'boolean', |
| 6769 |
autohide: 'boolean', |
| 6770 |
delay: 'number' |
| 6771 |
}; |
| 6772 |
/** |
| 6773 |
* Class definition |
| 6774 |
*/ |
| 6775 |
|
| 6776 |
var Toast = /*#__PURE__*/function () { |
| 6777 |
function Toast(element, config) { |
| 6778 |
this._element = element; |
| 6779 |
this._config = this._getConfig(config); |
| 6780 |
this._timeout = null; |
| 6781 |
|
| 6782 |
this._setListeners(); |
| 6783 |
} // Getters |
| 6784 |
|
| 6785 |
|
| 6786 |
var _proto = Toast.prototype; |
| 6787 |
|
| 6788 |
// Public |
| 6789 |
_proto.show = function show() { |
| 6790 |
var _this = this; |
| 6791 |
|
| 6792 |
var showEvent = $__default["default"].Event(EVENT_SHOW); |
| 6793 |
$__default["default"](this._element).trigger(showEvent); |
| 6794 |
|
| 6795 |
if (showEvent.isDefaultPrevented()) { |
| 6796 |
return; |
| 6797 |
} |
| 6798 |
|
| 6799 |
this._clearTimeout(); |
| 6800 |
|
| 6801 |
if (this._config.animation) { |
| 6802 |
this._element.classList.add(CLASS_NAME_FADE); |
| 6803 |
} |
| 6804 |
|
| 6805 |
var complete = function complete() { |
| 6806 |
_this._element.classList.remove(CLASS_NAME_SHOWING); |
| 6807 |
|
| 6808 |
_this._element.classList.add(CLASS_NAME_SHOW); |
| 6809 |
|
| 6810 |
$__default["default"](_this._element).trigger(EVENT_SHOWN); |
| 6811 |
|
| 6812 |
if (_this._config.autohide) { |
| 6813 |
_this._timeout = setTimeout(function () { |
| 6814 |
_this.hide(); |
| 6815 |
}, _this._config.delay); |
| 6816 |
} |
| 6817 |
}; |
| 6818 |
|
| 6819 |
this._element.classList.remove(CLASS_NAME_HIDE); |
| 6820 |
|
| 6821 |
Util.reflow(this._element); |
| 6822 |
|
| 6823 |
this._element.classList.add(CLASS_NAME_SHOWING); |
| 6824 |
|
| 6825 |
if (this._config.animation) { |
| 6826 |
var transitionDuration = Util.getTransitionDurationFromElement(this._element); |
| 6827 |
$__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); |
| 6828 |
} else { |
| 6829 |
complete(); |
| 6830 |
} |
| 6831 |
}; |
| 6832 |
|
| 6833 |
_proto.hide = function hide() { |
| 6834 |
if (!this._element.classList.contains(CLASS_NAME_SHOW)) { |
| 6835 |
return; |
| 6836 |
} |
| 6837 |
|
| 6838 |
var hideEvent = $__default["default"].Event(EVENT_HIDE); |
| 6839 |
$__default["default"](this._element).trigger(hideEvent); |
| 6840 |
|
| 6841 |
if (hideEvent.isDefaultPrevented()) { |
| 6842 |
return; |
| 6843 |
} |
| 6844 |
|
| 6845 |
this._close(); |
| 6846 |
}; |
| 6847 |
|
| 6848 |
_proto.dispose = function dispose() { |
| 6849 |
this._clearTimeout(); |
| 6850 |
|
| 6851 |
if (this._element.classList.contains(CLASS_NAME_SHOW)) { |
| 6852 |
this._element.classList.remove(CLASS_NAME_SHOW); |
| 6853 |
} |
| 6854 |
|
| 6855 |
$__default["default"](this._element).off(EVENT_CLICK_DISMISS); |
| 6856 |
$__default["default"].removeData(this._element, DATA_KEY); |
| 6857 |
this._element = null; |
| 6858 |
this._config = null; |
| 6859 |
} // Private |
| 6860 |
; |
| 6861 |
|
| 6862 |
_proto._getConfig = function _getConfig(config) { |
| 6863 |
config = _extends$1({}, Default, $__default["default"](this._element).data(), typeof config === 'object' && config ? config : {}); |
| 6864 |
Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); |
| 6865 |
return config; |
| 6866 |
}; |
| 6867 |
|
| 6868 |
_proto._setListeners = function _setListeners() { |
| 6869 |
var _this2 = this; |
| 6870 |
|
| 6871 |
$__default["default"](this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () { |
| 6872 |
return _this2.hide(); |
| 6873 |
}); |
| 6874 |
}; |
| 6875 |
|
| 6876 |
_proto._close = function _close() { |
| 6877 |
var _this3 = this; |
| 6878 |
|
| 6879 |
var complete = function complete() { |
| 6880 |
_this3._element.classList.add(CLASS_NAME_HIDE); |
| 6881 |
|
| 6882 |
$__default["default"](_this3._element).trigger(EVENT_HIDDEN); |
| 6883 |
}; |
| 6884 |
|
| 6885 |
this._element.classList.remove(CLASS_NAME_SHOW); |
| 6886 |
|
| 6887 |
if (this._config.animation) { |
| 6888 |
var transitionDuration = Util.getTransitionDurationFromElement(this._element); |
| 6889 |
$__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); |
| 6890 |
} else { |
| 6891 |
complete(); |
| 6892 |
} |
| 6893 |
}; |
| 6894 |
|
| 6895 |
_proto._clearTimeout = function _clearTimeout() { |
| 6896 |
clearTimeout(this._timeout); |
| 6897 |
this._timeout = null; |
| 6898 |
} // Static |
| 6899 |
; |
| 6900 |
|
| 6901 |
Toast._jQueryInterface = function _jQueryInterface(config) { |
| 6902 |
return this.each(function () { |
| 6903 |
var $element = $__default["default"](this); |
| 6904 |
var data = $element.data(DATA_KEY); |
| 6905 |
|
| 6906 |
var _config = typeof config === 'object' && config; |
| 6907 |
|
| 6908 |
if (!data) { |
| 6909 |
data = new Toast(this, _config); |
| 6910 |
$element.data(DATA_KEY, data); |
| 6911 |
} |
| 6912 |
|
| 6913 |
if (typeof config === 'string') { |
| 6914 |
if (typeof data[config] === 'undefined') { |
| 6915 |
throw new TypeError("No method named \"" + config + "\""); |
| 6916 |
} |
| 6917 |
|
| 6918 |
data[config](this); |
| 6919 |
} |
| 6920 |
}); |
| 6921 |
}; |
| 6922 |
|
| 6923 |
_createClass(Toast, null, [{ |
| 6924 |
key: "VERSION", |
| 6925 |
get: function get() { |
| 6926 |
return VERSION; |
| 6927 |
} |
| 6928 |
}, { |
| 6929 |
key: "DefaultType", |
| 6930 |
get: function get() { |
| 6931 |
return DefaultType; |
| 6932 |
} |
| 6933 |
}, { |
| 6934 |
key: "Default", |
| 6935 |
get: function get() { |
| 6936 |
return Default; |
| 6937 |
} |
| 6938 |
}]); |
| 6939 |
|
| 6940 |
return Toast; |
| 6941 |
}(); |
| 6942 |
/** |
| 6943 |
* jQuery |
| 6944 |
*/ |
| 6945 |
|
| 6946 |
|
| 6947 |
$__default["default"].fn[NAME] = Toast._jQueryInterface; |
| 6948 |
$__default["default"].fn[NAME].Constructor = Toast; |
| 6949 |
|
| 6950 |
$__default["default"].fn[NAME].noConflict = function () { |
| 6951 |
$__default["default"].fn[NAME] = JQUERY_NO_CONFLICT; |
| 6952 |
return Toast._jQueryInterface; |
| 6953 |
}; |
| 6954 |
|
| 6955 |
exports.Alert = Alert; |
| 6956 |
exports.Button = Button; |
| 6957 |
exports.Carousel = Carousel; |
| 6958 |
exports.Collapse = Collapse; |
| 6959 |
exports.Dropdown = Dropdown; |
| 6960 |
exports.Modal = Modal; |
| 6961 |
exports.Popover = Popover; |
| 6962 |
exports.Scrollspy = ScrollSpy; |
| 6963 |
exports.Tab = Tab; |
| 6964 |
exports.Toast = Toast; |
| 6965 |
exports.Tooltip = Tooltip; |
| 6966 |
exports.Util = Util; |
| 6967 |
|
| 6968 |
Object.defineProperty(exports, '__esModule', { value: true }); |
| 6969 |
|
| 6970 |
})); |
| 6971 |
//# sourceMappingURL=bootstrap.bundle.js.map |
| 6972 |
|