release: 3.3.0

This commit is contained in:
Grzegorz 2021-02-22 10:25:02 +01:00
parent 8482ccd236
commit d336d92011
153 changed files with 3010 additions and 3150 deletions

View File

@ -1,5 +1,5 @@
MDB5 MDB5
Version: FREE 3.2.0 Version: FREE 3.3.0
Documentation: Documentation:
https://mdbootstrap.com/docs/standard/ https://mdbootstrap.com/docs/standard/

12
css/mdb.min.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

6
css/mdb.rtl.min.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,7 @@
<!-- MDB icon --> <!-- MDB icon -->
<link rel="icon" href="img/mdb-favicon.ico" type="image/x-icon" /> <link rel="icon" href="img/mdb-favicon.ico" type="image/x-icon" />
<!-- Font Awesome --> <!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.11.2/css/all.css" /> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.2/css/all.css" />
<!-- Google Fonts Roboto --> <!-- Google Fonts Roboto -->
<link <link
rel="stylesheet" rel="stylesheet"
@ -20,12 +20,12 @@
<body> <body>
<!-- Start your project here--> <!-- Start your project here-->
<div class="container"> <div class="container">
<div class="d-flex justify-content-center align-items-center" style="height: 100vh"> <div class="d-flex justify-content-center align-items-center" style="height: 100vh;">
<div class="text-center"> <div class="text-center">
<img <img
class="mb-4" class="mb-4"
src="https://mdbootstrap.com/img/logo/mdb-transparent-250px.png" src="https://mdbootstrap.com/img/logo/mdb-transparent-250px.png"
style="width: 250px; height: 90px" style="width: 250px; height: 90px;"
/> />
<h5 class="mb-3">Thank you for using our product. We're glad you're with us.</h5> <h5 class="mb-3">Thank you for using our product. We're glad you're with us.</h5>
<p class="mb-3">MDB Team</p> <p class="mb-3">MDB Team</p>

4
js/mdb.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "mdb-ui-kit", "name": "mdb-ui-kit",
"version": "3.2.0", "version": "3.3.0",
"main": "js/mdb.min.js", "main": "js/mdb.min.js",
"repository": "https://github.com/mdbootstrap/mdb-ui-kit.git", "repository": "https://github.com/mdbootstrap/mdb-ui-kit.git",
"author": "MDBootstrap", "author": "MDBootstrap",

View File

@ -1,16 +1,20 @@
/*! /*!
* Bootstrap alert.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap alert.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' typeof exports === 'object' && typeof module !== 'undefined'
? (module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'))) ? (module.exports = factory(
require('./dom/data.js'),
require('./dom/event-handler.js'),
require('./base-component.js')
))
: typeof define === 'function' && define.amd : typeof define === 'function' && define.amd
? define(['./dom/data', './dom/event-handler'], factory) ? define(['./dom/data', './dom/event-handler', './base-component'], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Alert = factory(global.Data, global.EventHandler))); (global.Alert = factory(global.Data, global.EventHandler, global.Base)));
})(this, function (Data, EventHandler) { })(this, function (Data, EventHandler, BaseComponent) {
'use strict'; 'use strict';
function _interopDefaultLegacy(e) { function _interopDefaultLegacy(e) {
@ -19,10 +23,45 @@
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data); var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler); var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
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 _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -33,7 +72,19 @@
var selector = element.getAttribute('data-bs-target'); var selector = element.getAttribute('data-bs-target');
if (!selector || selector === '#') { if (!selector || selector === '#') {
var hrefAttr = element.getAttribute('href'); var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
// `document.querySelector` will rightfully complain it is invalid.
// See https://github.com/twbs/bootstrap/issues/32273
if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {
return null;
} // Just in case some CMS puts out a full URL with the anchor appended
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1];
}
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
} }
@ -110,86 +161,26 @@
} }
}; };
var isRTL = document.documentElement.dir === 'rtl'; document.documentElement.dir === 'rtl';
function _defineProperties(target, props) { var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
for (var i = 0; i < props.length; i++) { onDOMContentLoaded(function () {
var descriptor = props[i]; var $ = getjQuery();
descriptor.enumerable = descriptor.enumerable || false; /* istanbul ignore if */
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) { if ($) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps); var JQUERY_NO_CONFLICT = $.fn[name];
if (staticProps) _defineProperties(Constructor, staticProps); $.fn[name] = plugin.jQueryInterface;
return Constructor; $.fn[name].Constructor = plugin;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var VERSION = '5.0.0-beta1'; $.fn[name].noConflict = function () {
$.fn[name] = JQUERY_NO_CONFLICT;
var BaseComponent = /*#__PURE__*/ (function () { return plugin.jQueryInterface;
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 * Constants
@ -204,9 +195,9 @@
var EVENT_CLOSE = 'close' + EVENT_KEY; var EVENT_CLOSE = 'close' + EVENT_KEY;
var EVENT_CLOSED = 'closed' + EVENT_KEY; var EVENT_CLOSED = 'closed' + EVENT_KEY;
var EVENT_CLICK_DATA_API = 'click' + EVENT_KEY + DATA_API_KEY; var EVENT_CLICK_DATA_API = 'click' + EVENT_KEY + DATA_API_KEY;
var CLASSNAME_ALERT = 'alert'; var CLASS_NAME_ALERT = 'alert';
var CLASSNAME_FADE = 'fade'; var CLASS_NAME_FADE = 'fade';
var CLASSNAME_SHOW = 'show'; var CLASS_NAME_SHOW = 'show';
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Class Definition * Class Definition
@ -236,7 +227,7 @@
}; // Private }; // Private
_proto._getRootElement = function _getRootElement(element) { _proto._getRootElement = function _getRootElement(element) {
return getElementFromSelector(element) || element.closest('.' + CLASSNAME_ALERT); return getElementFromSelector(element) || element.closest('.' + CLASS_NAME_ALERT);
}; };
_proto._triggerCloseEvent = function _triggerCloseEvent(element) { _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
@ -246,16 +237,16 @@
_proto._removeElement = function _removeElement(element) { _proto._removeElement = function _removeElement(element) {
var _this = this; var _this = this;
element.classList.remove(CLASSNAME_SHOW); element.classList.remove(CLASS_NAME_SHOW);
if (!element.classList.contains(CLASSNAME_FADE)) { if (!element.classList.contains(CLASS_NAME_FADE)) {
this._destroyElement(element); this._destroyElement(element);
return; return;
} }
var transitionDuration = getTransitionDurationFromElement(element); var transitionDuration = getTransitionDurationFromElement(element);
EventHandler__default['default'].one(element, TRANSITION_END, function () { EventHandler__default['default'].one(element, 'transitionend', function () {
return _this._destroyElement(element); return _this._destroyElement(element);
}); });
emulateTransitionEnd(element, transitionDuration); emulateTransitionEnd(element, transitionDuration);
@ -293,7 +284,7 @@
}; };
}; };
_createClass$1(Alert, null, [ _createClass(Alert, null, [
{ {
key: 'DATA_KEY', key: 'DATA_KEY',
// Getters // Getters
@ -304,7 +295,7 @@
]); ]);
return Alert; return Alert;
})(BaseComponent); })(BaseComponent__default['default']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
@ -324,21 +315,7 @@
* add .Alert to jQuery only if jQuery is present * add .Alert to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(function () { defineJQueryPlugin(NAME, Alert);
var $ = getjQuery();
/* istanbul ignore if */
if ($) {
var JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Alert.jQueryInterface;
$.fn[NAME].Constructor = Alert;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Alert.jQueryInterface;
};
}
});
return Alert; return Alert;
}); });

File diff suppressed because one or more lines are too long

82
src/js/bootstrap/dist/base-component.js vendored Normal file
View File

@ -0,0 +1,82 @@
/*!
* Bootstrap base-component.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined'
? (module.exports = factory(require('./dom/data.js')))
: typeof define === 'function' && define.amd
? define(['./dom/data'], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Base = factory(global.Data)));
})(this, function (Data) {
'use strict';
function _interopDefaultLegacy(e) {
return e && typeof e === 'object' && 'default' in e ? e : { default: e };
}
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
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;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var VERSION = '5.0.0-beta2';
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;
})();
return BaseComponent;
});
//# sourceMappingURL=base-component.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"base-component.js","sources":["../src/base-component.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta2): base-component.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Data from './dom/data'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst VERSION = '5.0.0-beta2'\n\nclass BaseComponent {\n constructor(element) {\n if (!element) {\n return\n }\n\n this._element = element\n Data.setData(element, this.constructor.DATA_KEY, this)\n }\n\n dispose() {\n Data.removeData(this._element, this.constructor.DATA_KEY)\n this._element = null\n }\n\n /** Static */\n\n static getInstance(element) {\n return Data.getData(element, this.DATA_KEY)\n }\n\n static get VERSION() {\n return VERSION\n }\n}\n\nexport default BaseComponent\n"],"names":["VERSION","BaseComponent","element","_element","Data","setData","constructor","DATA_KEY","dispose","removeData","getInstance","getData"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA;EACA;EACA;EACA;EACA;;EAEA,IAAMA,OAAO,GAAG,aAAhB;;MAEMC;EACJ,yBAAYC,OAAZ,EAAqB;EACnB,QAAI,CAACA,OAAL,EAAc;EACZ;EACD;;EAED,SAAKC,QAAL,GAAgBD,OAAhB;EACAE,IAAAA,wBAAI,CAACC,OAAL,CAAaH,OAAb,EAAsB,KAAKI,WAAL,CAAiBC,QAAvC,EAAiD,IAAjD;EACD;;;;WAEDC,UAAA,mBAAU;EACRJ,IAAAA,wBAAI,CAACK,UAAL,CAAgB,KAAKN,QAArB,EAA+B,KAAKG,WAAL,CAAiBC,QAAhD;EACA,SAAKJ,QAAL,GAAgB,IAAhB;EACD;EAED;;;kBAEOO,cAAP,qBAAmBR,OAAnB,EAA4B;EAC1B,WAAOE,wBAAI,CAACO,OAAL,CAAaT,OAAb,EAAsB,KAAKK,QAA3B,CAAP;EACD;;;;WAED,eAAqB;EACnB,aAAOP,OAAP;EACD;;;;;;;;;;;;"}

View File

