mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-15 10:05:40 +02:00
Prepare v5.1.0. (#34674)
This commit is contained in:
122
js/dist/alert.js
vendored
122
js/dist/alert.js
vendored
@@ -1,19 +1,26 @@
|
||||
/*!
|
||||
* Bootstrap alert.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap alert.js v5.1.0 (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('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/event-handler', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.SelectorEngine, global.EventHandler, global.Base));
|
||||
}(this, (function (SelectorEngine, EventHandler, BaseComponent) { 'use strict';
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/event-handler', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.EventHandler, global.Base));
|
||||
}(this, (function (EventHandler, BaseComponent) { 'use strict';
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
||||
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.0): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const getSelector = element => {
|
||||
let selector = element.getAttribute('data-bs-target');
|
||||
|
||||
@@ -43,6 +50,22 @@
|
||||
return selector ? document.querySelector(selector) : null;
|
||||
};
|
||||
|
||||
const isDisabled = element => {
|
||||
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (element.classList.contains('disabled')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof element.disabled !== 'undefined') {
|
||||
return element.disabled;
|
||||
}
|
||||
|
||||
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
||||
};
|
||||
|
||||
const getjQuery = () => {
|
||||
const {
|
||||
jQuery
|
||||
@@ -93,7 +116,33 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): alert.js
|
||||
* Bootstrap (v5.1.0): util/component-functions.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const enableDismissTrigger = (component, method = 'hide') => {
|
||||
const clickEvent = `click.dismiss${component.EVENT_KEY}`;
|
||||
const name = component.NAME;
|
||||
EventHandler__default['default'].on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
|
||||
if (['A', 'AREA'].includes(this.tagName)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (isDisabled(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const target = getElementFromSelector(this) || this.closest(`.${name}`);
|
||||
const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
|
||||
|
||||
instance[method]();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.0): alert.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -106,12 +155,8 @@
|
||||
const NAME = 'alert';
|
||||
const DATA_KEY = 'bs.alert';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const DATA_API_KEY = '.data-api';
|
||||
const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
|
||||
const EVENT_CLOSE = `close${EVENT_KEY}`;
|
||||
const EVENT_CLOSED = `closed${EVENT_KEY}`;
|
||||
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const CLASS_NAME_ALERT = 'alert';
|
||||
const CLASS_NAME_FADE = 'fade';
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
/**
|
||||
@@ -127,37 +172,26 @@
|
||||
} // Public
|
||||
|
||||
|
||||
close(element) {
|
||||
const rootElement = element ? this._getRootElement(element) : this._element;
|
||||
close() {
|
||||
const closeEvent = EventHandler__default['default'].trigger(this._element, EVENT_CLOSE);
|
||||
|
||||
const customEvent = this._triggerCloseEvent(rootElement);
|
||||
|
||||
if (customEvent === null || customEvent.defaultPrevented) {
|
||||
if (closeEvent.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._removeElement(rootElement);
|
||||
this._element.classList.remove(CLASS_NAME_SHOW);
|
||||
|
||||
const isAnimated = this._element.classList.contains(CLASS_NAME_FADE);
|
||||
|
||||
this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
|
||||
} // Private
|
||||
|
||||
|
||||
_getRootElement(element) {
|
||||
return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
|
||||
}
|
||||
_destroyElement() {
|
||||
this._element.remove();
|
||||
|
||||
_triggerCloseEvent(element) {
|
||||
return EventHandler__default['default'].trigger(element, EVENT_CLOSE);
|
||||
}
|
||||
|
||||
_removeElement(element) {
|
||||
element.classList.remove(CLASS_NAME_SHOW);
|
||||
const isAnimated = element.classList.contains(CLASS_NAME_FADE);
|
||||
|
||||
this._queueCallback(() => this._destroyElement(element), element, isAnimated);
|
||||
}
|
||||
|
||||
_destroyElement(element) {
|
||||
element.remove();
|
||||
EventHandler__default['default'].trigger(element, EVENT_CLOSED);
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_CLOSED);
|
||||
this.dispose();
|
||||
} // Static
|
||||
|
||||
|
||||
@@ -165,22 +199,18 @@
|
||||
return this.each(function () {
|
||||
const data = Alert.getOrCreateInstance(this);
|
||||
|
||||
if (config === 'close') {
|
||||
data[config](this);
|
||||
if (typeof config !== 'string') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
|
||||
throw new TypeError(`No method named "${config}"`);
|
||||
}
|
||||
|
||||
data[config](this);
|
||||
});
|
||||
}
|
||||
|
||||
static handleDismiss(alertInstance) {
|
||||
return function (event) {
|
||||
if (event) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
alertInstance.close(this);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
@@ -189,7 +219,7 @@
|
||||
*/
|
||||
|
||||
|
||||
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
|
||||
enableDismissTrigger(Alert, 'close');
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* jQuery
|
||||
|
2
js/dist/alert.js.map
vendored
2
js/dist/alert.js.map
vendored
File diff suppressed because one or more lines are too long
25
js/dist/base-component.js
vendored
25
js/dist/base-component.js
vendored
@@ -1,20 +1,25 @@
|
||||
/*!
|
||||
* Bootstrap base-component.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap base-component.js v5.1.0 (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/event-handler.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/selector-engine', './dom/event-handler'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Base = factory(global.Data, global.SelectorEngine, global.EventHandler));
|
||||
}(this, (function (Data, SelectorEngine, EventHandler) { 'use strict';
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Base = factory(global.Data, global.EventHandler));
|
||||
}(this, (function (Data, EventHandler) { '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 EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.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)
|
||||
|
||||
@@ -64,7 +69,7 @@
|
||||
}
|
||||
|
||||
if (typeof obj === 'string' && obj.length > 0) {
|
||||
return SelectorEngine__default['default'].findOne(obj);
|
||||
return document.querySelector(obj);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -108,7 +113,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): base-component.js
|
||||
* Bootstrap (v5.1.0): base-component.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -118,7 +123,7 @@
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const VERSION = '5.0.2';
|
||||
const VERSION = '5.1.0';
|
||||
|
||||
class BaseComponent {
|
||||
constructor(element) {
|
||||
@@ -147,7 +152,7 @@
|
||||
|
||||
|
||||
static getInstance(element) {
|
||||
return Data__default['default'].get(element, this.DATA_KEY);
|
||||
return Data__default['default'].get(getElement(element), this.DATA_KEY);
|
||||
}
|
||||
|
||||
static getOrCreateInstance(element, config = {}) {
|
||||
|
2
js/dist/base-component.js.map
vendored
2
js/dist/base-component.js.map
vendored
File diff suppressed because one or more lines are too long
19
js/dist/button.js
vendored
19
js/dist/button.js
vendored
@@ -1,19 +1,26 @@
|
||||
/*!
|
||||
* Bootstrap button.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap button.js v5.1.0 (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('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/event-handler', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Button = factory(global.SelectorEngine, global.EventHandler, global.Base));
|
||||
}(this, (function (SelectorEngine, EventHandler, BaseComponent) { 'use strict';
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/event-handler', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Button = factory(global.EventHandler, global.Base));
|
||||
}(this, (function (EventHandler, BaseComponent) { 'use strict';
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
||||
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.0): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const getjQuery = () => {
|
||||
const {
|
||||
jQuery
|
||||
@@ -64,7 +71,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): button.js
|
||||
* Bootstrap (v5.1.0): button.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
2
js/dist/button.js.map
vendored
2
js/dist/button.js.map
vendored
File diff suppressed because one or more lines are too long
34
js/dist/carousel.js
vendored
34
js/dist/carousel.js
vendored
@@ -1,21 +1,27 @@
|
||||
/*!
|
||||
* Bootstrap carousel.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap carousel.js v5.1.0 (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('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/event-handler', './dom/manipulator', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.SelectorEngine, global.EventHandler, global.Manipulator, global.Base));
|
||||
}(this, (function (SelectorEngine, EventHandler, Manipulator, BaseComponent) { 'use strict';
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(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/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
|
||||
}(this, (function (EventHandler, Manipulator, SelectorEngine, 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.1.0): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
|
||||
|
||||
const toType = obj => {
|
||||
@@ -90,8 +96,20 @@
|
||||
|
||||
return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
|
||||
};
|
||||
/**
|
||||
* Trick to restart an element's animation
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @return void
|
||||
*
|
||||
* @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
|
||||
*/
|
||||
|
||||
const reflow = element => element.offsetHeight;
|
||||
|
||||
const reflow = element => {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
element.offsetHeight;
|
||||
};
|
||||
|
||||
const getjQuery = () => {
|
||||
const {
|
||||
@@ -172,7 +190,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): carousel.js
|
||||
* Bootstrap (v5.1.0): carousel.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
2
js/dist/carousel.js.map
vendored
2
js/dist/carousel.js.map
vendored
File diff suppressed because one or more lines are too long
224
js/dist/collapse.js
vendored
224
js/dist/collapse.js
vendored
@@ -1,22 +1,29 @@
|
||||
/*!
|
||||
* Bootstrap collapse.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap collapse.js v5.1.0 (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('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/data', './dom/event-handler', './dom/manipulator', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.SelectorEngine, global.Data, global.EventHandler, global.Manipulator, global.Base));
|
||||
}(this, (function (SelectorEngine, Data, EventHandler, Manipulator, BaseComponent) { 'use strict';
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Collapse = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
|
||||
}(this, (function (Data, EventHandler, Manipulator, SelectorEngine, 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.1.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}`;
|
||||
@@ -83,7 +90,7 @@
|
||||
}
|
||||
|
||||
if (typeof obj === 'string' && obj.length > 0) {
|
||||
return SelectorEngine__default['default'].findOne(obj);
|
||||
return document.querySelector(obj);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -100,8 +107,20 @@
|
||||
}
|
||||
});
|
||||
};
|
||||
/**
|
||||
* Trick to restart an element's animation
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @return void
|
||||
*
|
||||
* @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
|
||||
*/
|
||||
|
||||
const reflow = element => element.offsetHeight;
|
||||
|
||||
const reflow = element => {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
element.offsetHeight;
|
||||
};
|
||||
|
||||
const getjQuery = () => {
|
||||
const {
|
||||
@@ -153,7 +172,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): collapse.js
|
||||
* Bootstrap (v5.1.0): collapse.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -169,11 +188,11 @@
|
||||
const DATA_API_KEY = '.data-api';
|
||||
const Default = {
|
||||
toggle: true,
|
||||
parent: ''
|
||||
parent: null
|
||||
};
|
||||
const DefaultType = {
|
||||
toggle: 'boolean',
|
||||
parent: '(string|element)'
|
||||
parent: '(null|element)'
|
||||
};
|
||||
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||
@@ -184,6 +203,7 @@
|
||||
const CLASS_NAME_COLLAPSE = 'collapse';
|
||||
const CLASS_NAME_COLLAPSING = 'collapsing';
|
||||
const CLASS_NAME_COLLAPSED = 'collapsed';
|
||||
const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
|
||||
const WIDTH = 'width';
|
||||
const HEIGHT = 'height';
|
||||
const SELECTOR_ACTIVES = '.show, .collapsing';
|
||||
@@ -199,7 +219,7 @@
|
||||
super(element);
|
||||
this._isTransitioning = false;
|
||||
this._config = this._getConfig(config);
|
||||
this._triggerArray = SelectorEngine__default['default'].find(`${SELECTOR_DATA_TOGGLE}[href="#${this._element.id}"],` + `${SELECTOR_DATA_TOGGLE}[data-bs-target="#${this._element.id}"]`);
|
||||
this._triggerArray = [];
|
||||
const toggleList = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
|
||||
|
||||
for (let i = 0, len = toggleList.length; i < len; i++) {
|
||||
@@ -214,10 +234,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
this._parent = this._config.parent ? this._getParent() : null;
|
||||
this._initializeChildren();
|
||||
|
||||
if (!this._config.parent) {
|
||||
this._addAriaAndCollapsedClass(this._element, this._triggerArray);
|
||||
this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
|
||||
}
|
||||
|
||||
if (this._config.toggle) {
|
||||
@@ -236,7 +256,7 @@
|
||||
|
||||
|
||||
toggle() {
|
||||
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||
if (this._isShown()) {
|
||||
this.hide();
|
||||
} else {
|
||||
this.show();
|
||||
@@ -244,30 +264,21 @@
|
||||
}
|
||||
|
||||
show() {
|
||||
if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||
if (this._isTransitioning || this._isShown()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let actives;
|
||||
let actives = [];
|
||||
let activesData;
|
||||
|
||||
if (this._parent) {
|
||||
actives = SelectorEngine__default['default'].find(SELECTOR_ACTIVES, this._parent).filter(elem => {
|
||||
if (typeof this._config.parent === 'string') {
|
||||
return elem.getAttribute('data-bs-parent') === this._config.parent;
|
||||
}
|
||||
|
||||
return elem.classList.contains(CLASS_NAME_COLLAPSE);
|
||||
});
|
||||
|
||||
if (actives.length === 0) {
|
||||
actives = null;
|
||||
}
|
||||
if (this._config.parent) {
|
||||
const children = SelectorEngine__default['default'].find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent);
|
||||
actives = SelectorEngine__default['default'].find(SELECTOR_ACTIVES, this._config.parent).filter(elem => !children.includes(elem)); // remove children if greater depth
|
||||
}
|
||||
|
||||
const container = SelectorEngine__default['default'].findOne(this._selector);
|
||||
|
||||
if (actives) {
|
||||
if (actives.length) {
|
||||
const tempActiveData = actives.find(elem => container !== elem);
|
||||
activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
|
||||
|
||||
@@ -282,17 +293,17 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (actives) {
|
||||
actives.forEach(elemActive => {
|
||||
if (container !== elemActive) {
|
||||
Collapse.collapseInterface(elemActive, 'hide');
|
||||
}
|
||||
actives.forEach(elemActive => {
|
||||
if (container !== elemActive) {
|
||||
Collapse.getOrCreateInstance(elemActive, {
|
||||
toggle: false
|
||||
}).hide();
|
||||
}
|
||||
|
||||
if (!activesData) {
|
||||
Data__default['default'].set(elemActive, DATA_KEY, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!activesData) {
|
||||
Data__default['default'].set(elemActive, DATA_KEY, null);
|
||||
}
|
||||
});
|
||||
|
||||
const dimension = this._getDimension();
|
||||
|
||||
@@ -302,22 +313,18 @@
|
||||
|
||||
this._element.style[dimension] = 0;
|
||||
|
||||
if (this._triggerArray.length) {
|
||||
this._triggerArray.forEach(element => {
|
||||
element.classList.remove(CLASS_NAME_COLLAPSED);
|
||||
element.setAttribute('aria-expanded', true);
|
||||
});
|
||||
}
|
||||
this._addAriaAndCollapsedClass(this._triggerArray, true);
|
||||
|
||||
this.setTransitioning(true);
|
||||
this._isTransitioning = true;
|
||||
|
||||
const complete = () => {
|
||||
this._isTransitioning = false;
|
||||
|
||||
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
||||
|
||||
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
||||
|
||||
this._element.style[dimension] = '';
|
||||
this.setTransitioning(false);
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_SHOWN);
|
||||
};
|
||||
|
||||
@@ -330,7 +337,7 @@
|
||||
}
|
||||
|
||||
hide() {
|
||||
if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||
if (this._isTransitioning || !this._isShown()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -351,22 +358,19 @@
|
||||
|
||||
const triggerArrayLength = this._triggerArray.length;
|
||||
|
||||
if (triggerArrayLength > 0) {
|
||||
for (let i = 0; i < triggerArrayLength; i++) {
|
||||
const trigger = this._triggerArray[i];
|
||||
const elem = getElementFromSelector(trigger);
|
||||
for (let i = 0; i < triggerArrayLength; i++) {
|
||||
const trigger = this._triggerArray[i];
|
||||
const elem = getElementFromSelector(trigger);
|
||||
|
||||
if (elem && !elem.classList.contains(CLASS_NAME_SHOW)) {
|
||||
trigger.classList.add(CLASS_NAME_COLLAPSED);
|
||||
trigger.setAttribute('aria-expanded', false);
|
||||
}
|
||||
if (elem && !this._isShown(elem)) {
|
||||
this._addAriaAndCollapsedClass([trigger], false);
|
||||
}
|
||||
}
|
||||
|
||||
this.setTransitioning(true);
|
||||
this._isTransitioning = true;
|
||||
|
||||
const complete = () => {
|
||||
this.setTransitioning(false);
|
||||
this._isTransitioning = false;
|
||||
|
||||
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
||||
|
||||
@@ -380,45 +384,47 @@
|
||||
this._queueCallback(complete, this._element, true);
|
||||
}
|
||||
|
||||
setTransitioning(isTransitioning) {
|
||||
this._isTransitioning = isTransitioning;
|
||||
_isShown(element = this._element) {
|
||||
return element.classList.contains(CLASS_NAME_SHOW);
|
||||
} // Private
|
||||
|
||||
|
||||
_getConfig(config) {
|
||||
config = { ...Default,
|
||||
...Manipulator__default['default'].getDataAttributes(this._element),
|
||||
...config
|
||||
};
|
||||
config.toggle = Boolean(config.toggle); // Coerce string values
|
||||
|
||||
config.parent = getElement(config.parent);
|
||||
typeCheckConfig(NAME, config, DefaultType);
|
||||
return config;
|
||||
}
|
||||
|
||||
_getDimension() {
|
||||
return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
|
||||
return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
|
||||
}
|
||||
|
||||
_getParent() {
|
||||
let {
|
||||
parent
|
||||
} = this._config;
|
||||
parent = getElement(parent);
|
||||
const selector = `${SELECTOR_DATA_TOGGLE}[data-bs-parent="${parent}"]`;
|
||||
SelectorEngine__default['default'].find(selector, parent).forEach(element => {
|
||||
const selected = getElementFromSelector(element);
|
||||
|
||||
this._addAriaAndCollapsedClass(selected, [element]);
|
||||
});
|
||||
return parent;
|
||||
}
|
||||
|
||||
_addAriaAndCollapsedClass(element, triggerArray) {
|
||||
if (!element || !triggerArray.length) {
|
||||
_initializeChildren() {
|
||||
if (!this._config.parent) {
|
||||
return;
|
||||
}
|
||||
|
||||
const children = SelectorEngine__default['default'].find(`.${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`, this._config.parent);
|
||||
SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE, this._config.parent).filter(elem => !children.includes(elem)).forEach(element => {
|
||||
const selected = getElementFromSelector(element);
|
||||
|
||||
if (selected) {
|
||||
this._addAriaAndCollapsedClass([element], this._isShown(selected));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_addAriaAndCollapsedClass(triggerArray, isOpen) {
|
||||
if (!triggerArray.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isOpen = element.classList.contains(CLASS_NAME_SHOW);
|
||||
triggerArray.forEach(elem => {
|
||||
if (isOpen) {
|
||||
elem.classList.remove(CLASS_NAME_COLLAPSED);
|
||||
@@ -431,33 +437,23 @@
|
||||
} // Static
|
||||
|
||||
|
||||
static collapseInterface(element, config) {
|
||||
let data = Collapse.getInstance(element);
|
||||
const _config = { ...Default,
|
||||
...Manipulator__default['default'].getDataAttributes(element),
|
||||
...(typeof config === 'object' && config ? config : {})
|
||||
};
|
||||
|
||||
if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
|
||||
_config.toggle = false;
|
||||
}
|
||||
|
||||
if (!data) {
|
||||
data = new Collapse(element, _config);
|
||||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (typeof data[config] === 'undefined') {
|
||||
throw new TypeError(`No method named "${config}"`);
|
||||
}
|
||||
|
||||
data[config]();
|
||||
}
|
||||
}
|
||||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
Collapse.collapseInterface(this, config);
|
||||
const _config = {};
|
||||
|
||||
if (typeof config === 'string' && /show|hide/.test(config)) {
|
||||
_config.toggle = false;
|
||||
}
|
||||
|
||||
const data = Collapse.getOrCreateInstance(this, _config);
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (typeof data[config] === 'undefined') {
|
||||
throw new TypeError(`No method named "${config}"`);
|
||||
}
|
||||
|
||||
data[config]();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -475,26 +471,12 @@
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
const triggerData = Manipulator__default['default'].getDataAttributes(this);
|
||||
const selector = getSelectorFromElement(this);
|
||||
const selectorElements = SelectorEngine__default['default'].find(selector);
|
||||
selectorElements.forEach(element => {
|
||||
const data = Collapse.getInstance(element);
|
||||
let config;
|
||||
|
||||
if (data) {
|
||||
// update parent attribute
|
||||
if (data._parent === null && typeof triggerData.parent === 'string') {
|
||||
data._config.parent = triggerData.parent;
|
||||
data._parent = data._getParent();
|
||||
}
|
||||
|
||||
config = 'toggle';
|
||||
} else {
|
||||
config = triggerData;
|
||||
}
|
||||
|
||||
Collapse.collapseInterface(element, config);
|
||||
Collapse.getOrCreateInstance(element, {
|
||||
toggle: false
|
||||
}).toggle();
|
||||
});
|
||||
});
|
||||
/**
|
||||
|
2
js/dist/collapse.js.map
vendored
2
js/dist/collapse.js.map
vendored
File diff suppressed because one or more lines are too long
4
js/dist/dom/data.js
vendored
4
js/dist/dom/data.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Bootstrap data.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap data.js v5.1.0 (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)
|
||||
*/
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): dom/data.js
|
||||
* Bootstrap (v5.1.0): dom/data.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
2
js/dist/dom/data.js.map
vendored
2
js/dist/dom/data.js.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"data.js","sources":["../../src/dom/data.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.2): 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.1.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;;;;;;;;"}
|
11
js/dist/dom/event-handler.js
vendored
11
js/dist/dom/event-handler.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Bootstrap event-handler.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap event-handler.js v5.1.0 (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)
|
||||
*/
|
||||
@@ -9,6 +9,13 @@
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.EventHandler = factory());
|
||||
}(this, (function () { 'use strict';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.0): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const getjQuery = () => {
|
||||
const {
|
||||
jQuery
|
||||
@@ -23,7 +30,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): dom/event-handler.js
|
||||
* Bootstrap (v5.1.0): dom/event-handler.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
2
js/dist/dom/event-handler.js.map
vendored
2
js/dist/dom/event-handler.js.map
vendored
File diff suppressed because one or more lines are too long
8
js/dist/dom/manipulator.js
vendored
8
js/dist/dom/manipulator.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Bootstrap manipulator.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap manipulator.js v5.1.0 (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)
|
||||
*/
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): dom/manipulator.js
|
||||
* Bootstrap (v5.1.0): dom/manipulator.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -69,8 +69,8 @@
|
||||
offset(element) {
|
||||
const rect = element.getBoundingClientRect();
|
||||
return {
|
||||
top: rect.top + document.body.scrollTop,
|
||||
left: rect.left + document.body.scrollLeft
|
||||
top: rect.top + window.pageYOffset,
|
||||
left: rect.left + window.pageXOffset
|
||||
};
|
||||
},
|
||||
|
||||
|
2
js/dist/dom/manipulator.js.map
vendored
2
js/dist/dom/manipulator.js.map
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"manipulator.js","sources":["../../src/dom/manipulator.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v5.0.2): 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.1.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 + window.pageYOffset,\n left: rect.left + window.pageXOffset\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","window","pageYOffset","left","pageXOffset","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,MAAM,CAACC,WADlB;EAELC,MAAAA,IAAI,EAAEL,IAAI,CAACK,IAAL,GAAYF,MAAM,CAACG;EAFpB,KAAP;EAID,GAtCiB;;EAwClBC,EAAAA,QAAQ,CAAC3B,OAAD,EAAU;EAChB,WAAO;EACLsB,MAAAA,GAAG,EAAEtB,OAAO,CAAC4B,SADR;EAELH,MAAAA,IAAI,EAAEzB,OAAO,CAAC6B;EAFT,KAAP;EAID;;EA7CiB;;;;;;;;"}
|
52
js/dist/dom/selector-engine.js
vendored
52
js/dist/dom/selector-engine.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Bootstrap selector-engine.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap selector-engine.js v5.1.0 (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)
|
||||
*/
|
||||
@@ -11,15 +11,52 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): dom/selector-engine.js
|
||||
* Bootstrap (v5.1.0): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const isElement = obj => {
|
||||
if (!obj || typeof obj !== 'object') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof obj.jquery !== 'undefined') {
|
||||
obj = obj[0];
|
||||
}
|
||||
|
||||
return typeof obj.nodeType !== 'undefined';
|
||||
};
|
||||
|
||||
const isVisible = element => {
|
||||
if (!isElement(element) || element.getClientRects().length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
|
||||
};
|
||||
|
||||
const isDisabled = element => {
|
||||
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (element.classList.contains('disabled')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof element.disabled !== 'undefined') {
|
||||
return element.disabled;
|
||||
}
|
||||
|
||||
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
||||
};
|
||||
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Constants
|
||||
* ------------------------------------------------------------------------
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.0): dom/selector-engine.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
const NODE_TEXT = 3;
|
||||
const SelectorEngine = {
|
||||
@@ -76,6 +113,11 @@
|
||||
}
|
||||
|
||||
return [];
|
||||
},
|
||||
|
||||
focusableChildren(element) {
|
||||
const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(', ');
|
||||
return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
|
||||
}
|
||||
|
||||
};
|
||||
|
2
js/dist/dom/selector-engine.js.map
vendored
2
js/dist/dom/selector-engine.js.map
vendored
File diff suppressed because one or more lines are too long
140
js/dist/dropdown.js
vendored
140
js/dist/dropdown.js
vendored
@@ -1,13 +1,13 @@
|
||||
/*!
|
||||
* Bootstrap dropdown.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap dropdown.js v5.1.0 (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('@popperjs/core'), require('./dom/selector-engine.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['@popperjs/core', './dom/selector-engine', './dom/event-handler', './dom/manipulator', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global.Popper, global.SelectorEngine, global.EventHandler, global.Manipulator, global.Base));
|
||||
}(this, (function (Popper, SelectorEngine, EventHandler, Manipulator, BaseComponent) { 'use strict';
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), 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/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Dropdown = factory(global.Popper, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
|
||||
}(this, (function (Popper, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
@@ -32,11 +32,18 @@
|
||||
}
|
||||
|
||||
var Popper__namespace = /*#__PURE__*/_interopNamespace(Popper);
|
||||
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.1.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}`;
|
||||
@@ -93,7 +100,7 @@
|
||||
}
|
||||
|
||||
if (typeof obj === 'string' && obj.length > 0) {
|
||||
return SelectorEngine__default['default'].findOne(obj);
|
||||
return document.querySelector(obj);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -216,7 +223,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): dropdown.js
|
||||
* Bootstrap (v5.1.0): dropdown.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -242,7 +249,6 @@
|
||||
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||
const EVENT_CLICK = `click${EVENT_KEY}`;
|
||||
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`;
|
||||
@@ -290,8 +296,6 @@
|
||||
this._config = this._getConfig(config);
|
||||
this._menu = this._getMenuElement();
|
||||
this._inNavbar = this._detectNavbar();
|
||||
|
||||
this._addEventListeners();
|
||||
} // Getters
|
||||
|
||||
|
||||
@@ -309,26 +313,14 @@
|
||||
|
||||
|
||||
toggle() {
|
||||
if (isDisabled(this._element)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isActive = this._element.classList.contains(CLASS_NAME_SHOW);
|
||||
|
||||
if (isActive) {
|
||||
this.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
this.show();
|
||||
return this._isShown() ? this.hide() : this.show();
|
||||
}
|
||||
|
||||
show() {
|
||||
if (isDisabled(this._element) || this._menu.classList.contains(CLASS_NAME_SHOW)) {
|
||||
if (isDisabled(this._element) || this._isShown(this._menu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const parent = Dropdown.getParentFromElement(this._element);
|
||||
const relatedTarget = {
|
||||
relatedTarget: this._element
|
||||
};
|
||||
@@ -336,34 +328,14 @@
|
||||
|
||||
if (showEvent.defaultPrevented) {
|
||||
return;
|
||||
} // Totally disable Popper for Dropdowns in Navbar
|
||||
}
|
||||
|
||||
const parent = Dropdown.getParentFromElement(this._element); // Totally disable Popper for Dropdowns in Navbar
|
||||
|
||||
if (this._inNavbar) {
|
||||
Manipulator__default['default'].setDataAttribute(this._menu, 'popper', 'none');
|
||||
} else {
|
||||
if (typeof Popper__namespace === 'undefined') {
|
||||
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
|
||||
}
|
||||
|
||||
let referenceElement = this._element;
|
||||
|
||||
if (this._config.reference === 'parent') {
|
||||
referenceElement = parent;
|
||||
} else if (isElement(this._config.reference)) {
|
||||
referenceElement = getElement(this._config.reference);
|
||||
} else if (typeof this._config.reference === 'object') {
|
||||
referenceElement = this._config.reference;
|
||||
}
|
||||
|
||||
const popperConfig = this._getPopperConfig();
|
||||
|
||||
const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
|
||||
this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig);
|
||||
|
||||
if (isDisplayStatic) {
|
||||
Manipulator__default['default'].setDataAttribute(this._menu, 'popper', 'static');
|
||||
}
|
||||
this._createPopper(parent);
|
||||
} // If this is a touch-enabled device we add extra
|
||||
// empty mouseover listeners to the body's immediate children;
|
||||
// only needed because of broken event delegation on iOS
|
||||
@@ -378,15 +350,15 @@
|
||||
|
||||
this._element.setAttribute('aria-expanded', true);
|
||||
|
||||
this._menu.classList.toggle(CLASS_NAME_SHOW);
|
||||
this._menu.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
this._element.classList.toggle(CLASS_NAME_SHOW);
|
||||
this._element.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_SHOWN, relatedTarget);
|
||||
}
|
||||
|
||||
hide() {
|
||||
if (isDisabled(this._element) || !this._menu.classList.contains(CLASS_NAME_SHOW)) {
|
||||
if (isDisabled(this._element) || !this._isShown(this._menu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -414,13 +386,6 @@
|
||||
} // Private
|
||||
|
||||
|
||||
_addEventListeners() {
|
||||
EventHandler__default['default'].on(this._element, EVENT_CLICK, event => {
|
||||
event.preventDefault();
|
||||
this.toggle();
|
||||
});
|
||||
}
|
||||
|
||||
_completeHide(relatedTarget) {
|
||||
const hideEvent = EventHandler__default['default'].trigger(this._element, EVENT_HIDE, relatedTarget);
|
||||
|
||||
@@ -463,6 +428,35 @@
|
||||
return config;
|
||||
}
|
||||
|
||||
_createPopper(parent) {
|
||||
if (typeof Popper__namespace === 'undefined') {
|
||||
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
|
||||
}
|
||||
|
||||
let referenceElement = this._element;
|
||||
|
||||
if (this._config.reference === 'parent') {
|
||||
referenceElement = parent;
|
||||
} else if (isElement(this._config.reference)) {
|
||||
referenceElement = getElement(this._config.reference);
|
||||
} else if (typeof this._config.reference === 'object') {
|
||||
referenceElement = this._config.reference;
|
||||
}
|
||||
|
||||
const popperConfig = this._getPopperConfig();
|
||||
|
||||
const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
|
||||
this._popper = Popper__namespace.createPopper(referenceElement, this._menu, popperConfig);
|
||||
|
||||
if (isDisplayStatic) {
|
||||
Manipulator__default['default'].setDataAttribute(this._menu, 'popper', 'static');
|
||||
}
|
||||
}
|
||||
|
||||
_isShown(element = this._element) {
|
||||
return element.classList.contains(CLASS_NAME_SHOW);
|
||||
}
|
||||
|
||||
_getMenuElement() {
|
||||
return SelectorEngine__default['default'].next(this._element, SELECTOR_MENU)[0];
|
||||
}
|
||||
@@ -552,21 +546,19 @@
|
||||
} // Static
|
||||
|
||||
|
||||
static dropdownInterface(element, config) {
|
||||
const data = Dropdown.getOrCreateInstance(element, config);
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
const data = Dropdown.getOrCreateInstance(this, config);
|
||||
|
||||
if (typeof config !== 'string') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof config === 'string') {
|
||||
if (typeof data[config] === 'undefined') {
|
||||
throw new TypeError(`No method named "${config}"`);
|
||||
}
|
||||
|
||||
data[config]();
|
||||
}
|
||||
}
|
||||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
Dropdown.dropdownInterface(this, config);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -584,7 +576,7 @@
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!context._element.classList.contains(CLASS_NAME_SHOW)) {
|
||||
if (!context._isShown()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -643,20 +635,20 @@
|
||||
return;
|
||||
}
|
||||
|
||||
const getToggleButton = () => this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine__default['default'].prev(this, SELECTOR_DATA_TOGGLE)[0];
|
||||
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ? this : SelectorEngine__default['default'].prev(this, SELECTOR_DATA_TOGGLE)[0];
|
||||
const instance = Dropdown.getOrCreateInstance(getToggleButton);
|
||||
|
||||
if (event.key === ESCAPE_KEY) {
|
||||
getToggleButton().focus();
|
||||
Dropdown.clearMenus();
|
||||
instance.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
|
||||
if (!isActive) {
|
||||
getToggleButton().click();
|
||||
instance.show();
|
||||
}
|
||||
|
||||
Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
|
||||
instance._selectMenuItem(event);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -680,7 +672,7 @@
|
||||
EventHandler__default['default'].on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
|
||||
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
|
||||
event.preventDefault();
|
||||
Dropdown.dropdownInterface(this);
|
||||
Dropdown.getOrCreateInstance(this).toggle();
|
||||
});
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
|
2
js/dist/dropdown.js.map
vendored
2
js/dist/dropdown.js.map
vendored
File diff suppressed because one or more lines are too long
250
js/dist/modal.js
vendored
250
js/dist/modal.js
vendored
@@ -1,21 +1,27 @@
|
||||
/*!
|
||||
* Bootstrap modal.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap modal.js v5.1.0 (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('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/event-handler', './dom/manipulator', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory(global.SelectorEngine, global.EventHandler, global.Manipulator, global.Base));
|
||||
}(this, (function (SelectorEngine, EventHandler, Manipulator, BaseComponent) { 'use strict';
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(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/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory(global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
|
||||
}(this, (function (EventHandler, Manipulator, SelectorEngine, 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.1.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)
|
||||
|
||||
@@ -102,7 +108,7 @@
|
||||
}
|
||||
|
||||
if (typeof obj === 'string' && obj.length > 0) {
|
||||
return SelectorEngine__default['default'].findOne(obj);
|
||||
return document.querySelector(obj);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -128,7 +134,35 @@
|
||||
return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
|
||||
};
|
||||
|
||||
const reflow = element => element.offsetHeight;
|
||||
const isDisabled = element => {
|
||||
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (element.classList.contains('disabled')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof element.disabled !== 'undefined') {
|
||||
return element.disabled;
|
||||
}
|
||||
|
||||
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
||||
};
|
||||
/**
|
||||
* Trick to restart an element's animation
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @return void
|
||||
*
|
||||
* @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
|
||||
*/
|
||||
|
||||
|
||||
const reflow = element => {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
element.offsetHeight;
|
||||
};
|
||||
|
||||
const getjQuery = () => {
|
||||
const {
|
||||
@@ -218,7 +252,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): util/scrollBar.js
|
||||
* Bootstrap (v5.1.0): util/scrollBar.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -322,11 +356,12 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): util/backdrop.js
|
||||
* Bootstrap (v5.1.0): util/backdrop.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
const Default$1 = {
|
||||
const Default$2 = {
|
||||
className: 'modal-backdrop',
|
||||
isVisible: true,
|
||||
// if false, we use the backdrop helper without adding any element to the dom
|
||||
isAnimated: false,
|
||||
@@ -334,17 +369,17 @@
|
||||
// give the choice to place backdrop under different elements
|
||||
clickCallback: null
|
||||
};
|
||||
const DefaultType$1 = {
|
||||
const DefaultType$2 = {
|
||||
className: 'string',
|
||||
isVisible: 'boolean',
|
||||
isAnimated: 'boolean',
|
||||
rootElement: '(element|string)',
|
||||
clickCallback: '(function|null)'
|
||||
};
|
||||
const NAME$1 = 'backdrop';
|
||||
const CLASS_NAME_BACKDROP = 'modal-backdrop';
|
||||
const NAME$2 = 'backdrop';
|
||||
const CLASS_NAME_FADE$1 = 'fade';
|
||||
const CLASS_NAME_SHOW$1 = 'show';
|
||||
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$1}`;
|
||||
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$2}`;
|
||||
|
||||
class Backdrop {
|
||||
constructor(config) {
|
||||
@@ -390,7 +425,7 @@
|
||||
_getElement() {
|
||||
if (!this._element) {
|
||||
const backdrop = document.createElement('div');
|
||||
backdrop.className = CLASS_NAME_BACKDROP;
|
||||
backdrop.className = this._config.className;
|
||||
|
||||
if (this._config.isAnimated) {
|
||||
backdrop.classList.add(CLASS_NAME_FADE$1);
|
||||
@@ -403,12 +438,12 @@
|
||||
}
|
||||
|
||||
_getConfig(config) {
|
||||
config = { ...Default$1,
|
||||
config = { ...Default$2,
|
||||
...(typeof config === 'object' ? config : {})
|
||||
}; // use getElement() with the default "body" to get a fresh Element on each instantiation
|
||||
|
||||
config.rootElement = getElement(config.rootElement);
|
||||
typeCheckConfig(NAME$1, config, DefaultType$1);
|
||||
typeCheckConfig(NAME$2, config, DefaultType$2);
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -417,7 +452,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
this._config.rootElement.appendChild(this._getElement());
|
||||
this._config.rootElement.append(this._getElement());
|
||||
|
||||
EventHandler__default['default'].on(this._getElement(), EVENT_MOUSEDOWN, () => {
|
||||
execute(this._config.clickCallback);
|
||||
@@ -445,7 +480,136 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): modal.js
|
||||
* Bootstrap (v5.1.0): util/focustrap.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
const Default$1 = {
|
||||
trapElement: null,
|
||||
// The element to trap focus inside of
|
||||
autofocus: true
|
||||
};
|
||||
const DefaultType$1 = {
|
||||
trapElement: 'element',
|
||||
autofocus: 'boolean'
|
||||
};
|
||||
const NAME$1 = 'focustrap';
|
||||
const DATA_KEY$1 = 'bs.focustrap';
|
||||
const EVENT_KEY$1 = `.${DATA_KEY$1}`;
|
||||
const EVENT_FOCUSIN = `focusin${EVENT_KEY$1}`;
|
||||
const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$1}`;
|
||||
const TAB_KEY = 'Tab';
|
||||
const TAB_NAV_FORWARD = 'forward';
|
||||
const TAB_NAV_BACKWARD = 'backward';
|
||||
|
||||
class FocusTrap {
|
||||
constructor(config) {
|
||||
this._config = this._getConfig(config);
|
||||
this._isActive = false;
|
||||
this._lastTabNavDirection = null;
|
||||
}
|
||||
|
||||
activate() {
|
||||
const {
|
||||
trapElement,
|
||||
autofocus
|
||||
} = this._config;
|
||||
|
||||
if (this._isActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (autofocus) {
|
||||
trapElement.focus();
|
||||
}
|
||||
|
||||
EventHandler__default['default'].off(document, EVENT_KEY$1); // guard against infinite focus loop
|
||||
|
||||
EventHandler__default['default'].on(document, EVENT_FOCUSIN, event => this._handleFocusin(event));
|
||||
EventHandler__default['default'].on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
|
||||
this._isActive = true;
|
||||
}
|
||||
|
||||
deactivate() {
|
||||
if (!this._isActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._isActive = false;
|
||||
EventHandler__default['default'].off(document, EVENT_KEY$1);
|
||||
} // Private
|
||||
|
||||
|
||||
_handleFocusin(event) {
|
||||
const {
|
||||
target
|
||||
} = event;
|
||||
const {
|
||||
trapElement
|
||||
} = this._config;
|
||||
|
||||
if (target === document || target === trapElement || trapElement.contains(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const elements = SelectorEngine__default['default'].focusableChildren(trapElement);
|
||||
|
||||
if (elements.length === 0) {
|
||||
trapElement.focus();
|
||||
} else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
|
||||
elements[elements.length - 1].focus();
|
||||
} else {
|
||||
elements[0].focus();
|
||||
}
|
||||
}
|
||||
|
||||
_handleKeydown(event) {
|
||||
if (event.key !== TAB_KEY) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
|
||||
}
|
||||
|
||||
_getConfig(config) {
|
||||
config = { ...Default$1,
|
||||
...(typeof config === 'object' ? config : {})
|
||||
};
|
||||
typeCheckConfig(NAME$1, config, DefaultType$1);
|
||||
return config;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.0): util/component-functions.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const enableDismissTrigger = (component, method = 'hide') => {
|
||||
const clickEvent = `click.dismiss${component.EVENT_KEY}`;
|
||||
const name = component.NAME;
|
||||
EventHandler__default['default'].on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
|
||||
if (['A', 'AREA'].includes(this.tagName)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (isDisabled(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const target = getElementFromSelector(this) || this.closest(`.${name}`);
|
||||
const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
|
||||
|
||||
instance[method]();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.0): modal.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -475,7 +639,6 @@
|
||||
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
|
||||
const EVENT_RESIZE = `resize${EVENT_KEY}`;
|
||||
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
|
||||
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`;
|
||||
@@ -489,7 +652,6 @@
|
||||
const SELECTOR_DIALOG = '.modal-dialog';
|
||||
const SELECTOR_MODAL_BODY = '.modal-body';
|
||||
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="modal"]';
|
||||
const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="modal"]';
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
@@ -502,6 +664,7 @@
|
||||
this._config = this._getConfig(config);
|
||||
this._dialog = SelectorEngine__default['default'].findOne(SELECTOR_DIALOG, this._element);
|
||||
this._backdrop = this._initializeBackDrop();
|
||||
this._focustrap = this._initializeFocusTrap();
|
||||
this._isShown = false;
|
||||
this._ignoreBackdropClick = false;
|
||||
this._isTransitioning = false;
|
||||
@@ -551,7 +714,6 @@
|
||||
|
||||
this._setResizeEvent();
|
||||
|
||||
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, event => this.hide(event));
|
||||
EventHandler__default['default'].on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
|
||||
EventHandler__default['default'].one(this._element, EVENT_MOUSEUP_DISMISS, event => {
|
||||
if (event.target === this._element) {
|
||||
@@ -563,11 +725,7 @@
|
||||
this._showBackdrop(() => this._showElement(relatedTarget));
|
||||
}
|
||||
|
||||
hide(event) {
|
||||
if (event && ['A', 'AREA'].includes(event.target.tagName)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
hide() {
|
||||
if (!this._isShown || this._isTransitioning) {
|
||||
return;
|
||||
}
|
||||
@@ -590,7 +748,7 @@
|
||||
|
||||
this._setResizeEvent();
|
||||
|
||||
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
|
||||
this._focustrap.deactivate();
|
||||
|
||||
this._element.classList.remove(CLASS_NAME_SHOW);
|
||||
|
||||
@@ -605,14 +763,9 @@
|
||||
|
||||
this._backdrop.dispose();
|
||||
|
||||
super.dispose();
|
||||
/**
|
||||
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
|
||||
* Do not move `document` in `htmlElements` array
|
||||
* It will remove `EVENT_CLICK_DATA_API` event that should remain
|
||||
*/
|
||||
this._focustrap.deactivate();
|
||||
|
||||
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
handleUpdate() {
|
||||
@@ -628,6 +781,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
_initializeFocusTrap() {
|
||||
return new FocusTrap({
|
||||
trapElement: this._element
|
||||
});
|
||||
}
|
||||
|
||||
_getConfig(config) {
|
||||
config = { ...Default,
|
||||
...Manipulator__default['default'].getDataAttributes(this._element),
|
||||
@@ -644,7 +803,7 @@
|
||||
|
||||
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
|
||||
// Don't move modal's DOM position
|
||||
document.body.appendChild(this._element);
|
||||
document.body.append(this._element);
|
||||
}
|
||||
|
||||
this._element.style.display = 'block';
|
||||
@@ -667,13 +826,9 @@
|
||||
|
||||
this._element.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
if (this._config.focus) {
|
||||
this._enforceFocus();
|
||||
}
|
||||
|
||||
const transitionComplete = () => {
|
||||
if (this._config.focus) {
|
||||
this._element.focus();
|
||||
this._focustrap.activate();
|
||||
}
|
||||
|
||||
this._isTransitioning = false;
|
||||
@@ -685,16 +840,6 @@
|
||||
this._queueCallback(transitionComplete, this._dialog, isAnimated);
|
||||
}
|
||||
|
||||
_enforceFocus() {
|
||||
EventHandler__default['default'].off(document, EVENT_FOCUSIN); // guard against infinite focus loop
|
||||
|
||||
EventHandler__default['default'].on(document, EVENT_FOCUSIN, event => {
|
||||
if (document !== event.target && this._element !== event.target && !this._element.contains(event.target)) {
|
||||
this._element.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_setEscapeEvent() {
|
||||
if (this._isShown) {
|
||||
EventHandler__default['default'].on(this._element, EVENT_KEYDOWN_DISMISS, event => {
|
||||
@@ -873,6 +1018,7 @@
|
||||
const data = Modal.getOrCreateInstance(target);
|
||||
data.toggle(this);
|
||||
});
|
||||
enableDismissTrigger(Modal);
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* jQuery
|
||||
|
2
js/dist/modal.js.map
vendored
2
js/dist/modal.js.map
vendored
File diff suppressed because one or more lines are too long
208
js/dist/offcanvas.js
vendored
208
js/dist/offcanvas.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Bootstrap offcanvas.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap offcanvas.js v5.1.0 (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)
|
||||
*/
|
||||
@@ -16,6 +16,12 @@
|
||||
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
|
||||
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.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)
|
||||
|
||||
@@ -102,7 +108,7 @@
|
||||
}
|
||||
|
||||
if (typeof obj === 'string' && obj.length > 0) {
|
||||
return SelectorEngine__default['default'].findOne(obj);
|
||||
return document.querySelector(obj);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -143,8 +149,20 @@
|
||||
|
||||
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
||||
};
|
||||
/**
|
||||
* Trick to restart an element's animation
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @return void
|
||||
*
|
||||
* @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
|
||||
*/
|
||||
|
||||
const reflow = element => element.offsetHeight;
|
||||
|
||||
const reflow = element => {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
element.offsetHeight;
|
||||
};
|
||||
|
||||
const getjQuery = () => {
|
||||
const {
|
||||
@@ -232,7 +250,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): util/scrollBar.js
|
||||
* Bootstrap (v5.1.0): util/scrollBar.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -336,11 +354,12 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): util/backdrop.js
|
||||
* Bootstrap (v5.1.0): util/backdrop.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
const Default$1 = {
|
||||
const Default$2 = {
|
||||
className: 'modal-backdrop',
|
||||
isVisible: true,
|
||||
// if false, we use the backdrop helper without adding any element to the dom
|
||||
isAnimated: false,
|
||||
@@ -348,17 +367,17 @@
|
||||
// give the choice to place backdrop under different elements
|
||||
clickCallback: null
|
||||
};
|
||||
const DefaultType$1 = {
|
||||
const DefaultType$2 = {
|
||||
className: 'string',
|
||||
isVisible: 'boolean',
|
||||
isAnimated: 'boolean',
|
||||
rootElement: '(element|string)',
|
||||
clickCallback: '(function|null)'
|
||||
};
|
||||
const NAME$1 = 'backdrop';
|
||||
const CLASS_NAME_BACKDROP = 'modal-backdrop';
|
||||
const NAME$2 = 'backdrop';
|
||||
const CLASS_NAME_FADE = 'fade';
|
||||
const CLASS_NAME_SHOW$1 = 'show';
|
||||
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$1}`;
|
||||
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$2}`;
|
||||
|
||||
class Backdrop {
|
||||
constructor(config) {
|
||||
@@ -404,7 +423,7 @@
|
||||
_getElement() {
|
||||
if (!this._element) {
|
||||
const backdrop = document.createElement('div');
|
||||
backdrop.className = CLASS_NAME_BACKDROP;
|
||||
backdrop.className = this._config.className;
|
||||
|
||||
if (this._config.isAnimated) {
|
||||
backdrop.classList.add(CLASS_NAME_FADE);
|
||||
@@ -417,12 +436,12 @@
|
||||
}
|
||||
|
||||
_getConfig(config) {
|
||||
config = { ...Default$1,
|
||||
config = { ...Default$2,
|
||||
...(typeof config === 'object' ? config : {})
|
||||
}; // use getElement() with the default "body" to get a fresh Element on each instantiation
|
||||
|
||||
config.rootElement = getElement(config.rootElement);
|
||||
typeCheckConfig(NAME$1, config, DefaultType$1);
|
||||
typeCheckConfig(NAME$2, config, DefaultType$2);
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -431,7 +450,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
this._config.rootElement.appendChild(this._getElement());
|
||||
this._config.rootElement.append(this._getElement());
|
||||
|
||||
EventHandler__default['default'].on(this._getElement(), EVENT_MOUSEDOWN, () => {
|
||||
execute(this._config.clickCallback);
|
||||
@@ -459,7 +478,136 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): offcanvas.js
|
||||
* Bootstrap (v5.1.0): util/focustrap.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
const Default$1 = {
|
||||
trapElement: null,
|
||||
// The element to trap focus inside of
|
||||
autofocus: true
|
||||
};
|
||||
const DefaultType$1 = {
|
||||
trapElement: 'element',
|
||||
autofocus: 'boolean'
|
||||
};
|
||||
const NAME$1 = 'focustrap';
|
||||
const DATA_KEY$1 = 'bs.focustrap';
|
||||
const EVENT_KEY$1 = `.${DATA_KEY$1}`;
|
||||
const EVENT_FOCUSIN = `focusin${EVENT_KEY$1}`;
|
||||
const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$1}`;
|
||||
const TAB_KEY = 'Tab';
|
||||
const TAB_NAV_FORWARD = 'forward';
|
||||
const TAB_NAV_BACKWARD = 'backward';
|
||||
|
||||
class FocusTrap {
|
||||
constructor(config) {
|
||||
this._config = this._getConfig(config);
|
||||
this._isActive = false;
|
||||
this._lastTabNavDirection = null;
|
||||
}
|
||||
|
||||
activate() {
|
||||
const {
|
||||
trapElement,
|
||||
autofocus
|
||||
} = this._config;
|
||||
|
||||
if (this._isActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (autofocus) {
|
||||
trapElement.focus();
|
||||
}
|
||||
|
||||
EventHandler__default['default'].off(document, EVENT_KEY$1); // guard against infinite focus loop
|
||||
|
||||
EventHandler__default['default'].on(document, EVENT_FOCUSIN, event => this._handleFocusin(event));
|
||||
EventHandler__default['default'].on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
|
||||
this._isActive = true;
|
||||
}
|
||||
|
||||
deactivate() {
|
||||
if (!this._isActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._isActive = false;
|
||||
EventHandler__default['default'].off(document, EVENT_KEY$1);
|
||||
} // Private
|
||||
|
||||
|
||||
_handleFocusin(event) {
|
||||
const {
|
||||
target
|
||||
} = event;
|
||||
const {
|
||||
trapElement
|
||||
} = this._config;
|
||||
|
||||
if (target === document || target === trapElement || trapElement.contains(target)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const elements = SelectorEngine__default['default'].focusableChildren(trapElement);
|
||||
|
||||
if (elements.length === 0) {
|
||||
trapElement.focus();
|
||||
} else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
|
||||
elements[elements.length - 1].focus();
|
||||
} else {
|
||||
elements[0].focus();
|
||||
}
|
||||
}
|
||||
|
||||
_handleKeydown(event) {
|
||||
if (event.key !== TAB_KEY) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
|
||||
}
|
||||
|
||||
_getConfig(config) {
|
||||
config = { ...Default$1,
|
||||
...(typeof config === 'object' ? config : {})
|
||||
};
|
||||
typeCheckConfig(NAME$1, config, DefaultType$1);
|
||||
return config;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.0): util/component-functions.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const enableDismissTrigger = (component, method = 'hide') => {
|
||||
const clickEvent = `click.dismiss${component.EVENT_KEY}`;
|
||||
const name = component.NAME;
|
||||
EventHandler__default['default'].on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
|
||||
if (['A', 'AREA'].includes(this.tagName)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (isDisabled(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const target = getElementFromSelector(this) || this.closest(`.${name}`);
|
||||
const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
|
||||
|
||||
instance[method]();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.0): offcanvas.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -486,16 +634,14 @@
|
||||
scroll: 'boolean'
|
||||
};
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
|
||||
const OPEN_SELECTOR = '.offcanvas.show';
|
||||
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||
const EVENT_HIDE = `hide${EVENT_KEY}`;
|
||||
const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||||
const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
|
||||
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||||
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
|
||||
const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`;
|
||||
const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="offcanvas"]';
|
||||
const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="offcanvas"]';
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
@@ -509,6 +655,7 @@
|
||||
this._config = this._getConfig(config);
|
||||
this._isShown = false;
|
||||
this._backdrop = this._initializeBackDrop();
|
||||
this._focustrap = this._initializeFocusTrap();
|
||||
|
||||
this._addEventListeners();
|
||||
} // Getters
|
||||
@@ -547,8 +694,6 @@
|
||||
|
||||
if (!this._config.scroll) {
|
||||
new ScrollBarHelper().hide();
|
||||
|
||||
this._enforceFocusOnElement(this._element);
|
||||
}
|
||||
|
||||
this._element.removeAttribute('aria-hidden');
|
||||
@@ -560,6 +705,10 @@
|
||||
this._element.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
const completeCallBack = () => {
|
||||
if (!this._config.scroll) {
|
||||
this._focustrap.activate();
|
||||
}
|
||||
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_SHOWN, {
|
||||
relatedTarget
|
||||
});
|
||||
@@ -579,7 +728,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
|
||||
this._focustrap.deactivate();
|
||||
|
||||
this._element.blur();
|
||||
|
||||
@@ -611,8 +760,9 @@
|
||||
dispose() {
|
||||
this._backdrop.dispose();
|
||||
|
||||
this._focustrap.deactivate();
|
||||
|
||||
super.dispose();
|
||||
EventHandler__default['default'].off(document, EVENT_FOCUSIN);
|
||||
} // Private
|
||||
|
||||
|
||||
@@ -627,6 +777,7 @@
|
||||
|
||||
_initializeBackDrop() {
|
||||
return new Backdrop({
|
||||
className: CLASS_NAME_BACKDROP,
|
||||
isVisible: this._config.backdrop,
|
||||
isAnimated: true,
|
||||
rootElement: this._element.parentNode,
|
||||
@@ -634,19 +785,13 @@
|
||||
});
|
||||
}
|
||||
|
||||
_enforceFocusOnElement(element) {
|
||||
EventHandler__default['default'].off(document, EVENT_FOCUSIN); // guard against infinite focus loop
|
||||
|
||||
EventHandler__default['default'].on(document, EVENT_FOCUSIN, event => {
|
||||
if (document !== event.target && element !== event.target && !element.contains(event.target)) {
|
||||
element.focus();
|
||||
}
|
||||
_initializeFocusTrap() {
|
||||
return new FocusTrap({
|
||||
trapElement: this._element
|
||||
});
|
||||
element.focus();
|
||||
}
|
||||
|
||||
_addEventListeners() {
|
||||
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
|
||||
EventHandler__default['default'].on(this._element, EVENT_KEYDOWN_DISMISS, event => {
|
||||
if (this._config.keyboard && event.key === ESCAPE_KEY) {
|
||||
this.hide();
|
||||
@@ -707,6 +852,7 @@
|
||||
data.toggle(this);
|
||||
});
|
||||
EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => SelectorEngine__default['default'].find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
|
||||
enableDismissTrigger(Offcanvas);
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* jQuery
|
||||
|
2
js/dist/offcanvas.js.map
vendored
2
js/dist/offcanvas.js.map
vendored
File diff suppressed because one or more lines are too long
71
js/dist/popover.js
vendored
71
js/dist/popover.js
vendored
@@ -1,19 +1,25 @@
|
||||
/*!
|
||||
* Bootstrap popover.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap popover.js v5.1.0 (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('./tooltip.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './tooltip'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.SelectorEngine, global.Tooltip));
|
||||
}(this, (function (SelectorEngine, Tooltip) { 'use strict';
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./tooltip.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./tooltip'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.Tooltip));
|
||||
}(this, (function (Tooltip) { 'use strict';
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
||||
var Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.0): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const getjQuery = () => {
|
||||
const {
|
||||
jQuery
|
||||
@@ -64,7 +70,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): popover.js
|
||||
* Bootstrap (v5.1.0): popover.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -78,7 +84,6 @@
|
||||
const DATA_KEY = 'bs.popover';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const CLASS_PREFIX = 'bs-popover';
|
||||
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
|
||||
const Default = { ...Tooltip__default['default'].Default,
|
||||
placement: 'right',
|
||||
offset: [0, 8],
|
||||
@@ -101,8 +106,6 @@
|
||||
MOUSEENTER: `mouseenter${EVENT_KEY}`,
|
||||
MOUSELEAVE: `mouseleave${EVENT_KEY}`
|
||||
};
|
||||
const CLASS_NAME_FADE = 'fade';
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
const SELECTOR_TITLE = '.popover-header';
|
||||
const SELECTOR_CONTENT = '.popover-body';
|
||||
/**
|
||||
@@ -134,55 +137,19 @@
|
||||
return this.getTitle() || this._getContent();
|
||||
}
|
||||
|
||||
getTipElement() {
|
||||
if (this.tip) {
|
||||
return this.tip;
|
||||
}
|
||||
setContent(tip) {
|
||||
this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TITLE);
|
||||
|
||||
this.tip = super.getTipElement();
|
||||
|
||||
if (!this.getTitle()) {
|
||||
SelectorEngine__default['default'].findOne(SELECTOR_TITLE, this.tip).remove();
|
||||
}
|
||||
|
||||
if (!this._getContent()) {
|
||||
SelectorEngine__default['default'].findOne(SELECTOR_CONTENT, this.tip).remove();
|
||||
}
|
||||
|
||||
return this.tip;
|
||||
}
|
||||
|
||||
setContent() {
|
||||
const tip = this.getTipElement(); // we use append for html objects to maintain js events
|
||||
|
||||
this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_TITLE, tip), this.getTitle());
|
||||
|
||||
let content = this._getContent();
|
||||
|
||||
if (typeof content === 'function') {
|
||||
content = content.call(this._element);
|
||||
}
|
||||
|
||||
this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_CONTENT, tip), content);
|
||||
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
|
||||
this._sanitizeAndSetContent(tip, this._getContent(), SELECTOR_CONTENT);
|
||||
} // Private
|
||||
|
||||
|
||||
_addAttachmentClass(attachment) {
|
||||
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
|
||||
}
|
||||
|
||||
_getContent() {
|
||||
return this._element.getAttribute('data-bs-content') || this._config.content;
|
||||
return this._resolvePossibleFunction(this._config.content);
|
||||
}
|
||||
|
||||
_cleanTipClass() {
|
||||
const tip = this.getTipElement();
|
||||
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
|
||||
|
||||
if (tabClass !== null && tabClass.length > 0) {
|
||||
tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
|
||||
}
|
||||
_getBasicClassPrefix() {
|
||||
return CLASS_PREFIX;
|
||||
} // Static
|
||||
|
||||
|
||||
|
2
js/dist/popover.js.map
vendored
2
js/dist/popover.js.map
vendored
File diff suppressed because one or more lines are too long
75
js/dist/scrollspy.js
vendored
75
js/dist/scrollspy.js
vendored
@@ -1,30 +1,28 @@
|
||||
/*!
|
||||
* Bootstrap scrollspy.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap scrollspy.js v5.1.0 (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('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/event-handler', './dom/manipulator', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ScrollSpy = factory(global.SelectorEngine, global.EventHandler, global.Manipulator, global.Base));
|
||||
}(this, (function (SelectorEngine, EventHandler, Manipulator, BaseComponent) { 'use strict';
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(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/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.ScrollSpy = factory(global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
|
||||
}(this, (function (EventHandler, Manipulator, SelectorEngine, 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.2): util/index.js
|
||||
* Bootstrap (v5.1.0): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const MAX_UID = 1000000;
|
||||
|
||||
const toType = obj => {
|
||||
if (obj === null || obj === undefined) {
|
||||
return `${obj}`;
|
||||
@@ -32,20 +30,6 @@
|
||||
|
||||
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
||||
};
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Public Util Api
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
const getUID = prefix => {
|
||||
do {
|
||||
prefix += Math.floor(Math.random() * MAX_UID);
|
||||
} while (document.getElementById(prefix));
|
||||
|
||||
return prefix;
|
||||
};
|
||||
|
||||
const getSelector = element => {
|
||||
let selector = element.getAttribute('data-bs-target');
|
||||
@@ -93,6 +77,19 @@
|
||||
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 document.querySelector(obj);
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
const typeCheckConfig = (componentName, config, configTypes) => {
|
||||
Object.keys(configTypes).forEach(property => {
|
||||
const expectedTypes = configTypes[property];
|
||||
@@ -155,7 +152,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): scrollspy.js
|
||||
* Bootstrap (v5.1.0): scrollspy.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -189,6 +186,7 @@
|
||||
const SELECTOR_NAV_LINKS = '.nav-link';
|
||||
const SELECTOR_NAV_ITEMS = '.nav-item';
|
||||
const SELECTOR_LIST_ITEMS = '.list-group-item';
|
||||
const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}, .${CLASS_NAME_DROPDOWN_ITEM}`;
|
||||
const SELECTOR_DROPDOWN = '.dropdown';
|
||||
const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
|
||||
const METHOD_OFFSET = 'offset';
|
||||
@@ -204,7 +202,6 @@
|
||||
super(element);
|
||||
this._scrollElement = this._element.tagName === 'BODY' ? window : this._element;
|
||||
this._config = this._getConfig(config);
|
||||
this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
|
||||
this._offsets = [];
|
||||
this._targets = [];
|
||||
this._activeTarget = null;
|
||||
@@ -232,7 +229,7 @@
|
||||
this._offsets = [];
|
||||
this._targets = [];
|
||||
this._scrollHeight = this._getScrollHeight();
|
||||
const targets = SelectorEngine__default['default'].find(this._selector);
|
||||
const targets = SelectorEngine__default['default'].find(SELECTOR_LINK_ITEMS, this._config.target);
|
||||
targets.map(element => {
|
||||
const targetSelector = getSelectorFromElement(element);
|
||||
const target = targetSelector ? SelectorEngine__default['default'].findOne(targetSelector) : null;
|
||||
@@ -264,20 +261,7 @@
|
||||
...Manipulator__default['default'].getDataAttributes(this._element),
|
||||
...(typeof config === 'object' && config ? config : {})
|
||||
};
|
||||
|
||||
if (typeof config.target !== 'string' && isElement(config.target)) {
|
||||
let {
|
||||
id
|
||||
} = config.target;
|
||||
|
||||
if (!id) {
|
||||
id = getUID(NAME);
|
||||
config.target.id = id;
|
||||
}
|
||||
|
||||
config.target = `#${id}`;
|
||||
}
|
||||
|
||||
config.target = getElement(config.target) || document.documentElement;
|
||||
typeCheckConfig(NAME, config, DefaultType);
|
||||
return config;
|
||||
}
|
||||
@@ -337,16 +321,13 @@
|
||||
|
||||
this._clear();
|
||||
|
||||
const queries = this._selector.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
|
||||
|
||||
const link = SelectorEngine__default['default'].findOne(queries.join(','));
|
||||
const queries = SELECTOR_LINK_ITEMS.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
|
||||
const link = SelectorEngine__default['default'].findOne(queries.join(','), this._config.target);
|
||||
link.classList.add(CLASS_NAME_ACTIVE);
|
||||
|
||||
if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
|
||||
SelectorEngine__default['default'].findOne(SELECTOR_DROPDOWN_TOGGLE, link.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE);
|
||||
link.classList.add(CLASS_NAME_ACTIVE);
|
||||
} else {
|
||||
// Set triggered link as active
|
||||
link.classList.add(CLASS_NAME_ACTIVE);
|
||||
SelectorEngine__default['default'].parents(link, SELECTOR_NAV_LIST_GROUP).forEach(listGroup => {
|
||||
// Set triggered links parents as active
|
||||
// With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
|
||||
@@ -364,7 +345,7 @@
|
||||
}
|
||||
|
||||
_clear() {
|
||||
SelectorEngine__default['default'].find(this._selector).filter(node => node.classList.contains(CLASS_NAME_ACTIVE)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE));
|
||||
SelectorEngine__default['default'].find(SELECTOR_LINK_ITEMS, this._config.target).filter(node => node.classList.contains(CLASS_NAME_ACTIVE)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE));
|
||||
} // Static
|
||||
|
||||
|
||||
|
2
js/dist/scrollspy.js.map
vendored
2
js/dist/scrollspy.js.map
vendored
File diff suppressed because one or more lines are too long
35
js/dist/tab.js
vendored
35
js/dist/tab.js
vendored
@@ -1,20 +1,27 @@
|
||||
/*!
|
||||
* Bootstrap tab.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap tab.js v5.1.0 (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('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/event-handler', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.SelectorEngine, global.EventHandler, global.Base));
|
||||
}(this, (function (SelectorEngine, EventHandler, BaseComponent) { 'use strict';
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./dom/selector-engine.js'), require('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['./dom/event-handler', './dom/selector-engine', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.EventHandler, global.SelectorEngine, global.Base));
|
||||
}(this, (function (EventHandler, SelectorEngine, 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 SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
|
||||
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.0): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const getSelector = element => {
|
||||
let selector = element.getAttribute('data-bs-target');
|
||||
|
||||
@@ -59,8 +66,20 @@
|
||||
|
||||
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
||||
};
|
||||
/**
|
||||
* Trick to restart an element's animation
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @return void
|
||||
*
|
||||
* @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
|
||||
*/
|
||||
|
||||
const reflow = element => element.offsetHeight;
|
||||
|
||||
const reflow = element => {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
element.offsetHeight;
|
||||
};
|
||||
|
||||
const getjQuery = () => {
|
||||
const {
|
||||
@@ -112,7 +131,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): tab.js
|
||||
* Bootstrap (v5.1.0): tab.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
2
js/dist/tab.js.map
vendored
2
js/dist/tab.js.map
vendored
File diff suppressed because one or more lines are too long
121
js/dist/toast.js
vendored
121
js/dist/toast.js
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Bootstrap toast.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap toast.js v5.1.0 (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,6 +15,13 @@
|
||||
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
|
||||
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.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}`;
|
||||
@@ -23,6 +30,35 @@
|
||||
return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
|
||||
};
|
||||
|
||||
const getSelector = element => {
|
||||
let selector = element.getAttribute('data-bs-target');
|
||||
|
||||
if (!selector || selector === '#') {
|
||||
let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
|
||||
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
||||
// `document.querySelector` will rightfully complain it is invalid.
|
||||
// See https://github.com/twbs/bootstrap/issues/32273
|
||||
|
||||
if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
|
||||
return null;
|
||||
} // Just in case some CMS puts out a full URL with the anchor appended
|
||||
|
||||
|
||||
if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
|
||||
hrefAttr = `#${hrefAttr.split('#')[1]}`;
|
||||
}
|
||||
|
||||
selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
|
||||
}
|
||||
|
||||
return selector;
|
||||
};
|
||||
|
||||
const getElementFromSelector = element => {
|
||||
const selector = getSelector(element);
|
||||
return selector ? document.querySelector(selector) : null;
|
||||
};
|
||||
|
||||
const isElement = obj => {
|
||||
if (!obj || typeof obj !== 'object') {
|
||||
return false;
|
||||
@@ -47,7 +83,35 @@
|
||||
});
|
||||
};
|
||||
|
||||
const reflow = element => element.offsetHeight;
|
||||
const isDisabled = element => {
|
||||
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (element.classList.contains('disabled')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (typeof element.disabled !== 'undefined') {
|
||||
return element.disabled;
|
||||
}
|
||||
|
||||
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
|
||||
};
|
||||
/**
|
||||
* Trick to restart an element's animation
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @return void
|
||||
*
|
||||
* @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
|
||||
*/
|
||||
|
||||
|
||||
const reflow = element => {
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
element.offsetHeight;
|
||||
};
|
||||
|
||||
const getjQuery = () => {
|
||||
const {
|
||||
@@ -99,7 +163,33 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): toast.js
|
||||
* Bootstrap (v5.1.0): util/component-functions.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const enableDismissTrigger = (component, method = 'hide') => {
|
||||
const clickEvent = `click.dismiss${component.EVENT_KEY}`;
|
||||
const name = component.NAME;
|
||||
EventHandler__default['default'].on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
|
||||
if (['A', 'AREA'].includes(this.tagName)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (isDisabled(this)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const target = getElementFromSelector(this) || this.closest(`.${name}`);
|
||||
const instance = component.getOrCreateInstance(target); // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
|
||||
|
||||
instance[method]();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.1.0): toast.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -112,7 +202,6 @@
|
||||
const NAME = 'toast';
|
||||
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}`;
|
||||
@@ -122,7 +211,8 @@
|
||||
const EVENT_SHOW = `show${EVENT_KEY}`;
|
||||
const EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||||
const CLASS_NAME_FADE = 'fade';
|
||||
const CLASS_NAME_HIDE = 'hide';
|
||||
const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
|
||||
|
||||
const CLASS_NAME_SHOW = 'show';
|
||||
const CLASS_NAME_SHOWING = 'showing';
|
||||
const DefaultType = {
|
||||
@@ -135,7 +225,6 @@
|
||||
autohide: true,
|
||||
delay: 5000
|
||||
};
|
||||
const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
@@ -183,17 +272,18 @@
|
||||
const complete = () => {
|
||||
this._element.classList.remove(CLASS_NAME_SHOWING);
|
||||
|
||||
this._element.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_SHOWN);
|
||||
|
||||
this._maybeScheduleHide();
|
||||
};
|
||||
|
||||
this._element.classList.remove(CLASS_NAME_HIDE);
|
||||
this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
|
||||
|
||||
|
||||
reflow(this._element);
|
||||
|
||||
this._element.classList.add(CLASS_NAME_SHOW);
|
||||
|
||||
this._element.classList.add(CLASS_NAME_SHOWING);
|
||||
|
||||
this._queueCallback(complete, this._element, this._config.animation);
|
||||
@@ -211,12 +301,17 @@
|
||||
}
|
||||
|
||||
const complete = () => {
|
||||
this._element.classList.add(CLASS_NAME_HIDE);
|
||||
this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
|
||||
|
||||
|
||||
this._element.classList.remove(CLASS_NAME_SHOWING);
|
||||
|
||||
this._element.classList.remove(CLASS_NAME_SHOW);
|
||||
|
||||
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
|
||||
};
|
||||
|
||||
this._element.classList.remove(CLASS_NAME_SHOW);
|
||||
this._element.classList.add(CLASS_NAME_SHOWING);
|
||||
|
||||
this._queueCallback(complete, this._element, this._config.animation);
|
||||
}
|
||||
@@ -284,7 +379,6 @@
|
||||
}
|
||||
|
||||
_setListeners() {
|
||||
EventHandler__default['default'].on(this._element, EVENT_CLICK_DISMISS, 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));
|
||||
@@ -312,6 +406,8 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enableDismissTrigger(Toast);
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* jQuery
|
||||
@@ -319,7 +415,6 @@
|
||||
* add .Toast to jQuery only if jQuery is present
|
||||
*/
|
||||
|
||||
|
||||
defineJQueryPlugin(Toast);
|
||||
|
||||
return Toast;
|
||||
|
2
js/dist/toast.js.map
vendored
2
js/dist/toast.js.map
vendored
File diff suppressed because one or more lines are too long
104
js/dist/tooltip.js
vendored
104
js/dist/tooltip.js
vendored
@@ -1,13 +1,13 @@
|
||||
/*!
|
||||
* Bootstrap tooltip.js v5.0.2 (https://getbootstrap.com/)
|
||||
* Bootstrap tooltip.js v5.1.0 (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('@popperjs/core'), require('./dom/selector-engine.js'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./base-component.js')) :
|
||||
typeof define === 'function' && define.amd ? define(['@popperjs/core', './dom/selector-engine', './dom/data', './dom/event-handler', './dom/manipulator', './base-component'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tooltip = factory(global.Popper, global.SelectorEngine, global.Data, global.EventHandler, global.Manipulator, global.Base));
|
||||
}(this, (function (Popper, SelectorEngine, Data, EventHandler, Manipulator, BaseComponent) { 'use strict';
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core'), 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/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.Data, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
|
||||
}(this, (function (Popper, Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
|
||||
|
||||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
||||
|
||||
@@ -32,19 +32,18 @@
|
||||
}
|
||||
|
||||
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.2): util/index.js
|
||||
* Bootstrap (v5.1.0): util/index.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
const MAX_UID = 1000000;
|
||||
|
||||
const toType = obj => {
|
||||
@@ -88,7 +87,7 @@
|
||||
}
|
||||
|
||||
if (typeof obj === 'string' && obj.length > 0) {
|
||||
return SelectorEngine__default['default'].findOne(obj);
|
||||
return document.querySelector(obj);
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -183,7 +182,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): util/sanitizer.js
|
||||
* Bootstrap (v5.1.0): util/sanitizer.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -296,7 +295,7 @@
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Bootstrap (v5.0.2): tooltip.js
|
||||
* Bootstrap (v5.1.0): tooltip.js
|
||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
||||
* --------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -310,7 +309,6 @@
|
||||
const DATA_KEY = 'bs.tooltip';
|
||||
const EVENT_KEY = `.${DATA_KEY}`;
|
||||
const CLASS_PREFIX = 'bs-tooltip';
|
||||
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
|
||||
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
|
||||
const DefaultType = {
|
||||
animation: 'boolean',
|
||||
@@ -375,6 +373,8 @@
|
||||
const HOVER_STATE_SHOW = 'show';
|
||||
const HOVER_STATE_OUT = 'out';
|
||||
const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
|
||||
const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
|
||||
const EVENT_MODAL_HIDE = 'hide.bs.modal';
|
||||
const TRIGGER_HOVER = 'hover';
|
||||
const TRIGGER_FOCUS = 'focus';
|
||||
const TRIGGER_CLICK = 'click';
|
||||
@@ -463,7 +463,7 @@
|
||||
|
||||
dispose() {
|
||||
clearTimeout(this._timeout);
|
||||
EventHandler__default['default'].off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
|
||||
EventHandler__default['default'].off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
||||
|
||||
if (this.tip) {
|
||||
this.tip.remove();
|
||||
@@ -499,8 +499,6 @@
|
||||
|
||||
this._element.setAttribute('aria-describedby', tipId);
|
||||
|
||||
this.setContent();
|
||||
|
||||
if (this._config.animation) {
|
||||
tip.classList.add(CLASS_NAME_FADE);
|
||||
}
|
||||
@@ -517,7 +515,7 @@
|
||||
Data__default['default'].set(tip, this.constructor.DATA_KEY, this);
|
||||
|
||||
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
|
||||
container.appendChild(tip);
|
||||
container.append(tip);
|
||||
EventHandler__default['default'].trigger(this._element, this.constructor.Event.INSERTED);
|
||||
}
|
||||
|
||||
@@ -528,7 +526,8 @@
|
||||
}
|
||||
|
||||
tip.classList.add(CLASS_NAME_SHOW);
|
||||
const customClass = typeof this._config.customClass === 'function' ? this._config.customClass() : this._config.customClass;
|
||||
|
||||
const customClass = this._resolvePossibleFunction(this._config.customClass);
|
||||
|
||||
if (customClass) {
|
||||
tip.classList.add(...customClass.split(' '));
|
||||
@@ -629,14 +628,27 @@
|
||||
|
||||
const element = document.createElement('div');
|
||||
element.innerHTML = this._config.template;
|
||||
this.tip = element.children[0];
|
||||
const tip = element.children[0];
|
||||
this.setContent(tip);
|
||||
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
|
||||
this.tip = tip;
|
||||
return this.tip;
|
||||
}
|
||||
|
||||
setContent() {
|
||||
const tip = this.getTipElement();
|
||||
this.setElementContent(SelectorEngine__default['default'].findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
|
||||
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
|
||||
setContent(tip) {
|
||||
this._sanitizeAndSetContent(tip, this.getTitle(), SELECTOR_TOOLTIP_INNER);
|
||||
}
|
||||
|
||||
_sanitizeAndSetContent(template, content, selector) {
|
||||
const templateElement = SelectorEngine__default['default'].findOne(selector, template);
|
||||
|
||||
if (!content && templateElement) {
|
||||
templateElement.remove();
|
||||
return;
|
||||
} // we use append for html objects to maintain js events
|
||||
|
||||
|
||||
this.setElementContent(templateElement, content);
|
||||
}
|
||||
|
||||
setElementContent(element, content) {
|
||||
@@ -650,7 +662,7 @@
|
||||
if (this._config.html) {
|
||||
if (content.parentNode !== element) {
|
||||
element.innerHTML = '';
|
||||
element.appendChild(content);
|
||||
element.append(content);
|
||||
}
|
||||
} else {
|
||||
element.textContent = content.textContent;
|
||||
@@ -671,13 +683,9 @@
|
||||
}
|
||||
|
||||
getTitle() {
|
||||
let title = this._element.getAttribute('data-bs-original-title');
|
||||
const title = this._element.getAttribute('data-bs-original-title') || this._config.title;
|
||||
|
||||
if (!title) {
|
||||
title = typeof this._config.title === 'function' ? this._config.title.call(this._element) : this._config.title;
|
||||
}
|
||||
|
||||
return title;
|
||||
return this._resolvePossibleFunction(title);
|
||||
}
|
||||
|
||||
updateAttachment(attachment) {
|
||||
@@ -694,15 +702,7 @@
|
||||
|
||||
|
||||
_initializeOnDelegatedTarget(event, context) {
|
||||
const dataKey = this.constructor.DATA_KEY;
|
||||
context = context || Data__default['default'].get(event.delegateTarget, dataKey);
|
||||
|
||||
if (!context) {
|
||||
context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
|
||||
Data__default['default'].set(event.delegateTarget, dataKey, context);
|
||||
}
|
||||
|
||||
return context;
|
||||
return context || this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
|
||||
}
|
||||
|
||||
_getOffset() {
|
||||
@@ -721,6 +721,10 @@
|
||||
return offset;
|
||||
}
|
||||
|
||||
_resolvePossibleFunction(content) {
|
||||
return typeof content === 'function' ? content.call(this._element) : content;
|
||||
}
|
||||
|
||||
_getPopperConfig(attachment) {
|
||||
const defaultBsPopperConfig = {
|
||||
placement: attachment,
|
||||
@@ -762,7 +766,7 @@
|
||||
}
|
||||
|
||||
_addAttachmentClass(attachment) {
|
||||
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
|
||||
this.getTipElement().classList.add(`${this._getBasicClassPrefix()}-${this.updateAttachment(attachment)}`);
|
||||
}
|
||||
|
||||
_getAttachment(placement) {
|
||||
@@ -789,7 +793,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
EventHandler__default['default'].on(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
|
||||
EventHandler__default['default'].on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
||||
|
||||
if (this._config.selector) {
|
||||
this._config = { ...this._config,
|
||||
@@ -920,26 +924,32 @@
|
||||
_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];
|
||||
}
|
||||
for (const key in this._config) {
|
||||
if (this.constructor.Default[key] !== this._config[key]) {
|
||||
config[key] = this._config[key];
|
||||
}
|
||||
}
|
||||
} // In the future can be replaced with:
|
||||
// const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
|
||||
// `Object.fromEntries(keysWithDifferentValues)`
|
||||
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
_cleanTipClass() {
|
||||
const tip = this.getTipElement();
|
||||
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
|
||||
const basicClassPrefixRegex = new RegExp(`(^|\\s)${this._getBasicClassPrefix()}\\S+`, 'g');
|
||||
const tabClass = tip.getAttribute('class').match(basicClassPrefixRegex);
|
||||
|
||||
if (tabClass !== null && tabClass.length > 0) {
|
||||
tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
|
||||
}
|
||||
}
|
||||
|
||||
_getBasicClassPrefix() {
|
||||
return CLASS_PREFIX;
|
||||
}
|
||||
|
||||
_handlePopperPlacementChange(popperData) {
|
||||
const {
|
||||
state
|
||||
|
2
js/dist/tooltip.js.map
vendored
2
js/dist/tooltip.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user