release 3.7.0

This commit is contained in:
Grzegorz 2021-05-31 09:59:29 +02:00
parent 5f3c59fdab
commit ff89bd3201
118 changed files with 1423 additions and 1669 deletions

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

10
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

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",
"version": "3.6.0",
"version": "3.7.0",
"main": "js/mdb.min.js",
"homepage": "https://mdbootstrap.com/docs/standard/",
"repository": "https://github.com/mdbootstrap/mdb-ui-kit.git",

View File

@ -1,20 +1,31 @@
/*!
* Bootstrap alert.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap alert.js v5.0.1 (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/selector-engine.js'),
require('./dom/data.js'),
require('./dom/event-handler.js'),
require('./base-component.js')
))
: typeof define === 'function' && define.amd
? define(['./dom/data', './dom/event-handler', './base-component'], factory)
? define([
'./dom/selector-engine',
'./dom/data',
'./dom/event-handler',
'./base-component',
], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Alert = factory(global.Data, global.EventHandler, global.Base)));
})(this, function (Data, EventHandler, BaseComponent) {
(global.Alert = factory(
global.SelectorEngine,
global.Data,
global.EventHandler,
global.Base
)));
})(this, function (SelectorEngine, Data, EventHandler, BaseComponent) {
'use strict';
function _interopDefaultLegacy(e) {
@ -25,15 +36,6 @@
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
const getSelector = (element) => {
let selector = element.getAttribute('data-bs-target');
@ -62,49 +64,6 @@
return selector ? document.querySelector(selector) : null;
};
const getTransitionDurationFromElement = (element) => {
if (!element) {
return 0;
} // Get transition-duration of the element
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
const floatTransitionDuration = Number.parseFloat(transitionDuration);
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
if (!floatTransitionDuration && !floatTransitionDelay) {
return 0;
} // If multiple durations are defined, take the first
transitionDuration = transitionDuration.split(',')[0];
transitionDelay = transitionDelay.split(',')[0];
return (
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
MILLISECONDS_MULTIPLIER
);
};
const triggerTransitionEnd = (element) => {
element.dispatchEvent(new Event(TRANSITION_END));
};
const emulateTransitionEnd = (element, duration) => {
let called = false;
const durationPadding = 5;
const emulatedDuration = duration + durationPadding;
function listener() {
called = true;
element.removeEventListener(TRANSITION_END, listener);
}
element.addEventListener(TRANSITION_END, listener);
setTimeout(() => {
if (!called) {
triggerTransitionEnd(element);
}
}, emulatedDuration);
};
const getjQuery = () => {
const { jQuery } = window;
@ -123,12 +82,13 @@
}
};
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -143,7 +103,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): alert.js
* Bootstrap (v5.0.1): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -172,8 +132,8 @@
class Alert extends BaseComponent__default['default'] {
// Getters
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
} // Public
close(element) {
@ -198,18 +158,9 @@
_removeElement(element) {
element.classList.remove(CLASS_NAME_SHOW);
const isAnimated = element.classList.contains(CLASS_NAME_FADE);
if (!element.classList.contains(CLASS_NAME_FADE)) {
this._destroyElement(element);
return;
}
const transitionDuration = getTransitionDurationFromElement(element);
EventHandler__default['default'].one(element, 'transitionend', () =>
this._destroyElement(element)
);
emulateTransitionEnd(element, transitionDuration);
this._queueCallback(() => this._destroyElement(element), element, isAnimated);
}
_destroyElement(element) {
@ -263,7 +214,7 @@
* add .Alert to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Alert);
defineJQueryPlugin(Alert);
return Alert;
});

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,20 @@
/*!
* Bootstrap base-component.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap base-component.js v5.0.1 (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'), require('./dom/event-handler.js')))
? (module.exports = factory(
require('./dom/data.js'),
require('./dom/selector-engine.js'),
require('./dom/event-handler.js')
))
: typeof define === 'function' && define.amd
? define(['./dom/data', './dom/event-handler'], factory)
? define(['./dom/data', './dom/selector-engine', './dom/event-handler'], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Base = factory(global.Data, global.EventHandler)));
})(this, function (Data, EventHandler) {
(global.Base = factory(global.Data, global.SelectorEngine, global.EventHandler)));
})(this, function (Data, SelectorEngine, EventHandler) {
'use strict';
function _interopDefaultLegacy(e) {
@ -18,11 +22,89 @@
}
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
const getTransitionDurationFromElement = (element) => {
if (!element) {
return 0;
} // Get transition-duration of the element
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
const floatTransitionDuration = Number.parseFloat(transitionDuration);
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
if (!floatTransitionDuration && !floatTransitionDelay) {
return 0;
} // If multiple durations are defined, take the first
transitionDuration = transitionDuration.split(',')[0];
transitionDelay = transitionDelay.split(',')[0];
return (
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
MILLISECONDS_MULTIPLIER
);
};
const triggerTransitionEnd = (element) => {
element.dispatchEvent(new Event(TRANSITION_END));
};
const isElement = (obj) => {
if (!obj || typeof obj !== 'object') {
return false;
}
if (typeof obj.jquery !== 'undefined') {
obj = obj[0];
}
return typeof obj.nodeType !== 'undefined';
};
const getElement = (obj) => {
if (isElement(obj)) {
// it's a jQuery object or a node element
return obj.jquery ? obj[0] : obj;
}
if (typeof obj === 'string' && obj.length > 0) {
return SelectorEngine__default['default'].findOne(obj);
}
return null;
};
const emulateTransitionEnd = (element, duration) => {
let called = false;
const durationPadding = 5;
const emulatedDuration = duration + durationPadding;
function listener() {
called = true;
element.removeEventListener(TRANSITION_END, listener);
}
element.addEventListener(TRANSITION_END, listener);
setTimeout(() => {
if (!called) {
triggerTransitionEnd(element);
}
}, emulatedDuration);
};
const execute = (callback) => {
if (typeof callback === 'function') {
callback();
}
};
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): base-component.js
* Bootstrap (v5.0.1): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -32,11 +114,11 @@
* ------------------------------------------------------------------------
*/
const VERSION = '5.0.0';
const VERSION = '5.0.1';
class BaseComponent {
constructor(element) {
element = typeof element === 'string' ? document.querySelector(element) : element;
element = getElement(element);
if (!element) {
return;
@ -48,8 +130,21 @@
dispose() {
Data__default['default'].remove(this._element, this.constructor.DATA_KEY);
EventHandler__default['default'].off(this._element, `.${this.constructor.DATA_KEY}`);
this._element = null;
EventHandler__default['default'].off(this._element, this.constructor.EVENT_KEY);
Object.getOwnPropertyNames(this).forEach((propertyName) => {
this[propertyName] = null;
});
}
_queueCallback(callback, element, isAnimated = true) {
if (!isAnimated) {
execute(callback);
return;
}
const transitionDuration = getTransitionDurationFromElement(element);
EventHandler__default['default'].one(element, 'transitionend', () => execute(callback));
emulateTransitionEnd(element, transitionDuration);
}
/** Static */
@ -60,6 +155,18 @@
static get VERSION() {
return VERSION;
}
static get NAME() {
throw new Error('You have to implement the static method "NAME", for each component!');
}
static get DATA_KEY() {
return `bs.${this.NAME}`;
}
static get EVENT_KEY() {
return `.${this.DATA_KEY}`;
}
}
return BaseComponent;

File diff suppressed because one or more lines are too long

View File

@ -1,20 +1,31 @@
/*!
* Bootstrap button.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap button.js v5.0.1 (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/selector-engine.js'),
require('./dom/data.js'),
require('./dom/event-handler.js'),
require('./base-component.js')
))
: typeof define === 'function' && define.amd
? define(['./dom/data', './dom/event-handler', './base-component'], factory)
? define([
'./dom/selector-engine',
'./dom/data',
'./dom/event-handler',
'./base-component',
], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Button = factory(global.Data, global.EventHandler, global.Base)));
})(this, function (Data, EventHandler, BaseComponent) {
(global.Button = factory(
global.SelectorEngine,
global.Data,
global.EventHandler,
global.Base
)));
})(this, function (SelectorEngine, Data, EventHandler, BaseComponent) {
'use strict';
function _interopDefaultLegacy(e) {
@ -25,13 +36,6 @@
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const getjQuery = () => {
const { jQuery } = window;
@ -50,12 +54,13 @@
}
};
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -70,7 +75,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): button.js
* Bootstrap (v5.0.1): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -95,8 +100,8 @@
class Button extends BaseComponent__default['default'] {
// Getters
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
} // Public
toggle() {
@ -147,7 +152,7 @@
* add .Button to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Button);
defineJQueryPlugin(Button);
return Button;
});

File diff suppressed because one or more lines are too long

View File

@ -1,53 +1,46 @@
/*!
* Bootstrap carousel.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap carousel.js v5.0.1 (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/selector-engine.js'),
require('./dom/data.js'),
require('./dom/event-handler.js'),
require('./dom/manipulator.js'),
require('./dom/selector-engine.js'),
require('./base-component.js')
))
: typeof define === 'function' && define.amd
? define([
'./dom/selector-engine',
'./dom/data',
'./dom/event-handler',
'./dom/manipulator',
'./dom/selector-engine',
'./base-component',
], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Carousel = factory(
global.SelectorEngine,
global.Data,
global.EventHandler,
global.Manipulator,
global.SelectorEngine,
global.Base
)));
})(this, function (Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) {
})(this, function (SelectorEngine, Data, EventHandler, Manipulator, BaseComponent) {
'use strict';
function _interopDefaultLegacy(e) {
return e && typeof e === 'object' && 'default' in e ? e : { default: e };
}
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
const toType = (obj) => {
@ -89,49 +82,20 @@
return selector ? document.querySelector(selector) : null;
};
const getTransitionDurationFromElement = (element) => {
if (!element) {
return 0;
} // Get transition-duration of the element
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
const floatTransitionDuration = Number.parseFloat(transitionDuration);
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
if (!floatTransitionDuration && !floatTransitionDelay) {
return 0;
} // If multiple durations are defined, take the first
transitionDuration = transitionDuration.split(',')[0];
transitionDelay = transitionDelay.split(',')[0];
return (
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
MILLISECONDS_MULTIPLIER
);
};
const triggerTransitionEnd = (element) => {
element.dispatchEvent(new Event(TRANSITION_END));
};
const isElement = (obj) => (obj[0] || obj).nodeType;
const emulateTransitionEnd = (element, duration) => {
let called = false;
const durationPadding = 5;
const emulatedDuration = duration + durationPadding;
function listener() {
called = true;
element.removeEventListener(TRANSITION_END, listener);
const isElement = (obj) => {
if (!obj || typeof obj !== 'object') {
return false;
}
element.addEventListener(TRANSITION_END, listener);
setTimeout(() => {
if (!called) {
triggerTransitionEnd(element);
}
}, emulatedDuration);
if (typeof obj.jquery !== 'undefined') {
obj = obj[0];
}
return typeof obj.nodeType !== 'undefined';
};
const typeCheckConfig = (componentName, config, configTypes) => {
@ -188,12 +152,13 @@
const isRTL = () => document.documentElement.dir === 'rtl';
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -208,7 +173,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): carousel.js
* Bootstrap (v5.0.1): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -312,8 +277,8 @@
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
} // Public
next() {
@ -396,17 +361,6 @@
const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
this._slide(order, this._items[index]);
}
dispose() {
this._items = null;
this._config = null;
this._interval = null;
this._isPaused = null;
this._isSliding = null;
this._activeElement = null;
this._indicatorsElement = null;
super.dispose();
} // Private
_getConfig(config) {
@ -676,37 +630,35 @@
this._activeElement = nextElement;
if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
nextElement.classList.add(orderClassName);
reflow(nextElement);
activeElement.classList.add(directionalClassName);
nextElement.classList.add(directionalClassName);
const transitionDuration = getTransitionDurationFromElement(activeElement);
EventHandler__default['default'].one(activeElement, 'transitionend', () => {
nextElement.classList.remove(directionalClassName, orderClassName);
nextElement.classList.add(CLASS_NAME_ACTIVE);
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
this._isSliding = false;
setTimeout(() => {
EventHandler__default['default'].trigger(this._element, EVENT_SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
to: nextElementIndex,
});
}, 0);
});
emulateTransitionEnd(activeElement, transitionDuration);
} else {
activeElement.classList.remove(CLASS_NAME_ACTIVE);
nextElement.classList.add(CLASS_NAME_ACTIVE);
this._isSliding = false;
const triggerSlidEvent = () => {
EventHandler__default['default'].trigger(this._element, EVENT_SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
to: nextElementIndex,
});
};
if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
nextElement.classList.add(orderClassName);
reflow(nextElement);
activeElement.classList.add(directionalClassName);
nextElement.classList.add(directionalClassName);
const completeCallBack = () => {
nextElement.classList.remove(directionalClassName, orderClassName);
nextElement.classList.add(CLASS_NAME_ACTIVE);
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
this._isSliding = false;
setTimeout(triggerSlidEvent, 0);
};
this._queueCallback(completeCallBack, activeElement, true);
} else {
activeElement.classList.remove(CLASS_NAME_ACTIVE);
nextElement.classList.add(CLASS_NAME_ACTIVE);
this._isSliding = false;
triggerSlidEvent();
}
if (isCycling) {
@ -827,7 +779,7 @@
* add .Carousel to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Carousel);
defineJQueryPlugin(Carousel);
return Carousel;
});

File diff suppressed because one or more lines are too long

View File

@ -1,55 +1,46 @@
/*!
* Bootstrap collapse.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap collapse.js v5.0.1 (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/selector-engine.js'),
require('./dom/data.js'),
require('./dom/event-handler.js'),
require('./dom/manipulator.js'),
require('./dom/selector-engine.js'),
require('./base-component.js')
))
: typeof define === 'function' && define.amd
? define([
'./dom/selector-engine',
'./dom/data',
'./dom/event-handler',
'./dom/manipulator',
'./dom/selector-engine',
'./base-component',
], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Collapse = factory(
global.SelectorEngine,
global.Data,
global.EventHandler,
global.Manipulator,
global.SelectorEngine,
global.Base
)));
})(this, function (Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) {
})(this, function (SelectorEngine, Data, EventHandler, Manipulator, BaseComponent) {
'use strict';
function _interopDefaultLegacy(e) {
return e && typeof e === 'object' && 'default' in e ? e : { default: e };
}
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
const toType = (obj) => {
if (obj === null || obj === undefined) {
return `${obj}`;
@ -99,49 +90,29 @@
return selector ? document.querySelector(selector) : null;
};
const getTransitionDurationFromElement = (element) => {
if (!element) {
return 0;
} // Get transition-duration of the element
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
const floatTransitionDuration = Number.parseFloat(transitionDuration);
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
if (!floatTransitionDuration && !floatTransitionDelay) {
return 0;
} // If multiple durations are defined, take the first
transitionDuration = transitionDuration.split(',')[0];
transitionDelay = transitionDelay.split(',')[0];
return (
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
MILLISECONDS_MULTIPLIER
);
};
const triggerTransitionEnd = (element) => {
element.dispatchEvent(new Event(TRANSITION_END));
};
const isElement = (obj) => (obj[0] || obj).nodeType;
const emulateTransitionEnd = (element, duration) => {
let called = false;
const durationPadding = 5;
const emulatedDuration = duration + durationPadding;
function listener() {
called = true;
element.removeEventListener(TRANSITION_END, listener);
const isElement = (obj) => {
if (!obj || typeof obj !== 'object') {
return false;
}
element.addEventListener(TRANSITION_END, listener);
setTimeout(() => {
if (!called) {
triggerTransitionEnd(element);
}
}, emulatedDuration);
if (typeof obj.jquery !== 'undefined') {
obj = obj[0];
}
return typeof obj.nodeType !== 'undefined';
};
const getElement = (obj) => {
if (isElement(obj)) {
// it's a jQuery object or a node element
return obj.jquery ? obj[0] : obj;
}
if (typeof obj === 'string' && obj.length > 0) {
return SelectorEngine__default['default'].findOne(obj);
}
return null;
};
const typeCheckConfig = (componentName, config, configTypes) => {
@ -178,12 +149,13 @@
}
};
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -198,7 +170,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): collapse.js
* Bootstrap (v5.0.1): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -279,8 +251,8 @@
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
} // Public
toggle() {
@ -375,9 +347,9 @@
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
const scrollSize = `scroll${capitalizedDimension}`;
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
this._queueCallback(complete, this._element, true);
this._element.style[dimension] = `${this._element[scrollSize]}px`;
}
@ -428,21 +400,12 @@
};
this._element.style[dimension] = '';
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
this._queueCallback(complete, this._element, true);
}
setTransitioning(isTransitioning) {
this._isTransitioning = isTransitioning;
}
dispose() {
super.dispose();
this._config = null;
this._parent = null;
this._triggerArray = null;
this._isTransitioning = null;
} // Private
_getConfig(config) {
@ -459,16 +422,7 @@
_getParent() {
let { parent } = this._config;
if (isElement(parent)) {
// it's a jQuery object
if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') {
parent = parent[0];
}
} else {
parent = SelectorEngine__default['default'].findOne(parent);
}
parent = getElement(parent);
const selector = `${SELECTOR_DATA_TOGGLE}[data-bs-parent="${parent}"]`;
SelectorEngine__default['default'].find(selector, parent).forEach((element) => {
const selected = getElementFromSelector(element);
@ -575,7 +529,7 @@
* add .Collapse to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Collapse);
defineJQueryPlugin(Collapse);
return Collapse;
});

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*!
* Bootstrap data.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap data.js v5.0.1 (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)
*/
@ -15,7 +15,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): dom/data.js
* Bootstrap (v5.0.1): dom/data.js
* 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): 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 elementMap = new Map()\n\nexport default {\n set(element, key, instance) {\n if (!elementMap.has(element)) {\n elementMap.set(element, new Map())\n }\n\n const instanceMap = elementMap.get(element)\n\n // make it clear we only want one instance per element\n // can be removed later when multiple key/instances are fine to be used\n if (!instanceMap.has(key) && instanceMap.size !== 0) {\n // eslint-disable-next-line no-console\n console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`)\n return\n }\n\n instanceMap.set(key, instance)\n },\n\n get(element, key) {\n if (elementMap.has(element)) {\n return elementMap.get(element).get(key) || null\n }\n\n return null\n },\n\n remove(element, key) {\n if (!elementMap.has(element)) {\n return\n }\n\n const instanceMap = elementMap.get(element)\n\n instanceMap.delete(key)\n\n // free up element references if there are no instances left for an element\n if (instanceMap.size === 0) {\n elementMap.delete(element)\n }\n }\n}\n"],"names":["elementMap","Map","set","element","key","instance","has","instanceMap","get","size","console","error","Array","from","keys","remove","delete"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,MAAMA,UAAU,GAAG,IAAIC,GAAJ,EAAnB;AAEA,aAAe;EACbC,EAAAA,GAAG,CAACC,OAAD,EAAUC,GAAV,EAAeC,QAAf,EAAyB;EAC1B,QAAI,CAACL,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAL,EAA8B;EAC5BH,MAAAA,UAAU,CAACE,GAAX,CAAeC,OAAf,EAAwB,IAAIF,GAAJ,EAAxB;EACD;;EAED,UAAMM,WAAW,GAAGP,UAAU,CAACQ,GAAX,CAAeL,OAAf,CAApB,CAL0B;EAQ1B;;EACA,QAAI,CAACI,WAAW,CAACD,GAAZ,CAAgBF,GAAhB,CAAD,IAAyBG,WAAW,CAACE,IAAZ,KAAqB,CAAlD,EAAqD;EACnD;EACAC,MAAAA,OAAO,CAACC,KAAR,CAAe,+EAA8EC,KAAK,CAACC,IAAN,CAAWN,WAAW,CAACO,IAAZ,EAAX,EAA+B,CAA/B,CAAkC,GAA/H;EACA;EACD;;EAEDP,IAAAA,WAAW,CAACL,GAAZ,CAAgBE,GAAhB,EAAqBC,QAArB;EACD,GAjBY;;EAmBbG,EAAAA,GAAG,CAACL,OAAD,EAAUC,GAAV,EAAe;EAChB,QAAIJ,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAJ,EAA6B;EAC3B,aAAOH,UAAU,CAACQ,GAAX,CAAeL,OAAf,EAAwBK,GAAxB,CAA4BJ,GAA5B,KAAoC,IAA3C;EACD;;EAED,WAAO,IAAP;EACD,GAzBY;;EA2BbW,EAAAA,MAAM,CAACZ,OAAD,EAAUC,GAAV,EAAe;EACnB,QAAI,CAACJ,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAL,EAA8B;EAC5B;EACD;;EAED,UAAMI,WAAW,GAAGP,UAAU,CAACQ,GAAX,CAAeL,OAAf,CAApB;EAEAI,IAAAA,WAAW,CAACS,MAAZ,CAAmBZ,GAAnB,EAPmB;;EAUnB,QAAIG,WAAW,CAACE,IAAZ,KAAqB,CAAzB,EAA4B;EAC1BT,MAAAA,UAAU,CAACgB,MAAX,CAAkBb,OAAlB;EACD;EACF;;EAxCY,CAAf;;;;;;;;"}
{"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.1): 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 elementMap = new Map()\n\nexport default {\n set(element, key, instance) {\n if (!elementMap.has(element)) {\n elementMap.set(element, new Map())\n }\n\n const instanceMap = elementMap.get(element)\n\n // make it clear we only want one instance per element\n // can be removed later when multiple key/instances are fine to be used\n if (!instanceMap.has(key) && instanceMap.size !== 0) {\n // eslint-disable-next-line no-console\n console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`)\n return\n }\n\n instanceMap.set(key, instance)\n },\n\n get(element, key) {\n if (elementMap.has(element)) {\n return elementMap.get(element).get(key) || null\n }\n\n return null\n },\n\n remove(element, key) {\n if (!elementMap.has(element)) {\n return\n }\n\n const instanceMap = elementMap.get(element)\n\n instanceMap.delete(key)\n\n // free up element references if there are no instances left for an element\n if (instanceMap.size === 0) {\n elementMap.delete(element)\n }\n }\n}\n"],"names":["elementMap","Map","set","element","key","instance","has","instanceMap","get","size","console","error","Array","from","keys","remove","delete"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EAEA,MAAMA,UAAU,GAAG,IAAIC,GAAJ,EAAnB;AAEA,aAAe;EACbC,EAAAA,GAAG,CAACC,OAAD,EAAUC,GAAV,EAAeC,QAAf,EAAyB;EAC1B,QAAI,CAACL,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAL,EAA8B;EAC5BH,MAAAA,UAAU,CAACE,GAAX,CAAeC,OAAf,EAAwB,IAAIF,GAAJ,EAAxB;EACD;;EAED,UAAMM,WAAW,GAAGP,UAAU,CAACQ,GAAX,CAAeL,OAAf,CAApB,CAL0B;EAQ1B;;EACA,QAAI,CAACI,WAAW,CAACD,GAAZ,CAAgBF,GAAhB,CAAD,IAAyBG,WAAW,CAACE,IAAZ,KAAqB,CAAlD,EAAqD;EACnD;EACAC,MAAAA,OAAO,CAACC,KAAR,CAAe,+EAA8EC,KAAK,CAACC,IAAN,CAAWN,WAAW,CAACO,IAAZ,EAAX,EAA+B,CAA/B,CAAkC,GAA/H;EACA;EACD;;EAEDP,IAAAA,WAAW,CAACL,GAAZ,CAAgBE,GAAhB,EAAqBC,QAArB;EACD,GAjBY;;EAmBbG,EAAAA,GAAG,CAACL,OAAD,EAAUC,GAAV,EAAe;EAChB,QAAIJ,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAJ,EAA6B;EAC3B,aAAOH,UAAU,CAACQ,GAAX,CAAeL,OAAf,EAAwBK,GAAxB,CAA4BJ,GAA5B,KAAoC,IAA3C;EACD;;EAED,WAAO,IAAP;EACD,GAzBY;;EA2BbW,EAAAA,MAAM,CAACZ,OAAD,EAAUC,GAAV,EAAe;EACnB,QAAI,CAACJ,UAAU,CAACM,GAAX,CAAeH,OAAf,CAAL,EAA8B;EAC5B;EACD;;EAED,UAAMI,WAAW,GAAGP,UAAU,CAACQ,GAAX,CAAeL,OAAf,CAApB;EAEAI,IAAAA,WAAW,CAACS,MAAZ,CAAmBZ,GAAnB,EAPmB;;EAUnB,QAAIG,WAAW,CAACE,IAAZ,KAAqB,CAAzB,EAA4B;EAC1BT,MAAAA,UAAU,CAACgB,MAAX,CAAkBb,OAAlB;EACD;EACF;;EAxCY,CAAf;;;;;;;;"}

View File

@ -1,5 +1,5 @@
/*!
* Bootstrap event-handler.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap event-handler.js v5.0.1 (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)
*/
@ -13,13 +13,6 @@
})(this, function () {
'use strict';
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const getjQuery = () => {
const { jQuery } = window;
@ -32,7 +25,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): dom/event-handler.js
* Bootstrap (v5.0.1): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*!
* Bootstrap manipulator.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap manipulator.js v5.0.1 (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)
*/
@ -15,7 +15,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): dom/manipulator.js
* Bootstrap (v5.0.1): dom/manipulator.js
* 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): 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,EAAsBC,GAAG,IAAK,IAAGA,GAAG,CAACC,WAAJ,EAAkB,EAAnD,CAAP;EACD;;QAEKC,WAAW,GAAG;EAClBC,EAAAA,gBAAgB,CAACC,OAAD,EAAUN,GAAV,EAAeO,KAAf,EAAsB;EACpCD,IAAAA,OAAO,CAACE,YAAR,CAAsB,WAAUT,gBAAgB,CAACC,GAAD,CAAM,EAAtD,EAAyDO,KAAzD;EACD,GAHiB;;EAKlBE,EAAAA,mBAAmB,CAACH,OAAD,EAAUN,GAAV,EAAe;EAChCM,IAAAA,OAAO,CAACI,eAAR,CAAyB,WAAUX,gBAAgB,CAACC,GAAD,CAAM,EAAzD;EACD,GAPiB;;EASlBW,EAAAA,iBAAiB,CAACL,OAAD,EAAU;EACzB,QAAI,CAACA,OAAL,EAAc;EACZ,aAAO,EAAP;EACD;;EAED,UAAMM,UAAU,GAAG,EAAnB;EAEAC,IAAAA,MAAM,CAACC,IAAP,CAAYR,OAAO,CAACS,OAApB,EACGC,MADH,CACUhB,GAAG,IAAIA,GAAG,CAACiB,UAAJ,CAAe,IAAf,CADjB,EAEGC,OAFH,CAEWlB,GAAG,IAAI;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,gBAAgB,CAACjB,OAAD,EAAUN,GAAV,EAAe;EAC7B,WAAOL,aAAa,CAACW,OAAO,CAACkB,YAAR,CAAsB,WAAUzB,gBAAgB,CAACC,GAAD,CAAM,EAAtD,CAAD,CAApB;EACD,GA7BiB;;EA+BlByB,EAAAA,MAAM,CAACnB,OAAD,EAAU;EACd,UAAMoB,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,QAAQ,CAAC5B,OAAD,EAAU;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.1): 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,EAAsBC,GAAG,IAAK,IAAGA,GAAG,CAACC,WAAJ,EAAkB,EAAnD,CAAP;EACD;;QAEKC,WAAW,GAAG;EAClBC,EAAAA,gBAAgB,CAACC,OAAD,EAAUN,GAAV,EAAeO,KAAf,EAAsB;EACpCD,IAAAA,OAAO,CAACE,YAAR,CAAsB,WAAUT,gBAAgB,CAACC,GAAD,CAAM,EAAtD,EAAyDO,KAAzD;EACD,GAHiB;;EAKlBE,EAAAA,mBAAmB,CAACH,OAAD,EAAUN,GAAV,EAAe;EAChCM,IAAAA,OAAO,CAACI,eAAR,CAAyB,WAAUX,gBAAgB,CAACC,GAAD,CAAM,EAAzD;EACD,GAPiB;;EASlBW,EAAAA,iBAAiB,CAACL,OAAD,EAAU;EACzB,QAAI,CAACA,OAAL,EAAc;EACZ,aAAO,EAAP;EACD;;EAED,UAAMM,UAAU,GAAG,EAAnB;EAEAC,IAAAA,MAAM,CAACC,IAAP,CAAYR,OAAO,CAACS,OAApB,EACGC,MADH,CACUhB,GAAG,IAAIA,GAAG,CAACiB,UAAJ,CAAe,IAAf,CADjB,EAEGC,OAFH,CAEWlB,GAAG,IAAI;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,gBAAgB,CAACjB,OAAD,EAAUN,GAAV,EAAe;EAC7B,WAAOL,aAAa,CAACW,OAAO,CAACkB,YAAR,CAAsB,WAAUzB,gBAAgB,CAACC,GAAD,CAAM,EAAtD,CAAD,CAApB;EACD,GA7BiB;;EA+BlByB,EAAAA,MAAM,CAACnB,OAAD,EAAU;EACd,UAAMoB,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,QAAQ,CAAC5B,OAAD,EAAU;EAChB,WAAO;EACLsB,MAAAA,GAAG,EAAEtB,OAAO,CAAC6B,SADR;EAELH,MAAAA,IAAI,EAAE1B,OAAO,CAAC8B;EAFT,KAAP;EAID;;EA7CiB;;;;;;;;"}