@ -1,16 +1,20 @@
/*! /*!
* Bootstrap button.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap button.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' typeof exports === 'object' && typeof module !== 'undefined'
? (module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'))) ? (module.exports = factory(
require('./dom/data.js'),
require('./dom/event-handler.js'),
require('./base-component.js')
))
: typeof define === 'function' && define.amd : typeof define === 'function' && define.amd
? define(['./dom/data', './dom/event-handler'], factory) ? define(['./dom/data', './dom/event-handler', './base-component'], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Button = factory(global.Data, global.EventHandler))); (global.Button = factory(global.Data, global.EventHandler, global.Base)));
})(this, function (Data, EventHandler) { })(this, function (Data, EventHandler, BaseComponent) {
'use strict'; 'use strict';
function _interopDefaultLegacy(e) { function _interopDefaultLegacy(e) {
@ -19,10 +23,45 @@
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data); var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler); var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
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 _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -46,86 +85,26 @@
} }
}; };
var isRTL = document.documentElement.dir === 'rtl'; document.documentElement.dir === 'rtl';
function _defineProperties(target, props) { var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
for (var i = 0; i < props.length; i++) { onDOMContentLoaded(function () {
var descriptor = props[i]; var $ = getjQuery();
descriptor.enumerable = descriptor.enumerable || false; /* istanbul ignore if */
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) { if ($) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps); var JQUERY_NO_CONFLICT = $.fn[name];
if (staticProps) _defineProperties(Constructor, staticProps); $.fn[name] = plugin.jQueryInterface;
return Constructor; $.fn[name].Constructor = plugin;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var VERSION = '5.0.0-beta1'; $.fn[name].noConflict = function () {
$.fn[name] = JQUERY_NO_CONFLICT;
var BaseComponent = /*#__PURE__*/ (function () { return plugin.jQueryInterface;
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 * Constants
@ -174,7 +153,7 @@
}); });
}; };
_createClass$1(Button, null, [ _createClass(Button, null, [
{ {
key: 'DATA_KEY', key: 'DATA_KEY',
// Getters // Getters
@ -185,7 +164,7 @@
]); ]);
return Button; return Button;
})(BaseComponent); })(BaseComponent__default['default']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
@ -215,21 +194,7 @@
* add .Button to jQuery only if jQuery is present * add .Button to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(function () { defineJQueryPlugin(NAME, Button);
var $ = getjQuery();
/* istanbul ignore if */
if ($) {
var JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Button.jQueryInterface;
$.fn[NAME].Constructor = Button;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Button.jQueryInterface;
};
}
});
return Button; return Button;
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*! /*!
* Bootstrap carousel.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap carousel.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
@ -9,7 +9,8 @@
require('./dom/data.js'), require('./dom/data.js'),
require('./dom/event-handler.js'), require('./dom/event-handler.js'),
require('./dom/manipulator.js'), require('./dom/manipulator.js'),
require('./dom/selector-engine.js') require('./dom/selector-engine.js'),
require('./base-component.js')
)) ))
: typeof define === 'function' && define.amd : typeof define === 'function' && define.amd
? define([ ? define([
@ -17,15 +18,17 @@
'./dom/event-handler', './dom/event-handler',
'./dom/manipulator', './dom/manipulator',
'./dom/selector-engine', './dom/selector-engine',
'./base-component',
], factory) ], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Carousel = factory( (global.Carousel = factory(
global.Data, global.Data,
global.EventHandler, global.EventHandler,
global.Manipulator, global.Manipulator,
global.SelectorEngine global.SelectorEngine,
global.Base
))); )));
})(this, function (Data, EventHandler, Manipulator, SelectorEngine) { })(this, function (Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) {
'use strict'; 'use strict';
function _interopDefaultLegacy(e) { function _interopDefaultLegacy(e) {
@ -36,10 +39,65 @@
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler); var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator); var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine); var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
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 _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 _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -61,7 +119,19 @@
var selector = element.getAttribute('data-bs-target'); var selector = element.getAttribute('data-bs-target');
if (!selector || selector === '#') { if (!selector || selector === '#') {
var hrefAttr = element.getAttribute('href'); var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
// `document.querySelector` will rightfully complain it is invalid.
// See https://github.com/twbs/bootstrap/issues/32273
if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {
return null;
} // Just in case some CMS puts out a full URL with the anchor appended
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1];
}
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
} }
@ -130,7 +200,7 @@
var valueType = value && isElement(value) ? 'element' : toType(value); var valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error( throw new TypeError(
componentName.toUpperCase() + componentName.toUpperCase() +
': ' + ': ' +
('Option "' + property + '" provided type "' + valueType + '" ') + ('Option "' + property + '" provided type "' + valueType + '" ') +
@ -183,101 +253,24 @@
var isRTL = document.documentElement.dir === 'rtl'; var isRTL = document.documentElement.dir === 'rtl';
function _defineProperties(target, props) { var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
for (var i = 0; i < props.length; i++) { onDOMContentLoaded(function () {
var descriptor = props[i]; var $ = getjQuery();
descriptor.enumerable = descriptor.enumerable || false; /* istanbul ignore if */
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) { if ($) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps); var JQUERY_NO_CONFLICT = $.fn[name];
if (staticProps) _defineProperties(Constructor, staticProps); $.fn[name] = plugin.jQueryInterface;
return Constructor; $.fn[name].Constructor = plugin;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var VERSION = '5.0.0-beta1'; $.fn[name].noConflict = function () {
$.fn[name] = JQUERY_NO_CONFLICT;
var BaseComponent = /*#__PURE__*/ (function () { return plugin.jQueryInterface;
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 * Constants
@ -340,12 +333,11 @@
var SELECTOR_ITEM_IMG = '.carousel-item img'; var SELECTOR_ITEM_IMG = '.carousel-item img';
var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
var SELECTOR_INDICATORS = '.carousel-indicators'; var SELECTOR_INDICATORS = '.carousel-indicators';
var SELECTOR_INDICATOR = '[data-bs-target]';
var SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'; var SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'; var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
var PointerType = { var POINTER_TYPE_TOUCH = 'touch';
TOUCH: 'touch', var POINTER_TYPE_PEN = 'pen';
PEN: 'pen',
};
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Class Definition * Class Definition
@ -500,12 +492,20 @@
this.touchDeltaX = 0; // swipe left this.touchDeltaX = 0; // swipe left
if (direction > 0) { if (direction > 0) {
if (isRTL) {
this.next();
} else {
this.prev(); this.prev();
}
} // swipe right } // swipe right
if (direction < 0) { if (direction < 0) {
if (isRTL) {
this.prev();
} else {
this.next(); this.next();
} }
}
}; };
_proto._addEventListeners = function _addEventListeners() { _proto._addEventListeners = function _addEventListeners() {
@ -535,7 +535,10 @@
var _this4 = this; var _this4 = this;
var start = function start(event) { var start = function start(event) {
if (_this4._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { if (
_this4._pointerEvent &&
(event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)
) {
_this4.touchStartX = event.clientX; _this4.touchStartX = event.clientX;
} else if (!_this4._pointerEvent) { } else if (!_this4._pointerEvent) {
_this4.touchStartX = event.touches[0].clientX; _this4.touchStartX = event.touches[0].clientX;
@ -552,7 +555,10 @@
}; };
var end = function end(event) { var end = function end(event) {
if (_this4._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { if (
_this4._pointerEvent &&
(event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)
) {
_this4.touchDeltaX = event.clientX - _this4.touchStartX; _this4.touchDeltaX = event.clientX - _this4.touchStartX;
} }
@ -613,16 +619,22 @@
return; return;
} }
switch (event.key) { if (event.key === ARROW_LEFT_KEY) {
case ARROW_LEFT_KEY:
event.preventDefault(); event.preventDefault();
this.prev();
break;
case ARROW_RIGHT_KEY: if (isRTL) {
event.preventDefault();
this.next(); this.next();
break; } else {
this.prev();
}
} else if (event.key === ARROW_RIGHT_KEY) {
event.preventDefault();
if (isRTL) {
this.prev();
} else {
this.next();
}
} }
}; };
@ -671,19 +683,26 @@
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
if (this._indicatorsElement) { if (this._indicatorsElement) {
var indicators = SelectorEngine__default['default'].find( var activeIndicator = SelectorEngine__default['default'].findOne(
SELECTOR_ACTIVE, SELECTOR_ACTIVE,
this._indicatorsElement this._indicatorsElement
); );
activeIndicator.classList.remove(CLASS_NAME_ACTIVE);
activeIndicator.removeAttribute('aria-current');
var indicators = SelectorEngine__default['default'].find(
SELECTOR_INDICATOR,
this._indicatorsElement
);
for (var i = 0; i < indicators.length; i++) { for (var i = 0; i < indicators.length; i++) {
indicators[i].classList.remove(CLASS_NAME_ACTIVE); if (
Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) ===
this._getItemIndex(element)
) {
indicators[i].classList.add(CLASS_NAME_ACTIVE);
indicators[i].setAttribute('aria-current', 'true');
break;
} }
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
if (nextIndicator) {
nextIndicator.classList.add(CLASS_NAME_ACTIVE);
} }
} }
}; };
@ -723,19 +742,9 @@
var nextElementIndex = this._getItemIndex(nextElement); var nextElementIndex = this._getItemIndex(nextElement);
var isCycling = Boolean(this._interval); var isCycling = Boolean(this._interval);
var directionalClassName; var directionalClassName = direction === DIRECTION_NEXT ? CLASS_NAME_START : CLASS_NAME_END;
var orderClassName; var orderClassName = direction === DIRECTION_NEXT ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
var eventDirectionName; var eventDirectionName = direction === DIRECTION_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT;
if (direction === DIRECTION_NEXT) {
directionalClassName = CLASS_NAME_START;
orderClassName = CLASS_NAME_NEXT;
eventDirectionName = DIRECTION_LEFT;
} else {
directionalClassName = CLASS_NAME_END;
orderClassName = CLASS_NAME_PREV;
eventDirectionName = DIRECTION_RIGHT;
}
if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) { if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {
this._isSliding = false; this._isSliding = false;
@ -769,7 +778,7 @@
activeElement.classList.add(directionalClassName); activeElement.classList.add(directionalClassName);
nextElement.classList.add(directionalClassName); nextElement.classList.add(directionalClassName);
var transitionDuration = getTransitionDurationFromElement(activeElement); var transitionDuration = getTransitionDurationFromElement(activeElement);
EventHandler__default['default'].one(activeElement, TRANSITION_END, function () { EventHandler__default['default'].one(activeElement, 'transitionend', function () {
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);
@ -868,7 +877,7 @@
event.preventDefault(); event.preventDefault();
}; };
_createClass$1(Carousel, null, [ _createClass(Carousel, null, [
{ {
key: 'Default', key: 'Default',
get: function get() { get: function get() {
@ -884,7 +893,7 @@
]); ]);
return Carousel; return Carousel;
})(BaseComponent); })(BaseComponent__default['default']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
@ -914,21 +923,7 @@
* add .Carousel to jQuery only if jQuery is present * add .Carousel to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(function () { defineJQueryPlugin(NAME, Carousel);
var $ = getjQuery();
/* istanbul ignore if */
if ($) {
var JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Carousel.jQueryInterface;
$.fn[NAME].Constructor = Carousel;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Carousel.jQueryInterface;
};
}
});
return Carousel; return Carousel;
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*! /*!
* Bootstrap collapse.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap collapse.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
@ -9,7 +9,8 @@
require('./dom/data.js'), require('./dom/data.js'),
require('./dom/event-handler.js'), require('./dom/event-handler.js'),
require('./dom/manipulator.js'), require('./dom/manipulator.js'),
require('./dom/selector-engine.js') require('./dom/selector-engine.js'),
require('./base-component.js')
)) ))
: typeof define === 'function' && define.amd : typeof define === 'function' && define.amd
? define([ ? define([
@ -17,15 +18,17 @@
'./dom/event-handler', './dom/event-handler',
'./dom/manipulator', './dom/manipulator',
'./dom/selector-engine', './dom/selector-engine',
'./base-component',
], factory) ], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Collapse = factory( (global.Collapse = factory(
global.Data, global.Data,
global.EventHandler, global.EventHandler,
global.Manipulator, global.Manipulator,
global.SelectorEngine global.SelectorEngine,
global.Base
))); )));
})(this, function (Data, EventHandler, Manipulator, SelectorEngine) { })(this, function (Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) {
'use strict'; 'use strict';
function _interopDefaultLegacy(e) { function _interopDefaultLegacy(e) {
@ -36,10 +39,65 @@
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler); var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator); var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine); var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
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 _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 _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -61,7 +119,19 @@
var selector = element.getAttribute('data-bs-target'); var selector = element.getAttribute('data-bs-target');
if (!selector || selector === '#') { if (!selector || selector === '#') {
var hrefAttr = element.getAttribute('href'); var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
// `document.querySelector` will rightfully complain it is invalid.
// See https://github.com/twbs/bootstrap/issues/32273
if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {
return null;
} // Just in case some CMS puts out a full URL with the anchor appended
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1];
}
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
} }
@ -140,7 +210,7 @@
var valueType = value && isElement(value) ? 'element' : toType(value); var valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error( throw new TypeError(
componentName.toUpperCase() + componentName.toUpperCase() +
': ' + ': ' +
('Option "' + property + '" provided type "' + valueType + '" ') + ('Option "' + property + '" provided type "' + valueType + '" ') +
@ -173,103 +243,26 @@
} }
}; };
var isRTL = document.documentElement.dir === 'rtl'; document.documentElement.dir === 'rtl';
function _defineProperties(target, props) { var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
for (var i = 0; i < props.length; i++) { onDOMContentLoaded(function () {
var descriptor = props[i]; var $ = getjQuery();
descriptor.enumerable = descriptor.enumerable || false; /* istanbul ignore if */
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) { if ($) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps); var JQUERY_NO_CONFLICT = $.fn[name];
if (staticProps) _defineProperties(Constructor, staticProps); $.fn[name] = plugin.jQueryInterface;
return Constructor; $.fn[name].Constructor = plugin;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var VERSION = '5.0.0-beta1'; $.fn[name].noConflict = function () {
$.fn[name] = JQUERY_NO_CONFLICT;
var BaseComponent = /*#__PURE__*/ (function () { return plugin.jQueryInterface;
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 * Constants
@ -456,7 +449,7 @@
var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
var scrollSize = 'scroll' + capitalizedDimension; var scrollSize = 'scroll' + capitalizedDimension;
var transitionDuration = getTransitionDurationFromElement(this._element); var transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, TRANSITION_END, complete); EventHandler__default['default'].one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
this._element.style[dimension] = this._element[scrollSize] + 'px'; this._element.style[dimension] = this._element[scrollSize] + 'px';
}; };
@ -511,7 +504,7 @@
this._element.style[dimension] = ''; this._element.style[dimension] = '';
var transitionDuration = getTransitionDurationFromElement(this._element); var transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, TRANSITION_END, complete); EventHandler__default['default'].one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
}; };
@ -613,7 +606,7 @@
}); });
}; };
_createClass$1(Collapse, null, [ _createClass(Collapse, null, [
{ {
key: 'Default', key: 'Default',
get: function get() { get: function get() {
@ -629,7 +622,7 @@
]); ]);
return Collapse; return Collapse;
})(BaseComponent); })(BaseComponent__default['default']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
@ -642,7 +635,10 @@
SELECTOR_DATA_TOGGLE, SELECTOR_DATA_TOGGLE,
function (event) { function (event) {
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
if (event.target.tagName === 'A') { if (
event.target.tagName === 'A' ||
(event.delegateTarget && event.delegateTarget.tagName === 'A')
) {
event.preventDefault(); event.preventDefault();
} }
@ -676,21 +672,7 @@
* add .Collapse to jQuery only if jQuery is present * add .Collapse to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(function () { defineJQueryPlugin(NAME, Collapse);
var $ = getjQuery();
/* istanbul ignore if */
if ($) {
var JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Collapse.jQueryInterface;
$.fn[NAME].Constructor = Collapse;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Collapse.jQueryInterface;
};
}
});
return Collapse; return Collapse;
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*! /*!
* Bootstrap data.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap data.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
@ -15,7 +15,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/data.js * Bootstrap (v5.0.0-beta2): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1 +1 @@
{"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta1): dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst mapData = (() => {\n const storeData = {}\n let id = 1\n return {\n set(element, key, data) {\n if (typeof element.bsKey === 'undefined') {\n element.bsKey = {\n key,\n id\n }\n id++\n }\n\n storeData[element.bsKey.id] = data\n },\n get(element, key) {\n if (!element || typeof element.bsKey === 'undefined') {\n return null\n }\n\n const keyProperties = element.bsKey\n if (keyProperties.key === key) {\n return storeData[keyProperties.id]\n }\n\n return null\n },\n delete(element, key) {\n if (typeof element.bsKey === 'undefined') {\n return\n }\n\n const keyProperties = element.bsKey\n if (keyProperties.key === key) {\n delete storeData[keyProperties.id]\n delete element.bsKey\n }\n }\n }\n})()\n\nconst Data = {\n setData(instance, key, data) {\n mapData.set(instance, key, data)\n },\n getData(instance, key) {\n return mapData.get(instance, key)\n },\n removeData(instance, key) {\n mapData.delete(instance, key)\n }\n}\n\nexport default Data\n"],"names":["mapData","storeData","id","set","element","key","data","bsKey","get","keyProperties","delete","Data","setData","instance","getData","removeData"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,IAAMA,OAAO,GAAI,YAAM;EACrB,MAAMC,SAAS,GAAG,EAAlB;EACA,MAAIC,EAAE,GAAG,CAAT;EACA,SAAO;EACLC,IAAAA,GADK,eACDC,OADC,EACQC,GADR,EACaC,IADb,EACmB;EACtB,UAAI,OAAOF,OAAO,CAACG,KAAf,KAAyB,WAA7B,EAA0C;EACxCH,QAAAA,OAAO,CAACG,KAAR,GAAgB;EACdF,UAAAA,GAAG,EAAHA,GADc;EAEdH,UAAAA,EAAE,EAAFA;EAFc,SAAhB;EAIAA,QAAAA,EAAE;EACH;;EAEDD,MAAAA,SAAS,CAACG,OAAO,CAACG,KAAR,CAAcL,EAAf,CAAT,GAA8BI,IAA9B;EACD,KAXI;EAYLE,IAAAA,GAZK,eAYDJ,OAZC,EAYQC,GAZR,EAYa;EAChB,UAAI,CAACD,OAAD,IAAY,OAAOA,OAAO,CAACG,KAAf,KAAyB,WAAzC,EAAsD;EACpD,eAAO,IAAP;EACD;;EAED,UAAME,aAAa,GAAGL,OAAO,CAACG,KAA9B;;EACA,UAAIE,aAAa,CAACJ,GAAd,KAAsBA,GAA1B,EAA+B;EAC7B,eAAOJ,SAAS,CAACQ,aAAa,CAACP,EAAf,CAAhB;EACD;;EAED,aAAO,IAAP;EACD,KAvBI;EAwBLQ,IAAAA,MAxBK,mBAwBEN,OAxBF,EAwBWC,GAxBX,EAwBgB;EACnB,UAAI,OAAOD,OAAO,CAACG,KAAf,KAAyB,WAA7B,EAA0C;EACxC;EACD;;EAED,UAAME,aAAa,GAAGL,OAAO,CAACG,KAA9B;;EACA,UAAIE,aAAa,CAACJ,GAAd,KAAsBA,GAA1B,EAA+B;EAC7B,eAAOJ,SAAS,CAACQ,aAAa,CAACP,EAAf,CAAhB;EACA,eAAOE,OAAO,CAACG,KAAf;EACD;EACF;EAlCI,GAAP;EAoCD,CAvCe,EAAhB;;MAyCMI,IAAI,GAAG;EACXC,EAAAA,OADW,mBACHC,QADG,EACOR,GADP,EACYC,IADZ,EACkB;EAC3BN,IAAAA,OAAO,CAACG,GAAR,CAAYU,QAAZ,EAAsBR,GAAtB,EAA2BC,IAA3B;EACD,GAHU;EAIXQ,EAAAA,OAJW,mBAIHD,QAJG,EAIOR,GAJP,EAIY;EACrB,WAAOL,OAAO,CAACQ,GAAR,CAAYK,QAAZ,EAAsBR,GAAtB,CAAP;EACD,GANU;EAOXU,EAAAA,UAPW,sBAOAF,QAPA,EAOUR,GAPV,EAOe;EACxBL,IAAAA,OAAO,CAACU,MAAR,CAAeG,QAAf,EAAyBR,GAAzB;EACD;EATU;;;;;;;;"} {"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta2): dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst mapData = (() => {\n const storeData = {}\n let id = 1\n return {\n set(element, key, data) {\n if (typeof element.bsKey === 'undefined') {\n element.bsKey = {\n key,\n id\n }\n id++\n }\n\n storeData[element.bsKey.id] = data\n },\n get(element, key) {\n if (!element || typeof element.bsKey === 'undefined') {\n return null\n }\n\n const keyProperties = element.bsKey\n if (keyProperties.key === key) {\n return storeData[keyProperties.id]\n }\n\n return null\n },\n delete(element, key) {\n if (typeof element.bsKey === 'undefined') {\n return\n }\n\n const keyProperties = element.bsKey\n if (keyProperties.key === key) {\n delete storeData[keyProperties.id]\n delete element.bsKey\n }\n }\n }\n})()\n\nconst Data = {\n setData(instance, key, data) {\n mapData.set(instance, key, data)\n },\n getData(instance, key) {\n return mapData.get(instance, key)\n },\n removeData(instance, key) {\n mapData.delete(instance, key)\n }\n}\n\nexport default Data\n"],"names":["mapData","storeData","id","set","element","key","data","bsKey","get","keyProperties","delete","Data","setData","instance","getData","removeData"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,IAAMA,OAAO,GAAI,YAAM;EACrB,MAAMC,SAAS,GAAG,EAAlB;EACA,MAAIC,EAAE,GAAG,CAAT;EACA,SAAO;EACLC,IAAAA,GADK,eACDC,OADC,EACQC,GADR,EACaC,IADb,EACmB;EACtB,UAAI,OAAOF,OAAO,CAACG,KAAf,KAAyB,WAA7B,EAA0C;EACxCH,QAAAA,OAAO,CAACG,KAAR,GAAgB;EACdF,UAAAA,GAAG,EAAHA,GADc;EAEdH,UAAAA,EAAE,EAAFA;EAFc,SAAhB;EAIAA,QAAAA,EAAE;EACH;;EAEDD,MAAAA,SAAS,CAACG,OAAO,CAACG,KAAR,CAAcL,EAAf,CAAT,GAA8BI,IAA9B;EACD,KAXI;EAYLE,IAAAA,GAZK,eAYDJ,OAZC,EAYQC,GAZR,EAYa;EAChB,UAAI,CAACD,OAAD,IAAY,OAAOA,OAAO,CAACG,KAAf,KAAyB,WAAzC,EAAsD;EACpD,eAAO,IAAP;EACD;;EAED,UAAME,aAAa,GAAGL,OAAO,CAACG,KAA9B;;EACA,UAAIE,aAAa,CAACJ,GAAd,KAAsBA,GAA1B,EAA+B;EAC7B,eAAOJ,SAAS,CAACQ,aAAa,CAACP,EAAf,CAAhB;EACD;;EAED,aAAO,IAAP;EACD,KAvBI;EAwBLQ,IAAAA,MAxBK,mBAwBEN,OAxBF,EAwBWC,GAxBX,EAwBgB;EACnB,UAAI,OAAOD,OAAO,CAACG,KAAf,KAAyB,WAA7B,EAA0C;EACxC;EACD;;EAED,UAAME,aAAa,GAAGL,OAAO,CAACG,KAA9B;;EACA,UAAIE,aAAa,CAACJ,GAAd,KAAsBA,GAA1B,EAA+B;EAC7B,eAAOJ,SAAS,CAACQ,aAAa,CAACP,EAAf,CAAhB;EACA,eAAOE,OAAO,CAACG,KAAf;EACD;EACF;EAlCI,GAAP;EAoCD,CAvCe,EAAhB;;MAyCMI,IAAI,GAAG;EACXC,EAAAA,OADW,mBACHC,QADG,EACOR,GADP,EACYC,IADZ,EACkB;EAC3BN,IAAAA,OAAO,CAACG,GAAR,CAAYU,QAAZ,EAAsBR,GAAtB,EAA2BC,IAA3B;EACD,GAHU;EAIXQ,EAAAA,OAJW,mBAIHD,QAJG,EAIOR,GAJP,EAIY;EACrB,WAAOL,OAAO,CAACQ,GAAR,CAAYK,QAAZ,EAAsBR,GAAtB,CAAP;EACD,GANU;EAOXU,EAAAA,UAPW,sBAOAF,QAPA,EAOUR,GAPV,EAOe;EACxBL,IAAAA,OAAO,CAACU,MAAR,CAAeG,QAAf,EAAyBR,GAAzB;EACD;EATU;;;;;;;;"}

View File

@ -1,6 +1,6 @@
/*! /*!
* Bootstrap event-handler.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap event-handler.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
@ -15,7 +15,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -31,11 +31,11 @@
return null; return null;
}; };
var isRTL = document.documentElement.dir === 'rtl'; document.documentElement.dir === 'rtl';
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/event-handler.js * Bootstrap (v5.0.0-beta2): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -142,6 +142,7 @@
event.delegateTarget = target; event.delegateTarget = target;
if (handler.oneOff) { if (handler.oneOff) {
// eslint-disable-next-line unicorn/consistent-destructuring
EventHandler.off(element, event.type, fn); EventHandler.off(element, event.type, fn);
} }

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*! /*!
* Bootstrap manipulator.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap manipulator.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
@ -15,7 +15,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/manipulator.js * Bootstrap (v5.0.0-beta2): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1 +1 @@
{"version":3,"file":"manipulator.js","sources":["../../src/dom/manipulator.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta1): dom/manipulator.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nfunction normalizeData(val) {\n if (val === 'true') {\n return true\n }\n\n if (val === 'false') {\n return false\n }\n\n if (val === Number(val).toString()) {\n return Number(val)\n }\n\n if (val === '' || val === 'null') {\n return null\n }\n\n return val\n}\n\nfunction normalizeDataKey(key) {\n return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`)\n}\n\nconst Manipulator = {\n setDataAttribute(element, key, value) {\n element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value)\n },\n\n removeDataAttribute(element, key) {\n element.removeAttribute(`data-bs-${normalizeDataKey(key)}`)\n },\n\n getDataAttributes(element) {\n if (!element) {\n return {}\n }\n\n const attributes = {}\n\n Object.keys(element.dataset)\n .filter(key => key.startsWith('bs'))\n .forEach(key => {\n let pureKey = key.replace(/^bs/, '')\n pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length)\n attributes[pureKey] = normalizeData(element.dataset[key])\n })\n\n return attributes\n },\n\n getDataAttribute(element, key) {\n return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`))\n },\n\n offset(element) {\n const rect = element.getBoundingClientRect()\n\n return {\n top: rect.top + document.body.scrollTop,\n left: rect.left + document.body.scrollLeft\n }\n },\n\n position(element) {\n return {\n top: element.offsetTop,\n left: element.offsetLeft\n }\n }\n}\n\nexport default Manipulator\n"],"names":["normalizeData","val","Number","toString","normalizeDataKey","key","replace","chr","toLowerCase","Manipulator","setDataAttribute","element","value","setAttribute","removeDataAttribute","removeAttribute","getDataAttributes","attributes","Object","keys","dataset","filter","startsWith","forEach","pureKey","charAt","slice","length","getDataAttribute","getAttribute","offset","rect","getBoundingClientRect","top","document","body","scrollTop","left","scrollLeft","position","offsetTop","offsetLeft"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EAEA,SAASA,aAAT,CAAuBC,GAAvB,EAA4B;EAC1B,MAAIA,GAAG,KAAK,MAAZ,EAAoB;EAClB,WAAO,IAAP;EACD;;EAED,MAAIA,GAAG,KAAK,OAAZ,EAAqB;EACnB,WAAO,KAAP;EACD;;EAED,MAAIA,GAAG,KAAKC,MAAM,CAACD,GAAD,CAAN,CAAYE,QAAZ,EAAZ,EAAoC;EAClC,WAAOD,MAAM,CAACD,GAAD,CAAb;EACD;;EAED,MAAIA,GAAG,KAAK,EAAR,IAAcA,GAAG,KAAK,MAA1B,EAAkC;EAChC,WAAO,IAAP;EACD;;EAED,SAAOA,GAAP;EACD;;EAED,SAASG,gBAAT,CAA0BC,GAA1B,EAA+B;EAC7B,SAAOA,GAAG,CAACC,OAAJ,CAAY,QAAZ,EAAsB,UAAAC,GAAG;EAAA,iBAAQA,GAAG,CAACC,WAAJ,EAAR;EAAA,GAAzB,CAAP;EACD;;MAEKC,WAAW,GAAG;EAClBC,EAAAA,gBADkB,4BACDC,OADC,EACQN,GADR,EACaO,KADb,EACoB;EACpCD,IAAAA,OAAO,CAACE,YAAR,cAAgCT,gBAAgB,CAACC,GAAD,CAAhD,EAAyDO,KAAzD;EACD,GAHiB;EAKlBE,EAAAA,mBALkB,+BAKEH,OALF,EAKWN,GALX,EAKgB;EAChCM,IAAAA,OAAO,CAACI,eAAR,cAAmCX,gBAAgB,CAACC,GAAD,CAAnD;EACD,GAPiB;EASlBW,EAAAA,iBATkB,6BASAL,OATA,EASS;EACzB,QAAI,CAACA,OAAL,EAAc;EACZ,aAAO,EAAP;EACD;;EAED,QAAMM,UAAU,GAAG,EAAnB;EAEAC,IAAAA,MAAM,CAACC,IAAP,CAAYR,OAAO,CAACS,OAApB,EACGC,MADH,CACU,UAAAhB,GAAG;EAAA,aAAIA,GAAG,CAACiB,UAAJ,CAAe,IAAf,CAAJ;EAAA,KADb,EAEGC,OAFH,CAEW,UAAAlB,GAAG,EAAI;EACd,UAAImB,OAAO,GAAGnB,GAAG,CAACC,OAAJ,CAAY,KAAZ,EAAmB,EAAnB,CAAd;EACAkB,MAAAA,OAAO,GAAGA,OAAO,CAACC,MAAR,CAAe,CAAf,EAAkBjB,WAAlB,KAAkCgB,OAAO,CAACE,KAAR,CAAc,CAAd,EAAiBF,OAAO,CAACG,MAAzB,CAA5C;EACAV,MAAAA,UAAU,CAACO,OAAD,CAAV,GAAsBxB,aAAa,CAACW,OAAO,CAACS,OAAR,CAAgBf,GAAhB,CAAD,CAAnC;EACD,KANH;EAQA,WAAOY,UAAP;EACD,GAzBiB;EA2BlBW,EAAAA,gBA3BkB,4BA2BDjB,OA3BC,EA2BQN,GA3BR,EA2Ba;EAC7B,WAAOL,aAAa,CAACW,OAAO,CAACkB,YAAR,cAAgCzB,gBAAgB,CAACC,GAAD,CAAhD,CAAD,CAApB;EACD,GA7BiB;EA+BlByB,EAAAA,MA/BkB,kBA+BXnB,OA/BW,EA+BF;EACd,QAAMoB,IAAI,GAAGpB,OAAO,CAACqB,qBAAR,EAAb;EAEA,WAAO;EACLC,MAAAA,GAAG,EAAEF,IAAI,CAACE,GAAL,GAAWC,QAAQ,CAACC,IAAT,CAAcC,SADzB;EAELC,MAAAA,IAAI,EAAEN,IAAI,CAACM,IAAL,GAAYH,QAAQ,CAACC,IAAT,CAAcG;EAF3B,KAAP;EAID,GAtCiB;EAwClBC,EAAAA,QAxCkB,oBAwCT5B,OAxCS,EAwCA;EAChB,WAAO;EACLsB,MAAAA,GAAG,EAAEtB,OAAO,CAAC6B,SADR;EAELH,MAAAA,IAAI,EAAE1B,OAAO,CAAC8B;EAFT,KAAP;EAID;EA7CiB;;;;;;;;"} {"version":3,"file":"manipulator.js","sources":["../../src/dom/manipulator.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta2): dom/manipulator.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nfunction normalizeData(val) {\n if (val === 'true') {\n return true\n }\n\n if (val === 'false') {\n return false\n }\n\n if (val === Number(val).toString()) {\n return Number(val)\n }\n\n if (val === '' || val === 'null') {\n return null\n }\n\n return val\n}\n\nfunction normalizeDataKey(key) {\n return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`)\n}\n\nconst Manipulator = {\n setDataAttribute(element, key, value) {\n element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value)\n },\n\n removeDataAttribute(element, key) {\n element.removeAttribute(`data-bs-${normalizeDataKey(key)}`)\n },\n\n getDataAttributes(element) {\n if (!element) {\n return {}\n }\n\n const attributes = {}\n\n Object.keys(element.dataset)\n .filter(key => key.startsWith('bs'))\n .forEach(key => {\n let pureKey = key.replace(/^bs/, '')\n pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length)\n attributes[pureKey] = normalizeData(element.dataset[key])\n })\n\n return attributes\n },\n\n getDataAttribute(element, key) {\n return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`))\n },\n\n offset(element) {\n const rect = element.getBoundingClientRect()\n\n return {\n top: rect.top + document.body.scrollTop,\n left: rect.left + document.body.scrollLeft\n }\n },\n\n position(element) {\n return {\n top: element.offsetTop,\n left: element.offsetLeft\n }\n }\n}\n\nexport default Manipulator\n"],"names":["normalizeData","val","Number","toString","normalizeDataKey","key","replace","chr","toLowerCase","Manipulator","setDataAttribute","element","value","setAttribute","removeDataAttribute","removeAttribute","getDataAttributes","attributes","Object","keys","dataset","filter","startsWith","forEach","pureKey","charAt","slice","length","getDataAttribute","getAttribute","offset","rect","getBoundingClientRect","top","document","body","scrollTop","left","scrollLeft","position","offsetTop","offsetLeft"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EAEA,SAASA,aAAT,CAAuBC,GAAvB,EAA4B;EAC1B,MAAIA,GAAG,KAAK,MAAZ,EAAoB;EAClB,WAAO,IAAP;EACD;;EAED,MAAIA,GAAG,KAAK,OAAZ,EAAqB;EACnB,WAAO,KAAP;EACD;;EAED,MAAIA,GAAG,KAAKC,MAAM,CAACD,GAAD,CAAN,CAAYE,QAAZ,EAAZ,EAAoC;EAClC,WAAOD,MAAM,CAACD,GAAD,CAAb;EACD;;EAED,MAAIA,GAAG,KAAK,EAAR,IAAcA,GAAG,KAAK,MAA1B,EAAkC;EAChC,WAAO,IAAP;EACD;;EAED,SAAOA,GAAP;EACD;;EAED,SAASG,gBAAT,CAA0BC,GAA1B,EAA+B;EAC7B,SAAOA,GAAG,CAACC,OAAJ,CAAY,QAAZ,EAAsB,UAAAC,GAAG;EAAA,iBAAQA,GAAG,CAACC,WAAJ,EAAR;EAAA,GAAzB,CAAP;EACD;;MAEKC,WAAW,GAAG;EAClBC,EAAAA,gBADkB,4BACDC,OADC,EACQN,GADR,EACaO,KADb,EACoB;EACpCD,IAAAA,OAAO,CAACE,YAAR,cAAgCT,gBAAgB,CAACC,GAAD,CAAhD,EAAyDO,KAAzD;EACD,GAHiB;EAKlBE,EAAAA,mBALkB,+BAKEH,OALF,EAKWN,GALX,EAKgB;EAChCM,IAAAA,OAAO,CAACI,eAAR,cAAmCX,gBAAgB,CAACC,GAAD,CAAnD;EACD,GAPiB;EASlBW,EAAAA,iBATkB,6BASAL,OATA,EASS;EACzB,QAAI,CAACA,OAAL,EAAc;EACZ,aAAO,EAAP;EACD;;EAED,QAAMM,UAAU,GAAG,EAAnB;EAEAC,IAAAA,MAAM,CAACC,IAAP,CAAYR,OAAO,CAACS,OAApB,EACGC,MADH,CACU,UAAAhB,GAAG;EAAA,aAAIA,GAAG,CAACiB,UAAJ,CAAe,IAAf,CAAJ;EAAA,KADb,EAEGC,OAFH,CAEW,UAAAlB,GAAG,EAAI;EACd,UAAImB,OAAO,GAAGnB,GAAG,CAACC,OAAJ,CAAY,KAAZ,EAAmB,EAAnB,CAAd;EACAkB,MAAAA,OAAO,GAAGA,OAAO,CAACC,MAAR,CAAe,CAAf,EAAkBjB,WAAlB,KAAkCgB,OAAO,CAACE,KAAR,CAAc,CAAd,EAAiBF,OAAO,CAACG,MAAzB,CAA5C;EACAV,MAAAA,UAAU,CAACO,OAAD,CAAV,GAAsBxB,aAAa,CAACW,OAAO,CAACS,OAAR,CAAgBf,GAAhB,CAAD,CAAnC;EACD,KANH;EAQA,WAAOY,UAAP;EACD,GAzBiB;EA2BlBW,EAAAA,gBA3BkB,4BA2BDjB,OA3BC,EA2BQN,GA3BR,EA2Ba;EAC7B,WAAOL,aAAa,CAACW,OAAO,CAACkB,YAAR,cAAgCzB,gBAAgB,CAACC,GAAD,CAAhD,CAAD,CAApB;EACD,GA7BiB;EA+BlByB,EAAAA,MA/BkB,kBA+BXnB,OA/BW,EA+BF;EACd,QAAMoB,IAAI,GAAGpB,OAAO,CAACqB,qBAAR,EAAb;EAEA,WAAO;EACLC,MAAAA,GAAG,EAAEF,IAAI,CAACE,GAAL,GAAWC,QAAQ,CAACC,IAAT,CAAcC,SADzB;EAELC,MAAAA,IAAI,EAAEN,IAAI,CAACM,IAAL,GAAYH,QAAQ,CAACC,IAAT,CAAcG;EAF3B,KAAP;EAID,GAtCiB;EAwClBC,EAAAA,QAxCkB,oBAwCT5B,OAxCS,EAwCA;EAChB,WAAO;EACLsB,MAAAA,GAAG,EAAEtB,OAAO,CAAC6B,SADR;EAELH,MAAAA,IAAI,EAAE1B,OAAO,CAAC8B;EAFT,KAAP;EAID;EA7CiB;;;;;;;;"}

View File

@ -1,6 +1,6 @@
/*! /*!
* Bootstrap selector-engine.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap selector-engine.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
@ -15,7 +15,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/selector-engine.js * Bootstrap (v5.0.0-beta2): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -27,9 +27,6 @@
*/ */
var NODE_TEXT = 3; var NODE_TEXT = 3;
var SelectorEngine = { var SelectorEngine = {
matches: function matches(element, selector) {
return element.matches(selector);
},
find: function find(selector, element) { find: function find(selector, element) {
var _ref; var _ref;
@ -52,9 +49,7 @@
children: function children(element, selector) { children: function children(element, selector) {
var _ref2; var _ref2;
var children = (_ref2 = []).concat.apply(_ref2, element.children); return (_ref2 = []).concat.apply(_ref2, element.children).filter(function (child) {
return children.filter(function (child) {
return child.matches(selector); return child.matches(selector);
}); });
}, },
@ -67,7 +62,7 @@
ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType === Node.ELEMENT_NODE &&
ancestor.nodeType !== NODE_TEXT ancestor.nodeType !== NODE_TEXT
) { ) {
if (this.matches(ancestor, selector)) { if (ancestor.matches(selector)) {
parents.push(ancestor); parents.push(ancestor);
} }
@ -93,7 +88,7 @@
var next = element.nextElementSibling; var next = element.nextElementSibling;
while (next) { while (next) {
if (this.matches(next, selector)) { if (next.matches(selector)) {
return [next]; return [next];
} }

View File

@ -1 +1 @@
{"version":3,"file":"selector-engine.js","sources":["../../src/dom/selector-engine.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta1): dom/selector-engine.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NODE_TEXT = 3\n\nconst SelectorEngine = {\n matches(element, selector) {\n return element.matches(selector)\n },\n\n find(selector, element = document.documentElement) {\n return [].concat(...Element.prototype.querySelectorAll.call(element, selector))\n },\n\n findOne(selector, element = document.documentElement) {\n return Element.prototype.querySelector.call(element, selector)\n },\n\n children(element, selector) {\n const children = [].concat(...element.children)\n\n return children.filter(child => child.matches(selector))\n },\n\n parents(element, selector) {\n const parents = []\n\n let ancestor = element.parentNode\n\n while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {\n if (this.matches(ancestor, selector)) {\n parents.push(ancestor)\n }\n\n ancestor = ancestor.parentNode\n }\n\n return parents\n },\n\n prev(element, selector) {\n let previous = element.previousElementSibling\n\n while (previous) {\n if (previous.matches(selector)) {\n return [previous]\n }\n\n previous = previous.previousElementSibling\n }\n\n return []\n },\n\n next(element, selector) {\n let next = element.nextElementSibling\n\n while (next) {\n if (this.matches(next, selector)) {\n return [next]\n }\n\n next = next.nextElementSibling\n }\n\n return []\n }\n}\n\nexport default SelectorEngine\n"],"names":["NODE_TEXT","SelectorEngine","matches","element","selector","find","document","documentElement","concat","Element","prototype","querySelectorAll","call","findOne","querySelector","children","filter","child","parents","ancestor","parentNode","nodeType","Node","ELEMENT_NODE","push","prev","previous","previousElementSibling","next","nextElementSibling"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,IAAMA,SAAS,GAAG,CAAlB;MAEMC,cAAc,GAAG;EACrBC,EAAAA,OADqB,mBACbC,OADa,EACJC,QADI,EACM;EACzB,WAAOD,OAAO,CAACD,OAAR,CAAgBE,QAAhB,CAAP;EACD,GAHoB;EAKrBC,EAAAA,IALqB,gBAKhBD,QALgB,EAKND,OALM,EAK8B;EAAA;;EAAA,QAApCA,OAAoC;EAApCA,MAAAA,OAAoC,GAA1BG,QAAQ,CAACC,eAAiB;EAAA;;EACjD,WAAO,YAAGC,MAAH,aAAaC,OAAO,CAACC,SAAR,CAAkBC,gBAAlB,CAAmCC,IAAnC,CAAwCT,OAAxC,EAAiDC,QAAjD,CAAb,CAAP;EACD,GAPoB;EASrBS,EAAAA,OATqB,mBASbT,QATa,EASHD,OATG,EASiC;EAAA,QAApCA,OAAoC;EAApCA,MAAAA,OAAoC,GAA1BG,QAAQ,CAACC,eAAiB;EAAA;;EACpD,WAAOE,OAAO,CAACC,SAAR,CAAkBI,aAAlB,CAAgCF,IAAhC,CAAqCT,OAArC,EAA8CC,QAA9C,CAAP;EACD,GAXoB;EAarBW,EAAAA,QAbqB,oBAaZZ,OAbY,EAaHC,QAbG,EAaO;EAAA;;EAC1B,QAAMW,QAAQ,GAAG,aAAGP,MAAH,cAAaL,OAAO,CAACY,QAArB,CAAjB;;EAEA,WAAOA,QAAQ,CAACC,MAAT,CAAgB,UAAAC,KAAK;EAAA,aAAIA,KAAK,CAACf,OAAN,CAAcE,QAAd,CAAJ;EAAA,KAArB,CAAP;EACD,GAjBoB;EAmBrBc,EAAAA,OAnBqB,mBAmBbf,OAnBa,EAmBJC,QAnBI,EAmBM;EACzB,QAAMc,OAAO,GAAG,EAAhB;EAEA,QAAIC,QAAQ,GAAGhB,OAAO,CAACiB,UAAvB;;EAEA,WAAOD,QAAQ,IAAIA,QAAQ,CAACE,QAAT,KAAsBC,IAAI,CAACC,YAAvC,IAAuDJ,QAAQ,CAACE,QAAT,KAAsBrB,SAApF,EAA+F;EAC7F,UAAI,KAAKE,OAAL,CAAaiB,QAAb,EAAuBf,QAAvB,CAAJ,EAAsC;EACpCc,QAAAA,OAAO,CAACM,IAAR,CAAaL,QAAb;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,UAApB;EACD;;EAED,WAAOF,OAAP;EACD,GAjCoB;EAmCrBO,EAAAA,IAnCqB,gBAmChBtB,OAnCgB,EAmCPC,QAnCO,EAmCG;EACtB,QAAIsB,QAAQ,GAAGvB,OAAO,CAACwB,sBAAvB;;EAEA,WAAOD,QAAP,EAAiB;EACf,UAAIA,QAAQ,CAACxB,OAAT,CAAiBE,QAAjB,CAAJ,EAAgC;EAC9B,eAAO,CAACsB,QAAD,CAAP;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,sBAApB;EACD;;EAED,WAAO,EAAP;EACD,GA/CoB;EAiDrBC,EAAAA,IAjDqB,gBAiDhBzB,OAjDgB,EAiDPC,QAjDO,EAiDG;EACtB,QAAIwB,IAAI,GAAGzB,OAAO,CAAC0B,kBAAnB;;EAEA,WAAOD,IAAP,EAAa;EACX,UAAI,KAAK1B,OAAL,CAAa0B,IAAb,EAAmBxB,QAAnB,CAAJ,EAAkC;EAChC,eAAO,CAACwB,IAAD,CAAP;EACD;;EAEDA,MAAAA,IAAI,GAAGA,IAAI,CAACC,kBAAZ;EACD;;EAED,WAAO,EAAP;EACD;EA7DoB;;;;;;;;"} {"version":3,"file":"selector-engine.js","sources":["../../src/dom/selector-engine.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0-beta2): dom/selector-engine.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NODE_TEXT = 3\n\nconst SelectorEngine = {\n find(selector, element = document.documentElement) {\n return [].concat(...Element.prototype.querySelectorAll.call(element, selector))\n },\n\n findOne(selector, element = document.documentElement) {\n return Element.prototype.querySelector.call(element, selector)\n },\n\n children(element, selector) {\n return [].concat(...element.children)\n .filter(child => child.matches(selector))\n },\n\n parents(element, selector) {\n const parents = []\n\n let ancestor = element.parentNode\n\n while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {\n if (ancestor.matches(selector)) {\n parents.push(ancestor)\n }\n\n ancestor = ancestor.parentNode\n }\n\n return parents\n },\n\n prev(element, selector) {\n let previous = element.previousElementSibling\n\n while (previous) {\n if (previous.matches(selector)) {\n return [previous]\n }\n\n previous = previous.previousElementSibling\n }\n\n return []\n },\n\n next(element, selector) {\n let next = element.nextElementSibling\n\n while (next) {\n if (next.matches(selector)) {\n return [next]\n }\n\n next = next.nextElementSibling\n }\n\n return []\n }\n}\n\nexport default SelectorEngine\n"],"names":["NODE_TEXT","SelectorEngine","find","selector","element","document","documentElement","concat","Element","prototype","querySelectorAll","call","findOne","querySelector","children","filter","child","matches","parents","ancestor","parentNode","nodeType","Node","ELEMENT_NODE","push","prev","previous","previousElementSibling","next","nextElementSibling"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,IAAMA,SAAS,GAAG,CAAlB;MAEMC,cAAc,GAAG;EACrBC,EAAAA,IADqB,gBAChBC,QADgB,EACNC,OADM,EAC8B;EAAA;;EAAA,QAApCA,OAAoC;EAApCA,MAAAA,OAAoC,GAA1BC,QAAQ,CAACC,eAAiB;EAAA;;EACjD,WAAO,YAAGC,MAAH,aAAaC,OAAO,CAACC,SAAR,CAAkBC,gBAAlB,CAAmCC,IAAnC,CAAwCP,OAAxC,EAAiDD,QAAjD,CAAb,CAAP;EACD,GAHoB;EAKrBS,EAAAA,OALqB,mBAKbT,QALa,EAKHC,OALG,EAKiC;EAAA,QAApCA,OAAoC;EAApCA,MAAAA,OAAoC,GAA1BC,QAAQ,CAACC,eAAiB;EAAA;;EACpD,WAAOE,OAAO,CAACC,SAAR,CAAkBI,aAAlB,CAAgCF,IAAhC,CAAqCP,OAArC,EAA8CD,QAA9C,CAAP;EACD,GAPoB;EASrBW,EAAAA,QATqB,oBASZV,OATY,EASHD,QATG,EASO;EAAA;;EAC1B,WAAO,aAAGI,MAAH,cAAaH,OAAO,CAACU,QAArB,EACJC,MADI,CACG,UAAAC,KAAK;EAAA,aAAIA,KAAK,CAACC,OAAN,CAAcd,QAAd,CAAJ;EAAA,KADR,CAAP;EAED,GAZoB;EAcrBe,EAAAA,OAdqB,mBAcbd,OAda,EAcJD,QAdI,EAcM;EACzB,QAAMe,OAAO,GAAG,EAAhB;EAEA,QAAIC,QAAQ,GAAGf,OAAO,CAACgB,UAAvB;;EAEA,WAAOD,QAAQ,IAAIA,QAAQ,CAACE,QAAT,KAAsBC,IAAI,CAACC,YAAvC,IAAuDJ,QAAQ,CAACE,QAAT,KAAsBrB,SAApF,EAA+F;EAC7F,UAAImB,QAAQ,CAACF,OAAT,CAAiBd,QAAjB,CAAJ,EAAgC;EAC9Be,QAAAA,OAAO,CAACM,IAAR,CAAaL,QAAb;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,UAApB;EACD;;EAED,WAAOF,OAAP;EACD,GA5BoB;EA8BrBO,EAAAA,IA9BqB,gBA8BhBrB,OA9BgB,EA8BPD,QA9BO,EA8BG;EACtB,QAAIuB,QAAQ,GAAGtB,OAAO,CAACuB,sBAAvB;;EAEA,WAAOD,QAAP,EAAiB;EACf,UAAIA,QAAQ,CAACT,OAAT,CAAiBd,QAAjB,CAAJ,EAAgC;EAC9B,eAAO,CAACuB,QAAD,CAAP;EACD;;EAEDA,MAAAA,QAAQ,GAAGA,QAAQ,CAACC,sBAApB;EACD;;EAED,WAAO,EAAP;EACD,GA1CoB;EA4CrBC,EAAAA,IA5CqB,gBA4ChBxB,OA5CgB,EA4CPD,QA5CO,EA4CG;EACtB,QAAIyB,IAAI,GAAGxB,OAAO,CAACyB,kBAAnB;;EAEA,WAAOD,IAAP,EAAa;EACX,UAAIA,IAAI,CAACX,OAAL,CAAad,QAAb,CAAJ,EAA4B;EAC1B,eAAO,CAACyB,IAAD,CAAP;EACD;;EAEDA,MAAAA,IAAI,GAAGA,IAAI,CAACC,kBAAZ;EACD;;EAED,WAAO,EAAP;EACD;EAxDoB;;;;;;;;"}

View File

@ -1,6 +1,6 @@
/*! /*!
* Bootstrap dropdown.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap dropdown.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
@ -10,7 +10,8 @@
require('./dom/data.js'), require('./dom/data.js'),
require('./dom/event-handler.js'), require('./dom/event-handler.js'),
require('./dom/manipulator.js'), require('./dom/manipulator.js'),
require('./dom/selector-engine.js') require('./dom/selector-engine.js'),
require('./base-component.js')
)) ))
: typeof define === 'function' && define.amd : typeof define === 'function' && define.amd
? define([ ? define([
@ -19,6 +20,7 @@
'./dom/event-handler', './dom/event-handler',
'./dom/manipulator', './dom/manipulator',
'./dom/selector-engine', './dom/selector-engine',
'./base-component',
], factory) ], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Dropdown = factory( (global.Dropdown = factory(
@ -26,9 +28,10 @@
global.Data, global.Data,
global.EventHandler, global.EventHandler,
global.Manipulator, global.Manipulator,
global.SelectorEngine global.SelectorEngine,
global.Base
))); )));
})(this, function (Popper, Data, EventHandler, Manipulator, SelectorEngine) { })(this, function (Popper, Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) {
'use strict'; 'use strict';
function _interopDefaultLegacy(e) { function _interopDefaultLegacy(e) {
@ -66,10 +69,65 @@
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler); var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator); var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine); var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
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 _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 _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -89,7 +147,19 @@
var selector = element.getAttribute('data-bs-target'); var selector = element.getAttribute('data-bs-target');
if (!selector || selector === '#') { if (!selector || selector === '#') {
var hrefAttr = element.getAttribute('href'); var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
// `document.querySelector` will rightfully complain it is invalid.
// See https://github.com/twbs/bootstrap/issues/32273
if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {
return null;
} // Just in case some CMS puts out a full URL with the anchor appended
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1];
}
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
} }
@ -112,7 +182,7 @@
var valueType = value && isElement(value) ? 'element' : toType(value); var valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error( throw new TypeError(
componentName.toUpperCase() + componentName.toUpperCase() +
': ' + ': ' +
('Option "' + property + '" provided type "' + valueType + '" ') + ('Option "' + property + '" provided type "' + valueType + '" ') +
@ -165,101 +235,24 @@
var isRTL = document.documentElement.dir === 'rtl'; var isRTL = document.documentElement.dir === 'rtl';
function _defineProperties(target, props) { var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
for (var i = 0; i < props.length; i++) { onDOMContentLoaded(function () {
var descriptor = props[i]; var $ = getjQuery();
descriptor.enumerable = descriptor.enumerable || false; /* istanbul ignore if */
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) { if ($) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps); var JQUERY_NO_CONFLICT = $.fn[name];
if (staticProps) _defineProperties(Constructor, staticProps); $.fn[name] = plugin.jQueryInterface;
return Constructor; $.fn[name].Constructor = plugin;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var VERSION = '5.0.0-beta1'; $.fn[name].noConflict = function () {
$.fn[name] = JQUERY_NO_CONFLICT;
var BaseComponent = /*#__PURE__*/ (function () { return plugin.jQueryInterface;
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 * Constants
@ -304,7 +297,7 @@
var PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start'; var PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start';
var PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start'; var PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start';
var Default = { var Default = {
offset: 0, offset: [0, 2],
flip: true, flip: true,
boundary: 'clippingParents', boundary: 'clippingParents',
reference: 'toggle', reference: 'toggle',
@ -312,12 +305,12 @@
popperConfig: null, popperConfig: null,
}; };
var DefaultType = { var DefaultType = {
offset: '(number|string|function)', offset: '(array|string|function)',
flip: 'boolean', flip: 'boolean',
boundary: '(string|element)', boundary: '(string|element)',
reference: '(string|element)', reference: '(string|element|object)',
display: 'string', display: 'string',
popperConfig: '(null|object)', popperConfig: '(null|object|function)',
}; };
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -384,7 +377,9 @@
return; return;
} // Totally disable Popper for Dropdowns in Navbar } // Totally disable Popper for Dropdowns in Navbar
if (!this._inNavbar) { if (this._inNavbar) {
Manipulator__default['default'].setDataAttribute(this._menu, 'popper', 'none');
} else {
if (typeof Popper__namespace === 'undefined') { if (typeof Popper__namespace === 'undefined') {
throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)"); throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
} }
@ -399,9 +394,20 @@
if (typeof this._config.reference.jquery !== 'undefined') { if (typeof this._config.reference.jquery !== 'undefined') {
referenceElement = this._config.reference[0]; referenceElement = this._config.reference[0];
} }
} else if (typeof this._config.reference === 'object') {
referenceElement = this._config.reference;
} }
this._popper = Popper.createPopper(referenceElement, this._menu, this._getPopperConfig()); var popperConfig = this._getPopperConfig();
var isDisplayStatic = popperConfig.modifiers.find(function (modifier) {
return modifier.name === 'applyStyles' && modifier.enabled === false;
});
this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
if (isDisplayStatic) {
Manipulator__default['default'].setDataAttribute(this._menu, 'popper', 'static');
}
} // If this is a touch-enabled device we add extra } // 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
@ -423,7 +429,7 @@
this._element.classList.toggle(CLASS_NAME_SHOW); this._element.classList.toggle(CLASS_NAME_SHOW);
EventHandler__default['default'].trigger(parent, EVENT_SHOWN, relatedTarget); EventHandler__default['default'].trigger(this._element, EVENT_SHOWN, relatedTarget);
}; };
_proto.hide = function hide() { _proto.hide = function hide() {
@ -435,11 +441,14 @@
return; return;
} }
var parent = Dropdown.getParentFromElement(this._element);
var relatedTarget = { var relatedTarget = {
relatedTarget: this._element, relatedTarget: this._element,
}; };
var hideEvent = EventHandler__default['default'].trigger(parent, EVENT_HIDE, relatedTarget); var hideEvent = EventHandler__default['default'].trigger(
this._element,
EVENT_HIDE,
relatedTarget
);
if (hideEvent.defaultPrevented) { if (hideEvent.defaultPrevented) {
return; return;
@ -453,7 +462,8 @@
this._element.classList.toggle(CLASS_NAME_SHOW); this._element.classList.toggle(CLASS_NAME_SHOW);
EventHandler__default['default'].trigger(parent, EVENT_HIDDEN, relatedTarget); Manipulator__default['default'].removeDataAttribute(this._menu, 'popper');
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN, relatedTarget);
}; };
_proto.dispose = function dispose() { _proto.dispose = function dispose() {
@ -496,6 +506,19 @@
config config
); );
typeCheckConfig(NAME, config, this.constructor.DefaultType); typeCheckConfig(NAME, config, this.constructor.DefaultType);
if (
typeof config.reference === 'object' &&
!isElement(config.reference) &&
typeof config.reference.getBoundingClientRect !== 'function'
) {
// Popper virtual elements require a getBoundingClientRect method
throw new TypeError(
NAME.toUpperCase() +
': Option "reference" provided type "object" without a required "getBoundingClientRect" method.'
);
}
return config; return config;
}; };
@ -527,22 +550,48 @@
return this._element.closest('.' + CLASS_NAME_NAVBAR) !== null; return this._element.closest('.' + CLASS_NAME_NAVBAR) !== null;
}; };
_proto._getOffset = function _getOffset() {
var _this3 = this;
var offset = this._config.offset;
if (typeof offset === 'string') {
return offset.split(',').map(function (val) {
return Number.parseInt(val, 10);
});
}
if (typeof offset === 'function') {
return function (popperData) {
return offset(popperData, _this3._element);
};
}
return offset;
};
_proto._getPopperConfig = function _getPopperConfig() { _proto._getPopperConfig = function _getPopperConfig() {
var popperConfig = { var defaultBsPopperConfig = {
placement: this._getPlacement(), placement: this._getPlacement(),
modifiers: [ modifiers: [
{ {
name: 'preventOverflow', name: 'preventOverflow',
options: { options: {
altBoundary: this._config.flip, altBoundary: this._config.flip,
rootBoundary: this._config.boundary, boundary: this._config.boundary,
},
},
{
name: 'offset',
options: {
offset: this._getOffset(),
}, },
}, },
], ],
}; // Disable Popper if we have a static display }; // Disable Popper if we have a static display
if (this._config.display === 'static') { if (this._config.display === 'static') {
popperConfig.modifiers = [ defaultBsPopperConfig.modifiers = [
{ {
name: 'applyStyles', name: 'applyStyles',
enabled: false, enabled: false,
@ -550,7 +599,13 @@
]; ];
} }
return _extends({}, popperConfig, this._config.popperConfig); return _extends(
{},
defaultBsPopperConfig,
typeof this._config.popperConfig === 'function'
? this._config.popperConfig(defaultBsPopperConfig)
: this._config.popperConfig
);
}; // Static }; // Static
Dropdown.dropdownInterface = function dropdownInterface(element, config) { Dropdown.dropdownInterface = function dropdownInterface(element, config) {
@ -588,7 +643,6 @@
var toggles = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE); var toggles = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
for (var i = 0, len = toggles.length; i < len; i++) { for (var i = 0, len = toggles.length; i < len; i++) {
var parent = Dropdown.getParentFromElement(toggles[i]);
var context = Data__default['default'].getData(toggles[i], DATA_KEY); var context = Data__default['default'].getData(toggles[i], DATA_KEY);
var relatedTarget = { var relatedTarget = {
relatedTarget: toggles[i], relatedTarget: toggles[i],
@ -617,7 +671,11 @@
continue; continue;
} }
var hideEvent = EventHandler__default['default'].trigger(parent, EVENT_HIDE, relatedTarget); var hideEvent = EventHandler__default['default'].trigger(
toggles[i],
EVENT_HIDE,
relatedTarget
);
if (hideEvent.defaultPrevented) { if (hideEvent.defaultPrevented) {
continue; continue;
@ -640,7 +698,8 @@
dropdownMenu.classList.remove(CLASS_NAME_SHOW); dropdownMenu.classList.remove(CLASS_NAME_SHOW);
toggles[i].classList.remove(CLASS_NAME_SHOW); toggles[i].classList.remove(CLASS_NAME_SHOW);
EventHandler__default['default'].trigger(parent, EVENT_HIDDEN, relatedTarget); Manipulator__default['default'].removeDataAttribute(dropdownMenu, 'popper');
EventHandler__default['default'].trigger(toggles[i], EVENT_HIDDEN, relatedTarget);
} }
}; };
@ -686,6 +745,16 @@
return; return;
} }
if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
var _button = this.matches(SELECTOR_DATA_TOGGLE)
? this
: SelectorEngine__default['default'].prev(this, SELECTOR_DATA_TOGGLE)[0];
_button.click();
return;
}
if (!isActive || event.key === SPACE_KEY) { if (!isActive || event.key === SPACE_KEY) {
Dropdown.clearMenus(); Dropdown.clearMenus();
return; return;
@ -713,7 +782,7 @@
items[index].focus(); items[index].focus();
}; };
_createClass$1(Dropdown, null, [ _createClass(Dropdown, null, [
{ {
key: 'Default', key: 'Default',
get: function get() { get: function get() {
@ -735,7 +804,7 @@
]); ]);
return Dropdown; return Dropdown;
})(BaseComponent); })(BaseComponent__default['default']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
@ -781,21 +850,7 @@
* add .Dropdown to jQuery only if jQuery is present * add .Dropdown to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(function () { defineJQueryPlugin(NAME, Dropdown);
var $ = getjQuery();
/* istanbul ignore if */
if ($) {
var JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Dropdown.jQueryInterface;
$.fn[NAME].Constructor = Dropdown;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Dropdown.jQueryInterface;
};
}
});
return Dropdown; return Dropdown;
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*! /*!
* Bootstrap modal.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap modal.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
@ -9,7 +9,8 @@
require('./dom/data.js'), require('./dom/data.js'),
require('./dom/event-handler.js'), require('./dom/event-handler.js'),
require('./dom/manipulator.js'), require('./dom/manipulator.js'),
require('./dom/selector-engine.js') require('./dom/selector-engine.js'),
require('./base-component.js')
)) ))
: typeof define === 'function' && define.amd : typeof define === 'function' && define.amd
? define([ ? define([
@ -17,15 +18,17 @@
'./dom/event-handler', './dom/event-handler',
'./dom/manipulator', './dom/manipulator',
'./dom/selector-engine', './dom/selector-engine',
'./base-component',
], factory) ], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Modal = factory( (global.Modal = factory(
global.Data, global.Data,
global.EventHandler, global.EventHandler,
global.Manipulator, global.Manipulator,
global.SelectorEngine global.SelectorEngine,
global.Base
))); )));
})(this, function (Data, EventHandler, Manipulator, SelectorEngine) { })(this, function (Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) {
'use strict'; 'use strict';
function _interopDefaultLegacy(e) { function _interopDefaultLegacy(e) {
@ -36,10 +39,65 @@
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler); var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator); var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine); var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
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 _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 _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -61,7 +119,19 @@
var selector = element.getAttribute('data-bs-target'); var selector = element.getAttribute('data-bs-target');
if (!selector || selector === '#') { if (!selector || selector === '#') {
var hrefAttr = element.getAttribute('href'); var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
// `document.querySelector` will rightfully complain it is invalid.
// See https://github.com/twbs/bootstrap/issues/32273
if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {
return null;
} // Just in case some CMS puts out a full URL with the anchor appended
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1];
}
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
} }
@ -130,7 +200,7 @@
var valueType = value && isElement(value) ? 'element' : toType(value); var valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error( throw new TypeError(
componentName.toUpperCase() + componentName.toUpperCase() +
': ' + ': ' +
('Option "' + property + '" provided type "' + valueType + '" ') + ('Option "' + property + '" provided type "' + valueType + '" ') +
@ -183,101 +253,24 @@
var isRTL = document.documentElement.dir === 'rtl'; var isRTL = document.documentElement.dir === 'rtl';
function _defineProperties(target, props) { var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
for (var i = 0; i < props.length; i++) { onDOMContentLoaded(function () {
var descriptor = props[i]; var $ = getjQuery();
descriptor.enumerable = descriptor.enumerable || false; /* istanbul ignore if */
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) { if ($) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps); var JQUERY_NO_CONFLICT = $.fn[name];
if (staticProps) _defineProperties(Constructor, staticProps); $.fn[name] = plugin.jQueryInterface;
return Constructor; $.fn[name].Constructor = plugin;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var VERSION = '5.0.0-beta1'; $.fn[name].noConflict = function () {
$.fn[name] = JQUERY_NO_CONFLICT;
var BaseComponent = /*#__PURE__*/ (function () { return plugin.jQueryInterface;
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 * Constants
@ -446,7 +439,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, 'transitionend', function (event) {
return _this3._hideModal(event); return _this3._hideModal(event);
}); });
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
@ -537,7 +530,7 @@
if (transition) { if (transition) {
var transitionDuration = getTransitionDurationFromElement(this._dialog); var transitionDuration = getTransitionDurationFromElement(this._dialog);
EventHandler__default['default'].one(this._dialog, TRANSITION_END, transitionComplete); EventHandler__default['default'].one(this._dialog, 'transitionend', transitionComplete);
emulateTransitionEnd(this._dialog, transitionDuration); emulateTransitionEnd(this._dialog, transitionDuration);
} else { } else {
transitionComplete(); transitionComplete();
@ -663,7 +656,7 @@
} }
var backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); var backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
EventHandler__default['default'].one(this._backdrop, TRANSITION_END, callback); EventHandler__default['default'].one(this._backdrop, 'transitionend', callback);
emulateTransitionEnd(this._backdrop, backdropTransitionDuration); emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else if (!this._isShown && this._backdrop) { } else if (!this._isShown && this._backdrop) {
this._backdrop.classList.remove(CLASS_NAME_SHOW); this._backdrop.classList.remove(CLASS_NAME_SHOW);
@ -677,7 +670,7 @@
if (this._element.classList.contains(CLASS_NAME_FADE)) { if (this._element.classList.contains(CLASS_NAME_FADE)) {
var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
EventHandler__default['default'].one(this._backdrop, TRANSITION_END, callbackRemove); EventHandler__default['default'].one(this._backdrop, 'transitionend', callbackRemove);
emulateTransitionEnd(this._backdrop, _backdropTransitionDuration); emulateTransitionEnd(this._backdrop, _backdropTransitionDuration);
} else { } else {
callbackRemove(); callbackRemove();
@ -705,12 +698,12 @@
this._element.classList.add(CLASS_NAME_STATIC); this._element.classList.add(CLASS_NAME_STATIC);
var modalTransitionDuration = getTransitionDurationFromElement(this._dialog); var modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
EventHandler__default['default'].off(this._element, TRANSITION_END); EventHandler__default['default'].off(this._element, 'transitionend');
EventHandler__default['default'].one(this._element, TRANSITION_END, function () { EventHandler__default['default'].one(this._element, 'transitionend', function () {
_this10._element.classList.remove(CLASS_NAME_STATIC); _this10._element.classList.remove(CLASS_NAME_STATIC);
if (!isModalOverflowing) { if (!isModalOverflowing) {
EventHandler__default['default'].one(_this10._element, TRANSITION_END, function () { EventHandler__default['default'].one(_this10._element, 'transitionend', function () {
_this10._element.style.overflowY = ''; _this10._element.style.overflowY = '';
}); });
emulateTransitionEnd(_this10._element, modalTransitionDuration); emulateTransitionEnd(_this10._element, modalTransitionDuration);
@ -756,74 +749,54 @@
var _this11 = this; var _this11 = this;
if (this._isBodyOverflowing) { if (this._isBodyOverflowing) {
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', function (
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set calculatedValue
// Adjust fixed content padding ) {
SelectorEngine__default['default'].find(SELECTOR_FIXED_CONTENT).forEach(function (element) { return calculatedValue + _this11._scrollbarWidth;
var actualPadding = element.style.paddingRight; });
var calculatedPadding = window.getComputedStyle(element)['padding-right'];
Manipulator__default['default'].setDataAttribute(element, 'padding-right', actualPadding);
element.style.paddingRight =
Number.parseFloat(calculatedPadding) + _this11._scrollbarWidth + 'px';
}); // Adjust sticky content margin
SelectorEngine__default['default'] this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', function (
.find(SELECTOR_STICKY_CONTENT) calculatedValue
.forEach(function (element) { ) {
var actualMargin = element.style.marginRight; return calculatedValue - _this11._scrollbarWidth;
var calculatedMargin = window.getComputedStyle(element)['margin-right']; });
Manipulator__default['default'].setDataAttribute(element, 'margin-right', actualMargin);
element.style.marginRight =
Number.parseFloat(calculatedMargin) - _this11._scrollbarWidth + 'px';
}); // Adjust body padding
var actualPadding = document.body.style.paddingRight; this._setElementAttributes('body', 'paddingRight', function (calculatedValue) {
var calculatedPadding = window.getComputedStyle(document.body)['padding-right']; return calculatedValue + _this11._scrollbarWidth;
Manipulator__default['default'].setDataAttribute( });
document.body,
'padding-right',
actualPadding
);
document.body.style.paddingRight =
Number.parseFloat(calculatedPadding) + this._scrollbarWidth + 'px';
} }
document.body.classList.add(CLASS_NAME_OPEN); document.body.classList.add(CLASS_NAME_OPEN);
}; };
_proto._setElementAttributes = function _setElementAttributes(selector, styleProp, callback) {
SelectorEngine__default['default'].find(selector).forEach(function (element) {
var actualValue = element.style[styleProp];
var calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator__default['default'].setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
});
};
_proto._resetScrollbar = function _resetScrollbar() { _proto._resetScrollbar = function _resetScrollbar() {
// Restore fixed content padding this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
SelectorEngine__default['default'].find(SELECTOR_FIXED_CONTENT).forEach(function (element) {
var padding = Manipulator__default['default'].getDataAttribute(element, 'padding-right');
if (typeof padding !== 'undefined') { this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
Manipulator__default['default'].removeDataAttribute(element, 'padding-right');
element.style.paddingRight = padding;
}
}); // Restore sticky content and navbar-toggler margin
SelectorEngine__default['default'] this._resetElementAttributes('body', 'paddingRight');
.find('' + SELECTOR_STICKY_CONTENT) };
.forEach(function (element) {
var margin = Manipulator__default['default'].getDataAttribute(element, 'margin-right');
if (typeof margin !== 'undefined') { _proto._resetElementAttributes = function _resetElementAttributes(selector, styleProp) {
Manipulator__default['default'].removeDataAttribute(element, 'margin-right'); SelectorEngine__default['default'].find(selector).forEach(function (element) {
element.style.marginRight = margin; var value = Manipulator__default['default'].getDataAttribute(element, styleProp);
}
}); // Restore body padding
var padding = Manipulator__default['default'].getDataAttribute( if (typeof value === 'undefined' && element === document.body) {
document.body, element.style[styleProp] = '';
'padding-right'
);
if (typeof padding === 'undefined') {
document.body.style.paddingRight = '';
} else { } else {
Manipulator__default['default'].removeDataAttribute(document.body, 'padding-right'); Manipulator__default['default'].removeDataAttribute(element, styleProp);
document.body.style.paddingRight = padding; element.style[styleProp] = value;
} }
});
}; };
_proto._getScrollbarWidth = function _getScrollbarWidth() { _proto._getScrollbarWidth = function _getScrollbarWidth() {
@ -861,7 +834,7 @@
}); });
}; };
_createClass$1(Modal, null, [ _createClass(Modal, null, [
{ {
key: 'Default', key: 'Default',
get: function get() { get: function get() {
@ -877,7 +850,7 @@
]); ]);
return Modal; return Modal;
})(BaseComponent); })(BaseComponent__default['default']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
@ -921,7 +894,7 @@
data = new Modal(target, config); data = new Modal(target, config);
} }
data.show(this); data.toggle(this);
} }
); );
/** /**
@ -931,21 +904,7 @@
* add .Modal to jQuery only if jQuery is present * add .Modal to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(function () { defineJQueryPlugin(NAME, Modal);
var $ = getjQuery();
/* istanbul ignore if */
if ($) {
var JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Modal.jQueryInterface;
$.fn[NAME].Constructor = Modal;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Modal.jQueryInterface;
};
}
});
return Modal; return Modal;
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*! /*!
* Bootstrap popover.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap popover.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
@ -25,9 +25,63 @@
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine); var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var Tooltip__default = /*#__PURE__*/ _interopDefaultLegacy(Tooltip); var Tooltip__default = /*#__PURE__*/ _interopDefaultLegacy(Tooltip);
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 _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 _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -51,46 +105,26 @@
} }
}; };
var isRTL = document.documentElement.dir === 'rtl'; document.documentElement.dir === 'rtl';
function _defineProperties(target, props) { var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
for (var i = 0; i < props.length; i++) { onDOMContentLoaded(function () {
var descriptor = props[i]; var $ = getjQuery();
descriptor.enumerable = descriptor.enumerable || false; /* istanbul ignore if */
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) { if ($) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps); var JQUERY_NO_CONFLICT = $.fn[name];
if (staticProps) _defineProperties(Constructor, staticProps); $.fn[name] = plugin.jQueryInterface;
return Constructor; $.fn[name].Constructor = plugin;
}
function _inheritsLoose(subClass, superClass) { $.fn[name].noConflict = function () {
subClass.prototype = Object.create(superClass.prototype); $.fn[name] = JQUERY_NO_CONFLICT;
subClass.prototype.constructor = subClass; return plugin.jQueryInterface;
subClass.__proto__ = superClass;
}
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);
} }
});
};
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Constants * Constants
@ -105,6 +139,7 @@
var Default = _extends({}, Tooltip__default['default'].Default, { var Default = _extends({}, Tooltip__default['default'].Default, {
placement: 'right', placement: 'right',
offset: [0, 8],
trigger: 'click', trigger: 'click',
content: '', content: '',
template: template:
@ -273,21 +308,7 @@
* add .Popover to jQuery only if jQuery is present * add .Popover to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(function () { defineJQueryPlugin(NAME, Popover);
var $ = getjQuery();
/* istanbul ignore if */
if ($) {
var JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Popover.jQueryInterface;
$.fn[NAME].Constructor = Popover;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Popover.jQueryInterface;
};
}
});
return Popover; return Popover;
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*! /*!
* Bootstrap scrollspy.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap scrollspy.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
@ -9,7 +9,8 @@
require('./dom/data.js'), require('./dom/data.js'),
require('./dom/event-handler.js'), require('./dom/event-handler.js'),
require('./dom/manipulator.js'), require('./dom/manipulator.js'),
require('./dom/selector-engine.js') require('./dom/selector-engine.js'),
require('./base-component.js')
)) ))
: typeof define === 'function' && define.amd : typeof define === 'function' && define.amd
? define([ ? define([
@ -17,15 +18,17 @@
'./dom/event-handler', './dom/event-handler',
'./dom/manipulator', './dom/manipulator',
'./dom/selector-engine', './dom/selector-engine',
'./base-component',
], factory) ], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.ScrollSpy = factory( (global.ScrollSpy = factory(
global.Data, global.Data,
global.EventHandler, global.EventHandler,
global.Manipulator, global.Manipulator,
global.SelectorEngine global.SelectorEngine,
global.Base
))); )));
})(this, function (Data, EventHandler, Manipulator, SelectorEngine) { })(this, function (Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) {
'use strict'; 'use strict';
function _interopDefaultLegacy(e) { function _interopDefaultLegacy(e) {
@ -36,10 +39,65 @@
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler); var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator); var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine); var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
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 _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 _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -73,7 +131,19 @@
var selector = element.getAttribute('data-bs-target'); var selector = element.getAttribute('data-bs-target');
if (!selector || selector === '#') { if (!selector || selector === '#') {
var hrefAttr = element.getAttribute('href'); var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
// `document.querySelector` will rightfully complain it is invalid.
// See https://github.com/twbs/bootstrap/issues/32273
if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {
return null;
} // Just in case some CMS puts out a full URL with the anchor appended
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1];
}
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
} }
@ -101,7 +171,7 @@
var valueType = value && isElement(value) ? 'element' : toType(value); var valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error( throw new TypeError(
componentName.toUpperCase() + componentName.toUpperCase() +
': ' + ': ' +
('Option "' + property + '" provided type "' + valueType + '" ') + ('Option "' + property + '" provided type "' + valueType + '" ') +
@ -130,103 +200,26 @@
} }
}; };
var isRTL = document.documentElement.dir === 'rtl'; document.documentElement.dir === 'rtl';
function _defineProperties(target, props) { var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
for (var i = 0; i < props.length; i++) { onDOMContentLoaded(function () {
var descriptor = props[i]; var $ = getjQuery();
descriptor.enumerable = descriptor.enumerable || false; /* istanbul ignore if */
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) { if ($) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps); var JQUERY_NO_CONFLICT = $.fn[name];
if (staticProps) _defineProperties(Constructor, staticProps); $.fn[name] = plugin.jQueryInterface;
return Constructor; $.fn[name].Constructor = plugin;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var VERSION = '5.0.0-beta1'; $.fn[name].noConflict = function () {
$.fn[name] = JQUERY_NO_CONFLICT;
var BaseComponent = /*#__PURE__*/ (function () { return plugin.jQueryInterface;
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 * Constants
@ -292,8 +285,8 @@
_this._targets = []; _this._targets = [];
_this._activeTarget = null; _this._activeTarget = null;
_this._scrollHeight = 0; _this._scrollHeight = 0;
EventHandler__default['default'].on(_this._scrollElement, EVENT_SCROLL, function (event) { EventHandler__default['default'].on(_this._scrollElement, EVENT_SCROLL, function () {
return _this._process(event); return _this._process();
}); });
_this.refresh(); _this.refresh();
@ -521,7 +514,7 @@
}); });
}; };
_createClass$1(ScrollSpy, null, [ _createClass(ScrollSpy, null, [
{ {
key: 'Default', key: 'Default',
get: function get() { get: function get() {
@ -537,7 +530,7 @@
]); ]);
return ScrollSpy; return ScrollSpy;
})(BaseComponent); })(BaseComponent__default['default']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
@ -556,21 +549,7 @@
* add .ScrollSpy to jQuery only if jQuery is present * add .ScrollSpy to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(function () { defineJQueryPlugin(NAME, ScrollSpy);
var $ = getjQuery();
/* istanbul ignore if */
if ($) {
var JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = ScrollSpy.jQueryInterface;
$.fn[NAME].Constructor = ScrollSpy;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return ScrollSpy.jQueryInterface;
};
}
});
return ScrollSpy; return ScrollSpy;
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*! /*!
* Bootstrap tab.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap tab.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
@ -8,13 +8,19 @@
? (module.exports = factory( ? (module.exports = factory(
require('./dom/data.js'), require('./dom/data.js'),
require('./dom/event-handler.js'), require('./dom/event-handler.js'),
require('./dom/selector-engine.js') require('./dom/selector-engine.js'),
require('./base-component.js')
)) ))
: typeof define === 'function' && define.amd : typeof define === 'function' && define.amd
? define(['./dom/data', './dom/event-handler', './dom/selector-engine'], factory) ? define([
'./dom/data',
'./dom/event-handler',
'./dom/selector-engine',
'./base-component',
], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Tab = factory(global.Data, global.EventHandler, global.SelectorEngine))); (global.Tab = factory(global.Data, global.EventHandler, global.SelectorEngine, global.Base)));
})(this, function (Data, EventHandler, SelectorEngine) { })(this, function (Data, EventHandler, SelectorEngine, BaseComponent) {
'use strict'; 'use strict';
function _interopDefaultLegacy(e) { function _interopDefaultLegacy(e) {
@ -24,10 +30,45 @@
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data); var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler); var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine); var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
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 _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -38,7 +79,19 @@
var selector = element.getAttribute('data-bs-target'); var selector = element.getAttribute('data-bs-target');
if (!selector || selector === '#') { if (!selector || selector === '#') {
var hrefAttr = element.getAttribute('href'); var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
// `document.querySelector` will rightfully complain it is invalid.
// See https://github.com/twbs/bootstrap/issues/32273
if (!hrefAttr || (!hrefAttr.includes('#') && !hrefAttr.startsWith('.'))) {
return null;
} // Just in case some CMS puts out a full URL with the anchor appended
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
hrefAttr = '#' + hrefAttr.split('#')[1];
}
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
} }
@ -119,86 +172,26 @@
} }
}; };
var isRTL = document.documentElement.dir === 'rtl'; document.documentElement.dir === 'rtl';
function _defineProperties(target, props) { var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
for (var i = 0; i < props.length; i++) { onDOMContentLoaded(function () {
var descriptor = props[i]; var $ = getjQuery();
descriptor.enumerable = descriptor.enumerable || false; /* istanbul ignore if */
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) { if ($) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps); var JQUERY_NO_CONFLICT = $.fn[name];
if (staticProps) _defineProperties(Constructor, staticProps); $.fn[name] = plugin.jQueryInterface;
return Constructor; $.fn[name].Constructor = plugin;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var VERSION = '5.0.0-beta1'; $.fn[name].noConflict = function () {
$.fn[name] = JQUERY_NO_CONFLICT;
var BaseComponent = /*#__PURE__*/ (function () { return plugin.jQueryInterface;
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 * Constants
@ -269,14 +262,11 @@
previous = previous[previous.length - 1]; previous = previous[previous.length - 1];
} }
var hideEvent = null; var hideEvent = previous
? EventHandler__default['default'].trigger(previous, EVENT_HIDE, {
if (previous) {
hideEvent = EventHandler__default['default'].trigger(previous, EVENT_HIDE, {
relatedTarget: this._element, relatedTarget: this._element,
}); })
} : null;
var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW, { var showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW, {
relatedTarget: previous, relatedTarget: previous,
}); });
@ -320,7 +310,7 @@
if (active && isTransitioning) { if (active && isTransitioning) {
var transitionDuration = getTransitionDurationFromElement(active); var transitionDuration = getTransitionDurationFromElement(active);
active.classList.remove(CLASS_NAME_SHOW); active.classList.remove(CLASS_NAME_SHOW);
EventHandler__default['default'].one(active, TRANSITION_END, complete); EventHandler__default['default'].one(active, 'transitionend', complete);
emulateTransitionEnd(active, transitionDuration); emulateTransitionEnd(active, transitionDuration);
} else { } else {
complete(); complete();
@ -389,7 +379,7 @@
}); });
}; };
_createClass$1(Tab, null, [ _createClass(Tab, null, [
{ {
key: 'DATA_KEY', key: 'DATA_KEY',
// Getters // Getters
@ -400,7 +390,7 @@
]); ]);
return Tab; return Tab;
})(BaseComponent); })(BaseComponent__default['default']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* Data Api implementation * Data Api implementation
@ -424,21 +414,7 @@
* add .Tab to jQuery only if jQuery is present * add .Tab to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(function () { defineJQueryPlugin(NAME, Tab);
var $ = getjQuery();
/* istanbul ignore if */
if ($) {
var JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Tab.jQueryInterface;
$.fn[NAME].Constructor = Tab;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Tab.jQueryInterface;
};
}
});
return Tab; return Tab;
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*! /*!
* Bootstrap toast.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap toast.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
@ -8,13 +8,19 @@
? (module.exports = factory( ? (module.exports = factory(
require('./dom/data.js'), require('./dom/data.js'),
require('./dom/event-handler.js'), require('./dom/event-handler.js'),
require('./dom/manipulator.js') require('./dom/manipulator.js'),
require('./base-component.js')
)) ))
: typeof define === 'function' && define.amd : typeof define === 'function' && define.amd
? define(['./dom/data', './dom/event-handler', './dom/manipulator'], factory) ? define([
'./dom/data',
'./dom/event-handler',
'./dom/manipulator',
'./base-component',
], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Toast = factory(global.Data, global.EventHandler, global.Manipulator))); (global.Toast = factory(global.Data, global.EventHandler, global.Manipulator, global.Base)));
})(this, function (Data, EventHandler, Manipulator) { })(this, function (Data, EventHandler, Manipulator, BaseComponent) {
'use strict'; 'use strict';
function _interopDefaultLegacy(e) { function _interopDefaultLegacy(e) {
@ -24,10 +30,65 @@
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data); var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler); var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator); var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
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 _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 _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -102,7 +163,7 @@
var valueType = value && isElement(value) ? 'element' : toType(value); var valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error( throw new TypeError(
componentName.toUpperCase() + componentName.toUpperCase() +
': ' + ': ' +
('Option "' + property + '" provided type "' + valueType + '" ') + ('Option "' + property + '" provided type "' + valueType + '" ') +
@ -135,103 +196,26 @@
} }
}; };
var isRTL = document.documentElement.dir === 'rtl'; document.documentElement.dir === 'rtl';
function _defineProperties(target, props) { var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
for (var i = 0; i < props.length; i++) { onDOMContentLoaded(function () {
var descriptor = props[i]; var $ = getjQuery();
descriptor.enumerable = descriptor.enumerable || false; /* istanbul ignore if */
descriptor.configurable = true;
if ('value' in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) { if ($) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps); var JQUERY_NO_CONFLICT = $.fn[name];
if (staticProps) _defineProperties(Constructor, staticProps); $.fn[name] = plugin.jQueryInterface;
return Constructor; $.fn[name].Constructor = plugin;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var VERSION = '5.0.0-beta1'; $.fn[name].noConflict = function () {
$.fn[name] = JQUERY_NO_CONFLICT;
var BaseComponent = /*#__PURE__*/ (function () { return plugin.jQueryInterface;
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 * Constants
@ -322,7 +306,7 @@
if (this._config.animation) { if (this._config.animation) {
var transitionDuration = getTransitionDurationFromElement(this._element); var transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, TRANSITION_END, complete); EventHandler__default['default'].one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
} else { } else {
complete(); complete();
@ -352,7 +336,7 @@
if (this._config.animation) { if (this._config.animation) {
var transitionDuration = getTransitionDurationFromElement(this._element); var transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, TRANSITION_END, complete); EventHandler__default['default'].one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
} else { } else {
complete(); complete();
@ -422,7 +406,7 @@
}); });
}; };
_createClass$1(Toast, null, [ _createClass(Toast, null, [
{ {
key: 'DefaultType', key: 'DefaultType',
get: function get() { get: function get() {
@ -444,7 +428,7 @@
]); ]);
return Toast; return Toast;
})(BaseComponent); })(BaseComponent__default['default']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* jQuery * jQuery
@ -452,21 +436,7 @@
* add .Toast to jQuery only if jQuery is present * add .Toast to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(function () { defineJQueryPlugin(NAME, Toast);
var $ = getjQuery();
/* istanbul ignore if */
if ($) {
var JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Toast.jQueryInterface;
$.fn[NAME].Constructor = Toast;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Toast.jQueryInterface;
};
}
});
return Toast; return Toast;
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
/*! /*!
* Bootstrap tooltip.js v5.0.0-beta1 (https://getbootstrap.com/) * Bootstrap tooltip.js v5.0.0-beta2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
(function (global, factory) { (function (global, factory) {
@ -10,7 +10,8 @@
require('./dom/data.js'), require('./dom/data.js'),
require('./dom/event-handler.js'), require('./dom/event-handler.js'),
require('./dom/manipulator.js'), require('./dom/manipulator.js'),
require('./dom/selector-engine.js') require('./dom/selector-engine.js'),
require('./base-component.js')
)) ))
: typeof define === 'function' && define.amd : typeof define === 'function' && define.amd
? define([ ? define([
@ -19,6 +20,7 @@
'./dom/event-handler', './dom/event-handler',
'./dom/manipulator', './dom/manipulator',
'./dom/selector-engine', './dom/selector-engine',
'./base-component',
], factory) ], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), : ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Tooltip = factory( (global.Tooltip = factory(
@ -26,9 +28,10 @@
global.Data, global.Data,
global.EventHandler, global.EventHandler,
global.Manipulator, global.Manipulator,
global.SelectorEngine global.SelectorEngine,
global.Base
))); )));
})(this, function (Popper, Data, EventHandler, Manipulator, SelectorEngine) { })(this, function (Popper, Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) {
'use strict'; 'use strict';
function _interopDefaultLegacy(e) { function _interopDefaultLegacy(e) {
@ -66,10 +69,65 @@
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler); var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator); var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine); var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
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 _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 _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf =
Object.setPrototypeOf ||
function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -158,7 +216,7 @@
var valueType = value && isElement(value) ? 'element' : toType(value); var valueType = value && isElement(value) ? 'element' : toType(value);
if (!new RegExp(expectedTypes).test(valueType)) { if (!new RegExp(expectedTypes).test(valueType)) {
throw new Error( throw new TypeError(
componentName.toUpperCase() + componentName.toUpperCase() +
': ' + ': ' +
('Option "' + property + '" provided type "' + valueType + '" ') + ('Option "' + property + '" provided type "' + valueType + '" ') +
@ -214,9 +272,27 @@
var isRTL = document.documentElement.dir === 'rtl'; var isRTL = document.documentElement.dir === 'rtl';
var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) {
onDOMContentLoaded(function () {
var $ = getjQuery();
/* istanbul ignore if */
if ($) {
var JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
$.fn[name].noConflict = function () {
$.fn[name] = JQUERY_NO_CONFLICT;
return plugin.jQueryInterface;
};
}
});
};
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/sanitizer.js * Bootstrap (v5.0.0-beta2): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -252,7 +328,7 @@
if (allowedAttributeList.includes(attrName)) { if (allowedAttributeList.includes(attrName)) {
if (uriAttrs.has(attrName)) { if (uriAttrs.has(attrName)) {
return Boolean( return Boolean(
attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN) SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)
); );
} }
@ -264,7 +340,7 @@
}); // Check if a regular expression validates the attribute. }); // Check if a regular expression validates the attribute.
for (var i = 0, len = regExp.length; i < len; i++) { for (var i = 0, len = regExp.length; i < len; i++) {
if (attrName.match(regExp[i])) { if (regExp[i].test(attrName)) {
return true; return true;
} }
} }
@ -352,101 +428,6 @@
return createdDocument.body.innerHTML; return createdDocument.body.innerHTML;
} }
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;
}
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
var VERSION = '5.0.0-beta1';
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 * Constants
@ -468,14 +449,15 @@
html: 'boolean', html: 'boolean',
selector: '(string|boolean)', selector: '(string|boolean)',
placement: '(string|function)', placement: '(string|function)',
offset: '(array|string|function)',
container: '(string|element|boolean)', container: '(string|element|boolean)',
fallbackPlacements: '(null|array)', fallbackPlacements: 'array',
boundary: '(string|element)', boundary: '(string|element)',
customClass: '(string|function)', customClass: '(string|function)',
sanitize: 'boolean', sanitize: 'boolean',
sanitizeFn: '(null|function)', sanitizeFn: '(null|function)',
allowList: 'object', allowList: 'object',
popperConfig: '(null|object)', popperConfig: '(null|object|function)',
}; };
var AttachmentMap = { var AttachmentMap = {
AUTO: 'auto', AUTO: 'auto',
@ -497,8 +479,9 @@
html: false, html: false,
selector: false, selector: false,
placement: 'top', placement: 'top',
offset: [0, 0],
container: false, container: false,
fallbackPlacements: null, fallbackPlacements: ['top', 'right', 'bottom', 'left'],
boundary: 'clippingParents', boundary: 'clippingParents',
customClass: '', customClass: '',
sanitize: true, sanitize: true,
@ -581,13 +564,7 @@
} }
if (event) { if (event) {
var dataKey = this.constructor.DATA_KEY; var context = this._initializeOnDelegatedTarget(event);
var context = Data__default['default'].getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data__default['default'].setData(event.delegateTarget, dataKey, context);
}
context._activeTrigger.click = !context._activeTrigger.click; context._activeTrigger.click = !context._activeTrigger.click;
@ -616,7 +593,7 @@
this._hideModalHandler this._hideModalHandler
); );
if (this.tip) { if (this.tip && this.tip.parentNode) {
this.tip.parentNode.removeChild(this.tip); this.tip.parentNode.removeChild(this.tip);
} }
@ -643,7 +620,10 @@
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)) {
return;
}
var showEvent = EventHandler__default['default'].trigger( var showEvent = EventHandler__default['default'].trigger(
this._element, this._element,
this.constructor.Event.SHOW this.constructor.Event.SHOW
@ -724,12 +704,11 @@
if (this.tip.classList.contains(CLASS_NAME_FADE)) { if (this.tip.classList.contains(CLASS_NAME_FADE)) {
var transitionDuration = getTransitionDurationFromElement(this.tip); var transitionDuration = getTransitionDurationFromElement(this.tip);
EventHandler__default['default'].one(this.tip, TRANSITION_END, complete); EventHandler__default['default'].one(this.tip, 'transitionend', complete);
emulateTransitionEnd(this.tip, transitionDuration); emulateTransitionEnd(this.tip, transitionDuration);
} else { } else {
complete(); complete();
} }
}
}; };
_proto.hide = function hide() { _proto.hide = function hide() {
@ -785,7 +764,7 @@
if (this.tip.classList.contains(CLASS_NAME_FADE)) { if (this.tip.classList.contains(CLASS_NAME_FADE)) {
var transitionDuration = getTransitionDurationFromElement(tip); var transitionDuration = getTransitionDurationFromElement(tip);
EventHandler__default['default'].one(tip, TRANSITION_END, complete); EventHandler__default['default'].one(tip, 'transitionend', complete);
emulateTransitionEnd(tip, transitionDuration); emulateTransitionEnd(tip, transitionDuration);
} else { } else {
complete(); complete();
@ -882,28 +861,61 @@
return attachment; return attachment;
}; // Private }; // Private
_proto._getPopperConfig = function _getPopperConfig(attachment) { _proto._initializeOnDelegatedTarget = function _initializeOnDelegatedTarget(event, context) {
var dataKey = this.constructor.DATA_KEY;
context = context || Data__default['default'].getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data__default['default'].setData(event.delegateTarget, dataKey, context);
}
return context;
};
_proto._getOffset = function _getOffset() {
var _this4 = this; var _this4 = this;
var flipModifier = { var offset = this.config.offset;
if (typeof offset === 'string') {
return offset.split(',').map(function (val) {
return Number.parseInt(val, 10);
});
}
if (typeof offset === 'function') {
return function (popperData) {
return offset(popperData, _this4._element);
};
}
return offset;
};
_proto._getPopperConfig = function _getPopperConfig(attachment) {
var _this5 = this;
var defaultBsPopperConfig = {
placement: attachment,
modifiers: [
{
name: 'flip', name: 'flip',
options: { options: {
altBoundary: true, altBoundary: true,
fallbackPlacements: this.config.fallbackPlacements,
},
},
{
name: 'offset',
options: {
offset: this._getOffset(),
},
}, },
};
if (this.config.fallbackPlacements) {
flipModifier.options.fallbackPlacements = this.config.fallbackPlacements;
}
var defaultBsConfig = {
placement: attachment,
modifiers: [
flipModifier,
{ {
name: 'preventOverflow', name: 'preventOverflow',
options: { options: {
rootBoundary: this.config.boundary, boundary: this.config.boundary,
}, },
}, },
{ {
@ -917,17 +929,23 @@
enabled: true, enabled: true,
phase: 'afterWrite', phase: 'afterWrite',
fn: function fn(data) { fn: function fn(data) {
return _this4._handlePopperPlacementChange(data); return _this5._handlePopperPlacementChange(data);
}, },
}, },
], ],
onFirstUpdate: function onFirstUpdate(data) { onFirstUpdate: function onFirstUpdate(data) {
if (data.options.placement !== data.placement) { if (data.options.placement !== data.placement) {
_this4._handlePopperPlacementChange(data); _this5._handlePopperPlacementChange(data);
} }
}, },
}; };
return _extends({}, defaultBsConfig, this.config.popperConfig); return _extends(
{},
defaultBsPopperConfig,
typeof this.config.popperConfig === 'function'
? this.config.popperConfig(defaultBsPopperConfig)
: this.config.popperConfig
);
}; };
_proto._addAttachmentClass = function _addAttachmentClass(attachment) { _proto._addAttachmentClass = function _addAttachmentClass(attachment) {
@ -951,50 +969,50 @@
}; };
_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( EventHandler__default['default'].on(
_this5._element, _this6._element,
_this5.constructor.Event.CLICK, _this6.constructor.Event.CLICK,
_this5.config.selector, _this6.config.selector,
function (event) { function (event) {
return _this5.toggle(event); return _this6.toggle(event);
} }
); );
} else if (trigger !== TRIGGER_MANUAL) { } else if (trigger !== TRIGGER_MANUAL) {
var eventIn = var eventIn =
trigger === TRIGGER_HOVER trigger === TRIGGER_HOVER
? _this5.constructor.Event.MOUSEENTER ? _this6.constructor.Event.MOUSEENTER
: _this5.constructor.Event.FOCUSIN; : _this6.constructor.Event.FOCUSIN;
var eventOut = var eventOut =
trigger === TRIGGER_HOVER trigger === TRIGGER_HOVER
? _this5.constructor.Event.MOUSELEAVE ? _this6.constructor.Event.MOUSELEAVE
: _this5.constructor.Event.FOCUSOUT; : _this6.constructor.Event.FOCUSOUT;
EventHandler__default['default'].on( EventHandler__default['default'].on(
_this5._element, _this6._element,
eventIn, eventIn,
_this5.config.selector, _this6.config.selector,
function (event) { function (event) {
return _this5._enter(event); return _this6._enter(event);
} }
); );
EventHandler__default['default'].on( EventHandler__default['default'].on(
_this5._element, _this6._element,
eventOut, eventOut,
_this5.config.selector, _this6.config.selector,
function (event) { 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();
} }
}; };
@ -1031,13 +1049,7 @@
}; };
_proto._enter = function _enter(event, context) { _proto._enter = function _enter(event, context) {
var dataKey = this.constructor.DATA_KEY; context = this._initializeOnDelegatedTarget(event, context);
context = context || Data__default['default'].getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data__default['default'].setData(event.delegateTarget, dataKey, context);
}
if (event) { if (event) {
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
@ -1067,13 +1079,7 @@
}; };
_proto._leave = function _leave(event, context) { _proto._leave = function _leave(event, context) {
var dataKey = this.constructor.DATA_KEY; context = this._initializeOnDelegatedTarget(event, context);
context = context || Data__default['default'].getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data__default['default'].setData(event.delegateTarget, dataKey, context);
}
if (event) { if (event) {
context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false; context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
@ -1218,7 +1224,7 @@
}); });
}; };
_createClass$1(Tooltip, null, [ _createClass(Tooltip, null, [
{ {
key: 'Default', key: 'Default',
get: function get() { get: function get() {
@ -1258,7 +1264,7 @@
]); ]);
return Tooltip; return Tooltip;
})(BaseComponent); })(BaseComponent__default['default']);
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
* jQuery * jQuery
@ -1266,21 +1272,7 @@
* add .Tooltip to jQuery only if jQuery is present * add .Tooltip to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(function () { defineJQueryPlugin(NAME, Tooltip);
var $ = getjQuery();
/* istanbul ignore if */
if ($) {
var JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Tooltip.jQueryInterface;
$.fn[NAME].Constructor = Tooltip;
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Tooltip.jQueryInterface;
};
}
});
return Tooltip; return Tooltip;
}); });

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,12 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): alert.js * Bootstrap (v5.0.0-beta2): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
getElementFromSelector, getElementFromSelector,
getTransitionDurationFromElement, getTransitionDurationFromElement,
@ -34,9 +32,9 @@ const EVENT_CLOSE = `close${EVENT_KEY}`;
const EVENT_CLOSED = `closed${EVENT_KEY}`; const EVENT_CLOSED = `closed${EVENT_KEY}`;
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
const CLASSNAME_ALERT = 'alert'; const CLASS_NAME_ALERT = 'alert';
const CLASSNAME_FADE = 'fade'; const CLASS_NAME_FADE = 'fade';
const CLASSNAME_SHOW = 'show'; const CLASS_NAME_SHOW = 'show';
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -67,7 +65,7 @@ class Alert extends BaseComponent {
// Private // Private
_getRootElement(element) { _getRootElement(element) {
return getElementFromSelector(element) || element.closest(`.${CLASSNAME_ALERT}`); return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
} }
_triggerCloseEvent(element) { _triggerCloseEvent(element) {
@ -75,16 +73,16 @@ class Alert extends BaseComponent {
} }
_removeElement(element) { _removeElement(element) {
element.classList.remove(CLASSNAME_SHOW); element.classList.remove(CLASS_NAME_SHOW);
if (!element.classList.contains(CLASSNAME_FADE)) { if (!element.classList.contains(CLASS_NAME_FADE)) {
this._destroyElement(element); this._destroyElement(element);
return; return;
} }
const transitionDuration = getTransitionDurationFromElement(element); const transitionDuration = getTransitionDurationFromElement(element);
EventHandler.one(element, TRANSITION_END, () => this._destroyElement(element)); EventHandler.one(element, 'transitionend', () => this._destroyElement(element));
emulateTransitionEnd(element, transitionDuration); emulateTransitionEnd(element, transitionDuration);
} }
@ -137,18 +135,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDi
* add .Alert to jQuery only if jQuery is present * add .Alert to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Alert);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Alert.jQueryInterface;
$.fn[NAME].Constructor = Alert;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Alert.jQueryInterface;
};
}
});
export default Alert; export default Alert;

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): base-component.js * Bootstrap (v5.0.0-beta2): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -13,7 +13,7 @@ import Data from './dom/data';
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const VERSION = '5.0.0-beta1'; const VERSION = '5.0.0-beta2';
class BaseComponent { class BaseComponent {
constructor(element) { constructor(element) {

View File

@ -1,11 +1,11 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): button.js * Bootstrap (v5.0.0-beta2): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { getjQuery, onDOMContentLoaded } from './util/index'; import { defineJQueryPlugin } from './util/index';
import Data from './dom/data'; import Data from './dom/data';
import EventHandler from './dom/event-handler'; import EventHandler from './dom/event-handler';
import BaseComponent from './base-component'; import BaseComponent from './base-component';
@ -90,19 +90,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, (event) =>
* add .Button to jQuery only if jQuery is present * add .Button to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Button);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Button.jQueryInterface;
$.fn[NAME].Constructor = Button;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Button.jQueryInterface;
};
}
});
export default Button; export default Button;

