Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2020-12-03 17:18:59 +0300
committerGitHub <noreply@github.com>2020-12-03 17:18:59 +0300
commitcfe31592d7b487a769fd8d14ddf7898c07425280 (patch)
tree79d9dc546df2099295a948a26ca2f9ae71a3a733 /dist/js/bootstrap.esm.js
parentcfd00b5eeb7b7440afb3f115a66ea3c58e2e2d5d (diff)
Dist (#32323)
Diffstat (limited to 'dist/js/bootstrap.esm.js')
-rw-r--r--dist/js/bootstrap.esm.js813
1 files changed, 408 insertions, 405 deletions
diff --git a/dist/js/bootstrap.esm.js b/dist/js/bootstrap.esm.js
index 855cc43947..526030b94b 100644
--- a/dist/js/bootstrap.esm.js
+++ b/dist/js/bootstrap.esm.js
@@ -576,8 +576,48 @@ var EventHandler = {
* ------------------------------------------------------------------------
*/
-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';
@@ -594,15 +634,12 @@ var CLASSNAME_SHOW = 'show';
* ------------------------------------------------------------------------
*/
-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;
@@ -617,11 +654,6 @@ var Alert = /*#__PURE__*/function () {
}
this._removeElement(rootElement);
- };
-
- _proto.dispose = function dispose() {
- Data.removeData(this._element, DATA_KEY);
- this._element = null;
} // Private
;
@@ -684,19 +716,16 @@ var Alert = /*#__PURE__*/function () {
};
};
- 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
@@ -735,7 +764,6 @@ onDOMContentLoaded(function () {
*/
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';
@@ -748,12 +776,12 @@ var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$1 + DATA_API_KEY$1;
* ------------------------------------------------------------------------
*/
-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;
@@ -761,11 +789,6 @@ var Button = /*#__PURE__*/function () {
_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
;
@@ -783,19 +806,16 @@ var Button = /*#__PURE__*/function () {
});
};
- 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
@@ -1000,7 +1020,6 @@ var SelectorEngine = {
*/
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';
@@ -1068,25 +1087,29 @@ var PointerType = {
* ------------------------------------------------------------------------
*/
-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
@@ -1145,7 +1168,7 @@ var Carousel = /*#__PURE__*/function () {
};
_proto.to = function to(index) {
- var _this = this;
+ var _this2 = this;
this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
@@ -1157,7 +1180,7 @@ var Carousel = /*#__PURE__*/function () {
if (this._isSliding) {
EventHandler.one(this._element, EVENT_SLID, function () {
- return _this.to(index);
+ return _this2.to(index);
});
return;
}
@@ -1174,11 +1197,11 @@ var Carousel = /*#__PURE__*/function () {
};
_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;
@@ -1214,20 +1237,20 @@ var Carousel = /*#__PURE__*/function () {
};
_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);
});
}
@@ -1237,33 +1260,33 @@ var Carousel = /*#__PURE__*/function () {
};
_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;
@@ -1271,15 +1294,15 @@ var Carousel = /*#__PURE__*/function () {
// (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);
}
};
@@ -1399,7 +1422,7 @@ var Carousel = /*#__PURE__*/function () {
};
_proto._slide = function _slide(direction, element) {
- var _this4 = this;
+ var _this5 = this;
var activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
@@ -1460,9 +1483,9 @@ var Carousel = /*#__PURE__*/function () {
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,
@@ -1548,24 +1571,20 @@ var Carousel = /*#__PURE__*/function () {
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
@@ -1611,7 +1630,6 @@ onDOMContentLoaded(function () {
*/
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';
@@ -1642,12 +1660,16 @@ var SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="collapse"]';
* ------------------------------------------------------------------------
*/
-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++) {
@@ -1658,23 +1680,23 @@ var Collapse = /*#__PURE__*/function () {
});
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
@@ -1690,7 +1712,7 @@ var Collapse = /*#__PURE__*/function () {
};
_proto.show = function show() {
- var _this = this;
+ var _this2 = this;
if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
return;
@@ -1701,8 +1723,8 @@ var Collapse = /*#__PURE__*/function () {
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);
@@ -1762,15 +1784,15 @@ var Collapse = /*#__PURE__*/function () {
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);
@@ -1782,7 +1804,7 @@ var Collapse = /*#__PURE__*/function () {
};
_proto.hide = function hide() {
- var _this2 = this;
+ var _this3 = this;
if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
return;
@@ -1820,13 +1842,13 @@ var Collapse = /*#__PURE__*/function () {
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] = '';
@@ -1840,10 +1862,10 @@ var Collapse = /*#__PURE__*/function () {
};
_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
@@ -1862,7 +1884,7 @@ var Collapse = /*#__PURE__*/function () {
};
_proto._getParent = function _getParent() {
- var _this3 = this;
+ var _this4 = this;
var parent = this._config.parent;
@@ -1879,7 +1901,7 @@ var Collapse = /*#__PURE__*/function () {
SelectorEngine.find(selector, parent).forEach(function (element) {
var selected = getElementFromSelector(element);
- _this3._addAriaAndCollapsedClass(selected, [element]);
+ _this4._addAriaAndCollapsedClass(selected, [element]);
});
return parent;
};
@@ -1930,24 +1952,20 @@ var Collapse = /*#__PURE__*/function () {
});
};
- 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
@@ -2013,7 +2031,6 @@ onDOMContentLoaded(function () {
*/
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';
@@ -2074,17 +2091,21 @@ var DefaultType$2 = {
* ------------------------------------------------------------------------
*/
-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
@@ -2200,9 +2221,9 @@ var Dropdown = /*#__PURE__*/function () {
};
_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) {
@@ -2222,13 +2243,13 @@ var Dropdown = /*#__PURE__*/function () {
;
_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();
});
};
@@ -2264,13 +2285,13 @@ var Dropdown = /*#__PURE__*/function () {
};
_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 {
@@ -2432,15 +2453,14 @@ var Dropdown = /*#__PURE__*/function () {
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
@@ -2449,16 +2469,7 @@ var Dropdown = /*#__PURE__*/function () {
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;
@@ -2468,10 +2479,15 @@ var Dropdown = /*#__PURE__*/function () {
get: function get() {
return DefaultType$2;
}
+ }, {
+ key: "DATA_KEY",
+ get: function get() {
+ return DATA_KEY$4;
+ }
}]);
return Dropdown;
-}();
+}(BaseComponent);
/**
* ------------------------------------------------------------------------
* Data Api implementation
@@ -2521,7 +2537,6 @@ onDOMContentLoaded(function () {
*/
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';
@@ -2529,14 +2544,12 @@ var ESCAPE_KEY$1 = 'Escape';
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;
@@ -2568,18 +2581,22 @@ var SELECTOR_STICKY_CONTENT = '.sticky-top';
* ------------------------------------------------------------------------
*/
-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
@@ -2591,7 +2608,7 @@ var Modal = /*#__PURE__*/function () {
};
_proto.show = function show(relatedTarget) {
- var _this = this;
+ var _this2 = this;
if (this._isShown || this._isTransitioning) {
return;
@@ -2622,23 +2639,23 @@ var Modal = /*#__PURE__*/function () {
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();
@@ -2676,7 +2693,7 @@ var Modal = /*#__PURE__*/function () {
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 {
@@ -2688,16 +2705,17 @@ var Modal = /*#__PURE__*/function () {
[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;
@@ -2719,7 +2737,7 @@ var Modal = /*#__PURE__*/function () {
};
_proto._showElement = function _showElement(relatedTarget) {
- var _this3 = this;
+ var _this4 = this;
var transition = this._element.classList.contains(CLASS_NAME_FADE);
@@ -2755,12 +2773,12 @@ var Modal = /*#__PURE__*/function () {
}
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
});
};
@@ -2775,28 +2793,28 @@ var Modal = /*#__PURE__*/function () {
};
_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 {
@@ -2805,11 +2823,11 @@ var Modal = /*#__PURE__*/function () {
};
_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);
@@ -2817,7 +2835,7 @@ var Modal = /*#__PURE__*/function () {
};
_proto._hideModal = function _hideModal() {
- var _this7 = this;
+ var _this8 = this;
this._element.style.display = 'none';
@@ -2832,11 +2850,11 @@ var Modal = /*#__PURE__*/function () {
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);
});
};
@@ -2847,7 +2865,7 @@ var Modal = /*#__PURE__*/function () {
};
_proto._showBackdrop = function _showBackdrop(callback) {
- var _this8 = this;
+ var _this9 = this;
var animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
@@ -2861,8 +2879,8 @@ var Modal = /*#__PURE__*/function () {
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;
}
@@ -2870,10 +2888,10 @@ var Modal = /*#__PURE__*/function () {
return;
}
- if (_this8._config.backdrop === 'static') {
- _this8._triggerBackdropTransition();
+ if (_this9._config.backdrop === 'static') {
+ _this9._triggerBackdropTransition();
} else {
- _this8.hide();
+ _this9.hide();
}
});
@@ -2895,7 +2913,7 @@ var Modal = /*#__PURE__*/function () {
this._backdrop.classList.remove(CLASS_NAME_SHOW$2);
var callbackRemove = function callbackRemove() {
- _this8._removeBackdrop();
+ _this9._removeBackdrop();
callback();
};
@@ -2914,7 +2932,7 @@ var Modal = /*#__PURE__*/function () {
};
_proto._triggerBackdropTransition = function _triggerBackdropTransition() {
- var _this9 = this;
+ var _this10 = this;
var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
@@ -2933,13 +2951,13 @@ var Modal = /*#__PURE__*/function () {
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);
@@ -2974,7 +2992,7 @@ var Modal = /*#__PURE__*/function () {
};
_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
@@ -2984,14 +3002,14 @@ var Modal = /*#__PURE__*/function () {
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;
@@ -3060,30 +3078,24 @@ var Modal = /*#__PURE__*/function () {
}
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
@@ -3092,7 +3104,7 @@ var Modal = /*#__PURE__*/function () {
EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, function (event) {
- var _this11 = this;
+ var _this12 = this;
var target = getElementFromSelector(this);
@@ -3107,8 +3119,8 @@ EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE$3, functi
}
EventHandler.one(target, EVENT_HIDDEN$2, function () {
- if (isVisible(_this11)) {
- _this11.focus();
+ if (isVisible(_this12)) {
+ _this12.focus();
}
});
});
@@ -3279,7 +3291,6 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
*/
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';
@@ -3298,6 +3309,7 @@ var DefaultType$4 = {
container: '(string|element|boolean)',
fallbackPlacement: '(string|array)',
boundary: '(string|element)',
+ customClass: '(string|function)',
sanitize: 'boolean',
sanitizeFn: '(null|function)',
allowList: 'object',
@@ -3312,7 +3324,7 @@ var AttachmentMap = {
};
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,
@@ -3323,6 +3335,7 @@ var Default$4 = {
container: false,
fallbackPlacement: 'flip',
boundary: 'scrollParent',
+ customClass: '',
sanitize: true,
sanitizeFn: null,
allowList: DefaultAllowlist,
@@ -3356,26 +3369,30 @@ var TRIGGER_MANUAL = 'manual';
* ------------------------------------------------------------------------
*/
-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
@@ -3428,9 +3445,8 @@ var Tooltip = /*#__PURE__*/function () {
_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);
@@ -3446,22 +3462,23 @@ var Tooltip = /*#__PURE__*/function () {
}
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;
@@ -3470,14 +3487,16 @@ var Tooltip = /*#__PURE__*/function () {
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);
@@ -3487,17 +3506,25 @@ var Tooltip = /*#__PURE__*/function () {
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;
@@ -3507,16 +3534,16 @@ var Tooltip = /*#__PURE__*/function () {
}
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);
}
};
@@ -3531,7 +3558,7 @@ var Tooltip = /*#__PURE__*/function () {
};
_proto.hide = function hide() {
- var _this2 = this;
+ var _this3 = this;
if (!this._popper) {
return;
@@ -3540,20 +3567,20 @@ var Tooltip = /*#__PURE__*/function () {
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;
@@ -3648,10 +3675,10 @@ var Tooltip = /*#__PURE__*/function () {
};
_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;
@@ -3659,7 +3686,7 @@ var Tooltip = /*#__PURE__*/function () {
;
_proto._getPopperConfig = function _getPopperConfig(attachment) {
- var _this3 = this;
+ var _this4 = this;
var defaultBsConfig = {
placement: attachment,
@@ -3677,11 +3704,11 @@ var Tooltip = /*#__PURE__*/function () {
},
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);
@@ -3692,13 +3719,13 @@ var Tooltip = /*#__PURE__*/function () {
};
_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 {
@@ -3725,33 +3752,33 @@ var Tooltip = /*#__PURE__*/function () {
};
_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, {
@@ -3764,12 +3791,18 @@ var Tooltip = /*#__PURE__*/function () {
};
_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', '');
}
};
@@ -3849,7 +3882,7 @@ var Tooltip = /*#__PURE__*/function () {
};
_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];
@@ -3961,16 +3994,7 @@ var Tooltip = /*#__PURE__*/function () {
});
};
- 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;
@@ -4003,7 +4027,7 @@ var Tooltip = /*#__PURE__*/function () {
}]);
return Tooltip;
-}();
+}(BaseComponent);
/**
* ------------------------------------------------------------------------
* jQuery
@@ -4035,7 +4059,6 @@ onDOMContentLoaded(function () {
*/
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';
@@ -4045,7 +4068,7 @@ var Default$5 = _extends({}, Tooltip.Default, {
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, {
@@ -4096,7 +4119,7 @@ var Popover = /*#__PURE__*/function (_Tooltip) {
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);
@@ -4109,7 +4132,7 @@ var Popover = /*#__PURE__*/function (_Tooltip) {
};
_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() {
@@ -4151,18 +4174,9 @@ var Popover = /*#__PURE__*/function (_Tooltip) {
});
};
- 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;
}
@@ -4226,7 +4240,6 @@ onDOMContentLoaded(function () {
*/
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';
@@ -4260,26 +4273,29 @@ var METHOD_POSITION = 'position';
* ------------------------------------------------------------------------
*/
-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
@@ -4321,9 +4337,9 @@ var ScrollSpy = /*#__PURE__*/function () {
};
_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;
@@ -4468,24 +4484,20 @@ var ScrollSpy = /*#__PURE__*/function () {
});
};
- 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
@@ -4528,7 +4540,6 @@ onDOMContentLoaded(function () {
*/
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';
@@ -4555,12 +4566,12 @@ var SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
* ------------------------------------------------------------------------
*/
-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;
@@ -4615,11 +4626,6 @@ var Tab = /*#__PURE__*/function () {
} else {
complete();
}
- };
-
- _proto.dispose = function dispose() {
- Data.removeData(this._element, DATA_KEY$9);
- this._element = null;
} // Private
;
@@ -4702,19 +4708,16 @@ var Tab = /*#__PURE__*/function () {
});
};
- 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
@@ -4757,7 +4760,6 @@ onDOMContentLoaded(function () {
*/
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;
@@ -4786,15 +4788,19 @@ var SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="toast"]';
* ------------------------------------------------------------------------
*/
-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
@@ -4802,7 +4808,7 @@ var Toast = /*#__PURE__*/function () {
// Public
_proto.show = function show() {
- var _this = this;
+ var _this2 = this;
var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4);
@@ -4817,16 +4823,16 @@ var Toast = /*#__PURE__*/function () {
}
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);
}
};
@@ -4846,7 +4852,7 @@ var Toast = /*#__PURE__*/function () {
};
_proto.hide = function hide() {
- var _this2 = this;
+ var _this3 = this;
if (!this._element.classList.contains(CLASS_NAME_SHOW$6)) {
return;
@@ -4859,9 +4865,9 @@ var Toast = /*#__PURE__*/function () {
}
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);
@@ -4883,8 +4889,9 @@ var Toast = /*#__PURE__*/function () {
}
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
;
@@ -4896,10 +4903,10 @@ var Toast = /*#__PURE__*/function () {
};
_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();
});
};
@@ -4929,16 +4936,7 @@ var Toast = /*#__PURE__*/function () {
});
};
- 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;
@@ -4948,10 +4946,15 @@ var Toast = /*#__PURE__*/function () {
get: function get() {
return Default$7;
}
+ }, {
+ key: "DATA_KEY",
+ get: function get() {
+ return DATA_KEY$a;
+ }
}]);
return Toast;
-}();
+}(BaseComponent);
/**
* ------------------------------------------------------------------------
* jQuery