View File

@ -1,5 +1,5 @@
/*!
* Bootstrap selector-engine.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap selector-engine.js v5.0.1 (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)
*/
@ -15,7 +15,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): dom/selector-engine.js
* Bootstrap (v5.0.1): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/

View File

@ -1 +1 @@
{"version":3,"file":"selector-engine.js","sources":["../../src/dom/selector-engine.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.0): 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,MAAMA,SAAS,GAAG,CAAlB;QAEMC,cAAc,GAAG;EACrBC,EAAAA,IAAI,CAACC,QAAD,EAAWC,OAAO,GAAGC,QAAQ,CAACC,eAA9B,EAA+C;EACjD,WAAO,GAAGC,MAAH,CAAU,GAAGC,OAAO,CAACC,SAAR,CAAkBC,gBAAlB,CAAmCC,IAAnC,CAAwCP,OAAxC,EAAiDD,QAAjD,CAAb,CAAP;EACD,GAHoB;;EAKrBS,EAAAA,OAAO,CAACT,QAAD,EAAWC,OAAO,GAAGC,QAAQ,CAACC,eAA9B,EAA+C;EACpD,WAAOE,OAAO,CAACC,SAAR,CAAkBI,aAAlB,CAAgCF,IAAhC,CAAqCP,OAArC,EAA8CD,QAA9C,CAAP;EACD,GAPoB;;EASrBW,EAAAA,QAAQ,CAACV,OAAD,EAAUD,QAAV,EAAoB;EAC1B,WAAO,GAAGI,MAAH,CAAU,GAAGH,OAAO,CAACU,QAArB,EACJC,MADI,CACGC,KAAK,IAAIA,KAAK,CAACC,OAAN,CAAcd,QAAd,CADZ,CAAP;EAED,GAZoB;;EAcrBe,EAAAA,OAAO,CAACd,OAAD,EAAUD,QAAV,EAAoB;EACzB,UAAMe,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,IAAI,CAACrB,OAAD,EAAUD,QAAV,EAAoB;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,IAAI,CAACxB,OAAD,EAAUD,QAAV,EAAoB;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;;;;;;;;"}
{"version":3,"file":"selector-engine.js","sources":["../../src/dom/selector-engine.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.1): 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,MAAMA,SAAS,GAAG,CAAlB;QAEMC,cAAc,GAAG;EACrBC,EAAAA,IAAI,CAACC,QAAD,EAAWC,OAAO,GAAGC,QAAQ,CAACC,eAA9B,EAA+C;EACjD,WAAO,GAAGC,MAAH,CAAU,GAAGC,OAAO,CAACC,SAAR,CAAkBC,gBAAlB,CAAmCC,IAAnC,CAAwCP,OAAxC,EAAiDD,QAAjD,CAAb,CAAP;EACD,GAHoB;;EAKrBS,EAAAA,OAAO,CAACT,QAAD,EAAWC,OAAO,GAAGC,QAAQ,CAACC,eAA9B,EAA+C;EACpD,WAAOE,OAAO,CAACC,SAAR,CAAkBI,aAAlB,CAAgCF,IAAhC,CAAqCP,OAArC,EAA8CD,QAA9C,CAAP;EACD,GAPoB;;EASrBW,EAAAA,QAAQ,CAACV,OAAD,EAAUD,QAAV,EAAoB;EAC1B,WAAO,GAAGI,MAAH,CAAU,GAAGH,OAAO,CAACU,QAArB,EACJC,MADI,CACGC,KAAK,IAAIA,KAAK,CAACC,OAAN,CAAcd,QAAd,CADZ,CAAP;EAED,GAZoB;;EAcrBe,EAAAA,OAAO,CAACd,OAAD,EAAUD,QAAV,EAAoB;EACzB,UAAMe,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,IAAI,CAACrB,OAAD,EAAUD,QAAV,EAAoB;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,IAAI,CAACxB,OAAD,EAAUD,QAAV,EAAoB;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,5 +1,5 @@
/*!
* Bootstrap dropdown.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap dropdown.js v5.0.1 (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)
*/
@ -7,31 +7,31 @@
typeof exports === 'object' && typeof module !== 'undefined'
? (module.exports = factory(
require('@popperjs/core'),
require('./dom/selector-engine.js'),
require('./dom/data.js'),
require('./dom/event-handler.js'),
require('./dom/manipulator.js'),
require('./dom/selector-engine.js'),
require('./base-component.js')
))
: typeof define === 'function' && define.amd
? define([
'@popperjs/core',
'./dom/selector-engine',
'./dom/data',
'./dom/event-handler',
'./dom/manipulator',
'./dom/selector-engine',
'./base-component',
], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Dropdown = factory(
global.Popper,
global.SelectorEngine,
global.Data,
global.EventHandler,
global.Manipulator,
global.SelectorEngine,
global.Base
)));
})(this, function (Popper, Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) {
})(this, function (Popper, SelectorEngine, Data, EventHandler, Manipulator, BaseComponent) {
'use strict';
function _interopDefaultLegacy(e) {
@ -65,19 +65,12 @@
}
var Popper__namespace = /*#__PURE__*/ _interopNamespace(Popper);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const toType = (obj) => {
if (obj === null || obj === undefined) {
return `${obj}`;
@ -117,7 +110,30 @@
return selector ? document.querySelector(selector) : null;
};
const isElement = (obj) => (obj[0] || obj).nodeType;
const isElement = (obj) => {
if (!obj || typeof obj !== 'object') {
return false;
}
if (typeof obj.jquery !== 'undefined') {
obj = obj[0];
}
return typeof obj.nodeType !== 'undefined';
};
const getElement = (obj) => {
if (isElement(obj)) {
// it's a jQuery object or a node element
return obj.jquery ? obj[0] : obj;
}
if (typeof obj === 'string' && obj.length > 0) {
return SelectorEngine__default['default'].findOne(obj);
}
return null;
};
const typeCheckConfig = (componentName, config, configTypes) => {
Object.keys(configTypes).forEach((property) => {
@ -189,12 +205,13 @@
const isRTL = () => document.documentElement.dir === 'rtl';
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -209,7 +226,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): dropdown.js
* Bootstrap (v5.0.1): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -295,8 +312,8 @@
return DefaultType;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
} // Public
toggle() {
@ -345,11 +362,7 @@
if (this._config.reference === 'parent') {
referenceElement = parent;
} else if (isElement(this._config.reference)) {
referenceElement = this._config.reference; // Check if it's jQuery element
if (typeof this._config.reference.jquery !== 'undefined') {
referenceElement = this._config.reference[0];
}
referenceElement = getElement(this._config.reference);
} else if (typeof this._config.reference === 'object') {
referenceElement = this._config.reference;
}
@ -399,12 +412,8 @@
}
dispose() {
this._menu = null;
if (this._popper) {
this._popper.destroy();
this._popper = null;
}
super.dispose();
@ -605,17 +614,11 @@
}
static clearMenus(event) {
if (event) {
if (
event.button === RIGHT_MOUSE_BUTTON ||
(event.type === 'keyup' && event.key !== TAB_KEY)
) {
return;
}
if (/input|select|option|textarea|form/i.test(event.target.tagName)) {
return;
}
if (
event &&
(event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY))
) {
return;
}
const toggles = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
@ -645,12 +648,12 @@
(context._config.autoClose === 'outside' && isMenuTarget)
) {
continue;
} // Tab navigation through the dropdown menu shouldn't close the menu
} // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
if (
event.type === 'keyup' &&
event.key === TAB_KEY &&
context._menu.contains(event.target)
context._menu.contains(event.target) &&
((event.type === 'keyup' && event.key === TAB_KEY) ||
/input|select|option|textarea|form/i.test(event.target.tagName))
) {
continue;
}
@ -760,7 +763,7 @@
* add .Dropdown to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Dropdown);
defineJQueryPlugin(Dropdown);
return Dropdown;
});