View File

@ -1,18 +1,17 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): carousel.js * Bootstrap (v5.0.0-beta2): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
getElementFromSelector, getElementFromSelector,
getTransitionDurationFromElement, getTransitionDurationFromElement,
isVisible, isVisible,
isRTL,
reflow, reflow,
triggerTransitionEnd, triggerTransitionEnd,
typeCheckConfig, typeCheckConfig,
@ -91,13 +90,12 @@ const SELECTOR_ITEM = '.carousel-item';
const SELECTOR_ITEM_IMG = '.carousel-item img'; const SELECTOR_ITEM_IMG = '.carousel-item img';
const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
const SELECTOR_INDICATORS = '.carousel-indicators'; const SELECTOR_INDICATORS = '.carousel-indicators';
const SELECTOR_INDICATOR = '[data-mdb-target]';
const SELECTOR_DATA_SLIDE = '[data-mdb-slide], [data-mdb-slide-to]'; const SELECTOR_DATA_SLIDE = '[data-mdb-slide], [data-mdb-slide-to]';
const SELECTOR_DATA_RIDE = '[data-mdb-ride="carousel"]'; const SELECTOR_DATA_RIDE = '[data-mdb-ride="carousel"]';
const PointerType = { const POINTER_TYPE_TOUCH = 'touch';
TOUCH: 'touch', const POINTER_TYPE_PEN = 'pen';
PEN: 'pen',
};
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -253,14 +251,22 @@ class Carousel extends BaseComponent {
// swipe left // swipe left
if (direction > 0) { if (direction > 0) {
if (isRTL) {
this.next();
} else {
this.prev(); this.prev();
} }
}
// swipe right // swipe right
if (direction < 0) { if (direction < 0) {
if (isRTL) {
this.prev();
} else {
this.next(); this.next();
} }
} }
}
_addEventListeners() { _addEventListeners() {
if (this._config.keyboard) { if (this._config.keyboard) {
@ -279,7 +285,10 @@ class Carousel extends BaseComponent {
_addTouchEventListeners() { _addTouchEventListeners() {
const start = (event) => { const start = (event) => {
if (this._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { if (
this._pointerEvent &&
(event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)
) {
this.touchStartX = event.clientX; this.touchStartX = event.clientX;
} else if (!this._pointerEvent) { } else if (!this._pointerEvent) {
this.touchStartX = event.touches[0].clientX; this.touchStartX = event.touches[0].clientX;
@ -296,7 +305,10 @@ class Carousel extends BaseComponent {
}; };
const end = (event) => { const end = (event) => {
if (this._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { if (
this._pointerEvent &&
(event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)
) {
this.touchDeltaX = event.clientX - this.touchStartX; this.touchDeltaX = event.clientX - this.touchStartX;
} }
@ -343,16 +355,20 @@ class Carousel extends BaseComponent {
return; return;
} }
switch (event.key) { if (event.key === ARROW_LEFT_KEY) {
case ARROW_LEFT_KEY:
event.preventDefault();
this.prev();
break;
case ARROW_RIGHT_KEY:
event.preventDefault(); event.preventDefault();
if (isRTL) {
this.next(); this.next();
break; } else {
default: this.prev();
}
} else if (event.key === ARROW_RIGHT_KEY) {
event.preventDefault();
if (isRTL) {
this.prev();
} else {
this.next();
}
} }
} }
@ -397,16 +413,22 @@ class Carousel extends BaseComponent {
_setActiveIndicatorElement(element) { _setActiveIndicatorElement(element) {
if (this._indicatorsElement) { if (this._indicatorsElement) {
const indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement); const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement);
activeIndicator.classList.remove(CLASS_NAME_ACTIVE);
activeIndicator.removeAttribute('aria-current');
const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement);
for (let i = 0; i < indicators.length; i++) { for (let i = 0; i < indicators.length; i++) {
indicators[i].classList.remove(CLASS_NAME_ACTIVE); if (
Number.parseInt(indicators[i].getAttribute('data-mdb-slide-to'), 10) ===
this._getItemIndex(element)
) {
indicators[i].classList.add(CLASS_NAME_ACTIVE);
indicators[i].setAttribute('aria-current', 'true');
break;
} }
const nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
if (nextIndicator) {
nextIndicator.classList.add(CLASS_NAME_ACTIVE);
} }
} }
} }
@ -438,19 +460,9 @@ class Carousel extends BaseComponent {
const nextElementIndex = this._getItemIndex(nextElement); const nextElementIndex = this._getItemIndex(nextElement);
const isCycling = Boolean(this._interval); const isCycling = Boolean(this._interval);
let directionalClassName; const directionalClassName = direction === DIRECTION_NEXT ? CLASS_NAME_START : CLASS_NAME_END;
let orderClassName; const orderClassName = direction === DIRECTION_NEXT ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
let eventDirectionName; const eventDirectionName = direction === DIRECTION_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT;
if (direction === DIRECTION_NEXT) {
directionalClassName = CLASS_NAME_START;
orderClassName = CLASS_NAME_NEXT;
eventDirectionName = DIRECTION_LEFT;
} else {
directionalClassName = CLASS_NAME_END;
orderClassName = CLASS_NAME_PREV;
eventDirectionName = DIRECTION_RIGHT;
}
if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) { if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {
this._isSliding = false; this._isSliding = false;
@ -486,7 +498,7 @@ class Carousel extends BaseComponent {
const transitionDuration = getTransitionDurationFromElement(activeElement); const transitionDuration = getTransitionDurationFromElement(activeElement);
EventHandler.one(activeElement, TRANSITION_END, () => { EventHandler.one(activeElement, 'transitionend', () => {
nextElement.classList.remove(directionalClassName, orderClassName); nextElement.classList.remove(directionalClassName, orderClassName);
nextElement.classList.add(CLASS_NAME_ACTIVE); nextElement.classList.add(CLASS_NAME_ACTIVE);
@ -615,18 +627,6 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
* add .Carousel to jQuery only if jQuery is present * add .Carousel to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Carousel);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Carousel.jQueryInterface;
$.fn[NAME].Constructor = Carousel;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Carousel.jQueryInterface;
};
}
});
export default Carousel; export default Carousel;

View File

@ -1,14 +1,12 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): collapse.js * Bootstrap (v5.0.0-beta2): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
getSelectorFromElement, getSelectorFromElement,
getElementFromSelector, getElementFromSelector,
@ -204,7 +202,7 @@ class Collapse extends BaseComponent {
const scrollSize = `scroll${capitalizedDimension}`; const scrollSize = `scroll${capitalizedDimension}`;
const transitionDuration = getTransitionDurationFromElement(this._element); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete); EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
this._element.style[dimension] = `${this._element[scrollSize]}px`; this._element.style[dimension] = `${this._element[scrollSize]}px`;
@ -254,7 +252,7 @@ class Collapse extends BaseComponent {
this._element.style[dimension] = ''; this._element.style[dimension] = '';
const transitionDuration = getTransitionDurationFromElement(this._element); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete); EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
} }
@ -369,7 +367,10 @@ class Collapse extends BaseComponent {
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
if (event.target.tagName === 'A') { if (
event.target.tagName === 'A' ||
(event.delegateTarget && event.delegateTarget.tagName === 'A')
) {
event.preventDefault(); event.preventDefault();
} }
@ -403,18 +404,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Collapse to jQuery only if jQuery is present * add .Collapse to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Collapse);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Collapse.jQueryInterface;
$.fn[NAME].Constructor = Collapse;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Collapse.jQueryInterface;
};
}
});
export default Collapse; export default Collapse;

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/data.js * Bootstrap (v5.0.0-beta2): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/event-handler.js * Bootstrap (v5.0.0-beta2): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/manipulator.js * Bootstrap (v5.0.0-beta2): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/selector-engine.js * Bootstrap (v5.0.0-beta2): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dropdown.js * Bootstrap (v5.0.0-beta2): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -8,8 +8,7 @@
import * as Popper from '@popperjs/core'; import * as Popper from '@popperjs/core';
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
getElementFromSelector, getElementFromSelector,
isElement, isElement,
isVisible, isVisible,
@ -73,7 +72,7 @@ const PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start';
const PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start'; const PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start';
const Default = { const Default = {
offset: 0, offset: [0, 2],
flip: true, flip: true,
boundary: 'clippingParents', boundary: 'clippingParents',
reference: 'toggle', reference: 'toggle',
@ -82,12 +81,12 @@ const Default = {
}; };
const DefaultType = { const DefaultType = {
offset: '(number|string|function)', offset: '(array|string|function)',
flip: 'boolean', flip: 'boolean',
boundary: '(string|element)', boundary: '(string|element)',
reference: '(string|element)', reference: '(string|element|object)',
display: 'string', display: 'string',
popperConfig: '(null|object)', popperConfig: '(null|object|function)',
}; };
/** /**
@ -161,7 +160,9 @@ class Dropdown extends BaseComponent {
} }
// Totally disable Popper for Dropdowns in Navbar // Totally disable Popper for Dropdowns in Navbar
if (!this._inNavbar) { if (this._inNavbar) {
Manipulator.setDataAttribute(this._menu, 'popper', 'none');
} else {
if (typeof Popper === 'undefined') { if (typeof Popper === 'undefined') {
throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)"); throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
} }
@ -177,9 +178,20 @@ class Dropdown extends BaseComponent {
if (typeof this._config.reference.jquery !== 'undefined') { if (typeof this._config.reference.jquery !== 'undefined') {
referenceElement = this._config.reference[0]; referenceElement = this._config.reference[0];
} }
} else if (typeof this._config.reference === 'object') {
referenceElement = this._config.reference;
} }
this._popper = Popper.createPopper(referenceElement, this._menu, this._getPopperConfig()); const popperConfig = this._getPopperConfig();
const isDisplayStatic = popperConfig.modifiers.find(
(modifier) => modifier.name === 'applyStyles' && modifier.enabled === false
);
this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
if (isDisplayStatic) {
Manipulator.setDataAttribute(this._menu, 'popper', 'static');
}
} }
// If this is a touch-enabled device we add extra // If this is a touch-enabled device we add extra
@ -197,7 +209,7 @@ class Dropdown extends BaseComponent {
this._menu.classList.toggle(CLASS_NAME_SHOW); this._menu.classList.toggle(CLASS_NAME_SHOW);
this._element.classList.toggle(CLASS_NAME_SHOW); this._element.classList.toggle(CLASS_NAME_SHOW);
EventHandler.trigger(parent, EVENT_SHOWN, relatedTarget); EventHandler.trigger(this._element, EVENT_SHOWN, relatedTarget);
} }
hide() { hide() {
@ -209,12 +221,11 @@ class Dropdown extends BaseComponent {
return; return;
} }
const parent = Dropdown.getParentFromElement(this._element);
const relatedTarget = { const relatedTarget = {
relatedTarget: this._element, relatedTarget: this._element,
}; };
const hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget); const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE, relatedTarget);
if (hideEvent.defaultPrevented) { if (hideEvent.defaultPrevented) {
return; return;
@ -226,7 +237,8 @@ class Dropdown extends BaseComponent {
this._menu.classList.toggle(CLASS_NAME_SHOW); this._menu.classList.toggle(CLASS_NAME_SHOW);
this._element.classList.toggle(CLASS_NAME_SHOW); this._element.classList.toggle(CLASS_NAME_SHOW);
EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget); Manipulator.removeDataAttribute(this._menu, 'popper');
EventHandler.trigger(this._element, EVENT_HIDDEN, relatedTarget);
} }
dispose() { dispose() {
@ -266,6 +278,17 @@ class Dropdown extends BaseComponent {
typeCheckConfig(NAME, config, this.constructor.DefaultType); typeCheckConfig(NAME, config, this.constructor.DefaultType);
if (
typeof config.reference === 'object' &&
!isElement(config.reference) &&
typeof config.reference.getBoundingClientRect !== 'function'
) {
// Popper virtual elements require a getBoundingClientRect method
throw new TypeError(
`${NAME.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`
);
}
return config; return config;
} }
@ -298,15 +321,35 @@ class Dropdown extends BaseComponent {
return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null; return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null;
} }
_getOffset() {
const { offset } = this._config;
if (typeof offset === 'string') {
return offset.split(',').map((val) => Number.parseInt(val, 10));
}
if (typeof offset === 'function') {
return (popperData) => offset(popperData, this._element);
}
return offset;
}
_getPopperConfig() { _getPopperConfig() {
const popperConfig = { const defaultBsPopperConfig = {
placement: this._getPlacement(), placement: this._getPlacement(),
modifiers: [ modifiers: [
{ {
name: 'preventOverflow', name: 'preventOverflow',
options: { options: {
altBoundary: this._config.flip, altBoundary: this._config.flip,
rootBoundary: this._config.boundary, boundary: this._config.boundary,
},
},
{
name: 'offset',
options: {
offset: this._getOffset(),
}, },
}, },
], ],
@ -314,7 +357,7 @@ class Dropdown extends BaseComponent {
// Disable Popper if we have a static display // Disable Popper if we have a static display
if (this._config.display === 'static') { if (this._config.display === 'static') {
popperConfig.modifiers = [ defaultBsPopperConfig.modifiers = [
{ {
name: 'applyStyles', name: 'applyStyles',
enabled: false, enabled: false,
@ -323,8 +366,10 @@ class Dropdown extends BaseComponent {
} }
return { return {
...popperConfig, ...defaultBsPopperConfig,
...this._config.popperConfig, ...(typeof this._config.popperConfig === 'function'
? this._config.popperConfig(defaultBsPopperConfig)
: this._config.popperConfig),
}; };
} }
@ -364,7 +409,6 @@ class Dropdown extends BaseComponent {
const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE); const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
for (let i = 0, len = toggles.length; i < len; i++) { for (let i = 0, len = toggles.length; i < len; i++) {
const parent = Dropdown.getParentFromElement(toggles[i]);
const context = Data.getData(toggles[i], DATA_KEY); const context = Data.getData(toggles[i], DATA_KEY);
const relatedTarget = { const relatedTarget = {
relatedTarget: toggles[i], relatedTarget: toggles[i],
@ -392,7 +436,7 @@ class Dropdown extends BaseComponent {
continue; continue;
} }
const hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget); const hideEvent = EventHandler.trigger(toggles[i], EVENT_HIDE, relatedTarget);
if (hideEvent.defaultPrevented) { if (hideEvent.defaultPrevented) {
continue; continue;
} }
@ -413,7 +457,8 @@ class Dropdown extends BaseComponent {
dropdownMenu.classList.remove(CLASS_NAME_SHOW); dropdownMenu.classList.remove(CLASS_NAME_SHOW);
toggles[i].classList.remove(CLASS_NAME_SHOW); toggles[i].classList.remove(CLASS_NAME_SHOW);
EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget); Manipulator.removeDataAttribute(dropdownMenu, 'popper');
EventHandler.trigger(toggles[i], EVENT_HIDDEN, relatedTarget);
} }
} }
@ -459,6 +504,14 @@ class Dropdown extends BaseComponent {
return; return;
} }
if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
const button = this.matches(SELECTOR_DATA_TOGGLE)
? this
: SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0];
button.click();
return;
}
if (!isActive || event.key === SPACE_KEY) { if (!isActive || event.key === SPACE_KEY) {
Dropdown.clearMenus(); Dropdown.clearMenus();
return; return;
@ -518,18 +571,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, (e) => e.st
* add .Dropdown to jQuery only if jQuery is present * add .Dropdown to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Dropdown);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Dropdown.jQueryInterface;
$.fn[NAME].Constructor = Dropdown;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Dropdown.jQueryInterface;
};
}
});
export default Dropdown; export default Dropdown;

View File

@ -1,14 +1,12 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): modal.js * Bootstrap (v5.0.0-beta2): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
getElementFromSelector, getElementFromSelector,
getTransitionDurationFromElement, getTransitionDurationFromElement,
@ -187,7 +185,7 @@ class Modal extends BaseComponent {
if (transition) { if (transition) {
const transitionDuration = getTransitionDurationFromElement(this._element); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, (event) => this._hideModal(event)); EventHandler.one(this._element, 'transitionend', (event) => this._hideModal(event));
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
} else { } else {
this._hideModal(); this._hideModal();
@ -231,7 +229,6 @@ class Modal extends BaseComponent {
...config, ...config,
}; };
typeCheckConfig(NAME, config, DefaultType); typeCheckConfig(NAME, config, DefaultType);
return config; return config;
} }
@ -278,7 +275,7 @@ class Modal extends BaseComponent {
if (transition) { if (transition) {
const transitionDuration = getTransitionDurationFromElement(this._dialog); const transitionDuration = getTransitionDurationFromElement(this._dialog);
EventHandler.one(this._dialog, TRANSITION_END, transitionComplete); EventHandler.one(this._dialog, 'transitionend', transitionComplete);
emulateTransitionEnd(this._dialog, transitionDuration); emulateTransitionEnd(this._dialog, transitionDuration);
} else { } else {
transitionComplete(); transitionComplete();
@ -383,7 +380,7 @@ class Modal extends BaseComponent {
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
EventHandler.one(this._backdrop, TRANSITION_END, callback); EventHandler.one(this._backdrop, 'transitionend', callback);
emulateTransitionEnd(this._backdrop, backdropTransitionDuration); emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else if (!this._isShown && this._backdrop) { } else if (!this._isShown && this._backdrop) {
this._backdrop.classList.remove(CLASS_NAME_SHOW); this._backdrop.classList.remove(CLASS_NAME_SHOW);
@ -395,7 +392,7 @@ class Modal extends BaseComponent {
if (this._element.classList.contains(CLASS_NAME_FADE)) { if (this._element.classList.contains(CLASS_NAME_FADE)) {
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove); EventHandler.one(this._backdrop, 'transitionend', callbackRemove);
emulateTransitionEnd(this._backdrop, backdropTransitionDuration); emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else { } else {
callbackRemove(); callbackRemove();
@ -419,11 +416,11 @@ class Modal extends BaseComponent {
this._element.classList.add(CLASS_NAME_STATIC); this._element.classList.add(CLASS_NAME_STATIC);
const modalTransitionDuration = getTransitionDurationFromElement(this._dialog); const modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
EventHandler.off(this._element, TRANSITION_END); EventHandler.off(this._element, 'transitionend');
EventHandler.one(this._element, TRANSITION_END, () => { EventHandler.one(this._element, 'transitionend', () => {
this._element.classList.remove(CLASS_NAME_STATIC); this._element.classList.remove(CLASS_NAME_STATIC);
if (!isModalOverflowing) { if (!isModalOverflowing) {
EventHandler.one(this._element, TRANSITION_END, () => { EventHandler.one(this._element, 'transitionend', () => {
this._element.style.overflowY = ''; this._element.style.overflowY = '';
}); });
emulateTransitionEnd(this._element, modalTransitionDuration); emulateTransitionEnd(this._element, modalTransitionDuration);
@ -468,69 +465,51 @@ class Modal extends BaseComponent {
_setScrollbar() { _setScrollbar() {
if (this._isBodyOverflowing) { if (this._isBodyOverflowing) {
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set this._setElementAttributes(
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set SELECTOR_FIXED_CONTENT,
'paddingRight',
// Adjust fixed content padding (calculatedValue) => calculatedValue + this._scrollbarWidth
SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach((element) => { );
const actualPadding = element.style.paddingRight; this._setElementAttributes(
const calculatedPadding = window.getComputedStyle(element)['padding-right']; SELECTOR_STICKY_CONTENT,
Manipulator.setDataAttribute(element, 'padding-right', actualPadding); 'marginRight',
element.style.paddingRight = `${ (calculatedValue) => calculatedValue - this._scrollbarWidth
Number.parseFloat(calculatedPadding) + this._scrollbarWidth );
}px`; this._setElementAttributes(
}); 'body',
'paddingRight',
// Adjust sticky content margin (calculatedValue) => calculatedValue + this._scrollbarWidth
SelectorEngine.find(SELECTOR_STICKY_CONTENT).forEach((element) => { );
const actualMargin = element.style.marginRight;
const calculatedMargin = window.getComputedStyle(element)['margin-right'];
Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
element.style.marginRight = `${
Number.parseFloat(calculatedMargin) - this._scrollbarWidth
}px`;
});
// Adjust body padding
const actualPadding = document.body.style.paddingRight;
const calculatedPadding = window.getComputedStyle(document.body)['padding-right'];
Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
document.body.style.paddingRight = `${
Number.parseFloat(calculatedPadding) + this._scrollbarWidth
}px`;
} }
document.body.classList.add(CLASS_NAME_OPEN); document.body.classList.add(CLASS_NAME_OPEN);
} }
_setElementAttributes(selector, styleProp, callback) {
SelectorEngine.find(selector).forEach((element) => {
const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator.setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
});
}
_resetScrollbar() { _resetScrollbar() {
// Restore fixed content padding this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach((element) => { this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
const padding = Manipulator.getDataAttribute(element, 'padding-right'); this._resetElementAttributes('body', 'paddingRight');
if (typeof padding !== 'undefined') {
Manipulator.removeDataAttribute(element, 'padding-right');
element.style.paddingRight = padding;
} }
});
// Restore sticky content and navbar-toggler margin _resetElementAttributes(selector, styleProp) {
SelectorEngine.find(`${SELECTOR_STICKY_CONTENT}`).forEach((element) => { SelectorEngine.find(selector).forEach((element) => {
const margin = Manipulator.getDataAttribute(element, 'margin-right'); const value = Manipulator.getDataAttribute(element, styleProp);
if (typeof margin !== 'undefined') { if (typeof value === 'undefined' && element === document.body) {
Manipulator.removeDataAttribute(element, 'margin-right'); element.style[styleProp] = '';
element.style.marginRight = margin;
}
});
// Restore body padding
const padding = Manipulator.getDataAttribute(document.body, 'padding-right');
if (typeof padding === 'undefined') {
document.body.style.paddingRight = '';
} else { } else {
Manipulator.removeDataAttribute(document.body, 'padding-right'); Manipulator.removeDataAttribute(element, styleProp);
document.body.style.paddingRight = padding; element.style[styleProp] = value;
} }
});
} }
_getScrollbarWidth() { _getScrollbarWidth() {
@ -605,7 +584,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
data = new Modal(target, config); data = new Modal(target, config);
} }
data.show(this); data.toggle(this);
}); });
/** /**
@ -615,18 +594,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Modal to jQuery only if jQuery is present * add .Modal to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Modal);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Modal.jQueryInterface;
$.fn[NAME].Constructor = Modal;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Modal.jQueryInterface;
};
}
});
export default Modal; export default Modal;

View File

@ -1,11 +1,11 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): popover.js * Bootstrap (v5.0.0-beta2): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { getjQuery, onDOMContentLoaded } from './util/index'; import { defineJQueryPlugin } from './util/index';
import Data from './dom/data'; import Data from './dom/data';
import SelectorEngine from './dom/selector-engine'; import SelectorEngine from './dom/selector-engine';
import Tooltip from './tooltip'; import Tooltip from './tooltip';
@ -25,6 +25,7 @@ const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
const Default = { const Default = {
...Tooltip.Default, ...Tooltip.Default,
placement: 'right', placement: 'right',
offset: [0, 8],
trigger: 'click', trigger: 'click',
content: '', content: '',
template: template:
@ -165,18 +166,6 @@ class Popover extends Tooltip {
* add .Popover to jQuery only if jQuery is present * add .Popover to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Popover);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Popover.jQueryInterface;
$.fn[NAME].Constructor = Popover;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Popover.jQueryInterface;
};
}
});
export default Popover; export default Popover;

View File

@ -1,13 +1,12 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): scrollspy.js * Bootstrap (v5.0.0-beta2): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
getSelectorFromElement, getSelectorFromElement,
getUID, getUID,
isElement, isElement,
@ -77,7 +76,7 @@ class ScrollSpy extends BaseComponent {
this._activeTarget = null; this._activeTarget = null;
this._scrollHeight = 0; this._scrollHeight = 0;
EventHandler.on(this._scrollElement, EVENT_SCROLL, (event) => this._process(event)); EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process());
this.refresh(); this.refresh();
this._process(); this._process();
@ -314,18 +313,6 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
* add .ScrollSpy to jQuery only if jQuery is present * add .ScrollSpy to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, ScrollSpy);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = ScrollSpy.jQueryInterface;
$.fn[NAME].Constructor = ScrollSpy;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return ScrollSpy.jQueryInterface;
};
}
});
export default ScrollSpy; export default ScrollSpy;

View File

@ -1,14 +1,12 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): tab.js * Bootstrap (v5.0.0-beta2): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
getElementFromSelector, getElementFromSelector,
getTransitionDurationFromElement, getTransitionDurationFromElement,
@ -89,13 +87,11 @@ class Tab extends BaseComponent {
previous = previous[previous.length - 1]; previous = previous[previous.length - 1];
} }
let hideEvent = null; const hideEvent = previous
? EventHandler.trigger(previous, EVENT_HIDE, {
if (previous) {
hideEvent = EventHandler.trigger(previous, EVENT_HIDE, {
relatedTarget: this._element, relatedTarget: this._element,
}); })
} : null;
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, { const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {
relatedTarget: previous, relatedTarget: previous,
@ -140,7 +136,7 @@ class Tab extends BaseComponent {
const transitionDuration = getTransitionDurationFromElement(active); const transitionDuration = getTransitionDurationFromElement(active);
active.classList.remove(CLASS_NAME_SHOW); active.classList.remove(CLASS_NAME_SHOW);
EventHandler.one(active, TRANSITION_END, complete); EventHandler.one(active, 'transitionend', complete);
emulateTransitionEnd(active, transitionDuration); emulateTransitionEnd(active, transitionDuration);
} else { } else {
complete(); complete();
@ -230,18 +226,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Tab to jQuery only if jQuery is present * add .Tab to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Tab);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Tab.jQueryInterface;
$.fn[NAME].Constructor = Tab;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Tab.jQueryInterface;
};
}
});
export default Tab; export default Tab;

View File

@ -1,14 +1,12 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): toast.js * Bootstrap (v5.0.0-beta2): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
getTransitionDurationFromElement, getTransitionDurationFromElement,
reflow, reflow,
@ -117,7 +115,7 @@ class Toast extends BaseComponent {
if (this._config.animation) { if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete); EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
} else { } else {
complete(); complete();
@ -144,7 +142,7 @@ class Toast extends BaseComponent {
if (this._config.animation) { if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete); EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
} else { } else {
complete(); complete();
@ -216,18 +214,6 @@ class Toast extends BaseComponent {
* add .Toast to jQuery only if jQuery is present * add .Toast to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Toast);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Toast.jQueryInterface;
$.fn[NAME].Constructor = Toast;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Toast.jQueryInterface;
};
}
});
export default Toast; export default Toast;

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): tooltip.js * Bootstrap (v5.0.0-beta2): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -8,9 +8,7 @@
import * as Popper from '@popperjs/core'; import * as Popper from '@popperjs/core';
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
findShadowRoot, findShadowRoot,
getTransitionDurationFromElement, getTransitionDurationFromElement,
@ -49,14 +47,15 @@ const DefaultType = {
html: 'boolean', html: 'boolean',
selector: '(string|boolean)', selector: '(string|boolean)',
placement: '(string|function)', placement: '(string|function)',
offset: '(array|string|function)',
container: '(string|element|boolean)', container: '(string|element|boolean)',
fallbackPlacements: '(null|array)', fallbackPlacements: 'array',
boundary: '(string|element)', boundary: '(string|element)',
customClass: '(string|function)', customClass: '(string|function)',
sanitize: 'boolean', sanitize: 'boolean',
sanitizeFn: '(null|function)', sanitizeFn: '(null|function)',
allowList: 'object', allowList: 'object',
popperConfig: '(null|object)', popperConfig: '(null|object|function)',
}; };
const AttachmentMap = { const AttachmentMap = {
@ -80,8 +79,9 @@ const Default = {
html: false, html: false,
selector: false, selector: false,
placement: 'top', placement: 'top',
offset: [0, 0],
container: false, container: false,
fallbackPlacements: null, fallbackPlacements: ['top', 'right', 'bottom', 'left'],
boundary: 'clippingParents', boundary: 'clippingParents',
customClass: '', customClass: '',
sanitize: true, sanitize: true,
@ -191,13 +191,7 @@ class Tooltip extends BaseComponent {
} }
if (event) { if (event) {
const dataKey = this.constructor.DATA_KEY; const context = this._initializeOnDelegatedTarget(event);
let context = Data.getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data.setData(event.delegateTarget, dataKey, context);
}
context._activeTrigger.click = !context._activeTrigger.click; context._activeTrigger.click = !context._activeTrigger.click;
@ -226,7 +220,7 @@ class Tooltip extends BaseComponent {
this._hideModalHandler this._hideModalHandler
); );
if (this.tip) { if (this.tip && this.tip.parentNode) {
this.tip.parentNode.removeChild(this.tip); this.tip.parentNode.removeChild(this.tip);
} }
@ -249,7 +243,10 @@ class Tooltip extends BaseComponent {
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)) {
return;
}
const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW); const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
const shadowRoot = findShadowRoot(this._element); const shadowRoot = findShadowRoot(this._element);
const isInTheDom = const isInTheDom =
@ -325,13 +322,12 @@ class Tooltip extends BaseComponent {
if (this.tip.classList.contains(CLASS_NAME_FADE)) { if (this.tip.classList.contains(CLASS_NAME_FADE)) {
const transitionDuration = getTransitionDurationFromElement(this.tip); const transitionDuration = getTransitionDurationFromElement(this.tip);
EventHandler.one(this.tip, TRANSITION_END, complete); EventHandler.one(this.tip, 'transitionend', complete);
emulateTransitionEnd(this.tip, transitionDuration); emulateTransitionEnd(this.tip, transitionDuration);
} else { } else {
complete(); complete();
} }
} }
}
hide() { hide() {
if (!this._popper) { if (!this._popper) {
@ -376,7 +372,7 @@ class Tooltip extends BaseComponent {
if (this.tip.classList.contains(CLASS_NAME_FADE)) { if (this.tip.classList.contains(CLASS_NAME_FADE)) {
const transitionDuration = getTransitionDurationFromElement(tip); const transitionDuration = getTransitionDurationFromElement(tip);
EventHandler.one(tip, TRANSITION_END, complete); EventHandler.one(tip, 'transitionend', complete);
emulateTransitionEnd(tip, transitionDuration); emulateTransitionEnd(tip, transitionDuration);
} else { } else {
complete(); complete();
@ -476,26 +472,53 @@ class Tooltip extends BaseComponent {
// Private // Private
_initializeOnDelegatedTarget(event, context) {
const dataKey = this.constructor.DATA_KEY;
context = context || Data.getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data.setData(event.delegateTarget, dataKey, context);
}
return context;
}
_getOffset() {
const { offset } = this.config;
if (typeof offset === 'string') {
return offset.split(',').map((val) => Number.parseInt(val, 10));
}
if (typeof offset === 'function') {
return (popperData) => offset(popperData, this._element);
}
return offset;
}
_getPopperConfig(attachment) { _getPopperConfig(attachment) {
const flipModifier = { const defaultBsPopperConfig = {
placement: attachment,
modifiers: [
{
name: 'flip', name: 'flip',
options: { options: {
altBoundary: true, altBoundary: true,
fallbackPlacements: this.config.fallbackPlacements,
},
},
{
name: 'offset',
options: {
offset: this._getOffset(),
},
}, },
};
if (this.config.fallbackPlacements) {
flipModifier.options.fallbackPlacements = this.config.fallbackPlacements;
}
const defaultBsConfig = {
placement: attachment,
modifiers: [
flipModifier,
{ {
name: 'preventOverflow', name: 'preventOverflow',
options: { options: {
rootBoundary: this.config.boundary, boundary: this.config.boundary,
}, },
}, },
{ {
@ -519,8 +542,10 @@ class Tooltip extends BaseComponent {
}; };
return { return {
...defaultBsConfig, ...defaultBsPopperConfig,
...this.config.popperConfig, ...(typeof this.config.popperConfig === 'function'
? this.config.popperConfig(defaultBsPopperConfig)
: this.config.popperConfig),
}; };
} }
@ -612,13 +637,7 @@ class Tooltip extends BaseComponent {
} }
_enter(event, context) { _enter(event, context) {
const dataKey = this.constructor.DATA_KEY; context = this._initializeOnDelegatedTarget(event, context);
context = context || Data.getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data.setData(event.delegateTarget, dataKey, context);
}
if (event) { if (event) {
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
@ -649,13 +668,7 @@ class Tooltip extends BaseComponent {
} }
_leave(event, context) { _leave(event, context) {
const dataKey = this.constructor.DATA_KEY; context = this._initializeOnDelegatedTarget(event, context);
context = context || Data.getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data.setData(event.delegateTarget, dataKey, context);
}
if (event) { if (event) {
context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false; context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
@ -801,18 +814,6 @@ class Tooltip extends BaseComponent {
* add .Tooltip to jQuery only if jQuery is present * add .Tooltip to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Tooltip);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Tooltip.jQueryInterface;
$.fn[NAME].Constructor = Tooltip;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Tooltip.jQueryInterface;
};
}
});
export default Tooltip; export default Tooltip;

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -195,6 +195,22 @@ const onDOMContentLoaded = (callback) => {
const isRTL = document.documentElement.dir === 'rtl'; const isRTL = document.documentElement.dir === 'rtl';
const defineJQueryPlugin = (name, plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
$.fn[name].noConflict = () => {
$.fn[name] = JQUERY_NO_CONFLICT;
return plugin.jQueryInterface;
};
}
});
};
export { export {
TRANSITION_END, TRANSITION_END,
getUID, getUID,
@ -212,4 +228,5 @@ export {
getjQuery, getjQuery,
onDOMContentLoaded, onDOMContentLoaded,
isRTL, isRTL,
defineJQueryPlugin,
}; };

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/sanitizer.js * Bootstrap (v5.0.0-beta2): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,14 +1,12 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): alert.js * Bootstrap (v5.0.0-beta2): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
getElementFromSelector, getElementFromSelector,
getTransitionDurationFromElement, getTransitionDurationFromElement,
@ -34,9 +32,9 @@ const EVENT_CLOSE = `close${EVENT_KEY}`;
const EVENT_CLOSED = `closed${EVENT_KEY}`; const EVENT_CLOSED = `closed${EVENT_KEY}`;
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`; const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
const CLASSNAME_ALERT = 'alert'; const CLASS_NAME_ALERT = 'alert';
const CLASSNAME_FADE = 'fade'; const CLASS_NAME_FADE = 'fade';
const CLASSNAME_SHOW = 'show'; const CLASS_NAME_SHOW = 'show';
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -67,7 +65,7 @@ class Alert extends BaseComponent {
// Private // Private
_getRootElement(element) { _getRootElement(element) {
return getElementFromSelector(element) || element.closest(`.${CLASSNAME_ALERT}`); return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
} }
_triggerCloseEvent(element) { _triggerCloseEvent(element) {
@ -75,16 +73,16 @@ class Alert extends BaseComponent {
} }
_removeElement(element) { _removeElement(element) {
element.classList.remove(CLASSNAME_SHOW); element.classList.remove(CLASS_NAME_SHOW);
if (!element.classList.contains(CLASSNAME_FADE)) { if (!element.classList.contains(CLASS_NAME_FADE)) {
this._destroyElement(element); this._destroyElement(element);
return; return;
} }
const transitionDuration = getTransitionDurationFromElement(element); const transitionDuration = getTransitionDurationFromElement(element);
EventHandler.one(element, TRANSITION_END, () => this._destroyElement(element)); EventHandler.one(element, 'transitionend', () => this._destroyElement(element));
emulateTransitionEnd(element, transitionDuration); emulateTransitionEnd(element, transitionDuration);
} }
@ -137,18 +135,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDi
* add .Alert to jQuery only if jQuery is present * add .Alert to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Alert);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Alert.jQueryInterface;
$.fn[NAME].Constructor = Alert;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Alert.jQueryInterface;
};
}
});
export default Alert; export default Alert;

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): base-component.js * Bootstrap (v5.0.0-beta2): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -13,7 +13,7 @@ import Data from './dom/data';
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
*/ */
const VERSION = '5.0.0-beta1'; const VERSION = '5.0.0-beta2';
class BaseComponent { class BaseComponent {
constructor(element) { constructor(element) {

View File

@ -1,11 +1,11 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): button.js * Bootstrap (v5.0.0-beta2): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { getjQuery, onDOMContentLoaded } from './util/index'; import { defineJQueryPlugin } from './util/index';
import Data from './dom/data'; import Data from './dom/data';
import EventHandler from './dom/event-handler'; import EventHandler from './dom/event-handler';
import BaseComponent from './base-component'; import BaseComponent from './base-component';
@ -90,19 +90,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, (event) =>
* add .Button to jQuery only if jQuery is present * add .Button to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Button);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Button.jQueryInterface;
$.fn[NAME].Constructor = Button;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Button.jQueryInterface;
};
}
});
export default Button; export default Button;

View File

@ -1,18 +1,17 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): carousel.js * Bootstrap (v5.0.0-beta2): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
getElementFromSelector, getElementFromSelector,
getTransitionDurationFromElement, getTransitionDurationFromElement,
isVisible, isVisible,
isRTL,
reflow, reflow,
triggerTransitionEnd, triggerTransitionEnd,
typeCheckConfig, typeCheckConfig,
@ -91,13 +90,12 @@ const SELECTOR_ITEM = '.carousel-item';
const SELECTOR_ITEM_IMG = '.carousel-item img'; const SELECTOR_ITEM_IMG = '.carousel-item img';
const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
const SELECTOR_INDICATORS = '.carousel-indicators'; const SELECTOR_INDICATORS = '.carousel-indicators';
const SELECTOR_INDICATOR = '[data-bs-target]';
const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'; const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'; const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
const PointerType = { const POINTER_TYPE_TOUCH = 'touch';
TOUCH: 'touch', const POINTER_TYPE_PEN = 'pen';
PEN: 'pen',
};
/** /**
* ------------------------------------------------------------------------ * ------------------------------------------------------------------------
@ -253,14 +251,22 @@ class Carousel extends BaseComponent {
// swipe left // swipe left
if (direction > 0) { if (direction > 0) {
if (isRTL) {
this.next();
} else {
this.prev(); this.prev();
} }
}
// swipe right // swipe right
if (direction < 0) { if (direction < 0) {
if (isRTL) {
this.prev();
} else {
this.next(); this.next();
} }
} }
}
_addEventListeners() { _addEventListeners() {
if (this._config.keyboard) { if (this._config.keyboard) {
@ -279,7 +285,10 @@ class Carousel extends BaseComponent {
_addTouchEventListeners() { _addTouchEventListeners() {
const start = (event) => { const start = (event) => {
if (this._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { if (
this._pointerEvent &&
(event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)
) {
this.touchStartX = event.clientX; this.touchStartX = event.clientX;
} else if (!this._pointerEvent) { } else if (!this._pointerEvent) {
this.touchStartX = event.touches[0].clientX; this.touchStartX = event.touches[0].clientX;
@ -296,7 +305,10 @@ class Carousel extends BaseComponent {
}; };
const end = (event) => { const end = (event) => {
if (this._pointerEvent && PointerType[event.pointerType.toUpperCase()]) { if (
this._pointerEvent &&
(event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)
) {
this.touchDeltaX = event.clientX - this.touchStartX; this.touchDeltaX = event.clientX - this.touchStartX;
} }
@ -343,16 +355,20 @@ class Carousel extends BaseComponent {
return; return;
} }
switch (event.key) { if (event.key === ARROW_LEFT_KEY) {
case ARROW_LEFT_KEY:
event.preventDefault();
this.prev();
break;
case ARROW_RIGHT_KEY:
event.preventDefault(); event.preventDefault();
if (isRTL) {
this.next(); this.next();
break; } else {
default: this.prev();
}
} else if (event.key === ARROW_RIGHT_KEY) {
event.preventDefault();
if (isRTL) {
this.prev();
} else {
this.next();
}
} }
} }
@ -397,16 +413,22 @@ class Carousel extends BaseComponent {
_setActiveIndicatorElement(element) { _setActiveIndicatorElement(element) {
if (this._indicatorsElement) { if (this._indicatorsElement) {
const indicators = SelectorEngine.find(SELECTOR_ACTIVE, this._indicatorsElement); const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement);
activeIndicator.classList.remove(CLASS_NAME_ACTIVE);
activeIndicator.removeAttribute('aria-current');
const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement);
for (let i = 0; i < indicators.length; i++) { for (let i = 0; i < indicators.length; i++) {
indicators[i].classList.remove(CLASS_NAME_ACTIVE); if (
Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) ===
this._getItemIndex(element)
) {
indicators[i].classList.add(CLASS_NAME_ACTIVE);
indicators[i].setAttribute('aria-current', 'true');
break;
} }
const nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
if (nextIndicator) {
nextIndicator.classList.add(CLASS_NAME_ACTIVE);
} }
} }
} }
@ -438,19 +460,9 @@ class Carousel extends BaseComponent {
const nextElementIndex = this._getItemIndex(nextElement); const nextElementIndex = this._getItemIndex(nextElement);
const isCycling = Boolean(this._interval); const isCycling = Boolean(this._interval);
let directionalClassName; const directionalClassName = direction === DIRECTION_NEXT ? CLASS_NAME_START : CLASS_NAME_END;
let orderClassName; const orderClassName = direction === DIRECTION_NEXT ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
let eventDirectionName; const eventDirectionName = direction === DIRECTION_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT;
if (direction === DIRECTION_NEXT) {
directionalClassName = CLASS_NAME_START;
orderClassName = CLASS_NAME_NEXT;
eventDirectionName = DIRECTION_LEFT;
} else {
directionalClassName = CLASS_NAME_END;
orderClassName = CLASS_NAME_PREV;
eventDirectionName = DIRECTION_RIGHT;
}
if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) { if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE)) {
this._isSliding = false; this._isSliding = false;
@ -486,7 +498,7 @@ class Carousel extends BaseComponent {
const transitionDuration = getTransitionDurationFromElement(activeElement); const transitionDuration = getTransitionDurationFromElement(activeElement);
EventHandler.one(activeElement, TRANSITION_END, () => { EventHandler.one(activeElement, 'transitionend', () => {
nextElement.classList.remove(directionalClassName, orderClassName); nextElement.classList.remove(directionalClassName, orderClassName);
nextElement.classList.add(CLASS_NAME_ACTIVE); nextElement.classList.add(CLASS_NAME_ACTIVE);
@ -615,18 +627,6 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
* add .Carousel to jQuery only if jQuery is present * add .Carousel to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Carousel);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Carousel.jQueryInterface;
$.fn[NAME].Constructor = Carousel;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Carousel.jQueryInterface;
};
}
});
export default Carousel; export default Carousel;

View File

@ -1,14 +1,12 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): collapse.js * Bootstrap (v5.0.0-beta2): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
getSelectorFromElement, getSelectorFromElement,
getElementFromSelector, getElementFromSelector,
@ -204,7 +202,7 @@ class Collapse extends BaseComponent {
const scrollSize = `scroll${capitalizedDimension}`; const scrollSize = `scroll${capitalizedDimension}`;
const transitionDuration = getTransitionDurationFromElement(this._element); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete); EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
this._element.style[dimension] = `${this._element[scrollSize]}px`; this._element.style[dimension] = `${this._element[scrollSize]}px`;
@ -254,7 +252,7 @@ class Collapse extends BaseComponent {
this._element.style[dimension] = ''; this._element.style[dimension] = '';
const transitionDuration = getTransitionDurationFromElement(this._element); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete); EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
} }
@ -369,7 +367,10 @@ class Collapse extends BaseComponent {
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
if (event.target.tagName === 'A') { if (
event.target.tagName === 'A' ||
(event.delegateTarget && event.delegateTarget.tagName === 'A')
) {
event.preventDefault(); event.preventDefault();
} }
@ -403,18 +404,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Collapse to jQuery only if jQuery is present * add .Collapse to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Collapse);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Collapse.jQueryInterface;
$.fn[NAME].Constructor = Collapse;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Collapse.jQueryInterface;
};
}
});
export default Collapse; export default Collapse;

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/data.js * Bootstrap (v5.0.0-beta2): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/event-handler.js * Bootstrap (v5.0.0-beta2): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/manipulator.js * Bootstrap (v5.0.0-beta2): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/selector-engine.js * Bootstrap (v5.0.0-beta2): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dropdown.js * Bootstrap (v5.0.0-beta2): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -8,8 +8,7 @@
import * as Popper from '@popperjs/core'; import * as Popper from '@popperjs/core';
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
getElementFromSelector, getElementFromSelector,
isElement, isElement,
isVisible, isVisible,
@ -73,7 +72,7 @@ const PLACEMENT_RIGHT = isRTL ? 'left-start' : 'right-start';
const PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start'; const PLACEMENT_LEFT = isRTL ? 'right-start' : 'left-start';
const Default = { const Default = {
offset: 0, offset: [0, 2],
flip: true, flip: true,
boundary: 'clippingParents', boundary: 'clippingParents',
reference: 'toggle', reference: 'toggle',
@ -82,12 +81,12 @@ const Default = {
}; };
const DefaultType = { const DefaultType = {
offset: '(number|string|function)', offset: '(array|string|function)',
flip: 'boolean', flip: 'boolean',
boundary: '(string|element)', boundary: '(string|element)',
reference: '(string|element)', reference: '(string|element|object)',
display: 'string', display: 'string',
popperConfig: '(null|object)', popperConfig: '(null|object|function)',
}; };
/** /**
@ -161,7 +160,9 @@ class Dropdown extends BaseComponent {
} }
// Totally disable Popper for Dropdowns in Navbar // Totally disable Popper for Dropdowns in Navbar
if (!this._inNavbar) { if (this._inNavbar) {
Manipulator.setDataAttribute(this._menu, 'popper', 'none');
} else {
if (typeof Popper === 'undefined') { if (typeof Popper === 'undefined') {
throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)"); throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
} }
@ -177,9 +178,20 @@ class Dropdown extends BaseComponent {
if (typeof this._config.reference.jquery !== 'undefined') { if (typeof this._config.reference.jquery !== 'undefined') {
referenceElement = this._config.reference[0]; referenceElement = this._config.reference[0];
} }
} else if (typeof this._config.reference === 'object') {
referenceElement = this._config.reference;
} }
this._popper = Popper.createPopper(referenceElement, this._menu, this._getPopperConfig()); const popperConfig = this._getPopperConfig();
const isDisplayStatic = popperConfig.modifiers.find(
(modifier) => modifier.name === 'applyStyles' && modifier.enabled === false
);
this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
if (isDisplayStatic) {
Manipulator.setDataAttribute(this._menu, 'popper', 'static');
}
} }
// If this is a touch-enabled device we add extra // If this is a touch-enabled device we add extra
@ -197,7 +209,7 @@ class Dropdown extends BaseComponent {
this._menu.classList.toggle(CLASS_NAME_SHOW); this._menu.classList.toggle(CLASS_NAME_SHOW);
this._element.classList.toggle(CLASS_NAME_SHOW); this._element.classList.toggle(CLASS_NAME_SHOW);
EventHandler.trigger(parent, EVENT_SHOWN, relatedTarget); EventHandler.trigger(this._element, EVENT_SHOWN, relatedTarget);
} }
hide() { hide() {
@ -209,12 +221,11 @@ class Dropdown extends BaseComponent {
return; return;
} }
const parent = Dropdown.getParentFromElement(this._element);
const relatedTarget = { const relatedTarget = {
relatedTarget: this._element, relatedTarget: this._element,
}; };
const hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget); const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE, relatedTarget);
if (hideEvent.defaultPrevented) { if (hideEvent.defaultPrevented) {
return; return;
@ -226,7 +237,8 @@ class Dropdown extends BaseComponent {
this._menu.classList.toggle(CLASS_NAME_SHOW); this._menu.classList.toggle(CLASS_NAME_SHOW);
this._element.classList.toggle(CLASS_NAME_SHOW); this._element.classList.toggle(CLASS_NAME_SHOW);
EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget); Manipulator.removeDataAttribute(this._menu, 'popper');
EventHandler.trigger(this._element, EVENT_HIDDEN, relatedTarget);
} }
dispose() { dispose() {
@ -266,6 +278,17 @@ class Dropdown extends BaseComponent {
typeCheckConfig(NAME, config, this.constructor.DefaultType); typeCheckConfig(NAME, config, this.constructor.DefaultType);
if (
typeof config.reference === 'object' &&
!isElement(config.reference) &&
typeof config.reference.getBoundingClientRect !== 'function'
) {
// Popper virtual elements require a getBoundingClientRect method
throw new TypeError(
`${NAME.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`
);
}
return config; return config;
} }
@ -298,15 +321,35 @@ class Dropdown extends BaseComponent {
return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null; return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null;
} }
_getOffset() {
const { offset } = this._config;
if (typeof offset === 'string') {
return offset.split(',').map((val) => Number.parseInt(val, 10));
}
if (typeof offset === 'function') {
return (popperData) => offset(popperData, this._element);
}
return offset;
}
_getPopperConfig() { _getPopperConfig() {
const popperConfig = { const defaultBsPopperConfig = {
placement: this._getPlacement(), placement: this._getPlacement(),
modifiers: [ modifiers: [
{ {
name: 'preventOverflow', name: 'preventOverflow',
options: { options: {
altBoundary: this._config.flip, altBoundary: this._config.flip,
rootBoundary: this._config.boundary, boundary: this._config.boundary,
},
},
{
name: 'offset',
options: {
offset: this._getOffset(),
}, },
}, },
], ],
@ -314,7 +357,7 @@ class Dropdown extends BaseComponent {
// Disable Popper if we have a static display // Disable Popper if we have a static display
if (this._config.display === 'static') { if (this._config.display === 'static') {
popperConfig.modifiers = [ defaultBsPopperConfig.modifiers = [
{ {
name: 'applyStyles', name: 'applyStyles',
enabled: false, enabled: false,
@ -323,8 +366,10 @@ class Dropdown extends BaseComponent {
} }
return { return {
...popperConfig, ...defaultBsPopperConfig,
...this._config.popperConfig, ...(typeof this._config.popperConfig === 'function'
? this._config.popperConfig(defaultBsPopperConfig)
: this._config.popperConfig),
}; };
} }
@ -364,7 +409,6 @@ class Dropdown extends BaseComponent {
const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE); const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
for (let i = 0, len = toggles.length; i < len; i++) { for (let i = 0, len = toggles.length; i < len; i++) {
const parent = Dropdown.getParentFromElement(toggles[i]);
const context = Data.getData(toggles[i], DATA_KEY); const context = Data.getData(toggles[i], DATA_KEY);
const relatedTarget = { const relatedTarget = {
relatedTarget: toggles[i], relatedTarget: toggles[i],
@ -392,7 +436,7 @@ class Dropdown extends BaseComponent {
continue; continue;
} }
const hideEvent = EventHandler.trigger(parent, EVENT_HIDE, relatedTarget); const hideEvent = EventHandler.trigger(toggles[i], EVENT_HIDE, relatedTarget);
if (hideEvent.defaultPrevented) { if (hideEvent.defaultPrevented) {
continue; continue;
} }
@ -413,7 +457,8 @@ class Dropdown extends BaseComponent {
dropdownMenu.classList.remove(CLASS_NAME_SHOW); dropdownMenu.classList.remove(CLASS_NAME_SHOW);
toggles[i].classList.remove(CLASS_NAME_SHOW); toggles[i].classList.remove(CLASS_NAME_SHOW);
EventHandler.trigger(parent, EVENT_HIDDEN, relatedTarget); Manipulator.removeDataAttribute(dropdownMenu, 'popper');
EventHandler.trigger(toggles[i], EVENT_HIDDEN, relatedTarget);
} }
} }
@ -459,6 +504,14 @@ class Dropdown extends BaseComponent {
return; return;
} }
if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
const button = this.matches(SELECTOR_DATA_TOGGLE)
? this
: SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0];
button.click();
return;
}
if (!isActive || event.key === SPACE_KEY) { if (!isActive || event.key === SPACE_KEY) {
Dropdown.clearMenus(); Dropdown.clearMenus();
return; return;
@ -518,18 +571,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_FORM_CHILD, (e) => e.st
* add .Dropdown to jQuery only if jQuery is present * add .Dropdown to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Dropdown);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Dropdown.jQueryInterface;
$.fn[NAME].Constructor = Dropdown;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Dropdown.jQueryInterface;
};
}
});
export default Dropdown; export default Dropdown;

View File

@ -1,14 +1,12 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): modal.js * Bootstrap (v5.0.0-beta2): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
getElementFromSelector, getElementFromSelector,
getTransitionDurationFromElement, getTransitionDurationFromElement,
@ -187,7 +185,7 @@ class Modal extends BaseComponent {
if (transition) { if (transition) {
const transitionDuration = getTransitionDurationFromElement(this._element); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, (event) => this._hideModal(event)); EventHandler.one(this._element, 'transitionend', (event) => this._hideModal(event));
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
} else { } else {
this._hideModal(); this._hideModal();
@ -276,7 +274,7 @@ class Modal extends BaseComponent {
if (transition) { if (transition) {
const transitionDuration = getTransitionDurationFromElement(this._dialog); const transitionDuration = getTransitionDurationFromElement(this._dialog);
EventHandler.one(this._dialog, TRANSITION_END, transitionComplete); EventHandler.one(this._dialog, 'transitionend', transitionComplete);
emulateTransitionEnd(this._dialog, transitionDuration); emulateTransitionEnd(this._dialog, transitionDuration);
} else { } else {
transitionComplete(); transitionComplete();
@ -381,7 +379,7 @@ class Modal extends BaseComponent {
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
EventHandler.one(this._backdrop, TRANSITION_END, callback); EventHandler.one(this._backdrop, 'transitionend', callback);
emulateTransitionEnd(this._backdrop, backdropTransitionDuration); emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else if (!this._isShown && this._backdrop) { } else if (!this._isShown && this._backdrop) {
this._backdrop.classList.remove(CLASS_NAME_SHOW); this._backdrop.classList.remove(CLASS_NAME_SHOW);
@ -393,7 +391,7 @@ class Modal extends BaseComponent {
if (this._element.classList.contains(CLASS_NAME_FADE)) { if (this._element.classList.contains(CLASS_NAME_FADE)) {
const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); const backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop);
EventHandler.one(this._backdrop, TRANSITION_END, callbackRemove); EventHandler.one(this._backdrop, 'transitionend', callbackRemove);
emulateTransitionEnd(this._backdrop, backdropTransitionDuration); emulateTransitionEnd(this._backdrop, backdropTransitionDuration);
} else { } else {
callbackRemove(); callbackRemove();
@ -417,11 +415,11 @@ class Modal extends BaseComponent {
this._element.classList.add(CLASS_NAME_STATIC); this._element.classList.add(CLASS_NAME_STATIC);
const modalTransitionDuration = getTransitionDurationFromElement(this._dialog); const modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
EventHandler.off(this._element, TRANSITION_END); EventHandler.off(this._element, 'transitionend');
EventHandler.one(this._element, TRANSITION_END, () => { EventHandler.one(this._element, 'transitionend', () => {
this._element.classList.remove(CLASS_NAME_STATIC); this._element.classList.remove(CLASS_NAME_STATIC);
if (!isModalOverflowing) { if (!isModalOverflowing) {
EventHandler.one(this._element, TRANSITION_END, () => { EventHandler.one(this._element, 'transitionend', () => {
this._element.style.overflowY = ''; this._element.style.overflowY = '';
}); });
emulateTransitionEnd(this._element, modalTransitionDuration); emulateTransitionEnd(this._element, modalTransitionDuration);
@ -466,69 +464,51 @@ class Modal extends BaseComponent {
_setScrollbar() { _setScrollbar() {
if (this._isBodyOverflowing) { if (this._isBodyOverflowing) {
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set this._setElementAttributes(
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set SELECTOR_FIXED_CONTENT,
'paddingRight',
// Adjust fixed content padding (calculatedValue) => calculatedValue + this._scrollbarWidth
SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach((element) => { );
const actualPadding = element.style.paddingRight; this._setElementAttributes(
const calculatedPadding = window.getComputedStyle(element)['padding-right']; SELECTOR_STICKY_CONTENT,
Manipulator.setDataAttribute(element, 'padding-right', actualPadding); 'marginRight',
element.style.paddingRight = `${ (calculatedValue) => calculatedValue - this._scrollbarWidth
Number.parseFloat(calculatedPadding) + this._scrollbarWidth );
}px`; this._setElementAttributes(
}); 'body',
'paddingRight',
// Adjust sticky content margin (calculatedValue) => calculatedValue + this._scrollbarWidth
SelectorEngine.find(SELECTOR_STICKY_CONTENT).forEach((element) => { );
const actualMargin = element.style.marginRight;
const calculatedMargin = window.getComputedStyle(element)['margin-right'];
Manipulator.setDataAttribute(element, 'margin-right', actualMargin);
element.style.marginRight = `${
Number.parseFloat(calculatedMargin) - this._scrollbarWidth
}px`;
});
// Adjust body padding
const actualPadding = document.body.style.paddingRight;
const calculatedPadding = window.getComputedStyle(document.body)['padding-right'];
Manipulator.setDataAttribute(document.body, 'padding-right', actualPadding);
document.body.style.paddingRight = `${
Number.parseFloat(calculatedPadding) + this._scrollbarWidth
}px`;
} }
document.body.classList.add(CLASS_NAME_OPEN); document.body.classList.add(CLASS_NAME_OPEN);
} }
_setElementAttributes(selector, styleProp, callback) {
SelectorEngine.find(selector).forEach((element) => {
const actualValue = element.style[styleProp];
const calculatedValue = window.getComputedStyle(element)[styleProp];
Manipulator.setDataAttribute(element, styleProp, actualValue);
element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px';
});
}
_resetScrollbar() { _resetScrollbar() {
// Restore fixed content padding this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
SelectorEngine.find(SELECTOR_FIXED_CONTENT).forEach((element) => { this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
const padding = Manipulator.getDataAttribute(element, 'padding-right'); this._resetElementAttributes('body', 'paddingRight');
if (typeof padding !== 'undefined') {
Manipulator.removeDataAttribute(element, 'padding-right');
element.style.paddingRight = padding;
} }
});
// Restore sticky content and navbar-toggler margin _resetElementAttributes(selector, styleProp) {
SelectorEngine.find(`${SELECTOR_STICKY_CONTENT}`).forEach((element) => { SelectorEngine.find(selector).forEach((element) => {
const margin = Manipulator.getDataAttribute(element, 'margin-right'); const value = Manipulator.getDataAttribute(element, styleProp);
if (typeof margin !== 'undefined') { if (typeof value === 'undefined' && element === document.body) {
Manipulator.removeDataAttribute(element, 'margin-right'); element.style[styleProp] = '';
element.style.marginRight = margin;
}
});
// Restore body padding
const padding = Manipulator.getDataAttribute(document.body, 'padding-right');
if (typeof padding === 'undefined') {
document.body.style.paddingRight = '';
} else { } else {
Manipulator.removeDataAttribute(document.body, 'padding-right'); Manipulator.removeDataAttribute(element, styleProp);
document.body.style.paddingRight = padding; element.style[styleProp] = value;
} }
});
} }
_getScrollbarWidth() { _getScrollbarWidth() {
@ -603,7 +583,7 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
data = new Modal(target, config); data = new Modal(target, config);
} }
data.show(this); data.toggle(this);
}); });
/** /**
@ -613,18 +593,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Modal to jQuery only if jQuery is present * add .Modal to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Modal);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Modal.jQueryInterface;
$.fn[NAME].Constructor = Modal;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Modal.jQueryInterface;
};
}
});
export default Modal; export default Modal;

View File

@ -1,11 +1,11 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): popover.js * Bootstrap (v5.0.0-beta2): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { getjQuery, onDOMContentLoaded } from './util/index'; import { defineJQueryPlugin } from './util/index';
import Data from './dom/data'; import Data from './dom/data';
import SelectorEngine from './dom/selector-engine'; import SelectorEngine from './dom/selector-engine';
import Tooltip from './tooltip'; import Tooltip from './tooltip';
@ -25,6 +25,7 @@ const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
const Default = { const Default = {
...Tooltip.Default, ...Tooltip.Default,
placement: 'right', placement: 'right',
offset: [0, 8],
trigger: 'click', trigger: 'click',
content: '', content: '',
template: template:
@ -165,18 +166,6 @@ class Popover extends Tooltip {
* add .Popover to jQuery only if jQuery is present * add .Popover to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Popover);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Popover.jQueryInterface;
$.fn[NAME].Constructor = Popover;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Popover.jQueryInterface;
};
}
});
export default Popover; export default Popover;

View File

@ -1,13 +1,12 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): scrollspy.js * Bootstrap (v5.0.0-beta2): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
getSelectorFromElement, getSelectorFromElement,
getUID, getUID,
isElement, isElement,
@ -77,7 +76,7 @@ class ScrollSpy extends BaseComponent {
this._activeTarget = null; this._activeTarget = null;
this._scrollHeight = 0; this._scrollHeight = 0;
EventHandler.on(this._scrollElement, EVENT_SCROLL, (event) => this._process(event)); EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process());
this.refresh(); this.refresh();
this._process(); this._process();
@ -314,18 +313,6 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
* add .ScrollSpy to jQuery only if jQuery is present * add .ScrollSpy to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, ScrollSpy);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = ScrollSpy.jQueryInterface;
$.fn[NAME].Constructor = ScrollSpy;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return ScrollSpy.jQueryInterface;
};
}
});
export default ScrollSpy; export default ScrollSpy;

View File

@ -1,14 +1,12 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): tab.js * Bootstrap (v5.0.0-beta2): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
getElementFromSelector, getElementFromSelector,
getTransitionDurationFromElement, getTransitionDurationFromElement,
@ -89,13 +87,11 @@ class Tab extends BaseComponent {
previous = previous[previous.length - 1]; previous = previous[previous.length - 1];
} }
let hideEvent = null; const hideEvent = previous
? EventHandler.trigger(previous, EVENT_HIDE, {
if (previous) {
hideEvent = EventHandler.trigger(previous, EVENT_HIDE, {
relatedTarget: this._element, relatedTarget: this._element,
}); })
} : null;
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, { const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {
relatedTarget: previous, relatedTarget: previous,
@ -140,7 +136,7 @@ class Tab extends BaseComponent {
const transitionDuration = getTransitionDurationFromElement(active); const transitionDuration = getTransitionDurationFromElement(active);
active.classList.remove(CLASS_NAME_SHOW); active.classList.remove(CLASS_NAME_SHOW);
EventHandler.one(active, TRANSITION_END, complete); EventHandler.one(active, 'transitionend', complete);
emulateTransitionEnd(active, transitionDuration); emulateTransitionEnd(active, transitionDuration);
} else { } else {
complete(); complete();
@ -230,18 +226,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Tab to jQuery only if jQuery is present * add .Tab to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Tab);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Tab.jQueryInterface;
$.fn[NAME].Constructor = Tab;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Tab.jQueryInterface;
};
}
});
export default Tab; export default Tab;

View File

@ -1,14 +1,12 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): toast.js * Bootstrap (v5.0.0-beta2): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
getTransitionDurationFromElement, getTransitionDurationFromElement,
reflow, reflow,
@ -117,7 +115,7 @@ class Toast extends BaseComponent {
if (this._config.animation) { if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete); EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
} else { } else {
complete(); complete();
@ -144,7 +142,7 @@ class Toast extends BaseComponent {
if (this._config.animation) { if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element); const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete); EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration); emulateTransitionEnd(this._element, transitionDuration);
} else { } else {
complete(); complete();
@ -216,18 +214,6 @@ class Toast extends BaseComponent {
* add .Toast to jQuery only if jQuery is present * add .Toast to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Toast);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Toast.jQueryInterface;
$.fn[NAME].Constructor = Toast;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Toast.jQueryInterface;
};
}
});
export default Toast; export default Toast;

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): tooltip.js * Bootstrap (v5.0.0-beta2): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -8,9 +8,7 @@
import * as Popper from '@popperjs/core'; import * as Popper from '@popperjs/core';
import { import {
getjQuery, defineJQueryPlugin,
onDOMContentLoaded,
TRANSITION_END,
emulateTransitionEnd, emulateTransitionEnd,
findShadowRoot, findShadowRoot,
getTransitionDurationFromElement, getTransitionDurationFromElement,
@ -49,14 +47,15 @@ const DefaultType = {
html: 'boolean', html: 'boolean',
selector: '(string|boolean)', selector: '(string|boolean)',
placement: '(string|function)', placement: '(string|function)',
offset: '(array|string|function)',
container: '(string|element|boolean)', container: '(string|element|boolean)',
fallbackPlacements: '(null|array)', fallbackPlacements: 'array',
boundary: '(string|element)', boundary: '(string|element)',
customClass: '(string|function)', customClass: '(string|function)',
sanitize: 'boolean', sanitize: 'boolean',
sanitizeFn: '(null|function)', sanitizeFn: '(null|function)',
allowList: 'object', allowList: 'object',
popperConfig: '(null|object)', popperConfig: '(null|object|function)',
}; };
const AttachmentMap = { const AttachmentMap = {
@ -80,8 +79,9 @@ const Default = {
html: false, html: false,
selector: false, selector: false,
placement: 'top', placement: 'top',
offset: [0, 0],
container: false, container: false,
fallbackPlacements: null, fallbackPlacements: ['top', 'right', 'bottom', 'left'],
boundary: 'clippingParents', boundary: 'clippingParents',
customClass: '', customClass: '',
sanitize: true, sanitize: true,
@ -191,13 +191,7 @@ class Tooltip extends BaseComponent {
} }
if (event) { if (event) {
const dataKey = this.constructor.DATA_KEY; const context = this._initializeOnDelegatedTarget(event);
let context = Data.getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data.setData(event.delegateTarget, dataKey, context);
}
context._activeTrigger.click = !context._activeTrigger.click; context._activeTrigger.click = !context._activeTrigger.click;
@ -226,7 +220,7 @@ class Tooltip extends BaseComponent {
this._hideModalHandler this._hideModalHandler
); );
if (this.tip) { if (this.tip && this.tip.parentNode) {
this.tip.parentNode.removeChild(this.tip); this.tip.parentNode.removeChild(this.tip);
} }
@ -249,7 +243,10 @@ class Tooltip extends BaseComponent {
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)) {
return;
}
const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW); const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
const shadowRoot = findShadowRoot(this._element); const shadowRoot = findShadowRoot(this._element);
const isInTheDom = const isInTheDom =
@ -325,13 +322,12 @@ class Tooltip extends BaseComponent {
if (this.tip.classList.contains(CLASS_NAME_FADE)) { if (this.tip.classList.contains(CLASS_NAME_FADE)) {
const transitionDuration = getTransitionDurationFromElement(this.tip); const transitionDuration = getTransitionDurationFromElement(this.tip);
EventHandler.one(this.tip, TRANSITION_END, complete); EventHandler.one(this.tip, 'transitionend', complete);
emulateTransitionEnd(this.tip, transitionDuration); emulateTransitionEnd(this.tip, transitionDuration);
} else { } else {
complete(); complete();
} }
} }
}
hide() { hide() {
if (!this._popper) { if (!this._popper) {
@ -376,7 +372,7 @@ class Tooltip extends BaseComponent {
if (this.tip.classList.contains(CLASS_NAME_FADE)) { if (this.tip.classList.contains(CLASS_NAME_FADE)) {
const transitionDuration = getTransitionDurationFromElement(tip); const transitionDuration = getTransitionDurationFromElement(tip);
EventHandler.one(tip, TRANSITION_END, complete); EventHandler.one(tip, 'transitionend', complete);
emulateTransitionEnd(tip, transitionDuration); emulateTransitionEnd(tip, transitionDuration);
} else { } else {
complete(); complete();
@ -476,26 +472,53 @@ class Tooltip extends BaseComponent {
// Private // Private
_initializeOnDelegatedTarget(event, context) {
const dataKey = this.constructor.DATA_KEY;
context = context || Data.getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data.setData(event.delegateTarget, dataKey, context);
}
return context;
}
_getOffset() {
const { offset } = this.config;
if (typeof offset === 'string') {
return offset.split(',').map((val) => Number.parseInt(val, 10));
}
if (typeof offset === 'function') {
return (popperData) => offset(popperData, this._element);
}
return offset;
}
_getPopperConfig(attachment) { _getPopperConfig(attachment) {
const flipModifier = { const defaultBsPopperConfig = {
placement: attachment,
modifiers: [
{
name: 'flip', name: 'flip',
options: { options: {
altBoundary: true, altBoundary: true,
fallbackPlacements: this.config.fallbackPlacements,
},
},
{
name: 'offset',
options: {
offset: this._getOffset(),
},
}, },
};
if (this.config.fallbackPlacements) {
flipModifier.options.fallbackPlacements = this.config.fallbackPlacements;
}
const defaultBsConfig = {
placement: attachment,
modifiers: [
flipModifier,
{ {
name: 'preventOverflow', name: 'preventOverflow',
options: { options: {
rootBoundary: this.config.boundary, boundary: this.config.boundary,
}, },
}, },
{ {
@ -519,8 +542,10 @@ class Tooltip extends BaseComponent {
}; };
return { return {
...defaultBsConfig, ...defaultBsPopperConfig,
...this.config.popperConfig, ...(typeof this.config.popperConfig === 'function'
? this.config.popperConfig(defaultBsPopperConfig)
: this.config.popperConfig),
}; };
} }
@ -612,13 +637,7 @@ class Tooltip extends BaseComponent {
} }
_enter(event, context) { _enter(event, context) {
const dataKey = this.constructor.DATA_KEY; context = this._initializeOnDelegatedTarget(event, context);
context = context || Data.getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data.setData(event.delegateTarget, dataKey, context);
}
if (event) { if (event) {
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
@ -649,13 +668,7 @@ class Tooltip extends BaseComponent {
} }
_leave(event, context) { _leave(event, context) {
const dataKey = this.constructor.DATA_KEY; context = this._initializeOnDelegatedTarget(event, context);
context = context || Data.getData(event.delegateTarget, dataKey);
if (!context) {
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
Data.setData(event.delegateTarget, dataKey, context);
}
if (event) { if (event) {
context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false; context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false;
@ -801,18 +814,6 @@ class Tooltip extends BaseComponent {
* add .Tooltip to jQuery only if jQuery is present * add .Tooltip to jQuery only if jQuery is present
*/ */
onDOMContentLoaded(() => { defineJQueryPlugin(NAME, Tooltip);
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[NAME];
$.fn[NAME] = Tooltip.jQueryInterface;
$.fn[NAME].Constructor = Tooltip;
$.fn[NAME].noConflict = () => {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return Tooltip.jQueryInterface;
};
}
});
export default Tooltip; export default Tooltip;

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -195,6 +195,22 @@ const onDOMContentLoaded = (callback) => {
const isRTL = document.documentElement.dir === 'rtl'; const isRTL = document.documentElement.dir === 'rtl';
const defineJQueryPlugin = (name, plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
$.fn[name].noConflict = () => {
$.fn[name] = JQUERY_NO_CONFLICT;
return plugin.jQueryInterface;
};
}
});
};
export { export {
TRANSITION_END, TRANSITION_END,
getUID, getUID,
@ -212,4 +228,5 @@ export {
getjQuery, getjQuery,
onDOMContentLoaded, onDOMContentLoaded,
isRTL, isRTL,
defineJQueryPlugin,
}; };

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/sanitizer.js * Bootstrap (v5.0.0-beta2): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -17,9 +17,9 @@ const EVENT_KEY = `.${DATA_KEY}`;
const SELECTOR_EXPAND = '[data-mdb-toggle="dropdown"]'; const SELECTOR_EXPAND = '[data-mdb-toggle="dropdown"]';
const Default = { const Default = {
offset: 0, offset: [0, 2],
flip: true, flip: true,
boundary: 'scrollParent', boundary: 'clippingParents',
reference: 'toggle', reference: 'toggle',
display: 'dynamic', display: 'dynamic',
popperConfig: null, popperConfig: null,
@ -27,12 +27,12 @@ const Default = {
}; };
const DefaultType = { const DefaultType = {
offset: '(number|string|function)', offset: '(array|string|function)',
flip: 'boolean', flip: 'boolean',
boundary: '(string|element)', boundary: '(string|element)',
reference: '(string|element)', reference: '(string|element|object)',
display: 'string', display: 'string',
popperConfig: '(null|object)', popperConfig: '(null|object|function)',
dropdownAnimation: 'string', dropdownAnimation: 'string',
}; };
@ -57,6 +57,7 @@ class Dropdown extends BSDropdown {
this._parent = Dropdown.getParentFromElement(this._element); this._parent = Dropdown.getParentFromElement(this._element);
this._menuStyle = ''; this._menuStyle = '';
this._popperPlacement = ''; this._popperPlacement = '';
this._mdbPopperConfig = '';
//* prevents dropdown close issue when system animation is turned off //* prevents dropdown close issue when system animation is turned off
const isPrefersReducedMotionSet = window.matchMedia('(prefers-reduced-motion: reduce)').matches; const isPrefersReducedMotionSet = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
@ -98,14 +99,14 @@ class Dropdown extends BSDropdown {
} }
_getOffset() { _getOffset() {
const offset = []; const { offset } = this._config;
if (Manipulator.getDataAttribute(this._element, 'offset')) { if (typeof offset === 'string') {
Manipulator.getDataAttribute(this._element, 'offset') return offset.split(',').map((val) => Number.parseInt(val, 10));
.split(',') }
.forEach((value) => {
offset.push(parseInt(value, 10)); if (typeof offset === 'function') {
}); return (popperData) => offset(popperData, this._element);
} }
return offset; return offset;
@ -119,7 +120,7 @@ class Dropdown extends BSDropdown {
name: 'preventOverflow', name: 'preventOverflow',
options: { options: {
altBoundary: this._config.flip, altBoundary: this._config.flip,
rootBoundary: this._config.boundary, boundary: this._config.boundary,
}, },
}, },
{ {
@ -143,7 +144,10 @@ class Dropdown extends BSDropdown {
return { return {
...popperConfig, ...popperConfig,
...this._config.popperConfig, /* eslint no-extra-parens: "off" */
...(typeof this._config.popperConfig === 'function'
? this._config.popperConfig(popperConfig)
: this._config.popperConfig),
}; };
} }
@ -167,6 +171,7 @@ class Dropdown extends BSDropdown {
this._menuStyle = this._menu.style.cssText; this._menuStyle = this._menu.style.cssText;
this._popperPlacement = this._menu.getAttribute('data-popper-placement'); this._popperPlacement = this._menu.getAttribute('data-popper-placement');
this._mdbPopperConfig = this._menu.getAttribute('data-mdb-popper');
}); });
} }
@ -179,6 +184,7 @@ class Dropdown extends BSDropdown {
} }
this._menu.setAttribute('data-popper-placement', this._popperPlacement); this._menu.setAttribute('data-popper-placement', this._popperPlacement);
this._menu.setAttribute('data-mdb-popper', this._mdbPopperConfig);
this._dropdownAnimationStart('hide'); this._dropdownAnimationStart('hide');
}); });

