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