diff options
author | XhmikosR <xhmikosr@gmail.com> | 2019-08-27 16:03:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-27 16:03:21 +0300 |
commit | bf57274fb51fd59f8d680590ead92cb631cf8ea1 (patch) | |
tree | 63aec9b1415470f399e1cbab0ae0d404d1389923 /dist/js/bootstrap.esm.js | |
parent | cad3d1098a2340299e88d05d7da190aac08ca319 (diff) |
Dist (#29263)
Diffstat (limited to 'dist/js/bootstrap.esm.js')
-rw-r--r-- | dist/js/bootstrap.esm.js | 547 |
1 files changed, 271 insertions, 276 deletions
diff --git a/dist/js/bootstrap.esm.js b/dist/js/bootstrap.esm.js index 3125fafc06..f88f8ee548 100644 --- a/dist/js/bootstrap.esm.js +++ b/dist/js/bootstrap.esm.js @@ -84,9 +84,7 @@ function _inheritsLoose(subClass, superClass) { */ var MAX_UID = 1000000; var MILLISECONDS_MULTIPLIER = 1000; -var TRANSITION_END = 'transitionend'; -var _window = window, - jQuery = _window.jQuery; // Shoutout AngusCroll (https://goo.gl/pxwQGp) +var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp) var toType = function toType(obj) { return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); @@ -107,19 +105,30 @@ var getUID = function getUID(prefix) { return prefix; }; -var getSelectorFromElement = function getSelectorFromElement(element) { +var getSelector = function getSelector(element) { var selector = element.getAttribute('data-target'); if (!selector || selector === '#') { var hrefAttr = element.getAttribute('href'); - selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; + selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; } - try { + return selector; +}; + +var getSelectorFromElement = function getSelectorFromElement(element) { + var selector = getSelector(element); + + if (selector) { return document.querySelector(selector) ? selector : null; - } catch (error) { - return null; } + + return null; +}; + +var getElementFromSelector = function getElementFromSelector(element) { + var selector = getSelector(element); + return selector ? document.querySelector(selector) : null; }; var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) { @@ -237,6 +246,17 @@ var reflow = function reflow(element) { return element.offsetHeight; }; +var getjQuery = function getjQuery() { + var _window = window, + jQuery = _window.jQuery; + + if (jQuery && !document.body.hasAttribute('data-no-jquery')) { + return jQuery; + } + + return null; +}; + /** * -------------------------------------------------------------------------- * Bootstrap (v4.3.1): dom/data.js @@ -455,6 +475,7 @@ if (!supportScopeQuery) { * ------------------------------------------------------------------------ */ +var $ = getjQuery(); var namespaceRegex = /[^.]*(?=\..*)\.|.*/; var stripNameRegex = /\..*/; var keyEventRegex = /^key/; @@ -682,9 +703,9 @@ var EventHandler = { var defaultPrevented = false; var evt = null; - if (inNamespace && typeof jQuery !== 'undefined') { - jQueryEvent = jQuery.Event(event, args); - jQuery(element).trigger(jQueryEvent); + if (inNamespace && $) { + jQueryEvent = $.Event(event, args); + $(element).trigger(jQueryEvent); bubbles = !jQueryEvent.isPropagationStopped(); nativeDispatch = !jQueryEvent.isImmediatePropagationStopped(); defaultPrevented = jQueryEvent.isDefaultPrevented(); @@ -876,12 +897,7 @@ function () { ; _proto._getRootElement = function _getRootElement(element) { - var selector = getSelectorFromElement(element); - var parent = false; - - if (selector) { - parent = SelectorEngine.findOne(selector); - } + var parent = getElementFromSelector(element); if (!parent) { parent = SelectorEngine.closest(element, "." + ClassName.ALERT); @@ -921,7 +937,7 @@ function () { } // Static ; - Alert._jQueryInterface = function _jQueryInterface(config) { + Alert.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.getData(this, DATA_KEY); @@ -935,7 +951,7 @@ function () { }); }; - Alert._handleDismiss = function _handleDismiss(alertInstance) { + Alert.handleDismiss = function handleDismiss(alertInstance) { return function (event) { if (event) { event.preventDefault(); @@ -945,7 +961,7 @@ function () { }; }; - Alert._getInstance = function _getInstance(element) { + Alert.getInstance = function getInstance(element) { return Data.getData(element, DATA_KEY); }; @@ -965,7 +981,8 @@ function () { */ -EventHandler.on(document, Event$1.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); +EventHandler.on(document, Event$1.CLICK_DATA_API, Selector.DISMISS, Alert.handleDismiss(new Alert())); +var $$1 = getjQuery(); /** * ------------------------------------------------------------------------ * jQuery @@ -975,14 +992,14 @@ EventHandler.on(document, Event$1.CLICK_DATA_API, Selector.DISMISS, Alert._handl /* istanbul ignore if */ -if (typeof jQuery !== 'undefined') { - var JQUERY_NO_CONFLICT = jQuery.fn[NAME]; - jQuery.fn[NAME] = Alert._jQueryInterface; - jQuery.fn[NAME].Constructor = Alert; +if ($$1) { + var JQUERY_NO_CONFLICT = $$1.fn[NAME]; + $$1.fn[NAME] = Alert.jQueryInterface; + $$1.fn[NAME].Constructor = Alert; - jQuery.fn[NAME].noConflict = function () { - jQuery.fn[NAME] = JQUERY_NO_CONFLICT; - return Alert._jQueryInterface; + $$1.fn[NAME].noConflict = function () { + $$1.fn[NAME] = JQUERY_NO_CONFLICT; + return Alert.jQueryInterface; }; } @@ -1041,16 +1058,14 @@ function () { if (rootElement) { var input = SelectorEngine.findOne(Selector$1.INPUT, this._element); - if (input) { - if (input.type === 'radio') { - if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) { - triggerChangeEvent = false; - } else { - var activeElement = SelectorEngine.findOne(Selector$1.ACTIVE, rootElement); + if (input && input.type === 'radio') { + if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) { + triggerChangeEvent = false; + } else { + var activeElement = SelectorEngine.findOne(Selector$1.ACTIVE, rootElement); - if (activeElement) { - activeElement.classList.remove(ClassName$1.ACTIVE); - } + if (activeElement) { + activeElement.classList.remove(ClassName$1.ACTIVE); } } @@ -1083,7 +1098,7 @@ function () { } // Static ; - Button._jQueryInterface = function _jQueryInterface(config) { + Button.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.getData(this, DATA_KEY$1); @@ -1097,7 +1112,7 @@ function () { }); }; - Button._getInstance = function _getInstance(element) { + Button.getInstance = function getInstance(element) { return Data.getData(element, DATA_KEY$1); }; @@ -1147,6 +1162,7 @@ EventHandler.on(document, Event$2.BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, button.classList.remove(ClassName$1.FOCUS); } }); +var $$2 = getjQuery(); /** * ------------------------------------------------------------------------ * jQuery @@ -1156,14 +1172,14 @@ EventHandler.on(document, Event$2.BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, /* istanbul ignore if */ -if (typeof jQuery !== 'undefined') { - var JQUERY_NO_CONFLICT$1 = jQuery.fn[NAME$1]; - jQuery.fn[NAME$1] = Button._jQueryInterface; - jQuery.fn[NAME$1].Constructor = Button; +if ($$2) { + var JQUERY_NO_CONFLICT$1 = $$2.fn[NAME$1]; + $$2.fn[NAME$1] = Button.jQueryInterface; + $$2.fn[NAME$1].Constructor = Button; - jQuery.fn[NAME$1].noConflict = function () { - jQuery.fn[NAME$1] = JQUERY_NO_CONFLICT$1; - return Button._jQueryInterface; + $$2.fn[NAME$1].noConflict = function () { + $$2.fn[NAME$1] = JQUERY_NO_CONFLICT$1; + return Button.jQueryInterface; }; } @@ -1750,7 +1766,7 @@ function () { } // Static ; - Carousel._carouselInterface = function _carouselInterface(element, config) { + Carousel.carouselInterface = function carouselInterface(element, config) { var data = Data.getData(element, DATA_KEY$2); var _config = _objectSpread2({}, Default, {}, Manipulator.getDataAttributes(element)); @@ -1779,20 +1795,14 @@ function () { } }; - Carousel._jQueryInterface = function _jQueryInterface(config) { + Carousel.jQueryInterface = function jQueryInterface(config) { return this.each(function () { - Carousel._carouselInterface(this, config); + Carousel.carouselInterface(this, config); }); }; - Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { - var selector = getSelectorFromElement(this); - - if (!selector) { - return; - } - - var target = SelectorEngine.findOne(selector); + Carousel.dataApiClickHandler = function dataApiClickHandler(event) { + var target = getElementFromSelector(this); if (!target || !target.classList.contains(ClassName$2.CAROUSEL)) { return; @@ -1806,7 +1816,7 @@ function () { config.interval = false; } - Carousel._carouselInterface(target, config); + Carousel.carouselInterface(target, config); if (slideIndex) { Data.getData(target, DATA_KEY$2).to(slideIndex); @@ -1815,7 +1825,7 @@ function () { event.preventDefault(); }; - Carousel._getInstance = function _getInstance(element) { + Carousel.getInstance = function getInstance(element) { return Data.getData(element, DATA_KEY$2); }; @@ -1840,14 +1850,15 @@ function () { */ -EventHandler.on(document, Event$3.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler); +EventHandler.on(document, Event$3.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel.dataApiClickHandler); EventHandler.on(window, Event$3.LOAD_DATA_API, function () { var carousels = makeArray(SelectorEngine.find(Selector$2.DATA_RIDE)); for (var i = 0, len = carousels.length; i < len; i++) { - Carousel._carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY$2)); + Carousel.carouselInterface(carousels[i], Data.getData(carousels[i], DATA_KEY$2)); } }); +var $$3 = getjQuery(); /** * ------------------------------------------------------------------------ * jQuery @@ -1857,14 +1868,14 @@ EventHandler.on(window, Event$3.LOAD_DATA_API, function () { /* istanbul ignore if */ -if (typeof jQuery !== 'undefined') { - var JQUERY_NO_CONFLICT$2 = jQuery.fn[NAME$2]; - jQuery.fn[NAME$2] = Carousel._jQueryInterface; - jQuery.fn[NAME$2].Constructor = Carousel; +if ($$3) { + var JQUERY_NO_CONFLICT$2 = $$3.fn[NAME$2]; + $$3.fn[NAME$2] = Carousel.jQueryInterface; + $$3.fn[NAME$2].Constructor = Carousel; - jQuery.fn[NAME$2].noConflict = function () { - jQuery.fn[NAME$2] = JQUERY_NO_CONFLICT$2; - return Carousel._jQueryInterface; + $$3.fn[NAME$2].noConflict = function () { + $$3.fn[NAME$2] = JQUERY_NO_CONFLICT$2; + return Carousel.jQueryInterface; }; } @@ -2010,7 +2021,7 @@ function () { if (actives) { actives.forEach(function (elemActive) { if (container !== elemActive) { - Collapse._collapseInterface(elemActive, 'hide'); + Collapse.collapseInterface(elemActive, 'hide'); } if (!activesData) { @@ -2087,15 +2098,11 @@ function () { if (triggerArrayLength > 0) { for (var i = 0; i < triggerArrayLength; i++) { var trigger = this._triggerArray[i]; - var selector = getSelectorFromElement(trigger); - - if (selector !== null) { - var elem = SelectorEngine.findOne(selector); + var elem = getElementFromSelector(trigger); - if (!elem.classList.contains(ClassName$3.SHOW)) { - trigger.classList.add(ClassName$3.COLLAPSED); - trigger.setAttribute('aria-expanded', false); - } + if (elem && !elem.classList.contains(ClassName$3.SHOW)) { + trigger.classList.add(ClassName$3.COLLAPSED); + trigger.setAttribute('aria-expanded', false); } } } @@ -2162,8 +2169,7 @@ function () { var selector = "[data-toggle=\"collapse\"][data-parent=\"" + parent + "\"]"; makeArray(SelectorEngine.find(selector, parent)).forEach(function (element) { - var selector = getSelectorFromElement(element); - var selected = selector ? SelectorEngine.findOne(selector) : null; + var selected = getElementFromSelector(element); _this3._addAriaAndCollapsedClass(selected, [element]); }); @@ -2189,7 +2195,7 @@ function () { } // Static ; - Collapse._collapseInterface = function _collapseInterface(element, config) { + Collapse.collapseInterface = function collapseInterface(element, config) { var data = Data.getData(element, DATA_KEY$3); var _config = _objectSpread2({}, Default$1, {}, Manipulator.getDataAttributes(element), {}, typeof config === 'object' && config ? config : {}); @@ -2211,13 +2217,13 @@ function () { } }; - Collapse._jQueryInterface = function _jQueryInterface(config) { + Collapse.jQueryInterface = function jQueryInterface(config) { return this.each(function () { - Collapse._collapseInterface(this, config); + Collapse.collapseInterface(this, config); }); }; - Collapse._getInstance = function _getInstance(element) { + Collapse.getInstance = function getInstance(element) { return Data.getData(element, DATA_KEY$3); }; @@ -2267,9 +2273,10 @@ EventHandler.on(document, Event$4.CLICK_DATA_API, Selector$3.DATA_TOGGLE, functi config = triggerData; } - Collapse._collapseInterface(element, config); + Collapse.collapseInterface(element, config); }); }); +var $$4 = getjQuery(); /** * ------------------------------------------------------------------------ * jQuery @@ -2279,14 +2286,14 @@ EventHandler.on(document, Event$4.CLICK_DATA_API, Selector$3.DATA_TOGGLE, functi /* istanbul ignore if */ -if (typeof jQuery !== 'undefined') { - var JQUERY_NO_CONFLICT$3 = jQuery.fn[NAME$3]; - jQuery.fn[NAME$3] = Collapse._jQueryInterface; - jQuery.fn[NAME$3].Constructor = Collapse; +if ($$4) { + var JQUERY_NO_CONFLICT$3 = $$4.fn[NAME$3]; + $$4.fn[NAME$3] = Collapse.jQueryInterface; + $$4.fn[NAME$3].Constructor = Collapse; - jQuery.fn[NAME$3].noConflict = function () { - jQuery.fn[NAME$3] = JQUERY_NO_CONFLICT$3; - return Collapse._jQueryInterface; + $$4.fn[NAME$3].noConflict = function () { + $$4.fn[NAME$3] = JQUERY_NO_CONFLICT$3; + return Collapse.jQueryInterface; }; } @@ -2355,14 +2362,16 @@ var Default$2 = { flip: true, boundary: 'scrollParent', reference: 'toggle', - display: 'dynamic' + display: 'dynamic', + popperConfig: null }; var DefaultType$2 = { offset: '(number|string|function)', flip: 'boolean', boundary: '(string|element)', reference: '(string|element)', - display: 'string' + display: 'string', + popperConfig: '(null|object)' /** * ------------------------------------------------------------------------ * Class Definition @@ -2395,16 +2404,23 @@ function () { return; } - var parent = Dropdown._getParentFromElement(this._element); - var isActive = this._menu.classList.contains(ClassName$4.SHOW); - Dropdown._clearMenus(); + Dropdown.clearMenus(); if (isActive) { return; } + this.show(); + }; + + _proto.show = function show() { + if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED) || this._menu.classList.contains(ClassName$4.SHOW)) { + return; + } + + var parent = Dropdown.getParentFromElement(this._element); var relatedTarget = { relatedTarget: this._element }; @@ -2416,10 +2432,6 @@ function () { if (!this._inNavbar) { - /** - * Check for Popper dependency - * Popper - https://popper.js.org - */ if (typeof Popper === 'undefined') { throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org)'); } @@ -2465,34 +2477,12 @@ function () { EventHandler.trigger(parent, Event$5.SHOWN, relatedTarget); }; - _proto.show = function show() { - if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED) || this._menu.classList.contains(ClassName$4.SHOW)) { - return; - } - - var parent = Dropdown._getParentFromElement(this._element); - - var relatedTarget = { - relatedTarget: this._element - }; - var showEvent = EventHandler.trigger(parent, Event$5.SHOW, relatedTarget); - - if (showEvent.defaultPrevented) { - return; - } - - Manipulator.toggleClass(this._menu, ClassName$4.SHOW); - Manipulator.toggleClass(parent, ClassName$4.SHOW); - EventHandler.trigger(parent, Event$5.SHOWN, relatedTarget); - }; - _proto.hide = function hide() { if (this._element.disabled || this._element.classList.contains(ClassName$4.DISABLED) || !this._menu.classList.contains(ClassName$4.SHOW)) { return; } - var parent = Dropdown._getParentFromElement(this._element); - + var parent = Dropdown.getParentFromElement(this._element); var relatedTarget = { relatedTarget: this._element }; @@ -2502,6 +2492,10 @@ function () { return; } + if (this._popper) { + this._popper.destroy(); + } + Manipulator.toggleClass(this._menu, ClassName$4.SHOW); Manipulator.toggleClass(parent, ClassName$4.SHOW); EventHandler.trigger(parent, Event$5.HIDDEN, relatedTarget); @@ -2513,7 +2507,7 @@ function () { this._element = null; this._menu = null; - if (this._popper !== null) { + if (this._popper) { this._popper.destroy(); this._popper = null; @@ -2523,7 +2517,7 @@ function () { _proto.update = function update() { this._inNavbar = this._detectNavbar(); - if (this._popper !== null) { + if (this._popper) { this._popper.scheduleUpdate(); } } // Private @@ -2547,8 +2541,7 @@ function () { }; _proto._getMenuElement = function _getMenuElement() { - var parent = Dropdown._getParentFromElement(this._element); - + var parent = Dropdown.getParentFromElement(this._element); return SelectorEngine.findOne(Selector$4.MENU, parent); }; @@ -2615,11 +2608,11 @@ function () { }; } - return popperConfig; + return _objectSpread2({}, popperConfig, {}, this._config.popperConfig); } // Static ; - Dropdown._dropdownInterface = function _dropdownInterface(element, config) { + Dropdown.dropdownInterface = function dropdownInterface(element, config) { var data = Data.getData(element, DATA_KEY$4); var _config = typeof config === 'object' ? config : null; @@ -2637,13 +2630,13 @@ function () { } }; - Dropdown._jQueryInterface = function _jQueryInterface(config) { + Dropdown.jQueryInterface = function jQueryInterface(config) { return this.each(function () { - Dropdown._dropdownInterface(this, config); + Dropdown.dropdownInterface(this, config); }); }; - Dropdown._clearMenus = function _clearMenus(event) { + Dropdown.clearMenus = function clearMenus(event) { if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { return; } @@ -2651,8 +2644,7 @@ function () { var toggles = makeArray(SelectorEngine.find(Selector$4.DATA_TOGGLE)); for (var i = 0, len = toggles.length; i < len; i++) { - var parent = Dropdown._getParentFromElement(toggles[i]); - + var parent = Dropdown.getParentFromElement(toggles[i]); var context = Data.getData(toggles[i], DATA_KEY$4); var relatedTarget = { relatedTarget: toggles[i] @@ -2691,24 +2683,22 @@ function () { } toggles[i].setAttribute('aria-expanded', 'false'); + + if (context._popper) { + context._popper.destroy(); + } + dropdownMenu.classList.remove(ClassName$4.SHOW); parent.classList.remove(ClassName$4.SHOW); EventHandler.trigger(parent, Event$5.HIDDEN, relatedTarget); } }; - Dropdown._getParentFromElement = function _getParentFromElement(element) { - var parent; - var selector = getSelectorFromElement(element); - - if (selector) { - parent = SelectorEngine.findOne(selector); - } - - return parent || element.parentNode; + Dropdown.getParentFromElement = function getParentFromElement(element) { + return getElementFromSelector(element) || element.parentNode; }; - Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { + Dropdown.dataApiKeydownHandler = function dataApiKeydownHandler(event) { // If not input/textarea: // - And not a key in REGEXP_KEYDOWN => not a dropdown command // If input/textarea: @@ -2727,8 +2717,7 @@ function () { return; } - var parent = Dropdown._getParentFromElement(this); - + var parent = Dropdown.getParentFromElement(this); var isActive = parent.classList.contains(ClassName$4.SHOW); if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { @@ -2736,8 +2725,7 @@ function () { SelectorEngine.findOne(Selector$4.DATA_TOGGLE, parent).focus(); } - Dropdown._clearMenus(); - + Dropdown.clearMenus(); return; } @@ -2766,7 +2754,7 @@ function () { items[index].focus(); }; - Dropdown._getInstance = function _getInstance(element) { + Dropdown.getInstance = function getInstance(element) { return Data.getData(element, DATA_KEY$4); }; @@ -2796,19 +2784,19 @@ function () { */ -EventHandler.on(document, Event$5.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler); -EventHandler.on(document, Event$5.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler); -EventHandler.on(document, Event$5.CLICK_DATA_API, Dropdown._clearMenus); -EventHandler.on(document, Event$5.KEYUP_DATA_API, Dropdown._clearMenus); +EventHandler.on(document, Event$5.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown.dataApiKeydownHandler); +EventHandler.on(document, Event$5.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown.dataApiKeydownHandler); +EventHandler.on(document, Event$5.CLICK_DATA_API, Dropdown.clearMenus); +EventHandler.on(document, Event$5.KEYUP_DATA_API, Dropdown.clearMenus); EventHandler.on(document, Event$5.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) { event.preventDefault(); event.stopPropagation(); - - Dropdown._dropdownInterface(this, 'toggle'); + Dropdown.dropdownInterface(this, 'toggle'); }); EventHandler.on(document, Event$5.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) { return e.stopPropagation(); }); +var $$5 = getjQuery(); /** * ------------------------------------------------------------------------ * jQuery @@ -2818,14 +2806,14 @@ EventHandler.on(document, Event$5.CLICK_DATA_API, Selector$4.FORM_CHILD, functio /* istanbul ignore if */ -if (typeof jQuery !== 'undefined') { - var JQUERY_NO_CONFLICT$4 = jQuery.fn[NAME$4]; - jQuery.fn[NAME$4] = Dropdown._jQueryInterface; - jQuery.fn[NAME$4].Constructor = Dropdown; +if ($$5) { + var JQUERY_NO_CONFLICT$4 = $$5.fn[NAME$4]; + $$5.fn[NAME$4] = Dropdown.jQueryInterface; + $$5.fn[NAME$4].Constructor = Dropdown; - jQuery.fn[NAME$4].noConflict = function () { - jQuery.fn[NAME$4] = JQUERY_NO_CONFLICT$4; - return Dropdown._jQueryInterface; + $$5.fn[NAME$4].noConflict = function () { + $$5.fn[NAME$4] = JQUERY_NO_CONFLICT$4; + return Dropdown.jQueryInterface; }; } @@ -3047,6 +3035,8 @@ function () { var transition = this._element.classList.contains(ClassName$5.FADE); + var modalBody = SelectorEngine.findOne(Selector$5.MODAL_BODY, this._dialog); + if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { // Don't move modal's DOM position document.body.appendChild(this._element); @@ -3058,8 +3048,8 @@ function () { this._element.setAttribute('aria-modal', true); - if (this._dialog.classList.contains(ClassName$5.SCROLLABLE)) { - SelectorEngine.findOne(Selector$5.MODAL_BODY, this._dialog).scrollTop = 0; + if (this._dialog.classList.contains(ClassName$5.SCROLLABLE) && modalBody) { + modalBody.scrollTop = 0; } else { this._element.scrollTop = 0; } @@ -3326,7 +3316,7 @@ function () { } // Static ; - Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { + Modal.jQueryInterface = function jQueryInterface(config, relatedTarget) { return this.each(function () { var data = Data.getData(this, DATA_KEY$5); @@ -3348,7 +3338,7 @@ function () { }); }; - Modal._getInstance = function _getInstance(element) { + Modal.getInstance = function getInstance(element) { return Data.getData(element, DATA_KEY$5); }; @@ -3376,8 +3366,7 @@ function () { EventHandler.on(document, Event$6.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) { var _this10 = this; - var selector = getSelectorFromElement(this); - var target = SelectorEngine.findOne(selector); + var target = getElementFromSelector(this); if (this.tagName === 'A' || this.tagName === 'AREA') { event.preventDefault(); @@ -3405,6 +3394,7 @@ EventHandler.on(document, Event$6.CLICK_DATA_API, Selector$5.DATA_TOGGLE, functi data.show(this); }); +var $$6 = getjQuery(); /** * ------------------------------------------------------------------------ * jQuery @@ -3414,14 +3404,14 @@ EventHandler.on(document, Event$6.CLICK_DATA_API, Selector$5.DATA_TOGGLE, functi /* istanbul ignore if */ -if (typeof jQuery !== 'undefined') { - var JQUERY_NO_CONFLICT$5 = jQuery.fn[NAME$5]; - jQuery.fn[NAME$5] = Modal._jQueryInterface; - jQuery.fn[NAME$5].Constructor = Modal; +if ($$6) { + var JQUERY_NO_CONFLICT$5 = $$6.fn[NAME$5]; + $$6.fn[NAME$5] = Modal.jQueryInterface; + $$6.fn[NAME$5].Constructor = Modal; - jQuery.fn[NAME$5].noConflict = function () { - jQuery.fn[NAME$5] = JQUERY_NO_CONFLICT$5; - return Modal._jQueryInterface; + $$6.fn[NAME$5].noConflict = function () { + $$6.fn[NAME$5] = JQUERY_NO_CONFLICT$5; + return Modal.jQueryInterface; }; } @@ -3574,7 +3564,8 @@ var DefaultType$4 = { boundary: '(string|element)', sanitize: 'boolean', sanitizeFn: '(null|function)', - whiteList: 'object' + whiteList: 'object', + popperConfig: '(null|object)' }; var AttachmentMap$1 = { AUTO: 'auto', @@ -3598,7 +3589,8 @@ var Default$4 = { boundary: 'scrollParent', sanitize: true, sanitizeFn: null, - whiteList: DefaultWhitelist + whiteList: DefaultWhitelist, + popperConfig: null }; var HoverState = { SHOW: 'show', @@ -3640,10 +3632,6 @@ var Tooltip = /*#__PURE__*/ function () { function Tooltip(element, config) { - /** - * Check for Popper dependency - * Popper - https://popper.js.org - */ if (typeof Popper === 'undefined') { throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org)'); } // private @@ -3727,7 +3715,7 @@ function () { this._hoverState = null; this._activeTrigger = null; - if (this._popper !== null) { + if (this._popper) { this._popper.destroy(); } @@ -3778,29 +3766,7 @@ function () { } EventHandler.trigger(this.element, this.constructor.Event.INSERTED); - this._popper = new Popper(this.element, tip, { - placement: attachment, - modifiers: { - offset: this._getOffset(), - flip: { - behavior: this.config.fallbackPlacement - }, - arrow: { - element: "." + this.constructor.NAME + "-arrow" - }, - preventOverflow: { - boundariesElement: this.config.boundary - } - }, - onCreate: function onCreate(data) { - if (data.originalPlacement !== data.placement) { - _this._handlePopperPlacementChange(data); - } - }, - onUpdate: function onUpdate(data) { - return _this._handlePopperPlacementChange(data); - } - }); + this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment)); tip.classList.add(ClassName$6.SHOW); // If this is a touch-enabled device we add extra // empty mouseover listeners to the body's immediate children; // only needed because of broken event delegation on iOS @@ -3959,18 +3925,47 @@ function () { } // Private ; + _proto._getPopperConfig = function _getPopperConfig(attachment) { + var _this3 = this; + + var defaultBsConfig = { + placement: attachment, + modifiers: { + offset: this._getOffset(), + flip: { + behavior: this.config.fallbackPlacement + }, + arrow: { + element: "." + this.constructor.NAME + "-arrow" + }, + preventOverflow: { + boundariesElement: this.config.boundary + } + }, + onCreate: function onCreate(data) { + if (data.originalPlacement !== data.placement) { + _this3._handlePopperPlacementChange(data); + } + }, + onUpdate: function onUpdate(data) { + return _this3._handlePopperPlacementChange(data); + } + }; + return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig); + }; + _proto._addAttachmentClass = function _addAttachmentClass(attachment) { this.getTipElement().classList.add(CLASS_PREFIX + "-" + attachment); }; _proto._getOffset = function _getOffset() { - var _this3 = this; + var _this4 = this; var offset = {}; if (typeof this.config.offset === 'function') { offset.fn = function (data) { - data.offsets = _objectSpread2({}, data.offsets, {}, _this3.config.offset(data.offsets, _this3.element) || {}); + data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {}); return data; }; } else { @@ -3997,29 +3992,29 @@ function () { }; _proto._setListeners = function _setListeners() { - var _this4 = this; + var _this5 = this; var triggers = this.config.trigger.split(' '); triggers.forEach(function (trigger) { if (trigger === 'click') { - EventHandler.on(_this4.element, _this4.constructor.Event.CLICK, _this4.config.selector, function (event) { - return _this4.toggle(event); + EventHandler.on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) { + return _this5.toggle(event); }); } else if (trigger !== Trigger.MANUAL) { - var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN; - var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT; - EventHandler.on(_this4.element, eventIn, _this4.config.selector, function (event) { - return _this4._enter(event); + var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN; + var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT; + EventHandler.on(_this5.element, eventIn, _this5.config.selector, function (event) { + return _this5._enter(event); }); - EventHandler.on(_this4.element, eventOut, _this4.config.selector, function (event) { - return _this4._leave(event); + EventHandler.on(_this5.element, eventOut, _this5.config.selector, function (event) { + return _this5._leave(event); }); } }); this._hideModalHandler = function () { - if (_this4.element) { - _this4.hide(); + if (_this5.element) { + _this5.hide(); } }; @@ -4209,7 +4204,7 @@ function () { } // Static ; - Tooltip._jQueryInterface = function _jQueryInterface(config) { + Tooltip.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.getData(this, DATA_KEY$6); @@ -4233,7 +4228,7 @@ function () { }); }; - Tooltip._getInstance = function _getInstance(element) { + Tooltip.getInstance = function getInstance(element) { return Data.getData(element, DATA_KEY$6); }; @@ -4276,6 +4271,8 @@ function () { return Tooltip; }(); + +var $$7 = getjQuery(); /** * ------------------------------------------------------------------------ * jQuery @@ -4285,15 +4282,14 @@ function () { /* istanbul ignore if */ +if ($$7) { + var JQUERY_NO_CONFLICT$6 = $$7.fn[NAME$6]; + $$7.fn[NAME$6] = Tooltip.jQueryInterface; + $$7.fn[NAME$6].Constructor = Tooltip; -if (typeof jQuery !== 'undefined') { - var JQUERY_NO_CONFLICT$6 = jQuery.fn[NAME$6]; - jQuery.fn[NAME$6] = Tooltip._jQueryInterface; - jQuery.fn[NAME$6].Constructor = Tooltip; - - jQuery.fn[NAME$6].noConflict = function () { - jQuery.fn[NAME$6] = JQUERY_NO_CONFLICT$6; - return Tooltip._jQueryInterface; + $$7.fn[NAME$6].noConflict = function () { + $$7.fn[NAME$6] = JQUERY_NO_CONFLICT$6; + return Tooltip.jQueryInterface; }; } @@ -4364,10 +4360,6 @@ function (_Tooltip) { return this.getTitle() || this._getContent(); }; - _proto.addAttachmentClass = function addAttachmentClass(attachment) { - this.getTipElement().classList.add(CLASS_PREFIX$1 + "-" + attachment); - }; - _proto.setContent = function setContent() { var tip = this.getTipElement(); // we use append for html objects to maintain js events @@ -4382,6 +4374,10 @@ function (_Tooltip) { this.setElementContent(SelectorEngine.findOne(Selector$7.CONTENT, tip), content); tip.classList.remove(ClassName$7.FADE); tip.classList.remove(ClassName$7.SHOW); + }; + + _proto._addAttachmentClass = function _addAttachmentClass(attachment) { + this.getTipElement().classList.add(CLASS_PREFIX$1 + "-" + attachment); } // Private ; @@ -4403,7 +4399,7 @@ function (_Tooltip) { } // Static ; - Popover._jQueryInterface = function _jQueryInterface(config) { + Popover.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.getData(this, DATA_KEY$7); @@ -4428,7 +4424,7 @@ function (_Tooltip) { }); }; - Popover._getInstance = function _getInstance(element) { + Popover.getInstance = function getInstance(element) { return Data.getData(element, DATA_KEY$7); }; @@ -4472,6 +4468,8 @@ function (_Tooltip) { return Popover; }(Tooltip); + +var $$8 = getjQuery(); /** * ------------------------------------------------------------------------ * jQuery @@ -4480,15 +4478,14 @@ function (_Tooltip) { /* istanbul ignore if */ +if ($$8) { + var JQUERY_NO_CONFLICT$7 = $$8.fn[NAME$7]; + $$8.fn[NAME$7] = Popover.jQueryInterface; + $$8.fn[NAME$7].Constructor = Popover; -if (typeof jQuery !== 'undefined') { - var JQUERY_NO_CONFLICT$7 = jQuery.fn[NAME$7]; - jQuery.fn[NAME$7] = Popover._jQueryInterface; - jQuery.fn[NAME$7].Constructor = Popover; - - jQuery.fn[NAME$7].noConflict = function () { - jQuery.fn[NAME$7] = JQUERY_NO_CONFLICT$7; - return Popover._jQueryInterface; + $$8.fn[NAME$7].noConflict = function () { + $$8.fn[NAME$7] = JQUERY_NO_CONFLICT$7; + return Popover.jQueryInterface; }; } @@ -4738,7 +4735,7 @@ function () { } // Static ; - ScrollSpy._jQueryInterface = function _jQueryInterface(config) { + ScrollSpy.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.getData(this, DATA_KEY$8); @@ -4758,7 +4755,7 @@ function () { }); }; - ScrollSpy._getInstance = function _getInstance(element) { + ScrollSpy.getInstance = function getInstance(element) { return Data.getData(element, DATA_KEY$8); }; @@ -4788,6 +4785,7 @@ EventHandler.on(window, Event$9.LOAD_DATA_API, function () { return new ScrollSpy(spy, Manipulator.getDataAttributes(spy)); }); }); +var $$9 = getjQuery(); /** * ------------------------------------------------------------------------ * jQuery @@ -4796,14 +4794,14 @@ EventHandler.on(window, Event$9.LOAD_DATA_API, function () { /* istanbul ignore if */ -if (typeof jQuery !== 'undefined') { - var JQUERY_NO_CONFLICT$8 = jQuery.fn[NAME$8]; - jQuery.fn[NAME$8] = ScrollSpy._jQueryInterface; - jQuery.fn[NAME$8].Constructor = ScrollSpy; +if ($$9) { + var JQUERY_NO_CONFLICT$8 = $$9.fn[NAME$8]; + $$9.fn[NAME$8] = ScrollSpy.jQueryInterface; + $$9.fn[NAME$8].Constructor = ScrollSpy; - jQuery.fn[NAME$8].noConflict = function () { - jQuery.fn[NAME$8] = JQUERY_NO_CONFLICT$8; - return ScrollSpy._jQueryInterface; + $$9.fn[NAME$8].noConflict = function () { + $$9.fn[NAME$8] = JQUERY_NO_CONFLICT$8; + return ScrollSpy.jQueryInterface; }; } @@ -4867,10 +4865,9 @@ function () { return; } - var target; var previous; + var target = getElementFromSelector(this._element); var listElement = SelectorEngine.closest(this._element, Selector$9.NAV_LIST_GROUP); - var selector = getSelectorFromElement(this._element); if (listElement) { var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE; @@ -4894,10 +4891,6 @@ function () { return; } - if (selector) { - target = SelectorEngine.findOne(selector); - } - this._activate(this._element, listElement); var complete = function complete() { @@ -4987,7 +4980,7 @@ function () { } // Static ; - Tab._jQueryInterface = function _jQueryInterface(config) { + Tab.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.getData(this, DATA_KEY$9) || new Tab(this); @@ -5001,7 +4994,7 @@ function () { }); }; - Tab._getInstance = function _getInstance(element) { + Tab.getInstance = function getInstance(element) { return Data.getData(element, DATA_KEY$9); }; @@ -5026,6 +5019,7 @@ EventHandler.on(document, Event$a.CLICK_DATA_API, Selector$9.DATA_TOGGLE, functi var data = Data.getData(this, DATA_KEY$9) || new Tab(this); data.show(); }); +var $$a = getjQuery(); /** * ------------------------------------------------------------------------ * jQuery @@ -5035,14 +5029,14 @@ EventHandler.on(document, Event$a.CLICK_DATA_API, Selector$9.DATA_TOGGLE, functi /* istanbul ignore if */ -if (typeof jQuery !== 'undefined') { - var JQUERY_NO_CONFLICT$9 = jQuery.fn[NAME$9]; - jQuery.fn[NAME$9] = Tab._jQueryInterface; - jQuery.fn[NAME$9].Constructor = Tab; +if ($$a) { + var JQUERY_NO_CONFLICT$9 = $$a.fn[NAME$9]; + $$a.fn[NAME$9] = Tab.jQueryInterface; + $$a.fn[NAME$9].Constructor = Tab; - jQuery.fn[NAME$9].noConflict = function () { - jQuery.fn[NAME$9] = JQUERY_NO_CONFLICT$9; - return Tab._jQueryInterface; + $$a.fn[NAME$9].noConflict = function () { + $$a.fn[NAME$9] = JQUERY_NO_CONFLICT$9; + return Tab.jQueryInterface; }; } @@ -5208,7 +5202,7 @@ function () { } // Static ; - Toast._jQueryInterface = function _jQueryInterface(config) { + Toast.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.getData(this, DATA_KEY$a); @@ -5228,7 +5222,7 @@ function () { }); }; - Toast._getInstance = function _getInstance(element) { + Toast.getInstance = function getInstance(element) { return Data.getData(element, DATA_KEY$a); }; @@ -5251,6 +5245,8 @@ function () { return Toast; }(); + +var $$b = getjQuery(); /** * ------------------------------------------------------------------------ * jQuery @@ -5260,15 +5256,14 @@ function () { /* istanbul ignore if */ +if ($$b) { + var JQUERY_NO_CONFLICT$a = $$b.fn[NAME$a]; + $$b.fn[NAME$a] = Toast.jQueryInterface; + $$b.fn[NAME$a].Constructor = Toast; -if (typeof jQuery !== 'undefined') { - var JQUERY_NO_CONFLICT$a = jQuery.fn[NAME$a]; - jQuery.fn[NAME$a] = Toast._jQueryInterface; - jQuery.fn[NAME$a].Constructor = Toast; - - jQuery.fn[NAME$a].noConflict = function () { - jQuery.fn[NAME$a] = JQUERY_NO_CONFLICT$a; - return Toast._jQueryInterface; + $$b.fn[NAME$a].noConflict = function () { + $$b.fn[NAME$a] = JQUERY_NO_CONFLICT$a; + return Toast.jQueryInterface; }; } |