View File

@ -318,20 +318,23 @@ EventHandler.on(window, 'shown.bs.modal', (e) => {
}); });
EventHandler.on(window, 'shown.bs.dropdown', (e) => { EventHandler.on(window, 'shown.bs.dropdown', (e) => {
SelectorEngine.find(SELECTOR_OUTLINE_INPUT, e.target).forEach((element) => { const target = e.target.parentNode.querySelector('.dropdown-menu');
if (target) {
SelectorEngine.find(SELECTOR_OUTLINE_INPUT, target).forEach((element) => {
const instance = Input.getInstance(element.parentNode); const instance = Input.getInstance(element.parentNode);
if (!instance) { if (!instance) {
return; return;
} }
instance.update(); instance.update();
}); });
SelectorEngine.find(SELECTOR_OUTLINE_TEXTAREA, e.target).forEach((element) => { SelectorEngine.find(SELECTOR_OUTLINE_TEXTAREA, target).forEach((element) => {
const instance = Input.getInstance(element.parentNode); const instance = Input.getInstance(element.parentNode);
if (!instance) { if (!instance) {
return; return;
} }
instance.update(); instance.update();
}); });
}
}); });
EventHandler.on(window, 'shown.bs.tab', (e) => { EventHandler.on(window, 'shown.bs.tab', (e) => {

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/data.js * Bootstrap (v5.0.0-beta2): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/event-handler.js * Bootstrap (v5.0.0-beta2): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/manipulator.js * Bootstrap (v5.0.0-beta2): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): dom/selector-engine.js * Bootstrap (v5.0.0-beta2): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/index.js * Bootstrap (v5.0.0-beta2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@ -203,6 +203,22 @@ const element = (tag) => {
return document.createElement(tag); return document.createElement(tag);
}; };
const defineJQueryPlugin = (name, plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
$.fn[name].noConflict = () => {
$.fn[name] = JQUERY_NO_CONFLICT;
return plugin.jQueryInterface;
};
}
});
};
export { export {
getjQuery, getjQuery,
TRANSITION_END, TRANSITION_END,
@ -222,4 +238,5 @@ export {
element, element,
onDOMContentLoaded, onDOMContentLoaded,
isRTL, isRTL,
defineJQueryPlugin,
}; };

View File

@ -1,6 +1,6 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.0.0-beta1): util/sanitizer.js * Bootstrap (v5.0.0-beta2): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */

