[705d6f5] | 1 | /*!
|
---|
| 2 | * Bootstrap v4.3.1 (https://getbootstrap.com/)
|
---|
| 3 | * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
---|
| 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
---|
| 5 | */
|
---|
| 6 | (function (global, factory) {
|
---|
| 7 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) :
|
---|
| 8 | typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) :
|
---|
| 9 | (global = global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper));
|
---|
| 10 | }(this, function (exports, $, Popper) { 'use strict';
|
---|
| 11 |
|
---|
| 12 | $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
---|
| 13 | Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
|
---|
| 14 |
|
---|
| 15 | function _defineProperties(target, props) {
|
---|
| 16 | for (var i = 0; i < props.length; i++) {
|
---|
| 17 | var descriptor = props[i];
|
---|
| 18 | descriptor.enumerable = descriptor.enumerable || false;
|
---|
| 19 | descriptor.configurable = true;
|
---|
| 20 | if ("value" in descriptor) descriptor.writable = true;
|
---|
| 21 | Object.defineProperty(target, descriptor.key, descriptor);
|
---|
| 22 | }
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | function _createClass(Constructor, protoProps, staticProps) {
|
---|
| 26 | if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
---|
| 27 | if (staticProps) _defineProperties(Constructor, staticProps);
|
---|
| 28 | return Constructor;
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | function _defineProperty(obj, key, value) {
|
---|
| 32 | if (key in obj) {
|
---|
| 33 | Object.defineProperty(obj, key, {
|
---|
| 34 | value: value,
|
---|
| 35 | enumerable: true,
|
---|
| 36 | configurable: true,
|
---|
| 37 | writable: true
|
---|
| 38 | });
|
---|
| 39 | } else {
|
---|
| 40 | obj[key] = value;
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | return obj;
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | function _objectSpread(target) {
|
---|
| 47 | for (var i = 1; i < arguments.length; i++) {
|
---|
| 48 | var source = arguments[i] != null ? arguments[i] : {};
|
---|
| 49 | var ownKeys = Object.keys(source);
|
---|
| 50 |
|
---|
| 51 | if (typeof Object.getOwnPropertySymbols === 'function') {
|
---|
| 52 | ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
---|
| 53 | return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
---|
| 54 | }));
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | ownKeys.forEach(function (key) {
|
---|
| 58 | _defineProperty(target, key, source[key]);
|
---|
| 59 | });
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | return target;
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | function _inheritsLoose(subClass, superClass) {
|
---|
| 66 | subClass.prototype = Object.create(superClass.prototype);
|
---|
| 67 | subClass.prototype.constructor = subClass;
|
---|
| 68 | subClass.__proto__ = superClass;
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | /**
|
---|
| 72 | * --------------------------------------------------------------------------
|
---|
| 73 | * Bootstrap (v4.3.1): util.js
|
---|
| 74 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
---|
| 75 | * --------------------------------------------------------------------------
|
---|
| 76 | */
|
---|
| 77 | /**
|
---|
| 78 | * ------------------------------------------------------------------------
|
---|
| 79 | * Private TransitionEnd Helpers
|
---|
| 80 | * ------------------------------------------------------------------------
|
---|
| 81 | */
|
---|
| 82 |
|
---|
| 83 | var TRANSITION_END = 'transitionend';
|
---|
| 84 | var MAX_UID = 1000000;
|
---|
| 85 | var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
---|
| 86 |
|
---|
| 87 | function toType(obj) {
|
---|
| 88 | return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | function getSpecialTransitionEndEvent() {
|
---|
| 92 | return {
|
---|
| 93 | bindType: TRANSITION_END,
|
---|
| 94 | delegateType: TRANSITION_END,
|
---|
| 95 | handle: function handle(event) {
|
---|
| 96 | if ($(event.target).is(this)) {
|
---|
| 97 | return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
|
---|
| 98 | }
|
---|
| 99 |
|
---|
| 100 | return undefined; // eslint-disable-line no-undefined
|
---|
| 101 | }
|
---|
| 102 | };
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | function transitionEndEmulator(duration) {
|
---|
| 106 | var _this = this;
|
---|
| 107 |
|
---|
| 108 | var called = false;
|
---|
| 109 | $(this).one(Util.TRANSITION_END, function () {
|
---|
| 110 | called = true;
|
---|
| 111 | });
|
---|
| 112 | setTimeout(function () {
|
---|
| 113 | if (!called) {
|
---|
| 114 | Util.triggerTransitionEnd(_this);
|
---|
| 115 | }
|
---|
| 116 | }, duration);
|
---|
| 117 | return this;
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | function setTransitionEndSupport() {
|
---|
| 121 | $.fn.emulateTransitionEnd = transitionEndEmulator;
|
---|
| 122 | $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
|
---|
| 123 | }
|
---|
| 124 | /**
|
---|
| 125 | * --------------------------------------------------------------------------
|
---|
| 126 | * Public Util Api
|
---|
| 127 | * --------------------------------------------------------------------------
|
---|
| 128 | */
|
---|
| 129 |
|
---|
| 130 |
|
---|
| 131 | var Util = {
|
---|
| 132 | TRANSITION_END: 'bsTransitionEnd',
|
---|
| 133 | getUID: function getUID(prefix) {
|
---|
| 134 | do {
|
---|
| 135 | // eslint-disable-next-line no-bitwise
|
---|
| 136 | prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
|
---|
| 137 | } while (document.getElementById(prefix));
|
---|
| 138 |
|
---|
| 139 | return prefix;
|
---|
| 140 | },
|
---|
| 141 | getSelectorFromElement: function getSelectorFromElement(element) {
|
---|
| 142 | var selector = element.getAttribute('data-target');
|
---|
| 143 |
|
---|
| 144 | if (!selector || selector === '#') {
|
---|
| 145 | var hrefAttr = element.getAttribute('href');
|
---|
| 146 | selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
|
---|
| 147 | }
|
---|
| 148 |
|
---|
| 149 | try {
|
---|
| 150 | return document.querySelector(selector) ? selector : null;
|
---|
| 151 | } catch (err) {
|
---|
| 152 | return null;
|
---|
| 153 | }
|
---|
| 154 | },
|
---|
| 155 | getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
|
---|
| 156 | if (!element) {
|
---|
| 157 | return 0;
|
---|
| 158 | } // Get transition-duration of the element
|
---|
| 159 |
|
---|
| 160 |
|
---|
| 161 | var transitionDuration = $(element).css('transition-duration');
|
---|
| 162 | var transitionDelay = $(element).css('transition-delay');
|
---|
| 163 | var floatTransitionDuration = parseFloat(transitionDuration);
|
---|
| 164 | var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
|
---|
| 165 |
|
---|
| 166 | if (!floatTransitionDuration && !floatTransitionDelay) {
|
---|
| 167 | return 0;
|
---|
| 168 | } // If multiple durations are defined, take the first
|
---|
| 169 |
|
---|
| 170 |
|
---|
| 171 | transitionDuration = transitionDuration.split(',')[0];
|
---|
| 172 | transitionDelay = transitionDelay.split(',')[0];
|
---|
| 173 | return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
---|
| 174 | },
|
---|
| 175 | reflow: function reflow(element) {
|
---|
| 176 | return element.offsetHeight;
|
---|
| 177 | },
|
---|
| 178 | triggerTransitionEnd: function triggerTransitionEnd(element) {
|
---|
| 179 | $(element).trigger(TRANSITION_END);
|
---|
| 180 | },
|
---|
| 181 | // TODO: Remove in v5
|
---|
| 182 | supportsTransitionEnd: function supportsTransitionEnd() {
|
---|
| 183 | return Boolean(TRANSITION_END);
|
---|
| 184 | },
|
---|
| 185 | isElement: function isElement(obj) {
|
---|
| 186 | return (obj[0] || obj).nodeType;
|
---|
| 187 | },
|
---|
| 188 | typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
|
---|
| 189 | for (var property in configTypes) {
|
---|
| 190 | if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
|
---|
| 191 | var expectedTypes = configTypes[property];
|
---|
| 192 | var value = config[property];
|
---|
| 193 | var valueType = value && Util.isElement(value) ? 'element' : toType(value);
|
---|
| 194 |
|
---|
| 195 | if (!new RegExp(expectedTypes).test(valueType)) {
|
---|
| 196 | throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
|
---|
| 197 | }
|
---|
| 198 | }
|
---|
| 199 | }
|
---|
| 200 | },
|
---|
| 201 | findShadowRoot: function findShadowRoot(element) {
|
---|
| 202 | if (!document.documentElement.attachShadow) {
|
---|
| 203 | return null;
|
---|
| 204 | } // Can find the shadow root otherwise it'll return the document
|
---|
| 205 |
|
---|
| 206 |
|
---|
| 207 | if (typeof element.getRootNode === 'function') {
|
---|
| 208 | var root = element.getRootNode();
|
---|
| 209 | return root instanceof ShadowRoot ? root : null;
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 | if (element instanceof ShadowRoot) {
|
---|
| 213 | return element;
|
---|
| 214 | } // when we don't find a shadow root
|
---|
| 215 |
|
---|
| 216 |
|
---|
| 217 | if (!element.parentNode) {
|
---|
| 218 | return null;
|
---|
| 219 | }
|
---|
| 220 |
|
---|
| 221 | return Util.findShadowRoot(element.parentNode);
|
---|
| 222 | }
|
---|
| 223 | };
|
---|
| 224 | setTransitionEndSupport();
|
---|
| 225 |
|
---|
| 226 | /**
|
---|
| 227 | * ------------------------------------------------------------------------
|
---|
| 228 | * Constants
|
---|
| 229 | * ------------------------------------------------------------------------
|
---|
| 230 | */
|
---|
| 231 |
|
---|
| 232 | var NAME = 'alert';
|
---|
| 233 | var VERSION = '4.3.1';
|
---|
| 234 | var DATA_KEY = 'bs.alert';
|
---|
| 235 | var EVENT_KEY = "." + DATA_KEY;
|
---|
| 236 | var DATA_API_KEY = '.data-api';
|
---|
| 237 | var JQUERY_NO_CONFLICT = $.fn[NAME];
|
---|
| 238 | var Selector = {
|
---|
| 239 | DISMISS: '[data-dismiss="alert"]'
|
---|
| 240 | };
|
---|
| 241 | var Event = {
|
---|
| 242 | CLOSE: "close" + EVENT_KEY,
|
---|
| 243 | CLOSED: "closed" + EVENT_KEY,
|
---|
| 244 | CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
|
---|
| 245 | };
|
---|
| 246 | var ClassName = {
|
---|
| 247 | ALERT: 'alert',
|
---|
| 248 | FADE: 'fade',
|
---|
| 249 | SHOW: 'show'
|
---|
| 250 | /**
|
---|
| 251 | * ------------------------------------------------------------------------
|
---|
| 252 | * Class Definition
|
---|
| 253 | * ------------------------------------------------------------------------
|
---|
| 254 | */
|
---|
| 255 |
|
---|
| 256 | };
|
---|
| 257 |
|
---|
| 258 | var Alert =
|
---|
| 259 | /*#__PURE__*/
|
---|
| 260 | function () {
|
---|
| 261 | function Alert(element) {
|
---|
| 262 | this._element = element;
|
---|
| 263 | } // Getters
|
---|
| 264 |
|
---|
| 265 |
|
---|
| 266 | var _proto = Alert.prototype;
|
---|
| 267 |
|
---|
| 268 | // Public
|
---|
| 269 | _proto.close = function close(element) {
|
---|
| 270 | var rootElement = this._element;
|
---|
| 271 |
|
---|
| 272 | if (element) {
|
---|
| 273 | rootElement = this._getRootElement(element);
|
---|
| 274 | }
|
---|
| 275 |
|
---|
| 276 | var customEvent = this._triggerCloseEvent(rootElement);
|
---|
| 277 |
|
---|
| 278 | if (customEvent.isDefaultPrevented()) {
|
---|
| 279 | return;
|
---|
| 280 | }
|
---|
| 281 |
|
---|
| 282 | this._removeElement(rootElement);
|
---|
| 283 | };
|
---|
| 284 |
|
---|
| 285 | _proto.dispose = function dispose() {
|
---|
| 286 | $.removeData(this._element, DATA_KEY);
|
---|
| 287 | this._element = null;
|
---|
| 288 | } // Private
|
---|
| 289 | ;
|
---|
| 290 |
|
---|
| 291 | _proto._getRootElement = function _getRootElement(element) {
|
---|
| 292 | var selector = Util.getSelectorFromElement(element);
|
---|
| 293 | var parent = false;
|
---|
| 294 |
|
---|
| 295 | if (selector) {
|
---|
| 296 | parent = document.querySelector(selector);
|
---|
| 297 | }
|
---|
| 298 |
|
---|
| 299 | if (!parent) {
|
---|
| 300 | parent = $(element).closest("." + ClassName.ALERT)[0];
|
---|
| 301 | }
|
---|
| 302 |
|
---|
| 303 | return parent;
|
---|
| 304 | };
|
---|
| 305 |
|
---|
| 306 | _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
|
---|
| 307 | var closeEvent = $.Event(Event.CLOSE);
|
---|
| 308 | $(element).trigger(closeEvent);
|
---|
| 309 | return closeEvent;
|
---|
| 310 | };
|
---|
| 311 |
|
---|
| 312 | _proto._removeElement = function _removeElement(element) {
|
---|
| 313 | var _this = this;
|
---|
| 314 |
|
---|
| 315 | $(element).removeClass(ClassName.SHOW);
|
---|
| 316 |
|
---|
| 317 | if (!$(element).hasClass(ClassName.FADE)) {
|
---|
| 318 | this._destroyElement(element);
|
---|
| 319 |
|
---|
| 320 | return;
|
---|
| 321 | }
|
---|
| 322 |
|
---|
| 323 | var transitionDuration = Util.getTransitionDurationFromElement(element);
|
---|
| 324 | $(element).one(Util.TRANSITION_END, function (event) {
|
---|
| 325 | return _this._destroyElement(element, event);
|
---|
| 326 | }).emulateTransitionEnd(transitionDuration);
|
---|
| 327 | };
|
---|
| 328 |
|
---|
| 329 | _proto._destroyElement = function _destroyElement(element) {
|
---|
| 330 | $(element).detach().trigger(Event.CLOSED).remove();
|
---|
| 331 | } // Static
|
---|
| 332 | ;
|
---|
| 333 |
|
---|
| 334 | Alert._jQueryInterface = function _jQueryInterface(config) {
|
---|
| 335 | return this.each(function () {
|
---|
| 336 | var $element = $(this);
|
---|
| 337 | var data = $element.data(DATA_KEY);
|
---|
| 338 |
|
---|
| 339 | if (!data) {
|
---|
| 340 | data = new Alert(this);
|
---|
| 341 | $element.data(DATA_KEY, data);
|
---|
| 342 | }
|
---|
| 343 |
|
---|
| 344 | if (config === 'close') {
|
---|
| 345 | data[config](this);
|
---|
| 346 | }
|
---|
| 347 | });
|
---|
| 348 | };
|
---|
| 349 |
|
---|
| 350 | Alert._handleDismiss = function _handleDismiss(alertInstance) {
|
---|
| 351 | return function (event) {
|
---|
| 352 | if (event) {
|
---|
| 353 | event.preventDefault();
|
---|
| 354 | }
|
---|
| 355 |
|
---|
| 356 | alertInstance.close(this);
|
---|
| 357 | };
|
---|
| 358 | };
|
---|
| 359 |
|
---|
| 360 | _createClass(Alert, null, [{
|
---|
| 361 | key: "VERSION",
|
---|
| 362 | get: function get() {
|
---|
| 363 | return VERSION;
|
---|
| 364 | }
|
---|
| 365 | }]);
|
---|
| 366 |
|
---|
| 367 | return Alert;
|
---|
| 368 | }();
|
---|
| 369 | /**
|
---|
| 370 | * ------------------------------------------------------------------------
|
---|
| 371 | * Data Api implementation
|
---|
| 372 | * ------------------------------------------------------------------------
|
---|
| 373 | */
|
---|
| 374 |
|
---|
| 375 |
|
---|
| 376 | $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
|
---|
| 377 | /**
|
---|
| 378 | * ------------------------------------------------------------------------
|
---|
| 379 | * jQuery
|
---|
| 380 | * ------------------------------------------------------------------------
|
---|
| 381 | */
|
---|
| 382 |
|
---|
| 383 | $.fn[NAME] = Alert._jQueryInterface;
|
---|
| 384 | $.fn[NAME].Constructor = Alert;
|
---|
| 385 |
|
---|
| 386 | $.fn[NAME].noConflict = function () {
|
---|
| 387 | $.fn[NAME] = JQUERY_NO_CONFLICT;
|
---|
| 388 | return Alert._jQueryInterface;
|
---|
| 389 | };
|
---|
| 390 |
|
---|
| 391 | /**
|
---|
| 392 | * ------------------------------------------------------------------------
|
---|
| 393 | * Constants
|
---|
| 394 | * ------------------------------------------------------------------------
|
---|
| 395 | */
|
---|
| 396 |
|
---|
| 397 | var NAME$1 = 'button';
|
---|
| 398 | var VERSION$1 = '4.3.1';
|
---|
| 399 | var DATA_KEY$1 = 'bs.button';
|
---|
| 400 | var EVENT_KEY$1 = "." + DATA_KEY$1;
|
---|
| 401 | var DATA_API_KEY$1 = '.data-api';
|
---|
| 402 | var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
|
---|
| 403 | var ClassName$1 = {
|
---|
| 404 | ACTIVE: 'active',
|
---|
| 405 | BUTTON: 'btn',
|
---|
| 406 | FOCUS: 'focus'
|
---|
| 407 | };
|
---|
| 408 | var Selector$1 = {
|
---|
| 409 | DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
|
---|
| 410 | DATA_TOGGLE: '[data-toggle="buttons"]',
|
---|
| 411 | INPUT: 'input:not([type="hidden"])',
|
---|
| 412 | ACTIVE: '.active',
|
---|
| 413 | BUTTON: '.btn'
|
---|
| 414 | };
|
---|
| 415 | var Event$1 = {
|
---|
| 416 | CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
|
---|
| 417 | FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1)
|
---|
| 418 | /**
|
---|
| 419 | * ------------------------------------------------------------------------
|
---|
| 420 | * Class Definition
|
---|
| 421 | * ------------------------------------------------------------------------
|
---|
| 422 | */
|
---|
| 423 |
|
---|
| 424 | };
|
---|
| 425 |
|
---|
| 426 | var Button =
|
---|
| 427 | /*#__PURE__*/
|
---|
| 428 | function () {
|
---|
| 429 | function Button(element) {
|
---|
| 430 | this._element = element;
|
---|
| 431 | } // Getters
|
---|
| 432 |
|
---|
| 433 |
|
---|
| 434 | var _proto = Button.prototype;
|
---|
| 435 |
|
---|
| 436 | // Public
|
---|
| 437 | _proto.toggle = function toggle() {
|
---|
| 438 | var triggerChangeEvent = true;
|
---|
| 439 | var addAriaPressed = true;
|
---|
| 440 | var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLE)[0];
|
---|
| 441 |
|
---|
| 442 | if (rootElement) {
|
---|
| 443 | var input = this._element.querySelector(Selector$1.INPUT);
|
---|
| 444 |
|
---|
| 445 | if (input) {
|
---|
| 446 | if (input.type === 'radio') {
|
---|
| 447 | if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
|
---|
| 448 | triggerChangeEvent = false;
|
---|
| 449 | } else {
|
---|
| 450 | var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
|
---|
| 451 |
|
---|
| 452 | if (activeElement) {
|
---|
| 453 | $(activeElement).removeClass(ClassName$1.ACTIVE);
|
---|
| 454 | }
|
---|
| 455 | }
|
---|
| 456 | }
|
---|
| 457 |
|
---|
| 458 | if (triggerChangeEvent) {
|
---|
| 459 | if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) {
|
---|
| 460 | return;
|
---|
| 461 | }
|
---|
| 462 |
|
---|
| 463 | input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
|
---|
| 464 | $(input).trigger('change');
|
---|
| 465 | }
|
---|
| 466 |
|
---|
| 467 | input.focus();
|
---|
| 468 | addAriaPressed = false;
|
---|
| 469 | }
|
---|
| 470 | }
|
---|
| 471 |
|
---|
| 472 | if (addAriaPressed) {
|
---|
| 473 | this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
|
---|
| 474 | }
|
---|
| 475 |
|
---|
| 476 | if (triggerChangeEvent) {
|
---|
| 477 | $(this._element).toggleClass(ClassName$1.ACTIVE);
|
---|
| 478 | }
|
---|
| 479 | };
|
---|
| 480 |
|
---|
| 481 | _proto.dispose = function dispose() {
|
---|
| 482 | $.removeData(this._element, DATA_KEY$1);
|
---|
| 483 | this._element = null;
|
---|
| 484 | } // Static
|
---|
| 485 | ;
|
---|
| 486 |
|
---|
| 487 | Button._jQueryInterface = function _jQueryInterface(config) {
|
---|
| 488 | return this.each(function () {
|
---|
| 489 | var data = $(this).data(DATA_KEY$1);
|
---|
| 490 |
|
---|
| 491 | if (!data) {
|
---|
| 492 | data = new Button(this);
|
---|
| 493 | $(this).data(DATA_KEY$1, data);
|
---|
| 494 | }
|
---|
| 495 |
|
---|
| 496 | if (config === 'toggle') {
|
---|
| 497 | data[config]();
|
---|
| 498 | }
|
---|
| 499 | });
|
---|
| 500 | };
|
---|
| 501 |
|
---|
| 502 | _createClass(Button, null, [{
|
---|
| 503 | key: "VERSION",
|
---|
| 504 | get: function get() {
|
---|
| 505 | return VERSION$1;
|
---|
| 506 | }
|
---|
| 507 | }]);
|
---|
| 508 |
|
---|
| 509 | return Button;
|
---|
| 510 | }();
|
---|
| 511 | /**
|
---|
| 512 | * ------------------------------------------------------------------------
|
---|
| 513 | * Data Api implementation
|
---|
| 514 | * ------------------------------------------------------------------------
|
---|
| 515 | */
|
---|
| 516 |
|
---|
| 517 |
|
---|
| 518 | $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
|
---|
| 519 | event.preventDefault();
|
---|
| 520 | var button = event.target;
|
---|
| 521 |
|
---|
| 522 | if (!$(button).hasClass(ClassName$1.BUTTON)) {
|
---|
| 523 | button = $(button).closest(Selector$1.BUTTON);
|
---|
| 524 | }
|
---|
| 525 |
|
---|
| 526 | Button._jQueryInterface.call($(button), 'toggle');
|
---|
| 527 | }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
|
---|
| 528 | var button = $(event.target).closest(Selector$1.BUTTON)[0];
|
---|
| 529 | $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
|
---|
| 530 | });
|
---|
| 531 | /**
|
---|
| 532 | * ------------------------------------------------------------------------
|
---|
| 533 | * jQuery
|
---|
| 534 | * ------------------------------------------------------------------------
|
---|
| 535 | */
|
---|
| 536 |
|
---|
| 537 | $.fn[NAME$1] = Button._jQueryInterface;
|
---|
| 538 | $.fn[NAME$1].Constructor = Button;
|
---|
| 539 |
|
---|
| 540 | $.fn[NAME$1].noConflict = function () {
|
---|
| 541 | $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
|
---|
| 542 | return Button._jQueryInterface;
|
---|
| 543 | };
|
---|
| 544 |
|
---|
| 545 | /**
|
---|
| 546 | * ------------------------------------------------------------------------
|
---|
| 547 | * Constants
|
---|
| 548 | * ------------------------------------------------------------------------
|
---|
| 549 | */
|
---|
| 550 |
|
---|
| 551 | var NAME$2 = 'carousel';
|
---|
| 552 | var VERSION$2 = '4.3.1';
|
---|
| 553 | var DATA_KEY$2 = 'bs.carousel';
|
---|
| 554 | var EVENT_KEY$2 = "." + DATA_KEY$2;
|
---|
| 555 | var DATA_API_KEY$2 = '.data-api';
|
---|
| 556 | var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
|
---|
| 557 | var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
|
---|
| 558 |
|
---|
| 559 | var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
|
---|
| 560 |
|
---|
| 561 | var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
|
---|
| 562 |
|
---|
| 563 | var SWIPE_THRESHOLD = 40;
|
---|
| 564 | var Default = {
|
---|
| 565 | interval: 5000,
|
---|
| 566 | keyboard: true,
|
---|
| 567 | slide: false,
|
---|
| 568 | pause: 'hover',
|
---|
| 569 | wrap: true,
|
---|
| 570 | touch: true
|
---|
| 571 | };
|
---|
| 572 | var DefaultType = {
|
---|
| 573 | interval: '(number|boolean)',
|
---|
| 574 | keyboard: 'boolean',
|
---|
| 575 | slide: '(boolean|string)',
|
---|
| 576 | pause: '(string|boolean)',
|
---|
| 577 | wrap: 'boolean',
|
---|
| 578 | touch: 'boolean'
|
---|
| 579 | };
|
---|
| 580 | var Direction = {
|
---|
| 581 | NEXT: 'next',
|
---|
| 582 | PREV: 'prev',
|
---|
| 583 | LEFT: 'left',
|
---|
| 584 | RIGHT: 'right'
|
---|
| 585 | };
|
---|
| 586 | var Event$2 = {
|
---|
| 587 | SLIDE: "slide" + EVENT_KEY$2,
|
---|
| 588 | SLID: "slid" + EVENT_KEY$2,
|
---|
| 589 | KEYDOWN: "keydown" + EVENT_KEY$2,
|
---|
| 590 | MOUSEENTER: "mouseenter" + EVENT_KEY$2,
|
---|
| 591 | MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
|
---|
| 592 | TOUCHSTART: "touchstart" + EVENT_KEY$2,
|
---|
| 593 | TOUCHMOVE: "touchmove" + EVENT_KEY$2,
|
---|
| 594 | TOUCHEND: "touchend" + EVENT_KEY$2,
|
---|
| 595 | POINTERDOWN: "pointerdown" + EVENT_KEY$2,
|
---|
| 596 | POINTERUP: "pointerup" + EVENT_KEY$2,
|
---|
| 597 | DRAG_START: "dragstart" + EVENT_KEY$2,
|
---|
| 598 | LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
|
---|
| 599 | CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
|
---|
| 600 | };
|
---|
| 601 | var ClassName$2 = {
|
---|
| 602 | CAROUSEL: 'carousel',
|
---|
| 603 | ACTIVE: 'active',
|
---|
| 604 | SLIDE: 'slide',
|
---|
| 605 | RIGHT: 'carousel-item-right',
|
---|
| 606 | LEFT: 'carousel-item-left',
|
---|
| 607 | NEXT: 'carousel-item-next',
|
---|
| 608 | PREV: 'carousel-item-prev',
|
---|
| 609 | ITEM: 'carousel-item',
|
---|
| 610 | POINTER_EVENT: 'pointer-event'
|
---|
| 611 | };
|
---|
| 612 | var Selector$2 = {
|
---|
| 613 | ACTIVE: '.active',
|
---|
| 614 | ACTIVE_ITEM: '.active.carousel-item',
|
---|
| 615 | ITEM: '.carousel-item',
|
---|
| 616 | ITEM_IMG: '.carousel-item img',
|
---|
| 617 | NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
|
---|
| 618 | INDICATORS: '.carousel-indicators',
|
---|
| 619 | DATA_SLIDE: '[data-slide], [data-slide-to]',
|
---|
| 620 | DATA_RIDE: '[data-ride="carousel"]'
|
---|
| 621 | };
|
---|
| 622 | var PointerType = {
|
---|
| 623 | TOUCH: 'touch',
|
---|
| 624 | PEN: 'pen'
|
---|
| 625 | /**
|
---|
| 626 | * ------------------------------------------------------------------------
|
---|
| 627 | * Class Definition
|
---|
| 628 | * ------------------------------------------------------------------------
|
---|
| 629 | */
|
---|
| 630 |
|
---|
| 631 | };
|
---|
| 632 |
|
---|
| 633 | var Carousel =
|
---|
| 634 | /*#__PURE__*/
|
---|
| 635 | function () {
|
---|
| 636 | function Carousel(element, config) {
|
---|
| 637 | this._items = null;
|
---|
| 638 | this._interval = null;
|
---|
| 639 | this._activeElement = null;
|
---|
| 640 | this._isPaused = false;
|
---|
| 641 | this._isSliding = false;
|
---|
| 642 | this.touchTimeout = null;
|
---|
| 643 | this.touchStartX = 0;
|
---|
| 644 | this.touchDeltaX = 0;
|
---|
| 645 | this._config = this._getConfig(config);
|
---|
| 646 | this._element = element;
|
---|
| 647 | this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
|
---|
| 648 | this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
|
---|
| 649 | this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
|
---|
| 650 |
|
---|
| 651 | this._addEventListeners();
|
---|
| 652 | } // Getters
|
---|
| 653 |
|
---|
| 654 |
|
---|
| 655 | var _proto = Carousel.prototype;
|
---|
| 656 |
|
---|
| 657 | // Public
|
---|
| 658 | _proto.next = function next() {
|
---|
| 659 | if (!this._isSliding) {
|
---|
| 660 | this._slide(Direction.NEXT);
|
---|
| 661 | }
|
---|
| 662 | };
|
---|
| 663 |
|
---|
| 664 | _proto.nextWhenVisible = function nextWhenVisible() {
|
---|
| 665 | // Don't call next when the page isn't visible
|
---|
| 666 | // or the carousel or its parent isn't visible
|
---|
| 667 | if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
|
---|
| 668 | this.next();
|
---|
| 669 | }
|
---|
| 670 | };
|
---|
| 671 |
|
---|
| 672 | _proto.prev = function prev() {
|
---|
| 673 | if (!this._isSliding) {
|
---|
| 674 | this._slide(Direction.PREV);
|
---|
| 675 | }
|
---|
| 676 | };
|
---|
| 677 |
|
---|
| 678 | _proto.pause = function pause(event) {
|
---|
| 679 | if (!event) {
|
---|
| 680 | this._isPaused = true;
|
---|
| 681 | }
|
---|
| 682 |
|
---|
| 683 | if (this._element.querySelector(Selector$2.NEXT_PREV)) {
|
---|
| 684 | Util.triggerTransitionEnd(this._element);
|
---|
| 685 | this.cycle(true);
|
---|
| 686 | }
|
---|
| 687 |
|
---|
| 688 | clearInterval(this._interval);
|
---|
| 689 | this._interval = null;
|
---|
| 690 | };
|
---|
| 691 |
|
---|
| 692 | _proto.cycle = function cycle(event) {
|
---|
| 693 | if (!event) {
|
---|
| 694 | this._isPaused = false;
|
---|
| 695 | }
|
---|
| 696 |
|
---|
| 697 | if (this._interval) {
|
---|
| 698 | clearInterval(this._interval);
|
---|
| 699 | this._interval = null;
|
---|
| 700 | }
|
---|
| 701 |
|
---|
| 702 | if (this._config.interval && !this._isPaused) {
|
---|
| 703 | this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
|
---|
| 704 | }
|
---|
| 705 | };
|
---|
| 706 |
|
---|
| 707 | _proto.to = function to(index) {
|
---|
| 708 | var _this = this;
|
---|
| 709 |
|
---|
| 710 | this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
|
---|
| 711 |
|
---|
| 712 | var activeIndex = this._getItemIndex(this._activeElement);
|
---|
| 713 |
|
---|
| 714 | if (index > this._items.length - 1 || index < 0) {
|
---|
| 715 | return;
|
---|
| 716 | }
|
---|
| 717 |
|
---|
| 718 | if (this._isSliding) {
|
---|
| 719 | $(this._element).one(Event$2.SLID, function () {
|
---|
| 720 | return _this.to(index);
|
---|
| 721 | });
|
---|
| 722 | return;
|
---|
| 723 | }
|
---|
| 724 |
|
---|
| 725 | if (activeIndex === index) {
|
---|
| 726 | this.pause();
|
---|
| 727 | this.cycle();
|
---|
| 728 | return;
|
---|
| 729 | }
|
---|
| 730 |
|
---|
| 731 | var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
|
---|
| 732 |
|
---|
| 733 | this._slide(direction, this._items[index]);
|
---|
| 734 | };
|
---|
| 735 |
|
---|
| 736 | _proto.dispose = function dispose() {
|
---|
| 737 | $(this._element).off(EVENT_KEY$2);
|
---|
| 738 | $.removeData(this._element, DATA_KEY$2);
|
---|
| 739 | this._items = null;
|
---|
| 740 | this._config = null;
|
---|
| 741 | this._element = null;
|
---|
| 742 | this._interval = null;
|
---|
| 743 | this._isPaused = null;
|
---|
| 744 | this._isSliding = null;
|
---|
| 745 | this._activeElement = null;
|
---|
| 746 | this._indicatorsElement = null;
|
---|
| 747 | } // Private
|
---|
| 748 | ;
|
---|
| 749 |
|
---|
| 750 | _proto._getConfig = function _getConfig(config) {
|
---|
| 751 | config = _objectSpread({}, Default, config);
|
---|
| 752 | Util.typeCheckConfig(NAME$2, config, DefaultType);
|
---|
| 753 | return config;
|
---|
| 754 | };
|
---|
| 755 |
|
---|
| 756 | _proto._handleSwipe = function _handleSwipe() {
|
---|
| 757 | var absDeltax = Math.abs(this.touchDeltaX);
|
---|
| 758 |
|
---|
| 759 | if (absDeltax <= SWIPE_THRESHOLD) {
|
---|
| 760 | return;
|
---|
| 761 | }
|
---|
| 762 |
|
---|
| 763 | var direction = absDeltax / this.touchDeltaX; // swipe left
|
---|
| 764 |
|
---|
| 765 | if (direction > 0) {
|
---|
| 766 | this.prev();
|
---|
| 767 | } // swipe right
|
---|
| 768 |
|
---|
| 769 |
|
---|
| 770 | if (direction < 0) {
|
---|
| 771 | this.next();
|
---|
| 772 | }
|
---|
| 773 | };
|
---|
| 774 |
|
---|
| 775 | _proto._addEventListeners = function _addEventListeners() {
|
---|
| 776 | var _this2 = this;
|
---|
| 777 |
|
---|
| 778 | if (this._config.keyboard) {
|
---|
| 779 | $(this._element).on(Event$2.KEYDOWN, function (event) {
|
---|
| 780 | return _this2._keydown(event);
|
---|
| 781 | });
|
---|
| 782 | }
|
---|
| 783 |
|
---|
| 784 | if (this._config.pause === 'hover') {
|
---|
| 785 | $(this._element).on(Event$2.MOUSEENTER, function (event) {
|
---|
| 786 | return _this2.pause(event);
|
---|
| 787 | }).on(Event$2.MOUSELEAVE, function (event) {
|
---|
| 788 | return _this2.cycle(event);
|
---|
| 789 | });
|
---|
| 790 | }
|
---|
| 791 |
|
---|
| 792 | if (this._config.touch) {
|
---|
| 793 | this._addTouchEventListeners();
|
---|
| 794 | }
|
---|
| 795 | };
|
---|
| 796 |
|
---|
| 797 | _proto._addTouchEventListeners = function _addTouchEventListeners() {
|
---|
| 798 | var _this3 = this;
|
---|
| 799 |
|
---|
| 800 | if (!this._touchSupported) {
|
---|
| 801 | return;
|
---|
| 802 | }
|
---|
| 803 |
|
---|
| 804 | var start = function start(event) {
|
---|
| 805 | if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
|
---|
| 806 | _this3.touchStartX = event.originalEvent.clientX;
|
---|
| 807 | } else if (!_this3._pointerEvent) {
|
---|
| 808 | _this3.touchStartX = event.originalEvent.touches[0].clientX;
|
---|
| 809 | }
|
---|
| 810 | };
|
---|
| 811 |
|
---|
| 812 | var move = function move(event) {
|
---|
| 813 | // ensure swiping with one touch and not pinching
|
---|
| 814 | if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
|
---|
| 815 | _this3.touchDeltaX = 0;
|
---|
| 816 | } else {
|
---|
| 817 | _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
|
---|
| 818 | }
|
---|
| 819 | };
|
---|
| 820 |
|
---|
| 821 | var end = function end(event) {
|
---|
| 822 | if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
|
---|
| 823 | _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
|
---|
| 824 | }
|
---|
| 825 |
|
---|
| 826 | _this3._handleSwipe();
|
---|
| 827 |
|
---|
| 828 | if (_this3._config.pause === 'hover') {
|
---|
| 829 | // If it's a touch-enabled device, mouseenter/leave are fired as
|
---|
| 830 | // part of the mouse compatibility events on first tap - the carousel
|
---|
| 831 | // would stop cycling until user tapped out of it;
|
---|
| 832 | // here, we listen for touchend, explicitly pause the carousel
|
---|
| 833 | // (as if it's the second time we tap on it, mouseenter compat event
|
---|
| 834 | // is NOT fired) and after a timeout (to allow for mouse compatibility
|
---|
| 835 | // events to fire) we explicitly restart cycling
|
---|
| 836 | _this3.pause();
|
---|
| 837 |
|
---|
| 838 | if (_this3.touchTimeout) {
|
---|
| 839 | clearTimeout(_this3.touchTimeout);
|
---|
| 840 | }
|
---|
| 841 |
|
---|
| 842 | _this3.touchTimeout = setTimeout(function (event) {
|
---|
| 843 | return _this3.cycle(event);
|
---|
| 844 | }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
|
---|
| 845 | }
|
---|
| 846 | };
|
---|
| 847 |
|
---|
| 848 | $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
|
---|
| 849 | return e.preventDefault();
|
---|
| 850 | });
|
---|
| 851 |
|
---|
| 852 | if (this._pointerEvent) {
|
---|
| 853 | $(this._element).on(Event$2.POINTERDOWN, function (event) {
|
---|
| 854 | return start(event);
|
---|
| 855 | });
|
---|
| 856 | $(this._element).on(Event$2.POINTERUP, function (event) {
|
---|
| 857 | return end(event);
|
---|
| 858 | });
|
---|
| 859 |
|
---|
| 860 | this._element.classList.add(ClassName$2.POINTER_EVENT);
|
---|
| 861 | } else {
|
---|
| 862 | $(this._element).on(Event$2.TOUCHSTART, function (event) {
|
---|
| 863 | return start(event);
|
---|
| 864 | });
|
---|
| 865 | $(this._element).on(Event$2.TOUCHMOVE, function (event) {
|
---|
| 866 | return move(event);
|
---|
| 867 | });
|
---|
| 868 | $(this._element).on(Event$2.TOUCHEND, function (event) {
|
---|
| 869 | return end(event);
|
---|
| 870 | });
|
---|
| 871 | }
|
---|
| 872 | };
|
---|
| 873 |
|
---|
| 874 | _proto._keydown = function _keydown(event) {
|
---|
| 875 | if (/input|textarea/i.test(event.target.tagName)) {
|
---|
| 876 | return;
|
---|
| 877 | }
|
---|
| 878 |
|
---|
| 879 | switch (event.which) {
|
---|
| 880 | case ARROW_LEFT_KEYCODE:
|
---|
| 881 | event.preventDefault();
|
---|
| 882 | this.prev();
|
---|
| 883 | break;
|
---|
| 884 |
|
---|
| 885 | case ARROW_RIGHT_KEYCODE:
|
---|
| 886 | event.preventDefault();
|
---|
| 887 | this.next();
|
---|
| 888 | break;
|
---|
| 889 |
|
---|
| 890 | default:
|
---|
| 891 | }
|
---|
| 892 | };
|
---|
| 893 |
|
---|
| 894 | _proto._getItemIndex = function _getItemIndex(element) {
|
---|
| 895 | this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
|
---|
| 896 | return this._items.indexOf(element);
|
---|
| 897 | };
|
---|
| 898 |
|
---|
| 899 | _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
|
---|
| 900 | var isNextDirection = direction === Direction.NEXT;
|
---|
| 901 | var isPrevDirection = direction === Direction.PREV;
|
---|
| 902 |
|
---|
| 903 | var activeIndex = this._getItemIndex(activeElement);
|
---|
| 904 |
|
---|
| 905 | var lastItemIndex = this._items.length - 1;
|
---|
| 906 | var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
|
---|
| 907 |
|
---|
| 908 | if (isGoingToWrap && !this._config.wrap) {
|
---|
| 909 | return activeElement;
|
---|
| 910 | }
|
---|
| 911 |
|
---|
| 912 | var delta = direction === Direction.PREV ? -1 : 1;
|
---|
| 913 | var itemIndex = (activeIndex + delta) % this._items.length;
|
---|
| 914 | return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
|
---|
| 915 | };
|
---|
| 916 |
|
---|
| 917 | _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
|
---|
| 918 | var targetIndex = this._getItemIndex(relatedTarget);
|
---|
| 919 |
|
---|
| 920 | var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
|
---|
| 921 |
|
---|
| 922 | var slideEvent = $.Event(Event$2.SLIDE, {
|
---|
| 923 | relatedTarget: relatedTarget,
|
---|
| 924 | direction: eventDirectionName,
|
---|
| 925 | from: fromIndex,
|
---|
| 926 | to: targetIndex
|
---|
| 927 | });
|
---|
| 928 | $(this._element).trigger(slideEvent);
|
---|
| 929 | return slideEvent;
|
---|
| 930 | };
|
---|
| 931 |
|
---|
| 932 | _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
|
---|
| 933 | if (this._indicatorsElement) {
|
---|
| 934 | var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
|
---|
| 935 | $(indicators).removeClass(ClassName$2.ACTIVE);
|
---|
| 936 |
|
---|
| 937 | var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
|
---|
| 938 |
|
---|
| 939 | if (nextIndicator) {
|
---|
| 940 | $(nextIndicator).addClass(ClassName$2.ACTIVE);
|
---|
| 941 | }
|
---|
| 942 | }
|
---|
| 943 | };
|
---|
| 944 |
|
---|
| 945 | _proto._slide = function _slide(direction, element) {
|
---|
| 946 | var _this4 = this;
|
---|
| 947 |
|
---|
| 948 | var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
|
---|
| 949 |
|
---|
| 950 | var activeElementIndex = this._getItemIndex(activeElement);
|
---|
| 951 |
|
---|
| 952 | var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
|
---|
| 953 |
|
---|
| 954 | var nextElementIndex = this._getItemIndex(nextElement);
|
---|
| 955 |
|
---|
| 956 | var isCycling = Boolean(this._interval);
|
---|
| 957 | var directionalClassName;
|
---|
| 958 | var orderClassName;
|
---|
| 959 | var eventDirectionName;
|
---|
| 960 |
|
---|
| 961 | if (direction === Direction.NEXT) {
|
---|
| 962 | directionalClassName = ClassName$2.LEFT;
|
---|
| 963 | orderClassName = ClassName$2.NEXT;
|
---|
| 964 | eventDirectionName = Direction.LEFT;
|
---|
| 965 | } else {
|
---|
| 966 | directionalClassName = ClassName$2.RIGHT;
|
---|
| 967 | orderClassName = ClassName$2.PREV;
|
---|
| 968 | eventDirectionName = Direction.RIGHT;
|
---|
| 969 | }
|
---|
| 970 |
|
---|
| 971 | if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
|
---|
| 972 | this._isSliding = false;
|
---|
| 973 | return;
|
---|
| 974 | }
|
---|
| 975 |
|
---|
| 976 | var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
|
---|
| 977 |
|
---|
| 978 | if (slideEvent.isDefaultPrevented()) {
|
---|
| 979 | return;
|
---|
| 980 | }
|
---|
| 981 |
|
---|
| 982 | if (!activeElement || !nextElement) {
|
---|
| 983 | // Some weirdness is happening, so we bail
|
---|
| 984 | return;
|
---|
| 985 | }
|
---|
| 986 |
|
---|
| 987 | this._isSliding = true;
|
---|
| 988 |
|
---|
| 989 | if (isCycling) {
|
---|
| 990 | this.pause();
|
---|
| 991 | }
|
---|
| 992 |
|
---|
| 993 | this._setActiveIndicatorElement(nextElement);
|
---|
| 994 |
|
---|
| 995 | var slidEvent = $.Event(Event$2.SLID, {
|
---|
| 996 | relatedTarget: nextElement,
|
---|
| 997 | direction: eventDirectionName,
|
---|
| 998 | from: activeElementIndex,
|
---|
| 999 | to: nextElementIndex
|
---|
| 1000 | });
|
---|
| 1001 |
|
---|
| 1002 | if ($(this._element).hasClass(ClassName$2.SLIDE)) {
|
---|
| 1003 | $(nextElement).addClass(orderClassName);
|
---|
| 1004 | Util.reflow(nextElement);
|
---|
| 1005 | $(activeElement).addClass(directionalClassName);
|
---|
| 1006 | $(nextElement).addClass(directionalClassName);
|
---|
| 1007 | var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
|
---|
| 1008 |
|
---|
| 1009 | if (nextElementInterval) {
|
---|
| 1010 | this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
|
---|
| 1011 | this._config.interval = nextElementInterval;
|
---|
| 1012 | } else {
|
---|
| 1013 | this._config.interval = this._config.defaultInterval || this._config.interval;
|
---|
| 1014 | }
|
---|
| 1015 |
|
---|
| 1016 | var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
|
---|
| 1017 | $(activeElement).one(Util.TRANSITION_END, function () {
|
---|
| 1018 | $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
|
---|
| 1019 | $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
|
---|
| 1020 | _this4._isSliding = false;
|
---|
| 1021 | setTimeout(function () {
|
---|
| 1022 | return $(_this4._element).trigger(slidEvent);
|
---|
| 1023 | }, 0);
|
---|
| 1024 | }).emulateTransitionEnd(transitionDuration);
|
---|
| 1025 | } else {
|
---|
| 1026 | $(activeElement).removeClass(ClassName$2.ACTIVE);
|
---|
| 1027 | $(nextElement).addClass(ClassName$2.ACTIVE);
|
---|
| 1028 | this._isSliding = false;
|
---|
| 1029 | $(this._element).trigger(slidEvent);
|
---|
| 1030 | }
|
---|
| 1031 |
|
---|
| 1032 | if (isCycling) {
|
---|
| 1033 | this.cycle();
|
---|
| 1034 | }
|
---|
| 1035 | } // Static
|
---|
| 1036 | ;
|
---|
| 1037 |
|
---|
| 1038 | Carousel._jQueryInterface = function _jQueryInterface(config) {
|
---|
| 1039 | return this.each(function () {
|
---|
| 1040 | var data = $(this).data(DATA_KEY$2);
|
---|
| 1041 |
|
---|
| 1042 | var _config = _objectSpread({}, Default, $(this).data());
|
---|
| 1043 |
|
---|
| 1044 | if (typeof config === 'object') {
|
---|
| 1045 | _config = _objectSpread({}, _config, config);
|
---|
| 1046 | }
|
---|
| 1047 |
|
---|
| 1048 | var action = typeof config === 'string' ? config : _config.slide;
|
---|
| 1049 |
|
---|
| 1050 | if (!data) {
|
---|
| 1051 | data = new Carousel(this, _config);
|
---|
| 1052 | $(this).data(DATA_KEY$2, data);
|
---|
| 1053 | }
|
---|
| 1054 |
|
---|
| 1055 | if (typeof config === 'number') {
|
---|
| 1056 | data.to(config);
|
---|
| 1057 | } else if (typeof action === 'string') {
|
---|
| 1058 | if (typeof data[action] === 'undefined') {
|
---|
| 1059 | throw new TypeError("No method named \"" + action + "\"");
|
---|
| 1060 | }
|
---|
| 1061 |
|
---|
| 1062 | data[action]();
|
---|
| 1063 | } else if (_config.interval && _config.ride) {
|
---|
| 1064 | data.pause();
|
---|
| 1065 | data.cycle();
|
---|
| 1066 | }
|
---|
| 1067 | });
|
---|
| 1068 | };
|
---|
| 1069 |
|
---|
| 1070 | Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
|
---|
| 1071 | var selector = Util.getSelectorFromElement(this);
|
---|
| 1072 |
|
---|
| 1073 | if (!selector) {
|
---|
| 1074 | return;
|
---|
| 1075 | }
|
---|
| 1076 |
|
---|
| 1077 | var target = $(selector)[0];
|
---|
| 1078 |
|
---|
| 1079 | if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
|
---|
| 1080 | return;
|
---|
| 1081 | }
|
---|
| 1082 |
|
---|
| 1083 | var config = _objectSpread({}, $(target).data(), $(this).data());
|
---|
| 1084 |
|
---|
| 1085 | var slideIndex = this.getAttribute('data-slide-to');
|
---|
| 1086 |
|
---|
| 1087 | if (slideIndex) {
|
---|
| 1088 | config.interval = false;
|
---|
| 1089 | }
|
---|
| 1090 |
|
---|
| 1091 | Carousel._jQueryInterface.call($(target), config);
|
---|
| 1092 |
|
---|
| 1093 | if (slideIndex) {
|
---|
| 1094 | $(target).data(DATA_KEY$2).to(slideIndex);
|
---|
| 1095 | }
|
---|
| 1096 |
|
---|
| 1097 | event.preventDefault();
|
---|
| 1098 | };
|
---|
| 1099 |
|
---|
| 1100 | _createClass(Carousel, null, [{
|
---|
| 1101 | key: "VERSION",
|
---|
| 1102 | get: function get() {
|
---|
| 1103 | return VERSION$2;
|
---|
| 1104 | }
|
---|
| 1105 | }, {
|
---|
| 1106 | key: "Default",
|
---|
| 1107 | get: function get() {
|
---|
| 1108 | return Default;
|
---|
| 1109 | }
|
---|
| 1110 | }]);
|
---|
| 1111 |
|
---|
| 1112 | return Carousel;
|
---|
| 1113 | }();
|
---|
| 1114 | /**
|
---|
| 1115 | * ------------------------------------------------------------------------
|
---|
| 1116 | * Data Api implementation
|
---|
| 1117 | * ------------------------------------------------------------------------
|
---|
| 1118 | */
|
---|
| 1119 |
|
---|
| 1120 |
|
---|
| 1121 | $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
|
---|
| 1122 | $(window).on(Event$2.LOAD_DATA_API, function () {
|
---|
| 1123 | var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
|
---|
| 1124 |
|
---|
| 1125 | for (var i = 0, len = carousels.length; i < len; i++) {
|
---|
| 1126 | var $carousel = $(carousels[i]);
|
---|
| 1127 |
|
---|
| 1128 | Carousel._jQueryInterface.call($carousel, $carousel.data());
|
---|
| 1129 | }
|
---|
| 1130 | });
|
---|
| 1131 | /**
|
---|
| 1132 | * ------------------------------------------------------------------------
|
---|
| 1133 | * jQuery
|
---|
| 1134 | * ------------------------------------------------------------------------
|
---|
| 1135 | */
|
---|
| 1136 |
|
---|
| 1137 | $.fn[NAME$2] = Carousel._jQueryInterface;
|
---|
| 1138 | $.fn[NAME$2].Constructor = Carousel;
|
---|
| 1139 |
|
---|
| 1140 | $.fn[NAME$2].noConflict = function () {
|
---|
| 1141 | $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
|
---|
| 1142 | return Carousel._jQueryInterface;
|
---|
| 1143 | };
|
---|
| 1144 |
|
---|
| 1145 | /**
|
---|
| 1146 | * ------------------------------------------------------------------------
|
---|
| 1147 | * Constants
|
---|
| 1148 | * ------------------------------------------------------------------------
|
---|
| 1149 | */
|
---|
| 1150 |
|
---|
| 1151 | var NAME$3 = 'collapse';
|
---|
| 1152 | var VERSION$3 = '4.3.1';
|
---|
| 1153 | var DATA_KEY$3 = 'bs.collapse';
|
---|
| 1154 | var EVENT_KEY$3 = "." + DATA_KEY$3;
|
---|
| 1155 | var DATA_API_KEY$3 = '.data-api';
|
---|
| 1156 | var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
|
---|
| 1157 | var Default$1 = {
|
---|
| 1158 | toggle: true,
|
---|
| 1159 | parent: ''
|
---|
| 1160 | };
|
---|
| 1161 | var DefaultType$1 = {
|
---|
| 1162 | toggle: 'boolean',
|
---|
| 1163 | parent: '(string|element)'
|
---|
| 1164 | };
|
---|
| 1165 | var Event$3 = {
|
---|
| 1166 | SHOW: "show" + EVENT_KEY$3,
|
---|
| 1167 | SHOWN: "shown" + EVENT_KEY$3,
|
---|
| 1168 | HIDE: "hide" + EVENT_KEY$3,
|
---|
| 1169 | HIDDEN: "hidden" + EVENT_KEY$3,
|
---|
| 1170 | CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
|
---|
| 1171 | };
|
---|
| 1172 | var ClassName$3 = {
|
---|
| 1173 | SHOW: 'show',
|
---|
| 1174 | COLLAPSE: 'collapse',
|
---|
| 1175 | COLLAPSING: 'collapsing',
|
---|
| 1176 | COLLAPSED: 'collapsed'
|
---|
| 1177 | };
|
---|
| 1178 | var Dimension = {
|
---|
| 1179 | WIDTH: 'width',
|
---|
| 1180 | HEIGHT: 'height'
|
---|
| 1181 | };
|
---|
| 1182 | var Selector$3 = {
|
---|
| 1183 | ACTIVES: '.show, .collapsing',
|
---|
| 1184 | DATA_TOGGLE: '[data-toggle="collapse"]'
|
---|
| 1185 | /**
|
---|
| 1186 | * ------------------------------------------------------------------------
|
---|
| 1187 | * Class Definition
|
---|
| 1188 | * ------------------------------------------------------------------------
|
---|
| 1189 | */
|
---|
| 1190 |
|
---|
| 1191 | };
|
---|
| 1192 |
|
---|
| 1193 | var Collapse =
|
---|
| 1194 | /*#__PURE__*/
|
---|
| 1195 | function () {
|
---|
| 1196 | function Collapse(element, config) {
|
---|
| 1197 | this._isTransitioning = false;
|
---|
| 1198 | this._element = element;
|
---|
| 1199 | this._config = this._getConfig(config);
|
---|
| 1200 | this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
|
---|
| 1201 | var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
|
---|
| 1202 |
|
---|
| 1203 | for (var i = 0, len = toggleList.length; i < len; i++) {
|
---|
| 1204 | var elem = toggleList[i];
|
---|
| 1205 | var selector = Util.getSelectorFromElement(elem);
|
---|
| 1206 | var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
|
---|
| 1207 | return foundElem === element;
|
---|
| 1208 | });
|
---|
| 1209 |
|
---|
| 1210 | if (selector !== null && filterElement.length > 0) {
|
---|
| 1211 | this._selector = selector;
|
---|
| 1212 |
|
---|
| 1213 | this._triggerArray.push(elem);
|
---|
| 1214 | }
|
---|
| 1215 | }
|
---|
| 1216 |
|
---|
| 1217 | this._parent = this._config.parent ? this._getParent() : null;
|
---|
| 1218 |
|
---|
| 1219 | if (!this._config.parent) {
|
---|
| 1220 | this._addAriaAndCollapsedClass(this._element, this._triggerArray);
|
---|
| 1221 | }
|
---|
| 1222 |
|
---|
| 1223 | if (this._config.toggle) {
|
---|
| 1224 | this.toggle();
|
---|
| 1225 | }
|
---|
| 1226 | } // Getters
|
---|
| 1227 |
|
---|
| 1228 |
|
---|
| 1229 | var _proto = Collapse.prototype;
|
---|
| 1230 |
|
---|
| 1231 | // Public
|
---|
| 1232 | _proto.toggle = function toggle() {
|
---|
| 1233 | if ($(this._element).hasClass(ClassName$3.SHOW)) {
|
---|
| 1234 | this.hide();
|
---|
| 1235 | } else {
|
---|
| 1236 | this.show();
|
---|
| 1237 | }
|
---|
| 1238 | };
|
---|
| 1239 |
|
---|
| 1240 | _proto.show = function show() {
|
---|
| 1241 | var _this = this;
|
---|
| 1242 |
|
---|
| 1243 | if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
|
---|
| 1244 | return;
|
---|
| 1245 | }
|
---|
| 1246 |
|
---|
| 1247 | var actives;
|
---|
| 1248 | var activesData;
|
---|
| 1249 |
|
---|
| 1250 | if (this._parent) {
|
---|
| 1251 | actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
|
---|
| 1252 | if (typeof _this._config.parent === 'string') {
|
---|
| 1253 | return elem.getAttribute('data-parent') === _this._config.parent;
|
---|
| 1254 | }
|
---|
| 1255 |
|
---|
| 1256 | return elem.classList.contains(ClassName$3.COLLAPSE);
|
---|
| 1257 | });
|
---|
| 1258 |
|
---|
| 1259 | if (actives.length === 0) {
|
---|
| 1260 | actives = null;
|
---|
| 1261 | }
|
---|
| 1262 | }
|
---|
| 1263 |
|
---|
| 1264 | if (actives) {
|
---|
| 1265 | activesData = $(actives).not(this._selector).data(DATA_KEY$3);
|
---|
| 1266 |
|
---|
| 1267 | if (activesData && activesData._isTransitioning) {
|
---|
| 1268 | return;
|
---|
| 1269 | }
|
---|
| 1270 | }
|
---|
| 1271 |
|
---|
| 1272 | var startEvent = $.Event(Event$3.SHOW);
|
---|
| 1273 | $(this._element).trigger(startEvent);
|
---|
| 1274 |
|
---|
| 1275 | if (startEvent.isDefaultPrevented()) {
|
---|
| 1276 | return;
|
---|
| 1277 | }
|
---|
| 1278 |
|
---|
| 1279 | if (actives) {
|
---|
| 1280 | Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
|
---|
| 1281 |
|
---|
| 1282 | if (!activesData) {
|
---|
| 1283 | $(actives).data(DATA_KEY$3, null);
|
---|
| 1284 | }
|
---|
| 1285 | }
|
---|
| 1286 |
|
---|
| 1287 | var dimension = this._getDimension();
|
---|
| 1288 |
|
---|
| 1289 | $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
|
---|
| 1290 | this._element.style[dimension] = 0;
|
---|
| 1291 |
|
---|
| 1292 | if (this._triggerArray.length) {
|
---|
| 1293 | $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
|
---|
| 1294 | }
|
---|
| 1295 |
|
---|
| 1296 | this.setTransitioning(true);
|
---|
| 1297 |
|
---|
| 1298 | var complete = function complete() {
|
---|
| 1299 | $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
|
---|
| 1300 | _this._element.style[dimension] = '';
|
---|
| 1301 |
|
---|
| 1302 | _this.setTransitioning(false);
|
---|
| 1303 |
|
---|
| 1304 | $(_this._element).trigger(Event$3.SHOWN);
|
---|
| 1305 | };
|
---|
| 1306 |
|
---|
| 1307 | var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
---|
| 1308 | var scrollSize = "scroll" + capitalizedDimension;
|
---|
| 1309 | var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
---|
| 1310 | $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
---|
| 1311 | this._element.style[dimension] = this._element[scrollSize] + "px";
|
---|
| 1312 | };
|
---|
| 1313 |
|
---|
| 1314 | _proto.hide = function hide() {
|
---|
| 1315 | var _this2 = this;
|
---|
| 1316 |
|
---|
| 1317 | if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
|
---|
| 1318 | return;
|
---|
| 1319 | }
|
---|
| 1320 |
|
---|
| 1321 | var startEvent = $.Event(Event$3.HIDE);
|
---|
| 1322 | $(this._element).trigger(startEvent);
|
---|
| 1323 |
|
---|
| 1324 | if (startEvent.isDefaultPrevented()) {
|
---|
| 1325 | return;
|
---|
| 1326 | }
|
---|
| 1327 |
|
---|
| 1328 | var dimension = this._getDimension();
|
---|
| 1329 |
|
---|
| 1330 | this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
|
---|
| 1331 | Util.reflow(this._element);
|
---|
| 1332 | $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
|
---|
| 1333 | var triggerArrayLength = this._triggerArray.length;
|
---|
| 1334 |
|
---|
| 1335 | if (triggerArrayLength > 0) {
|
---|
| 1336 | for (var i = 0; i < triggerArrayLength; i++) {
|
---|
| 1337 | var trigger = this._triggerArray[i];
|
---|
| 1338 | var selector = Util.getSelectorFromElement(trigger);
|
---|
| 1339 |
|
---|
| 1340 | if (selector !== null) {
|
---|
| 1341 | var $elem = $([].slice.call(document.querySelectorAll(selector)));
|
---|
| 1342 |
|
---|
| 1343 | if (!$elem.hasClass(ClassName$3.SHOW)) {
|
---|
| 1344 | $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
|
---|
| 1345 | }
|
---|
| 1346 | }
|
---|
| 1347 | }
|
---|
| 1348 | }
|
---|
| 1349 |
|
---|
| 1350 | this.setTransitioning(true);
|
---|
| 1351 |
|
---|
| 1352 | var complete = function complete() {
|
---|
| 1353 | _this2.setTransitioning(false);
|
---|
| 1354 |
|
---|
| 1355 | $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
|
---|
| 1356 | };
|
---|
| 1357 |
|
---|
| 1358 | this._element.style[dimension] = '';
|
---|
| 1359 | var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
---|
| 1360 | $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
---|
| 1361 | };
|
---|
| 1362 |
|
---|
| 1363 | _proto.setTransitioning = function setTransitioning(isTransitioning) {
|
---|
| 1364 | this._isTransitioning = isTransitioning;
|
---|
| 1365 | };
|
---|
| 1366 |
|
---|
| 1367 | _proto.dispose = function dispose() {
|
---|
| 1368 | $.removeData(this._element, DATA_KEY$3);
|
---|
| 1369 | this._config = null;
|
---|
| 1370 | this._parent = null;
|
---|
| 1371 | this._element = null;
|
---|
| 1372 | this._triggerArray = null;
|
---|
| 1373 | this._isTransitioning = null;
|
---|
| 1374 | } // Private
|
---|
| 1375 | ;
|
---|
| 1376 |
|
---|
| 1377 | _proto._getConfig = function _getConfig(config) {
|
---|
| 1378 | config = _objectSpread({}, Default$1, config);
|
---|
| 1379 | config.toggle = Boolean(config.toggle); // Coerce string values
|
---|
| 1380 |
|
---|
| 1381 | Util.typeCheckConfig(NAME$3, config, DefaultType$1);
|
---|
| 1382 | return config;
|
---|
| 1383 | };
|
---|
| 1384 |
|
---|
| 1385 | _proto._getDimension = function _getDimension() {
|
---|
| 1386 | var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
|
---|
| 1387 | return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
|
---|
| 1388 | };
|
---|
| 1389 |
|
---|
| 1390 | _proto._getParent = function _getParent() {
|
---|
| 1391 | var _this3 = this;
|
---|
| 1392 |
|
---|
| 1393 | var parent;
|
---|
| 1394 |
|
---|
| 1395 | if (Util.isElement(this._config.parent)) {
|
---|
| 1396 | parent = this._config.parent; // It's a jQuery object
|
---|
| 1397 |
|
---|
| 1398 | if (typeof this._config.parent.jquery !== 'undefined') {
|
---|
| 1399 | parent = this._config.parent[0];
|
---|
| 1400 | }
|
---|
| 1401 | } else {
|
---|
| 1402 | parent = document.querySelector(this._config.parent);
|
---|
| 1403 | }
|
---|
| 1404 |
|
---|
| 1405 | var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
|
---|
| 1406 | var children = [].slice.call(parent.querySelectorAll(selector));
|
---|
| 1407 | $(children).each(function (i, element) {
|
---|
| 1408 | _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
|
---|
| 1409 | });
|
---|
| 1410 | return parent;
|
---|
| 1411 | };
|
---|
| 1412 |
|
---|
| 1413 | _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
|
---|
| 1414 | var isOpen = $(element).hasClass(ClassName$3.SHOW);
|
---|
| 1415 |
|
---|
| 1416 | if (triggerArray.length) {
|
---|
| 1417 | $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
|
---|
| 1418 | }
|
---|
| 1419 | } // Static
|
---|
| 1420 | ;
|
---|
| 1421 |
|
---|
| 1422 | Collapse._getTargetFromElement = function _getTargetFromElement(element) {
|
---|
| 1423 | var selector = Util.getSelectorFromElement(element);
|
---|
| 1424 | return selector ? document.querySelector(selector) : null;
|
---|
| 1425 | };
|
---|
| 1426 |
|
---|
| 1427 | Collapse._jQueryInterface = function _jQueryInterface(config) {
|
---|
| 1428 | return this.each(function () {
|
---|
| 1429 | var $this = $(this);
|
---|
| 1430 | var data = $this.data(DATA_KEY$3);
|
---|
| 1431 |
|
---|
| 1432 | var _config = _objectSpread({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {});
|
---|
| 1433 |
|
---|
| 1434 | if (!data && _config.toggle && /show|hide/.test(config)) {
|
---|
| 1435 | _config.toggle = false;
|
---|
| 1436 | }
|
---|
| 1437 |
|
---|
| 1438 | if (!data) {
|
---|
| 1439 | data = new Collapse(this, _config);
|
---|
| 1440 | $this.data(DATA_KEY$3, data);
|
---|
| 1441 | }
|
---|
| 1442 |
|
---|
| 1443 | if (typeof config === 'string') {
|
---|
| 1444 | if (typeof data[config] === 'undefined') {
|
---|
| 1445 | throw new TypeError("No method named \"" + config + "\"");
|
---|
| 1446 | }
|
---|
| 1447 |
|
---|
| 1448 | data[config]();
|
---|
| 1449 | }
|
---|
| 1450 | });
|
---|
| 1451 | };
|
---|
| 1452 |
|
---|
| 1453 | _createClass(Collapse, null, [{
|
---|
| 1454 | key: "VERSION",
|
---|
| 1455 | get: function get() {
|
---|
| 1456 | return VERSION$3;
|
---|
| 1457 | }
|
---|
| 1458 | }, {
|
---|
| 1459 | key: "Default",
|
---|
| 1460 | get: function get() {
|
---|
| 1461 | return Default$1;
|
---|
| 1462 | }
|
---|
| 1463 | }]);
|
---|
| 1464 |
|
---|
| 1465 | return Collapse;
|
---|
| 1466 | }();
|
---|
| 1467 | /**
|
---|
| 1468 | * ------------------------------------------------------------------------
|
---|
| 1469 | * Data Api implementation
|
---|
| 1470 | * ------------------------------------------------------------------------
|
---|
| 1471 | */
|
---|
| 1472 |
|
---|
| 1473 |
|
---|
| 1474 | $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
|
---|
| 1475 | // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
|
---|
| 1476 | if (event.currentTarget.tagName === 'A') {
|
---|
| 1477 | event.preventDefault();
|
---|
| 1478 | }
|
---|
| 1479 |
|
---|
| 1480 | var $trigger = $(this);
|
---|
| 1481 | var selector = Util.getSelectorFromElement(this);
|
---|
| 1482 | var selectors = [].slice.call(document.querySelectorAll(selector));
|
---|
| 1483 | $(selectors).each(function () {
|
---|
| 1484 | var $target = $(this);
|
---|
| 1485 | var data = $target.data(DATA_KEY$3);
|
---|
| 1486 | var config = data ? 'toggle' : $trigger.data();
|
---|
| 1487 |
|
---|
| 1488 | Collapse._jQueryInterface.call($target, config);
|
---|
| 1489 | });
|
---|
| 1490 | });
|
---|
| 1491 | /**
|
---|
| 1492 | * ------------------------------------------------------------------------
|
---|
| 1493 | * jQuery
|
---|
| 1494 | * ------------------------------------------------------------------------
|
---|
| 1495 | */
|
---|
| 1496 |
|
---|
| 1497 | $.fn[NAME$3] = Collapse._jQueryInterface;
|
---|
| 1498 | $.fn[NAME$3].Constructor = Collapse;
|
---|
| 1499 |
|
---|
| 1500 | $.fn[NAME$3].noConflict = function () {
|
---|
| 1501 | $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
|
---|
| 1502 | return Collapse._jQueryInterface;
|
---|
| 1503 | };
|
---|
| 1504 |
|
---|
| 1505 | /**
|
---|
| 1506 | * ------------------------------------------------------------------------
|
---|
| 1507 | * Constants
|
---|
| 1508 | * ------------------------------------------------------------------------
|
---|
| 1509 | */
|
---|
| 1510 |
|
---|
| 1511 | var NAME$4 = 'dropdown';
|
---|
| 1512 | var VERSION$4 = '4.3.1';
|
---|
| 1513 | var DATA_KEY$4 = 'bs.dropdown';
|
---|
| 1514 | var EVENT_KEY$4 = "." + DATA_KEY$4;
|
---|
| 1515 | var DATA_API_KEY$4 = '.data-api';
|
---|
| 1516 | var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
|
---|
| 1517 | var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
|
---|
| 1518 |
|
---|
| 1519 | var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
|
---|
| 1520 |
|
---|
| 1521 | var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
|
---|
| 1522 |
|
---|
| 1523 | var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
|
---|
| 1524 |
|
---|
| 1525 | var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
|
---|
| 1526 |
|
---|
| 1527 | var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
|
---|
| 1528 |
|
---|
| 1529 | var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
|
---|
| 1530 | var Event$4 = {
|
---|
| 1531 | HIDE: "hide" + EVENT_KEY$4,
|
---|
| 1532 | HIDDEN: "hidden" + EVENT_KEY$4,
|
---|
| 1533 | SHOW: "show" + EVENT_KEY$4,
|
---|
| 1534 | SHOWN: "shown" + EVENT_KEY$4,
|
---|
| 1535 | CLICK: "click" + EVENT_KEY$4,
|
---|
| 1536 | CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
|
---|
| 1537 | KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
|
---|
| 1538 | KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
|
---|
| 1539 | };
|
---|
| 1540 | var ClassName$4 = {
|
---|
| 1541 | DISABLED: 'disabled',
|
---|
| 1542 | SHOW: 'show',
|
---|
| 1543 | DROPUP: 'dropup',
|
---|
| 1544 | DROPRIGHT: 'dropright',
|
---|
| 1545 | DROPLEFT: 'dropleft',
|
---|
| 1546 | MENURIGHT: 'dropdown-menu-right',
|
---|
| 1547 | MENULEFT: 'dropdown-menu-left',
|
---|
| 1548 | POSITION_STATIC: 'position-static'
|
---|
| 1549 | };
|
---|
| 1550 | var Selector$4 = {
|
---|
| 1551 | DATA_TOGGLE: '[data-toggle="dropdown"]',
|
---|
| 1552 | FORM_CHILD: '.dropdown form',
|
---|
| 1553 | MENU: '.dropdown-menu',
|
---|
| 1554 | NAVBAR_NAV: '.navbar-nav',
|
---|
| 1555 | VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
|
---|
| 1556 | };
|
---|
| 1557 | var AttachmentMap = {
|
---|
| 1558 | TOP: 'top-start',
|
---|
| 1559 | TOPEND: 'top-end',
|
---|
| 1560 | BOTTOM: 'bottom-start',
|
---|
| 1561 | BOTTOMEND: 'bottom-end',
|
---|
| 1562 | RIGHT: 'right-start',
|
---|
| 1563 | RIGHTEND: 'right-end',
|
---|
| 1564 | LEFT: 'left-start',
|
---|
| 1565 | LEFTEND: 'left-end'
|
---|
| 1566 | };
|
---|
| 1567 | var Default$2 = {
|
---|
| 1568 | offset: 0,
|
---|
| 1569 | flip: true,
|
---|
| 1570 | boundary: 'scrollParent',
|
---|
| 1571 | reference: 'toggle',
|
---|
| 1572 | display: 'dynamic'
|
---|
| 1573 | };
|
---|
| 1574 | var DefaultType$2 = {
|
---|
| 1575 | offset: '(number|string|function)',
|
---|
| 1576 | flip: 'boolean',
|
---|
| 1577 | boundary: '(string|element)',
|
---|
| 1578 | reference: '(string|element)',
|
---|
| 1579 | display: 'string'
|
---|
| 1580 | /**
|
---|
| 1581 | * ------------------------------------------------------------------------
|
---|
| 1582 | * Class Definition
|
---|
| 1583 | * ------------------------------------------------------------------------
|
---|
| 1584 | */
|
---|
| 1585 |
|
---|
| 1586 | };
|
---|
| 1587 |
|
---|
| 1588 | var Dropdown =
|
---|
| 1589 | /*#__PURE__*/
|
---|
| 1590 | function () {
|
---|
| 1591 | function Dropdown(element, config) {
|
---|
| 1592 | this._element = element;
|
---|
| 1593 | this._popper = null;
|
---|
| 1594 | this._config = this._getConfig(config);
|
---|
| 1595 | this._menu = this._getMenuElement();
|
---|
| 1596 | this._inNavbar = this._detectNavbar();
|
---|
| 1597 |
|
---|
| 1598 | this._addEventListeners();
|
---|
| 1599 | } // Getters
|
---|
| 1600 |
|
---|
| 1601 |
|
---|
| 1602 | var _proto = Dropdown.prototype;
|
---|
| 1603 |
|
---|
| 1604 | // Public
|
---|
| 1605 | _proto.toggle = function toggle() {
|
---|
| 1606 | if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
|
---|
| 1607 | return;
|
---|
| 1608 | }
|
---|
| 1609 |
|
---|
| 1610 | var parent = Dropdown._getParentFromElement(this._element);
|
---|
| 1611 |
|
---|
| 1612 | var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
|
---|
| 1613 |
|
---|
| 1614 | Dropdown._clearMenus();
|
---|
| 1615 |
|
---|
| 1616 | if (isActive) {
|
---|
| 1617 | return;
|
---|
| 1618 | }
|
---|
| 1619 |
|
---|
| 1620 | var relatedTarget = {
|
---|
| 1621 | relatedTarget: this._element
|
---|
| 1622 | };
|
---|
| 1623 | var showEvent = $.Event(Event$4.SHOW, relatedTarget);
|
---|
| 1624 | $(parent).trigger(showEvent);
|
---|
| 1625 |
|
---|
| 1626 | if (showEvent.isDefaultPrevented()) {
|
---|
| 1627 | return;
|
---|
| 1628 | } // Disable totally Popper.js for Dropdown in Navbar
|
---|
| 1629 |
|
---|
| 1630 |
|
---|
| 1631 | if (!this._inNavbar) {
|
---|
| 1632 | /**
|
---|
| 1633 | * Check for Popper dependency
|
---|
| 1634 | * Popper - https://popper.js.org
|
---|
| 1635 | */
|
---|
| 1636 | if (typeof Popper === 'undefined') {
|
---|
| 1637 | throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
|
---|
| 1638 | }
|
---|
| 1639 |
|
---|
| 1640 | var referenceElement = this._element;
|
---|
| 1641 |
|
---|
| 1642 | if (this._config.reference === 'parent') {
|
---|
| 1643 | referenceElement = parent;
|
---|
| 1644 | } else if (Util.isElement(this._config.reference)) {
|
---|
| 1645 | referenceElement = this._config.reference; // Check if it's jQuery element
|
---|
| 1646 |
|
---|
| 1647 | if (typeof this._config.reference.jquery !== 'undefined') {
|
---|
| 1648 | referenceElement = this._config.reference[0];
|
---|
| 1649 | }
|
---|
| 1650 | } // If boundary is not `scrollParent`, then set position to `static`
|
---|
| 1651 | // to allow the menu to "escape" the scroll parent's boundaries
|
---|
| 1652 | // https://github.com/twbs/bootstrap/issues/24251
|
---|
| 1653 |
|
---|
| 1654 |
|
---|
| 1655 | if (this._config.boundary !== 'scrollParent') {
|
---|
| 1656 | $(parent).addClass(ClassName$4.POSITION_STATIC);
|
---|
| 1657 | }
|
---|
| 1658 |
|
---|
| 1659 | this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
|
---|
| 1660 | } // If this is a touch-enabled device we add extra
|
---|
| 1661 | // empty mouseover listeners to the body's immediate children;
|
---|
| 1662 | // only needed because of broken event delegation on iOS
|
---|
| 1663 | // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
---|
| 1664 |
|
---|
| 1665 |
|
---|
| 1666 | if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
|
---|
| 1667 | $(document.body).children().on('mouseover', null, $.noop);
|
---|
| 1668 | }
|
---|
| 1669 |
|
---|
| 1670 | this._element.focus();
|
---|
| 1671 |
|
---|
| 1672 | this._element.setAttribute('aria-expanded', true);
|
---|
| 1673 |
|
---|
| 1674 | $(this._menu).toggleClass(ClassName$4.SHOW);
|
---|
| 1675 | $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
|
---|
| 1676 | };
|
---|
| 1677 |
|
---|
| 1678 | _proto.show = function show() {
|
---|
| 1679 | if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
|
---|
| 1680 | return;
|
---|
| 1681 | }
|
---|
| 1682 |
|
---|
| 1683 | var relatedTarget = {
|
---|
| 1684 | relatedTarget: this._element
|
---|
| 1685 | };
|
---|
| 1686 | var showEvent = $.Event(Event$4.SHOW, relatedTarget);
|
---|
| 1687 |
|
---|
| 1688 | var parent = Dropdown._getParentFromElement(this._element);
|
---|
| 1689 |
|
---|
| 1690 | $(parent).trigger(showEvent);
|
---|
| 1691 |
|
---|
| 1692 | if (showEvent.isDefaultPrevented()) {
|
---|
| 1693 | return;
|
---|
| 1694 | }
|
---|
| 1695 |
|
---|
| 1696 | $(this._menu).toggleClass(ClassName$4.SHOW);
|
---|
| 1697 | $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
|
---|
| 1698 | };
|
---|
| 1699 |
|
---|
| 1700 | _proto.hide = function hide() {
|
---|
| 1701 | if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
|
---|
| 1702 | return;
|
---|
| 1703 | }
|
---|
| 1704 |
|
---|
| 1705 | var relatedTarget = {
|
---|
| 1706 | relatedTarget: this._element
|
---|
| 1707 | };
|
---|
| 1708 | var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
|
---|
| 1709 |
|
---|
| 1710 | var parent = Dropdown._getParentFromElement(this._element);
|
---|
| 1711 |
|
---|
| 1712 | $(parent).trigger(hideEvent);
|
---|
| 1713 |
|
---|
| 1714 | if (hideEvent.isDefaultPrevented()) {
|
---|
| 1715 | return;
|
---|
| 1716 | }
|
---|
| 1717 |
|
---|
| 1718 | $(this._menu).toggleClass(ClassName$4.SHOW);
|
---|
| 1719 | $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
|
---|
| 1720 | };
|
---|
| 1721 |
|
---|
| 1722 | _proto.dispose = function dispose() {
|
---|
| 1723 | $.removeData(this._element, DATA_KEY$4);
|
---|
| 1724 | $(this._element).off(EVENT_KEY$4);
|
---|
| 1725 | this._element = null;
|
---|
| 1726 | this._menu = null;
|
---|
| 1727 |
|
---|
| 1728 | if (this._popper !== null) {
|
---|
| 1729 | this._popper.destroy();
|
---|
| 1730 |
|
---|
| 1731 | this._popper = null;
|
---|
| 1732 | }
|
---|
| 1733 | };
|
---|
| 1734 |
|
---|
| 1735 | _proto.update = function update() {
|
---|
| 1736 | this._inNavbar = this._detectNavbar();
|
---|
| 1737 |
|
---|
| 1738 | if (this._popper !== null) {
|
---|
| 1739 | this._popper.scheduleUpdate();
|
---|
| 1740 | }
|
---|
| 1741 | } // Private
|
---|
| 1742 | ;
|
---|
| 1743 |
|
---|
| 1744 | _proto._addEventListeners = function _addEventListeners() {
|
---|
| 1745 | var _this = this;
|
---|
| 1746 |
|
---|
| 1747 | $(this._element).on(Event$4.CLICK, function (event) {
|
---|
| 1748 | event.preventDefault();
|
---|
| 1749 | event.stopPropagation();
|
---|
| 1750 |
|
---|
| 1751 | _this.toggle();
|
---|
| 1752 | });
|
---|
| 1753 | };
|
---|
| 1754 |
|
---|
| 1755 | _proto._getConfig = function _getConfig(config) {
|
---|
| 1756 | config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config);
|
---|
| 1757 | Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
|
---|
| 1758 | return config;
|
---|
| 1759 | };
|
---|
| 1760 |
|
---|
| 1761 | _proto._getMenuElement = function _getMenuElement() {
|
---|
| 1762 | if (!this._menu) {
|
---|
| 1763 | var parent = Dropdown._getParentFromElement(this._element);
|
---|
| 1764 |
|
---|
| 1765 | if (parent) {
|
---|
| 1766 | this._menu = parent.querySelector(Selector$4.MENU);
|
---|
| 1767 | }
|
---|
| 1768 | }
|
---|
| 1769 |
|
---|
| 1770 | return this._menu;
|
---|
| 1771 | };
|
---|
| 1772 |
|
---|
| 1773 | _proto._getPlacement = function _getPlacement() {
|
---|
| 1774 | var $parentDropdown = $(this._element.parentNode);
|
---|
| 1775 | var placement = AttachmentMap.BOTTOM; // Handle dropup
|
---|
| 1776 |
|
---|
| 1777 | if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
|
---|
| 1778 | placement = AttachmentMap.TOP;
|
---|
| 1779 |
|
---|
| 1780 | if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
|
---|
| 1781 | placement = AttachmentMap.TOPEND;
|
---|
| 1782 | }
|
---|
| 1783 | } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
|
---|
| 1784 | placement = AttachmentMap.RIGHT;
|
---|
| 1785 | } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
|
---|
| 1786 | placement = AttachmentMap.LEFT;
|
---|
| 1787 | } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
|
---|
| 1788 | placement = AttachmentMap.BOTTOMEND;
|
---|
| 1789 | }
|
---|
| 1790 |
|
---|
| 1791 | return placement;
|
---|
| 1792 | };
|
---|
| 1793 |
|
---|
| 1794 | _proto._detectNavbar = function _detectNavbar() {
|
---|
| 1795 | return $(this._element).closest('.navbar').length > 0;
|
---|
| 1796 | };
|
---|
| 1797 |
|
---|
| 1798 | _proto._getOffset = function _getOffset() {
|
---|
| 1799 | var _this2 = this;
|
---|
| 1800 |
|
---|
| 1801 | var offset = {};
|
---|
| 1802 |
|
---|
| 1803 | if (typeof this._config.offset === 'function') {
|
---|
| 1804 | offset.fn = function (data) {
|
---|
| 1805 | data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {});
|
---|
| 1806 | return data;
|
---|
| 1807 | };
|
---|
| 1808 | } else {
|
---|
| 1809 | offset.offset = this._config.offset;
|
---|
| 1810 | }
|
---|
| 1811 |
|
---|
| 1812 | return offset;
|
---|
| 1813 | };
|
---|
| 1814 |
|
---|
| 1815 | _proto._getPopperConfig = function _getPopperConfig() {
|
---|
| 1816 | var popperConfig = {
|
---|
| 1817 | placement: this._getPlacement(),
|
---|
| 1818 | modifiers: {
|
---|
| 1819 | offset: this._getOffset(),
|
---|
| 1820 | flip: {
|
---|
| 1821 | enabled: this._config.flip
|
---|
| 1822 | },
|
---|
| 1823 | preventOverflow: {
|
---|
| 1824 | boundariesElement: this._config.boundary
|
---|
| 1825 | }
|
---|
| 1826 | } // Disable Popper.js if we have a static display
|
---|
| 1827 |
|
---|
| 1828 | };
|
---|
| 1829 |
|
---|
| 1830 | if (this._config.display === 'static') {
|
---|
| 1831 | popperConfig.modifiers.applyStyle = {
|
---|
| 1832 | enabled: false
|
---|
| 1833 | };
|
---|
| 1834 | }
|
---|
| 1835 |
|
---|
| 1836 | return popperConfig;
|
---|
| 1837 | } // Static
|
---|
| 1838 | ;
|
---|
| 1839 |
|
---|
| 1840 | Dropdown._jQueryInterface = function _jQueryInterface(config) {
|
---|
| 1841 | return this.each(function () {
|
---|
| 1842 | var data = $(this).data(DATA_KEY$4);
|
---|
| 1843 |
|
---|
| 1844 | var _config = typeof config === 'object' ? config : null;
|
---|
| 1845 |
|
---|
| 1846 | if (!data) {
|
---|
| 1847 | data = new Dropdown(this, _config);
|
---|
| 1848 | $(this).data(DATA_KEY$4, data);
|
---|
| 1849 | }
|
---|
| 1850 |
|
---|
| 1851 | if (typeof config === 'string') {
|
---|
| 1852 | if (typeof data[config] === 'undefined') {
|
---|
| 1853 | throw new TypeError("No method named \"" + config + "\"");
|
---|
| 1854 | }
|
---|
| 1855 |
|
---|
| 1856 | data[config]();
|
---|
| 1857 | }
|
---|
| 1858 | });
|
---|
| 1859 | };
|
---|
| 1860 |
|
---|
| 1861 | Dropdown._clearMenus = function _clearMenus(event) {
|
---|
| 1862 | if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
|
---|
| 1863 | return;
|
---|
| 1864 | }
|
---|
| 1865 |
|
---|
| 1866 | var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
|
---|
| 1867 |
|
---|
| 1868 | for (var i = 0, len = toggles.length; i < len; i++) {
|
---|
| 1869 | var parent = Dropdown._getParentFromElement(toggles[i]);
|
---|
| 1870 |
|
---|
| 1871 | var context = $(toggles[i]).data(DATA_KEY$4);
|
---|
| 1872 | var relatedTarget = {
|
---|
| 1873 | relatedTarget: toggles[i]
|
---|
| 1874 | };
|
---|
| 1875 |
|
---|
| 1876 | if (event && event.type === 'click') {
|
---|
| 1877 | relatedTarget.clickEvent = event;
|
---|
| 1878 | }
|
---|
| 1879 |
|
---|
| 1880 | if (!context) {
|
---|
| 1881 | continue;
|
---|
| 1882 | }
|
---|
| 1883 |
|
---|
| 1884 | var dropdownMenu = context._menu;
|
---|
| 1885 |
|
---|
| 1886 | if (!$(parent).hasClass(ClassName$4.SHOW)) {
|
---|
| 1887 | continue;
|
---|
| 1888 | }
|
---|
| 1889 |
|
---|
| 1890 | if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
|
---|
| 1891 | continue;
|
---|
| 1892 | }
|
---|
| 1893 |
|
---|
| 1894 | var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
|
---|
| 1895 | $(parent).trigger(hideEvent);
|
---|
| 1896 |
|
---|
| 1897 | if (hideEvent.isDefaultPrevented()) {
|
---|
| 1898 | continue;
|
---|
| 1899 | } // If this is a touch-enabled device we remove the extra
|
---|
| 1900 | // empty mouseover listeners we added for iOS support
|
---|
| 1901 |
|
---|
| 1902 |
|
---|
| 1903 | if ('ontouchstart' in document.documentElement) {
|
---|
| 1904 | $(document.body).children().off('mouseover', null, $.noop);
|
---|
| 1905 | }
|
---|
| 1906 |
|
---|
| 1907 | toggles[i].setAttribute('aria-expanded', 'false');
|
---|
| 1908 | $(dropdownMenu).removeClass(ClassName$4.SHOW);
|
---|
| 1909 | $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
|
---|
| 1910 | }
|
---|
| 1911 | };
|
---|
| 1912 |
|
---|
| 1913 | Dropdown._getParentFromElement = function _getParentFromElement(element) {
|
---|
| 1914 | var parent;
|
---|
| 1915 | var selector = Util.getSelectorFromElement(element);
|
---|
| 1916 |
|
---|
| 1917 | if (selector) {
|
---|
| 1918 | parent = document.querySelector(selector);
|
---|
| 1919 | }
|
---|
| 1920 |
|
---|
| 1921 | return parent || element.parentNode;
|
---|
| 1922 | } // eslint-disable-next-line complexity
|
---|
| 1923 | ;
|
---|
| 1924 |
|
---|
| 1925 | Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
|
---|
| 1926 | // If not input/textarea:
|
---|
| 1927 | // - And not a key in REGEXP_KEYDOWN => not a dropdown command
|
---|
| 1928 | // If input/textarea:
|
---|
| 1929 | // - If space key => not a dropdown command
|
---|
| 1930 | // - If key is other than escape
|
---|
| 1931 | // - If key is not up or down => not a dropdown command
|
---|
| 1932 | // - If trigger inside the menu => not a dropdown command
|
---|
| 1933 | if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) {
|
---|
| 1934 | return;
|
---|
| 1935 | }
|
---|
| 1936 |
|
---|
| 1937 | event.preventDefault();
|
---|
| 1938 | event.stopPropagation();
|
---|
| 1939 |
|
---|
| 1940 | if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
|
---|
| 1941 | return;
|
---|
| 1942 | }
|
---|
| 1943 |
|
---|
| 1944 | var parent = Dropdown._getParentFromElement(this);
|
---|
| 1945 |
|
---|
| 1946 | var isActive = $(parent).hasClass(ClassName$4.SHOW);
|
---|
| 1947 |
|
---|
| 1948 | if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
|
---|
| 1949 | if (event.which === ESCAPE_KEYCODE) {
|
---|
| 1950 | var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
|
---|
| 1951 | $(toggle).trigger('focus');
|
---|
| 1952 | }
|
---|
| 1953 |
|
---|
| 1954 | $(this).trigger('click');
|
---|
| 1955 | return;
|
---|
| 1956 | }
|
---|
| 1957 |
|
---|
| 1958 | var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS));
|
---|
| 1959 |
|
---|
| 1960 | if (items.length === 0) {
|
---|
| 1961 | return;
|
---|
| 1962 | }
|
---|
| 1963 |
|
---|
| 1964 | var index = items.indexOf(event.target);
|
---|
| 1965 |
|
---|
| 1966 | if (event.which === ARROW_UP_KEYCODE && index > 0) {
|
---|
| 1967 | // Up
|
---|
| 1968 | index--;
|
---|
| 1969 | }
|
---|
| 1970 |
|
---|
| 1971 | if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
|
---|
| 1972 | // Down
|
---|
| 1973 | index++;
|
---|
| 1974 | }
|
---|
| 1975 |
|
---|
| 1976 | if (index < 0) {
|
---|
| 1977 | index = 0;
|
---|
| 1978 | }
|
---|
| 1979 |
|
---|
| 1980 | items[index].focus();
|
---|
| 1981 | };
|
---|
| 1982 |
|
---|
| 1983 | _createClass(Dropdown, null, [{
|
---|
| 1984 | key: "VERSION",
|
---|
| 1985 | get: function get() {
|
---|
| 1986 | return VERSION$4;
|
---|
| 1987 | }
|
---|
| 1988 | }, {
|
---|
| 1989 | key: "Default",
|
---|
| 1990 | get: function get() {
|
---|
| 1991 | return Default$2;
|
---|
| 1992 | }
|
---|
| 1993 | }, {
|
---|
| 1994 | key: "DefaultType",
|
---|
| 1995 | get: function get() {
|
---|
| 1996 | return DefaultType$2;
|
---|
| 1997 | }
|
---|
| 1998 | }]);
|
---|
| 1999 |
|
---|
| 2000 | return Dropdown;
|
---|
| 2001 | }();
|
---|
| 2002 | /**
|
---|
| 2003 | * ------------------------------------------------------------------------
|
---|
| 2004 | * Data Api implementation
|
---|
| 2005 | * ------------------------------------------------------------------------
|
---|
| 2006 | */
|
---|
| 2007 |
|
---|
| 2008 |
|
---|
| 2009 | $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) {
|
---|
| 2010 | event.preventDefault();
|
---|
| 2011 | event.stopPropagation();
|
---|
| 2012 |
|
---|
| 2013 | Dropdown._jQueryInterface.call($(this), 'toggle');
|
---|
| 2014 | }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
|
---|
| 2015 | e.stopPropagation();
|
---|
| 2016 | });
|
---|
| 2017 | /**
|
---|
| 2018 | * ------------------------------------------------------------------------
|
---|
| 2019 | * jQuery
|
---|
| 2020 | * ------------------------------------------------------------------------
|
---|
| 2021 | */
|
---|
| 2022 |
|
---|
| 2023 | $.fn[NAME$4] = Dropdown._jQueryInterface;
|
---|
| 2024 | $.fn[NAME$4].Constructor = Dropdown;
|
---|
| 2025 |
|
---|
| 2026 | $.fn[NAME$4].noConflict = function () {
|
---|
| 2027 | $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
|
---|
| 2028 | return Dropdown._jQueryInterface;
|
---|
| 2029 | };
|
---|
| 2030 |
|
---|
| 2031 | /**
|
---|
| 2032 | * ------------------------------------------------------------------------
|
---|
| 2033 | * Constants
|
---|
| 2034 | * ------------------------------------------------------------------------
|
---|
| 2035 | */
|
---|
| 2036 |
|
---|
| 2037 | var NAME$5 = 'modal';
|
---|
| 2038 | var VERSION$5 = '4.3.1';
|
---|
| 2039 | var DATA_KEY$5 = 'bs.modal';
|
---|
| 2040 | var EVENT_KEY$5 = "." + DATA_KEY$5;
|
---|
| 2041 | var DATA_API_KEY$5 = '.data-api';
|
---|
| 2042 | var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
|
---|
| 2043 | var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
|
---|
| 2044 |
|
---|
| 2045 | var Default$3 = {
|
---|
| 2046 | backdrop: true,
|
---|
| 2047 | keyboard: true,
|
---|
| 2048 | focus: true,
|
---|
| 2049 | show: true
|
---|
| 2050 | };
|
---|
| 2051 | var DefaultType$3 = {
|
---|
| 2052 | backdrop: '(boolean|string)',
|
---|
| 2053 | keyboard: 'boolean',
|
---|
| 2054 | focus: 'boolean',
|
---|
| 2055 | show: 'boolean'
|
---|
| 2056 | };
|
---|
| 2057 | var Event$5 = {
|
---|
| 2058 | HIDE: "hide" + EVENT_KEY$5,
|
---|
| 2059 | HIDDEN: "hidden" + EVENT_KEY$5,
|
---|
| 2060 | SHOW: "show" + EVENT_KEY$5,
|
---|
| 2061 | SHOWN: "shown" + EVENT_KEY$5,
|
---|
| 2062 | FOCUSIN: "focusin" + EVENT_KEY$5,
|
---|
| 2063 | RESIZE: "resize" + EVENT_KEY$5,
|
---|
| 2064 | CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
|
---|
| 2065 | KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
|
---|
| 2066 | MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
|
---|
| 2067 | MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
|
---|
| 2068 | CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
|
---|
| 2069 | };
|
---|
| 2070 | var ClassName$5 = {
|
---|
| 2071 | SCROLLABLE: 'modal-dialog-scrollable',
|
---|
| 2072 | SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
|
---|
| 2073 | BACKDROP: 'modal-backdrop',
|
---|
| 2074 | OPEN: 'modal-open',
|
---|
| 2075 | FADE: 'fade',
|
---|
| 2076 | SHOW: 'show'
|
---|
| 2077 | };
|
---|
| 2078 | var Selector$5 = {
|
---|
| 2079 | DIALOG: '.modal-dialog',
|
---|
| 2080 | MODAL_BODY: '.modal-body',
|
---|
| 2081 | DATA_TOGGLE: '[data-toggle="modal"]',
|
---|
| 2082 | DATA_DISMISS: '[data-dismiss="modal"]',
|
---|
| 2083 | FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
|
---|
| 2084 | STICKY_CONTENT: '.sticky-top'
|
---|
| 2085 | /**
|
---|
| 2086 | * ------------------------------------------------------------------------
|
---|
| 2087 | * Class Definition
|
---|
| 2088 | * ------------------------------------------------------------------------
|
---|
| 2089 | */
|
---|
| 2090 |
|
---|
| 2091 | };
|
---|
| 2092 |
|
---|
| 2093 | var Modal =
|
---|
| 2094 | /*#__PURE__*/
|
---|
| 2095 | function () {
|
---|
| 2096 | function Modal(element, config) {
|
---|
| 2097 | this._config = this._getConfig(config);
|
---|
| 2098 | this._element = element;
|
---|
| 2099 | this._dialog = element.querySelector(Selector$5.DIALOG);
|
---|
| 2100 | this._backdrop = null;
|
---|
| 2101 | this._isShown = false;
|
---|
| 2102 | this._isBodyOverflowing = false;
|
---|
| 2103 | this._ignoreBackdropClick = false;
|
---|
| 2104 | this._isTransitioning = false;
|
---|
| 2105 | this._scrollbarWidth = 0;
|
---|
| 2106 | } // Getters
|
---|
| 2107 |
|
---|
| 2108 |
|
---|
| 2109 | var _proto = Modal.prototype;
|
---|
| 2110 |
|
---|
| 2111 | // Public
|
---|
| 2112 | _proto.toggle = function toggle(relatedTarget) {
|
---|
| 2113 | return this._isShown ? this.hide() : this.show(relatedTarget);
|
---|
| 2114 | };
|
---|
| 2115 |
|
---|
| 2116 | _proto.show = function show(relatedTarget) {
|
---|
| 2117 | var _this = this;
|
---|
| 2118 |
|
---|
| 2119 | if (this._isShown || this._isTransitioning) {
|
---|
| 2120 | return;
|
---|
| 2121 | }
|
---|
| 2122 |
|
---|
| 2123 | if ($(this._element).hasClass(ClassName$5.FADE)) {
|
---|
| 2124 | this._isTransitioning = true;
|
---|
| 2125 | }
|
---|
| 2126 |
|
---|
| 2127 | var showEvent = $.Event(Event$5.SHOW, {
|
---|
| 2128 | relatedTarget: relatedTarget
|
---|
| 2129 | });
|
---|
| 2130 | $(this._element).trigger(showEvent);
|
---|
| 2131 |
|
---|
| 2132 | if (this._isShown || showEvent.isDefaultPrevented()) {
|
---|
| 2133 | return;
|
---|
| 2134 | }
|
---|
| 2135 |
|
---|
| 2136 | this._isShown = true;
|
---|
| 2137 |
|
---|
| 2138 | this._checkScrollbar();
|
---|
| 2139 |
|
---|
| 2140 | this._setScrollbar();
|
---|
| 2141 |
|
---|
| 2142 | this._adjustDialog();
|
---|
| 2143 |
|
---|
| 2144 | this._setEscapeEvent();
|
---|
| 2145 |
|
---|
| 2146 | this._setResizeEvent();
|
---|
| 2147 |
|
---|
| 2148 | $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
|
---|
| 2149 | return _this.hide(event);
|
---|
| 2150 | });
|
---|
| 2151 | $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
|
---|
| 2152 | $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
|
---|
| 2153 | if ($(event.target).is(_this._element)) {
|
---|
| 2154 | _this._ignoreBackdropClick = true;
|
---|
| 2155 | }
|
---|
| 2156 | });
|
---|
| 2157 | });
|
---|
| 2158 |
|
---|
| 2159 | this._showBackdrop(function () {
|
---|
| 2160 | return _this._showElement(relatedTarget);
|
---|
| 2161 | });
|
---|
| 2162 | };
|
---|
| 2163 |
|
---|
| 2164 | _proto.hide = function hide(event) {
|
---|
| 2165 | var _this2 = this;
|
---|
| 2166 |
|
---|
| 2167 | if (event) {
|
---|
| 2168 | event.preventDefault();
|
---|
| 2169 | }
|
---|
| 2170 |
|
---|
| 2171 | if (!this._isShown || this._isTransitioning) {
|
---|
| 2172 | return;
|
---|
| 2173 | }
|
---|
| 2174 |
|
---|
| 2175 | var hideEvent = $.Event(Event$5.HIDE);
|
---|
| 2176 | $(this._element).trigger(hideEvent);
|
---|
| 2177 |
|
---|
| 2178 | if (!this._isShown || hideEvent.isDefaultPrevented()) {
|
---|
| 2179 | return;
|
---|
| 2180 | }
|
---|
| 2181 |
|
---|
| 2182 | this._isShown = false;
|
---|
| 2183 | var transition = $(this._element).hasClass(ClassName$5.FADE);
|
---|
| 2184 |
|
---|
| 2185 | if (transition) {
|
---|
| 2186 | this._isTransitioning = true;
|
---|
| 2187 | }
|
---|
| 2188 |
|
---|
| 2189 | this._setEscapeEvent();
|
---|
| 2190 |
|
---|
| 2191 | this._setResizeEvent();
|
---|
| 2192 |
|
---|
| 2193 | $(document).off(Event$5.FOCUSIN);
|
---|
| 2194 | $(this._element).removeClass(ClassName$5.SHOW);
|
---|
| 2195 | $(this._element).off(Event$5.CLICK_DISMISS);
|
---|
| 2196 | $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
|
---|
| 2197 |
|
---|
| 2198 | if (transition) {
|
---|
| 2199 | var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
---|
| 2200 | $(this._element).one(Util.TRANSITION_END, function (event) {
|
---|
| 2201 | return _this2._hideModal(event);
|
---|
| 2202 | }).emulateTransitionEnd(transitionDuration);
|
---|
| 2203 | } else {
|
---|
| 2204 | this._hideModal();
|
---|
| 2205 | }
|
---|
| 2206 | };
|
---|
| 2207 |
|
---|
| 2208 | _proto.dispose = function dispose() {
|
---|
| 2209 | [window, this._element, this._dialog].forEach(function (htmlElement) {
|
---|
| 2210 | return $(htmlElement).off(EVENT_KEY$5);
|
---|
| 2211 | });
|
---|
| 2212 | /**
|
---|
| 2213 | * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
|
---|
| 2214 | * Do not move `document` in `htmlElements` array
|
---|
| 2215 | * It will remove `Event.CLICK_DATA_API` event that should remain
|
---|
| 2216 | */
|
---|
| 2217 |
|
---|
| 2218 | $(document).off(Event$5.FOCUSIN);
|
---|
| 2219 | $.removeData(this._element, DATA_KEY$5);
|
---|
| 2220 | this._config = null;
|
---|
| 2221 | this._element = null;
|
---|
| 2222 | this._dialog = null;
|
---|
| 2223 | this._backdrop = null;
|
---|
| 2224 | this._isShown = null;
|
---|
| 2225 | this._isBodyOverflowing = null;
|
---|
| 2226 | this._ignoreBackdropClick = null;
|
---|
| 2227 | this._isTransitioning = null;
|
---|
| 2228 | this._scrollbarWidth = null;
|
---|
| 2229 | };
|
---|
| 2230 |
|
---|
| 2231 | _proto.handleUpdate = function handleUpdate() {
|
---|
| 2232 | this._adjustDialog();
|
---|
| 2233 | } // Private
|
---|
| 2234 | ;
|
---|
| 2235 |
|
---|
| 2236 | _proto._getConfig = function _getConfig(config) {
|
---|
| 2237 | config = _objectSpread({}, Default$3, config);
|
---|
| 2238 | Util.typeCheckConfig(NAME$5, config, DefaultType$3);
|
---|
| 2239 | return config;
|
---|
| 2240 | };
|
---|
| 2241 |
|
---|
| 2242 | _proto._showElement = function _showElement(relatedTarget) {
|
---|
| 2243 | var _this3 = this;
|
---|
| 2244 |
|
---|
| 2245 | var transition = $(this._element).hasClass(ClassName$5.FADE);
|
---|
| 2246 |
|
---|
| 2247 | if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
---|
| 2248 | // Don't move modal's DOM position
|
---|
| 2249 | document.body.appendChild(this._element);
|
---|
| 2250 | }
|
---|
| 2251 |
|
---|
| 2252 | this._element.style.display = 'block';
|
---|
| 2253 |
|
---|
| 2254 | this._element.removeAttribute('aria-hidden');
|
---|
| 2255 |
|
---|
| 2256 | this._element.setAttribute('aria-modal', true);
|
---|
| 2257 |
|
---|
| 2258 | if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE)) {
|
---|
| 2259 | this._dialog.querySelector(Selector$5.MODAL_BODY).scrollTop = 0;
|
---|
| 2260 | } else {
|
---|
| 2261 | this._element.scrollTop = 0;
|
---|
| 2262 | }
|
---|
| 2263 |
|
---|
| 2264 | if (transition) {
|
---|
| 2265 | Util.reflow(this._element);
|
---|
| 2266 | }
|
---|
| 2267 |
|
---|
| 2268 | $(this._element).addClass(ClassName$5.SHOW);
|
---|
| 2269 |
|
---|
| 2270 | if (this._config.focus) {
|
---|
| 2271 | this._enforceFocus();
|
---|
| 2272 | }
|
---|
| 2273 |
|
---|
| 2274 | var shownEvent = $.Event(Event$5.SHOWN, {
|
---|
| 2275 | relatedTarget: relatedTarget
|
---|
| 2276 | });
|
---|
| 2277 |
|
---|
| 2278 | var transitionComplete = function transitionComplete() {
|
---|
| 2279 | if (_this3._config.focus) {
|
---|
| 2280 | _this3._element.focus();
|
---|
| 2281 | }
|
---|
| 2282 |
|
---|
| 2283 | _this3._isTransitioning = false;
|
---|
| 2284 | $(_this3._element).trigger(shownEvent);
|
---|
| 2285 | };
|
---|
| 2286 |
|
---|
| 2287 | if (transition) {
|
---|
| 2288 | var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
|
---|
| 2289 | $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
|
---|
| 2290 | } else {
|
---|
| 2291 | transitionComplete();
|
---|
| 2292 | }
|
---|
| 2293 | };
|
---|
| 2294 |
|
---|
| 2295 | _proto._enforceFocus = function _enforceFocus() {
|
---|
| 2296 | var _this4 = this;
|
---|
| 2297 |
|
---|
| 2298 | $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
|
---|
| 2299 | .on(Event$5.FOCUSIN, function (event) {
|
---|
| 2300 | if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) {
|
---|
| 2301 | _this4._element.focus();
|
---|
| 2302 | }
|
---|
| 2303 | });
|
---|
| 2304 | };
|
---|
| 2305 |
|
---|
| 2306 | _proto._setEscapeEvent = function _setEscapeEvent() {
|
---|
| 2307 | var _this5 = this;
|
---|
| 2308 |
|
---|
| 2309 | if (this._isShown && this._config.keyboard) {
|
---|
| 2310 | $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
|
---|
| 2311 | if (event.which === ESCAPE_KEYCODE$1) {
|
---|
| 2312 | event.preventDefault();
|
---|
| 2313 |
|
---|
| 2314 | _this5.hide();
|
---|
| 2315 | }
|
---|
| 2316 | });
|
---|
| 2317 | } else if (!this._isShown) {
|
---|
| 2318 | $(this._element).off(Event$5.KEYDOWN_DISMISS);
|
---|
| 2319 | }
|
---|
| 2320 | };
|
---|
| 2321 |
|
---|
| 2322 | _proto._setResizeEvent = function _setResizeEvent() {
|
---|
| 2323 | var _this6 = this;
|
---|
| 2324 |
|
---|
| 2325 | if (this._isShown) {
|
---|
| 2326 | $(window).on(Event$5.RESIZE, function (event) {
|
---|
| 2327 | return _this6.handleUpdate(event);
|
---|
| 2328 | });
|
---|
| 2329 | } else {
|
---|
| 2330 | $(window).off(Event$5.RESIZE);
|
---|
| 2331 | }
|
---|
| 2332 | };
|
---|
| 2333 |
|
---|
| 2334 | _proto._hideModal = function _hideModal() {
|
---|
| 2335 | var _this7 = this;
|
---|
| 2336 |
|
---|
| 2337 | this._element.style.display = 'none';
|
---|
| 2338 |
|
---|
| 2339 | this._element.setAttribute('aria-hidden', true);
|
---|
| 2340 |
|
---|
| 2341 | this._element.removeAttribute('aria-modal');
|
---|
| 2342 |
|
---|
| 2343 | this._isTransitioning = false;
|
---|
| 2344 |
|
---|
| 2345 | this._showBackdrop(function () {
|
---|
| 2346 | $(document.body).removeClass(ClassName$5.OPEN);
|
---|
| 2347 |
|
---|
| 2348 | _this7._resetAdjustments();
|
---|
| 2349 |
|
---|
| 2350 | _this7._resetScrollbar();
|
---|
| 2351 |
|
---|
| 2352 | $(_this7._element).trigger(Event$5.HIDDEN);
|
---|
| 2353 | });
|
---|
| 2354 | };
|
---|
| 2355 |
|
---|
| 2356 | _proto._removeBackdrop = function _removeBackdrop() {
|
---|
| 2357 | if (this._backdrop) {
|
---|
| 2358 | $(this._backdrop).remove();
|
---|
| 2359 | this._backdrop = null;
|
---|
| 2360 | }
|
---|
| 2361 | };
|
---|
| 2362 |
|
---|
| 2363 | _proto._showBackdrop = function _showBackdrop(callback) {
|
---|
| 2364 | var _this8 = this;
|
---|
| 2365 |
|
---|
| 2366 | var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
|
---|
| 2367 |
|
---|
| 2368 | if (this._isShown && this._config.backdrop) {
|
---|
| 2369 | this._backdrop = document.createElement('div');
|
---|
| 2370 | this._backdrop.className = ClassName$5.BACKDROP;
|
---|
| 2371 |
|
---|
| 2372 | if (animate) {
|
---|
| 2373 | this._backdrop.classList.add(animate);
|
---|
| 2374 | }
|
---|
| 2375 |
|
---|
| 2376 | $(this._backdrop).appendTo(document.body);
|
---|
| 2377 | $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
|
---|
| 2378 | if (_this8._ignoreBackdropClick) {
|
---|
| 2379 | _this8._ignoreBackdropClick = false;
|
---|
| 2380 | return;
|
---|
| 2381 | }
|
---|
| 2382 |
|
---|
| 2383 | if (event.target !== event.currentTarget) {
|
---|
| 2384 | return;
|
---|
| 2385 | }
|
---|
| 2386 |
|
---|
| 2387 | if (_this8._config.backdrop === 'static') {
|
---|
| 2388 | _this8._element.focus();
|
---|
| 2389 | } else {
|
---|
| 2390 | _this8.hide();
|
---|
| 2391 | }
|
---|
| 2392 | });
|
---|
| 2393 |
|
---|
| 2394 | if (animate) {
|
---|
| 2395 | Util.reflow(this._backdrop);
|
---|
| 2396 | }
|
---|
| 2397 |
|
---|
| 2398 | $(this._backdrop).addClass(ClassName$5.SHOW);
|
---|
| 2399 |
|
---|
| 2400 | if (!callback) {
|
---|
| 2401 | return;
|
---|
| 2402 | }
|
---|
| 2403 |
|
---|
| 2404 | if (!animate) {
|
---|
| 2405 | callback();
|
---|
| 2406 | return;
|
---|
| 2407 | }
|
---|
| 2408 |
|
---|
| 2409 | var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
|
---|
| 2410 | $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
|
---|
| 2411 | } else if (!this._isShown && this._backdrop) {
|
---|
| 2412 | $(this._backdrop).removeClass(ClassName$5.SHOW);
|
---|
| 2413 |
|
---|
| 2414 | var callbackRemove = function callbackRemove() {
|
---|
| 2415 | _this8._removeBackdrop();
|
---|
| 2416 |
|
---|
| 2417 | if (callback) {
|
---|
| 2418 | callback();
|
---|
| 2419 | }
|
---|
| 2420 | };
|
---|
| 2421 |
|
---|
| 2422 | if ($(this._element).hasClass(ClassName$5.FADE)) {
|
---|
| 2423 | var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
|
---|
| 2424 |
|
---|
| 2425 | $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
|
---|
| 2426 | } else {
|
---|
| 2427 | callbackRemove();
|
---|
| 2428 | }
|
---|
| 2429 | } else if (callback) {
|
---|
| 2430 | callback();
|
---|
| 2431 | }
|
---|
| 2432 | } // ----------------------------------------------------------------------
|
---|
| 2433 | // the following methods are used to handle overflowing modals
|
---|
| 2434 | // todo (fat): these should probably be refactored out of modal.js
|
---|
| 2435 | // ----------------------------------------------------------------------
|
---|
| 2436 | ;
|
---|
| 2437 |
|
---|
| 2438 | _proto._adjustDialog = function _adjustDialog() {
|
---|
| 2439 | var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
---|
| 2440 |
|
---|
| 2441 | if (!this._isBodyOverflowing && isModalOverflowing) {
|
---|
| 2442 | this._element.style.paddingLeft = this._scrollbarWidth + "px";
|
---|
| 2443 | }
|
---|
| 2444 |
|
---|
| 2445 | if (this._isBodyOverflowing && !isModalOverflowing) {
|
---|
| 2446 | this._element.style.paddingRight = this._scrollbarWidth + "px";
|
---|
| 2447 | }
|
---|
| 2448 | };
|
---|
| 2449 |
|
---|
| 2450 | _proto._resetAdjustments = function _resetAdjustments() {
|
---|
| 2451 | this._element.style.paddingLeft = '';
|
---|
| 2452 | this._element.style.paddingRight = '';
|
---|
| 2453 | };
|
---|
| 2454 |
|
---|
| 2455 | _proto._checkScrollbar = function _checkScrollbar() {
|
---|
| 2456 | var rect = document.body.getBoundingClientRect();
|
---|
| 2457 | this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
|
---|
| 2458 | this._scrollbarWidth = this._getScrollbarWidth();
|
---|
| 2459 | };
|
---|
| 2460 |
|
---|
| 2461 | _proto._setScrollbar = function _setScrollbar() {
|
---|
| 2462 | var _this9 = this;
|
---|
| 2463 |
|
---|
| 2464 | if (this._isBodyOverflowing) {
|
---|
| 2465 | // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
|
---|
| 2466 | // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
|
---|
| 2467 | var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
|
---|
| 2468 | var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
|
---|
| 2469 |
|
---|
| 2470 | $(fixedContent).each(function (index, element) {
|
---|
| 2471 | var actualPadding = element.style.paddingRight;
|
---|
| 2472 | var calculatedPadding = $(element).css('padding-right');
|
---|
| 2473 | $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px");
|
---|
| 2474 | }); // Adjust sticky content margin
|
---|
| 2475 |
|
---|
| 2476 | $(stickyContent).each(function (index, element) {
|
---|
| 2477 | var actualMargin = element.style.marginRight;
|
---|
| 2478 | var calculatedMargin = $(element).css('margin-right');
|
---|
| 2479 | $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px");
|
---|
| 2480 | }); // Adjust body padding
|
---|
| 2481 |
|
---|
| 2482 | var actualPadding = document.body.style.paddingRight;
|
---|
| 2483 | var calculatedPadding = $(document.body).css('padding-right');
|
---|
| 2484 | $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
|
---|
| 2485 | }
|
---|
| 2486 |
|
---|
| 2487 | $(document.body).addClass(ClassName$5.OPEN);
|
---|
| 2488 | };
|
---|
| 2489 |
|
---|
| 2490 | _proto._resetScrollbar = function _resetScrollbar() {
|
---|
| 2491 | // Restore fixed content padding
|
---|
| 2492 | var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
|
---|
| 2493 | $(fixedContent).each(function (index, element) {
|
---|
| 2494 | var padding = $(element).data('padding-right');
|
---|
| 2495 | $(element).removeData('padding-right');
|
---|
| 2496 | element.style.paddingRight = padding ? padding : '';
|
---|
| 2497 | }); // Restore sticky content
|
---|
| 2498 |
|
---|
| 2499 | var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
|
---|
| 2500 | $(elements).each(function (index, element) {
|
---|
| 2501 | var margin = $(element).data('margin-right');
|
---|
| 2502 |
|
---|
| 2503 | if (typeof margin !== 'undefined') {
|
---|
| 2504 | $(element).css('margin-right', margin).removeData('margin-right');
|
---|
| 2505 | }
|
---|
| 2506 | }); // Restore body padding
|
---|
| 2507 |
|
---|
| 2508 | var padding = $(document.body).data('padding-right');
|
---|
| 2509 | $(document.body).removeData('padding-right');
|
---|
| 2510 | document.body.style.paddingRight = padding ? padding : '';
|
---|
| 2511 | };
|
---|
| 2512 |
|
---|
| 2513 | _proto._getScrollbarWidth = function _getScrollbarWidth() {
|
---|
| 2514 | // thx d.walsh
|
---|
| 2515 | var scrollDiv = document.createElement('div');
|
---|
| 2516 | scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
|
---|
| 2517 | document.body.appendChild(scrollDiv);
|
---|
| 2518 | var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
|
---|
| 2519 | document.body.removeChild(scrollDiv);
|
---|
| 2520 | return scrollbarWidth;
|
---|
| 2521 | } // Static
|
---|
| 2522 | ;
|
---|
| 2523 |
|
---|
| 2524 | Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
|
---|
| 2525 | return this.each(function () {
|
---|
| 2526 | var data = $(this).data(DATA_KEY$5);
|
---|
| 2527 |
|
---|
| 2528 | var _config = _objectSpread({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {});
|
---|
| 2529 |
|
---|
| 2530 | if (!data) {
|
---|
| 2531 | data = new Modal(this, _config);
|
---|
| 2532 | $(this).data(DATA_KEY$5, data);
|
---|
| 2533 | }
|
---|
| 2534 |
|
---|
| 2535 | if (typeof config === 'string') {
|
---|
| 2536 | if (typeof data[config] === 'undefined') {
|
---|
| 2537 | throw new TypeError("No method named \"" + config + "\"");
|
---|
| 2538 | }
|
---|
| 2539 |
|
---|
| 2540 | data[config](relatedTarget);
|
---|
| 2541 | } else if (_config.show) {
|
---|
| 2542 | data.show(relatedTarget);
|
---|
| 2543 | }
|
---|
| 2544 | });
|
---|
| 2545 | };
|
---|
| 2546 |
|
---|
| 2547 | _createClass(Modal, null, [{
|
---|
| 2548 | key: "VERSION",
|
---|
| 2549 | get: function get() {
|
---|
| 2550 | return VERSION$5;
|
---|
| 2551 | }
|
---|
| 2552 | }, {
|
---|
| 2553 | key: "Default",
|
---|
| 2554 | get: function get() {
|
---|
| 2555 | return Default$3;
|
---|
| 2556 | }
|
---|
| 2557 | }]);
|
---|
| 2558 |
|
---|
| 2559 | return Modal;
|
---|
| 2560 | }();
|
---|
| 2561 | /**
|
---|
| 2562 | * ------------------------------------------------------------------------
|
---|
| 2563 | * Data Api implementation
|
---|
| 2564 | * ------------------------------------------------------------------------
|
---|
| 2565 | */
|
---|
| 2566 |
|
---|
| 2567 |
|
---|
| 2568 | $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
|
---|
| 2569 | var _this10 = this;
|
---|
| 2570 |
|
---|
| 2571 | var target;
|
---|
| 2572 | var selector = Util.getSelectorFromElement(this);
|
---|
| 2573 |
|
---|
| 2574 | if (selector) {
|
---|
| 2575 | target = document.querySelector(selector);
|
---|
| 2576 | }
|
---|
| 2577 |
|
---|
| 2578 | var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data());
|
---|
| 2579 |
|
---|
| 2580 | if (this.tagName === 'A' || this.tagName === 'AREA') {
|
---|
| 2581 | event.preventDefault();
|
---|
| 2582 | }
|
---|
| 2583 |
|
---|
| 2584 | var $target = $(target).one(Event$5.SHOW, function (showEvent) {
|
---|
| 2585 | if (showEvent.isDefaultPrevented()) {
|
---|
| 2586 | // Only register focus restorer if modal will actually get shown
|
---|
| 2587 | return;
|
---|
| 2588 | }
|
---|
| 2589 |
|
---|
| 2590 | $target.one(Event$5.HIDDEN, function () {
|
---|
| 2591 | if ($(_this10).is(':visible')) {
|
---|
| 2592 | _this10.focus();
|
---|
| 2593 | }
|
---|
| 2594 | });
|
---|
| 2595 | });
|
---|
| 2596 |
|
---|
| 2597 | Modal._jQueryInterface.call($(target), config, this);
|
---|
| 2598 | });
|
---|
| 2599 | /**
|
---|
| 2600 | * ------------------------------------------------------------------------
|
---|
| 2601 | * jQuery
|
---|
| 2602 | * ------------------------------------------------------------------------
|
---|
| 2603 | */
|
---|
| 2604 |
|
---|
| 2605 | $.fn[NAME$5] = Modal._jQueryInterface;
|
---|
| 2606 | $.fn[NAME$5].Constructor = Modal;
|
---|
| 2607 |
|
---|
| 2608 | $.fn[NAME$5].noConflict = function () {
|
---|
| 2609 | $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
|
---|
| 2610 | return Modal._jQueryInterface;
|
---|
| 2611 | };
|
---|
| 2612 |
|
---|
| 2613 | /**
|
---|
| 2614 | * --------------------------------------------------------------------------
|
---|
| 2615 | * Bootstrap (v4.3.1): tools/sanitizer.js
|
---|
| 2616 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
---|
| 2617 | * --------------------------------------------------------------------------
|
---|
| 2618 | */
|
---|
| 2619 | var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
|
---|
| 2620 | var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
---|
| 2621 | var DefaultWhitelist = {
|
---|
| 2622 | // Global attributes allowed on any supplied element below.
|
---|
| 2623 | '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
|
---|
| 2624 | a: ['target', 'href', 'title', 'rel'],
|
---|
| 2625 | area: [],
|
---|
| 2626 | b: [],
|
---|
| 2627 | br: [],
|
---|
| 2628 | col: [],
|
---|
| 2629 | code: [],
|
---|
| 2630 | div: [],
|
---|
| 2631 | em: [],
|
---|
| 2632 | hr: [],
|
---|
| 2633 | h1: [],
|
---|
| 2634 | h2: [],
|
---|
| 2635 | h3: [],
|
---|
| 2636 | h4: [],
|
---|
| 2637 | h5: [],
|
---|
| 2638 | h6: [],
|
---|
| 2639 | i: [],
|
---|
| 2640 | img: ['src', 'alt', 'title', 'width', 'height'],
|
---|
| 2641 | li: [],
|
---|
| 2642 | ol: [],
|
---|
| 2643 | p: [],
|
---|
| 2644 | pre: [],
|
---|
| 2645 | s: [],
|
---|
| 2646 | small: [],
|
---|
| 2647 | span: [],
|
---|
| 2648 | sub: [],
|
---|
| 2649 | sup: [],
|
---|
| 2650 | strong: [],
|
---|
| 2651 | u: [],
|
---|
| 2652 | ul: []
|
---|
| 2653 | /**
|
---|
| 2654 | * A pattern that recognizes a commonly useful subset of URLs that are safe.
|
---|
| 2655 | *
|
---|
| 2656 | * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
---|
| 2657 | */
|
---|
| 2658 |
|
---|
| 2659 | };
|
---|
| 2660 | var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
|
---|
| 2661 | /**
|
---|
| 2662 | * A pattern that matches safe data URLs. Only matches image, video and audio types.
|
---|
| 2663 | *
|
---|
| 2664 | * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
|
---|
| 2665 | */
|
---|
| 2666 |
|
---|
| 2667 | var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;
|
---|
| 2668 |
|
---|
| 2669 | function allowedAttribute(attr, allowedAttributeList) {
|
---|
| 2670 | var attrName = attr.nodeName.toLowerCase();
|
---|
| 2671 |
|
---|
| 2672 | if (allowedAttributeList.indexOf(attrName) !== -1) {
|
---|
| 2673 | if (uriAttrs.indexOf(attrName) !== -1) {
|
---|
| 2674 | return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
|
---|
| 2675 | }
|
---|
| 2676 |
|
---|
| 2677 | return true;
|
---|
| 2678 | }
|
---|
| 2679 |
|
---|
| 2680 | var regExp = allowedAttributeList.filter(function (attrRegex) {
|
---|
| 2681 | return attrRegex instanceof RegExp;
|
---|
| 2682 | }); // Check if a regular expression validates the attribute.
|
---|
| 2683 |
|
---|
| 2684 | for (var i = 0, l = regExp.length; i < l; i++) {
|
---|
| 2685 | if (attrName.match(regExp[i])) {
|
---|
| 2686 | return true;
|
---|
| 2687 | }
|
---|
| 2688 | }
|
---|
| 2689 |
|
---|
| 2690 | return false;
|
---|
| 2691 | }
|
---|
| 2692 |
|
---|
| 2693 | function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
|
---|
| 2694 | if (unsafeHtml.length === 0) {
|
---|
| 2695 | return unsafeHtml;
|
---|
| 2696 | }
|
---|
| 2697 |
|
---|
| 2698 | if (sanitizeFn && typeof sanitizeFn === 'function') {
|
---|
| 2699 | return sanitizeFn(unsafeHtml);
|
---|
| 2700 | }
|
---|
| 2701 |
|
---|
| 2702 | var domParser = new window.DOMParser();
|
---|
| 2703 | var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
---|
| 2704 | var whitelistKeys = Object.keys(whiteList);
|
---|
| 2705 | var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
|
---|
| 2706 |
|
---|
| 2707 | var _loop = function _loop(i, len) {
|
---|
| 2708 | var el = elements[i];
|
---|
| 2709 | var elName = el.nodeName.toLowerCase();
|
---|
| 2710 |
|
---|
| 2711 | if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
|
---|
| 2712 | el.parentNode.removeChild(el);
|
---|
| 2713 | return "continue";
|
---|
| 2714 | }
|
---|
| 2715 |
|
---|
| 2716 | var attributeList = [].slice.call(el.attributes);
|
---|
| 2717 | var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
|
---|
| 2718 | attributeList.forEach(function (attr) {
|
---|
| 2719 | if (!allowedAttribute(attr, whitelistedAttributes)) {
|
---|
| 2720 | el.removeAttribute(attr.nodeName);
|
---|
| 2721 | }
|
---|
| 2722 | });
|
---|
| 2723 | };
|
---|
| 2724 |
|
---|
| 2725 | for (var i = 0, len = elements.length; i < len; i++) {
|
---|
| 2726 | var _ret = _loop(i, len);
|
---|
| 2727 |
|
---|
| 2728 | if (_ret === "continue") continue;
|
---|
| 2729 | }
|
---|
| 2730 |
|
---|
| 2731 | return createdDocument.body.innerHTML;
|
---|
| 2732 | }
|
---|
| 2733 |
|
---|
| 2734 | /**
|
---|
| 2735 | * ------------------------------------------------------------------------
|
---|
| 2736 | * Constants
|
---|
| 2737 | * ------------------------------------------------------------------------
|
---|
| 2738 | */
|
---|
| 2739 |
|
---|
| 2740 | var NAME$6 = 'tooltip';
|
---|
| 2741 | var VERSION$6 = '4.3.1';
|
---|
| 2742 | var DATA_KEY$6 = 'bs.tooltip';
|
---|
| 2743 | var EVENT_KEY$6 = "." + DATA_KEY$6;
|
---|
| 2744 | var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
|
---|
| 2745 | var CLASS_PREFIX = 'bs-tooltip';
|
---|
| 2746 | var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
|
---|
| 2747 | var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
|
---|
| 2748 | var DefaultType$4 = {
|
---|
| 2749 | animation: 'boolean',
|
---|
| 2750 | template: 'string',
|
---|
| 2751 | title: '(string|element|function)',
|
---|
| 2752 | trigger: 'string',
|
---|
| 2753 | delay: '(number|object)',
|
---|
| 2754 | html: 'boolean',
|
---|
| 2755 | selector: '(string|boolean)',
|
---|
| 2756 | placement: '(string|function)',
|
---|
| 2757 | offset: '(number|string|function)',
|
---|
| 2758 | container: '(string|element|boolean)',
|
---|
| 2759 | fallbackPlacement: '(string|array)',
|
---|
| 2760 | boundary: '(string|element)',
|
---|
| 2761 | sanitize: 'boolean',
|
---|
| 2762 | sanitizeFn: '(null|function)',
|
---|
| 2763 | whiteList: 'object'
|
---|
| 2764 | };
|
---|
| 2765 | var AttachmentMap$1 = {
|
---|
| 2766 | AUTO: 'auto',
|
---|
| 2767 | TOP: 'top',
|
---|
| 2768 | RIGHT: 'right',
|
---|
| 2769 | BOTTOM: 'bottom',
|
---|
| 2770 | LEFT: 'left'
|
---|
| 2771 | };
|
---|
| 2772 | var Default$4 = {
|
---|
| 2773 | animation: true,
|
---|
| 2774 | template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
|
---|
| 2775 | trigger: 'hover focus',
|
---|
| 2776 | title: '',
|
---|
| 2777 | delay: 0,
|
---|
| 2778 | html: false,
|
---|
| 2779 | selector: false,
|
---|
| 2780 | placement: 'top',
|
---|
| 2781 | offset: 0,
|
---|
| 2782 | container: false,
|
---|
| 2783 | fallbackPlacement: 'flip',
|
---|
| 2784 | boundary: 'scrollParent',
|
---|
| 2785 | sanitize: true,
|
---|
| 2786 | sanitizeFn: null,
|
---|
| 2787 | whiteList: DefaultWhitelist
|
---|
| 2788 | };
|
---|
| 2789 | var HoverState = {
|
---|
| 2790 | SHOW: 'show',
|
---|
| 2791 | OUT: 'out'
|
---|
| 2792 | };
|
---|
| 2793 | var Event$6 = {
|
---|
| 2794 | HIDE: "hide" + EVENT_KEY$6,
|
---|
| 2795 | HIDDEN: "hidden" + EVENT_KEY$6,
|
---|
| 2796 | SHOW: "show" + EVENT_KEY$6,
|
---|
| 2797 | SHOWN: "shown" + EVENT_KEY$6,
|
---|
| 2798 | INSERTED: "inserted" + EVENT_KEY$6,
|
---|
| 2799 | CLICK: "click" + EVENT_KEY$6,
|
---|
| 2800 | FOCUSIN: "focusin" + EVENT_KEY$6,
|
---|
| 2801 | FOCUSOUT: "focusout" + EVENT_KEY$6,
|
---|
| 2802 | MOUSEENTER: "mouseenter" + EVENT_KEY$6,
|
---|
| 2803 | MOUSELEAVE: "mouseleave" + EVENT_KEY$6
|
---|
| 2804 | };
|
---|
| 2805 | var ClassName$6 = {
|
---|
| 2806 | FADE: 'fade',
|
---|
| 2807 | SHOW: 'show'
|
---|
| 2808 | };
|
---|
| 2809 | var Selector$6 = {
|
---|
| 2810 | TOOLTIP: '.tooltip',
|
---|
| 2811 | TOOLTIP_INNER: '.tooltip-inner',
|
---|
| 2812 | ARROW: '.arrow'
|
---|
| 2813 | };
|
---|
| 2814 | var Trigger = {
|
---|
| 2815 | HOVER: 'hover',
|
---|
| 2816 | FOCUS: 'focus',
|
---|
| 2817 | CLICK: 'click',
|
---|
| 2818 | MANUAL: 'manual'
|
---|
| 2819 | /**
|
---|
| 2820 | * ------------------------------------------------------------------------
|
---|
| 2821 | * Class Definition
|
---|
| 2822 | * ------------------------------------------------------------------------
|
---|
| 2823 | */
|
---|
| 2824 |
|
---|
| 2825 | };
|
---|
| 2826 |
|
---|
| 2827 | var Tooltip =
|
---|
| 2828 | /*#__PURE__*/
|
---|
| 2829 | function () {
|
---|
| 2830 | function Tooltip(element, config) {
|
---|
| 2831 | /**
|
---|
| 2832 | * Check for Popper dependency
|
---|
| 2833 | * Popper - https://popper.js.org
|
---|
| 2834 | */
|
---|
| 2835 | if (typeof Popper === 'undefined') {
|
---|
| 2836 | throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
|
---|
| 2837 | } // private
|
---|
| 2838 |
|
---|
| 2839 |
|
---|
| 2840 | this._isEnabled = true;
|
---|
| 2841 | this._timeout = 0;
|
---|
| 2842 | this._hoverState = '';
|
---|
| 2843 | this._activeTrigger = {};
|
---|
| 2844 | this._popper = null; // Protected
|
---|
| 2845 |
|
---|
| 2846 | this.element = element;
|
---|
| 2847 | this.config = this._getConfig(config);
|
---|
| 2848 | this.tip = null;
|
---|
| 2849 |
|
---|
| 2850 | this._setListeners();
|
---|
| 2851 | } // Getters
|
---|
| 2852 |
|
---|
| 2853 |
|
---|
| 2854 | var _proto = Tooltip.prototype;
|
---|
| 2855 |
|
---|
| 2856 | // Public
|
---|
| 2857 | _proto.enable = function enable() {
|
---|
| 2858 | this._isEnabled = true;
|
---|
| 2859 | };
|
---|
| 2860 |
|
---|
| 2861 | _proto.disable = function disable() {
|
---|
| 2862 | this._isEnabled = false;
|
---|
| 2863 | };
|
---|
| 2864 |
|
---|
| 2865 | _proto.toggleEnabled = function toggleEnabled() {
|
---|
| 2866 | this._isEnabled = !this._isEnabled;
|
---|
| 2867 | };
|
---|
| 2868 |
|
---|
| 2869 | _proto.toggle = function toggle(event) {
|
---|
| 2870 | if (!this._isEnabled) {
|
---|
| 2871 | return;
|
---|
| 2872 | }
|
---|
| 2873 |
|
---|
| 2874 | if (event) {
|
---|
| 2875 | var dataKey = this.constructor.DATA_KEY;
|
---|
| 2876 | var context = $(event.currentTarget).data(dataKey);
|
---|
| 2877 |
|
---|
| 2878 | if (!context) {
|
---|
| 2879 | context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
---|
| 2880 | $(event.currentTarget).data(dataKey, context);
|
---|
| 2881 | }
|
---|
| 2882 |
|
---|
| 2883 | context._activeTrigger.click = !context._activeTrigger.click;
|
---|
| 2884 |
|
---|
| 2885 | if (context._isWithActiveTrigger()) {
|
---|
| 2886 | context._enter(null, context);
|
---|
| 2887 | } else {
|
---|
| 2888 | context._leave(null, context);
|
---|
| 2889 | }
|
---|
| 2890 | } else {
|
---|
| 2891 | if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
|
---|
| 2892 | this._leave(null, this);
|
---|
| 2893 |
|
---|
| 2894 | return;
|
---|
| 2895 | }
|
---|
| 2896 |
|
---|
| 2897 | this._enter(null, this);
|
---|
| 2898 | }
|
---|
| 2899 | };
|
---|
| 2900 |
|
---|
| 2901 | _proto.dispose = function dispose() {
|
---|
| 2902 | clearTimeout(this._timeout);
|
---|
| 2903 | $.removeData(this.element, this.constructor.DATA_KEY);
|
---|
| 2904 | $(this.element).off(this.constructor.EVENT_KEY);
|
---|
| 2905 | $(this.element).closest('.modal').off('hide.bs.modal');
|
---|
| 2906 |
|
---|
| 2907 | if (this.tip) {
|
---|
| 2908 | $(this.tip).remove();
|
---|
| 2909 | }
|
---|
| 2910 |
|
---|
| 2911 | this._isEnabled = null;
|
---|
| 2912 | this._timeout = null;
|
---|
| 2913 | this._hoverState = null;
|
---|
| 2914 | this._activeTrigger = null;
|
---|
| 2915 |
|
---|
| 2916 | if (this._popper !== null) {
|
---|
| 2917 | this._popper.destroy();
|
---|
| 2918 | }
|
---|
| 2919 |
|
---|
| 2920 | this._popper = null;
|
---|
| 2921 | this.element = null;
|
---|
| 2922 | this.config = null;
|
---|
| 2923 | this.tip = null;
|
---|
| 2924 | };
|
---|
| 2925 |
|
---|
| 2926 | _proto.show = function show() {
|
---|
| 2927 | var _this = this;
|
---|
| 2928 |
|
---|
| 2929 | if ($(this.element).css('display') === 'none') {
|
---|
| 2930 | throw new Error('Please use show on visible elements');
|
---|
| 2931 | }
|
---|
| 2932 |
|
---|
| 2933 | var showEvent = $.Event(this.constructor.Event.SHOW);
|
---|
| 2934 |
|
---|
| 2935 | if (this.isWithContent() && this._isEnabled) {
|
---|
| 2936 | $(this.element).trigger(showEvent);
|
---|
| 2937 | var shadowRoot = Util.findShadowRoot(this.element);
|
---|
| 2938 | var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
|
---|
| 2939 |
|
---|
| 2940 | if (showEvent.isDefaultPrevented() || !isInTheDom) {
|
---|
| 2941 | return;
|
---|
| 2942 | }
|
---|
| 2943 |
|
---|
| 2944 | var tip = this.getTipElement();
|
---|
| 2945 | var tipId = Util.getUID(this.constructor.NAME);
|
---|
| 2946 | tip.setAttribute('id', tipId);
|
---|
| 2947 | this.element.setAttribute('aria-describedby', tipId);
|
---|
| 2948 | this.setContent();
|
---|
| 2949 |
|
---|
| 2950 | if (this.config.animation) {
|
---|
| 2951 | $(tip).addClass(ClassName$6.FADE);
|
---|
| 2952 | }
|
---|
| 2953 |
|
---|
| 2954 | var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
|
---|
| 2955 |
|
---|
| 2956 | var attachment = this._getAttachment(placement);
|
---|
| 2957 |
|
---|
| 2958 | this.addAttachmentClass(attachment);
|
---|
| 2959 |
|
---|
| 2960 | var container = this._getContainer();
|
---|
| 2961 |
|
---|
| 2962 | $(tip).data(this.constructor.DATA_KEY, this);
|
---|
| 2963 |
|
---|
| 2964 | if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
|
---|
| 2965 | $(tip).appendTo(container);
|
---|
| 2966 | }
|
---|
| 2967 |
|
---|
| 2968 | $(this.element).trigger(this.constructor.Event.INSERTED);
|
---|
| 2969 | this._popper = new Popper(this.element, tip, {
|
---|
| 2970 | placement: attachment,
|
---|
| 2971 | modifiers: {
|
---|
| 2972 | offset: this._getOffset(),
|
---|
| 2973 | flip: {
|
---|
| 2974 | behavior: this.config.fallbackPlacement
|
---|
| 2975 | },
|
---|
| 2976 | arrow: {
|
---|
| 2977 | element: Selector$6.ARROW
|
---|
| 2978 | },
|
---|
| 2979 | preventOverflow: {
|
---|
| 2980 | boundariesElement: this.config.boundary
|
---|
| 2981 | }
|
---|
| 2982 | },
|
---|
| 2983 | onCreate: function onCreate(data) {
|
---|
| 2984 | if (data.originalPlacement !== data.placement) {
|
---|
| 2985 | _this._handlePopperPlacementChange(data);
|
---|
| 2986 | }
|
---|
| 2987 | },
|
---|
| 2988 | onUpdate: function onUpdate(data) {
|
---|
| 2989 | return _this._handlePopperPlacementChange(data);
|
---|
| 2990 | }
|
---|
| 2991 | });
|
---|
| 2992 | $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
|
---|
| 2993 | // empty mouseover listeners to the body's immediate children;
|
---|
| 2994 | // only needed because of broken event delegation on iOS
|
---|
| 2995 | // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
---|
| 2996 |
|
---|
| 2997 | if ('ontouchstart' in document.documentElement) {
|
---|
| 2998 | $(document.body).children().on('mouseover', null, $.noop);
|
---|
| 2999 | }
|
---|
| 3000 |
|
---|
| 3001 | var complete = function complete() {
|
---|
| 3002 | if (_this.config.animation) {
|
---|
| 3003 | _this._fixTransition();
|
---|
| 3004 | }
|
---|
| 3005 |
|
---|
| 3006 | var prevHoverState = _this._hoverState;
|
---|
| 3007 | _this._hoverState = null;
|
---|
| 3008 | $(_this.element).trigger(_this.constructor.Event.SHOWN);
|
---|
| 3009 |
|
---|
| 3010 | if (prevHoverState === HoverState.OUT) {
|
---|
| 3011 | _this._leave(null, _this);
|
---|
| 3012 | }
|
---|
| 3013 | };
|
---|
| 3014 |
|
---|
| 3015 | if ($(this.tip).hasClass(ClassName$6.FADE)) {
|
---|
| 3016 | var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
|
---|
| 3017 | $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
---|
| 3018 | } else {
|
---|
| 3019 | complete();
|
---|
| 3020 | }
|
---|
| 3021 | }
|
---|
| 3022 | };
|
---|
| 3023 |
|
---|
| 3024 | _proto.hide = function hide(callback) {
|
---|
| 3025 | var _this2 = this;
|
---|
| 3026 |
|
---|
| 3027 | var tip = this.getTipElement();
|
---|
| 3028 | var hideEvent = $.Event(this.constructor.Event.HIDE);
|
---|
| 3029 |
|
---|
| 3030 | var complete = function complete() {
|
---|
| 3031 | if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
|
---|
| 3032 | tip.parentNode.removeChild(tip);
|
---|
| 3033 | }
|
---|
| 3034 |
|
---|
| 3035 | _this2._cleanTipClass();
|
---|
| 3036 |
|
---|
| 3037 | _this2.element.removeAttribute('aria-describedby');
|
---|
| 3038 |
|
---|
| 3039 | $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
|
---|
| 3040 |
|
---|
| 3041 | if (_this2._popper !== null) {
|
---|
| 3042 | _this2._popper.destroy();
|
---|
| 3043 | }
|
---|
| 3044 |
|
---|
| 3045 | if (callback) {
|
---|
| 3046 | callback();
|
---|
| 3047 | }
|
---|
| 3048 | };
|
---|
| 3049 |
|
---|
| 3050 | $(this.element).trigger(hideEvent);
|
---|
| 3051 |
|
---|
| 3052 | if (hideEvent.isDefaultPrevented()) {
|
---|
| 3053 | return;
|
---|
| 3054 | }
|
---|
| 3055 |
|
---|
| 3056 | $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
|
---|
| 3057 | // empty mouseover listeners we added for iOS support
|
---|
| 3058 |
|
---|
| 3059 | if ('ontouchstart' in document.documentElement) {
|
---|
| 3060 | $(document.body).children().off('mouseover', null, $.noop);
|
---|
| 3061 | }
|
---|
| 3062 |
|
---|
| 3063 | this._activeTrigger[Trigger.CLICK] = false;
|
---|
| 3064 | this._activeTrigger[Trigger.FOCUS] = false;
|
---|
| 3065 | this._activeTrigger[Trigger.HOVER] = false;
|
---|
| 3066 |
|
---|
| 3067 | if ($(this.tip).hasClass(ClassName$6.FADE)) {
|
---|
| 3068 | var transitionDuration = Util.getTransitionDurationFromElement(tip);
|
---|
| 3069 | $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
---|
| 3070 | } else {
|
---|
| 3071 | complete();
|
---|
| 3072 | }
|
---|
| 3073 |
|
---|
| 3074 | this._hoverState = '';
|
---|
| 3075 | };
|
---|
| 3076 |
|
---|
| 3077 | _proto.update = function update() {
|
---|
| 3078 | if (this._popper !== null) {
|
---|
| 3079 | this._popper.scheduleUpdate();
|
---|
| 3080 | }
|
---|
| 3081 | } // Protected
|
---|
| 3082 | ;
|
---|
| 3083 |
|
---|
| 3084 | _proto.isWithContent = function isWithContent() {
|
---|
| 3085 | return Boolean(this.getTitle());
|
---|
| 3086 | };
|
---|
| 3087 |
|
---|
| 3088 | _proto.addAttachmentClass = function addAttachmentClass(attachment) {
|
---|
| 3089 | $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
|
---|
| 3090 | };
|
---|
| 3091 |
|
---|
| 3092 | _proto.getTipElement = function getTipElement() {
|
---|
| 3093 | this.tip = this.tip || $(this.config.template)[0];
|
---|
| 3094 | return this.tip;
|
---|
| 3095 | };
|
---|
| 3096 |
|
---|
| 3097 | _proto.setContent = function setContent() {
|
---|
| 3098 | var tip = this.getTipElement();
|
---|
| 3099 | this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
|
---|
| 3100 | $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
|
---|
| 3101 | };
|
---|
| 3102 |
|
---|
| 3103 | _proto.setElementContent = function setElementContent($element, content) {
|
---|
| 3104 | if (typeof content === 'object' && (content.nodeType || content.jquery)) {
|
---|
| 3105 | // Content is a DOM node or a jQuery
|
---|
| 3106 | if (this.config.html) {
|
---|
| 3107 | if (!$(content).parent().is($element)) {
|
---|
| 3108 | $element.empty().append(content);
|
---|
| 3109 | }
|
---|
| 3110 | } else {
|
---|
| 3111 | $element.text($(content).text());
|
---|
| 3112 | }
|
---|
| 3113 |
|
---|
| 3114 | return;
|
---|
| 3115 | }
|
---|
| 3116 |
|
---|
| 3117 | if (this.config.html) {
|
---|
| 3118 | if (this.config.sanitize) {
|
---|
| 3119 | content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
|
---|
| 3120 | }
|
---|
| 3121 |
|
---|
| 3122 | $element.html(content);
|
---|
| 3123 | } else {
|
---|
| 3124 | $element.text(content);
|
---|
| 3125 | }
|
---|
| 3126 | };
|
---|
| 3127 |
|
---|
| 3128 | _proto.getTitle = function getTitle() {
|
---|
| 3129 | var title = this.element.getAttribute('data-original-title');
|
---|
| 3130 |
|
---|
| 3131 | if (!title) {
|
---|
| 3132 | title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
|
---|
| 3133 | }
|
---|
| 3134 |
|
---|
| 3135 | return title;
|
---|
| 3136 | } // Private
|
---|
| 3137 | ;
|
---|
| 3138 |
|
---|
| 3139 | _proto._getOffset = function _getOffset() {
|
---|
| 3140 | var _this3 = this;
|
---|
| 3141 |
|
---|
| 3142 | var offset = {};
|
---|
| 3143 |
|
---|
| 3144 | if (typeof this.config.offset === 'function') {
|
---|
| 3145 | offset.fn = function (data) {
|
---|
| 3146 | data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {});
|
---|
| 3147 | return data;
|
---|
| 3148 | };
|
---|
| 3149 | } else {
|
---|
| 3150 | offset.offset = this.config.offset;
|
---|
| 3151 | }
|
---|
| 3152 |
|
---|
| 3153 | return offset;
|
---|
| 3154 | };
|
---|
| 3155 |
|
---|
| 3156 | _proto._getContainer = function _getContainer() {
|
---|
| 3157 | if (this.config.container === false) {
|
---|
| 3158 | return document.body;
|
---|
| 3159 | }
|
---|
| 3160 |
|
---|
| 3161 | if (Util.isElement(this.config.container)) {
|
---|
| 3162 | return $(this.config.container);
|
---|
| 3163 | }
|
---|
| 3164 |
|
---|
| 3165 | return $(document).find(this.config.container);
|
---|
| 3166 | };
|
---|
| 3167 |
|
---|
| 3168 | _proto._getAttachment = function _getAttachment(placement) {
|
---|
| 3169 | return AttachmentMap$1[placement.toUpperCase()];
|
---|
| 3170 | };
|
---|
| 3171 |
|
---|
| 3172 | _proto._setListeners = function _setListeners() {
|
---|
| 3173 | var _this4 = this;
|
---|
| 3174 |
|
---|
| 3175 | var triggers = this.config.trigger.split(' ');
|
---|
| 3176 | triggers.forEach(function (trigger) {
|
---|
| 3177 | if (trigger === 'click') {
|
---|
| 3178 | $(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) {
|
---|
| 3179 | return _this4.toggle(event);
|
---|
| 3180 | });
|
---|
| 3181 | } else if (trigger !== Trigger.MANUAL) {
|
---|
| 3182 | var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN;
|
---|
| 3183 | var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT;
|
---|
| 3184 | $(_this4.element).on(eventIn, _this4.config.selector, function (event) {
|
---|
| 3185 | return _this4._enter(event);
|
---|
| 3186 | }).on(eventOut, _this4.config.selector, function (event) {
|
---|
| 3187 | return _this4._leave(event);
|
---|
| 3188 | });
|
---|
| 3189 | }
|
---|
| 3190 | });
|
---|
| 3191 | $(this.element).closest('.modal').on('hide.bs.modal', function () {
|
---|
| 3192 | if (_this4.element) {
|
---|
| 3193 | _this4.hide();
|
---|
| 3194 | }
|
---|
| 3195 | });
|
---|
| 3196 |
|
---|
| 3197 | if (this.config.selector) {
|
---|
| 3198 | this.config = _objectSpread({}, this.config, {
|
---|
| 3199 | trigger: 'manual',
|
---|
| 3200 | selector: ''
|
---|
| 3201 | });
|
---|
| 3202 | } else {
|
---|
| 3203 | this._fixTitle();
|
---|
| 3204 | }
|
---|
| 3205 | };
|
---|
| 3206 |
|
---|
| 3207 | _proto._fixTitle = function _fixTitle() {
|
---|
| 3208 | var titleType = typeof this.element.getAttribute('data-original-title');
|
---|
| 3209 |
|
---|
| 3210 | if (this.element.getAttribute('title') || titleType !== 'string') {
|
---|
| 3211 | this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
|
---|
| 3212 | this.element.setAttribute('title', '');
|
---|
| 3213 | }
|
---|
| 3214 | };
|
---|
| 3215 |
|
---|
| 3216 | _proto._enter = function _enter(event, context) {
|
---|
| 3217 | var dataKey = this.constructor.DATA_KEY;
|
---|
| 3218 | context = context || $(event.currentTarget).data(dataKey);
|
---|
| 3219 |
|
---|
| 3220 | if (!context) {
|
---|
| 3221 | context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
---|
| 3222 | $(event.currentTarget).data(dataKey, context);
|
---|
| 3223 | }
|
---|
| 3224 |
|
---|
| 3225 | if (event) {
|
---|
| 3226 | context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
|
---|
| 3227 | }
|
---|
| 3228 |
|
---|
| 3229 | if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
|
---|
| 3230 | context._hoverState = HoverState.SHOW;
|
---|
| 3231 | return;
|
---|
| 3232 | }
|
---|
| 3233 |
|
---|
| 3234 | clearTimeout(context._timeout);
|
---|
| 3235 | context._hoverState = HoverState.SHOW;
|
---|
| 3236 |
|
---|
| 3237 | if (!context.config.delay || !context.config.delay.show) {
|
---|
| 3238 | context.show();
|
---|
| 3239 | return;
|
---|
| 3240 | }
|
---|
| 3241 |
|
---|
| 3242 | context._timeout = setTimeout(function () {
|
---|
| 3243 | if (context._hoverState === HoverState.SHOW) {
|
---|
| 3244 | context.show();
|
---|
| 3245 | }
|
---|
| 3246 | }, context.config.delay.show);
|
---|
| 3247 | };
|
---|
| 3248 |
|
---|
| 3249 | _proto._leave = function _leave(event, context) {
|
---|
| 3250 | var dataKey = this.constructor.DATA_KEY;
|
---|
| 3251 | context = context || $(event.currentTarget).data(dataKey);
|
---|
| 3252 |
|
---|
| 3253 | if (!context) {
|
---|
| 3254 | context = new this.constructor(event.currentTarget, this._getDelegateConfig());
|
---|
| 3255 | $(event.currentTarget).data(dataKey, context);
|
---|
| 3256 | }
|
---|
| 3257 |
|
---|
| 3258 | if (event) {
|
---|
| 3259 | context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
|
---|
| 3260 | }
|
---|
| 3261 |
|
---|
| 3262 | if (context._isWithActiveTrigger()) {
|
---|
| 3263 | return;
|
---|
| 3264 | }
|
---|
| 3265 |
|
---|
| 3266 | clearTimeout(context._timeout);
|
---|
| 3267 | context._hoverState = HoverState.OUT;
|
---|
| 3268 |
|
---|
| 3269 | if (!context.config.delay || !context.config.delay.hide) {
|
---|
| 3270 | context.hide();
|
---|
| 3271 | return;
|
---|
| 3272 | }
|
---|
| 3273 |
|
---|
| 3274 | context._timeout = setTimeout(function () {
|
---|
| 3275 | if (context._hoverState === HoverState.OUT) {
|
---|
| 3276 | context.hide();
|
---|
| 3277 | }
|
---|
| 3278 | }, context.config.delay.hide);
|
---|
| 3279 | };
|
---|
| 3280 |
|
---|
| 3281 | _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
|
---|
| 3282 | for (var trigger in this._activeTrigger) {
|
---|
| 3283 | if (this._activeTrigger[trigger]) {
|
---|
| 3284 | return true;
|
---|
| 3285 | }
|
---|
| 3286 | }
|
---|
| 3287 |
|
---|
| 3288 | return false;
|
---|
| 3289 | };
|
---|
| 3290 |
|
---|
| 3291 | _proto._getConfig = function _getConfig(config) {
|
---|
| 3292 | var dataAttributes = $(this.element).data();
|
---|
| 3293 | Object.keys(dataAttributes).forEach(function (dataAttr) {
|
---|
| 3294 | if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
|
---|
| 3295 | delete dataAttributes[dataAttr];
|
---|
| 3296 | }
|
---|
| 3297 | });
|
---|
| 3298 | config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {});
|
---|
| 3299 |
|
---|
| 3300 | if (typeof config.delay === 'number') {
|
---|
| 3301 | config.delay = {
|
---|
| 3302 | show: config.delay,
|
---|
| 3303 | hide: config.delay
|
---|
| 3304 | };
|
---|
| 3305 | }
|
---|
| 3306 |
|
---|
| 3307 | if (typeof config.title === 'number') {
|
---|
| 3308 | config.title = config.title.toString();
|
---|
| 3309 | }
|
---|
| 3310 |
|
---|
| 3311 | if (typeof config.content === 'number') {
|
---|
| 3312 | config.content = config.content.toString();
|
---|
| 3313 | }
|
---|
| 3314 |
|
---|
| 3315 | Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
|
---|
| 3316 |
|
---|
| 3317 | if (config.sanitize) {
|
---|
| 3318 | config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
|
---|
| 3319 | }
|
---|
| 3320 |
|
---|
| 3321 | return config;
|
---|
| 3322 | };
|
---|
| 3323 |
|
---|
| 3324 | _proto._getDelegateConfig = function _getDelegateConfig() {
|
---|
| 3325 | var config = {};
|
---|
| 3326 |
|
---|
| 3327 | if (this.config) {
|
---|
| 3328 | for (var key in this.config) {
|
---|
| 3329 | if (this.constructor.Default[key] !== this.config[key]) {
|
---|
| 3330 | config[key] = this.config[key];
|
---|
| 3331 | }
|
---|
| 3332 | }
|
---|
| 3333 | }
|
---|
| 3334 |
|
---|
| 3335 | return config;
|
---|
| 3336 | };
|
---|
| 3337 |
|
---|
| 3338 | _proto._cleanTipClass = function _cleanTipClass() {
|
---|
| 3339 | var $tip = $(this.getTipElement());
|
---|
| 3340 | var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
|
---|
| 3341 |
|
---|
| 3342 | if (tabClass !== null && tabClass.length) {
|
---|
| 3343 | $tip.removeClass(tabClass.join(''));
|
---|
| 3344 | }
|
---|
| 3345 | };
|
---|
| 3346 |
|
---|
| 3347 | _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
|
---|
| 3348 | var popperInstance = popperData.instance;
|
---|
| 3349 | this.tip = popperInstance.popper;
|
---|
| 3350 |
|
---|
| 3351 | this._cleanTipClass();
|
---|
| 3352 |
|
---|
| 3353 | this.addAttachmentClass(this._getAttachment(popperData.placement));
|
---|
| 3354 | };
|
---|
| 3355 |
|
---|
| 3356 | _proto._fixTransition = function _fixTransition() {
|
---|
| 3357 | var tip = this.getTipElement();
|
---|
| 3358 | var initConfigAnimation = this.config.animation;
|
---|
| 3359 |
|
---|
| 3360 | if (tip.getAttribute('x-placement') !== null) {
|
---|
| 3361 | return;
|
---|
| 3362 | }
|
---|
| 3363 |
|
---|
| 3364 | $(tip).removeClass(ClassName$6.FADE);
|
---|
| 3365 | this.config.animation = false;
|
---|
| 3366 | this.hide();
|
---|
| 3367 | this.show();
|
---|
| 3368 | this.config.animation = initConfigAnimation;
|
---|
| 3369 | } // Static
|
---|
| 3370 | ;
|
---|
| 3371 |
|
---|
| 3372 | Tooltip._jQueryInterface = function _jQueryInterface(config) {
|
---|
| 3373 | return this.each(function () {
|
---|
| 3374 | var data = $(this).data(DATA_KEY$6);
|
---|
| 3375 |
|
---|
| 3376 | var _config = typeof config === 'object' && config;
|
---|
| 3377 |
|
---|
| 3378 | if (!data && /dispose|hide/.test(config)) {
|
---|
| 3379 | return;
|
---|
| 3380 | }
|
---|
| 3381 |
|
---|
| 3382 | if (!data) {
|
---|
| 3383 | data = new Tooltip(this, _config);
|
---|
| 3384 | $(this).data(DATA_KEY$6, data);
|
---|
| 3385 | }
|
---|
| 3386 |
|
---|
| 3387 | if (typeof config === 'string') {
|
---|
| 3388 | if (typeof data[config] === 'undefined') {
|
---|
| 3389 | throw new TypeError("No method named \"" + config + "\"");
|
---|
| 3390 | }
|
---|
| 3391 |
|
---|
| 3392 | data[config]();
|
---|
| 3393 | }
|
---|
| 3394 | });
|
---|
| 3395 | };
|
---|
| 3396 |
|
---|
| 3397 | _createClass(Tooltip, null, [{
|
---|
| 3398 | key: "VERSION",
|
---|
| 3399 | get: function get() {
|
---|
| 3400 | return VERSION$6;
|
---|
| 3401 | }
|
---|
| 3402 | }, {
|
---|
| 3403 | key: "Default",
|
---|
| 3404 | get: function get() {
|
---|
| 3405 | return Default$4;
|
---|
| 3406 | }
|
---|
| 3407 | }, {
|
---|
| 3408 | key: "NAME",
|
---|
| 3409 | get: function get() {
|
---|
| 3410 | return NAME$6;
|
---|
| 3411 | }
|
---|
| 3412 | }, {
|
---|
| 3413 | key: "DATA_KEY",
|
---|
| 3414 | get: function get() {
|
---|
| 3415 | return DATA_KEY$6;
|
---|
| 3416 | }
|
---|
| 3417 | }, {
|
---|
| 3418 | key: "Event",
|
---|
| 3419 | get: function get() {
|
---|
| 3420 | return Event$6;
|
---|
| 3421 | }
|
---|
| 3422 | }, {
|
---|
| 3423 | key: "EVENT_KEY",
|
---|
| 3424 | get: function get() {
|
---|
| 3425 | return EVENT_KEY$6;
|
---|
| 3426 | }
|
---|
| 3427 | }, {
|
---|
| 3428 | key: "DefaultType",
|
---|
| 3429 | get: function get() {
|
---|
| 3430 | return DefaultType$4;
|
---|
| 3431 | }
|
---|
| 3432 | }]);
|
---|
| 3433 |
|
---|
| 3434 | return Tooltip;
|
---|
| 3435 | }();
|
---|
| 3436 | /**
|
---|
| 3437 | * ------------------------------------------------------------------------
|
---|
| 3438 | * jQuery
|
---|
| 3439 | * ------------------------------------------------------------------------
|
---|
| 3440 | */
|
---|
| 3441 |
|
---|
| 3442 |
|
---|
| 3443 | $.fn[NAME$6] = Tooltip._jQueryInterface;
|
---|
| 3444 | $.fn[NAME$6].Constructor = Tooltip;
|
---|
| 3445 |
|
---|
| 3446 | $.fn[NAME$6].noConflict = function () {
|
---|
| 3447 | $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
|
---|
| 3448 | return Tooltip._jQueryInterface;
|
---|
| 3449 | };
|
---|
| 3450 |
|
---|
| 3451 | /**
|
---|
| 3452 | * ------------------------------------------------------------------------
|
---|
| 3453 | * Constants
|
---|
| 3454 | * ------------------------------------------------------------------------
|
---|
| 3455 | */
|
---|
| 3456 |
|
---|
| 3457 | var NAME$7 = 'popover';
|
---|
| 3458 | var VERSION$7 = '4.3.1';
|
---|
| 3459 | var DATA_KEY$7 = 'bs.popover';
|
---|
| 3460 | var EVENT_KEY$7 = "." + DATA_KEY$7;
|
---|
| 3461 | var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
|
---|
| 3462 | var CLASS_PREFIX$1 = 'bs-popover';
|
---|
| 3463 | var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
|
---|
| 3464 |
|
---|
| 3465 | var Default$5 = _objectSpread({}, Tooltip.Default, {
|
---|
| 3466 | placement: 'right',
|
---|
| 3467 | trigger: 'click',
|
---|
| 3468 | content: '',
|
---|
| 3469 | template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
|
---|
| 3470 | });
|
---|
| 3471 |
|
---|
| 3472 | var DefaultType$5 = _objectSpread({}, Tooltip.DefaultType, {
|
---|
| 3473 | content: '(string|element|function)'
|
---|
| 3474 | });
|
---|
| 3475 |
|
---|
| 3476 | var ClassName$7 = {
|
---|
| 3477 | FADE: 'fade',
|
---|
| 3478 | SHOW: 'show'
|
---|
| 3479 | };
|
---|
| 3480 | var Selector$7 = {
|
---|
| 3481 | TITLE: '.popover-header',
|
---|
| 3482 | CONTENT: '.popover-body'
|
---|
| 3483 | };
|
---|
| 3484 | var Event$7 = {
|
---|
| 3485 | HIDE: "hide" + EVENT_KEY$7,
|
---|
| 3486 | HIDDEN: "hidden" + EVENT_KEY$7,
|
---|
| 3487 | SHOW: "show" + EVENT_KEY$7,
|
---|
| 3488 | SHOWN: "shown" + EVENT_KEY$7,
|
---|
| 3489 | INSERTED: "inserted" + EVENT_KEY$7,
|
---|
| 3490 | CLICK: "click" + EVENT_KEY$7,
|
---|
| 3491 | FOCUSIN: "focusin" + EVENT_KEY$7,
|
---|
| 3492 | FOCUSOUT: "focusout" + EVENT_KEY$7,
|
---|
| 3493 | MOUSEENTER: "mouseenter" + EVENT_KEY$7,
|
---|
| 3494 | MOUSELEAVE: "mouseleave" + EVENT_KEY$7
|
---|
| 3495 | /**
|
---|
| 3496 | * ------------------------------------------------------------------------
|
---|
| 3497 | * Class Definition
|
---|
| 3498 | * ------------------------------------------------------------------------
|
---|
| 3499 | */
|
---|
| 3500 |
|
---|
| 3501 | };
|
---|
| 3502 |
|
---|
| 3503 | var Popover =
|
---|
| 3504 | /*#__PURE__*/
|
---|
| 3505 | function (_Tooltip) {
|
---|
| 3506 | _inheritsLoose(Popover, _Tooltip);
|
---|
| 3507 |
|
---|
| 3508 | function Popover() {
|
---|
| 3509 | return _Tooltip.apply(this, arguments) || this;
|
---|
| 3510 | }
|
---|
| 3511 |
|
---|
| 3512 | var _proto = Popover.prototype;
|
---|
| 3513 |
|
---|
| 3514 | // Overrides
|
---|
| 3515 | _proto.isWithContent = function isWithContent() {
|
---|
| 3516 | return this.getTitle() || this._getContent();
|
---|
| 3517 | };
|
---|
| 3518 |
|
---|
| 3519 | _proto.addAttachmentClass = function addAttachmentClass(attachment) {
|
---|
| 3520 | $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
|
---|
| 3521 | };
|
---|
| 3522 |
|
---|
| 3523 | _proto.getTipElement = function getTipElement() {
|
---|
| 3524 | this.tip = this.tip || $(this.config.template)[0];
|
---|
| 3525 | return this.tip;
|
---|
| 3526 | };
|
---|
| 3527 |
|
---|
| 3528 | _proto.setContent = function setContent() {
|
---|
| 3529 | var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
|
---|
| 3530 |
|
---|
| 3531 | this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
|
---|
| 3532 |
|
---|
| 3533 | var content = this._getContent();
|
---|
| 3534 |
|
---|
| 3535 | if (typeof content === 'function') {
|
---|
| 3536 | content = content.call(this.element);
|
---|
| 3537 | }
|
---|
| 3538 |
|
---|
| 3539 | this.setElementContent($tip.find(Selector$7.CONTENT), content);
|
---|
| 3540 | $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
|
---|
| 3541 | } // Private
|
---|
| 3542 | ;
|
---|
| 3543 |
|
---|
| 3544 | _proto._getContent = function _getContent() {
|
---|
| 3545 | return this.element.getAttribute('data-content') || this.config.content;
|
---|
| 3546 | };
|
---|
| 3547 |
|
---|
| 3548 | _proto._cleanTipClass = function _cleanTipClass() {
|
---|
| 3549 | var $tip = $(this.getTipElement());
|
---|
| 3550 | var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
|
---|
| 3551 |
|
---|
| 3552 | if (tabClass !== null && tabClass.length > 0) {
|
---|
| 3553 | $tip.removeClass(tabClass.join(''));
|
---|
| 3554 | }
|
---|
| 3555 | } // Static
|
---|
| 3556 | ;
|
---|
| 3557 |
|
---|
| 3558 | Popover._jQueryInterface = function _jQueryInterface(config) {
|
---|
| 3559 | return this.each(function () {
|
---|
| 3560 | var data = $(this).data(DATA_KEY$7);
|
---|
| 3561 |
|
---|
| 3562 | var _config = typeof config === 'object' ? config : null;
|
---|
| 3563 |
|
---|
| 3564 | if (!data && /dispose|hide/.test(config)) {
|
---|
| 3565 | return;
|
---|
| 3566 | }
|
---|
| 3567 |
|
---|
| 3568 | if (!data) {
|
---|
| 3569 | data = new Popover(this, _config);
|
---|
| 3570 | $(this).data(DATA_KEY$7, data);
|
---|
| 3571 | }
|
---|
| 3572 |
|
---|
| 3573 | if (typeof config === 'string') {
|
---|
| 3574 | if (typeof data[config] === 'undefined') {
|
---|
| 3575 | throw new TypeError("No method named \"" + config + "\"");
|
---|
| 3576 | }
|
---|
| 3577 |
|
---|
| 3578 | data[config]();
|
---|
| 3579 | }
|
---|
| 3580 | });
|
---|
| 3581 | };
|
---|
| 3582 |
|
---|
| 3583 | _createClass(Popover, null, [{
|
---|
| 3584 | key: "VERSION",
|
---|
| 3585 | // Getters
|
---|
| 3586 | get: function get() {
|
---|
| 3587 | return VERSION$7;
|
---|
| 3588 | }
|
---|
| 3589 | }, {
|
---|
| 3590 | key: "Default",
|
---|
| 3591 | get: function get() {
|
---|
| 3592 | return Default$5;
|
---|
| 3593 | }
|
---|
| 3594 | }, {
|
---|
| 3595 | key: "NAME",
|
---|
| 3596 | get: function get() {
|
---|
| 3597 | return NAME$7;
|
---|
| 3598 | }
|
---|
| 3599 | }, {
|
---|
| 3600 | key: "DATA_KEY",
|
---|
| 3601 | get: function get() {
|
---|
| 3602 | return DATA_KEY$7;
|
---|
| 3603 | }
|
---|
| 3604 | }, {
|
---|
| 3605 | key: "Event",
|
---|
| 3606 | get: function get() {
|
---|
| 3607 | return Event$7;
|
---|
| 3608 | }
|
---|
| 3609 | }, {
|
---|
| 3610 | key: "EVENT_KEY",
|
---|
| 3611 | get: function get() {
|
---|
| 3612 | return EVENT_KEY$7;
|
---|
| 3613 | }
|
---|
| 3614 | }, {
|
---|
| 3615 | key: "DefaultType",
|
---|
| 3616 | get: function get() {
|
---|
| 3617 | return DefaultType$5;
|
---|
| 3618 | }
|
---|
| 3619 | }]);
|
---|
| 3620 |
|
---|
| 3621 | return Popover;
|
---|
| 3622 | }(Tooltip);
|
---|
| 3623 | /**
|
---|
| 3624 | * ------------------------------------------------------------------------
|
---|
| 3625 | * jQuery
|
---|
| 3626 | * ------------------------------------------------------------------------
|
---|
| 3627 | */
|
---|
| 3628 |
|
---|
| 3629 |
|
---|
| 3630 | $.fn[NAME$7] = Popover._jQueryInterface;
|
---|
| 3631 | $.fn[NAME$7].Constructor = Popover;
|
---|
| 3632 |
|
---|
| 3633 | $.fn[NAME$7].noConflict = function () {
|
---|
| 3634 | $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
|
---|
| 3635 | return Popover._jQueryInterface;
|
---|
| 3636 | };
|
---|
| 3637 |
|
---|
| 3638 | /**
|
---|
| 3639 | * ------------------------------------------------------------------------
|
---|
| 3640 | * Constants
|
---|
| 3641 | * ------------------------------------------------------------------------
|
---|
| 3642 | */
|
---|
| 3643 |
|
---|
| 3644 | var NAME$8 = 'scrollspy';
|
---|
| 3645 | var VERSION$8 = '4.3.1';
|
---|
| 3646 | var DATA_KEY$8 = 'bs.scrollspy';
|
---|
| 3647 | var EVENT_KEY$8 = "." + DATA_KEY$8;
|
---|
| 3648 | var DATA_API_KEY$6 = '.data-api';
|
---|
| 3649 | var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
|
---|
| 3650 | var Default$6 = {
|
---|
| 3651 | offset: 10,
|
---|
| 3652 | method: 'auto',
|
---|
| 3653 | target: ''
|
---|
| 3654 | };
|
---|
| 3655 | var DefaultType$6 = {
|
---|
| 3656 | offset: 'number',
|
---|
| 3657 | method: 'string',
|
---|
| 3658 | target: '(string|element)'
|
---|
| 3659 | };
|
---|
| 3660 | var Event$8 = {
|
---|
| 3661 | ACTIVATE: "activate" + EVENT_KEY$8,
|
---|
| 3662 | SCROLL: "scroll" + EVENT_KEY$8,
|
---|
| 3663 | LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
|
---|
| 3664 | };
|
---|
| 3665 | var ClassName$8 = {
|
---|
| 3666 | DROPDOWN_ITEM: 'dropdown-item',
|
---|
| 3667 | DROPDOWN_MENU: 'dropdown-menu',
|
---|
| 3668 | ACTIVE: 'active'
|
---|
| 3669 | };
|
---|
| 3670 | var Selector$8 = {
|
---|
| 3671 | DATA_SPY: '[data-spy="scroll"]',
|
---|
| 3672 | ACTIVE: '.active',
|
---|
| 3673 | NAV_LIST_GROUP: '.nav, .list-group',
|
---|
| 3674 | NAV_LINKS: '.nav-link',
|
---|
| 3675 | NAV_ITEMS: '.nav-item',
|
---|
| 3676 | LIST_ITEMS: '.list-group-item',
|
---|
| 3677 | DROPDOWN: '.dropdown',
|
---|
| 3678 | DROPDOWN_ITEMS: '.dropdown-item',
|
---|
| 3679 | DROPDOWN_TOGGLE: '.dropdown-toggle'
|
---|
| 3680 | };
|
---|
| 3681 | var OffsetMethod = {
|
---|
| 3682 | OFFSET: 'offset',
|
---|
| 3683 | POSITION: 'position'
|
---|
| 3684 | /**
|
---|
| 3685 | * ------------------------------------------------------------------------
|
---|
| 3686 | * Class Definition
|
---|
| 3687 | * ------------------------------------------------------------------------
|
---|
| 3688 | */
|
---|
| 3689 |
|
---|
| 3690 | };
|
---|
| 3691 |
|
---|
| 3692 | var ScrollSpy =
|
---|
| 3693 | /*#__PURE__*/
|
---|
| 3694 | function () {
|
---|
| 3695 | function ScrollSpy(element, config) {
|
---|
| 3696 | var _this = this;
|
---|
| 3697 |
|
---|
| 3698 | this._element = element;
|
---|
| 3699 | this._scrollElement = element.tagName === 'BODY' ? window : element;
|
---|
| 3700 | this._config = this._getConfig(config);
|
---|
| 3701 | this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
|
---|
| 3702 | this._offsets = [];
|
---|
| 3703 | this._targets = [];
|
---|
| 3704 | this._activeTarget = null;
|
---|
| 3705 | this._scrollHeight = 0;
|
---|
| 3706 | $(this._scrollElement).on(Event$8.SCROLL, function (event) {
|
---|
| 3707 | return _this._process(event);
|
---|
| 3708 | });
|
---|
| 3709 | this.refresh();
|
---|
| 3710 |
|
---|
| 3711 | this._process();
|
---|
| 3712 | } // Getters
|
---|
| 3713 |
|
---|
| 3714 |
|
---|
| 3715 | var _proto = ScrollSpy.prototype;
|
---|
| 3716 |
|
---|
| 3717 | // Public
|
---|
| 3718 | _proto.refresh = function refresh() {
|
---|
| 3719 | var _this2 = this;
|
---|
| 3720 |
|
---|
| 3721 | var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
|
---|
| 3722 | var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
|
---|
| 3723 | var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
|
---|
| 3724 | this._offsets = [];
|
---|
| 3725 | this._targets = [];
|
---|
| 3726 | this._scrollHeight = this._getScrollHeight();
|
---|
| 3727 | var targets = [].slice.call(document.querySelectorAll(this._selector));
|
---|
| 3728 | targets.map(function (element) {
|
---|
| 3729 | var target;
|
---|
| 3730 | var targetSelector = Util.getSelectorFromElement(element);
|
---|
| 3731 |
|
---|
| 3732 | if (targetSelector) {
|
---|
| 3733 | target = document.querySelector(targetSelector);
|
---|
| 3734 | }
|
---|
| 3735 |
|
---|
| 3736 | if (target) {
|
---|
| 3737 | var targetBCR = target.getBoundingClientRect();
|
---|
| 3738 |
|
---|
| 3739 | if (targetBCR.width || targetBCR.height) {
|
---|
| 3740 | // TODO (fat): remove sketch reliance on jQuery position/offset
|
---|
| 3741 | return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
|
---|
| 3742 | }
|
---|
| 3743 | }
|
---|
| 3744 |
|
---|
| 3745 | return null;
|
---|
| 3746 | }).filter(function (item) {
|
---|
| 3747 | return item;
|
---|
| 3748 | }).sort(function (a, b) {
|
---|
| 3749 | return a[0] - b[0];
|
---|
| 3750 | }).forEach(function (item) {
|
---|
| 3751 | _this2._offsets.push(item[0]);
|
---|
| 3752 |
|
---|
| 3753 | _this2._targets.push(item[1]);
|
---|
| 3754 | });
|
---|
| 3755 | };
|
---|
| 3756 |
|
---|
| 3757 | _proto.dispose = function dispose() {
|
---|
| 3758 | $.removeData(this._element, DATA_KEY$8);
|
---|
| 3759 | $(this._scrollElement).off(EVENT_KEY$8);
|
---|
| 3760 | this._element = null;
|
---|
| 3761 | this._scrollElement = null;
|
---|
| 3762 | this._config = null;
|
---|
| 3763 | this._selector = null;
|
---|
| 3764 | this._offsets = null;
|
---|
| 3765 | this._targets = null;
|
---|
| 3766 | this._activeTarget = null;
|
---|
| 3767 | this._scrollHeight = null;
|
---|
| 3768 | } // Private
|
---|
| 3769 | ;
|
---|
| 3770 |
|
---|
| 3771 | _proto._getConfig = function _getConfig(config) {
|
---|
| 3772 | config = _objectSpread({}, Default$6, typeof config === 'object' && config ? config : {});
|
---|
| 3773 |
|
---|
| 3774 | if (typeof config.target !== 'string') {
|
---|
| 3775 | var id = $(config.target).attr('id');
|
---|
| 3776 |
|
---|
| 3777 | if (!id) {
|
---|
| 3778 | id = Util.getUID(NAME$8);
|
---|
| 3779 | $(config.target).attr('id', id);
|
---|
| 3780 | }
|
---|
| 3781 |
|
---|
| 3782 | config.target = "#" + id;
|
---|
| 3783 | }
|
---|
| 3784 |
|
---|
| 3785 | Util.typeCheckConfig(NAME$8, config, DefaultType$6);
|
---|
| 3786 | return config;
|
---|
| 3787 | };
|
---|
| 3788 |
|
---|
| 3789 | _proto._getScrollTop = function _getScrollTop() {
|
---|
| 3790 | return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
|
---|
| 3791 | };
|
---|
| 3792 |
|
---|
| 3793 | _proto._getScrollHeight = function _getScrollHeight() {
|
---|
| 3794 | return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
|
---|
| 3795 | };
|
---|
| 3796 |
|
---|
| 3797 | _proto._getOffsetHeight = function _getOffsetHeight() {
|
---|
| 3798 | return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
|
---|
| 3799 | };
|
---|
| 3800 |
|
---|
| 3801 | _proto._process = function _process() {
|
---|
| 3802 | var scrollTop = this._getScrollTop() + this._config.offset;
|
---|
| 3803 |
|
---|
| 3804 | var scrollHeight = this._getScrollHeight();
|
---|
| 3805 |
|
---|
| 3806 | var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
|
---|
| 3807 |
|
---|
| 3808 | if (this._scrollHeight !== scrollHeight) {
|
---|
| 3809 | this.refresh();
|
---|
| 3810 | }
|
---|
| 3811 |
|
---|
| 3812 | if (scrollTop >= maxScroll) {
|
---|
| 3813 | var target = this._targets[this._targets.length - 1];
|
---|
| 3814 |
|
---|
| 3815 | if (this._activeTarget !== target) {
|
---|
| 3816 | this._activate(target);
|
---|
| 3817 | }
|
---|
| 3818 |
|
---|
| 3819 | return;
|
---|
| 3820 | }
|
---|
| 3821 |
|
---|
| 3822 | if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
|
---|
| 3823 | this._activeTarget = null;
|
---|
| 3824 |
|
---|
| 3825 | this._clear();
|
---|
| 3826 |
|
---|
| 3827 | return;
|
---|
| 3828 | }
|
---|
| 3829 |
|
---|
| 3830 | var offsetLength = this._offsets.length;
|
---|
| 3831 |
|
---|
| 3832 | for (var i = offsetLength; i--;) {
|
---|
| 3833 | var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
|
---|
| 3834 |
|
---|
| 3835 | if (isActiveTarget) {
|
---|
| 3836 | this._activate(this._targets[i]);
|
---|
| 3837 | }
|
---|
| 3838 | }
|
---|
| 3839 | };
|
---|
| 3840 |
|
---|
| 3841 | _proto._activate = function _activate(target) {
|
---|
| 3842 | this._activeTarget = target;
|
---|
| 3843 |
|
---|
| 3844 | this._clear();
|
---|
| 3845 |
|
---|
| 3846 | var queries = this._selector.split(',').map(function (selector) {
|
---|
| 3847 | return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
|
---|
| 3848 | });
|
---|
| 3849 |
|
---|
| 3850 | var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
|
---|
| 3851 |
|
---|
| 3852 | if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
|
---|
| 3853 | $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
|
---|
| 3854 | $link.addClass(ClassName$8.ACTIVE);
|
---|
| 3855 | } else {
|
---|
| 3856 | // Set triggered link as active
|
---|
| 3857 | $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
|
---|
| 3858 | // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
---|
| 3859 |
|
---|
| 3860 | $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item
|
---|
| 3861 |
|
---|
| 3862 | $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
|
---|
| 3863 | }
|
---|
| 3864 |
|
---|
| 3865 | $(this._scrollElement).trigger(Event$8.ACTIVATE, {
|
---|
| 3866 | relatedTarget: target
|
---|
| 3867 | });
|
---|
| 3868 | };
|
---|
| 3869 |
|
---|
| 3870 | _proto._clear = function _clear() {
|
---|
| 3871 | [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
|
---|
| 3872 | return node.classList.contains(ClassName$8.ACTIVE);
|
---|
| 3873 | }).forEach(function (node) {
|
---|
| 3874 | return node.classList.remove(ClassName$8.ACTIVE);
|
---|
| 3875 | });
|
---|
| 3876 | } // Static
|
---|
| 3877 | ;
|
---|
| 3878 |
|
---|
| 3879 | ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
|
---|
| 3880 | return this.each(function () {
|
---|
| 3881 | var data = $(this).data(DATA_KEY$8);
|
---|
| 3882 |
|
---|
| 3883 | var _config = typeof config === 'object' && config;
|
---|
| 3884 |
|
---|
| 3885 | if (!data) {
|
---|
| 3886 | data = new ScrollSpy(this, _config);
|
---|
| 3887 | $(this).data(DATA_KEY$8, data);
|
---|
| 3888 | }
|
---|
| 3889 |
|
---|
| 3890 | if (typeof config === 'string') {
|
---|
| 3891 | if (typeof data[config] === 'undefined') {
|
---|
| 3892 | throw new TypeError("No method named \"" + config + "\"");
|
---|
| 3893 | }
|
---|
| 3894 |
|
---|
| 3895 | data[config]();
|
---|
| 3896 | }
|
---|
| 3897 | });
|
---|
| 3898 | };
|
---|
| 3899 |
|
---|
| 3900 | _createClass(ScrollSpy, null, [{
|
---|
| 3901 | key: "VERSION",
|
---|
| 3902 | get: function get() {
|
---|
| 3903 | return VERSION$8;
|
---|
| 3904 | }
|
---|
| 3905 | }, {
|
---|
| 3906 | key: "Default",
|
---|
| 3907 | get: function get() {
|
---|
| 3908 | return Default$6;
|
---|
| 3909 | }
|
---|
| 3910 | }]);
|
---|
| 3911 |
|
---|
| 3912 | return ScrollSpy;
|
---|
| 3913 | }();
|
---|
| 3914 | /**
|
---|
| 3915 | * ------------------------------------------------------------------------
|
---|
| 3916 | * Data Api implementation
|
---|
| 3917 | * ------------------------------------------------------------------------
|
---|
| 3918 | */
|
---|
| 3919 |
|
---|
| 3920 |
|
---|
| 3921 | $(window).on(Event$8.LOAD_DATA_API, function () {
|
---|
| 3922 | var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
|
---|
| 3923 | var scrollSpysLength = scrollSpys.length;
|
---|
| 3924 |
|
---|
| 3925 | for (var i = scrollSpysLength; i--;) {
|
---|
| 3926 | var $spy = $(scrollSpys[i]);
|
---|
| 3927 |
|
---|
| 3928 | ScrollSpy._jQueryInterface.call($spy, $spy.data());
|
---|
| 3929 | }
|
---|
| 3930 | });
|
---|
| 3931 | /**
|
---|
| 3932 | * ------------------------------------------------------------------------
|
---|
| 3933 | * jQuery
|
---|
| 3934 | * ------------------------------------------------------------------------
|
---|
| 3935 | */
|
---|
| 3936 |
|
---|
| 3937 | $.fn[NAME$8] = ScrollSpy._jQueryInterface;
|
---|
| 3938 | $.fn[NAME$8].Constructor = ScrollSpy;
|
---|
| 3939 |
|
---|
| 3940 | $.fn[NAME$8].noConflict = function () {
|
---|
| 3941 | $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
|
---|
| 3942 | return ScrollSpy._jQueryInterface;
|
---|
| 3943 | };
|
---|
| 3944 |
|
---|
| 3945 | /**
|
---|
| 3946 | * ------------------------------------------------------------------------
|
---|
| 3947 | * Constants
|
---|
| 3948 | * ------------------------------------------------------------------------
|
---|
| 3949 | */
|
---|
| 3950 |
|
---|
| 3951 | var NAME$9 = 'tab';
|
---|
| 3952 | var VERSION$9 = '4.3.1';
|
---|
| 3953 | var DATA_KEY$9 = 'bs.tab';
|
---|
| 3954 | var EVENT_KEY$9 = "." + DATA_KEY$9;
|
---|
| 3955 | var DATA_API_KEY$7 = '.data-api';
|
---|
| 3956 | var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
|
---|
| 3957 | var Event$9 = {
|
---|
| 3958 | HIDE: "hide" + EVENT_KEY$9,
|
---|
| 3959 | HIDDEN: "hidden" + EVENT_KEY$9,
|
---|
| 3960 | SHOW: "show" + EVENT_KEY$9,
|
---|
| 3961 | SHOWN: "shown" + EVENT_KEY$9,
|
---|
| 3962 | CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
|
---|
| 3963 | };
|
---|
| 3964 | var ClassName$9 = {
|
---|
| 3965 | DROPDOWN_MENU: 'dropdown-menu',
|
---|
| 3966 | ACTIVE: 'active',
|
---|
| 3967 | DISABLED: 'disabled',
|
---|
| 3968 | FADE: 'fade',
|
---|
| 3969 | SHOW: 'show'
|
---|
| 3970 | };
|
---|
| 3971 | var Selector$9 = {
|
---|
| 3972 | DROPDOWN: '.dropdown',
|
---|
| 3973 | NAV_LIST_GROUP: '.nav, .list-group',
|
---|
| 3974 | ACTIVE: '.active',
|
---|
| 3975 | ACTIVE_UL: '> li > .active',
|
---|
| 3976 | DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
|
---|
| 3977 | DROPDOWN_TOGGLE: '.dropdown-toggle',
|
---|
| 3978 | DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
|
---|
| 3979 | /**
|
---|
| 3980 | * ------------------------------------------------------------------------
|
---|
| 3981 | * Class Definition
|
---|
| 3982 | * ------------------------------------------------------------------------
|
---|
| 3983 | */
|
---|
| 3984 |
|
---|
| 3985 | };
|
---|
| 3986 |
|
---|
| 3987 | var Tab =
|
---|
| 3988 | /*#__PURE__*/
|
---|
| 3989 | function () {
|
---|
| 3990 | function Tab(element) {
|
---|
| 3991 | this._element = element;
|
---|
| 3992 | } // Getters
|
---|
| 3993 |
|
---|
| 3994 |
|
---|
| 3995 | var _proto = Tab.prototype;
|
---|
| 3996 |
|
---|
| 3997 | // Public
|
---|
| 3998 | _proto.show = function show() {
|
---|
| 3999 | var _this = this;
|
---|
| 4000 |
|
---|
| 4001 | if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
|
---|
| 4002 | return;
|
---|
| 4003 | }
|
---|
| 4004 |
|
---|
| 4005 | var target;
|
---|
| 4006 | var previous;
|
---|
| 4007 | var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
|
---|
| 4008 | var selector = Util.getSelectorFromElement(this._element);
|
---|
| 4009 |
|
---|
| 4010 | if (listElement) {
|
---|
| 4011 | var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
|
---|
| 4012 | previous = $.makeArray($(listElement).find(itemSelector));
|
---|
| 4013 | previous = previous[previous.length - 1];
|
---|
| 4014 | }
|
---|
| 4015 |
|
---|
| 4016 | var hideEvent = $.Event(Event$9.HIDE, {
|
---|
| 4017 | relatedTarget: this._element
|
---|
| 4018 | });
|
---|
| 4019 | var showEvent = $.Event(Event$9.SHOW, {
|
---|
| 4020 | relatedTarget: previous
|
---|
| 4021 | });
|
---|
| 4022 |
|
---|
| 4023 | if (previous) {
|
---|
| 4024 | $(previous).trigger(hideEvent);
|
---|
| 4025 | }
|
---|
| 4026 |
|
---|
| 4027 | $(this._element).trigger(showEvent);
|
---|
| 4028 |
|
---|
| 4029 | if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
|
---|
| 4030 | return;
|
---|
| 4031 | }
|
---|
| 4032 |
|
---|
| 4033 | if (selector) {
|
---|
| 4034 | target = document.querySelector(selector);
|
---|
| 4035 | }
|
---|
| 4036 |
|
---|
| 4037 | this._activate(this._element, listElement);
|
---|
| 4038 |
|
---|
| 4039 | var complete = function complete() {
|
---|
| 4040 | var hiddenEvent = $.Event(Event$9.HIDDEN, {
|
---|
| 4041 | relatedTarget: _this._element
|
---|
| 4042 | });
|
---|
| 4043 | var shownEvent = $.Event(Event$9.SHOWN, {
|
---|
| 4044 | relatedTarget: previous
|
---|
| 4045 | });
|
---|
| 4046 | $(previous).trigger(hiddenEvent);
|
---|
| 4047 | $(_this._element).trigger(shownEvent);
|
---|
| 4048 | };
|
---|
| 4049 |
|
---|
| 4050 | if (target) {
|
---|
| 4051 | this._activate(target, target.parentNode, complete);
|
---|
| 4052 | } else {
|
---|
| 4053 | complete();
|
---|
| 4054 | }
|
---|
| 4055 | };
|
---|
| 4056 |
|
---|
| 4057 | _proto.dispose = function dispose() {
|
---|
| 4058 | $.removeData(this._element, DATA_KEY$9);
|
---|
| 4059 | this._element = null;
|
---|
| 4060 | } // Private
|
---|
| 4061 | ;
|
---|
| 4062 |
|
---|
| 4063 | _proto._activate = function _activate(element, container, callback) {
|
---|
| 4064 | var _this2 = this;
|
---|
| 4065 |
|
---|
| 4066 | var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
|
---|
| 4067 | var active = activeElements[0];
|
---|
| 4068 | var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
|
---|
| 4069 |
|
---|
| 4070 | var complete = function complete() {
|
---|
| 4071 | return _this2._transitionComplete(element, active, callback);
|
---|
| 4072 | };
|
---|
| 4073 |
|
---|
| 4074 | if (active && isTransitioning) {
|
---|
| 4075 | var transitionDuration = Util.getTransitionDurationFromElement(active);
|
---|
| 4076 | $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
---|
| 4077 | } else {
|
---|
| 4078 | complete();
|
---|
| 4079 | }
|
---|
| 4080 | };
|
---|
| 4081 |
|
---|
| 4082 | _proto._transitionComplete = function _transitionComplete(element, active, callback) {
|
---|
| 4083 | if (active) {
|
---|
| 4084 | $(active).removeClass(ClassName$9.ACTIVE);
|
---|
| 4085 | var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
|
---|
| 4086 |
|
---|
| 4087 | if (dropdownChild) {
|
---|
| 4088 | $(dropdownChild).removeClass(ClassName$9.ACTIVE);
|
---|
| 4089 | }
|
---|
| 4090 |
|
---|
| 4091 | if (active.getAttribute('role') === 'tab') {
|
---|
| 4092 | active.setAttribute('aria-selected', false);
|
---|
| 4093 | }
|
---|
| 4094 | }
|
---|
| 4095 |
|
---|
| 4096 | $(element).addClass(ClassName$9.ACTIVE);
|
---|
| 4097 |
|
---|
| 4098 | if (element.getAttribute('role') === 'tab') {
|
---|
| 4099 | element.setAttribute('aria-selected', true);
|
---|
| 4100 | }
|
---|
| 4101 |
|
---|
| 4102 | Util.reflow(element);
|
---|
| 4103 |
|
---|
| 4104 | if (element.classList.contains(ClassName$9.FADE)) {
|
---|
| 4105 | element.classList.add(ClassName$9.SHOW);
|
---|
| 4106 | }
|
---|
| 4107 |
|
---|
| 4108 | if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
|
---|
| 4109 | var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
|
---|
| 4110 |
|
---|
| 4111 | if (dropdownElement) {
|
---|
| 4112 | var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
|
---|
| 4113 | $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
|
---|
| 4114 | }
|
---|
| 4115 |
|
---|
| 4116 | element.setAttribute('aria-expanded', true);
|
---|
| 4117 | }
|
---|
| 4118 |
|
---|
| 4119 | if (callback) {
|
---|
| 4120 | callback();
|
---|
| 4121 | }
|
---|
| 4122 | } // Static
|
---|
| 4123 | ;
|
---|
| 4124 |
|
---|
| 4125 | Tab._jQueryInterface = function _jQueryInterface(config) {
|
---|
| 4126 | return this.each(function () {
|
---|
| 4127 | var $this = $(this);
|
---|
| 4128 | var data = $this.data(DATA_KEY$9);
|
---|
| 4129 |
|
---|
| 4130 | if (!data) {
|
---|
| 4131 | data = new Tab(this);
|
---|
| 4132 | $this.data(DATA_KEY$9, data);
|
---|
| 4133 | }
|
---|
| 4134 |
|
---|
| 4135 | if (typeof config === 'string') {
|
---|
| 4136 | if (typeof data[config] === 'undefined') {
|
---|
| 4137 | throw new TypeError("No method named \"" + config + "\"");
|
---|
| 4138 | }
|
---|
| 4139 |
|
---|
| 4140 | data[config]();
|
---|
| 4141 | }
|
---|
| 4142 | });
|
---|
| 4143 | };
|
---|
| 4144 |
|
---|
| 4145 | _createClass(Tab, null, [{
|
---|
| 4146 | key: "VERSION",
|
---|
| 4147 | get: function get() {
|
---|
| 4148 | return VERSION$9;
|
---|
| 4149 | }
|
---|
| 4150 | }]);
|
---|
| 4151 |
|
---|
| 4152 | return Tab;
|
---|
| 4153 | }();
|
---|
| 4154 | /**
|
---|
| 4155 | * ------------------------------------------------------------------------
|
---|
| 4156 | * Data Api implementation
|
---|
| 4157 | * ------------------------------------------------------------------------
|
---|
| 4158 | */
|
---|
| 4159 |
|
---|
| 4160 |
|
---|
| 4161 | $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
|
---|
| 4162 | event.preventDefault();
|
---|
| 4163 |
|
---|
| 4164 | Tab._jQueryInterface.call($(this), 'show');
|
---|
| 4165 | });
|
---|
| 4166 | /**
|
---|
| 4167 | * ------------------------------------------------------------------------
|
---|
| 4168 | * jQuery
|
---|
| 4169 | * ------------------------------------------------------------------------
|
---|
| 4170 | */
|
---|
| 4171 |
|
---|
| 4172 | $.fn[NAME$9] = Tab._jQueryInterface;
|
---|
| 4173 | $.fn[NAME$9].Constructor = Tab;
|
---|
| 4174 |
|
---|
| 4175 | $.fn[NAME$9].noConflict = function () {
|
---|
| 4176 | $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
|
---|
| 4177 | return Tab._jQueryInterface;
|
---|
| 4178 | };
|
---|
| 4179 |
|
---|
| 4180 | /**
|
---|
| 4181 | * ------------------------------------------------------------------------
|
---|
| 4182 | * Constants
|
---|
| 4183 | * ------------------------------------------------------------------------
|
---|
| 4184 | */
|
---|
| 4185 |
|
---|
| 4186 | var NAME$a = 'toast';
|
---|
| 4187 | var VERSION$a = '4.3.1';
|
---|
| 4188 | var DATA_KEY$a = 'bs.toast';
|
---|
| 4189 | var EVENT_KEY$a = "." + DATA_KEY$a;
|
---|
| 4190 | var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
|
---|
| 4191 | var Event$a = {
|
---|
| 4192 | CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
|
---|
| 4193 | HIDE: "hide" + EVENT_KEY$a,
|
---|
| 4194 | HIDDEN: "hidden" + EVENT_KEY$a,
|
---|
| 4195 | SHOW: "show" + EVENT_KEY$a,
|
---|
| 4196 | SHOWN: "shown" + EVENT_KEY$a
|
---|
| 4197 | };
|
---|
| 4198 | var ClassName$a = {
|
---|
| 4199 | FADE: 'fade',
|
---|
| 4200 | HIDE: 'hide',
|
---|
| 4201 | SHOW: 'show',
|
---|
| 4202 | SHOWING: 'showing'
|
---|
| 4203 | };
|
---|
| 4204 | var DefaultType$7 = {
|
---|
| 4205 | animation: 'boolean',
|
---|
| 4206 | autohide: 'boolean',
|
---|
| 4207 | delay: 'number'
|
---|
| 4208 | };
|
---|
| 4209 | var Default$7 = {
|
---|
| 4210 | animation: true,
|
---|
| 4211 | autohide: true,
|
---|
| 4212 | delay: 500
|
---|
| 4213 | };
|
---|
| 4214 | var Selector$a = {
|
---|
| 4215 | DATA_DISMISS: '[data-dismiss="toast"]'
|
---|
| 4216 | /**
|
---|
| 4217 | * ------------------------------------------------------------------------
|
---|
| 4218 | * Class Definition
|
---|
| 4219 | * ------------------------------------------------------------------------
|
---|
| 4220 | */
|
---|
| 4221 |
|
---|
| 4222 | };
|
---|
| 4223 |
|
---|
| 4224 | var Toast =
|
---|
| 4225 | /*#__PURE__*/
|
---|
| 4226 | function () {
|
---|
| 4227 | function Toast(element, config) {
|
---|
| 4228 | this._element = element;
|
---|
| 4229 | this._config = this._getConfig(config);
|
---|
| 4230 | this._timeout = null;
|
---|
| 4231 |
|
---|
| 4232 | this._setListeners();
|
---|
| 4233 | } // Getters
|
---|
| 4234 |
|
---|
| 4235 |
|
---|
| 4236 | var _proto = Toast.prototype;
|
---|
| 4237 |
|
---|
| 4238 | // Public
|
---|
| 4239 | _proto.show = function show() {
|
---|
| 4240 | var _this = this;
|
---|
| 4241 |
|
---|
| 4242 | $(this._element).trigger(Event$a.SHOW);
|
---|
| 4243 |
|
---|
| 4244 | if (this._config.animation) {
|
---|
| 4245 | this._element.classList.add(ClassName$a.FADE);
|
---|
| 4246 | }
|
---|
| 4247 |
|
---|
| 4248 | var complete = function complete() {
|
---|
| 4249 | _this._element.classList.remove(ClassName$a.SHOWING);
|
---|
| 4250 |
|
---|
| 4251 | _this._element.classList.add(ClassName$a.SHOW);
|
---|
| 4252 |
|
---|
| 4253 | $(_this._element).trigger(Event$a.SHOWN);
|
---|
| 4254 |
|
---|
| 4255 | if (_this._config.autohide) {
|
---|
| 4256 | _this.hide();
|
---|
| 4257 | }
|
---|
| 4258 | };
|
---|
| 4259 |
|
---|
| 4260 | this._element.classList.remove(ClassName$a.HIDE);
|
---|
| 4261 |
|
---|
| 4262 | this._element.classList.add(ClassName$a.SHOWING);
|
---|
| 4263 |
|
---|
| 4264 | if (this._config.animation) {
|
---|
| 4265 | var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
---|
| 4266 | $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
---|
| 4267 | } else {
|
---|
| 4268 | complete();
|
---|
| 4269 | }
|
---|
| 4270 | };
|
---|
| 4271 |
|
---|
| 4272 | _proto.hide = function hide(withoutTimeout) {
|
---|
| 4273 | var _this2 = this;
|
---|
| 4274 |
|
---|
| 4275 | if (!this._element.classList.contains(ClassName$a.SHOW)) {
|
---|
| 4276 | return;
|
---|
| 4277 | }
|
---|
| 4278 |
|
---|
| 4279 | $(this._element).trigger(Event$a.HIDE);
|
---|
| 4280 |
|
---|
| 4281 | if (withoutTimeout) {
|
---|
| 4282 | this._close();
|
---|
| 4283 | } else {
|
---|
| 4284 | this._timeout = setTimeout(function () {
|
---|
| 4285 | _this2._close();
|
---|
| 4286 | }, this._config.delay);
|
---|
| 4287 | }
|
---|
| 4288 | };
|
---|
| 4289 |
|
---|
| 4290 | _proto.dispose = function dispose() {
|
---|
| 4291 | clearTimeout(this._timeout);
|
---|
| 4292 | this._timeout = null;
|
---|
| 4293 |
|
---|
| 4294 | if (this._element.classList.contains(ClassName$a.SHOW)) {
|
---|
| 4295 | this._element.classList.remove(ClassName$a.SHOW);
|
---|
| 4296 | }
|
---|
| 4297 |
|
---|
| 4298 | $(this._element).off(Event$a.CLICK_DISMISS);
|
---|
| 4299 | $.removeData(this._element, DATA_KEY$a);
|
---|
| 4300 | this._element = null;
|
---|
| 4301 | this._config = null;
|
---|
| 4302 | } // Private
|
---|
| 4303 | ;
|
---|
| 4304 |
|
---|
| 4305 | _proto._getConfig = function _getConfig(config) {
|
---|
| 4306 | config = _objectSpread({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {});
|
---|
| 4307 | Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
|
---|
| 4308 | return config;
|
---|
| 4309 | };
|
---|
| 4310 |
|
---|
| 4311 | _proto._setListeners = function _setListeners() {
|
---|
| 4312 | var _this3 = this;
|
---|
| 4313 |
|
---|
| 4314 | $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
|
---|
| 4315 | return _this3.hide(true);
|
---|
| 4316 | });
|
---|
| 4317 | };
|
---|
| 4318 |
|
---|
| 4319 | _proto._close = function _close() {
|
---|
| 4320 | var _this4 = this;
|
---|
| 4321 |
|
---|
| 4322 | var complete = function complete() {
|
---|
| 4323 | _this4._element.classList.add(ClassName$a.HIDE);
|
---|
| 4324 |
|
---|
| 4325 | $(_this4._element).trigger(Event$a.HIDDEN);
|
---|
| 4326 | };
|
---|
| 4327 |
|
---|
| 4328 | this._element.classList.remove(ClassName$a.SHOW);
|
---|
| 4329 |
|
---|
| 4330 | if (this._config.animation) {
|
---|
| 4331 | var transitionDuration = Util.getTransitionDurationFromElement(this._element);
|
---|
| 4332 | $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
|
---|
| 4333 | } else {
|
---|
| 4334 | complete();
|
---|
| 4335 | }
|
---|
| 4336 | } // Static
|
---|
| 4337 | ;
|
---|
| 4338 |
|
---|
| 4339 | Toast._jQueryInterface = function _jQueryInterface(config) {
|
---|
| 4340 | return this.each(function () {
|
---|
| 4341 | var $element = $(this);
|
---|
| 4342 | var data = $element.data(DATA_KEY$a);
|
---|
| 4343 |
|
---|
| 4344 | var _config = typeof config === 'object' && config;
|
---|
| 4345 |
|
---|
| 4346 | if (!data) {
|
---|
| 4347 | data = new Toast(this, _config);
|
---|
| 4348 | $element.data(DATA_KEY$a, data);
|
---|
| 4349 | }
|
---|
| 4350 |
|
---|
| 4351 | if (typeof config === 'string') {
|
---|
| 4352 | if (typeof data[config] === 'undefined') {
|
---|
| 4353 | throw new TypeError("No method named \"" + config + "\"");
|
---|
| 4354 | }
|
---|
| 4355 |
|
---|
| 4356 | data[config](this);
|
---|
| 4357 | }
|
---|
| 4358 | });
|
---|
| 4359 | };
|
---|
| 4360 |
|
---|
| 4361 | _createClass(Toast, null, [{
|
---|
| 4362 | key: "VERSION",
|
---|
| 4363 | get: function get() {
|
---|
| 4364 | return VERSION$a;
|
---|
| 4365 | }
|
---|
| 4366 | }, {
|
---|
| 4367 | key: "DefaultType",
|
---|
| 4368 | get: function get() {
|
---|
| 4369 | return DefaultType$7;
|
---|
| 4370 | }
|
---|
| 4371 | }, {
|
---|
| 4372 | key: "Default",
|
---|
| 4373 | get: function get() {
|
---|
| 4374 | return Default$7;
|
---|
| 4375 | }
|
---|
| 4376 | }]);
|
---|
| 4377 |
|
---|
| 4378 | return Toast;
|
---|
| 4379 | }();
|
---|
| 4380 | /**
|
---|
| 4381 | * ------------------------------------------------------------------------
|
---|
| 4382 | * jQuery
|
---|
| 4383 | * ------------------------------------------------------------------------
|
---|
| 4384 | */
|
---|
| 4385 |
|
---|
| 4386 |
|
---|
| 4387 | $.fn[NAME$a] = Toast._jQueryInterface;
|
---|
| 4388 | $.fn[NAME$a].Constructor = Toast;
|
---|
| 4389 |
|
---|
| 4390 | $.fn[NAME$a].noConflict = function () {
|
---|
| 4391 | $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
|
---|
| 4392 | return Toast._jQueryInterface;
|
---|
| 4393 | };
|
---|
| 4394 |
|
---|
| 4395 | /**
|
---|
| 4396 | * --------------------------------------------------------------------------
|
---|
| 4397 | * Bootstrap (v4.3.1): index.js
|
---|
| 4398 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
---|
| 4399 | * --------------------------------------------------------------------------
|
---|
| 4400 | */
|
---|
| 4401 |
|
---|
| 4402 | (function () {
|
---|
| 4403 | if (typeof $ === 'undefined') {
|
---|
| 4404 | throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
|
---|
| 4405 | }
|
---|
| 4406 |
|
---|
| 4407 | var version = $.fn.jquery.split(' ')[0].split('.');
|
---|
| 4408 | var minMajor = 1;
|
---|
| 4409 | var ltMajor = 2;
|
---|
| 4410 | var minMinor = 9;
|
---|
| 4411 | var minPatch = 1;
|
---|
| 4412 | var maxMajor = 4;
|
---|
| 4413 |
|
---|
| 4414 | if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
|
---|
| 4415 | throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
|
---|
| 4416 | }
|
---|
| 4417 | })();
|
---|
| 4418 |
|
---|
| 4419 | exports.Util = Util;
|
---|
| 4420 | exports.Alert = Alert;
|
---|
| 4421 | exports.Button = Button;
|
---|
| 4422 | exports.Carousel = Carousel;
|
---|
| 4423 | exports.Collapse = Collapse;
|
---|
| 4424 | exports.Dropdown = Dropdown;
|
---|
| 4425 | exports.Modal = Modal;
|
---|
| 4426 | exports.Popover = Popover;
|
---|
| 4427 | exports.Scrollspy = ScrollSpy;
|
---|
| 4428 | exports.Tab = Tab;
|
---|
| 4429 | exports.Toast = Toast;
|
---|
| 4430 | exports.Tooltip = Tooltip;
|
---|
| 4431 |
|
---|
| 4432 | Object.defineProperty(exports, '__esModule', { value: true });
|
---|
| 4433 |
|
---|
| 4434 | }));
|
---|
| 4435 | //# sourceMappingURL=bootstrap.js.map
|
---|