diff options
Diffstat (limited to 'dist/js/bootstrap.bundle.js')
-rw-r--r-- | dist/js/bootstrap.bundle.js | 813 |
1 files changed, 408 insertions, 405 deletions
diff --git a/dist/js/bootstrap.bundle.js b/dist/js/bootstrap.bundle.js index 662f7c36fc..7ce97d5910 100644 --- a/dist/js/bootstrap.bundle.js +++ b/dist/js/bootstrap.bundle.js @@ -580,8 +580,48 @@ * ------------------------------------------------------------------------ */ - var NAME = 'alert'; var VERSION = '5.0.0-alpha3'; + + var BaseComponent = /*#__PURE__*/function () { + function BaseComponent(element) { + if (!element) { + return; + } + + this._element = element; + Data.setData(element, this.constructor.DATA_KEY, this); + } + + var _proto = BaseComponent.prototype; + + _proto.dispose = function dispose() { + Data.removeData(this._element, this.constructor.DATA_KEY); + this._element = null; + } + /** Static */ + ; + + BaseComponent.getInstance = function getInstance(element) { + return Data.getData(element, this.DATA_KEY); + }; + + _createClass(BaseComponent, null, [{ + key: "VERSION", + get: function get() { + return VERSION; + } + }]); + + return BaseComponent; + }(); + + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + + var NAME = 'alert'; var DATA_KEY = 'bs.alert'; var EVENT_KEY = "." + DATA_KEY; var DATA_API_KEY = '.data-api'; @@ -598,15 +638,12 @@ * ------------------------------------------------------------------------ */ - var Alert = /*#__PURE__*/function () { - function Alert(element) { - this._element = element; - - if (this._element) { - Data.setData(element, DATA_KEY, this); - } - } // Getters + var Alert = /*#__PURE__*/function (_BaseComponent) { + _inheritsLoose(Alert, _BaseComponent); + function Alert() { + return _BaseComponent.apply(this, arguments) || this; + } var _proto = Alert.prototype; @@ -621,11 +658,6 @@ } this._removeElement(rootElement); - }; - - _proto.dispose = function dispose() { - Data.removeData(this._element, DATA_KEY); - this._element = null; } // Private ; @@ -688,19 +720,16 @@ }; }; - Alert.getInstance = function getInstance(element) { - return Data.getData(element, DATA_KEY); - }; - _createClass(Alert, null, [{ - key: "VERSION", + key: "DATA_KEY", + // Getters get: function get() { - return VERSION; + return DATA_KEY; } }]); return Alert; - }(); + }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation @@ -739,7 +768,6 @@ */ var NAME$1 = 'button'; - var VERSION$1 = '5.0.0-alpha3'; var DATA_KEY$1 = 'bs.button'; var EVENT_KEY$1 = "." + DATA_KEY$1; var DATA_API_KEY$1 = '.data-api'; @@ -752,12 +780,12 @@ * ------------------------------------------------------------------------ */ - var Button = /*#__PURE__*/function () { - function Button(element) { - this._element = element; - Data.setData(element, DATA_KEY$1, this); - } // Getters + var Button = /*#__PURE__*/function (_BaseComponent) { + _inheritsLoose(Button, _BaseComponent); + function Button() { + return _BaseComponent.apply(this, arguments) || this; + } var _proto = Button.prototype; @@ -765,11 +793,6 @@ _proto.toggle = function toggle() { // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE)); - }; - - _proto.dispose = function dispose() { - Data.removeData(this._element, DATA_KEY$1); - this._element = null; } // Static ; @@ -787,19 +810,16 @@ }); }; - Button.getInstance = function getInstance(element) { - return Data.getData(element, DATA_KEY$1); - }; - _createClass(Button, null, [{ - key: "VERSION", + key: "DATA_KEY", + // Getters get: function get() { - return VERSION$1; + return DATA_KEY$1; } }]); return Button; - }(); + }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation @@ -1004,7 +1024,6 @@ */ var NAME$2 = 'carousel'; - var VERSION$2 = '5.0.0-alpha3'; var DATA_KEY$2 = 'bs.carousel'; var EVENT_KEY$2 = "." + DATA_KEY$2; var DATA_API_KEY$2 = '.data-api'; @@ -1072,25 +1091,29 @@ * ------------------------------------------------------------------------ */ - var Carousel = /*#__PURE__*/function () { - function Carousel(element, config) { - this._items = null; - this._interval = null; - this._activeElement = null; - this._isPaused = false; - this._isSliding = false; - this.touchTimeout = null; - this.touchStartX = 0; - this.touchDeltaX = 0; - this._config = this._getConfig(config); - this._element = element; - this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element); - this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; - this._pointerEvent = Boolean(window.PointerEvent); - - this._addEventListeners(); + var Carousel = /*#__PURE__*/function (_BaseComponent) { + _inheritsLoose(Carousel, _BaseComponent); - Data.setData(element, DATA_KEY$2, this); + function Carousel(element, config) { + var _this; + + _this = _BaseComponent.call(this, element) || this; + _this._items = null; + _this._interval = null; + _this._activeElement = null; + _this._isPaused = false; + _this._isSliding = false; + _this.touchTimeout = null; + _this.touchStartX = 0; + _this.touchDeltaX = 0; + _this._config = _this._getConfig(config); + _this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, _this._element); + _this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; + _this._pointerEvent = Boolean(window.PointerEvent); + + _this._addEventListeners(); + + return _this; } // Getters @@ -1149,7 +1172,7 @@ }; _proto.to = function to(index) { - var _this = this; + var _this2 = this; this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); @@ -1161,7 +1184,7 @@ if (this._isSliding) { EventHandler.one(this._element, EVENT_SLID, function () { - return _this.to(index); + return _this2.to(index); }); return; } @@ -1178,11 +1201,11 @@ }; _proto.dispose = function dispose() { + _BaseComponent.prototype.dispose.call(this); + EventHandler.off(this._element, EVENT_KEY$2); - Data.removeData(this._element, DATA_KEY$2); this._items = null; this._config = null; - this._element = null; this._interval = null; this._isPaused = null; this._isSliding = null; @@ -1218,20 +1241,20 @@ }; _proto._addEventListeners = function _addEventListeners() { - var _this2 = this; + var _this3 = this; if (this._config.keyboard) { EventHandler.on(this._element, EVENT_KEYDOWN, function (event) { - return _this2._keydown(event); + return _this3._keydown(event); }); } if (this._config.pause === 'hover') { EventHandler.on(this._element, EVENT_MOUSEENTER, function (event) { - return _this2.pause(event); + return _this3.pause(event); }); EventHandler.on(this._element, EVENT_MOUSELEAVE, function (event) { - return _this2.cycle(event); + return _this3.cycle(event); }); } @@ -1241,33 +1264,33 @@ }; _proto._addTouchEventListeners = function _addTouchEventListeners() { - var _this3 = this; + var _this4 = this; var start = function start(event) { - if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { - _this3.touchStartX = event.clientX; - } else if (!_this3._pointerEvent) { - _this3.touchStartX = event.touches[0].clientX; + if (_this4._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { + _this4.touchStartX = event.clientX; + } else if (!_this4._pointerEvent) { + _this4.touchStartX = event.touches[0].clientX; } }; var move = function move(event) { // ensure swiping with one touch and not pinching if (event.touches && event.touches.length > 1) { - _this3.touchDeltaX = 0; + _this4.touchDeltaX = 0; } else { - _this3.touchDeltaX = event.touches[0].clientX - _this3.touchStartX; + _this4.touchDeltaX = event.touches[0].clientX - _this4.touchStartX; } }; var end = function end(event) { - if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { - _this3.touchDeltaX = event.clientX - _this3.touchStartX; + if (_this4._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { + _this4.touchDeltaX = event.clientX - _this4.touchStartX; } - _this3._handleSwipe(); + _this4._handleSwipe(); - if (_this3._config.pause === 'hover') { + if (_this4._config.pause === 'hover') { // If it's a touch-enabled device, mouseenter/leave are fired as // part of the mouse compatibility events on first tap - the carousel // would stop cycling until user tapped out of it; @@ -1275,15 +1298,15 @@ // (as if it's the second time we tap on it, mouseenter compat event // is NOT fired) and after a timeout (to allow for mouse compatibility // events to fire) we explicitly restart cycling - _this3.pause(); + _this4.pause(); - if (_this3.touchTimeout) { - clearTimeout(_this3.touchTimeout); + if (_this4.touchTimeout) { + clearTimeout(_this4.touchTimeout); } - _this3.touchTimeout = setTimeout(function (event) { - return _this3.cycle(event); - }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); + _this4.touchTimeout = setTimeout(function (event) { + return _this4.cycle(event); + }, TOUCHEVENT_COMPAT_WAIT + _this4._config.interval); } }; @@ -1403,7 +1426,7 @@ }; _proto._slide = function _slide(direction, element) { - var _this4 = this; + var _this5 = this; var activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); @@ -1464,9 +1487,9 @@ nextElement.classList.remove(directionalClassName, orderClassName); nextElement.classList.add(CLASS_NAME_ACTIVE$1); activeElement.classList.remove(CLASS_NAME_ACTIVE$1, orderClassName, directionalClassName); - _this4._isSliding = false; + _this5._isSliding = false; setTimeout(function () { - EventHandler.trigger(_this4._element, EVENT_SLID, { + EventHandler.trigger(_this5._element, EVENT_SLID, { relatedTarget: nextElement, direction: eventDirectionName, from: activeElementIndex, @@ -1552,24 +1575,20 @@ event.preventDefault(); }; - Carousel.getInstance = function getInstance(element) { - return Data.getData(element, DATA_KEY$2); - }; - _createClass(Carousel, null, [{ - key: "VERSION", + key: "Default", get: function get() { - return VERSION$2; + return Default; } }, { - key: "Default", + key: "DATA_KEY", get: function get() { - return Default; + return DATA_KEY$2; } }]); return Carousel; - }(); + }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation @@ -1615,7 +1634,6 @@ */ var NAME$3 = 'collapse'; - var VERSION$3 = '5.0.0-alpha3'; var DATA_KEY$3 = 'bs.collapse'; var EVENT_KEY$3 = "." + DATA_KEY$3; var DATA_API_KEY$3 = '.data-api'; @@ -1646,12 +1664,16 @@ * ------------------------------------------------------------------------ */ - var Collapse = /*#__PURE__*/function () { + var Collapse = /*#__PURE__*/function (_BaseComponent) { + _inheritsLoose(Collapse, _BaseComponent); + function Collapse(element, config) { - this._isTransitioning = false; - this._element = element; - this._config = this._getConfig(config); - this._triggerArray = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1 + "[href=\"#" + element.id + "\"]," + (SELECTOR_DATA_TOGGLE$1 + "[data-bs-target=\"#" + element.id + "\"]")); + var _this; + + _this = _BaseComponent.call(this, element) || this; + _this._isTransitioning = false; + _this._config = _this._getConfig(config); + _this._triggerArray = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1 + "[href=\"#" + element.id + "\"]," + (SELECTOR_DATA_TOGGLE$1 + "[data-bs-target=\"#" + element.id + "\"]")); var toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$1); for (var i = 0, len = toggleList.length; i < len; i++) { @@ -1662,23 +1684,23 @@ }); if (selector !== null && filterElement.length) { - this._selector = selector; + _this._selector = selector; - this._triggerArray.push(elem); + _this._triggerArray.push(elem); } } - this._parent = this._config.parent ? this._getParent() : null; + _this._parent = _this._config.parent ? _this._getParent() : null; - if (!this._config.parent) { - this._addAriaAndCollapsedClass(this._element, this._triggerArray); + if (!_this._config.parent) { + _this._addAriaAndCollapsedClass(_this._element, _this._triggerArray); } - if (this._config.toggle) { - this.toggle(); + if (_this._config.toggle) { + _this.toggle(); } - Data.setData(element, DATA_KEY$3, this); + return _this; } // Getters @@ -1694,7 +1716,7 @@ }; _proto.show = function show() { - var _this = this; + var _this2 = this; if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) { return; @@ -1705,8 +1727,8 @@ if (this._parent) { actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(function (elem) { - if (typeof _this._config.parent === 'string') { - return elem.getAttribute('data-bs-parent') === _this._config.parent; + if (typeof _this2._config.parent === 'string') { + return elem.getAttribute('data-bs-parent') === _this2._config.parent; } return elem.classList.contains(CLASS_NAME_COLLAPSE); @@ -1766,15 +1788,15 @@ this.setTransitioning(true); var complete = function complete() { - _this._element.classList.remove(CLASS_NAME_COLLAPSING); + _this2._element.classList.remove(CLASS_NAME_COLLAPSING); - _this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW); + _this2._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW); - _this._element.style[dimension] = ''; + _this2._element.style[dimension] = ''; - _this.setTransitioning(false); + _this2.setTransitioning(false); - EventHandler.trigger(_this._element, EVENT_SHOWN); + EventHandler.trigger(_this2._element, EVENT_SHOWN); }; var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); @@ -1786,7 +1808,7 @@ }; _proto.hide = function hide() { - var _this2 = this; + var _this3 = this; if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) { return; @@ -1824,13 +1846,13 @@ this.setTransitioning(true); var complete = function complete() { - _this2.setTransitioning(false); + _this3.setTransitioning(false); - _this2._element.classList.remove(CLASS_NAME_COLLAPSING); + _this3._element.classList.remove(CLASS_NAME_COLLAPSING); - _this2._element.classList.add(CLASS_NAME_COLLAPSE); + _this3._element.classList.add(CLASS_NAME_COLLAPSE); - EventHandler.trigger(_this2._element, EVENT_HIDDEN); + EventHandler.trigger(_this3._element, EVENT_HIDDEN); }; this._element.style[dimension] = ''; @@ -1844,10 +1866,10 @@ }; _proto.dispose = function dispose() { - Data.removeData(this._element, DATA_KEY$3); + _BaseComponent.prototype.dispose.call(this); + this._config = null; this._parent = null; - this._element = null; this._triggerArray = null; this._isTransitioning = null; } // Private @@ -1866,7 +1888,7 @@ }; _proto._getParent = function _getParent() { - var _this3 = this; + var _this4 = this; var parent = this._config.parent; @@ -1883,7 +1905,7 @@ SelectorEngine.find(selector, parent).forEach(function (element) { var selected = getElementFromSelector(element); - _this3._addAriaAndCollapsedClass(selected, [element]); + _this4._addAriaAndCollapsedClass(selected, [element]); }); return parent; }; @@ -1934,24 +1956,20 @@ }); }; - Collapse.getInstance = function getInstance(element) { - return Data.getData(element, DATA_KEY$3); - }; - _createClass(Collapse, null, [{ - key: "VERSION", + key: "Default", get: function get() { - return VERSION$3; + return Default$1; } }, { - key: "Default", + key: "DATA_KEY", get: function get() { - return Default$1; + return DATA_KEY$3; } }]); return Collapse; - }(); + }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation @@ -4631,7 +4649,6 @@ */ var NAME$4 = 'dropdown'; - var VERSION$4 = '5.0.0-alpha3'; var DATA_KEY$4 = 'bs.dropdown'; var EVENT_KEY$4 = "." + DATA_KEY$4; var DATA_API_KEY$4 = '.data-api'; @@ -4692,17 +4709,21 @@ * ------------------------------------------------------------------------ */ - var Dropdown = /*#__PURE__*/function () { + var Dropdown = /*#__PURE__*/function (_BaseComponent) { + _inheritsLoose(Dropdown, _BaseComponent); + function Dropdown(element, config) { - this._element = element; - this._popper = null; - this._config = this._getConfig(config); - this._menu = this._getMenuElement(); - this._inNavbar = this._detectNavbar(); + var _this; + + _this = _BaseComponent.call(this, element) || this; + _this._popper = null; + _this._config = _this._getConfig(config); + _this._menu = _this._getMenuElement(); + _this._inNavbar = _this._detectNavbar(); - this._addEventListeners(); + _this._addEventListeners(); - Data.setData(element, DATA_KEY$4, this); + return _this; } // Getters @@ -4818,9 +4839,9 @@ }; _proto.dispose = function dispose() { - Data.removeData(this._element, DATA_KEY$4); + _BaseComponent.prototype.dispose.call(this); + EventHandler.off(this._element, EVENT_KEY$4); - this._element = null; this._menu = null; if (this._popper) { @@ -4840,13 +4861,13 @@ ; _proto._addEventListeners = function _addEventListeners() { - var _this = this; + var _this2 = this; EventHandler.on(this._element, EVENT_CLICK, function (event) { event.preventDefault(); event.stopPropagation(); - _this.toggle(); + _this2.toggle(); }); }; @@ -4882,13 +4903,13 @@ }; _proto._getOffset = function _getOffset() { - var _this2 = this; + var _this3 = this; var offset = {}; if (typeof this._config.offset === 'function') { offset.fn = function (data) { - data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {}); + data.offsets = _extends({}, data.offsets, _this3._config.offset(data.offsets, _this3._element) || {}); return data; }; } else { @@ -5050,15 +5071,14 @@ return; } - var index = items.indexOf(event.target); + var index = items.indexOf(event.target); // Up if (event.key === ARROW_UP_KEY && index > 0) { - // Up index--; - } + } // Down + if (event.key === ARROW_DOWN_KEY && index < items.length - 1) { - // Down index++; } // index is -1 if the first keydown is an ArrowUp @@ -5067,16 +5087,7 @@ items[index].focus(); }; - Dropdown.getInstance = function getInstance(element) { - return Data.getData(element, DATA_KEY$4); - }; - _createClass(Dropdown, null, [{ - key: "VERSION", - get: function get() { - return VERSION$4; - } - }, { key: "Default", get: function get() { return Default$2; @@ -5086,10 +5097,15 @@ get: function get() { return DefaultType$2; } + }, { + key: "DATA_KEY", + get: function get() { + return DATA_KEY$4; + } }]); return Dropdown; - }(); + }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation @@ -5139,7 +5155,6 @@ */ var NAME$5 = 'modal'; - var VERSION$5 = '5.0.0-alpha3'; var DATA_KEY$5 = 'bs.modal'; var EVENT_KEY$5 = "." + DATA_KEY$5; var DATA_API_KEY$5 = '.data-api'; @@ -5147,14 +5162,12 @@ var Default$3 = { backdrop: true, keyboard: true, - focus: true, - show: true + focus: true }; var DefaultType$3 = { backdrop: '(boolean|string)', keyboard: 'boolean', - focus: 'boolean', - show: 'boolean' + focus: 'boolean' }; var EVENT_HIDE$2 = "hide" + EVENT_KEY$5; var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5; @@ -5186,18 +5199,22 @@ * ------------------------------------------------------------------------ */ - var Modal = /*#__PURE__*/function () { + var Modal = /*#__PURE__*/function (_BaseComponent) { + _inheritsLoose(Modal, _BaseComponent); + function Modal(element, config) { - this._config = this._getConfig(config); - this._element = element; - this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element); - this._backdrop = null; - this._isShown = false; - this._isBodyOverflowing = false; - this._ignoreBackdropClick = false; - this._isTransitioning = false; - this._scrollbarWidth = 0; - Data.setData(element, DATA_KEY$5, this); + var _this; + + _this = _BaseComponent.call(this, element) || this; + _this._config = _this._getConfig(config); + _this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, element); + _this._backdrop = null; + _this._isShown = false; + _this._isBodyOverflowing = false; + _this._ignoreBackdropClick = false; + _this._isTransitioning = false; + _this._scrollbarWidth = 0; + return _this; } // Getters @@ -5209,7 +5226,7 @@ }; _proto.show = function show(relatedTarget) { - var _this = this; + var _this2 = this; if (this._isShown || this._isTransitioning) { return; @@ -5240,23 +5257,23 @@ this._setResizeEvent(); EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) { - return _this.hide(event); + return _this2.hide(event); }); EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () { - EventHandler.one(_this._element, EVENT_MOUSEUP_DISMISS, function (event) { - if (event.target === _this._element) { - _this._ignoreBackdropClick = true; + EventHandler.one(_this2._element, EVENT_MOUSEUP_DISMISS, function (event) { + if (event.target === _this2._element) { + _this2._ignoreBackdropClick = true; } }); }); this._showBackdrop(function () { - return _this._showElement(relatedTarget); + return _this2._showElement(relatedTarget); }); }; _proto.hide = function hide(event) { - var _this2 = this; + var _this3 = this; if (event) { event.preventDefault(); @@ -5294,7 +5311,7 @@ if (transition) { var transitionDuration = getTransitionDurationFromElement(this._element); EventHandler.one(this._element, TRANSITION_END, function (event) { - return _this2._hideModal(event); + return _this3._hideModal(event); }); emulateTransitionEnd(this._element, transitionDuration); } else { @@ -5306,16 +5323,17 @@ [window, this._element, this._dialog].forEach(function (htmlElement) { return EventHandler.off(htmlElement, EVENT_KEY$5); }); + + _BaseComponent.prototype.dispose.call(this); /** * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` * Do not move `document` in `htmlElements` array * It will remove `EVENT_CLICK_DATA_API` event that should remain */ + EventHandler.off(document, EVENT_FOCUSIN); - Data.removeData(this._element, DATA_KEY$5); this._config = null; - this._element = null; this._dialog = null; this._backdrop = null; this._isShown = null; @@ -5337,7 +5355,7 @@ }; _proto._showElement = function _showElement(relatedTarget) { - var _this3 = this; + var _this4 = this; var transition = this._element.classList.contains(CLASS_NAME_FADE); @@ -5373,12 +5391,12 @@ } var transitionComplete = function transitionComplete() { - if (_this3._config.focus) { - _this3._element.focus(); + if (_this4._config.focus) { + _this4._element.focus(); } - _this3._isTransitioning = false; - EventHandler.trigger(_this3._element, EVENT_SHOWN$2, { + _this4._isTransitioning = false; + EventHandler.trigger(_this4._element, EVENT_SHOWN$2, { relatedTarget: relatedTarget }); }; @@ -5393,28 +5411,28 @@ }; _proto._enforceFocus = function _enforceFocus() { - var _this4 = this; + var _this5 = this; EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop EventHandler.on(document, EVENT_FOCUSIN, function (event) { - if (document !== event.target && _this4._element !== event.target && !_this4._element.contains(event.target)) { - _this4._element.focus(); + if (document !== event.target && _this5._element !== event.target && !_this5._element.contains(event.target)) { + _this5._element.focus(); } }); }; _proto._setEscapeEvent = function _setEscapeEvent() { - var _this5 = this; + var _this6 = this; if (this._isShown) { EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, function (event) { - if (_this5._config.keyboard && event.key === ESCAPE_KEY$1) { + if (_this6._config.keyboard && event.key === ESCAPE_KEY$1) { event.preventDefault(); - _this5.hide(); - } else if (!_this5._config.keyboard && event.key === ESCAPE_KEY$1) { - _this5._triggerBackdropTransition(); + _this6.hide(); + } else if (!_this6._config.keyboard && event.key === ESCAPE_KEY$1) { + _this6._triggerBackdropTransition(); } }); } else { @@ -5423,11 +5441,11 @@ }; _proto._setResizeEvent = function _setResizeEvent() { - var _this6 = this; + var _this7 = this; if (this._isShown) { EventHandler.on(window, EVENT_RESIZE, function () { - return _this6._adjustDialog(); + return _this7._adjustDialog(); }); } else { EventHandler.off(window, EVENT_RESIZE); @@ -5435,7 +5453,7 @@ }; _proto._hideModal = function _hideModal() { - var _this7 = this; + var _this8 = this; this._element.style.display = 'none'; @@ -5450,11 +5468,11 @@ this._showBackdrop(function () { document.body.classList.remove(CLASS_NAME_OPEN); - _this7._resetAdjustments(); + _this8._resetAdjustments(); - _this7._resetScrollbar(); + _this8._resetScrollbar(); - EventHandler.trigger(_this7._element, EVENT_HIDDEN$2); + EventHandler.trigger(_this8._element, EVENT_HIDDEN$2); }); }; @@ -5465,7 +5483,7 @@ }; _proto._showBackdrop = function _showBackdrop(callback) { - var _this8 = this; + var _this9 = this; var animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : ''; @@ -5479,8 +5497,8 @@ document.body.appendChild(this._backdrop); EventHandler.on(this._element, EVENT_CLICK_DISMISS, function (event) { - if (_this8._ignoreBackdropClick) { - _this8._ignoreBackdropClick = false; + if (_this9._ignoreBackdropClick) { + _this9._ignoreBackdropClick = false; return; } @@ -5488,10 +5506,10 @@ return; } - if (_this8._config.backdrop === 'static') { - _this8._triggerBackdropTransition(); + if (_this9._config.backdrop === 'static') { + _this9._triggerBackdropTransition(); } else { - _this8.hide(); + _this9.hide(); } }); @@ -5513,7 +5531,7 @@ this._backdrop.classList.remove(CLASS_NAME_SHOW$2); var callbackRemove = function callbackRemove() { - _this8._removeBackdrop(); + _this9._removeBackdrop(); callback(); }; @@ -5532,7 +5550,7 @@ }; _proto._triggerBackdropTransition = function _triggerBackdropTransition() { - var _this9 = this; + var _this10 = this; var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); @@ -5551,13 +5569,13 @@ var modalTransitionDuration = getTransitionDurationFromElement(this._dialog); EventHandler.off(this._element, TRANSITION_END); EventHandler.one(this._element, TRANSITION_END, function () { - _this9._element.classList.remove(CLASS_NAME_STATIC); + _this10._element.classList.remove(CLASS_NAME_STATIC); if (!isModalOverflowing) { - EventHandler.one(_this9._element, TRANSITION_END, function () { - _this9._element.style.overflowY = ''; + EventHandler.one(_this10._element, TRANSITION_END, function () { + _this10._element.style.overflowY = ''; }); - emulateTransitionEnd(_this9._element, modalTransitionDuration); + emulateTransitionEnd(_this10._element, modalTransitionDuration); } }); emulateTransitionEnd(this._element, modalTransitionDuration); @@ -5592,7 +5610,7 @@ }; _proto._setScrollbar = function _setScrollbar() { - var _this10 = this; + var _this11 = this; if (this._isBodyOverflowing) { // Note: DOMNode.style.paddingRight returns the actual value or '' if not set @@ -5602,14 +5620,14 @@ var actualPadding = element.style.paddingRight; var calculatedPadding = window.getComputedStyle(element)['padding-right']; Manipulator.setDataAttribute(element, 'padding-right', actualPadding); - element.style.paddingRight = Number.parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px"; + element.style.paddingRight = Number.parseFloat(calculatedPadding) + _this11._scrollbarWidth + "px"; }); // Adjust sticky content margin SelectorEngine.find(SELECTOR_STICKY_CONTENT).forEach(function (element) { var actualMargin = element.style.marginRight; var calculatedMargin = window.getComputedStyle(element)['margin-right']; Manipulator.setDataAttribute(element, 'margin-right', actualMargin); - element.style.marginRight = Number.parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px"; + element.style.marginRight = Number.parseFloat(calculatedMargin) - _this11._scrollbarWidth + "px"; }); // Adjust body padding var actualPadding = document.body.style.paddingRight; @@ -5678,30 +5696,24 @@ } data[config](relatedTarget); - } else if (_config.show) { - data.show(relatedTarget); } }); }; - Modal.getInstance = function getInstance(element) { - return Data.getData(element, DATA_KEY$5); - }; - _createClass(Modal, null, [{ - key: "VERSION", + key: "Default", get: function get() { - return VERSION$5; + return Default$3; } }, { - key: "Default", + key: "DATA_KEY", get: function get() { - return Default$3; + return DATA_KEY$5; } }]); return Modal; - }(); + }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation @@ -5710,7 +5722,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) { - var _this11 = this; + var _this12 = this; var target = getElementFromSelector(this); @@ -5725,8 +5737,8 @@ } EventHandler.one(target, EVENT_HIDDEN$2, function () { - if (isVisible(_this11)) { - _this11.focus(); + if (isVisible(_this12)) { + _this12.focus(); } }); }); @@ -5897,7 +5909,6 @@ */ var NAME$6 = 'tooltip'; - var VERSION$6 = '5.0.0-alpha3'; var DATA_KEY$6 = 'bs.tooltip'; var EVENT_KEY$6 = "." + DATA_KEY$6; var CLASS_PREFIX = 'bs-tooltip'; @@ -5916,6 +5927,7 @@ container: '(string|element|boolean)', fallbackPlacement: '(string|array)', boundary: '(string|element)', + customClass: '(string|function)', sanitize: 'boolean', sanitizeFn: '(null|function)', allowList: 'object', @@ -5930,7 +5942,7 @@ }; var Default$4 = { animation: true, - template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div></div>', + template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>', trigger: 'hover focus', title: '', delay: 0, @@ -5941,6 +5953,7 @@ container: false, fallbackPlacement: 'flip', boundary: 'scrollParent', + customClass: '', sanitize: true, sanitizeFn: null, allowList: DefaultAllowlist, @@ -5974,26 +5987,30 @@ * ------------------------------------------------------------------------ */ - var Tooltip = /*#__PURE__*/function () { + var Tooltip = /*#__PURE__*/function (_BaseComponent) { + _inheritsLoose(Tooltip, _BaseComponent); + function Tooltip(element, config) { + var _this; + if (typeof Popper === 'undefined') { throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); - } // private + } + _this = _BaseComponent.call(this, element) || this; // private - this._isEnabled = true; - this._timeout = 0; - this._hoverState = ''; - this._activeTrigger = {}; - this._popper = null; // Protected + _this._isEnabled = true; + _this._timeout = 0; + _this._hoverState = ''; + _this._activeTrigger = {}; + _this._popper = null; // Protected - this.element = element; - this.config = this._getConfig(config); - this.tip = null; + _this.config = _this._getConfig(config); + _this.tip = null; - this._setListeners(); + _this._setListeners(); - Data.setData(element, this.constructor.DATA_KEY, this); + return _this; } // Getters @@ -6046,9 +6063,8 @@ _proto.dispose = function dispose() { clearTimeout(this._timeout); - Data.removeData(this.element, this.constructor.DATA_KEY); - EventHandler.off(this.element, this.constructor.EVENT_KEY); - EventHandler.off(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler); + EventHandler.off(this._element, this.constructor.EVENT_KEY); + EventHandler.off(this._element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler); if (this.tip) { this.tip.parentNode.removeChild(this.tip); @@ -6064,22 +6080,23 @@ } this._popper = null; - this.element = null; this.config = null; this.tip = null; + + _BaseComponent.prototype.dispose.call(this); }; _proto.show = function show() { - var _this = this; + var _this2 = this; - if (this.element.style.display === 'none') { + if (this._element.style.display === 'none') { throw new Error('Please use show on visible elements'); } if (this.isWithContent() && this._isEnabled) { - var showEvent = EventHandler.trigger(this.element, this.constructor.Event.SHOW); - var shadowRoot = findShadowRoot(this.element); - var isInTheDom = shadowRoot === null ? this.element.ownerDocument.documentElement.contains(this.element) : shadowRoot.contains(this.element); + var showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW); + var shadowRoot = findShadowRoot(this._element); + var isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element); if (showEvent.defaultPrevented || !isInTheDom) { return; @@ -6088,14 +6105,16 @@ var tip = this.getTipElement(); var tipId = getUID(this.constructor.NAME); tip.setAttribute('id', tipId); - this.element.setAttribute('aria-describedby', tipId); + + this._element.setAttribute('aria-describedby', tipId); + this.setContent(); if (this.config.animation) { tip.classList.add(CLASS_NAME_FADE$1); } - var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; + var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this._element) : this.config.placement; var attachment = this._getAttachment(placement); @@ -6105,17 +6124,25 @@ Data.setData(tip, this.constructor.DATA_KEY, this); - if (!this.element.ownerDocument.documentElement.contains(this.tip)) { + if (!this._element.ownerDocument.documentElement.contains(this.tip)) { container.appendChild(tip); } - EventHandler.trigger(this.element, this.constructor.Event.INSERTED); - this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment)); - tip.classList.add(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we add extra + EventHandler.trigger(this._element, this.constructor.Event.INSERTED); + this._popper = new Popper(this._element, tip, this._getPopperConfig(attachment)); + tip.classList.add(CLASS_NAME_SHOW$3); + var customClass = typeof this.config.customClass === 'function' ? this.config.customClass() : this.config.customClass; + + if (customClass) { + var _tip$classList; + + (_tip$classList = tip.classList).add.apply(_tip$classList, customClass.split(' ')); + } // 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 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html + if ('ontouchstart' in document.documentElement) { var _ref; @@ -6125,16 +6152,16 @@ } var complete = function complete() { - if (_this.config.animation) { - _this._fixTransition(); + if (_this2.config.animation) { + _this2._fixTransition(); } - var prevHoverState = _this._hoverState; - _this._hoverState = null; - EventHandler.trigger(_this.element, _this.constructor.Event.SHOWN); + var prevHoverState = _this2._hoverState; + _this2._hoverState = null; + EventHandler.trigger(_this2._element, _this2.constructor.Event.SHOWN); if (prevHoverState === HOVER_STATE_OUT) { - _this._leave(null, _this); + _this2._leave(null, _this2); } }; @@ -6149,7 +6176,7 @@ }; _proto.hide = function hide() { - var _this2 = this; + var _this3 = this; if (!this._popper) { return; @@ -6158,20 +6185,20 @@ var tip = this.getTipElement(); var complete = function complete() { - if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) { + if (_this3._hoverState !== HOVER_STATE_SHOW && tip.parentNode) { tip.parentNode.removeChild(tip); } - _this2._cleanTipClass(); + _this3._cleanTipClass(); - _this2.element.removeAttribute('aria-describedby'); + _this3._element.removeAttribute('aria-describedby'); - EventHandler.trigger(_this2.element, _this2.constructor.Event.HIDDEN); + EventHandler.trigger(_this3._element, _this3.constructor.Event.HIDDEN); - _this2._popper.destroy(); + _this3._popper.destroy(); }; - var hideEvent = EventHandler.trigger(this.element, this.constructor.Event.HIDE); + var hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE); if (hideEvent.defaultPrevented) { return; @@ -6266,10 +6293,10 @@ }; _proto.getTitle = function getTitle() { - var title = this.element.getAttribute('data-bs-original-title'); + var title = this._element.getAttribute('data-bs-original-title'); if (!title) { - title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; + title = typeof this.config.title === 'function' ? this.config.title.call(this._element) : this.config.title; } return title; @@ -6277,7 +6304,7 @@ ; _proto._getPopperConfig = function _getPopperConfig(attachment) { - var _this3 = this; + var _this4 = this; var defaultBsConfig = { placement: attachment, @@ -6295,11 +6322,11 @@ }, onCreate: function onCreate(data) { if (data.originalPlacement !== data.placement) { - _this3._handlePopperPlacementChange(data); + _this4._handlePopperPlacementChange(data); } }, onUpdate: function onUpdate(data) { - return _this3._handlePopperPlacementChange(data); + return _this4._handlePopperPlacementChange(data); } }; return _extends({}, defaultBsConfig, this.config.popperConfig); @@ -6310,13 +6337,13 @@ }; _proto._getOffset = function _getOffset() { - var _this4 = this; + var _this5 = this; var offset = {}; if (typeof this.config.offset === 'function') { offset.fn = function (data) { - data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element) || {}); + data.offsets = _extends({}, data.offsets, _this5.config.offset(data.offsets, _this5._element) || {}); return data; }; } else { @@ -6343,33 +6370,33 @@ }; _proto._setListeners = function _setListeners() { - var _this5 = this; + var _this6 = this; var triggers = this.config.trigger.split(' '); triggers.forEach(function (trigger) { if (trigger === 'click') { - EventHandler.on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) { - return _this5.toggle(event); + EventHandler.on(_this6._element, _this6.constructor.Event.CLICK, _this6.config.selector, function (event) { + return _this6.toggle(event); }); } else if (trigger !== TRIGGER_MANUAL) { - 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); + var eventIn = trigger === TRIGGER_HOVER ? _this6.constructor.Event.MOUSEENTER : _this6.constructor.Event.FOCUSIN; + var eventOut = trigger === TRIGGER_HOVER ? _this6.constructor.Event.MOUSELEAVE : _this6.constructor.Event.FOCUSOUT; + EventHandler.on(_this6._element, eventIn, _this6.config.selector, function (event) { + return _this6._enter(event); }); - EventHandler.on(_this5.element, eventOut, _this5.config.selector, function (event) { - return _this5._leave(event); + EventHandler.on(_this6._element, eventOut, _this6.config.selector, function (event) { + return _this6._leave(event); }); } }); this._hideModalHandler = function () { - if (_this5.element) { - _this5.hide(); + if (_this6._element) { + _this6.hide(); } }; - EventHandler.on(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler); + EventHandler.on(this._element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler); if (this.config.selector) { this.config = _extends({}, this.config, { @@ -6382,12 +6409,18 @@ }; _proto._fixTitle = function _fixTitle() { - var title = this.element.getAttribute('title'); - var originalTitleType = typeof this.element.getAttribute('data-bs-original-title'); + var title = this._element.getAttribute('title'); + + var originalTitleType = typeof this._element.getAttribute('data-bs-original-title'); if (title || originalTitleType !== 'string') { - this.element.setAttribute('data-bs-original-title', title || ''); - this.element.setAttribute('title', ''); + this._element.setAttribute('data-bs-original-title', title || ''); + + if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) { + this._element.setAttribute('aria-label', title); + } + + this._element.setAttribute('title', ''); } }; @@ -6467,7 +6500,7 @@ }; _proto._getConfig = function _getConfig(config) { - var dataAttributes = Manipulator.getDataAttributes(this.element); + var dataAttributes = Manipulator.getDataAttributes(this._element); Object.keys(dataAttributes).forEach(function (dataAttr) { if (DISALLOWED_ATTRIBUTES.has(dataAttr)) { delete dataAttributes[dataAttr]; @@ -6579,16 +6612,7 @@ }); }; - Tooltip.getInstance = function getInstance(element) { - return Data.getData(element, DATA_KEY$6); - }; - _createClass(Tooltip, null, [{ - key: "VERSION", - get: function get() { - return VERSION$6; - } - }, { key: "Default", get: function get() { return Default$4; @@ -6621,7 +6645,7 @@ }]); return Tooltip; - }(); + }(BaseComponent); /** * ------------------------------------------------------------------------ * jQuery @@ -6653,7 +6677,6 @@ */ var NAME$7 = 'popover'; - var VERSION$7 = '5.0.0-alpha3'; var DATA_KEY$7 = 'bs.popover'; var EVENT_KEY$7 = "." + DATA_KEY$7; var CLASS_PREFIX$1 = 'bs-popover'; @@ -6663,7 +6686,7 @@ placement: 'right', trigger: 'click', content: '', - template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' + template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>' }); var DefaultType$5 = _extends({}, Tooltip.DefaultType, { @@ -6714,7 +6737,7 @@ var content = this._getContent(); if (typeof content === 'function') { - content = content.call(this.element); + content = content.call(this._element); } this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content); @@ -6727,7 +6750,7 @@ }; _proto._getContent = function _getContent() { - return this.element.getAttribute('data-bs-content') || this.config.content; + return this._element.getAttribute('data-bs-content') || this.config.content; }; _proto._cleanTipClass = function _cleanTipClass() { @@ -6769,18 +6792,9 @@ }); }; - Popover.getInstance = function getInstance(element) { - return Data.getData(element, DATA_KEY$7); - }; - _createClass(Popover, null, [{ - key: "VERSION", - // Getters - get: function get() { - return VERSION$7; - } - }, { key: "Default", + // Getters get: function get() { return Default$5; } @@ -6844,7 +6858,6 @@ */ var NAME$8 = 'scrollspy'; - var VERSION$8 = '5.0.0-alpha3'; var DATA_KEY$8 = 'bs.scrollspy'; var EVENT_KEY$8 = "." + DATA_KEY$8; var DATA_API_KEY$6 = '.data-api'; @@ -6878,26 +6891,29 @@ * ------------------------------------------------------------------------ */ - var ScrollSpy = /*#__PURE__*/function () { - function ScrollSpy(element, config) { - var _this = this; + var ScrollSpy = /*#__PURE__*/function (_BaseComponent) { + _inheritsLoose(ScrollSpy, _BaseComponent); - this._element = element; - this._scrollElement = element.tagName === 'BODY' ? window : element; - this._config = this._getConfig(config); - this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + ", " + this._config.target + " " + SELECTOR_LIST_ITEMS + ", " + this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM; - this._offsets = []; - this._targets = []; - this._activeTarget = null; - this._scrollHeight = 0; - EventHandler.on(this._scrollElement, EVENT_SCROLL, function (event) { + function ScrollSpy(element, config) { + var _this; + + _this = _BaseComponent.call(this, element) || this; + _this._scrollElement = element.tagName === 'BODY' ? window : element; + _this._config = _this._getConfig(config); + _this._selector = _this._config.target + " " + SELECTOR_NAV_LINKS + ", " + _this._config.target + " " + SELECTOR_LIST_ITEMS + ", " + _this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM; + _this._offsets = []; + _this._targets = []; + _this._activeTarget = null; + _this._scrollHeight = 0; + EventHandler.on(_this._scrollElement, EVENT_SCROLL, function (event) { return _this._process(event); }); - this.refresh(); - this._process(); + _this.refresh(); + + _this._process(); - Data.setData(element, DATA_KEY$8, this); + return _this; } // Getters @@ -6939,9 +6955,9 @@ }; _proto.dispose = function dispose() { - Data.removeData(this._element, DATA_KEY$8); + _BaseComponent.prototype.dispose.call(this); + EventHandler.off(this._scrollElement, EVENT_KEY$8); - this._element = null; this._scrollElement = null; this._config = null; this._selector = null; @@ -7086,24 +7102,20 @@ }); }; - ScrollSpy.getInstance = function getInstance(element) { - return Data.getData(element, DATA_KEY$8); - }; - _createClass(ScrollSpy, null, [{ - key: "VERSION", + key: "Default", get: function get() { - return VERSION$8; + return Default$6; } }, { - key: "Default", + key: "DATA_KEY", get: function get() { - return Default$6; + return DATA_KEY$8; } }]); return ScrollSpy; - }(); + }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation @@ -7146,7 +7158,6 @@ */ var NAME$9 = 'tab'; - var VERSION$9 = '5.0.0-alpha3'; var DATA_KEY$9 = 'bs.tab'; var EVENT_KEY$9 = "." + DATA_KEY$9; var DATA_API_KEY$7 = '.data-api'; @@ -7173,12 +7184,12 @@ * ------------------------------------------------------------------------ */ - var Tab = /*#__PURE__*/function () { - function Tab(element) { - this._element = element; - Data.setData(this._element, DATA_KEY$9, this); - } // Getters + var Tab = /*#__PURE__*/function (_BaseComponent) { + _inheritsLoose(Tab, _BaseComponent); + function Tab() { + return _BaseComponent.apply(this, arguments) || this; + } var _proto = Tab.prototype; @@ -7233,11 +7244,6 @@ } else { complete(); } - }; - - _proto.dispose = function dispose() { - Data.removeData(this._element, DATA_KEY$9); - this._element = null; } // Private ; @@ -7320,19 +7326,16 @@ }); }; - Tab.getInstance = function getInstance(element) { - return Data.getData(element, DATA_KEY$9); - }; - _createClass(Tab, null, [{ - key: "VERSION", + key: "DATA_KEY", + // Getters get: function get() { - return VERSION$9; + return DATA_KEY$9; } }]); return Tab; - }(); + }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation @@ -7375,7 +7378,6 @@ */ var NAME$a = 'toast'; - var VERSION$a = '5.0.0-alpha3'; var DATA_KEY$a = 'bs.toast'; var EVENT_KEY$a = "." + DATA_KEY$a; var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$a; @@ -7404,15 +7406,19 @@ * ------------------------------------------------------------------------ */ - var Toast = /*#__PURE__*/function () { + var Toast = /*#__PURE__*/function (_BaseComponent) { + _inheritsLoose(Toast, _BaseComponent); + function Toast(element, config) { - this._element = element; - this._config = this._getConfig(config); - this._timeout = null; + var _this; - this._setListeners(); + _this = _BaseComponent.call(this, element) || this; + _this._config = _this._getConfig(config); + _this._timeout = null; - Data.setData(element, DATA_KEY$a, this); + _this._setListeners(); + + return _this; } // Getters @@ -7420,7 +7426,7 @@ // Public _proto.show = function show() { - var _this = this; + var _this2 = this; var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4); @@ -7435,16 +7441,16 @@ } var complete = function complete() { - _this._element.classList.remove(CLASS_NAME_SHOWING); + _this2._element.classList.remove(CLASS_NAME_SHOWING); - _this._element.classList.add(CLASS_NAME_SHOW$6); + _this2._element.classList.add(CLASS_NAME_SHOW$6); - EventHandler.trigger(_this._element, EVENT_SHOWN$4); + EventHandler.trigger(_this2._element, EVENT_SHOWN$4); - if (_this._config.autohide) { - _this._timeout = setTimeout(function () { - _this.hide(); - }, _this._config.delay); + if (_this2._config.autohide) { + _this2._timeout = setTimeout(function () { + _this2.hide(); + }, _this2._config.delay); } }; @@ -7464,7 +7470,7 @@ }; _proto.hide = function hide() { - var _this2 = this; + var _this3 = this; if (!this._element.classList.contains(CLASS_NAME_SHOW$6)) { return; @@ -7477,9 +7483,9 @@ } var complete = function complete() { - _this2._element.classList.add(CLASS_NAME_HIDE); + _this3._element.classList.add(CLASS_NAME_HIDE); - EventHandler.trigger(_this2._element, EVENT_HIDDEN$4); + EventHandler.trigger(_this3._element, EVENT_HIDDEN$4); }; this._element.classList.remove(CLASS_NAME_SHOW$6); @@ -7501,8 +7507,9 @@ } EventHandler.off(this._element, EVENT_CLICK_DISMISS$1); - Data.removeData(this._element, DATA_KEY$a); - this._element = null; + + _BaseComponent.prototype.dispose.call(this); + this._config = null; } // Private ; @@ -7514,10 +7521,10 @@ }; _proto._setListeners = function _setListeners() { - var _this3 = this; + var _this4 = this; EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () { - return _this3.hide(); + return _this4.hide(); }); }; @@ -7547,16 +7554,7 @@ }); }; - Toast.getInstance = function getInstance(element) { - return Data.getData(element, DATA_KEY$a); - }; - _createClass(Toast, null, [{ - key: "VERSION", - get: function get() { - return VERSION$a; - } - }, { key: "DefaultType", get: function get() { return DefaultType$7; @@ -7566,10 +7564,15 @@ get: function get() { return Default$7; } + }, { + key: "DATA_KEY", + get: function get() { + return DATA_KEY$a; + } }]); return Toast; - }(); + }(BaseComponent); /** * ------------------------------------------------------------------------ * jQuery |