View File

@ -10,6 +10,7 @@
padding: $accordion-button-padding-y $accordion-button-padding-x; padding: $accordion-button-padding-y $accordion-button-padding-x;
@include font-size($font-size-base); @include font-size($font-size-base);
color: $accordion-button-color; color: $accordion-button-color;
text-align: left; // Reset button style
background-color: $accordion-button-bg; background-color: $accordion-button-bg;
border: $accordion-border-width solid $accordion-border-color; border: $accordion-border-width solid $accordion-border-color;
@include border-radius(0); @include border-radius(0);

View File

@ -42,14 +42,14 @@
// Generate contextual modifier classes for colorizing the alert. // Generate contextual modifier classes for colorizing the alert.
@each $state, $value in $theme-colors { @each $state, $value in $theme-colors {
$background: shift-color($value, $alert-bg-scale); $alert-background: shift-color($value, $alert-bg-scale);
$border: shift-color($value, $alert-border-scale); $alert-border: shift-color($value, $alert-border-scale);
$color: shift-color($value, $alert-color-scale); $alert-color: shift-color($value, $alert-color-scale);
@if (contrast-ratio($background, $color) < $min-contrast-ratio) { @if (contrast-ratio($alert-background, $alert-color) < $min-contrast-ratio) {
$color: mix($value, color-contrast($background), abs($alert-color-scale)); $alert-color: mix($value, color-contrast($alert-background), abs($alert-color-scale));
} }
.alert-#{$state} { .alert-#{$state} {
@include alert-variant($background, $border, $color); @include alert-variant($alert-background, $alert-border, $alert-color);
} }
} }
// scss-docs-end alert-modifiers // scss-docs-end alert-modifiers