File diff suppressed because one or more lines are too long

View File

@ -1,48 +1,42 @@
/*!
* Bootstrap modal.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap modal.js v5.0.1 (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/selector-engine.js'),
require('./dom/event-handler.js'),
require('./dom/manipulator.js'),
require('./dom/selector-engine.js'),
require('./base-component.js')
))
: typeof define === 'function' && define.amd
? define([
'./dom/selector-engine',
'./dom/event-handler',
'./dom/manipulator',
'./dom/selector-engine',
'./base-component',
], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Modal = factory(
global.SelectorEngine,
global.EventHandler,
global.Manipulator,
global.SelectorEngine,
global.Base
)));
})(this, function (EventHandler, Manipulator, SelectorEngine, BaseComponent) {
})(this, function (SelectorEngine, EventHandler, Manipulator, BaseComponent) {
'use strict';
function _interopDefaultLegacy(e) {
return e && typeof e === 'object' && 'default' in e ? e : { default: e };
}
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
@ -110,7 +104,17 @@
element.dispatchEvent(new Event(TRANSITION_END));
};
const isElement = (obj) => (obj[0] || obj).nodeType;
const isElement = (obj) => {
if (!obj || typeof obj !== 'object') {
return false;
}
if (typeof obj.jquery !== 'undefined') {
obj = obj[0];
}
return typeof obj.nodeType !== 'undefined';
};
const emulateTransitionEnd = (element, duration) => {
let called = false;
@ -184,12 +188,13 @@
const isRTL = () => document.documentElement.dir === 'rtl';
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -210,7 +215,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/scrollBar.js
* Bootstrap (v5.0.1): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -290,7 +295,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/backdrop.js
* Bootstrap (v5.0.1): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@ -371,6 +376,7 @@
_getConfig(config) {
config = { ...Default$1, ...(typeof config === 'object' ? config : {}) };
config.rootElement = config.rootElement || document.body;
typeCheckConfig(NAME$1, config, DefaultType$1);
return config;
}
@ -416,7 +422,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): modal.js
* Bootstrap (v5.0.1): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -482,8 +488,8 @@
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
} // Public
toggle(relatedTarget) {
@ -568,21 +574,16 @@
EventHandler__default['default'].off(this._element, EVENT_CLICK_DISMISS);
EventHandler__default['default'].off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
if (isAnimated) {
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, 'transitionend', (event) =>
this._hideModal(event)
);
emulateTransitionEnd(this._element, transitionDuration);
} else {
this._hideModal();
}
this._queueCallback(() => this._hideModal(), this._element, isAnimated);
}
dispose() {
[window, this._dialog].forEach((htmlElement) =>
EventHandler__default['default'].off(htmlElement, EVENT_KEY)
);
this._backdrop.dispose();
super.dispose();
/**
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
@ -591,15 +592,6 @@
*/
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
this._config = null;
this._dialog = null;
this._backdrop.dispose();
this._backdrop = null;
this._isShown = null;
this._ignoreBackdropClick = null;
this._isTransitioning = null;
}
handleUpdate() {
@ -672,13 +664,7 @@
});
};
if (isAnimated) {
const transitionDuration = getTransitionDurationFromElement(this._dialog);
EventHandler__default['default'].one(this._dialog, 'transitionend', transitionComplete);
emulateTransitionEnd(this._dialog, transitionDuration);
} else {
transitionComplete();
}
this._queueCallback(transitionComplete, this._dialog, isAnimated);
}
_enforceFocus() {
@ -883,7 +869,7 @@
* add .Modal to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Modal);
defineJQueryPlugin(Modal);
return Modal;
});

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*!
* Bootstrap offcanvas.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap offcanvas.js v5.0.1 (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)
*/
@ -41,12 +41,6 @@
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
@ -114,7 +108,17 @@
element.dispatchEvent(new Event(TRANSITION_END));
};
const isElement = (obj) => (obj[0] || obj).nodeType;
const isElement = (obj) => {
if (!obj || typeof obj !== 'object') {
return false;
}
if (typeof obj.jquery !== 'undefined') {
obj = obj[0];
}
return typeof obj.nodeType !== 'undefined';
};
const emulateTransitionEnd = (element, duration) => {
let called = false;
@ -202,12 +206,13 @@
}
};
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -228,7 +233,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/scrollBar.js
* Bootstrap (v5.0.1): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -308,7 +313,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/backdrop.js
* Bootstrap (v5.0.1): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@ -389,6 +394,7 @@
_getConfig(config) {
config = { ...Default$1, ...(typeof config === 'object' ? config : {}) };
config.rootElement = config.rootElement || document.body;
typeCheckConfig(NAME$1, config, DefaultType$1);
return config;
}
@ -434,7 +440,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): offcanvas.js
* Bootstrap (v5.0.1): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@ -488,12 +494,12 @@
this._addEventListeners();
} // Getters
static get Default() {
return Default;
static get NAME() {
return NAME;
}
static get DATA_KEY() {
return DATA_KEY;
static get Default() {
return Default;
} // Public
toggle(relatedTarget) {
@ -538,9 +544,7 @@
});
};
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, 'transitionend', completeCallBack);
emulateTransitionEnd(this._element, transitionDuration);
this._queueCallback(completeCallBack, this._element, true);
}
hide() {
@ -580,9 +584,7 @@
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
};
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, 'transitionend', completeCallback);
emulateTransitionEnd(this._element, transitionDuration);
this._queueCallback(completeCallback, this._element, true);
}
dispose() {
@ -590,8 +592,6 @@
super.dispose();
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
this._config = null;
this._backdrop = null;
} // Private
_getConfig(config) {
@ -709,7 +709,7 @@
* ------------------------------------------------------------------------
*/
defineJQueryPlugin(NAME, Offcanvas);
defineJQueryPlugin(Offcanvas);
return Offcanvas;
});

File diff suppressed because one or more lines are too long

View File

@ -1,37 +1,30 @@
/*!
* Bootstrap popover.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap popover.js v5.0.1 (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'),
require('./dom/selector-engine.js'),
require('./dom/data.js'),
require('./tooltip.js')
))
: typeof define === 'function' && define.amd
? define(['./dom/data', './dom/selector-engine', './tooltip'], factory)
? define(['./dom/selector-engine', './dom/data', './tooltip'], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Popover = factory(global.Data, global.SelectorEngine, global.Tooltip)));
})(this, function (Data, SelectorEngine, Tooltip) {
(global.Popover = factory(global.SelectorEngine, global.Data, global.Tooltip)));
})(this, function (SelectorEngine, Data, Tooltip) {
'use strict';
function _interopDefaultLegacy(e) {
return e && typeof e === 'object' && 'default' in e ? e : { default: e };
}
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
var Tooltip__default = /*#__PURE__*/ _interopDefaultLegacy(Tooltip);
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const getjQuery = () => {
const { jQuery } = window;
@ -50,12 +43,13 @@
}
};
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -70,7 +64,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): popover.js
* Bootstrap (v5.0.1): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -134,18 +128,10 @@
return NAME;
}
static get DATA_KEY() {
return DATA_KEY;
}
static get Event() {
return Event;
}
static get EVENT_KEY() {
return EVENT_KEY;
}
static get DefaultType() {
return DefaultType;
} // Overrides
@ -180,7 +166,7 @@
}
_getContent() {
return this._element.getAttribute('data-bs-content') || this.config.content;
return this._element.getAttribute('data-bs-content') || this._config.content;
}
_cleanTipClass() {
@ -224,7 +210,7 @@
* add .Popover to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Popover);
defineJQueryPlugin(Popover);
return Popover;
});

File diff suppressed because one or more lines are too long

View File

