2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-17 19:21:23 +03:00
This commit is contained in:
XhmikosR
2020-12-03 16:18:59 +02:00
committed by GitHub
parent cfd00b5eeb
commit cfe31592d7
41 changed files with 2123 additions and 1695 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+3 -6
View File
@@ -1914,7 +1914,6 @@ progress {
} }
.table { .table {
--bs-table-bg: transparent; --bs-table-bg: transparent;
--bs-table-accent-bg: transparent;
--bs-table-striped-color: #212529; --bs-table-striped-color: #212529;
--bs-table-striped-bg: rgba(0, 0, 0, 0.05); --bs-table-striped-bg: rgba(0, 0, 0, 0.05);
--bs-table-active-color: #212529; --bs-table-active-color: #212529;
@@ -3754,7 +3753,7 @@ textarea.form-control-lg {
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
border-bottom-left-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 { .btn-group-vertical > .btn-group:not(:first-child) > .btn {
border-top-left-radius: 0; border-top-left-radius: 0;
border-top-right-radius: 0; border-top-right-radius: 0;
@@ -4397,11 +4396,9 @@ textarea.form-control-lg {
.breadcrumb { .breadcrumb {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
padding: 0.5rem 1rem; padding: 0 0;
margin-bottom: 1rem; margin-bottom: 1rem;
list-style: none; list-style: none;
background-color: #e9ecef;
border-radius: 0.25rem;
} }
.breadcrumb-item + .breadcrumb-item { .breadcrumb-item + .breadcrumb-item {
@@ -4411,7 +4408,7 @@ textarea.form-control-lg {
float: left; float: left;
padding-right: 0.5rem; padding-right: 0.5rem;
color: #6c757d; color: #6c757d;
content: "/"; content: var(--bs-breadcrumb-divider, "/");
} }
.breadcrumb-item.active { .breadcrumb-item.active {
color: #6c757d; color: #6c757d;
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+410 -407
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+410 -407
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+410 -407
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+57 -23
View File
@@ -5,7 +5,7 @@
*/ */
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) : 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)); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.Data, global.EventHandler));
}(this, (function (Data, EventHandler) { 'use strict'; }(this, (function (Data, EventHandler) { 'use strict';
@@ -112,8 +112,53 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
var NAME = 'alert';
var VERSION = '5.0.0-alpha3'; 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 DATA_KEY = 'bs.alert';
var EVENT_KEY = "." + DATA_KEY; var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api'; var DATA_API_KEY = '.data-api';
@@ -130,15 +175,12 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
var Alert = /*#__PURE__*/function () { var Alert = /*#__PURE__*/function (_BaseComponent) {
function Alert(element) { _inheritsLoose(Alert, _BaseComponent);
this._element = element;
if (this._element) {
Data__default['default'].setData(element, DATA_KEY, this);
}
} // Getters
function Alert() {
return _BaseComponent.apply(this, arguments) || this;
}
var _proto = Alert.prototype; var _proto = Alert.prototype;
@@ -153,11 +195,6 @@
} }
this._removeElement(rootElement); this._removeElement(rootElement);
};
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, DATA_KEY);
this._element = null;
} // Private } // Private
; ;
@@ -220,19 +257,16 @@
}; };
}; };
Alert.getInstance = function getInstance(element) { _createClass$1(Alert, null, [{
return Data__default['default'].getData(element, DATA_KEY); key: "DATA_KEY",
}; // Getters
_createClass(Alert, null, [{
key: "VERSION",
get: function get() { get: function get() {
return VERSION; return DATA_KEY;
} }
}]); }]);
return Alert; return Alert;
}(); }(BaseComponent);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
+1 -1
View File
File diff suppressed because one or more lines are too long
+57 -20
View File
@@ -5,7 +5,7 @@
*/ */
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) : 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)); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Button = factory(global.Data, global.EventHandler));
}(this, (function (Data, EventHandler) { 'use strict'; }(this, (function (Data, EventHandler) { 'use strict';
@@ -49,8 +49,53 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
var NAME = 'button';
var VERSION = '5.0.0-alpha3'; 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 DATA_KEY = 'bs.button';
var EVENT_KEY = "." + DATA_KEY; var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api'; var DATA_API_KEY = '.data-api';
@@ -63,12 +108,12 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
var Button = /*#__PURE__*/function () { var Button = /*#__PURE__*/function (_BaseComponent) {
function Button(element) { _inheritsLoose(Button, _BaseComponent);
this._element = element;
Data__default['default'].setData(element, DATA_KEY, this);
} // Getters
function Button() {
return _BaseComponent.apply(this, arguments) || this;
}
var _proto = Button.prototype; var _proto = Button.prototype;
@@ -76,11 +121,6 @@
_proto.toggle = function toggle() { _proto.toggle = function toggle() {
// Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method // 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)); 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 } // Static
; ;
@@ -98,19 +138,16 @@
}); });
}; };
Button.getInstance = function getInstance(element) { _createClass$1(Button, null, [{
return Data__default['default'].getData(element, DATA_KEY); key: "DATA_KEY",
}; // Getters
_createClass(Button, null, [{
key: "VERSION",
get: function get() { get: function get() {
return VERSION; return DATA_KEY;
} }
}]); }]);
return Button; return Button;
}(); }(BaseComponent);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
+1 -1
View File
File diff suppressed because one or more lines are too long
+104 -59
View File
@@ -5,7 +5,7 @@
*/ */
(function (global, factory) { (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 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)); (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'; }(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 _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; } 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 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 DATA_KEY = 'bs.carousel';
var EVENT_KEY = "." + DATA_KEY; var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api'; 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) { function Carousel(element, config) {
this._items = null; var _this;
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);
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 } // Getters
@@ -304,7 +353,7 @@
}; };
_proto.to = function to(index) { _proto.to = function to(index) {
var _this = this; var _this2 = this;
this._activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element); this._activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
@@ -316,7 +365,7 @@
if (this._isSliding) { if (this._isSliding) {
EventHandler__default['default'].one(this._element, EVENT_SLID, function () { EventHandler__default['default'].one(this._element, EVENT_SLID, function () {
return _this.to(index); return _this2.to(index);
}); });
return; return;
} }
@@ -333,11 +382,11 @@
}; };
_proto.dispose = function dispose() { _proto.dispose = function dispose() {
_BaseComponent.prototype.dispose.call(this);
EventHandler__default['default'].off(this._element, EVENT_KEY); EventHandler__default['default'].off(this._element, EVENT_KEY);
Data__default['default'].removeData(this._element, DATA_KEY);
this._items = null; this._items = null;
this._config = null; this._config = null;
this._element = null;
this._interval = null; this._interval = null;
this._isPaused = null; this._isPaused = null;
this._isSliding = null; this._isSliding = null;
@@ -373,20 +422,20 @@
}; };
_proto._addEventListeners = function _addEventListeners() { _proto._addEventListeners = function _addEventListeners() {
var _this2 = this; var _this3 = this;
if (this._config.keyboard) { if (this._config.keyboard) {
EventHandler__default['default'].on(this._element, EVENT_KEYDOWN, function (event) { EventHandler__default['default'].on(this._element, EVENT_KEYDOWN, function (event) {
return _this2._keydown(event); return _this3._keydown(event);
}); });
} }
if (this._config.pause === 'hover') { if (this._config.pause === 'hover') {
EventHandler__default['default'].on(this._element, EVENT_MOUSEENTER, function (event) { 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) { 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() { _proto._addTouchEventListeners = function _addTouchEventListeners() {
var _this3 = this; var _this4 = this;
var start = function start(event) { var start = function start(event) {
if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { if (_this4._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
_this3.touchStartX = event.clientX; _this4.touchStartX = event.clientX;
} else if (!_this3._pointerEvent) { } else if (!_this4._pointerEvent) {
_this3.touchStartX = event.touches[0].clientX; _this4.touchStartX = event.touches[0].clientX;
} }
}; };
var move = function move(event) { var move = function move(event) {
// ensure swiping with one touch and not pinching // ensure swiping with one touch and not pinching
if (event.touches && event.touches.length > 1) { if (event.touches && event.touches.length > 1) {
_this3.touchDeltaX = 0; _this4.touchDeltaX = 0;
} else { } else {
_this3.touchDeltaX = event.touches[0].clientX - _this3.touchStartX; _this4.touchDeltaX = event.touches[0].clientX - _this4.touchStartX;
} }
}; };
var end = function end(event) { var end = function end(event) {
if (_this3._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { if (_this4._pointerEvent && PointerType[event.pointerType.toUpperCase()]) {
_this3.touchDeltaX = event.clientX - _this3.touchStartX; _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 // If it's a touch-enabled device, mouseenter/leave are fired as
// part of the mouse compatibility events on first tap - the carousel // part of the mouse compatibility events on first tap - the carousel
// would stop cycling until user tapped out of it; // 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 // (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 // is NOT fired) and after a timeout (to allow for mouse compatibility
// events to fire) we explicitly restart cycling // events to fire) we explicitly restart cycling
_this3.pause(); _this4.pause();
if (_this3.touchTimeout) { if (_this4.touchTimeout) {
clearTimeout(_this3.touchTimeout); clearTimeout(_this4.touchTimeout);
} }
_this3.touchTimeout = setTimeout(function (event) { _this4.touchTimeout = setTimeout(function (event) {
return _this3.cycle(event); return _this4.cycle(event);
}, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); }, TOUCHEVENT_COMPAT_WAIT + _this4._config.interval);
} }
}; };
@@ -558,7 +607,7 @@
}; };
_proto._slide = function _slide(direction, element) { _proto._slide = function _slide(direction, element) {
var _this4 = this; var _this5 = this;
var activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element); var activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element);
@@ -619,9 +668,9 @@
nextElement.classList.remove(directionalClassName, orderClassName); nextElement.classList.remove(directionalClassName, orderClassName);
nextElement.classList.add(CLASS_NAME_ACTIVE); nextElement.classList.add(CLASS_NAME_ACTIVE);
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName); activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
_this4._isSliding = false; _this5._isSliding = false;
setTimeout(function () { setTimeout(function () {
EventHandler__default['default'].trigger(_this4._element, EVENT_SLID, { EventHandler__default['default'].trigger(_this5._element, EVENT_SLID, {
relatedTarget: nextElement, relatedTarget: nextElement,
direction: eventDirectionName, direction: eventDirectionName,
from: activeElementIndex, from: activeElementIndex,
@@ -707,24 +756,20 @@
event.preventDefault(); event.preventDefault();
}; };
Carousel.getInstance = function getInstance(element) { _createClass$1(Carousel, null, [{
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Carousel, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default", key: "Default",
get: function get() { get: function get() {
return Default; return Default;
} }
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}]); }]);
return Carousel; return Carousel;
}(); }(BaseComponent);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
+1 -1
View File
File diff suppressed because one or more lines are too long
+90 -45
View File
@@ -5,7 +5,7 @@
*/ */
(function (global, factory) { (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 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)); (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'; }(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 _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; } 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 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 DATA_KEY = 'bs.collapse';
var EVENT_KEY = "." + DATA_KEY; var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api'; 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) { function Collapse(element, config) {
this._isTransitioning = false; var _this;
this._element = element;
this._config = this._getConfig(config); _this = _BaseComponent.call(this, element) || this;
this._triggerArray = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE + "[href=\"#" + element.id + "\"]," + (SELECTOR_DATA_TOGGLE + "[data-bs-target=\"#" + element.id + "\"]")); _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); var toggleList = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
for (var i = 0, len = toggleList.length; i < len; i++) { for (var i = 0, len = toggleList.length; i < len; i++) {
@@ -202,23 +251,23 @@
}); });
if (selector !== null && filterElement.length) { 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) { if (!_this._config.parent) {
this._addAriaAndCollapsedClass(this._element, this._triggerArray); _this._addAriaAndCollapsedClass(_this._element, _this._triggerArray);
} }
if (this._config.toggle) { if (_this._config.toggle) {
this.toggle(); _this.toggle();
} }
Data__default['default'].setData(element, DATA_KEY, this); return _this;
} // Getters } // Getters
@@ -234,7 +283,7 @@
}; };
_proto.show = function show() { _proto.show = function show() {
var _this = this; var _this2 = this;
if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) { if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
return; return;
@@ -245,8 +294,8 @@
if (this._parent) { if (this._parent) {
actives = SelectorEngine__default['default'].find(SELECTOR_ACTIVES, this._parent).filter(function (elem) { actives = SelectorEngine__default['default'].find(SELECTOR_ACTIVES, this._parent).filter(function (elem) {
if (typeof _this._config.parent === 'string') { if (typeof _this2._config.parent === 'string') {
return elem.getAttribute('data-bs-parent') === _this._config.parent; return elem.getAttribute('data-bs-parent') === _this2._config.parent;
} }
return elem.classList.contains(CLASS_NAME_COLLAPSE); return elem.classList.contains(CLASS_NAME_COLLAPSE);
@@ -306,15 +355,15 @@
this.setTransitioning(true); this.setTransitioning(true);
var complete = function complete() { 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); var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
@@ -326,7 +375,7 @@
}; };
_proto.hide = function hide() { _proto.hide = function hide() {
var _this2 = this; var _this3 = this;
if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) { if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
return; return;
@@ -364,13 +413,13 @@
this.setTransitioning(true); this.setTransitioning(true);
var complete = function complete() { 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] = ''; this._element.style[dimension] = '';
@@ -384,10 +433,10 @@
}; };
_proto.dispose = function dispose() { _proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, DATA_KEY); _BaseComponent.prototype.dispose.call(this);
this._config = null; this._config = null;
this._parent = null; this._parent = null;
this._element = null;
this._triggerArray = null; this._triggerArray = null;
this._isTransitioning = null; this._isTransitioning = null;
} // Private } // Private
@@ -406,7 +455,7 @@
}; };
_proto._getParent = function _getParent() { _proto._getParent = function _getParent() {
var _this3 = this; var _this4 = this;
var parent = this._config.parent; var parent = this._config.parent;
@@ -423,7 +472,7 @@
SelectorEngine__default['default'].find(selector, parent).forEach(function (element) { SelectorEngine__default['default'].find(selector, parent).forEach(function (element) {
var selected = getElementFromSelector(element); var selected = getElementFromSelector(element);
_this3._addAriaAndCollapsedClass(selected, [element]); _this4._addAriaAndCollapsedClass(selected, [element]);
}); });
return parent; return parent;
}; };
@@ -474,24 +523,20 @@
}); });
}; };
Collapse.getInstance = function getInstance(element) { _createClass$1(Collapse, null, [{
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Collapse, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default", key: "Default",
get: function get() { get: function get() {
return Default; return Default;
} }
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}]); }]);
return Collapse; return Collapse;
}(); }(BaseComponent);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+77 -33
View File
@@ -5,7 +5,7 @@
*/ */
(function (global, factory) { (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 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)); (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'; }(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 _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; } 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 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 DATA_KEY = 'bs.dropdown';
var EVENT_KEY = "." + DATA_KEY; var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api'; 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) { function Dropdown(element, config) {
this._element = element; var _this;
this._popper = null;
this._config = this._getConfig(config);
this._menu = this._getMenuElement();
this._inNavbar = this._detectNavbar();
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 } // Getters
@@ -300,9 +349,9 @@
}; };
_proto.dispose = function dispose() { _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); EventHandler__default['default'].off(this._element, EVENT_KEY);
this._element = null;
this._menu = null; this._menu = null;
if (this._popper) { if (this._popper) {
@@ -322,13 +371,13 @@
; ;
_proto._addEventListeners = function _addEventListeners() { _proto._addEventListeners = function _addEventListeners() {
var _this = this; var _this2 = this;
EventHandler__default['default'].on(this._element, EVENT_CLICK, function (event) { EventHandler__default['default'].on(this._element, EVENT_CLICK, function (event) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
_this.toggle(); _this2.toggle();
}); });
}; };
@@ -364,13 +413,13 @@
}; };
_proto._getOffset = function _getOffset() { _proto._getOffset = function _getOffset() {
var _this2 = this; var _this3 = this;
var offset = {}; var offset = {};
if (typeof this._config.offset === 'function') { if (typeof this._config.offset === 'function') {
offset.fn = function (data) { 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; return data;
}; };
} else { } else {
@@ -532,15 +581,14 @@
return; return;
} }
var index = items.indexOf(event.target); var index = items.indexOf(event.target); // Up
if (event.key === ARROW_UP_KEY && index > 0) { if (event.key === ARROW_UP_KEY && index > 0) {
// Up
index--; index--;
} } // Down
if (event.key === ARROW_DOWN_KEY && index < items.length - 1) { if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
// Down
index++; index++;
} // index is -1 if the first keydown is an ArrowUp } // index is -1 if the first keydown is an ArrowUp
@@ -549,16 +597,7 @@
items[index].focus(); items[index].focus();
}; };
Dropdown.getInstance = function getInstance(element) { _createClass$1(Dropdown, null, [{
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Dropdown, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default", key: "Default",
get: function get() { get: function get() {
return Default; return Default;
@@ -568,10 +607,15 @@
get: function get() { get: function get() {
return DefaultType; return DefaultType;
} }
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}]); }]);
return Dropdown; return Dropdown;
}(); }(BaseComponent);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
+1 -1
View File
File diff suppressed because one or more lines are too long
+121 -79
View File
@@ -5,7 +5,7 @@
*/ */
(function (global, factory) { (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 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)); (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'; }(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 _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; } 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 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 DATA_KEY = 'bs.modal';
var EVENT_KEY = "." + DATA_KEY; var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api'; var DATA_API_KEY = '.data-api';
@@ -167,14 +212,12 @@
var Default = { var Default = {
backdrop: true, backdrop: true,
keyboard: true, keyboard: true,
focus: true, focus: true
show: true
}; };
var DefaultType = { var DefaultType = {
backdrop: '(boolean|string)', backdrop: '(boolean|string)',
keyboard: 'boolean', keyboard: 'boolean',
focus: 'boolean', focus: 'boolean'
show: 'boolean'
}; };
var EVENT_HIDE = "hide" + EVENT_KEY; var EVENT_HIDE = "hide" + EVENT_KEY;
var EVENT_HIDE_PREVENTED = "hidePrevented" + 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) { function Modal(element, config) {
this._config = this._getConfig(config); var _this;
this._element = element;
this._dialog = SelectorEngine__default['default'].findOne(SELECTOR_DIALOG, element); _this = _BaseComponent.call(this, element) || this;
this._backdrop = null; _this._config = _this._getConfig(config);
this._isShown = false; _this._dialog = SelectorEngine__default['default'].findOne(SELECTOR_DIALOG, element);
this._isBodyOverflowing = false; _this._backdrop = null;
this._ignoreBackdropClick = false; _this._isShown = false;
this._isTransitioning = false; _this._isBodyOverflowing = false;
this._scrollbarWidth = 0; _this._ignoreBackdropClick = false;
Data__default['default'].setData(element, DATA_KEY, this); _this._isTransitioning = false;
_this._scrollbarWidth = 0;
return _this;
} // Getters } // Getters
@@ -229,7 +276,7 @@
}; };
_proto.show = function show(relatedTarget) { _proto.show = function show(relatedTarget) {
var _this = this; var _this2 = this;
if (this._isShown || this._isTransitioning) { if (this._isShown || this._isTransitioning) {
return; return;
@@ -260,23 +307,23 @@
this._setResizeEvent(); this._setResizeEvent();
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) { 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'].on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () {
EventHandler__default['default'].one(_this._element, EVENT_MOUSEUP_DISMISS, function (event) { EventHandler__default['default'].one(_this2._element, EVENT_MOUSEUP_DISMISS, function (event) {
if (event.target === _this._element) { if (event.target === _this2._element) {
_this._ignoreBackdropClick = true; _this2._ignoreBackdropClick = true;
} }
}); });
}); });
this._showBackdrop(function () { this._showBackdrop(function () {
return _this._showElement(relatedTarget); return _this2._showElement(relatedTarget);
}); });
}; };
_proto.hide = function hide(event) { _proto.hide = function hide(event) {
var _this2 = this; var _this3 = this;
if (event) { if (event) {
event.preventDefault(); event.preventDefault();
@@ -314,7 +361,7 @@
if (transition) { if (transition) {
var transitionDuration = getTransitionDurationFromElement(this._element); var transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, TRANSITION_END, function (event) { EventHandler__default['default'].one(this._element, TRANSITION_END, function (event) {
return _this2._hideModal(event); return _this3._hideModal(event);
}); });
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
} else { } else {
@@ -326,16 +373,17 @@
[window, this._element, this._dialog].forEach(function (htmlElement) { [window, this._element, this._dialog].forEach(function (htmlElement) {
return EventHandler__default['default'].off(htmlElement, EVENT_KEY); return EventHandler__default['default'].off(htmlElement, EVENT_KEY);
}); });
_BaseComponent.prototype.dispose.call(this);
/** /**
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
* Do not move `document` in `htmlElements` array * Do not move `document` in `htmlElements` array
* It will remove `EVENT_CLICK_DATA_API` event that should remain * It will remove `EVENT_CLICK_DATA_API` event that should remain
*/ */
EventHandler__default['default'].off(document, EVENT_FOCUSIN); EventHandler__default['default'].off(document, EVENT_FOCUSIN);
Data__default['default'].removeData(this._element, DATA_KEY);
this._config = null; this._config = null;
this._element = null;
this._dialog = null; this._dialog = null;
this._backdrop = null; this._backdrop = null;
this._isShown = null; this._isShown = null;
@@ -357,7 +405,7 @@
}; };
_proto._showElement = function _showElement(relatedTarget) { _proto._showElement = function _showElement(relatedTarget) {
var _this3 = this; var _this4 = this;
var transition = this._element.classList.contains(CLASS_NAME_FADE); var transition = this._element.classList.contains(CLASS_NAME_FADE);
@@ -393,12 +441,12 @@
} }
var transitionComplete = function transitionComplete() { var transitionComplete = function transitionComplete() {
if (_this3._config.focus) { if (_this4._config.focus) {
_this3._element.focus(); _this4._element.focus();
} }
_this3._isTransitioning = false; _this4._isTransitioning = false;
EventHandler__default['default'].trigger(_this3._element, EVENT_SHOWN, { EventHandler__default['default'].trigger(_this4._element, EVENT_SHOWN, {
relatedTarget: relatedTarget relatedTarget: relatedTarget
}); });
}; };
@@ -413,28 +461,28 @@
}; };
_proto._enforceFocus = function _enforceFocus() { _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'].off(document, EVENT_FOCUSIN); // guard against infinite focus loop
EventHandler__default['default'].on(document, EVENT_FOCUSIN, function (event) { EventHandler__default['default'].on(document, EVENT_FOCUSIN, function (event) {
if (document !== event.target && _this4._element !== event.target && !_this4._element.contains(event.target)) { if (document !== event.target && _this5._element !== event.target && !_this5._element.contains(event.target)) {
_this4._element.focus(); _this5._element.focus();
} }
}); });
}; };
_proto._setEscapeEvent = function _setEscapeEvent() { _proto._setEscapeEvent = function _setEscapeEvent() {
var _this5 = this; var _this6 = this;
if (this._isShown) { if (this._isShown) {
EventHandler__default['default'].on(this._element, EVENT_KEYDOWN_DISMISS, function (event) { 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(); event.preventDefault();
_this5.hide(); _this6.hide();
} else if (!_this5._config.keyboard && event.key === ESCAPE_KEY) { } else if (!_this6._config.keyboard && event.key === ESCAPE_KEY) {
_this5._triggerBackdropTransition(); _this6._triggerBackdropTransition();
} }
}); });
} else { } else {
@@ -443,11 +491,11 @@
}; };
_proto._setResizeEvent = function _setResizeEvent() { _proto._setResizeEvent = function _setResizeEvent() {
var _this6 = this; var _this7 = this;
if (this._isShown) { if (this._isShown) {
EventHandler__default['default'].on(window, EVENT_RESIZE, function () { EventHandler__default['default'].on(window, EVENT_RESIZE, function () {
return _this6._adjustDialog(); return _this7._adjustDialog();
}); });
} else { } else {
EventHandler__default['default'].off(window, EVENT_RESIZE); EventHandler__default['default'].off(window, EVENT_RESIZE);
@@ -455,7 +503,7 @@
}; };
_proto._hideModal = function _hideModal() { _proto._hideModal = function _hideModal() {
var _this7 = this; var _this8 = this;
this._element.style.display = 'none'; this._element.style.display = 'none';
@@ -470,11 +518,11 @@
this._showBackdrop(function () { this._showBackdrop(function () {
document.body.classList.remove(CLASS_NAME_OPEN); 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) { _proto._showBackdrop = function _showBackdrop(callback) {
var _this8 = this; var _this9 = this;
var animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : ''; var animate = this._element.classList.contains(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
@@ -499,8 +547,8 @@
document.body.appendChild(this._backdrop); document.body.appendChild(this._backdrop);
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, function (event) { EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, function (event) {
if (_this8._ignoreBackdropClick) { if (_this9._ignoreBackdropClick) {
_this8._ignoreBackdropClick = false; _this9._ignoreBackdropClick = false;
return; return;
} }
@@ -508,10 +556,10 @@
return; return;
} }
if (_this8._config.backdrop === 'static') { if (_this9._config.backdrop === 'static') {
_this8._triggerBackdropTransition(); _this9._triggerBackdropTransition();
} else { } else {
_this8.hide(); _this9.hide();
} }
}); });
@@ -533,7 +581,7 @@
this._backdrop.classList.remove(CLASS_NAME_SHOW); this._backdrop.classList.remove(CLASS_NAME_SHOW);
var callbackRemove = function callbackRemove() { var callbackRemove = function callbackRemove() {
_this8._removeBackdrop(); _this9._removeBackdrop();
callback(); callback();
}; };
@@ -552,7 +600,7 @@
}; };
_proto._triggerBackdropTransition = function _triggerBackdropTransition() { _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
var _this9 = this; var _this10 = this;
var hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE_PREVENTED); var hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE_PREVENTED);
@@ -571,13 +619,13 @@
var modalTransitionDuration = getTransitionDurationFromElement(this._dialog); var modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
EventHandler__default['default'].off(this._element, TRANSITION_END); EventHandler__default['default'].off(this._element, TRANSITION_END);
EventHandler__default['default'].one(this._element, TRANSITION_END, function () { 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) { if (!isModalOverflowing) {
EventHandler__default['default'].one(_this9._element, TRANSITION_END, function () { EventHandler__default['default'].one(_this10._element, TRANSITION_END, function () {
_this9._element.style.overflowY = ''; _this10._element.style.overflowY = '';
}); });
emulateTransitionEnd(_this9._element, modalTransitionDuration); emulateTransitionEnd(_this10._element, modalTransitionDuration);
} }
}); });
emulateTransitionEnd(this._element, modalTransitionDuration); emulateTransitionEnd(this._element, modalTransitionDuration);
@@ -612,7 +660,7 @@
}; };
_proto._setScrollbar = function _setScrollbar() { _proto._setScrollbar = function _setScrollbar() {
var _this10 = this; var _this11 = this;
if (this._isBodyOverflowing) { if (this._isBodyOverflowing) {
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
@@ -622,14 +670,14 @@
var actualPadding = element.style.paddingRight; var actualPadding = element.style.paddingRight;
var calculatedPadding = window.getComputedStyle(element)['padding-right']; var calculatedPadding = window.getComputedStyle(element)['padding-right'];
Manipulator__default['default'].setDataAttribute(element, 'padding-right', actualPadding); 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 }); // Adjust sticky content margin
SelectorEngine__default['default'].find(SELECTOR_STICKY_CONTENT).forEach(function (element) { SelectorEngine__default['default'].find(SELECTOR_STICKY_CONTENT).forEach(function (element) {
var actualMargin = element.style.marginRight; var actualMargin = element.style.marginRight;
var calculatedMargin = window.getComputedStyle(element)['margin-right']; var calculatedMargin = window.getComputedStyle(element)['margin-right'];
Manipulator__default['default'].setDataAttribute(element, 'margin-right', actualMargin); 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 }); // Adjust body padding
var actualPadding = document.body.style.paddingRight; var actualPadding = document.body.style.paddingRight;
@@ -698,30 +746,24 @@
} }
data[config](relatedTarget); data[config](relatedTarget);
} else if (_config.show) {
data.show(relatedTarget);
} }
}); });
}; };
Modal.getInstance = function getInstance(element) { _createClass$1(Modal, null, [{
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Modal, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default", key: "Default",
get: function get() { get: function get() {
return Default; return Default;
} }
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}]); }]);
return Modal; return Modal;
}(); }(BaseComponent);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
@@ -730,7 +772,7 @@
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
var _this11 = this; var _this12 = this;
var target = getElementFromSelector(this); var target = getElementFromSelector(this);
@@ -745,8 +787,8 @@
} }
EventHandler__default['default'].one(target, EVENT_HIDDEN, function () { EventHandler__default['default'].one(target, EVENT_HIDDEN, function () {
if (isVisible(_this11)) { if (isVisible(_this12)) {
_this11.focus(); _this12.focus();
} }
}); });
}); });
+1 -1
View File
File diff suppressed because one or more lines are too long
+5 -15
View File
@@ -5,7 +5,7 @@
*/ */
(function (global, factory) { (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 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)); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.Data, global.SelectorEngine, global.Tooltip));
}(this, (function (Data, SelectorEngine, Tooltip) { 'use strict'; }(this, (function (Data, SelectorEngine, Tooltip) { 'use strict';
@@ -55,7 +55,6 @@
*/ */
var NAME = 'popover'; var NAME = 'popover';
var VERSION = '5.0.0-alpha3';
var DATA_KEY = 'bs.popover'; var DATA_KEY = 'bs.popover';
var EVENT_KEY = "." + DATA_KEY; var EVENT_KEY = "." + DATA_KEY;
var CLASS_PREFIX = 'bs-popover'; var CLASS_PREFIX = 'bs-popover';
@@ -65,7 +64,7 @@
placement: 'right', placement: 'right',
trigger: 'click', trigger: 'click',
content: '', 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, { var DefaultType = _extends({}, Tooltip__default['default'].DefaultType, {
@@ -116,7 +115,7 @@
var content = this._getContent(); var content = this._getContent();
if (typeof content === 'function') { if (typeof content === 'function') {
content = content.call(this.element); content = content.call(this._element);
} }
this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_CONTENT, tip), content); this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_CONTENT, tip), content);
@@ -129,7 +128,7 @@
}; };
_proto._getContent = function _getContent() { _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() { _proto._cleanTipClass = function _cleanTipClass() {
@@ -171,18 +170,9 @@
}); });
}; };
Popover.getInstance = function getInstance(element) {
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Popover, null, [{ _createClass(Popover, null, [{
key: "VERSION",
// Getters
get: function get() {
return VERSION;
}
}, {
key: "Default", key: "Default",
// Getters
get: function get() { get: function get() {
return Default; return Default;
} }
+1 -1
View File
File diff suppressed because one or more lines are too long
+76 -32
View File
@@ -5,7 +5,7 @@
*/ */
(function (global, factory) { (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 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)); (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'; }(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 _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; } 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 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 DATA_KEY = 'bs.scrollspy';
var EVENT_KEY = "." + DATA_KEY; var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api'; var DATA_API_KEY = '.data-api';
@@ -148,26 +193,29 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
var ScrollSpy = /*#__PURE__*/function () { var ScrollSpy = /*#__PURE__*/function (_BaseComponent) {
function ScrollSpy(element, config) { _inheritsLoose(ScrollSpy, _BaseComponent);
var _this = this;
this._element = element; function ScrollSpy(element, config) {
this._scrollElement = element.tagName === 'BODY' ? window : element; var _this;
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 = _BaseComponent.call(this, element) || this;
this._offsets = []; _this._scrollElement = element.tagName === 'BODY' ? window : element;
this._targets = []; _this._config = _this._getConfig(config);
this._activeTarget = null; _this._selector = _this._config.target + " " + SELECTOR_NAV_LINKS + ", " + _this._config.target + " " + SELECTOR_LIST_ITEMS + ", " + _this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM;
this._scrollHeight = 0; _this._offsets = [];
EventHandler__default['default'].on(this._scrollElement, EVENT_SCROLL, function (event) { _this._targets = [];
_this._activeTarget = null;
_this._scrollHeight = 0;
EventHandler__default['default'].on(_this._scrollElement, EVENT_SCROLL, function (event) {
return _this._process(event); return _this._process(event);
}); });
this.refresh();
this._process(); _this.refresh();
Data__default['default'].setData(element, DATA_KEY, this); _this._process();
return _this;
} // Getters } // Getters
@@ -209,9 +257,9 @@
}; };
_proto.dispose = function dispose() { _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); EventHandler__default['default'].off(this._scrollElement, EVENT_KEY);
this._element = null;
this._scrollElement = null; this._scrollElement = null;
this._config = null; this._config = null;
this._selector = null; this._selector = null;
@@ -356,24 +404,20 @@
}); });
}; };
ScrollSpy.getInstance = function getInstance(element) { _createClass$1(ScrollSpy, null, [{
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(ScrollSpy, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default", key: "Default",
get: function get() { get: function get() {
return Default; return Default;
} }
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}]); }]);
return ScrollSpy; return ScrollSpy;
}(); }(BaseComponent);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
+1 -1
View File
File diff suppressed because one or more lines are too long
+57 -20
View File
@@ -5,7 +5,7 @@
*/ */
(function (global, factory) { (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 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)); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.Data, global.EventHandler, global.SelectorEngine));
}(this, (function (Data, EventHandler, SelectorEngine) { 'use strict'; }(this, (function (Data, EventHandler, SelectorEngine) { 'use strict';
@@ -117,8 +117,53 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
var NAME = 'tab';
var VERSION = '5.0.0-alpha3'; 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 DATA_KEY = 'bs.tab';
var EVENT_KEY = "." + DATA_KEY; var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api'; var DATA_API_KEY = '.data-api';
@@ -145,12 +190,12 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
var Tab = /*#__PURE__*/function () { var Tab = /*#__PURE__*/function (_BaseComponent) {
function Tab(element) { _inheritsLoose(Tab, _BaseComponent);
this._element = element;
Data__default['default'].setData(this._element, DATA_KEY, this);
} // Getters
function Tab() {
return _BaseComponent.apply(this, arguments) || this;
}
var _proto = Tab.prototype; var _proto = Tab.prototype;
@@ -205,11 +250,6 @@
} else { } else {
complete(); complete();
} }
};
_proto.dispose = function dispose() {
Data__default['default'].removeData(this._element, DATA_KEY);
this._element = null;
} // Private } // Private
; ;
@@ -292,19 +332,16 @@
}); });
}; };
Tab.getInstance = function getInstance(element) { _createClass$1(Tab, null, [{
return Data__default['default'].getData(element, DATA_KEY); key: "DATA_KEY",
}; // Getters
_createClass(Tab, null, [{
key: "VERSION",
get: function get() { get: function get() {
return VERSION; return DATA_KEY;
} }
}]); }]);
return Tab; return Tab;
}(); }(BaseComponent);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
+1 -1
View File
File diff suppressed because one or more lines are too long
+82 -36
View File
@@ -5,7 +5,7 @@
*/ */
(function (global, factory) { (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 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)); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.Data, global.EventHandler, global.Manipulator));
}(this, (function (Data, EventHandler, Manipulator) { 'use strict'; }(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 _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; } 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 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 DATA_KEY = 'bs.toast';
var EVENT_KEY = "." + DATA_KEY; var EVENT_KEY = "." + DATA_KEY;
var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_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) { function Toast(element, config) {
this._element = element; var _this;
this._config = this._getConfig(config);
this._timeout = null;
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 } // Getters
@@ -173,7 +222,7 @@
// Public // Public
_proto.show = function show() { _proto.show = function show() {
var _this = this; var _this2 = this;
var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW); var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW);
@@ -188,16 +237,16 @@
} }
var complete = function complete() { 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) { if (_this2._config.autohide) {
_this._timeout = setTimeout(function () { _this2._timeout = setTimeout(function () {
_this.hide(); _this2.hide();
}, _this._config.delay); }, _this2._config.delay);
} }
}; };
@@ -217,7 +266,7 @@
}; };
_proto.hide = function hide() { _proto.hide = function hide() {
var _this2 = this; var _this3 = this;
if (!this._element.classList.contains(CLASS_NAME_SHOW)) { if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
return; return;
@@ -230,9 +279,9 @@
} }
var complete = function complete() { 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); this._element.classList.remove(CLASS_NAME_SHOW);
@@ -254,8 +303,9 @@
} }
EventHandler__default['default'].off(this._element, EVENT_CLICK_DISMISS); 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; this._config = null;
} // Private } // Private
; ;
@@ -267,10 +317,10 @@
}; };
_proto._setListeners = function _setListeners() { _proto._setListeners = function _setListeners() {
var _this3 = this; var _this4 = this;
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () { 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) { _createClass$1(Toast, null, [{
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Toast, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "DefaultType", key: "DefaultType",
get: function get() { get: function get() {
return DefaultType; return DefaultType;
@@ -319,10 +360,15 @@
get: function get() { get: function get() {
return Default; return Default;
} }
}, {
key: "DATA_KEY",
get: function get() {
return DATA_KEY;
}
}]); }]);
return Toast; return Toast;
}(); }(BaseComponent);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* jQuery * jQuery
+1 -1
View File
File diff suppressed because one or more lines are too long
+138 -80
View File
@@ -5,7 +5,7 @@
*/ */
(function (global, factory) { (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 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)); (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'; }(this, (function (Data, EventHandler, Manipulator, Popper, SelectorEngine) { 'use strict';
@@ -283,8 +283,6 @@
return createdDocument.body.innerHTML; 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 _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; } 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 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 DATA_KEY = 'bs.tooltip';
var EVENT_KEY = "." + DATA_KEY; var EVENT_KEY = "." + DATA_KEY;
var CLASS_PREFIX = 'bs-tooltip'; var CLASS_PREFIX = 'bs-tooltip';
@@ -314,6 +359,7 @@
container: '(string|element|boolean)', container: '(string|element|boolean)',
fallbackPlacement: '(string|array)', fallbackPlacement: '(string|array)',
boundary: '(string|element)', boundary: '(string|element)',
customClass: '(string|function)',
sanitize: 'boolean', sanitize: 'boolean',
sanitizeFn: '(null|function)', sanitizeFn: '(null|function)',
allowList: 'object', allowList: 'object',
@@ -328,7 +374,7 @@
}; };
var Default = { var Default = {
animation: true, 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', trigger: 'hover focus',
title: '', title: '',
delay: 0, delay: 0,
@@ -339,6 +385,7 @@
container: false, container: false,
fallbackPlacement: 'flip', fallbackPlacement: 'flip',
boundary: 'scrollParent', boundary: 'scrollParent',
customClass: '',
sanitize: true, sanitize: true,
sanitizeFn: null, sanitizeFn: null,
allowList: DefaultAllowlist, allowList: DefaultAllowlist,
@@ -372,26 +419,30 @@
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
var Tooltip = /*#__PURE__*/function () { var Tooltip = /*#__PURE__*/function (_BaseComponent) {
_inheritsLoose(Tooltip, _BaseComponent);
function Tooltip(element, config) { function Tooltip(element, config) {
var _this;
if (typeof Popper__default['default'] === 'undefined') { if (typeof Popper__default['default'] === 'undefined') {
throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
} // private }
_this = _BaseComponent.call(this, element) || this; // private
this._isEnabled = true; _this._isEnabled = true;
this._timeout = 0; _this._timeout = 0;
this._hoverState = ''; _this._hoverState = '';
this._activeTrigger = {}; _this._activeTrigger = {};
this._popper = null; // Protected _this._popper = null; // Protected
this.element = element; _this.config = _this._getConfig(config);
this.config = this._getConfig(config); _this.tip = null;
this.tip = null;
this._setListeners(); _this._setListeners();
Data__default['default'].setData(element, this.constructor.DATA_KEY, this); return _this;
} // Getters } // Getters
@@ -444,9 +495,8 @@
_proto.dispose = function dispose() { _proto.dispose = function dispose() {
clearTimeout(this._timeout); 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, 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.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler);
if (this.tip) { if (this.tip) {
this.tip.parentNode.removeChild(this.tip); this.tip.parentNode.removeChild(this.tip);
@@ -462,22 +512,23 @@
} }
this._popper = null; this._popper = null;
this.element = null;
this.config = null; this.config = null;
this.tip = null; this.tip = null;
_BaseComponent.prototype.dispose.call(this);
}; };
_proto.show = function show() { _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'); throw new Error('Please use show on visible elements');
} }
if (this.isWithContent() && this._isEnabled) { if (this.isWithContent() && this._isEnabled) {
var showEvent = EventHandler__default['default'].trigger(this.element, this.constructor.Event.SHOW); var showEvent = EventHandler__default['default'].trigger(this._element, this.constructor.Event.SHOW);
var shadowRoot = findShadowRoot(this.element); var shadowRoot = findShadowRoot(this._element);
var isInTheDom = shadowRoot === null ? this.element.ownerDocument.documentElement.contains(this.element) : shadowRoot.contains(this.element); var isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
if (showEvent.defaultPrevented || !isInTheDom) { if (showEvent.defaultPrevented || !isInTheDom) {
return; return;
@@ -486,14 +537,16 @@
var tip = this.getTipElement(); var tip = this.getTipElement();
var tipId = getUID(this.constructor.NAME); var tipId = getUID(this.constructor.NAME);
tip.setAttribute('id', tipId); tip.setAttribute('id', tipId);
this.element.setAttribute('aria-describedby', tipId);
this._element.setAttribute('aria-describedby', tipId);
this.setContent(); this.setContent();
if (this.config.animation) { if (this.config.animation) {
tip.classList.add(CLASS_NAME_FADE); 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); var attachment = this._getAttachment(placement);
@@ -503,17 +556,25 @@
Data__default['default'].setData(tip, this.constructor.DATA_KEY, this); 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); container.appendChild(tip);
} }
EventHandler__default['default'].trigger(this.element, this.constructor.Event.INSERTED); EventHandler__default['default'].trigger(this._element, this.constructor.Event.INSERTED);
this._popper = new Popper__default['default'](this.element, tip, this._getPopperConfig(attachment)); 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 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; // empty mouseover listeners to the body's immediate children;
// only needed because of broken event delegation on iOS // only needed because of broken event delegation on iOS
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
if ('ontouchstart' in document.documentElement) { if ('ontouchstart' in document.documentElement) {
var _ref; var _ref;
@@ -523,16 +584,16 @@
} }
var complete = function complete() { var complete = function complete() {
if (_this.config.animation) { if (_this2.config.animation) {
_this._fixTransition(); _this2._fixTransition();
} }
var prevHoverState = _this._hoverState; var prevHoverState = _this2._hoverState;
_this._hoverState = null; _this2._hoverState = null;
EventHandler__default['default'].trigger(_this.element, _this.constructor.Event.SHOWN); EventHandler__default['default'].trigger(_this2._element, _this2.constructor.Event.SHOWN);
if (prevHoverState === HOVER_STATE_OUT) { if (prevHoverState === HOVER_STATE_OUT) {
_this._leave(null, _this); _this2._leave(null, _this2);
} }
}; };
@@ -547,7 +608,7 @@
}; };
_proto.hide = function hide() { _proto.hide = function hide() {
var _this2 = this; var _this3 = this;
if (!this._popper) { if (!this._popper) {
return; return;
@@ -556,20 +617,20 @@
var tip = this.getTipElement(); var tip = this.getTipElement();
var complete = function complete() { var complete = function complete() {
if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) { if (_this3._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
tip.parentNode.removeChild(tip); 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) { if (hideEvent.defaultPrevented) {
return; return;
@@ -664,10 +725,10 @@
}; };
_proto.getTitle = function getTitle() { _proto.getTitle = function getTitle() {
var title = this.element.getAttribute('data-bs-original-title'); var title = this._element.getAttribute('data-bs-original-title');
if (!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; return title;
@@ -675,7 +736,7 @@
; ;
_proto._getPopperConfig = function _getPopperConfig(attachment) { _proto._getPopperConfig = function _getPopperConfig(attachment) {
var _this3 = this; var _this4 = this;
var defaultBsConfig = { var defaultBsConfig = {
placement: attachment, placement: attachment,
@@ -693,11 +754,11 @@
}, },
onCreate: function onCreate(data) { onCreate: function onCreate(data) {
if (data.originalPlacement !== data.placement) { if (data.originalPlacement !== data.placement) {
_this3._handlePopperPlacementChange(data); _this4._handlePopperPlacementChange(data);
} }
}, },
onUpdate: function onUpdate(data) { onUpdate: function onUpdate(data) {
return _this3._handlePopperPlacementChange(data); return _this4._handlePopperPlacementChange(data);
} }
}; };
return _extends({}, defaultBsConfig, this.config.popperConfig); return _extends({}, defaultBsConfig, this.config.popperConfig);
@@ -708,13 +769,13 @@
}; };
_proto._getOffset = function _getOffset() { _proto._getOffset = function _getOffset() {
var _this4 = this; var _this5 = this;
var offset = {}; var offset = {};
if (typeof this.config.offset === 'function') { if (typeof this.config.offset === 'function') {
offset.fn = function (data) { 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; return data;
}; };
} else { } else {
@@ -741,33 +802,33 @@
}; };
_proto._setListeners = function _setListeners() { _proto._setListeners = function _setListeners() {
var _this5 = this; var _this6 = this;
var triggers = this.config.trigger.split(' '); var triggers = this.config.trigger.split(' ');
triggers.forEach(function (trigger) { triggers.forEach(function (trigger) {
if (trigger === 'click') { if (trigger === 'click') {
EventHandler__default['default'].on(_this5.element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) { EventHandler__default['default'].on(_this6._element, _this6.constructor.Event.CLICK, _this6.config.selector, function (event) {
return _this5.toggle(event); return _this6.toggle(event);
}); });
} else if (trigger !== TRIGGER_MANUAL) { } else if (trigger !== TRIGGER_MANUAL) {
var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN; var eventIn = trigger === TRIGGER_HOVER ? _this6.constructor.Event.MOUSEENTER : _this6.constructor.Event.FOCUSIN;
var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT; var eventOut = trigger === TRIGGER_HOVER ? _this6.constructor.Event.MOUSELEAVE : _this6.constructor.Event.FOCUSOUT;
EventHandler__default['default'].on(_this5.element, eventIn, _this5.config.selector, function (event) { EventHandler__default['default'].on(_this6._element, eventIn, _this6.config.selector, function (event) {
return _this5._enter(event); return _this6._enter(event);
}); });
EventHandler__default['default'].on(_this5.element, eventOut, _this5.config.selector, function (event) { EventHandler__default['default'].on(_this6._element, eventOut, _this6.config.selector, function (event) {
return _this5._leave(event); return _this6._leave(event);
}); });
} }
}); });
this._hideModalHandler = function () { this._hideModalHandler = function () {
if (_this5.element) { if (_this6._element) {
_this5.hide(); _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) { if (this.config.selector) {
this.config = _extends({}, this.config, { this.config = _extends({}, this.config, {
@@ -780,12 +841,18 @@
}; };
_proto._fixTitle = function _fixTitle() { _proto._fixTitle = function _fixTitle() {
var title = this.element.getAttribute('title'); var title = this._element.getAttribute('title');
var originalTitleType = typeof this.element.getAttribute('data-bs-original-title');
var originalTitleType = typeof this._element.getAttribute('data-bs-original-title');
if (title || originalTitleType !== 'string') { if (title || originalTitleType !== 'string') {
this.element.setAttribute('data-bs-original-title', title || ''); this._element.setAttribute('data-bs-original-title', title || '');
this.element.setAttribute('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) { _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) { Object.keys(dataAttributes).forEach(function (dataAttr) {
if (DISALLOWED_ATTRIBUTES.has(dataAttr)) { if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
delete dataAttributes[dataAttr]; delete dataAttributes[dataAttr];
@@ -977,16 +1044,7 @@
}); });
}; };
Tooltip.getInstance = function getInstance(element) { _createClass$1(Tooltip, null, [{
return Data__default['default'].getData(element, DATA_KEY);
};
_createClass(Tooltip, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default", key: "Default",
get: function get() { get: function get() {
return Default; return Default;
@@ -1019,7 +1077,7 @@
}]); }]);
return Tooltip; return Tooltip;
}(); }(BaseComponent);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* jQuery * jQuery
+1 -1
View File
File diff suppressed because one or more lines are too long