View File

@ -70,7 +70,7 @@
+ .card-link { + .card-link {
/*!rtl:ignore*/ /*!rtl:ignore*/
margin-left: 5px; margin-left: $card-spacer-x;
} }
} }

View File

@ -96,8 +96,11 @@
align-items: center; // 2. vertically center contents align-items: center; // 2. vertically center contents
justify-content: center; // 3. horizontally center contents justify-content: center; // 3. horizontally center contents
width: $carousel-control-width; width: $carousel-control-width;
padding: 0;
color: $carousel-control-color; color: $carousel-control-color;
text-align: center; text-align: center;
background: none;
border: 0;
opacity: $carousel-control-opacity; opacity: $carousel-control-opacity;
@include transition($carousel-control-transition); @include transition($carousel-control-transition);
@ -145,7 +148,7 @@
"search" : "prev", "search" : "prev",
"replace" : "next" "replace" : "next"
} ] } ]
}*/ } */
.carousel-control-prev-icon { .carousel-control-prev-icon {
background-image: escape-svg($carousel-control-prev-icon-bg); background-image: escape-svg($carousel-control-prev-icon-bg);
} }
@ -153,10 +156,10 @@
background-image: escape-svg($carousel-control-next-icon-bg); background-image: escape-svg($carousel-control-next-icon-bg);
} }
// Optional indicator pips // Optional indicator pips/controls
// //
// Add an ordered list with the following class and add a list item for each // Add a container (such as a list) with the following class and add an item (ideally a focusable control,
// slide your carousel holds. // like a button) with data-mdb-target for each slide your carousel holds.
.carousel-indicators { .carousel-indicators {
position: absolute; position: absolute;
@ -166,23 +169,26 @@
z-index: 2; z-index: 2;
display: flex; display: flex;
justify-content: center; justify-content: center;
padding-left: 0; // override <ol> default padding: 0;
// Use the .carousel-control's width as margin so we don't overlay those // Use the .carousel-control's width as margin so we don't overlay those
margin-right: $carousel-control-width; margin-right: $carousel-control-width;
margin-bottom: 1rem;
margin-left: $carousel-control-width; margin-left: $carousel-control-width;
list-style: none; list-style: none;
li { [data-mdb-target] {
box-sizing: content-box; box-sizing: content-box;
flex: 0 1 auto; flex: 0 1 auto;
width: $carousel-indicator-width; width: $carousel-indicator-width;
height: $carousel-indicator-height; height: $carousel-indicator-height;
padding: 0;
margin-right: $carousel-indicator-spacer; margin-right: $carousel-indicator-spacer;
margin-left: $carousel-indicator-spacer; margin-left: $carousel-indicator-spacer;
text-indent: -999px; text-indent: -999px;
cursor: pointer; cursor: pointer;
background-color: $carousel-indicator-active-bg; background-color: $carousel-indicator-active-bg;
background-clip: padding-box; background-clip: padding-box;
border: 0;
// Use transparent borders to increase the hit area by 10px on top and bottom. // Use transparent borders to increase the hit area by 10px on top and bottom.
border-top: $carousel-indicator-hit-area-height solid transparent; border-top: $carousel-indicator-hit-area-height solid transparent;
border-bottom: $carousel-indicator-hit-area-height solid transparent; border-bottom: $carousel-indicator-hit-area-height solid transparent;
@ -218,7 +224,7 @@
filter: $carousel-dark-control-icon-filter; filter: $carousel-dark-control-icon-filter;
} }
.carousel-indicators li { .carousel-indicators [data-mdb-target] {
background-color: $carousel-dark-indicator-active-bg; background-color: $carousel-dark-indicator-active-bg;
} }

View File

@ -22,7 +22,7 @@
} }
&:focus { &:focus {
outline: none; outline: 0;
box-shadow: $btn-close-focus-shadow; box-shadow: $btn-close-focus-shadow;
opacity: $btn-close-focus-opacity; opacity: $btn-close-focus-opacity;
} }