@ -1,48 +1,49 @@
/*!
* Bootstrap scrollspy.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap scrollspy.js v5.0.1 (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/selector-engine.js'),
require('./dom/event-handler.js'),
require('./dom/manipulator.js'),
require('./dom/selector-engine.js'),
require('./base-component.js')
))
: typeof define === 'function' && define.amd
? define([
'./dom/selector-engine',
'./dom/event-handler',
'./dom/manipulator',
'./dom/selector-engine',
'./base-component',
], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.ScrollSpy = factory(
global.SelectorEngine,
global.EventHandler,
global.Manipulator,
global.SelectorEngine,
global.Base
)));
})(this, function (EventHandler, Manipulator, SelectorEngine, BaseComponent) {
})(this, function (SelectorEngine, EventHandler, Manipulator, BaseComponent) {
'use strict';
function _interopDefaultLegacy(e) {
return e && typeof e === 'object' && 'default' in e ? e : { default: e };
}
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Bootstrap (v5.0.1): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const MAX_UID = 1000000;
const toType = (obj) => {
@ -102,7 +103,17 @@
return null;
};
const isElement = (obj) => (obj[0] || obj).nodeType;
const isElement = (obj) => {
if (!obj || typeof obj !== 'object') {
return false;
}
if (typeof obj.jquery !== 'undefined') {
obj = obj[0];
}
return typeof obj.nodeType !== 'undefined';
};
const typeCheckConfig = (componentName, config, configTypes) => {
Object.keys(configTypes).forEach((property) => {
@ -136,12 +147,13 @@
}
};
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -156,7 +168,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): scrollspy.js
* Bootstrap (v5.0.1): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -220,8 +232,8 @@
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
} // Public
refresh() {
@ -263,15 +275,8 @@
}
dispose() {
super.dispose();
EventHandler__default['default'].off(this._scrollElement, EVENT_KEY);
this._scrollElement = null;
this._config = null;
this._selector = null;
this._offsets = null;
this._targets = null;
this._activeTarget = null;
this._scrollHeight = null;
super.dispose();
} // Private
_getConfig(config) {
@ -440,7 +445,7 @@
* add .ScrollSpy to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, ScrollSpy);
defineJQueryPlugin(ScrollSpy);
return ScrollSpy;
});

File diff suppressed because one or more lines are too long

View File

@ -1,46 +1,37 @@
/*!
* Bootstrap tab.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap tab.js v5.0.1 (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/selector-engine.js'),
require('./dom/data.js'),
require('./dom/event-handler.js'),
require('./dom/selector-engine.js'),
require('./base-component.js')
))
: typeof define === 'function' && define.amd
? define([
'./dom/selector-engine',
'./dom/data',
'./dom/event-handler',
'./dom/selector-engine',
'./base-component',
], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Tab = factory(global.Data, global.EventHandler, global.SelectorEngine, global.Base)));
})(this, function (Data, EventHandler, SelectorEngine, BaseComponent) {
(global.Tab = factory(global.SelectorEngine, global.Data, global.EventHandler, global.Base)));
})(this, function (SelectorEngine, Data, EventHandler, BaseComponent) {
'use strict';
function _interopDefaultLegacy(e) {
return e && typeof e === 'object' && 'default' in e ? e : { default: e };
}
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
const getSelector = (element) => {
let selector = element.getAttribute('data-bs-target');
@ -69,49 +60,6 @@
return selector ? document.querySelector(selector) : null;
};
const getTransitionDurationFromElement = (element) => {
if (!element) {
return 0;
} // Get transition-duration of the element
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
const floatTransitionDuration = Number.parseFloat(transitionDuration);
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
if (!floatTransitionDuration && !floatTransitionDelay) {
return 0;
} // If multiple durations are defined, take the first
transitionDuration = transitionDuration.split(',')[0];
transitionDelay = transitionDelay.split(',')[0];
return (
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
MILLISECONDS_MULTIPLIER
);
};
const triggerTransitionEnd = (element) => {
element.dispatchEvent(new Event(TRANSITION_END));
};
const emulateTransitionEnd = (element, duration) => {
let called = false;
const durationPadding = 5;
const emulatedDuration = duration + durationPadding;
function listener() {
called = true;
element.removeEventListener(TRANSITION_END, listener);
}
element.addEventListener(TRANSITION_END, listener);
setTimeout(() => {
if (!called) {
triggerTransitionEnd(element);
}
}, emulatedDuration);
};
const isDisabled = (element) => {
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
return true;
@ -148,12 +96,13 @@
}
};
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -168,7 +117,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): tab.js
* Bootstrap (v5.0.1): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -207,8 +156,8 @@
class Tab extends BaseComponent__default['default'] {
// Getters
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
} // Public
show() {
@ -276,10 +225,9 @@
const complete = () => this._transitionComplete(element, active, callback);
if (active && isTransitioning) {
const transitionDuration = getTransitionDurationFromElement(active);
active.classList.remove(CLASS_NAME_SHOW);
EventHandler__default['default'].one(active, 'transitionend', complete);
emulateTransitionEnd(active, transitionDuration);
this._queueCallback(complete, element, true);
} else {
complete();
}
@ -381,7 +329,7 @@
* add .Tab to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Tab);
defineJQueryPlugin(Tab);
return Tab;
});

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*!
* Bootstrap toast.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap toast.js v5.0.1 (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)
*/
@ -32,15 +32,6 @@
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
const toType = (obj) => {
if (obj === null || obj === undefined) {
return `${obj}`;
@ -52,49 +43,16 @@
.toLowerCase();
};
const getTransitionDurationFromElement = (element) => {
if (!element) {
return 0;
} // Get transition-duration of the element
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
const floatTransitionDuration = Number.parseFloat(transitionDuration);
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
if (!floatTransitionDuration && !floatTransitionDelay) {
return 0;
} // If multiple durations are defined, take the first
transitionDuration = transitionDuration.split(',')[0];
transitionDelay = transitionDelay.split(',')[0];
return (
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
MILLISECONDS_MULTIPLIER
);
};
const triggerTransitionEnd = (element) => {
element.dispatchEvent(new Event(TRANSITION_END));
};
const isElement = (obj) => (obj[0] || obj).nodeType;
const emulateTransitionEnd = (element, duration) => {
let called = false;
const durationPadding = 5;
const emulatedDuration = duration + durationPadding;
function listener() {
called = true;
element.removeEventListener(TRANSITION_END, listener);
const isElement = (obj) => {
if (!obj || typeof obj !== 'object') {
return false;
}
element.addEventListener(TRANSITION_END, listener);
setTimeout(() => {
if (!called) {
triggerTransitionEnd(element);
}
}, emulatedDuration);
if (typeof obj.jquery !== 'undefined') {
obj = obj[0];
}
return typeof obj.nodeType !== 'undefined';
};
const typeCheckConfig = (componentName, config, configTypes) => {
@ -131,12 +89,13 @@
}
};
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -151,7 +110,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): toast.js
* Bootstrap (v5.0.1): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -165,6 +124,10 @@
const DATA_KEY = 'bs.toast';
const EVENT_KEY = `.${DATA_KEY}`;
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
const EVENT_HIDE = `hide${EVENT_KEY}`;
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
const EVENT_SHOW = `show${EVENT_KEY}`;
@ -195,6 +158,8 @@
super(element);
this._config = this._getConfig(config);
this._timeout = null;
this._hasMouseInteraction = false;
this._hasKeyboardInteraction = false;
this._setListeners();
} // Getters
@ -207,8 +172,8 @@
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
} // Public
show() {
@ -231,11 +196,7 @@
EventHandler__default['default'].trigger(this._element, EVENT_SHOWN);
if (this._config.autohide) {
this._timeout = setTimeout(() => {
this.hide();
}, this._config.delay);
}
this._maybeScheduleHide();
};
this._element.classList.remove(CLASS_NAME_HIDE);
@ -244,13 +205,7 @@
this._element.classList.add(CLASS_NAME_SHOWING);
if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
} else {
complete();
}
this._queueCallback(complete, this._element, this._config.animation);
}
hide() {
@ -272,13 +227,7 @@
this._element.classList.remove(CLASS_NAME_SHOW);
if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler__default['default'].one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
} else {
complete();
}
this._queueCallback(complete, this._element, this._config.animation);
}
dispose() {
@ -289,7 +238,6 @@
}
super.dispose();
this._config = null;
} // Private
_getConfig(config) {
@ -302,6 +250,48 @@
return config;
}
_maybeScheduleHide() {
if (!this._config.autohide) {
return;
}
if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
return;
}
this._timeout = setTimeout(() => {
this.hide();
}, this._config.delay);
}
_onInteraction(event, isInteracting) {
switch (event.type) {
case 'mouseover':
case 'mouseout':
this._hasMouseInteraction = isInteracting;
break;
case 'focusin':
case 'focusout':
this._hasKeyboardInteraction = isInteracting;
break;
}
if (isInteracting) {
this._clearTimeout();
return;
}
const nextElement = event.relatedTarget;
if (this._element === nextElement || this._element.contains(nextElement)) {
return;
}
this._maybeScheduleHide();
}
_setListeners() {
EventHandler__default['default'].on(
this._element,
@ -309,6 +299,18 @@
SELECTOR_DATA_DISMISS,
() => this.hide()
);
EventHandler__default['default'].on(this._element, EVENT_MOUSEOVER, (event) =>
this._onInteraction(event, true)
);
EventHandler__default['default'].on(this._element, EVENT_MOUSEOUT, (event) =>
this._onInteraction(event, false)
);
EventHandler__default['default'].on(this._element, EVENT_FOCUSIN, (event) =>
this._onInteraction(event, true)
);
EventHandler__default['default'].on(this._element, EVENT_FOCUSOUT, (event) =>
this._onInteraction(event, false)
);
}
_clearTimeout() {
@ -343,7 +345,7 @@
* add .Toast to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Toast);
defineJQueryPlugin(Toast);
return Toast;
});

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
/*!
* Bootstrap tooltip.js v5.0.0 (https://getbootstrap.com/)
* Bootstrap tooltip.js v5.0.1 (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)
*/
@ -7,31 +7,31 @@
typeof exports === 'object' && typeof module !== 'undefined'
? (module.exports = factory(
require('@popperjs/core'),
require('./dom/selector-engine.js'),
require('./dom/data.js'),
require('./dom/event-handler.js'),
require('./dom/manipulator.js'),
require('./dom/selector-engine.js'),
require('./base-component.js')
))
: typeof define === 'function' && define.amd
? define([
'@popperjs/core',
'./dom/selector-engine',
'./dom/data',
'./dom/event-handler',
'./dom/manipulator',
'./dom/selector-engine',
'./base-component',
], factory)
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self),
(global.Tooltip = factory(
global.Popper,
global.SelectorEngine,
global.Data,
global.EventHandler,
global.Manipulator,
global.SelectorEngine,
global.Base
)));
})(this, function (Popper, Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) {
})(this, function (Popper, SelectorEngine, Data, EventHandler, Manipulator, BaseComponent) {
'use strict';
function _interopDefaultLegacy(e) {
@ -65,21 +65,20 @@
}
var Popper__namespace = /*#__PURE__*/ _interopNamespace(Popper);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var Data__default = /*#__PURE__*/ _interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/ _interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/ _interopDefaultLegacy(Manipulator);
var SelectorEngine__default = /*#__PURE__*/ _interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/ _interopDefaultLegacy(BaseComponent);
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Bootstrap (v5.0.1): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const MAX_UID = 1000000;
const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
const toType = (obj) => {
if (obj === null || obj === undefined) {
@ -105,49 +104,29 @@
return prefix;
};
const getTransitionDurationFromElement = (element) => {
if (!element) {
return 0;
} // Get transition-duration of the element
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
const floatTransitionDuration = Number.parseFloat(transitionDuration);
const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
if (!floatTransitionDuration && !floatTransitionDelay) {
return 0;
} // If multiple durations are defined, take the first
transitionDuration = transitionDuration.split(',')[0];
transitionDelay = transitionDelay.split(',')[0];
return (
(Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) *
MILLISECONDS_MULTIPLIER
);
};
const triggerTransitionEnd = (element) => {
element.dispatchEvent(new Event(TRANSITION_END));
};
const isElement = (obj) => (obj[0] || obj).nodeType;
const emulateTransitionEnd = (element, duration) => {
let called = false;
const durationPadding = 5;
const emulatedDuration = duration + durationPadding;
function listener() {
called = true;
element.removeEventListener(TRANSITION_END, listener);
const isElement = (obj) => {
if (!obj || typeof obj !== 'object') {
return false;
}
element.addEventListener(TRANSITION_END, listener);
setTimeout(() => {
if (!called) {
triggerTransitionEnd(element);
}
}, emulatedDuration);
if (typeof obj.jquery !== 'undefined') {
obj = obj[0];
}
return typeof obj.nodeType !== 'undefined';
};
const getElement = (obj) => {
if (isElement(obj)) {
// it's a jQuery object or a node element
return obj.jquery ? obj[0] : obj;
}
if (typeof obj === 'string' && obj.length > 0) {
return SelectorEngine__default['default'].findOne(obj);
}
return null;
};
const typeCheckConfig = (componentName, config, configTypes) => {
@ -207,12 +186,13 @@
const isRTL = () => document.documentElement.dir === 'rtl';
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -227,7 +207,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/sanitizer.js
* Bootstrap (v5.0.1): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -351,7 +331,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): tooltip.js
* Bootstrap (v5.0.1): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -416,7 +396,7 @@
allowList: DefaultAllowlist,
popperConfig: null,
};
const Event$1 = {
const Event = {
HIDE: `hide${EVENT_KEY}`,
HIDDEN: `hidden${EVENT_KEY}`,
SHOW: `show${EVENT_KEY}`,
@ -458,7 +438,7 @@
this._activeTrigger = {};
this._popper = null; // Protected
this.config = this._getConfig(config);
this._config = this._getConfig(config);
this.tip = null;
this._setListeners();
@ -472,16 +452,8 @@
return NAME;
}
static get DATA_KEY() {
return DATA_KEY;
}
static get Event() {
return Event$1;
}
static get EVENT_KEY() {
return EVENT_KEY;
return Event;
}
static get DefaultType() {
@ -538,18 +510,10 @@
this.tip.parentNode.removeChild(this.tip);
}
this._isEnabled = null;
this._timeout = null;
this._hoverState = null;
this._activeTrigger = null;
if (this._popper) {
this._popper.destroy();
}
this._popper = null;
this.config = null;
this.tip = null;
super.dispose();
}
@ -584,21 +548,20 @@
this.setContent();
if (this.config.animation) {
if (this._config.animation) {
tip.classList.add(CLASS_NAME_FADE);
}
const placement =
typeof this.config.placement === 'function'
? this.config.placement.call(this, tip, this._element)
: this.config.placement;
typeof this._config.placement === 'function'
? this._config.placement.call(this, tip, this._element)
: this._config.placement;
const attachment = this._getAttachment(placement);
this._addAttachmentClass(attachment);
const container = this._getContainer();
const { container } = this._config;
Data__default['default'].set(tip, this.constructor.DATA_KEY, this);
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
@ -618,9 +581,9 @@
tip.classList.add(CLASS_NAME_SHOW);
const customClass =
typeof this.config.customClass === 'function'
? this.config.customClass()
: this.config.customClass;
typeof this._config.customClass === 'function'
? this._config.customClass()
: this._config.customClass;
if (customClass) {
tip.classList.add(...customClass.split(' '));
@ -645,13 +608,9 @@
}
};
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
const transitionDuration = getTransitionDurationFromElement(this.tip);
EventHandler__default['default'].one(this.tip, 'transitionend', complete);
emulateTransitionEnd(this.tip, transitionDuration);
} else {
complete();
}
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE);
this._queueCallback(complete, this.tip, isAnimated);
}
hide() {
@ -704,14 +663,9 @@
this._activeTrigger[TRIGGER_CLICK] = false;
this._activeTrigger[TRIGGER_FOCUS] = false;
this._activeTrigger[TRIGGER_HOVER] = false;
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE);
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
const transitionDuration = getTransitionDurationFromElement(tip);
EventHandler__default['default'].one(tip, 'transitionend', complete);
emulateTransitionEnd(tip, transitionDuration);
} else {
complete();
}
this._queueCallback(complete, this.tip, isAnimated);
this._hoverState = '';
}
@ -732,7 +686,7 @@
}
const element = document.createElement('div');
element.innerHTML = this.config.template;
element.innerHTML = this._config.template;
this.tip = element.children[0];
return this.tip;
}
@ -751,12 +705,10 @@
return;
}
if (typeof content === 'object' && isElement(content)) {
if (content.jquery) {
content = content[0];
} // content is a DOM node or a jQuery
if (isElement(content)) {
content = getElement(content); // content is a DOM node or a jQuery
if (this.config.html) {
if (this._config.html) {
if (content.parentNode !== element) {
element.innerHTML = '';
element.appendChild(content);
@ -768,9 +720,9 @@
return;
}
if (this.config.html) {
if (this.config.sanitize) {
content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn);
if (this._config.html) {
if (this._config.sanitize) {
content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
}
element.innerHTML = content;
@ -784,9 +736,9 @@
if (!title) {
title =
typeof this.config.title === 'function'
? this.config.title.call(this._element)
: this.config.title;
typeof this._config.title === 'function'
? this._config.title.call(this._element)
: this._config.title;
}
return title;
@ -817,7 +769,7 @@
}
_getOffset() {
const { offset } = this.config;
const { offset } = this._config;
if (typeof offset === 'string') {
return offset.split(',').map((val) => Number.parseInt(val, 10));
@ -837,7 +789,7 @@
{
name: 'flip',
options: {
fallbackPlacements: this.config.fallbackPlacements,
fallbackPlacements: this._config.fallbackPlacements,
},
},
{
@ -849,7 +801,7 @@
{
name: 'preventOverflow',
options: {
boundary: this.config.boundary,
boundary: this._config.boundary,
},
},
{
@ -873,9 +825,9 @@
};
return {
...defaultBsPopperConfig,
...(typeof this.config.popperConfig === 'function'
? this.config.popperConfig(defaultBsPopperConfig)
: this.config.popperConfig),
...(typeof this._config.popperConfig === 'function'
? this._config.popperConfig(defaultBsPopperConfig)
: this._config.popperConfig),
};
}
@ -883,30 +835,19 @@
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
}
_getContainer() {
if (this.config.container === false) {
return document.body;
}
if (isElement(this.config.container)) {
return this.config.container;
}
return SelectorEngine__default['default'].findOne(this.config.container);
}
_getAttachment(placement) {
return AttachmentMap[placement.toUpperCase()];
}
_setListeners() {
const triggers = this.config.trigger.split(' ');
const triggers = this._config.trigger.split(' ');
triggers.forEach((trigger) => {
if (trigger === 'click') {
EventHandler__default['default'].on(
this._element,
this.constructor.Event.CLICK,
this.config.selector,
this._config.selector,
(event) => this.toggle(event)
);
} else if (trigger !== TRIGGER_MANUAL) {
@ -921,13 +862,13 @@
EventHandler__default['default'].on(
this._element,
eventIn,
this.config.selector,
this._config.selector,
(event) => this._enter(event)
);
EventHandler__default['default'].on(
this._element,
eventOut,
this.config.selector,
this._config.selector,
(event) => this._leave(event)
);
}
@ -945,8 +886,8 @@
this._hideModalHandler
);
if (this.config.selector) {
this.config = { ...this.config, trigger: 'manual', selector: '' };
if (this._config.selector) {
this._config = { ...this._config, trigger: 'manual', selector: '' };
} else {
this._fixTitle();
}
@ -986,7 +927,7 @@
clearTimeout(context._timeout);
context._hoverState = HOVER_STATE_SHOW;
if (!context.config.delay || !context.config.delay.show) {
if (!context._config.delay || !context._config.delay.show) {
context.show();
return;
}
@ -995,7 +936,7 @@
if (context._hoverState === HOVER_STATE_SHOW) {
context.show();
}
}, context.config.delay.show);
}, context._config.delay.show);
}
_leave(event, context) {
@ -1014,7 +955,7 @@
clearTimeout(context._timeout);
context._hoverState = HOVER_STATE_OUT;
if (!context.config.delay || !context.config.delay.hide) {
if (!context._config.delay || !context._config.delay.hide) {
context.hide();
return;
}
@ -1023,7 +964,7 @@
if (context._hoverState === HOVER_STATE_OUT) {
context.hide();
}
}, context.config.delay.hide);
}, context._config.delay.hide);
}
_isWithActiveTrigger() {
@ -1043,16 +984,12 @@
delete dataAttributes[dataAttr];
}
});
if (config && typeof config.container === 'object' && config.container.jquery) {
config.container = config.container[0];
}
config = {
...this.constructor.Default,
...dataAttributes,
...(typeof config === 'object' && config ? config : {}),
};
config.container = config.container === false ? document.body : getElement(config.container);
if (typeof config.delay === 'number') {
config.delay = {
@ -1081,10 +1018,10 @@
_getDelegateConfig() {
const config = {};
if (this.config) {
for (const key in this.config) {
if (this.constructor.Default[key] !== this.config[key]) {
config[key] = this.config[key];
if (this._config) {
for (const key in this._config) {
if (this.constructor.Default[key] !== this._config[key]) {
config[key] = this._config[key];
}
}
}
@ -1146,7 +1083,7 @@
* add .Tooltip to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Tooltip);
defineJQueryPlugin(Tooltip);
return Tooltip;
});

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,11 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): alert.js
* Bootstrap (v5.0.1): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
emulateTransitionEnd,
getElementFromSelector,
getTransitionDurationFromElement,
} from './util/index';
import { defineJQueryPlugin, getElementFromSelector } from './util/index';
import Data from './dom/data';
import EventHandler from './dom/event-handler';
import BaseComponent from './base-component';
@ -45,8 +40,8 @@ const CLASS_NAME_SHOW = 'show';
class Alert extends BaseComponent {
// Getters
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -75,15 +70,8 @@ class Alert extends BaseComponent {
_removeElement(element) {
element.classList.remove(CLASS_NAME_SHOW);
if (!element.classList.contains(CLASS_NAME_FADE)) {
this._destroyElement(element);
return;
}
const transitionDuration = getTransitionDurationFromElement(element);
EventHandler.one(element, 'transitionend', () => this._destroyElement(element));
emulateTransitionEnd(element, transitionDuration);
const isAnimated = element.classList.contains(CLASS_NAME_FADE);
this._queueCallback(() => this._destroyElement(element), element, isAnimated);
}
_destroyElement(element) {
@ -136,6 +124,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDi
* add .Alert to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Alert);
defineJQueryPlugin(Alert);
export default Alert;

View File

@ -1,11 +1,17 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): base-component.js
* Bootstrap (v5.0.1): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import Data from './dom/data';
import {
emulateTransitionEnd,
execute,
getElement,
getTransitionDurationFromElement,
} from './util/index';
import EventHandler from './dom/event-handler';
/**
@ -14,11 +20,11 @@ import EventHandler from './dom/event-handler';
* ------------------------------------------------------------------------
*/
const VERSION = '5.0.0';
const VERSION = '5.0.1';
class BaseComponent {
constructor(element) {
element = typeof element === 'string' ? document.querySelector(element) : element;
element = getElement(element);
if (!element) {
return;
@ -30,8 +36,23 @@ class BaseComponent {
dispose() {
Data.remove(this._element, this.constructor.DATA_KEY);
EventHandler.off(this._element, `.${this.constructor.DATA_KEY}`);
this._element = null;
EventHandler.off(this._element, this.constructor.EVENT_KEY);
Object.getOwnPropertyNames(this).forEach((propertyName) => {
this[propertyName] = null;
});
}
_queueCallback(callback, element, isAnimated = true) {
if (!isAnimated) {
execute(callback);
return;
}
const transitionDuration = getTransitionDurationFromElement(element);
EventHandler.one(element, 'transitionend', () => execute(callback));
emulateTransitionEnd(element, transitionDuration);
}
/** Static */
@ -43,6 +64,18 @@ class BaseComponent {
static get VERSION() {
return VERSION;
}
static get NAME() {
throw new Error('You have to implement the static method "NAME", for each component!');
}
static get DATA_KEY() {
return `bs.${this.NAME}`;
}
static get EVENT_KEY() {
return `.${this.DATA_KEY}`;
}
}
export default BaseComponent;

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): button.js
* Bootstrap (v5.0.1): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -36,8 +36,8 @@ const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
class Button extends BaseComponent {
// Getters
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -90,6 +90,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, (event) =>
* add .Button to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Button);
defineJQueryPlugin(Button);
export default Button;

View File

@ -1,15 +1,13 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): carousel.js
* Bootstrap (v5.0.1): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
emulateTransitionEnd,
getElementFromSelector,
getTransitionDurationFromElement,
isRTL,
isVisible,
reflow,
@ -130,8 +128,8 @@ class Carousel extends BaseComponent {
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -214,18 +212,6 @@ class Carousel extends BaseComponent {
this._slide(order, this._items[index]);
}
dispose() {
this._items = null;
this._config = null;
this._interval = null;
this._isPaused = null;
this._isSliding = null;
this._activeElement = null;
this._indicatorsElement = null;
super.dispose();
}
// Private
_getConfig(config) {
@ -465,6 +451,15 @@ class Carousel extends BaseComponent {
this._setActiveIndicatorElement(nextElement);
this._activeElement = nextElement;
const triggerSlidEvent = () => {
EventHandler.trigger(this._element, EVENT_SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
to: nextElementIndex,
});
};
if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
nextElement.classList.add(orderClassName);
@ -473,9 +468,7 @@ class Carousel extends BaseComponent {
activeElement.classList.add(directionalClassName);
nextElement.classList.add(directionalClassName);
const transitionDuration = getTransitionDurationFromElement(activeElement);
EventHandler.one(activeElement, 'transitionend', () => {
const completeCallBack = () => {
nextElement.classList.remove(directionalClassName, orderClassName);
nextElement.classList.add(CLASS_NAME_ACTIVE);
@ -483,28 +476,16 @@ class Carousel extends BaseComponent {
this._isSliding = false;
setTimeout(() => {
EventHandler.trigger(this._element, EVENT_SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
to: nextElementIndex,
});
}, 0);
});
setTimeout(triggerSlidEvent, 0);
};
emulateTransitionEnd(activeElement, transitionDuration);
this._queueCallback(completeCallBack, activeElement, true);
} else {
activeElement.classList.remove(CLASS_NAME_ACTIVE);
nextElement.classList.add(CLASS_NAME_ACTIVE);
this._isSliding = false;
EventHandler.trigger(this._element, EVENT_SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
to: nextElementIndex,
});
triggerSlidEvent();
}
if (isCycling) {
@ -628,6 +609,6 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
* add .Carousel to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Carousel);
defineJQueryPlugin(Carousel);
export default Carousel;

View File

@ -1,17 +1,15 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): collapse.js
* Bootstrap (v5.0.1): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
emulateTransitionEnd,
getElement,
getSelectorFromElement,
getElementFromSelector,
getTransitionDurationFromElement,
isElement,
reflow,
typeCheckConfig,
} from './util/index';
@ -108,8 +106,8 @@ class Collapse extends BaseComponent {
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -200,11 +198,8 @@ class Collapse extends BaseComponent {
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
const scrollSize = `scroll${capitalizedDimension}`;
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
this._queueCallback(complete, this._element, true);
this._element.style[dimension] = `${this._element[scrollSize]}px`;
}
@ -250,24 +245,14 @@ class Collapse extends BaseComponent {
};
this._element.style[dimension] = '';
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
this._queueCallback(complete, this._element, true);
}
setTransitioning(isTransitioning) {
this._isTransitioning = isTransitioning;
}
dispose() {
super.dispose();
this._config = null;
this._parent = null;
this._triggerArray = null;
this._isTransitioning = null;
}
// Private
_getConfig(config) {
@ -287,14 +272,7 @@ class Collapse extends BaseComponent {
_getParent() {
let { parent } = this._config;
if (isElement(parent)) {
// it's a jQuery object
if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') {
parent = parent[0];
}
} else {
parent = SelectorEngine.findOne(parent);
}
parent = getElement(parent);
const selector = `${SELECTOR_DATA_TOGGLE}[data-mdb-parent="${parent}"]`;
@ -404,6 +382,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Collapse to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Collapse);
defineJQueryPlugin(Collapse);
export default Collapse;

View File

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

View File

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

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): dom/manipulator.js
* Bootstrap (v5.0.1): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -46,9 +46,9 @@ const Manipulator = {
const attributes = {};
Object.keys(element.dataset)
.filter((key) => key.startsWith('mdb'))
.filter((key) => key.startsWith('bs'))
.forEach((key) => {
let pureKey = key.replace(/^mdb/, '');
let pureKey = key.replace(/^bs/, '');
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
attributes[pureKey] = normalizeData(element.dataset[key]);
});

View File

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

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): dropdown.js
* Bootstrap (v5.0.1): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -9,6 +9,7 @@ import * as Popper from '@popperjs/core';
import {
defineJQueryPlugin,
getElement,
getElementFromSelector,
isDisabled,
isElement,
@ -116,8 +117,8 @@ class Dropdown extends BaseComponent {
return DefaultType;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -166,12 +167,7 @@ class Dropdown extends BaseComponent {
if (this._config.reference === 'parent') {
referenceElement = parent;
} else if (isElement(this._config.reference)) {
referenceElement = this._config.reference;
// Check if it's jQuery element
if (typeof this._config.reference.jquery !== 'undefined') {
referenceElement = this._config.reference[0];
}
referenceElement = getElement(this._config.reference);
} else if (typeof this._config.reference === 'object') {
referenceElement = this._config.reference;
}
@ -219,11 +215,8 @@ class Dropdown extends BaseComponent {
}
dispose() {
this._menu = null;
if (this._popper) {
this._popper.destroy();
this._popper = null;
}
super.dispose();
@ -424,17 +417,11 @@ class Dropdown extends BaseComponent {
}
static clearMenus(event) {
if (event) {
if (
event.button === RIGHT_MOUSE_BUTTON ||
(event.type === 'keyup' && event.key !== TAB_KEY)
) {
return;
}
if (/input|select|option|textarea|form/i.test(event.target.tagName)) {
return;
}
if (
event &&
(event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY))
) {
return;
}
const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
@ -464,11 +451,11 @@ class Dropdown extends BaseComponent {
continue;
}
// Tab navigation through the dropdown menu shouldn't close the menu
// Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
if (
event.type === 'keyup' &&
event.key === TAB_KEY &&
context._menu.contains(event.target)
context._menu.contains(event.target) &&
((event.type === 'keyup' && event.key === TAB_KEY) ||
/input|select|option|textarea|form/i.test(event.target.tagName))
) {
continue;
}
@ -570,6 +557,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Dropdown to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Dropdown);
defineJQueryPlugin(Dropdown);
export default Dropdown;

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): modal.js
* Bootstrap (v5.0.1): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -97,8 +97,8 @@ class Modal extends BaseComponent {
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -182,19 +182,13 @@ class Modal extends BaseComponent {
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
if (isAnimated) {
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', (event) => this._hideModal(event));
emulateTransitionEnd(this._element, transitionDuration);
} else {
this._hideModal();
}
this._queueCallback(() => this._hideModal(), this._element, isAnimated);
}
dispose() {
[window, this._dialog].forEach((htmlElement) => EventHandler.off(htmlElement, EVENT_KEY));
this._backdrop.dispose();
super.dispose();
/**
@ -203,14 +197,6 @@ class Modal extends BaseComponent {
* It will remove `EVENT_CLICK_DATA_API` event that should remain
*/
EventHandler.off(document, EVENT_FOCUSIN);
this._config = null;
this._dialog = null;
this._backdrop.dispose();
this._backdrop = null;
this._isShown = null;
this._ignoreBackdropClick = null;
this._isTransitioning = null;
}
handleUpdate() {
@ -276,14 +262,7 @@ class Modal extends BaseComponent {
});
};
if (isAnimated) {
const transitionDuration = getTransitionDurationFromElement(this._dialog);
EventHandler.one(this._dialog, 'transitionend', transitionComplete);
emulateTransitionEnd(this._dialog, transitionDuration);
} else {
transitionComplete();
}
this._queueCallback(transitionComplete, this._dialog, isAnimated);
}
_enforceFocus() {
@ -476,6 +455,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Modal to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Modal);
defineJQueryPlugin(Modal);
export default Modal;

View File

@ -1,15 +1,13 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): offcanvas.js
* Bootstrap (v5.0.1): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
emulateTransitionEnd,
getElementFromSelector,
getTransitionDurationFromElement,
isDisabled,
isVisible,
typeCheckConfig,
@ -80,12 +78,12 @@ class Offcanvas extends BaseComponent {
// Getters
static get Default() {
return Default;
static get NAME() {
return NAME;
}
static get DATA_KEY() {
return DATA_KEY;
static get Default() {
return Default;
}
// Public
@ -124,9 +122,7 @@ class Offcanvas extends BaseComponent {
EventHandler.trigger(this._element, EVENT_SHOWN, { relatedTarget });
};
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', completeCallBack);
emulateTransitionEnd(this._element, transitionDuration);
this._queueCallback(completeCallBack, this._element, true);
}
hide() {
@ -159,18 +155,13 @@ class Offcanvas extends BaseComponent {
EventHandler.trigger(this._element, EVENT_HIDDEN);
};
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', completeCallback);
emulateTransitionEnd(this._element, transitionDuration);
this._queueCallback(completeCallback, this._element, true);
}
dispose() {
this._backdrop.dispose();
super.dispose();
EventHandler.off(document, EVENT_FOCUSIN);
this._config = null;
this._backdrop = null;
}
// Private
@ -285,6 +276,6 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
* ------------------------------------------------------------------------
*/
defineJQueryPlugin(NAME, Offcanvas);
defineJQueryPlugin(Offcanvas);
export default Offcanvas;

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): popover.js
* Bootstrap (v5.0.1): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -77,18 +77,10 @@ class Popover extends Tooltip {
return NAME;
}
static get DATA_KEY() {
return DATA_KEY;
}
static get Event() {
return Event;
}
static get EVENT_KEY() {
return EVENT_KEY;
}
static get DefaultType() {
return DefaultType;
}
@ -121,7 +113,7 @@ class Popover extends Tooltip {
}
_getContent() {
return this._element.getAttribute('data-mdb-content') || this.config.content;
return this._element.getAttribute('data-mdb-content') || this._config.content;
}
_cleanTipClass() {
@ -166,6 +158,6 @@ class Popover extends Tooltip {
* add .Popover to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Popover);
defineJQueryPlugin(Popover);
export default Popover;

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): scrollspy.js
* Bootstrap (v5.0.1): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -87,8 +87,8 @@ class ScrollSpy extends BaseComponent {
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -130,16 +130,8 @@ class ScrollSpy extends BaseComponent {
}
dispose() {
super.dispose();
EventHandler.off(this._scrollElement, EVENT_KEY);
this._scrollElement = null;
this._config = null;
this._selector = null;
this._offsets = null;
this._targets = null;
this._activeTarget = null;
this._scrollHeight = null;
super.dispose();
}
// Private
@ -310,6 +302,6 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
* add .ScrollSpy to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, ScrollSpy);
defineJQueryPlugin(ScrollSpy);
export default ScrollSpy;

View File

@ -1,18 +1,11 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): tab.js
* Bootstrap (v5.0.1): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
emulateTransitionEnd,
getElementFromSelector,
getTransitionDurationFromElement,
isDisabled,
reflow,
} from './util/index';
import { defineJQueryPlugin, getElementFromSelector, isDisabled, reflow } from './util/index';
import Data from './dom/data';
import EventHandler from './dom/event-handler';
import SelectorEngine from './dom/selector-engine';
@ -58,8 +51,8 @@ const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
class Tab extends BaseComponent {
// Getters
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -132,11 +125,8 @@ class Tab extends BaseComponent {
const complete = () => this._transitionComplete(element, active, callback);
if (active && isTransitioning) {
const transitionDuration = getTransitionDurationFromElement(active);
active.classList.remove(CLASS_NAME_SHOW);
EventHandler.one(active, 'transitionend', complete);
emulateTransitionEnd(active, transitionDuration);
this._queueCallback(complete, element, true);
} else {
complete();
}
@ -236,6 +226,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Tab to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Tab);
defineJQueryPlugin(Tab);
export default Tab;

View File

@ -1,17 +1,11 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): toast.js
* Bootstrap (v5.0.1): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
emulateTransitionEnd,
getTransitionDurationFromElement,
reflow,
typeCheckConfig,
} from './util/index';
import { defineJQueryPlugin, reflow, typeCheckConfig } from './util/index';
import Data from './dom/data';
import EventHandler from './dom/event-handler';
import Manipulator from './dom/manipulator';
@ -28,6 +22,10 @@ const DATA_KEY = 'bs.toast';
const EVENT_KEY = `.${DATA_KEY}`;
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
const EVENT_HIDE = `hide${EVENT_KEY}`;
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
const EVENT_SHOW = `show${EVENT_KEY}`;
@ -64,6 +62,8 @@ class Toast extends BaseComponent {
this._config = this._getConfig(config);
this._timeout = null;
this._hasMouseInteraction = false;
this._hasKeyboardInteraction = false;
this._setListeners();
}
@ -77,8 +77,8 @@ class Toast extends BaseComponent {
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -102,24 +102,14 @@ class Toast extends BaseComponent {
EventHandler.trigger(this._element, EVENT_SHOWN);
if (this._config.autohide) {
this._timeout = setTimeout(() => {
this.hide();
}, this._config.delay);
}
this._maybeScheduleHide();
};
this._element.classList.remove(CLASS_NAME_HIDE);
reflow(this._element);
this._element.classList.add(CLASS_NAME_SHOWING);
if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
} else {
complete();
}
this._queueCallback(complete, this._element, this._config.animation);
}
hide() {
@ -139,14 +129,7 @@ class Toast extends BaseComponent {
};
this._element.classList.remove(CLASS_NAME_SHOW);
if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
} else {
complete();
}
this._queueCallback(complete, this._element, this._config.animation);
}
dispose() {
@ -157,7 +140,6 @@ class Toast extends BaseComponent {
}
super.dispose();
this._config = null;
}
// Private
@ -174,8 +156,53 @@ class Toast extends BaseComponent {
return config;
}
_maybeScheduleHide() {
if (!this._config.autohide) {
return;
}
if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
return;
}
this._timeout = setTimeout(() => {
this.hide();
}, this._config.delay);
}
_onInteraction(event, isInteracting) {
switch (event.type) {
case 'mouseover':
case 'mouseout':
this._hasMouseInteraction = isInteracting;
break;
case 'focusin':
case 'focusout':
this._hasKeyboardInteraction = isInteracting;
break;
default:
break;
}
if (isInteracting) {
this._clearTimeout();
return;
}
const nextElement = event.relatedTarget;
if (this._element === nextElement || this._element.contains(nextElement)) {
return;
}
this._maybeScheduleHide();
}
_setListeners() {
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
EventHandler.on(this._element, EVENT_MOUSEOVER, (event) => this._onInteraction(event, true));
EventHandler.on(this._element, EVENT_MOUSEOUT, (event) => this._onInteraction(event, false));
EventHandler.on(this._element, EVENT_FOCUSIN, (event) => this._onInteraction(event, true));
EventHandler.on(this._element, EVENT_FOCUSOUT, (event) => this._onInteraction(event, false));
}
_clearTimeout() {
@ -212,6 +239,6 @@ class Toast extends BaseComponent {
* add .Toast to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Toast);
defineJQueryPlugin(Toast);
export default Toast;

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): tooltip.js
* Bootstrap (v5.0.1): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -9,9 +9,8 @@ import * as Popper from '@popperjs/core';
import {
defineJQueryPlugin,
emulateTransitionEnd,
findShadowRoot,
getTransitionDurationFromElement,
getElement,
getUID,
isElement,
isRTL,
@ -139,7 +138,7 @@ class Tooltip extends BaseComponent {
this._popper = null;
// Protected
this.config = this._getConfig(config);
this._config = this._getConfig(config);
this.tip = null;
this._setListeners();
@ -155,18 +154,10 @@ class Tooltip extends BaseComponent {
return NAME;
}
static get DATA_KEY() {
return DATA_KEY;
}
static get Event() {
return Event;
}
static get EVENT_KEY() {
return EVENT_KEY;
}
static get DefaultType() {
return DefaultType;
}
@ -223,17 +214,10 @@ class Tooltip extends BaseComponent {
this.tip.parentNode.removeChild(this.tip);
}
this._isEnabled = null;
this._timeout = null;
this._hoverState = null;
this._activeTrigger = null;
if (this._popper) {
this._popper.destroy();
}
this._popper = null;
this.config = null;
this.tip = null;
super.dispose();
}
@ -265,19 +249,19 @@ class Tooltip extends BaseComponent {
this.setContent();
if (this.config.animation) {
if (this._config.animation) {
tip.classList.add(CLASS_NAME_FADE);
}
const placement =
typeof this.config.placement === 'function'
? this.config.placement.call(this, tip, this._element)
: this.config.placement;
typeof this._config.placement === 'function'
? this._config.placement.call(this, tip, this._element)
: this._config.placement;
const attachment = this._getAttachment(placement);
this._addAttachmentClass(attachment);
const container = this._getContainer();
const { container } = this._config;
Data.set(tip, this.constructor.DATA_KEY, this);
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
@ -294,9 +278,9 @@ class Tooltip extends BaseComponent {
tip.classList.add(CLASS_NAME_SHOW);
const customClass =
typeof this.config.customClass === 'function'
? this.config.customClass()
: this.config.customClass;
typeof this._config.customClass === 'function'
? this._config.customClass()
: this._config.customClass;
if (customClass) {
tip.classList.add(...customClass.split(' '));
}
@ -322,13 +306,8 @@ class Tooltip extends BaseComponent {
}
};
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
const transitionDuration = getTransitionDurationFromElement(this.tip);
EventHandler.one(this.tip, 'transitionend', complete);
emulateTransitionEnd(this.tip, transitionDuration);
} else {
complete();
}
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE);
this._queueCallback(complete, this.tip, isAnimated);
}
hide() {
@ -375,15 +354,8 @@ class Tooltip extends BaseComponent {
this._activeTrigger[TRIGGER_FOCUS] = false;
this._activeTrigger[TRIGGER_HOVER] = false;
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
const transitionDuration = getTransitionDurationFromElement(tip);
EventHandler.one(tip, 'transitionend', complete);
emulateTransitionEnd(tip, transitionDuration);
} else {
complete();
}
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE);
this._queueCallback(complete, this.tip, isAnimated);
this._hoverState = '';
}
@ -405,7 +377,7 @@ class Tooltip extends BaseComponent {
}
const element = document.createElement('div');
element.innerHTML = this.config.template;
element.innerHTML = this._config.template;
this.tip = element.children[0];
return this.tip;
@ -422,13 +394,11 @@ class Tooltip extends BaseComponent {
return;
}
if (typeof content === 'object' && isElement(content)) {
if (content.jquery) {
content = content[0];
}
if (isElement(content)) {
content = getElement(content);
// content is a DOM node or a jQuery
if (this.config.html) {
if (this._config.html) {
if (content.parentNode !== element) {
element.innerHTML = '';
element.appendChild(content);
@ -440,9 +410,9 @@ class Tooltip extends BaseComponent {
return;
}
if (this.config.html) {
if (this.config.sanitize) {
content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn);
if (this._config.html) {
if (this._config.sanitize) {
content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
}
element.innerHTML = content;
@ -456,9 +426,9 @@ class Tooltip extends BaseComponent {
if (!title) {
title =
typeof this.config.title === 'function'
? this.config.title.call(this._element)
: this.config.title;
typeof this._config.title === 'function'
? this._config.title.call(this._element)
: this._config.title;
}
return title;
@ -491,7 +461,7 @@ class Tooltip extends BaseComponent {
}
_getOffset() {
const { offset } = this.config;
const { offset } = this._config;
if (typeof offset === 'string') {
return offset.split(',').map((val) => Number.parseInt(val, 10));
@ -511,7 +481,7 @@ class Tooltip extends BaseComponent {
{
name: 'flip',
options: {
fallbackPlacements: this.config.fallbackPlacements,
fallbackPlacements: this._config.fallbackPlacements,
},
},
{
@ -523,7 +493,7 @@ class Tooltip extends BaseComponent {
{
name: 'preventOverflow',
options: {
boundary: this.config.boundary,
boundary: this._config.boundary,
},
},
{
@ -548,9 +518,9 @@ class Tooltip extends BaseComponent {
return {
...defaultBsPopperConfig,
...(typeof this.config.popperConfig === 'function'
? this.config.popperConfig(defaultBsPopperConfig)
: this.config.popperConfig),
...(typeof this._config.popperConfig === 'function'
? this._config.popperConfig(defaultBsPopperConfig)
: this._config.popperConfig),
};
}
@ -558,31 +528,19 @@ class Tooltip extends BaseComponent {
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
}
_getContainer() {
if (this.config.container === false) {
return document.body;
}
if (isElement(this.config.container)) {
return this.config.container;
}
return SelectorEngine.findOne(this.config.container);
}
_getAttachment(placement) {
return AttachmentMap[placement.toUpperCase()];
}
_setListeners() {
const triggers = this.config.trigger.split(' ');
const triggers = this._config.trigger.split(' ');
triggers.forEach((trigger) => {
if (trigger === 'click') {
EventHandler.on(
this._element,
this.constructor.Event.CLICK,
this.config.selector,
this._config.selector,
(event) => this.toggle(event)
);
} else if (trigger !== TRIGGER_MANUAL) {
@ -595,10 +553,10 @@ class Tooltip extends BaseComponent {
? this.constructor.Event.MOUSELEAVE
: this.constructor.Event.FOCUSOUT;
EventHandler.on(this._element, eventIn, this.config.selector, (event) =>
EventHandler.on(this._element, eventIn, this._config.selector, (event) =>
this._enter(event)
);
EventHandler.on(this._element, eventOut, this.config.selector, (event) =>
EventHandler.on(this._element, eventOut, this._config.selector, (event) =>
this._leave(event)
);
}
@ -616,9 +574,9 @@ class Tooltip extends BaseComponent {
this._hideModalHandler
);
if (this.config.selector) {
this.config = {
...this.config,
if (this._config.selector) {
this._config = {
...this._config,
trigger: 'manual',
selector: '',
};
@ -660,7 +618,7 @@ class Tooltip extends BaseComponent {
context._hoverState = HOVER_STATE_SHOW;
if (!context.config.delay || !context.config.delay.show) {
if (!context._config.delay || !context._config.delay.show) {
context.show();
return;
}
@ -669,7 +627,7 @@ class Tooltip extends BaseComponent {
if (context._hoverState === HOVER_STATE_SHOW) {
context.show();
}
}, context.config.delay.show);
}, context._config.delay.show);
}
_leave(event, context) {
@ -689,7 +647,7 @@ class Tooltip extends BaseComponent {
context._hoverState = HOVER_STATE_OUT;
if (!context.config.delay || !context.config.delay.hide) {
if (!context._config.delay || !context._config.delay.hide) {
context.hide();
return;
}
@ -698,7 +656,7 @@ class Tooltip extends BaseComponent {
if (context._hoverState === HOVER_STATE_OUT) {
context.hide();
}
}, context.config.delay.hide);
}, context._config.delay.hide);
}
_isWithActiveTrigger() {
@ -720,16 +678,14 @@ class Tooltip extends BaseComponent {
}
});
if (config && typeof config.container === 'object' && config.container.jquery) {
config.container = config.container[0];
}
config = {
...this.constructor.Default,
...dataAttributes,
...(typeof config === 'object' && config ? config : {}),
};
config.container = config.container === false ? document.body : getElement(config.container);
if (typeof config.delay === 'number') {
config.delay = {
show: config.delay,
@ -757,10 +713,10 @@ class Tooltip extends BaseComponent {
_getDelegateConfig() {
const config = {};
if (this.config) {
for (const key in this.config) {
if (this.constructor.Default[key] !== this.config[key]) {
config[key] = this.config[key];
if (this._config) {
for (const key in this._config) {
if (this.constructor.Default[key] !== this._config[key]) {
config[key] = this._config[key];
}
}
}
@ -821,6 +777,6 @@ class Tooltip extends BaseComponent {
* add .Tooltip to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Tooltip);
defineJQueryPlugin(Tooltip);
export default Tooltip;

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/backdrop.js
* Bootstrap (v5.0.1): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@ -95,6 +95,8 @@ class Backdrop {
...Default,
...(typeof config === 'object' ? config : {}),
};
config.rootElement = config.rootElement || document.body;
typeCheckConfig(NAME, config, DefaultType);
return config;
}

View File

@ -1,6 +1,8 @@
import SelectorEngine from '../dom/selector-engine';
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Bootstrap (v5.0.1): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -106,7 +108,30 @@ const triggerTransitionEnd = (element) => {
element.dispatchEvent(new Event(TRANSITION_END));
};
const isElement = (obj) => (obj[0] || obj).nodeType;
const isElement = (obj) => {
if (!obj || typeof obj !== 'object') {
return false;
}
if (typeof obj.jquery !== 'undefined') {
obj = obj[0];
}
return typeof obj.nodeType !== 'undefined';
};
const getElement = (obj) => {
if (isElement(obj)) {
// it's a jQuery object or a node element
return obj.jquery ? obj[0] : obj;
}
if (typeof obj === 'string' && obj.length > 0) {
return SelectorEngine.findOne(obj);
}
return null;
};
const emulateTransitionEnd = (element, duration) => {
let called = false;
@ -222,11 +247,12 @@ const onDOMContentLoaded = (callback) => {
const isRTL = () => document.documentElement.dir === 'rtl';
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -245,6 +271,7 @@ const execute = (callback) => {
};
export {
getElement,
getUID,
getSelectorFromElement,
getElementFromSelector,

View File

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

View File

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

View File

@ -1,16 +1,11 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): alert.js
* Bootstrap (v5.0.1): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
emulateTransitionEnd,
getElementFromSelector,
getTransitionDurationFromElement,
} from './util/index';
import { defineJQueryPlugin, getElementFromSelector } from './util/index';
import Data from './dom/data';
import EventHandler from './dom/event-handler';
import BaseComponent from './base-component';
@ -45,8 +40,8 @@ const CLASS_NAME_SHOW = 'show';
class Alert extends BaseComponent {
// Getters
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -75,15 +70,8 @@ class Alert extends BaseComponent {
_removeElement(element) {
element.classList.remove(CLASS_NAME_SHOW);
if (!element.classList.contains(CLASS_NAME_FADE)) {
this._destroyElement(element);
return;
}
const transitionDuration = getTransitionDurationFromElement(element);
EventHandler.one(element, 'transitionend', () => this._destroyElement(element));
emulateTransitionEnd(element, transitionDuration);
const isAnimated = element.classList.contains(CLASS_NAME_FADE);
this._queueCallback(() => this._destroyElement(element), element, isAnimated);
}
_destroyElement(element) {
@ -136,6 +124,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDi
* add .Alert to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Alert);
defineJQueryPlugin(Alert);
export default Alert;

View File

@ -1,11 +1,17 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): base-component.js
* Bootstrap (v5.0.1): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import Data from './dom/data';
import {
emulateTransitionEnd,
execute,
getElement,
getTransitionDurationFromElement,
} from './util/index';
import EventHandler from './dom/event-handler';
/**
@ -14,11 +20,11 @@ import EventHandler from './dom/event-handler';
* ------------------------------------------------------------------------
*/
const VERSION = '5.0.0';
const VERSION = '5.0.1';
class BaseComponent {
constructor(element) {
element = typeof element === 'string' ? document.querySelector(element) : element;
element = getElement(element);
if (!element) {
return;
@ -30,8 +36,23 @@ class BaseComponent {
dispose() {
Data.remove(this._element, this.constructor.DATA_KEY);
EventHandler.off(this._element, `.${this.constructor.DATA_KEY}`);
this._element = null;
EventHandler.off(this._element, this.constructor.EVENT_KEY);
Object.getOwnPropertyNames(this).forEach((propertyName) => {
this[propertyName] = null;
});
}
_queueCallback(callback, element, isAnimated = true) {
if (!isAnimated) {
execute(callback);
return;
}
const transitionDuration = getTransitionDurationFromElement(element);
EventHandler.one(element, 'transitionend', () => execute(callback));
emulateTransitionEnd(element, transitionDuration);
}
/** Static */
@ -43,6 +64,18 @@ class BaseComponent {
static get VERSION() {
return VERSION;
}
static get NAME() {
throw new Error('You have to implement the static method "NAME", for each component!');
}
static get DATA_KEY() {
return `bs.${this.NAME}`;
}
static get EVENT_KEY() {
return `.${this.DATA_KEY}`;
}
}
export default BaseComponent;

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): button.js
* Bootstrap (v5.0.1): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -36,8 +36,8 @@ const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
class Button extends BaseComponent {
// Getters
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -90,6 +90,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, (event) =>
* add .Button to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Button);
defineJQueryPlugin(Button);
export default Button;

View File

@ -1,15 +1,13 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): carousel.js
* Bootstrap (v5.0.1): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
emulateTransitionEnd,
getElementFromSelector,
getTransitionDurationFromElement,
isRTL,
isVisible,
reflow,
@ -130,8 +128,8 @@ class Carousel extends BaseComponent {
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -214,18 +212,6 @@ class Carousel extends BaseComponent {
this._slide(order, this._items[index]);
}
dispose() {
this._items = null;
this._config = null;
this._interval = null;
this._isPaused = null;
this._isSliding = null;
this._activeElement = null;
this._indicatorsElement = null;
super.dispose();
}
// Private
_getConfig(config) {
@ -465,6 +451,15 @@ class Carousel extends BaseComponent {
this._setActiveIndicatorElement(nextElement);
this._activeElement = nextElement;
const triggerSlidEvent = () => {
EventHandler.trigger(this._element, EVENT_SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
to: nextElementIndex,
});
};
if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
nextElement.classList.add(orderClassName);
@ -473,9 +468,7 @@ class Carousel extends BaseComponent {
activeElement.classList.add(directionalClassName);
nextElement.classList.add(directionalClassName);
const transitionDuration = getTransitionDurationFromElement(activeElement);
EventHandler.one(activeElement, 'transitionend', () => {
const completeCallBack = () => {
nextElement.classList.remove(directionalClassName, orderClassName);
nextElement.classList.add(CLASS_NAME_ACTIVE);
@ -483,28 +476,16 @@ class Carousel extends BaseComponent {
this._isSliding = false;
setTimeout(() => {
EventHandler.trigger(this._element, EVENT_SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
to: nextElementIndex,
});
}, 0);
});
setTimeout(triggerSlidEvent, 0);
};
emulateTransitionEnd(activeElement, transitionDuration);
this._queueCallback(completeCallBack, activeElement, true);
} else {
activeElement.classList.remove(CLASS_NAME_ACTIVE);
nextElement.classList.add(CLASS_NAME_ACTIVE);
this._isSliding = false;
EventHandler.trigger(this._element, EVENT_SLID, {
relatedTarget: nextElement,
direction: eventDirectionName,
from: activeElementIndex,
to: nextElementIndex,
});
triggerSlidEvent();
}
if (isCycling) {
@ -628,6 +609,6 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
* add .Carousel to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Carousel);
defineJQueryPlugin(Carousel);
export default Carousel;

View File

@ -1,17 +1,15 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): collapse.js
* Bootstrap (v5.0.1): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
emulateTransitionEnd,
getElement,
getSelectorFromElement,
getElementFromSelector,
getTransitionDurationFromElement,
isElement,
reflow,
typeCheckConfig,
} from './util/index';
@ -108,8 +106,8 @@ class Collapse extends BaseComponent {
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -200,11 +198,8 @@ class Collapse extends BaseComponent {
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
const scrollSize = `scroll${capitalizedDimension}`;
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
this._queueCallback(complete, this._element, true);
this._element.style[dimension] = `${this._element[scrollSize]}px`;
}
@ -250,24 +245,14 @@ class Collapse extends BaseComponent {
};
this._element.style[dimension] = '';
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
this._queueCallback(complete, this._element, true);
}
setTransitioning(isTransitioning) {
this._isTransitioning = isTransitioning;
}
dispose() {
super.dispose();
this._config = null;
this._parent = null;
this._triggerArray = null;
this._isTransitioning = null;
}
// Private
_getConfig(config) {
@ -287,14 +272,7 @@ class Collapse extends BaseComponent {
_getParent() {
let { parent } = this._config;
if (isElement(parent)) {
// it's a jQuery object
if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') {
parent = parent[0];
}
} else {
parent = SelectorEngine.findOne(parent);
}
parent = getElement(parent);
const selector = `${SELECTOR_DATA_TOGGLE}[data-bs-parent="${parent}"]`;
@ -404,6 +382,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Collapse to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Collapse);
defineJQueryPlugin(Collapse);
export default Collapse;

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): dropdown.js
* Bootstrap (v5.0.1): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -9,6 +9,7 @@ import * as Popper from '@popperjs/core';
import {
defineJQueryPlugin,
getElement,
getElementFromSelector,
isDisabled,
isElement,
@ -116,8 +117,8 @@ class Dropdown extends BaseComponent {
return DefaultType;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -166,12 +167,7 @@ class Dropdown extends BaseComponent {
if (this._config.reference === 'parent') {
referenceElement = parent;
} else if (isElement(this._config.reference)) {
referenceElement = this._config.reference;
// Check if it's jQuery element
if (typeof this._config.reference.jquery !== 'undefined') {
referenceElement = this._config.reference[0];
}
referenceElement = getElement(this._config.reference);
} else if (typeof this._config.reference === 'object') {
referenceElement = this._config.reference;
}
@ -219,11 +215,8 @@ class Dropdown extends BaseComponent {
}
dispose() {
this._menu = null;
if (this._popper) {
this._popper.destroy();
this._popper = null;
}
super.dispose();
@ -424,17 +417,11 @@ class Dropdown extends BaseComponent {
}
static clearMenus(event) {
if (event) {
if (
event.button === RIGHT_MOUSE_BUTTON ||
(event.type === 'keyup' && event.key !== TAB_KEY)
) {
return;
}
if (/input|select|option|textarea|form/i.test(event.target.tagName)) {
return;
}
if (
event &&
(event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY))
) {
return;
}
const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE);
@ -464,11 +451,11 @@ class Dropdown extends BaseComponent {
continue;
}
// Tab navigation through the dropdown menu shouldn't close the menu
// Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
if (
event.type === 'keyup' &&
event.key === TAB_KEY &&
context._menu.contains(event.target)
context._menu.contains(event.target) &&
((event.type === 'keyup' && event.key === TAB_KEY) ||
/input|select|option|textarea|form/i.test(event.target.tagName))
) {
continue;
}
@ -570,6 +557,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Dropdown to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Dropdown);
defineJQueryPlugin(Dropdown);
export default Dropdown;

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): modal.js
* Bootstrap (v5.0.1): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -97,8 +97,8 @@ class Modal extends BaseComponent {
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -182,19 +182,13 @@ class Modal extends BaseComponent {
EventHandler.off(this._element, EVENT_CLICK_DISMISS);
EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
if (isAnimated) {
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', (event) => this._hideModal(event));
emulateTransitionEnd(this._element, transitionDuration);
} else {
this._hideModal();
}
this._queueCallback(() => this._hideModal(), this._element, isAnimated);
}
dispose() {
[window, this._dialog].forEach((htmlElement) => EventHandler.off(htmlElement, EVENT_KEY));
this._backdrop.dispose();
super.dispose();
/**
@ -203,14 +197,6 @@ class Modal extends BaseComponent {
* It will remove `EVENT_CLICK_DATA_API` event that should remain
*/
EventHandler.off(document, EVENT_FOCUSIN);
this._config = null;
this._dialog = null;
this._backdrop.dispose();
this._backdrop = null;
this._isShown = null;
this._ignoreBackdropClick = null;
this._isTransitioning = null;
}
handleUpdate() {
@ -276,14 +262,7 @@ class Modal extends BaseComponent {
});
};
if (isAnimated) {
const transitionDuration = getTransitionDurationFromElement(this._dialog);
EventHandler.one(this._dialog, 'transitionend', transitionComplete);
emulateTransitionEnd(this._dialog, transitionDuration);
} else {
transitionComplete();
}
this._queueCallback(transitionComplete, this._dialog, isAnimated);
}
_enforceFocus() {
@ -476,6 +455,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Modal to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Modal);
defineJQueryPlugin(Modal);
export default Modal;

View File

@ -1,15 +1,13 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): offcanvas.js
* Bootstrap (v5.0.1): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
emulateTransitionEnd,
getElementFromSelector,
getTransitionDurationFromElement,
isDisabled,
isVisible,
typeCheckConfig,
@ -80,12 +78,12 @@ class Offcanvas extends BaseComponent {
// Getters
static get Default() {
return Default;
static get NAME() {
return NAME;
}
static get DATA_KEY() {
return DATA_KEY;
static get Default() {
return Default;
}
// Public
@ -124,9 +122,7 @@ class Offcanvas extends BaseComponent {
EventHandler.trigger(this._element, EVENT_SHOWN, { relatedTarget });
};
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', completeCallBack);
emulateTransitionEnd(this._element, transitionDuration);
this._queueCallback(completeCallBack, this._element, true);
}
hide() {
@ -159,18 +155,13 @@ class Offcanvas extends BaseComponent {
EventHandler.trigger(this._element, EVENT_HIDDEN);
};
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', completeCallback);
emulateTransitionEnd(this._element, transitionDuration);
this._queueCallback(completeCallback, this._element, true);
}
dispose() {
this._backdrop.dispose();
super.dispose();
EventHandler.off(document, EVENT_FOCUSIN);
this._config = null;
this._backdrop = null;
}
// Private
@ -285,6 +276,6 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
* ------------------------------------------------------------------------
*/
defineJQueryPlugin(NAME, Offcanvas);
defineJQueryPlugin(Offcanvas);
export default Offcanvas;

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): popover.js
* Bootstrap (v5.0.1): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -77,18 +77,10 @@ class Popover extends Tooltip {
return NAME;
}
static get DATA_KEY() {
return DATA_KEY;
}
static get Event() {
return Event;
}
static get EVENT_KEY() {
return EVENT_KEY;
}
static get DefaultType() {
return DefaultType;
}
@ -121,7 +113,7 @@ class Popover extends Tooltip {
}
_getContent() {
return this._element.getAttribute('data-bs-content') || this.config.content;
return this._element.getAttribute('data-bs-content') || this._config.content;
}
_cleanTipClass() {
@ -166,6 +158,6 @@ class Popover extends Tooltip {
* add .Popover to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Popover);
defineJQueryPlugin(Popover);
export default Popover;

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): scrollspy.js
* Bootstrap (v5.0.1): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -87,8 +87,8 @@ class ScrollSpy extends BaseComponent {
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -130,16 +130,8 @@ class ScrollSpy extends BaseComponent {
}
dispose() {
super.dispose();
EventHandler.off(this._scrollElement, EVENT_KEY);
this._scrollElement = null;
this._config = null;
this._selector = null;
this._offsets = null;
this._targets = null;
this._activeTarget = null;
this._scrollHeight = null;
super.dispose();
}
// Private
@ -310,6 +302,6 @@ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
* add .ScrollSpy to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, ScrollSpy);
defineJQueryPlugin(ScrollSpy);
export default ScrollSpy;

View File

@ -1,18 +1,11 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): tab.js
* Bootstrap (v5.0.1): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
emulateTransitionEnd,
getElementFromSelector,
getTransitionDurationFromElement,
isDisabled,
reflow,
} from './util/index';
import { defineJQueryPlugin, getElementFromSelector, isDisabled, reflow } from './util/index';
import Data from './dom/data';
import EventHandler from './dom/event-handler';
import SelectorEngine from './dom/selector-engine';
@ -58,8 +51,8 @@ const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
class Tab extends BaseComponent {
// Getters
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -132,11 +125,8 @@ class Tab extends BaseComponent {
const complete = () => this._transitionComplete(element, active, callback);
if (active && isTransitioning) {
const transitionDuration = getTransitionDurationFromElement(active);
active.classList.remove(CLASS_NAME_SHOW);
EventHandler.one(active, 'transitionend', complete);
emulateTransitionEnd(active, transitionDuration);
this._queueCallback(complete, element, true);
} else {
complete();
}
@ -236,6 +226,6 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (
* add .Tab to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Tab);
defineJQueryPlugin(Tab);
export default Tab;

View File

@ -1,17 +1,11 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): toast.js
* Bootstrap (v5.0.1): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import {
defineJQueryPlugin,
emulateTransitionEnd,
getTransitionDurationFromElement,
reflow,
typeCheckConfig,
} from './util/index';
import { defineJQueryPlugin, reflow, typeCheckConfig } from './util/index';
import Data from './dom/data';
import EventHandler from './dom/event-handler';
import Manipulator from './dom/manipulator';
@ -28,6 +22,10 @@ const DATA_KEY = 'bs.toast';
const EVENT_KEY = `.${DATA_KEY}`;
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
const EVENT_HIDE = `hide${EVENT_KEY}`;
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
const EVENT_SHOW = `show${EVENT_KEY}`;
@ -64,6 +62,8 @@ class Toast extends BaseComponent {
this._config = this._getConfig(config);
this._timeout = null;
this._hasMouseInteraction = false;
this._hasKeyboardInteraction = false;
this._setListeners();
}
@ -77,8 +77,8 @@ class Toast extends BaseComponent {
return Default;
}
static get DATA_KEY() {
return DATA_KEY;
static get NAME() {
return NAME;
}
// Public
@ -102,24 +102,14 @@ class Toast extends BaseComponent {
EventHandler.trigger(this._element, EVENT_SHOWN);
if (this._config.autohide) {
this._timeout = setTimeout(() => {
this.hide();
}, this._config.delay);
}
this._maybeScheduleHide();
};
this._element.classList.remove(CLASS_NAME_HIDE);
reflow(this._element);
this._element.classList.add(CLASS_NAME_SHOWING);
if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
} else {
complete();
}
this._queueCallback(complete, this._element, this._config.animation);
}
hide() {
@ -139,14 +129,7 @@ class Toast extends BaseComponent {
};
this._element.classList.remove(CLASS_NAME_SHOW);
if (this._config.animation) {
const transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, 'transitionend', complete);
emulateTransitionEnd(this._element, transitionDuration);
} else {
complete();
}
this._queueCallback(complete, this._element, this._config.animation);
}
dispose() {
@ -157,7 +140,6 @@ class Toast extends BaseComponent {
}
super.dispose();
this._config = null;
}
// Private
@ -174,8 +156,53 @@ class Toast extends BaseComponent {
return config;
}
_maybeScheduleHide() {
if (!this._config.autohide) {
return;
}
if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
return;
}
this._timeout = setTimeout(() => {
this.hide();
}, this._config.delay);
}
_onInteraction(event, isInteracting) {
switch (event.type) {
case 'mouseover':
case 'mouseout':
this._hasMouseInteraction = isInteracting;
break;
case 'focusin':
case 'focusout':
this._hasKeyboardInteraction = isInteracting;
break;
default:
break;
}
if (isInteracting) {
this._clearTimeout();
return;
}
const nextElement = event.relatedTarget;
if (this._element === nextElement || this._element.contains(nextElement)) {
return;
}
this._maybeScheduleHide();
}
_setListeners() {
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
EventHandler.on(this._element, EVENT_MOUSEOVER, (event) => this._onInteraction(event, true));
EventHandler.on(this._element, EVENT_MOUSEOUT, (event) => this._onInteraction(event, false));
EventHandler.on(this._element, EVENT_FOCUSIN, (event) => this._onInteraction(event, true));
EventHandler.on(this._element, EVENT_FOCUSOUT, (event) => this._onInteraction(event, false));
}
_clearTimeout() {
@ -212,6 +239,6 @@ class Toast extends BaseComponent {
* add .Toast to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Toast);
defineJQueryPlugin(Toast);
export default Toast;

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): tooltip.js
* Bootstrap (v5.0.1): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -9,9 +9,8 @@ import * as Popper from '@popperjs/core';
import {
defineJQueryPlugin,
emulateTransitionEnd,
findShadowRoot,
getTransitionDurationFromElement,
getElement,
getUID,
isElement,
isRTL,
@ -139,7 +138,7 @@ class Tooltip extends BaseComponent {
this._popper = null;
// Protected
this.config = this._getConfig(config);
this._config = this._getConfig(config);
this.tip = null;
this._setListeners();
@ -155,18 +154,10 @@ class Tooltip extends BaseComponent {
return NAME;
}
static get DATA_KEY() {
return DATA_KEY;
}
static get Event() {
return Event;
}
static get EVENT_KEY() {
return EVENT_KEY;
}
static get DefaultType() {
return DefaultType;
}
@ -223,17 +214,10 @@ class Tooltip extends BaseComponent {
this.tip.parentNode.removeChild(this.tip);
}
this._isEnabled = null;
this._timeout = null;
this._hoverState = null;
this._activeTrigger = null;
if (this._popper) {
this._popper.destroy();
}
this._popper = null;
this.config = null;
this.tip = null;
super.dispose();
}
@ -265,19 +249,19 @@ class Tooltip extends BaseComponent {
this.setContent();
if (this.config.animation) {
if (this._config.animation) {
tip.classList.add(CLASS_NAME_FADE);
}
const placement =
typeof this.config.placement === 'function'
? this.config.placement.call(this, tip, this._element)
: this.config.placement;
typeof this._config.placement === 'function'
? this._config.placement.call(this, tip, this._element)
: this._config.placement;
const attachment = this._getAttachment(placement);
this._addAttachmentClass(attachment);
const container = this._getContainer();
const { container } = this._config;
Data.set(tip, this.constructor.DATA_KEY, this);
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
@ -294,9 +278,9 @@ class Tooltip extends BaseComponent {
tip.classList.add(CLASS_NAME_SHOW);
const customClass =
typeof this.config.customClass === 'function'
? this.config.customClass()
: this.config.customClass;
typeof this._config.customClass === 'function'
? this._config.customClass()
: this._config.customClass;
if (customClass) {
tip.classList.add(...customClass.split(' '));
}
@ -322,13 +306,8 @@ class Tooltip extends BaseComponent {
}
};
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
const transitionDuration = getTransitionDurationFromElement(this.tip);
EventHandler.one(this.tip, 'transitionend', complete);
emulateTransitionEnd(this.tip, transitionDuration);
} else {
complete();
}
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE);
this._queueCallback(complete, this.tip, isAnimated);
}
hide() {
@ -375,15 +354,8 @@ class Tooltip extends BaseComponent {
this._activeTrigger[TRIGGER_FOCUS] = false;
this._activeTrigger[TRIGGER_HOVER] = false;
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
const transitionDuration = getTransitionDurationFromElement(tip);
EventHandler.one(tip, 'transitionend', complete);
emulateTransitionEnd(tip, transitionDuration);
} else {
complete();
}
const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE);
this._queueCallback(complete, this.tip, isAnimated);
this._hoverState = '';
}
@ -405,7 +377,7 @@ class Tooltip extends BaseComponent {
}
const element = document.createElement('div');
element.innerHTML = this.config.template;
element.innerHTML = this._config.template;
this.tip = element.children[0];
return this.tip;
@ -422,13 +394,11 @@ class Tooltip extends BaseComponent {
return;
}
if (typeof content === 'object' && isElement(content)) {
if (content.jquery) {
content = content[0];
}
if (isElement(content)) {
content = getElement(content);
// content is a DOM node or a jQuery
if (this.config.html) {
if (this._config.html) {
if (content.parentNode !== element) {
element.innerHTML = '';
element.appendChild(content);
@ -440,9 +410,9 @@ class Tooltip extends BaseComponent {
return;
}
if (this.config.html) {
if (this.config.sanitize) {
content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn);
if (this._config.html) {
if (this._config.sanitize) {
content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
}
element.innerHTML = content;
@ -456,9 +426,9 @@ class Tooltip extends BaseComponent {
if (!title) {
title =
typeof this.config.title === 'function'
? this.config.title.call(this._element)
: this.config.title;
typeof this._config.title === 'function'
? this._config.title.call(this._element)
: this._config.title;
}
return title;
@ -491,7 +461,7 @@ class Tooltip extends BaseComponent {
}
_getOffset() {
const { offset } = this.config;
const { offset } = this._config;
if (typeof offset === 'string') {
return offset.split(',').map((val) => Number.parseInt(val, 10));
@ -511,7 +481,7 @@ class Tooltip extends BaseComponent {
{
name: 'flip',
options: {
fallbackPlacements: this.config.fallbackPlacements,
fallbackPlacements: this._config.fallbackPlacements,
},
},
{
@ -523,7 +493,7 @@ class Tooltip extends BaseComponent {
{
name: 'preventOverflow',
options: {
boundary: this.config.boundary,
boundary: this._config.boundary,
},
},
{
@ -548,9 +518,9 @@ class Tooltip extends BaseComponent {
return {
...defaultBsPopperConfig,
...(typeof this.config.popperConfig === 'function'
? this.config.popperConfig(defaultBsPopperConfig)
: this.config.popperConfig),
...(typeof this._config.popperConfig === 'function'
? this._config.popperConfig(defaultBsPopperConfig)
: this._config.popperConfig),
};
}
@ -558,31 +528,19 @@ class Tooltip extends BaseComponent {
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
}
_getContainer() {
if (this.config.container === false) {
return document.body;
}
if (isElement(this.config.container)) {
return this.config.container;
}
return SelectorEngine.findOne(this.config.container);
}
_getAttachment(placement) {
return AttachmentMap[placement.toUpperCase()];
}
_setListeners() {
const triggers = this.config.trigger.split(' ');
const triggers = this._config.trigger.split(' ');
triggers.forEach((trigger) => {
if (trigger === 'click') {
EventHandler.on(
this._element,
this.constructor.Event.CLICK,
this.config.selector,
this._config.selector,
(event) => this.toggle(event)
);
} else if (trigger !== TRIGGER_MANUAL) {
@ -595,10 +553,10 @@ class Tooltip extends BaseComponent {
? this.constructor.Event.MOUSELEAVE
: this.constructor.Event.FOCUSOUT;
EventHandler.on(this._element, eventIn, this.config.selector, (event) =>
EventHandler.on(this._element, eventIn, this._config.selector, (event) =>
this._enter(event)
);
EventHandler.on(this._element, eventOut, this.config.selector, (event) =>
EventHandler.on(this._element, eventOut, this._config.selector, (event) =>
this._leave(event)
);
}
@ -616,9 +574,9 @@ class Tooltip extends BaseComponent {
this._hideModalHandler
);
if (this.config.selector) {
this.config = {
...this.config,
if (this._config.selector) {
this._config = {
...this._config,
trigger: 'manual',
selector: '',
};
@ -660,7 +618,7 @@ class Tooltip extends BaseComponent {
context._hoverState = HOVER_STATE_SHOW;
if (!context.config.delay || !context.config.delay.show) {
if (!context._config.delay || !context._config.delay.show) {
context.show();
return;
}
@ -669,7 +627,7 @@ class Tooltip extends BaseComponent {
if (context._hoverState === HOVER_STATE_SHOW) {
context.show();
}
}, context.config.delay.show);
}, context._config.delay.show);
}
_leave(event, context) {
@ -689,7 +647,7 @@ class Tooltip extends BaseComponent {
context._hoverState = HOVER_STATE_OUT;
if (!context.config.delay || !context.config.delay.hide) {
if (!context._config.delay || !context._config.delay.hide) {
context.hide();
return;
}
@ -698,7 +656,7 @@ class Tooltip extends BaseComponent {
if (context._hoverState === HOVER_STATE_OUT) {
context.hide();
}
}, context.config.delay.hide);
}, context._config.delay.hide);
}
_isWithActiveTrigger() {
@ -720,16 +678,14 @@ class Tooltip extends BaseComponent {
}
});
if (config && typeof config.container === 'object' && config.container.jquery) {
config.container = config.container[0];
}
config = {
...this.constructor.Default,
...dataAttributes,
...(typeof config === 'object' && config ? config : {}),
};
config.container = config.container === false ? document.body : getElement(config.container);
if (typeof config.delay === 'number') {
config.delay = {
show: config.delay,
@ -757,10 +713,10 @@ class Tooltip extends BaseComponent {
_getDelegateConfig() {
const config = {};
if (this.config) {
for (const key in this.config) {
if (this.constructor.Default[key] !== this.config[key]) {
config[key] = this.config[key];
if (this._config) {
for (const key in this._config) {
if (this.constructor.Default[key] !== this._config[key]) {
config[key] = this._config[key];
}
}
}
@ -821,6 +777,6 @@ class Tooltip extends BaseComponent {
* add .Tooltip to jQuery only if jQuery is present
*/
defineJQueryPlugin(NAME, Tooltip);
defineJQueryPlugin(Tooltip);
export default Tooltip;

View File

@ -1,6 +1,6 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/backdrop.js
* Bootstrap (v5.0.1): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@ -95,6 +95,8 @@ class Backdrop {
...Default,
...(typeof config === 'object' ? config : {}),
};
config.rootElement = config.rootElement || document.body;
typeCheckConfig(NAME, config, DefaultType);
return config;
}

View File

@ -1,6 +1,8 @@
import SelectorEngine from '../dom/selector-engine';
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.0): util/index.js
* Bootstrap (v5.0.1): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@ -106,7 +108,30 @@ const triggerTransitionEnd = (element) => {
element.dispatchEvent(new Event(TRANSITION_END));
};
const isElement = (obj) => (obj[0] || obj).nodeType;
const isElement = (obj) => {
if (!obj || typeof obj !== 'object') {
return false;
}
if (typeof obj.jquery !== 'undefined') {
obj = obj[0];
}
return typeof obj.nodeType !== 'undefined';
};
const getElement = (obj) => {
if (isElement(obj)) {
// it's a jQuery object or a node element
return obj.jquery ? obj[0] : obj;
}
if (typeof obj === 'string' && obj.length > 0) {
return SelectorEngine.findOne(obj);
}
return null;
};
const emulateTransitionEnd = (element, duration) => {
let called = false;
@ -222,11 +247,12 @@ const onDOMContentLoaded = (callback) => {
const isRTL = () => document.documentElement.dir === 'rtl';
const defineJQueryPlugin = (name, plugin) => {
const defineJQueryPlugin = (plugin) => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@ -245,6 +271,7 @@ const execute = (callback) => {
};
export {
getElement,
getUID,
getSelectorFromElement,
getElementFromSelector,

View File

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

View File

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

View File

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

View File

@ -3,16 +3,6 @@
// .modal-dialog - positioning shell for the actual modal
// .modal-content - actual modal w/ bg and corners and stuff
.modal-open {
// Kill the scroll on the body
overflow: hidden;
.modal {
overflow-x: hidden;
overflow-y: auto;
}
}
// Container that the modal scrolls within
.modal {
position: fixed;
@ -22,7 +12,8 @@
display: none;
width: 100%;
height: 100%;
overflow: hidden;
overflow-x: hidden;
overflow-y: auto;
// Prevent Chrome on Windows from adding a focus outline. For details, see
// https://github.com/twbs/bootstrap/pull/10951.
outline: 0;

View File

@ -4,6 +4,7 @@
.table {
--#{$variable-prefix}table-bg: #{$table-bg};
--#{$variable-prefix}table-accent-bg: #{$table-bg};
--#{$variable-prefix}table-striped-color: #{$table-striped-color};
--#{$variable-prefix}table-striped-bg: #{$table-striped-bg};
--#{$variable-prefix}table-active-color: #{$table-active-color};

View File

@ -1,5 +1,5 @@
/*!
* Bootstrap Grid v5.0.0 (https://getbootstrap.com/)
* Bootstrap Grid v5.0.1 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

View File

@ -1,5 +1,5 @@
/*!
* Bootstrap Reboot v5.0.0 (https://getbootstrap.com/)
* Bootstrap Reboot v5.0.1 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

View File

@ -1,5 +1,5 @@
/*!
* Bootstrap Utilities v5.0.0 (https://getbootstrap.com/)
* Bootstrap Utilities v5.0.1 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

View File

@ -1,5 +1,5 @@
/*!
* Bootstrap v5.0.0 (https://getbootstrap.com/)
* Bootstrap v5.0.1 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)

View File

@ -25,7 +25,7 @@
&[type='file'] {
overflow: hidden; // prevent pseudo element button overlap
&:not(:disabled):not(:read-only) {
&:not(:disabled):not([readonly]) {
cursor: pointer;
}
}
@ -65,7 +65,7 @@
// disabled if the fieldset is disabled. Due to implementation difficulty, we
// don't honor that edge case; we style them as disabled anyway.
&:disabled,
&:read-only {
&[readonly] {
background-color: $input-disabled-bg;
border-color: $input-disabled-border-color;
// iOS fix for unreadable disabled content; see https://github.com/twbs/bootstrap/issues/11655.
@ -88,7 +88,7 @@
@include transition($btn-transition);
}
&:hover:not(:disabled):not(:read-only)::file-selector-button {
&:hover:not(:disabled):not([readonly])::file-selector-button {
background-color: $form-file-button-hover-bg;
}
@ -107,7 +107,7 @@
@include transition($btn-transition);
}
&:hover:not(:disabled):not(:read-only)::-webkit-file-upload-button {
&:hover:not(:disabled):not([readonly])::-webkit-file-upload-button {
background-color: $form-file-button-hover-bg;
}
}
@ -203,7 +203,7 @@ textarea {
height: auto; // Override fixed browser height
padding: $input-padding-y;
&:not(:disabled):not(:read-only) {
&:not(:disabled):not([readonly]) {
cursor: pointer;
}

View File

@ -131,7 +131,14 @@
.input-group .form-control,
.input-group .form-select {
@include form-validation-state-selector($state) {
z-index: 3;
@if $state == 'valid' {
z-index: 1;
} @else if $state == 'invalid' {
z-index: 2;
}
&:focus {
z-index: 3;
}
}
}
}

View File

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

View File

@ -3,16 +3,6 @@
// .modal-dialog - positioning shell for the actual modal
// .modal-content - actual modal w/ bg and corners and stuff
.modal-open {
// Kill the scroll on the body
overflow: hidden;
.modal {
overflow-x: hidden;
overflow-y: auto;
}
}
// Container that the modal scrolls within
.modal {
position: fixed;
@ -22,7 +12,8 @@
display: none;
width: 100%;
height: 100%;
overflow: hidden;
overflow-x: hidden;
overflow-y: auto;
// Prevent Chrome on Windows from adding a focus outline. For details, see
// https://github.com/twbs/bootstrap/pull/10951.
outline: 0;

View File

@ -4,6 +4,7 @@
.table {
--#{$variable-prefix}table-bg: #{$table-bg};
--#{$variable-prefix}table-accent-bg: #{$table-bg};
--#{$variable-prefix}table-striped-color: #{$table-striped-color};
--#{$variable-prefix}table-striped-bg: #{$table-striped-bg};
--#{$variable-prefix}table-active-color: #{$table-active-color};

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