This commit is contained in:
XhmikosR 2020-12-03 16:18:59 +02:00 committed by GitHub
parent cfd00b5eeb
commit cfe31592d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 2123 additions and 1695 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1914,7 +1914,6 @@ progress {
}
.table {
--bs-table-bg: transparent;
--bs-table-accent-bg: transparent;
--bs-table-striped-color: #212529;
--bs-table-striped-bg: rgba(0, 0, 0, 0.05);
--bs-table-active-color: #212529;
@ -3754,7 +3753,7 @@ textarea.form-control-lg {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.btn-group-vertical > .btn:not(:first-child),
.btn-group-vertical > .btn ~ .btn,
.btn-group-vertical > .btn-group:not(:first-child) > .btn {
border-top-left-radius: 0;
border-top-right-radius: 0;
@ -4397,11 +4396,9 @@ textarea.form-control-lg {
.breadcrumb {
display: flex;
flex-wrap: wrap;
padding: 0.5rem 1rem;
padding: 0 0;
margin-bottom: 1rem;
list-style: none;
background-color: #e9ecef;
border-radius: 0.25rem;
}
.breadcrumb-item + .breadcrumb-item {
@ -4411,7 +4408,7 @@ textarea.form-control-lg {
float: left;
padding-right: 0.5rem;
color: #6c757d;
content: "/";
content: var(--bs-breadcrumb-divider, "/");
}
.breadcrumb-item.active {
color: #6c757d;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

80
js/dist/alert.js vendored
View File

@ -5,7 +5,7 @@
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js'], factory) :
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.Data, global.EventHandler));
}(this, (function (Data, EventHandler) { 'use strict';
@ -112,8 +112,53 @@
* ------------------------------------------------------------------------
*/
var NAME = 'alert';
var VERSION = '5.0.0-alpha3';
var BaseComponent = /*#__PURE__*/function () {
function BaseComponent(element) {
if (!element) {
return;
}
this._element = element;
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
}
var _proto = BaseComponent.prototype;
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
this._element = null;
}
/** Static */
;
BaseComponent.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, this.DATA_KEY);
};
_createClass(BaseComponent, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return BaseComponent;
}();
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'alert';
var DATA_KEY = 'bs.alert';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
@ -130,15 +175,12 @@
* ------------------------------------------------------------------------
*/
var Alert = /*#__PURE__*/function () {
function Alert(element) {
this._element = element;
if (this._element) {
Data__default['default'].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;
@ -153,11 +195,6 @@
}
this._removeElement(rootElement);
};
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, DATA_KEY);
this._element = null;
} // Private
;
@ -220,19 +257,16 @@
};
};
Alert.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Alert, null, [{
key: "VERSION",
_createClass$1(Alert, null, [{
key: "DATA_KEY",
// Getters
get: function get() {
return VERSION;
return DATA_KEY;
}
}]);
return Alert;
}();
}(BaseComponent);
/**
* ------------------------------------------------------------------------
* Data Api implementation

File diff suppressed because one or more lines are too long

77
js/dist/button.js vendored
View File

@ -5,7 +5,7 @@
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js'], factory) :
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Button = factory(global.Data, global.EventHandler));
}(this, (function (Data, EventHandler) { 'use strict';
@ -49,8 +49,53 @@
* ------------------------------------------------------------------------
*/
var NAME = 'button';
var VERSION = '5.0.0-alpha3';
var BaseComponent = /*#__PURE__*/function () {
function BaseComponent(element) {
if (!element) {
return;
}
this._element = element;
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
}
var _proto = BaseComponent.prototype;
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
this._element = null;
}
/** Static */
;
BaseComponent.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, this.DATA_KEY);
};
_createClass(BaseComponent, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return BaseComponent;
}();
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'button';
var DATA_KEY = 'bs.button';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
@ -63,12 +108,12 @@
* ------------------------------------------------------------------------
*/
var Button = /*#__PURE__*/function () {
function Button(element) {
this._element = element;
Data__default['default'].setData(element, DATA_KEY, this);
} // Getters
var Button = /*#__PURE__*/function (_BaseComponent) {
_inheritsLoose(Button, _BaseComponent);
function Button() {
return _BaseComponent.apply(this, arguments) || this;
}
var _proto = Button.prototype;
@ -76,11 +121,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__default['default'].removeData(this._element, DATA_KEY);
this._element = null;
} // Static
;
@ -98,19 +138,16 @@
});
};
Button.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Button, null, [{
key: "VERSION",
_createClass$1(Button, null, [{
key: "DATA_KEY",
// Getters
get: function get() {
return VERSION;
return DATA_KEY;
}
}]);
return Button;
}();
}(BaseComponent);
/**
* ------------------------------------------------------------------------
* Data Api implementation

File diff suppressed because one or more lines are too long

163
js/dist/carousel.js vendored
View File

@ -5,7 +5,7 @@
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', './dom/selector-engine.js'], factory) :
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
@ -147,8 +147,6 @@
}
};
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
@ -158,8 +156,55 @@
* ------------------------------------------------------------------------
*/
var NAME = 'carousel';
var VERSION = '5.0.0-alpha3';
var BaseComponent = /*#__PURE__*/function () {
function BaseComponent(element) {
if (!element) {
return;
}
this._element = element;
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
}
var _proto = BaseComponent.prototype;
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
this._element = null;
}
/** Static */
;
BaseComponent.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, this.DATA_KEY);
};
_createClass(BaseComponent, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return BaseComponent;
}();
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'carousel';
var DATA_KEY = 'bs.carousel';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
@ -227,25 +272,29 @@
* ------------------------------------------------------------------------
*/
var Carousel = /*#__PURE__*/function () {
var Carousel = /*#__PURE__*/function (_BaseComponent) {
_inheritsLoose(Carousel, _BaseComponent);
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__default['default'].findOne(SELECTOR_INDICATORS, this._element);
this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
this._pointerEvent = Boolean(window.PointerEvent);
var _this;
this._addEventListeners();
_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__default['default'].findOne(SELECTOR_INDICATORS, _this._element);
_this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
_this._pointerEvent = Boolean(window.PointerEvent);
Data__default['default'].setData(element, DATA_KEY, this);
_this._addEventListeners();
return _this;
} // Getters
@ -304,7 +353,7 @@
};
_proto.to = function to(index) {
var _this = this;
var _this2 = this;
this._activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
@ -316,7 +365,7 @@
if (this._isSliding) {
EventHandler__default['default'].one(this._element, EVENT_SLID, function () {
return _this.to(index);
return _this2.to(index);
});
return;
}
@ -333,11 +382,11 @@
};
_proto.dispose = function dispose() {
_BaseComponent.prototype.dispose.call(this);
EventHandler__default['default'].off(this._element, EVENT_KEY);
Data__default['default'].removeData(this._element, DATA_KEY);
this._items = null;
this._config = null;
this._element = null;
this._interval = null;
this._isPaused = null;
this._isSliding = null;
@ -373,20 +422,20 @@
};
_proto._addEventListeners = function _addEventListeners() {
var _this2 = this;
var _this3 = this;
if (this._config.keyboard) {
EventHandler__default['default'].on(this._element, EVENT_KEYDOWN, function (event) {
return _this2._keydown(event);
return _this3._keydown(event);
});
}
if (this._config.pause === 'hover') {
EventHandler__default['default'].on(this._element, EVENT_MOUSEENTER, function (event) {
return _this2.pause(event);
return _this3.pause(event);
});
EventHandler__default['default'].on(this._element, EVENT_MOUSELEAVE, function (event) {
return _this2.cycle(event);
return _this3.cycle(event);
});
}
@ -396,33 +445,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;
@ -430,15 +479,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);
}
};
@ -558,7 +607,7 @@
};
_proto._slide = function _slide(direction, element) {
var _this4 = this;
var _this5 = this;
var activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
@ -619,9 +668,9 @@
nextElement.classList.remove(directionalClassName, orderClassName);
nextElement.classList.add(CLASS_NAME_ACTIVE);
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
_this4._isSliding = false;
_this5._isSliding = false;
setTimeout(function () {
EventHandler__default['default'].trigger(_this4._element, EVENT_SLID, {
EventHandler__default['default'].trigger(_this5._element, EVENT_SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
@ -707,24 +756,20 @@
event.preventDefault();
};
Carousel.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Carousel, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
_createClass$1(Carousel, null, [{
key: "Default",
get: function get() {
return Default;
}
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}]);
return Carousel;
}();
}(BaseComponent);
/**
* ------------------------------------------------------------------------
* Data Api implementation

File diff suppressed because one or more lines are too long

135
js/dist/collapse.js vendored
View File

@ -5,7 +5,7 @@
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', './dom/selector-engine.js'], factory) :
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
@ -143,8 +143,6 @@
}
};
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
@ -154,8 +152,55 @@
* ------------------------------------------------------------------------
*/
var NAME = 'collapse';
var VERSION = '5.0.0-alpha3';
var BaseComponent = /*#__PURE__*/function () {
function BaseComponent(element) {
if (!element) {
return;
}
this._element = element;
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
}
var _proto = BaseComponent.prototype;
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
this._element = null;
}
/** Static */
;
BaseComponent.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, this.DATA_KEY);
};
_createClass(BaseComponent, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return BaseComponent;
}();
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'collapse';
var DATA_KEY = 'bs.collapse';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
@ -186,12 +231,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__default['default'].find(SELECTOR_DATA_TOGGLE + "[href=\"#" + element.id + "\"]," + (SELECTOR_DATA_TOGGLE + "[data-bs-target=\"#" + element.id + "\"]"));
var _this;
_this = _BaseComponent.call(this, element) || this;
_this._isTransitioning = false;
_this._config = _this._getConfig(config);
_this._triggerArray = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE + "[href=\"#" + element.id + "\"]," + (SELECTOR_DATA_TOGGLE + "[data-bs-target=\"#" + element.id + "\"]"));
var toggleList = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
for (var i = 0, len = toggleList.length; i < len; i++) {
@ -202,23 +251,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__default['default'].setData(element, DATA_KEY, this);
return _this;
} // Getters
@ -234,7 +283,7 @@
};
_proto.show = function show() {
var _this = this;
var _this2 = this;
if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
return;
@ -245,8 +294,8 @@
if (this._parent) {
actives = SelectorEngine__default['default'].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);
@ -306,15 +355,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__default['default'].trigger(_this._element, EVENT_SHOWN);
EventHandler__default['default'].trigger(_this2._element, EVENT_SHOWN);
};
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
@ -326,7 +375,7 @@
};
_proto.hide = function hide() {
var _this2 = this;
var _this3 = this;
if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
return;
@ -364,13 +413,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__default['default'].trigger(_this2._element, EVENT_HIDDEN);
EventHandler__default['default'].trigger(_this3._element, EVENT_HIDDEN);
};
this._element.style[dimension] = '';
@ -384,10 +433,10 @@
};
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, DATA_KEY);
_BaseComponent.prototype.dispose.call(this);
this._config = null;
this._parent = null;
this._element = null;
this._triggerArray = null;
this._isTransitioning = null;
} // Private
@ -406,7 +455,7 @@
};
_proto._getParent = function _getParent() {
var _this3 = this;
var _this4 = this;
var parent = this._config.parent;
@ -423,7 +472,7 @@
SelectorEngine__default['default'].find(selector, parent).forEach(function (element) {
var selected = getElementFromSelector(element);
_this3._addAriaAndCollapsedClass(selected, [element]);
_this4._addAriaAndCollapsedClass(selected, [element]);
});
return parent;
};
@ -474,24 +523,20 @@
});
};
Collapse.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Collapse, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
_createClass$1(Collapse, null, [{
key: "Default",
get: function get() {
return Default;
}
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}]);
return Collapse;
}();
}(BaseComponent);
/**
* ------------------------------------------------------------------------
* Data Api implementation

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

110
js/dist/dropdown.js vendored
View File

@ -5,7 +5,7 @@
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('popper.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', 'popper.js', './dom/selector-engine.js'], factory) :
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', 'popper.js', './dom/selector-engine'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
}(this, (function (Data, EventHandler, Manipulator, Popper, SelectorEngine) { 'use strict';
@ -101,8 +101,6 @@
}
};
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
@ -112,8 +110,55 @@
* ------------------------------------------------------------------------
*/
var NAME = 'dropdown';
var VERSION = '5.0.0-alpha3';
var BaseComponent = /*#__PURE__*/function () {
function BaseComponent(element) {
if (!element) {
return;
}
this._element = element;
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
}
var _proto = BaseComponent.prototype;
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
this._element = null;
}
/** Static */
;
BaseComponent.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, this.DATA_KEY);
};
_createClass(BaseComponent, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return BaseComponent;
}();
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'dropdown';
var DATA_KEY = 'bs.dropdown';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
@ -174,17 +219,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._addEventListeners();
_this = _BaseComponent.call(this, element) || this;
_this._popper = null;
_this._config = _this._getConfig(config);
_this._menu = _this._getMenuElement();
_this._inNavbar = _this._detectNavbar();
Data__default['default'].setData(element, DATA_KEY, this);
_this._addEventListeners();
return _this;
} // Getters
@ -300,9 +349,9 @@
};
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, DATA_KEY);
_BaseComponent.prototype.dispose.call(this);
EventHandler__default['default'].off(this._element, EVENT_KEY);
this._element = null;
this._menu = null;
if (this._popper) {
@ -322,13 +371,13 @@
;
_proto._addEventListeners = function _addEventListeners() {
var _this = this;
var _this2 = this;
EventHandler__default['default'].on(this._element, EVENT_CLICK, function (event) {
event.preventDefault();
event.stopPropagation();
_this.toggle();
_this2.toggle();
});
};
@ -364,13 +413,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 {
@ -532,15 +581,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
@ -549,16 +597,7 @@
items[index].focus();
};
Dropdown.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Dropdown, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
_createClass$1(Dropdown, null, [{
key: "Default",
get: function get() {
return Default;
@ -568,10 +607,15 @@
get: function get() {
return DefaultType;
}
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}]);
return Dropdown;
}();
}(BaseComponent);
/**
* ------------------------------------------------------------------------
* Data Api implementation

File diff suppressed because one or more lines are too long

200
js/dist/modal.js vendored
View File

@ -5,7 +5,7 @@
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', './dom/selector-engine.js'], factory) :
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
@ -147,8 +147,6 @@
}
};
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
@ -158,8 +156,55 @@
* ------------------------------------------------------------------------
*/
var NAME = 'modal';
var VERSION = '5.0.0-alpha3';
var BaseComponent = /*#__PURE__*/function () {
function BaseComponent(element) {
if (!element) {
return;
}
this._element = element;
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
}
var _proto = BaseComponent.prototype;
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
this._element = null;
}
/** Static */
;
BaseComponent.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, this.DATA_KEY);
};
_createClass(BaseComponent, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return BaseComponent;
}();
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'modal';
var DATA_KEY = 'bs.modal';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
@ -167,14 +212,12 @@
var Default = {
backdrop: true,
keyboard: true,
focus: true,
show: true
focus: true
};
var DefaultType = {
backdrop: '(boolean|string)',
keyboard: 'boolean',
focus: 'boolean',
show: 'boolean'
focus: 'boolean'
};
var EVENT_HIDE = "hide" + EVENT_KEY;
var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY;
@ -206,18 +249,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__default['default'].findOne(SELECTOR_DIALOG, element);
this._backdrop = null;
this._isShown = false;
this._isBodyOverflowing = false;
this._ignoreBackdropClick = false;
this._isTransitioning = false;
this._scrollbarWidth = 0;
Data__default['default'].setData(element, DATA_KEY, this);
var _this;
_this = _BaseComponent.call(this, element) || this;
_this._config = _this._getConfig(config);
_this._dialog = SelectorEngine__default['default'].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
@ -229,7 +276,7 @@
};
_proto.show = function show(relatedTarget) {
var _this = this;
var _this2 = this;
if (this._isShown || this._isTransitioning) {
return;
@ -260,23 +307,23 @@
this._setResizeEvent();
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
return _this.hide(event);
return _this2.hide(event);
});
EventHandler__default['default'].on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () {
EventHandler__default['default'].one(_this._element, EVENT_MOUSEUP_DISMISS, function (event) {
if (event.target === _this._element) {
_this._ignoreBackdropClick = true;
EventHandler__default['default'].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();
@ -314,7 +361,7 @@
if (transition) {
var transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, TRANSITION_END, function (event) {
return _this2._hideModal(event);
return _this3._hideModal(event);
});
emulateTransitionEnd(this._element, transitionDuration);
} else {
@ -326,16 +373,17 @@
[window, this._element, this._dialog].forEach(function (htmlElement) {
return EventHandler__default['default'].off(htmlElement, EVENT_KEY);
});
_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__default['default'].off(document, EVENT_FOCUSIN);
Data__default['default'].removeData(this._element, DATA_KEY);
this._config = null;
this._element = null;
this._dialog = null;
this._backdrop = null;
this._isShown = null;
@ -357,7 +405,7 @@
};
_proto._showElement = function _showElement(relatedTarget) {
var _this3 = this;
var _this4 = this;
var transition = this._element.classList.contains(CLASS_NAME_FADE);
@ -393,12 +441,12 @@
}
var transitionComplete = function transitionComplete() {
if (_this3._config.focus) {
_this3._element.focus();
if (_this4._config.focus) {
_this4._element.focus();
}
_this3._isTransitioning = false;
EventHandler__default['default'].trigger(_this3._element, EVENT_SHOWN, {
_this4._isTransitioning = false;
EventHandler__default['default'].trigger(_this4._element, EVENT_SHOWN, {
relatedTarget: relatedTarget
});
};
@ -413,28 +461,28 @@
};
_proto._enforceFocus = function _enforceFocus() {
var _this4 = this;
var _this5 = this;
EventHandler__default['default'].off(document, EVENT_FOCUSIN); // guard against infinite focus loop
EventHandler__default['default'].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__default['default'].on(this._element, EVENT_KEYDOWN_DISMISS, function (event) {
if (_this5._config.keyboard && event.key === ESCAPE_KEY) {
if (_this6._config.keyboard && event.key === ESCAPE_KEY) {
event.preventDefault();
_this5.hide();
} else if (!_this5._config.keyboard && event.key === ESCAPE_KEY) {
_this5._triggerBackdropTransition();
_this6.hide();
} else if (!_this6._config.keyboard && event.key === ESCAPE_KEY) {
_this6._triggerBackdropTransition();
}
});
} else {
@ -443,11 +491,11 @@
};
_proto._setResizeEvent = function _setResizeEvent() {
var _this6 = this;
var _this7 = this;
if (this._isShown) {
EventHandler__default['default'].on(window, EVENT_RESIZE, function () {
return _this6._adjustDialog();
return _this7._adjustDialog();
});
} else {
EventHandler__default['default'].off(window, EVENT_RESIZE);
@ -455,7 +503,7 @@
};
_proto._hideModal = function _hideModal() {
var _this7 = this;
var _this8 = this;
this._element.style.display = 'none';
@ -470,11 +518,11 @@
this._showBackdrop(function () {
document.body.classList.remove(CLASS_NAME_OPEN);
_this7._resetAdjustments();
_this8._resetAdjustments();
_this7._resetScrollbar();
_this8._resetScrollbar();
EventHandler__default['default'].trigger(_this7._element, EVENT_HIDDEN);
EventHandler__default['default'].trigger(_this8._element, EVENT_HIDDEN);
});
};
@ -485,7 +533,7 @@
};
_proto._showBackdrop = function _showBackdrop(callback) {
var _this8 = this;
var _this9 = this;
var animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
@ -499,8 +547,8 @@
document.body.appendChild(this._backdrop);
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, function (event) {
if (_this8._ignoreBackdropClick) {
_this8._ignoreBackdropClick = false;
if (_this9._ignoreBackdropClick) {
_this9._ignoreBackdropClick = false;
return;
}
@ -508,10 +556,10 @@
return;
}
if (_this8._config.backdrop === 'static') {
_this8._triggerBackdropTransition();
if (_this9._config.backdrop === 'static') {
_this9._triggerBackdropTransition();
} else {
_this8.hide();
_this9.hide();
}
});
@ -533,7 +581,7 @@
this._backdrop.classList.remove(CLASS_NAME_SHOW);
var callbackRemove = function callbackRemove() {
_this8._removeBackdrop();
_this9._removeBackdrop();
callback();
};
@ -552,7 +600,7 @@
};
_proto._triggerBackdropTransition = function _triggerBackdropTransition() {
var _this9 = this;
var _this10 = this;
var hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE_PREVENTED);
@ -571,13 +619,13 @@
var modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
EventHandler__default['default'].off(this._element, TRANSITION_END);
EventHandler__default['default'].one(this._element, TRANSITION_END, function () {
_this9._element.classList.remove(CLASS_NAME_STATIC);
_this10._element.classList.remove(CLASS_NAME_STATIC);
if (!isModalOverflowing) {
EventHandler__default['default'].one(_this9._element, TRANSITION_END, function () {
_this9._element.style.overflowY = '';
EventHandler__default['default'].one(_this10._element, TRANSITION_END, function () {
_this10._element.style.overflowY = '';
});
emulateTransitionEnd(_this9._element, modalTransitionDuration);
emulateTransitionEnd(_this10._element, modalTransitionDuration);
}
});
emulateTransitionEnd(this._element, modalTransitionDuration);
@ -612,7 +660,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
@ -622,14 +670,14 @@
var actualPadding = element.style.paddingRight;
var calculatedPadding = window.getComputedStyle(element)['padding-right'];
Manipulator__default['default'].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__default['default'].find(SELECTOR_STICKY_CONTENT).forEach(function (element) {
var actualMargin = element.style.marginRight;
var calculatedMargin = window.getComputedStyle(element)['margin-right'];
Manipulator__default['default'].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;
@ -698,30 +746,24 @@
}
data[config](relatedTarget);
} else if (_config.show) {
data.show(relatedTarget);
}
});
};
Modal.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Modal, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
_createClass$1(Modal, null, [{
key: "Default",
get: function get() {
return Default;
}
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}]);
return Modal;
}();
}(BaseComponent);
/**
* ------------------------------------------------------------------------
* Data Api implementation
@ -730,7 +772,7 @@
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
var _this11 = this;
var _this12 = this;
var target = getElementFromSelector(this);
@ -745,8 +787,8 @@
}
EventHandler__default['default'].one(target, EVENT_HIDDEN, function () {
if (isVisible(_this11)) {
_this11.focus();
if (isVisible(_this12)) {
_this12.focus();
}
});
});

File diff suppressed because one or more lines are too long

20
js/dist/popover.js vendored
View File

@ -5,7 +5,7 @@
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/selector-engine.js'), require('./tooltip.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/selector-engine.js', './tooltip.js'], factory) :
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/selector-engine', './tooltip'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.Data, global.SelectorEngine, global.Tooltip));
}(this, (function (Data, SelectorEngine, Tooltip) { 'use strict';
@ -55,7 +55,6 @@
*/
var NAME = 'popover';
var VERSION = '5.0.0-alpha3';
var DATA_KEY = 'bs.popover';
var EVENT_KEY = "." + DATA_KEY;
var CLASS_PREFIX = 'bs-popover';
@ -65,7 +64,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 = _extends({}, Tooltip__default['default'].DefaultType, {
@ -116,7 +115,7 @@
var content = this._getContent();
if (typeof content === 'function') {
content = content.call(this.element);
content = content.call(this._element);
}
this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_CONTENT, tip), content);
@ -129,7 +128,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() {
@ -171,18 +170,9 @@
});
};
Popover.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Popover, null, [{
key: "VERSION",
// Getters
get: function get() {
return VERSION;
}
}, {
key: "Default",
// Getters
get: function get() {
return Default;
}

File diff suppressed because one or more lines are too long

108
js/dist/scrollspy.js vendored
View File

@ -5,7 +5,7 @@
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', './dom/selector-engine.js'], factory) :
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ScrollSpy = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine));
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine) { 'use strict';
@ -102,8 +102,6 @@
}
};
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
@ -113,8 +111,55 @@
* ------------------------------------------------------------------------
*/
var NAME = 'scrollspy';
var VERSION = '5.0.0-alpha3';
var BaseComponent = /*#__PURE__*/function () {
function BaseComponent(element) {
if (!element) {
return;
}
this._element = element;
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
}
var _proto = BaseComponent.prototype;
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
this._element = null;
}
/** Static */
;
BaseComponent.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, this.DATA_KEY);
};
_createClass(BaseComponent, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return BaseComponent;
}();
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'scrollspy';
var DATA_KEY = 'bs.scrollspy';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
@ -148,26 +193,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__default['default'].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__default['default'].on(_this._scrollElement, EVENT_SCROLL, function (event) {
return _this._process(event);
});
this.refresh();
this._process();
_this.refresh();
Data__default['default'].setData(element, DATA_KEY, this);
_this._process();
return _this;
} // Getters
@ -209,9 +257,9 @@
};
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, DATA_KEY);
_BaseComponent.prototype.dispose.call(this);
EventHandler__default['default'].off(this._scrollElement, EVENT_KEY);
this._element = null;
this._scrollElement = null;
this._config = null;
this._selector = null;
@ -356,24 +404,20 @@
});
};
ScrollSpy.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(ScrollSpy, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
_createClass$1(ScrollSpy, null, [{
key: "Default",
get: function get() {
return Default;
}
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}]);
return ScrollSpy;
}();
}(BaseComponent);
/**
* ------------------------------------------------------------------------
* Data Api implementation

File diff suppressed because one or more lines are too long

77
js/dist/tab.js vendored
View File

@ -5,7 +5,7 @@
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/selector-engine.js'], factory) :
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/selector-engine'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.Data, global.EventHandler, global.SelectorEngine));
}(this, (function (Data, EventHandler, SelectorEngine) { 'use strict';
@ -117,8 +117,53 @@
* ------------------------------------------------------------------------
*/
var NAME = 'tab';
var VERSION = '5.0.0-alpha3';
var BaseComponent = /*#__PURE__*/function () {
function BaseComponent(element) {
if (!element) {
return;
}
this._element = element;
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
}
var _proto = BaseComponent.prototype;
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
this._element = null;
}
/** Static */
;
BaseComponent.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, this.DATA_KEY);
};
_createClass(BaseComponent, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return BaseComponent;
}();
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'tab';
var DATA_KEY = 'bs.tab';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
@ -145,12 +190,12 @@
* ------------------------------------------------------------------------
*/
var Tab = /*#__PURE__*/function () {
function Tab(element) {
this._element = element;
Data__default['default'].setData(this._element, DATA_KEY, this);
} // Getters
var Tab = /*#__PURE__*/function (_BaseComponent) {
_inheritsLoose(Tab, _BaseComponent);
function Tab() {
return _BaseComponent.apply(this, arguments) || this;
}
var _proto = Tab.prototype;
@ -205,11 +250,6 @@
} else {
complete();
}
};
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, DATA_KEY);
this._element = null;
} // Private
;
@ -292,19 +332,16 @@
});
};
Tab.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Tab, null, [{
key: "VERSION",
_createClass$1(Tab, null, [{
key: "DATA_KEY",
// Getters
get: function get() {
return VERSION;
return DATA_KEY;
}
}]);
return Tab;
}();
}(BaseComponent);
/**
* ------------------------------------------------------------------------
* Data Api implementation

2
js/dist/tab.js.map vendored

File diff suppressed because one or more lines are too long

118
js/dist/toast.js vendored
View File

@ -5,7 +5,7 @@
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js'], factory) :
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.Data, global.EventHandler, global.Manipulator));
}(this, (function (Data, EventHandler, Manipulator) { 'use strict';
@ -116,8 +116,6 @@
}
};
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
@ -127,8 +125,55 @@
* ------------------------------------------------------------------------
*/
var NAME = 'toast';
var VERSION = '5.0.0-alpha3';
var BaseComponent = /*#__PURE__*/function () {
function BaseComponent(element) {
if (!element) {
return;
}
this._element = element;
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
}
var _proto = BaseComponent.prototype;
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
this._element = null;
}
/** Static */
;
BaseComponent.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, this.DATA_KEY);
};
_createClass(BaseComponent, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return BaseComponent;
}();
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'toast';
var DATA_KEY = 'bs.toast';
var EVENT_KEY = "." + DATA_KEY;
var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY;
@ -157,15 +202,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__default['default'].setData(element, DATA_KEY, this);
_this._setListeners();
return _this;
} // Getters
@ -173,7 +222,7 @@
// Public
_proto.show = function show() {
var _this = this;
var _this2 = this;
var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
@ -188,16 +237,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);
_this2._element.classList.add(CLASS_NAME_SHOW);
EventHandler__default['default'].trigger(_this._element, EVENT_SHOWN);
EventHandler__default['default'].trigger(_this2._element, EVENT_SHOWN);
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);
}
};
@ -217,7 +266,7 @@
};
_proto.hide = function hide() {
var _this2 = this;
var _this3 = this;
if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
return;
@ -230,9 +279,9 @@
}
var complete = function complete() {
_this2._element.classList.add(CLASS_NAME_HIDE);
_this3._element.classList.add(CLASS_NAME_HIDE);
EventHandler__default['default'].trigger(_this2._element, EVENT_HIDDEN);
EventHandler__default['default'].trigger(_this3._element, EVENT_HIDDEN);
};
this._element.classList.remove(CLASS_NAME_SHOW);
@ -254,8 +303,9 @@
}
EventHandler__default['default'].off(this._element, EVENT_CLICK_DISMISS);
Data__default['default'].removeData(this._element, DATA_KEY);
this._element = null;
_BaseComponent.prototype.dispose.call(this);
this._config = null;
} // Private
;
@ -267,10 +317,10 @@
};
_proto._setListeners = function _setListeners() {
var _this3 = this;
var _this4 = this;
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () {
return _this3.hide();
return _this4.hide();
});
};
@ -300,16 +350,7 @@
});
};
Toast.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Toast, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
_createClass$1(Toast, null, [{
key: "DefaultType",
get: function get() {
return DefaultType;
@ -319,10 +360,15 @@
get: function get() {
return Default;
}
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}]);
return Toast;
}();
}(BaseComponent);
/**
* ------------------------------------------------------------------------
* jQuery

File diff suppressed because one or more lines are too long

218
js/dist/tooltip.js vendored
View File

@ -5,7 +5,7 @@
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('popper.js'), require('./dom/selector-engine.js')) :
typeof define === 'function' && define.amd ? define(['./dom/data.js', './dom/event-handler.js', './dom/manipulator.js', 'popper.js', './dom/selector-engine.js'], factory) :
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', 'popper.js', './dom/selector-engine'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.Data, global.EventHandler, global.Manipulator, global.Popper, global.SelectorEngine));
}(this, (function (Data, EventHandler, Manipulator, Popper, SelectorEngine) { 'use strict';
@ -283,8 +283,6 @@
return createdDocument.body.innerHTML;
}
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
@ -294,8 +292,55 @@
* ------------------------------------------------------------------------
*/
var NAME = 'tooltip';
var VERSION = '5.0.0-alpha3';
var BaseComponent = /*#__PURE__*/function () {
function BaseComponent(element) {
if (!element) {
return;
}
this._element = element;
Data__default['default'].setData(element, this.constructor.DATA_KEY, this);
}
var _proto = BaseComponent.prototype;
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, this.constructor.DATA_KEY);
this._element = null;
}
/** Static */
;
BaseComponent.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, this.DATA_KEY);
};
_createClass(BaseComponent, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}]);
return BaseComponent;
}();
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); return Constructor; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var NAME = 'tooltip';
var DATA_KEY = 'bs.tooltip';
var EVENT_KEY = "." + DATA_KEY;
var CLASS_PREFIX = 'bs-tooltip';
@ -314,6 +359,7 @@
container: '(string|element|boolean)',
fallbackPlacement: '(string|array)',
boundary: '(string|element)',
customClass: '(string|function)',
sanitize: 'boolean',
sanitizeFn: '(null|function)',
allowList: 'object',
@ -328,7 +374,7 @@
};
var Default = {
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,
@ -339,6 +385,7 @@
container: false,
fallbackPlacement: 'flip',
boundary: 'scrollParent',
customClass: '',
sanitize: true,
sanitizeFn: null,
allowList: DefaultAllowlist,
@ -372,26 +419,30 @@
* ------------------------------------------------------------------------
*/
var Tooltip = /*#__PURE__*/function () {
var Tooltip = /*#__PURE__*/function (_BaseComponent) {
_inheritsLoose(Tooltip, _BaseComponent);
function Tooltip(element, config) {
var _this;
if (typeof Popper__default['default'] === '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__default['default'].setData(element, this.constructor.DATA_KEY, this);
return _this;
} // Getters
@ -444,9 +495,8 @@
_proto.dispose = function dispose() {
clearTimeout(this._timeout);
Data__default['default'].removeData(this.element, this.constructor.DATA_KEY);
EventHandler__default['default'].off(this.element, this.constructor.EVENT_KEY);
EventHandler__default['default'].off(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
EventHandler__default['default'].off(this._element, this.constructor.EVENT_KEY);
EventHandler__default['default'].off(this._element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
if (this.tip) {
this.tip.parentNode.removeChild(this.tip);
@ -462,22 +512,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__default['default'].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__default['default'].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;
@ -486,14 +537,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);
}
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);
@ -503,17 +556,25 @@
Data__default['default'].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__default['default'].trigger(this.element, this.constructor.Event.INSERTED);
this._popper = new Popper__default['default'](this.element, tip, this._getPopperConfig(attachment));
tip.classList.add(CLASS_NAME_SHOW); // If this is a touch-enabled device we add extra
EventHandler__default['default'].trigger(this._element, this.constructor.Event.INSERTED);
this._popper = new Popper__default['default'](this._element, tip, this._getPopperConfig(attachment));
tip.classList.add(CLASS_NAME_SHOW);
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;
@ -523,16 +584,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__default['default'].trigger(_this.element, _this.constructor.Event.SHOWN);
var prevHoverState = _this2._hoverState;
_this2._hoverState = null;
EventHandler__default['default'].trigger(_this2._element, _this2.constructor.Event.SHOWN);
if (prevHoverState === HOVER_STATE_OUT) {
_this._leave(null, _this);
_this2._leave(null, _this2);
}
};
@ -547,7 +608,7 @@
};
_proto.hide = function hide() {
var _this2 = this;
var _this3 = this;
if (!this._popper) {
return;
@ -556,20 +617,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__default['default'].trigger(_this2.element, _this2.constructor.Event.HIDDEN);
EventHandler__default['default'].trigger(_this3._element, _this3.constructor.Event.HIDDEN);
_this2._popper.destroy();
_this3._popper.destroy();
};
var hideEvent = EventHandler__default['default'].trigger(this.element, this.constructor.Event.HIDE);
var hideEvent = EventHandler__default['default'].trigger(this._element, this.constructor.Event.HIDE);
if (hideEvent.defaultPrevented) {
return;
@ -664,10 +725,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;
@ -675,7 +736,7 @@
;
_proto._getPopperConfig = function _getPopperConfig(attachment) {
var _this3 = this;
var _this4 = this;
var defaultBsConfig = {
placement: attachment,
@ -693,11 +754,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);
@ -708,13 +769,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 {
@ -741,33 +802,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__default['default'].on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
return _this5.toggle(event);
EventHandler__default['default'].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__default['default'].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__default['default'].on(_this6._element, eventIn, _this6.config.selector, function (event) {
return _this6._enter(event);
});
EventHandler__default['default'].on(_this5.element, eventOut, _this5.config.selector, function (event) {
return _this5._leave(event);
EventHandler__default['default'].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__default['default'].on(this.element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
EventHandler__default['default'].on(this._element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
if (this.config.selector) {
this.config = _extends({}, this.config, {
@ -780,12 +841,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', '');
}
};
@ -865,7 +932,7 @@
};
_proto._getConfig = function _getConfig(config) {
var dataAttributes = Manipulator__default['default'].getDataAttributes(this.element);
var dataAttributes = Manipulator__default['default'].getDataAttributes(this._element);
Object.keys(dataAttributes).forEach(function (dataAttr) {
if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
delete dataAttributes[dataAttr];
@ -977,16 +1044,7 @@
});
};
Tooltip.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Tooltip, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
_createClass$1(Tooltip, null, [{
key: "Default",
get: function get() {
return Default;
@ -1019,7 +1077,7 @@
}]);
return Tooltip;
}();
}(BaseComponent);
/**
* ------------------------------------------------------------------------
* jQuery

File diff suppressed because one or more lines are too long