View File

@ -17,12 +17,11 @@
.dropdown-menu { .dropdown-menu {
position: absolute; position: absolute;
top: 100%; top: 100%;
left: 0;
z-index: $zindex-dropdown; z-index: $zindex-dropdown;
display: none; // none by default, but block on "open" of the menu display: none; // none by default, but block on "open" of the menu
min-width: $dropdown-min-width; min-width: $dropdown-min-width;
padding: $dropdown-padding-y $dropdown-padding-x; padding: $dropdown-padding-y $dropdown-padding-x;
margin: $dropdown-spacer 0 0; // override default ul margin: 0; // Override default margin of ul
@include font-size($dropdown-font-size); @include font-size($dropdown-font-size);
color: $dropdown-color; color: $dropdown-color;
text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer) text-align: left; // Ensures proper alignment if parent has it changed (e.g., modal footer)
@ -33,9 +32,9 @@
@include border-radius($dropdown-border-radius); @include border-radius($dropdown-border-radius);
@include box-shadow($dropdown-box-shadow); @include box-shadow($dropdown-box-shadow);
// Reset positioning when positioned with Popper &[data-mdb-popper] {
&[style] { left: 0;
right: auto !important; // stylelint-disable-line declaration-no-important margin-top: $dropdown-spacer;
} }
} }
@ -49,20 +48,26 @@
.dropdown-menu#{$infix}-start { .dropdown-menu#{$infix}-start {
--bs-position: start; --bs-position: start;
&[data-mdb-popper] {
/*!rtl:ignore*/ /*!rtl:ignore*/
right: auto; right: auto;
/*!rtl:ignore*/ /*!rtl:ignore*/
left: 0; left: 0;
} }
}
.dropdown-menu#{$infix}-end { .dropdown-menu#{$infix}-end {
--bs-position: end; --bs-position: end;
&[data-mdb-popper] {
/*!rtl:ignore*/ /*!rtl:ignore*/
right: 0; right: 0;
/*!rtl:ignore*/ /*!rtl:ignore*/
left: auto; left: auto;
} }
} }
}
} }
// scss-docs-end responsive-breakpoints // scss-docs-end responsive-breakpoints
@ -72,9 +77,12 @@
.dropdown-menu { .dropdown-menu {
top: auto; top: auto;
bottom: 100%; bottom: 100%;
&[data-mdb-popper] {
margin-top: 0; margin-top: 0;
margin-bottom: $dropdown-spacer; margin-bottom: $dropdown-spacer;
} }
}
.dropdown-toggle { .dropdown-toggle {
@include caret(up); @include caret(up);
@ -86,9 +94,12 @@
top: 0; top: 0;
right: auto; right: auto;
left: 100%; left: 100%;
&[data-mdb-popper] {
margin-top: 0; margin-top: 0;
margin-left: $dropdown-spacer; margin-left: $dropdown-spacer;
} }
}
.dropdown-toggle { .dropdown-toggle {
@include caret(end); @include caret(end);
@ -103,9 +114,12 @@
top: 0; top: 0;
right: 100%; right: 100%;
left: auto; left: auto;
&[data-mdb-popper] {
margin-top: 0; margin-top: 0;
margin-right: $dropdown-spacer; margin-right: $dropdown-spacer;
} }
}
.dropdown-toggle { .dropdown-toggle {
@include caret(start); @include caret(start);

View File

@ -147,12 +147,12 @@
// Organizationally, this must come after the `:hover` states. // Organizationally, this must come after the `:hover` states.
@each $state, $value in $theme-colors { @each $state, $value in $theme-colors {
$background: shift-color($value, $list-group-item-bg-scale); $list-group-background: shift-color($value, $list-group-item-bg-scale);
$color: shift-color($value, $list-group-item-color-scale); $list-group-color: shift-color($value, $list-group-item-color-scale);
@if (contrast-ratio($background, $color) < $min-contrast-ratio) { @if (contrast-ratio($list-group-background, $list-group-color) < $min-contrast-ratio) {
$color: mix($value, color-contrast($background), abs($alert-color-scale)); $list-group-color: mix($value, color-contrast($list-group-background), abs($alert-color-scale));
} }
@include list-group-item-variant($state, $background, $color); @include list-group-item-variant($state, $list-group-background, $list-group-color);
} }
// scss-docs-end list-group-modifiers // scss-docs-end list-group-modifiers

View File

@ -43,12 +43,15 @@
.nav-link { .nav-link {
margin-bottom: -$nav-tabs-border-width; margin-bottom: -$nav-tabs-border-width;
background: none;
border: $nav-tabs-border-width solid transparent; border: $nav-tabs-border-width solid transparent;
@include border-top-radius($nav-tabs-border-radius); @include border-top-radius($nav-tabs-border-radius);
&:hover, &:hover,
&:focus { &:focus {
border-color: $nav-tabs-link-hover-border-color; border-color: $nav-tabs-link-hover-border-color;
// Prevents active .nav-link tab overlapping focus outline of previous/next .nav-link
isolation: isolate;
} }
&.disabled { &.disabled {
@ -79,6 +82,8 @@
.nav-pills { .nav-pills {
.nav-link { .nav-link {
background: none;
border: 0;
@include border-radius($nav-pills-border-radius); @include border-radius($nav-pills-border-radius);
} }

View File

@ -104,10 +104,11 @@
// the default flexbox row orientation. Requires the use of `flex-wrap: wrap` // the default flexbox row orientation. Requires the use of `flex-wrap: wrap`
// on the `.navbar` parent. // on the `.navbar` parent.
.navbar-collapse { .navbar-collapse {
flex-basis: 100%;
flex-grow: 1;
// For always expanded or extra full navbars, ensure content aligns itself // For always expanded or extra full navbars, ensure content aligns itself
// properly vertically. Can be easily overridden with flex utilities. // properly vertically. Can be easily overridden with flex utilities.
align-items: center; align-items: center;
width: 100%;
} }
// Button for toggling the navbar when in its collapsed state // Button for toggling the navbar when in its collapsed state
@ -143,6 +144,11 @@
background-size: 100%; background-size: 100%;
} }
.navbar-nav-scroll {
max-height: var(--#{$variable-prefix}scroll-height, 75vh);
overflow-y: auto;
}
// Generate series of `.navbar-expand-*` responsive classes for configuring // Generate series of `.navbar-expand-*` responsive classes for configuring
// where your navbar collapses. // where your navbar collapses.
.navbar-expand { .navbar-expand {
@ -169,8 +175,13 @@
} }
} }
.navbar-nav-scroll {
overflow: visible;
}
.navbar-collapse { .navbar-collapse {
display: flex !important; // stylelint-disable-line declaration-no-important display: flex !important; // stylelint-disable-line declaration-no-important
flex-basis: auto;
} }
.navbar-toggler { .navbar-toggler {

View File

@ -64,7 +64,7 @@
$pagination-padding-y-lg, $pagination-padding-y-lg,
$pagination-padding-x-lg, $pagination-padding-x-lg,
$font-size-lg, $font-size-lg,
$border-radius-lg $pagination-border-radius-lg
); );
} }
@ -73,6 +73,6 @@
$pagination-padding-y-sm, $pagination-padding-y-sm,
$pagination-padding-x-sm, $pagination-padding-x-sm,
$font-size-sm, $font-size-sm,
$border-radius-sm $pagination-border-radius-sm
); );
} }

View File

@ -23,7 +23,6 @@
display: block; display: block;
width: $popover-arrow-width; width: $popover-arrow-width;
height: $popover-arrow-height; height: $popover-arrow-height;
margin: 0 $popover-border-radius;
&::before, &::before,
&::after { &::after {
@ -37,9 +36,6 @@
} }
.bs-popover-top { .bs-popover-top {
// Overrule margin set by popper.js
margin-bottom: $popover-arrow-height !important; // stylelint-disable-line declaration-no-important
> .popover-arrow { > .popover-arrow {
bottom: subtract(-$popover-arrow-height, $popover-border-width); bottom: subtract(-$popover-arrow-height, $popover-border-width);
@ -58,14 +54,10 @@
} }
.bs-popover-end { .bs-popover-end {
// Overrule margin set by popper.js
margin-left: $popover-arrow-height !important; // stylelint-disable-line declaration-no-important
> .popover-arrow { > .popover-arrow {
left: subtract(-$popover-arrow-height, $popover-border-width); left: subtract(-$popover-arrow-height, $popover-border-width);
width: $popover-arrow-height; width: $popover-arrow-height;
height: $popover-arrow-width; height: $popover-arrow-width;
margin: $popover-border-radius 0; // make sure the arrow does not touch the popover's rounded corners
&::before { &::before {
left: 0; left: 0;
@ -82,9 +74,6 @@
} }
.bs-popover-bottom { .bs-popover-bottom {
// Overrule margin set by popper.js
margin-top: $popover-arrow-height !important; // stylelint-disable-line declaration-no-important
> .popover-arrow { > .popover-arrow {
top: subtract(-$popover-arrow-height, $popover-border-width); top: subtract(-$popover-arrow-height, $popover-border-width);
@ -115,14 +104,10 @@
} }
.bs-popover-start { .bs-popover-start {
// Overrule margin set by popper.js
margin-right: $popover-arrow-height !important; // stylelint-disable-line declaration-no-important
> .popover-arrow { > .popover-arrow {
right: subtract(-$popover-arrow-height, $popover-border-width); right: subtract(-$popover-arrow-height, $popover-border-width);
width: $popover-arrow-height; width: $popover-arrow-height;
height: $popover-arrow-width; height: $popover-arrow-width;
margin: $popover-border-radius 0; // make sure the arrow does not touch the popover's rounded corners
&::before { &::before {
right: 0; right: 0;

View File

@ -140,13 +140,13 @@ p {
// Abbreviations // Abbreviations
// //
// 1. Duplicate behavior to the data-bs-* attribute for our tooltip plugin // 1. Duplicate behavior to the data-mdb-* attribute for our tooltip plugin
// 2. Add the correct text decoration in Chrome, Edge, Opera, and Safari. // 2. Add the correct text decoration in Chrome, Edge, Opera, and Safari.
// 3. Add explicit cursor to indicate changed behavior. // 3. Add explicit cursor to indicate changed behavior.
// 4. Prevent the text-decoration to be skipped. // 4. Prevent the text-decoration to be skipped.
abbr[title], abbr[title],
abbr[data-bs-original-title] { abbr[data-mdb-original-title] {
// 1 // 1
text-decoration: underline; // 2 text-decoration: underline; // 2
text-decoration: underline dotted; // 2 text-decoration: underline dotted; // 2
@ -395,13 +395,13 @@ button {
border-radius: 0; border-radius: 0;
} }
// Work around a Firefox bug where the transparent `button` background // Explicitly remove focus outline in Chromium when it shouldn't be
// results in a loss of the default `button` focus styles. // visible (e.g. as result of mouse click or touch tap). It already
// Credit https://github.com/suitcss/base/ // should be doing this automatically, but seems to currently be
// confused and applies its very visible two-tone outline anyway.
button:focus { button:focus:not(:focus-visible) {
outline: dotted 1px; outline: 0;
outline: -webkit-focus-ring-color auto 5px;
} }
// 1. Remove the margin in Firefox and Safari // 1. Remove the margin in Firefox and Safari

View File

@ -3,8 +3,8 @@
// //
@keyframes spinner-border { @keyframes spinner-border {
to {
/*!rtl:ignore*/ /*!rtl:ignore*/
to {
transform: rotate(360deg); transform: rotate(360deg);
} }
} }

View File

@ -25,11 +25,8 @@
> :not(caption) > * > * { > :not(caption) > * > * {
padding: $table-cell-padding-y $table-cell-padding-x; padding: $table-cell-padding-y $table-cell-padding-x;
background-color: var(--#{$variable-prefix}table-bg); background-color: var(--#{$variable-prefix}table-bg);
background-image: linear-gradient(
var(--#{$variable-prefix}table-accent-bg),
var(--#{$variable-prefix}table-accent-bg)
);
border-bottom-width: $table-border-width; border-bottom-width: $table-border-width;
box-shadow: inset 0 0 0 9999px var(--#{$variable-prefix}table-accent-bg);
} }
> tbody { > tbody {

View File

@ -47,4 +47,5 @@
.toast-body { .toast-body {
padding: $toast-padding-x; // apply to both vertical and horizontal padding: $toast-padding-x; // apply to both vertical and horizontal
word-wrap: break-word;
} }

Some files were not shown because too many files have changed in this diff Show More