Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap-rubygem.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Mazovetskiy <glex.spb@gmail.com>2021-08-12 15:58:01 +0300
committerGleb Mazovetskiy <glex.spb@gmail.com>2021-08-12 15:58:25 +0300
commit7b25c697d8e2dcf983c3a71c18faeee78e5b3db5 (patch)
treea1aec9322f4ad6a1e31ce452faecac2badefc161 /assets/javascripts/bootstrap
parentc702c4dc732f44116e36837baffdf2efef4330f4 (diff)
Update to v5.0.2v5.0.2
bundle exec rake 'update[v5.0.2]'
Diffstat (limited to 'assets/javascripts/bootstrap')
-rw-r--r--assets/javascripts/bootstrap/alert.js35
-rw-r--r--assets/javascripts/bootstrap/base-component.js59
-rw-r--r--assets/javascripts/bootstrap/button.js37
-rw-r--r--assets/javascripts/bootstrap/carousel.js119
-rw-r--r--assets/javascripts/bootstrap/collapse.js21
-rw-r--r--assets/javascripts/bootstrap/dom/data.js4
-rw-r--r--assets/javascripts/bootstrap/dom/event-handler.js4
-rw-r--r--assets/javascripts/bootstrap/dom/manipulator.js4
-rw-r--r--assets/javascripts/bootstrap/dom/selector-engine.js4
-rw-r--r--assets/javascripts/bootstrap/dropdown.js105
-rw-r--r--assets/javascripts/bootstrap/modal.js279
-rw-r--r--assets/javascripts/bootstrap/offcanvas.js239
-rw-r--r--assets/javascripts/bootstrap/popover.js55
-rw-r--r--assets/javascripts/bootstrap/scrollspy.js19
-rw-r--r--assets/javascripts/bootstrap/tab.js28
-rw-r--r--assets/javascripts/bootstrap/toast.js32
-rw-r--r--assets/javascripts/bootstrap/tooltip.js41
17 files changed, 640 insertions, 445 deletions
diff --git a/assets/javascripts/bootstrap/alert.js b/assets/javascripts/bootstrap/alert.js
index 1020f6d..539d58a 100644
--- a/assets/javascripts/bootstrap/alert.js
+++ b/assets/javascripts/bootstrap/alert.js
@@ -1,17 +1,16 @@
/*!
- * Bootstrap alert.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap alert.js v5.0.2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./base-component.js')) :
- typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/data', './dom/event-handler', './base-component'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Alert = factory(global.SelectorEngine, global.Data, global.EventHandler, global.Base));
-}(this, (function (SelectorEngine, Data, EventHandler, BaseComponent) { 'use strict';
+ 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';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
- var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
@@ -56,9 +55,18 @@
return null;
};
+ const DOMContentLoadedCallbacks = [];
+
const onDOMContentLoaded = callback => {
if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', callback);
+ // add listener on the first call when the document is in loading state
+ if (!DOMContentLoadedCallbacks.length) {
+ document.addEventListener('DOMContentLoaded', () => {
+ DOMContentLoadedCallbacks.forEach(callback => callback());
+ });
+ }
+
+ DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
@@ -85,7 +93,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): alert.js
+ * Bootstrap (v5.0.2): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -148,21 +156,14 @@
}
_destroyElement(element) {
- if (element.parentNode) {
- element.parentNode.removeChild(element);
- }
-
+ element.remove();
EventHandler__default['default'].trigger(element, EVENT_CLOSED);
} // Static
static jQueryInterface(config) {
return this.each(function () {
- let data = Data__default['default'].get(this, DATA_KEY);
-
- if (!data) {
- data = new Alert(this);
- }
+ const data = Alert.getOrCreateInstance(this);
if (config === 'close') {
data[config](this);
diff --git a/assets/javascripts/bootstrap/base-component.js b/assets/javascripts/bootstrap/base-component.js
index 6230074..274f417 100644
--- a/assets/javascripts/bootstrap/base-component.js
+++ b/assets/javascripts/bootstrap/base-component.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap base-component.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap base-component.js v5.0.2 (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)
*/
@@ -70,33 +70,45 @@
return null;
};
- const emulateTransitionEnd = (element, duration) => {
- let called = false;
+ const execute = callback => {
+ if (typeof callback === 'function') {
+ callback();
+ }
+ };
+
+ const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
+ if (!waitForTransition) {
+ execute(callback);
+ return;
+ }
+
const durationPadding = 5;
- const emulatedDuration = duration + durationPadding;
+ const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
+ let called = false;
+
+ const handler = ({
+ target
+ }) => {
+ if (target !== transitionElement) {
+ return;
+ }
- function listener() {
called = true;
- element.removeEventListener(TRANSITION_END, listener);
- }
+ transitionElement.removeEventListener(TRANSITION_END, handler);
+ execute(callback);
+ };
- element.addEventListener(TRANSITION_END, listener);
+ transitionElement.addEventListener(TRANSITION_END, handler);
setTimeout(() => {
if (!called) {
- triggerTransitionEnd(element);
+ triggerTransitionEnd(transitionElement);
}
}, emulatedDuration);
};
- const execute = callback => {
- if (typeof callback === 'function') {
- callback();
- }
- };
-
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): base-component.js
+ * Bootstrap (v5.0.2): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -106,7 +118,7 @@
* ------------------------------------------------------------------------
*/
- const VERSION = '5.0.1';
+ const VERSION = '5.0.2';
class BaseComponent {
constructor(element) {
@@ -129,14 +141,7 @@
}
_queueCallback(callback, element, isAnimated = true) {
- if (!isAnimated) {
- execute(callback);
- return;
- }
-
- const transitionDuration = getTransitionDurationFromElement(element);
- EventHandler__default['default'].one(element, 'transitionend', () => execute(callback));
- emulateTransitionEnd(element, transitionDuration);
+ executeAfterTransition(callback, element, isAnimated);
}
/** Static */
@@ -145,6 +150,10 @@
return Data__default['default'].get(element, this.DATA_KEY);
}
+ static getOrCreateInstance(element, config = {}) {
+ return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null);
+ }
+
static get VERSION() {
return VERSION;
}
diff --git a/assets/javascripts/bootstrap/button.js b/assets/javascripts/bootstrap/button.js
index 50f3279..a5e2b0c 100644
--- a/assets/javascripts/bootstrap/button.js
+++ b/assets/javascripts/bootstrap/button.js
@@ -1,17 +1,16 @@
/*!
- * Bootstrap button.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap button.js v5.0.2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./base-component.js')) :
- typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/data', './dom/event-handler', './base-component'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Button = factory(global.SelectorEngine, global.Data, global.EventHandler, global.Base));
-}(this, (function (SelectorEngine, Data, EventHandler, BaseComponent) { 'use strict';
+ 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';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
- var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
@@ -27,9 +26,18 @@
return null;
};
+ const DOMContentLoadedCallbacks = [];
+
const onDOMContentLoaded = callback => {
if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', callback);
+ // add listener on the first call when the document is in loading state
+ if (!DOMContentLoadedCallbacks.length) {
+ document.addEventListener('DOMContentLoaded', () => {
+ DOMContentLoadedCallbacks.forEach(callback => callback());
+ });
+ }
+
+ DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
@@ -56,7 +64,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): button.js
+ * Bootstrap (v5.0.2): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -94,11 +102,7 @@
static jQueryInterface(config) {
return this.each(function () {
- let data = Data__default['default'].get(this, DATA_KEY);
-
- if (!data) {
- data = new Button(this);
- }
+ const data = Button.getOrCreateInstance(this);
if (config === 'toggle') {
data[config]();
@@ -117,12 +121,7 @@
EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {
event.preventDefault();
const button = event.target.closest(SELECTOR_DATA_TOGGLE);
- let data = Data__default['default'].get(button, DATA_KEY);
-
- if (!data) {
- data = new Button(button);
- }
-
+ const data = Button.getOrCreateInstance(button);
data.toggle();
});
/**
diff --git a/assets/javascripts/bootstrap/carousel.js b/assets/javascripts/bootstrap/carousel.js
index 49792d5..0d1a152 100644
--- a/assets/javascripts/bootstrap/carousel.js
+++ b/assets/javascripts/bootstrap/carousel.js
@@ -1,18 +1,17 @@
/*!
- * Bootstrap carousel.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap carousel.js v5.0.2 (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.Carousel = 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/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';
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 BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
@@ -85,17 +84,11 @@
};
const isVisible = element => {
- if (!element) {
+ if (!isElement(element) || element.getClientRects().length === 0) {
return false;
}
- if (element.style && element.parentNode && element.parentNode.style) {
- const elementStyle = getComputedStyle(element);
- const parentNodeStyle = getComputedStyle(element.parentNode);
- return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
- }
-
- return false;
+ return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
};
const reflow = element => element.offsetHeight;
@@ -112,9 +105,18 @@
return null;
};
+ const DOMContentLoadedCallbacks = [];
+
const onDOMContentLoaded = callback => {
if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', callback);
+ // add listener on the first call when the document is in loading state
+ if (!DOMContentLoadedCallbacks.length) {
+ document.addEventListener('DOMContentLoaded', () => {
+ DOMContentLoadedCallbacks.forEach(callback => callback());
+ });
+ }
+
+ DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
@@ -140,10 +142,37 @@
}
});
};
+ /**
+ * Return the previous/next element of a list.
+ *
+ * @param {array} list The list of elements
+ * @param activeElement The active element
+ * @param shouldGetNext Choose to get next or previous element
+ * @param isCycleAllowed
+ * @return {Element|elem} The proper element
+ */
+
+
+ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
+ let index = list.indexOf(activeElement); // if the element does not exist in the list return an element depending on the direction and if cycle is allowed
+
+ if (index === -1) {
+ return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
+ }
+
+ const listLength = list.length;
+ index += shouldGetNext ? 1 : -1;
+
+ if (isCycleAllowed) {
+ index = (index + listLength) % listLength;
+ }
+
+ return list[Math.max(0, Math.min(index, listLength - 1))];
+ };
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): carousel.js
+ * Bootstrap (v5.0.2): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -182,6 +211,10 @@
const ORDER_PREV = 'prev';
const DIRECTION_LEFT = 'left';
const DIRECTION_RIGHT = 'right';
+ const KEY_TO_DIRECTION = {
+ [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
+ [ARROW_RIGHT_KEY]: DIRECTION_LEFT
+ };
const EVENT_SLIDE = `slide${EVENT_KEY}`;
const EVENT_SLID = `slid${EVENT_KEY}`;
const EVENT_KEYDOWN = `keydown${EVENT_KEY}`;
@@ -250,9 +283,7 @@
next() {
- if (!this._isSliding) {
- this._slide(ORDER_NEXT);
- }
+ this._slide(ORDER_NEXT);
}
nextWhenVisible() {
@@ -264,9 +295,7 @@
}
prev() {
- if (!this._isSliding) {
- this._slide(ORDER_PREV);
- }
+ this._slide(ORDER_PREV);
}
pause(event) {
@@ -328,7 +357,8 @@
_getConfig(config) {
config = { ...Default,
- ...config
+ ...Manipulator__default['default'].getDataAttributes(this._element),
+ ...(typeof config === 'object' ? config : {})
};
typeCheckConfig(NAME, config, DefaultType);
return config;
@@ -426,14 +456,12 @@
return;
}
- if (event.key === ARROW_LEFT_KEY) {
- event.preventDefault();
+ const direction = KEY_TO_DIRECTION[event.key];
- this._slide(DIRECTION_RIGHT);
- } else if (event.key === ARROW_RIGHT_KEY) {
+ if (direction) {
event.preventDefault();
- this._slide(DIRECTION_LEFT);
+ this._slide(direction);
}
}
@@ -444,20 +472,7 @@
_getItemByOrder(order, activeElement) {
const isNext = order === ORDER_NEXT;
- const isPrev = order === ORDER_PREV;
-
- const activeIndex = this._getItemIndex(activeElement);
-
- const lastItemIndex = this._items.length - 1;
- const isGoingToWrap = isPrev && activeIndex === 0 || isNext && activeIndex === lastItemIndex;
-
- if (isGoingToWrap && !this._config.wrap) {
- return activeElement;
- }
-
- const delta = isPrev ? -1 : 1;
- const itemIndex = (activeIndex + delta) % this._items.length;
- return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
+ return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap);
}
_triggerSlideEvent(relatedTarget, eventDirectionName) {
@@ -530,6 +545,10 @@
return;
}
+ if (this._isSliding) {
+ return;
+ }
+
const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
if (slideEvent.defaultPrevented) {
@@ -613,10 +632,10 @@
static carouselInterface(element, config) {
- let data = Data__default['default'].get(element, DATA_KEY);
- let _config = { ...Default,
- ...Manipulator__default['default'].getDataAttributes(element)
- };
+ const data = Carousel.getOrCreateInstance(element, config);
+ let {
+ _config
+ } = data;
if (typeof config === 'object') {
_config = { ..._config,
@@ -626,10 +645,6 @@
const action = typeof config === 'string' ? config : _config.slide;
- if (!data) {
- data = new Carousel(element, _config);
- }
-
if (typeof config === 'number') {
data.to(config);
} else if (typeof action === 'string') {
@@ -669,7 +684,7 @@
Carousel.carouselInterface(target, config);
if (slideIndex) {
- Data__default['default'].get(target, DATA_KEY).to(slideIndex);
+ Carousel.getInstance(target).to(slideIndex);
}
event.preventDefault();
@@ -688,7 +703,7 @@
const carousels = SelectorEngine__default['default'].find(SELECTOR_DATA_RIDE);
for (let i = 0, len = carousels.length; i < len; i++) {
- Carousel.carouselInterface(carousels[i], Data__default['default'].get(carousels[i], DATA_KEY));
+ Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]));
}
});
/**
diff --git a/assets/javascripts/bootstrap/collapse.js b/assets/javascripts/bootstrap/collapse.js
index 6724627..40aa437 100644
--- a/assets/javascripts/bootstrap/collapse.js
+++ b/assets/javascripts/bootstrap/collapse.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap collapse.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap collapse.js v5.0.2 (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)
*/
@@ -115,9 +115,18 @@
return null;
};
+ const DOMContentLoadedCallbacks = [];
+
const onDOMContentLoaded = callback => {
if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', callback);
+ // add listener on the first call when the document is in loading state
+ if (!DOMContentLoadedCallbacks.length) {
+ document.addEventListener('DOMContentLoaded', () => {
+ DOMContentLoadedCallbacks.forEach(callback => callback());
+ });
+ }
+
+ DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
@@ -144,7 +153,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): collapse.js
+ * Bootstrap (v5.0.2): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -260,7 +269,7 @@
if (actives) {
const tempActiveData = actives.find(elem => container !== elem);
- activesData = tempActiveData ? Data__default['default'].get(tempActiveData, DATA_KEY) : null;
+ activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
if (activesData && activesData._isTransitioning) {
return;
@@ -423,7 +432,7 @@
static collapseInterface(element, config) {
- let data = Data__default['default'].get(element, DATA_KEY);
+ let data = Collapse.getInstance(element);
const _config = { ...Default,
...Manipulator__default['default'].getDataAttributes(element),
...(typeof config === 'object' && config ? config : {})
@@ -470,7 +479,7 @@
const selector = getSelectorFromElement(this);
const selectorElements = SelectorEngine__default['default'].find(selector);
selectorElements.forEach(element => {
- const data = Data__default['default'].get(element, DATA_KEY);
+ const data = Collapse.getInstance(element);
let config;
if (data) {
diff --git a/assets/javascripts/bootstrap/dom/data.js b/assets/javascripts/bootstrap/dom/data.js
index 3fafb3f..9d12826 100644
--- a/assets/javascripts/bootstrap/dom/data.js
+++ b/assets/javascripts/bootstrap/dom/data.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap data.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap data.js v5.0.2 (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.1): dom/data.js
+ * Bootstrap (v5.0.2): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
diff --git a/assets/javascripts/bootstrap/dom/event-handler.js b/assets/javascripts/bootstrap/dom/event-handler.js
index b45664b..3bac928 100644
--- a/assets/javascripts/bootstrap/dom/event-handler.js
+++ b/assets/javascripts/bootstrap/dom/event-handler.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap event-handler.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap event-handler.js v5.0.2 (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)
*/
@@ -23,7 +23,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): dom/event-handler.js
+ * Bootstrap (v5.0.2): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
diff --git a/assets/javascripts/bootstrap/dom/manipulator.js b/assets/javascripts/bootstrap/dom/manipulator.js
index 844928b..ec64f22 100644
--- a/assets/javascripts/bootstrap/dom/manipulator.js
+++ b/assets/javascripts/bootstrap/dom/manipulator.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap manipulator.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap manipulator.js v5.0.2 (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.1): dom/manipulator.js
+ * Bootstrap (v5.0.2): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
diff --git a/assets/javascripts/bootstrap/dom/selector-engine.js b/assets/javascripts/bootstrap/dom/selector-engine.js
index d3b5088..9a45199 100644
--- a/assets/javascripts/bootstrap/dom/selector-engine.js
+++ b/assets/javascripts/bootstrap/dom/selector-engine.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap selector-engine.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap selector-engine.js v5.0.2 (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.1): dom/selector-engine.js
+ * Bootstrap (v5.0.2): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
diff --git a/assets/javascripts/bootstrap/dropdown.js b/assets/javascripts/bootstrap/dropdown.js
index 47d04a3..e20db05 100644
--- a/assets/javascripts/bootstrap/dropdown.js
+++ b/assets/javascripts/bootstrap/dropdown.js
@@ -1,13 +1,13 @@
/*!
- * Bootstrap dropdown.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap dropdown.js v5.0.2 (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.Dropdown = 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/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';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -33,7 +33,6 @@
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 BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
@@ -113,17 +112,11 @@
};
const isVisible = element => {
- if (!element) {
+ if (!isElement(element) || element.getClientRects().length === 0) {
return false;
}
- if (element.style && element.parentNode && element.parentNode.style) {
- const elementStyle = getComputedStyle(element);
- const parentNodeStyle = getComputedStyle(element.parentNode);
- return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
- }
-
- return false;
+ return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
};
const isDisabled = element => {
@@ -156,9 +149,18 @@
return null;
};
+ const DOMContentLoadedCallbacks = [];
+
const onDOMContentLoaded = callback => {
if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', callback);
+ // add listener on the first call when the document is in loading state
+ if (!DOMContentLoadedCallbacks.length) {
+ document.addEventListener('DOMContentLoaded', () => {
+ DOMContentLoadedCallbacks.forEach(callback => callback());
+ });
+ }
+
+ DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
@@ -184,10 +186,37 @@
}
});
};
+ /**
+ * Return the previous/next element of a list.
+ *
+ * @param {array} list The list of elements
+ * @param activeElement The active element
+ * @param shouldGetNext Choose to get next or previous element
+ * @param isCycleAllowed
+ * @return {Element|elem} The proper element
+ */
+
+
+ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
+ let index = list.indexOf(activeElement); // if the element does not exist in the list return an element depending on the direction and if cycle is allowed
+
+ if (index === -1) {
+ return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
+ }
+
+ const listLength = list.length;
+ index += shouldGetNext ? 1 : -1;
+
+ if (isCycleAllowed) {
+ index = (index + listLength) % listLength;
+ }
+
+ return list[Math.max(0, Math.min(index, listLength - 1))];
+ };
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): dropdown.js
+ * Bootstrap (v5.0.2): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -507,38 +536,24 @@
};
}
- _selectMenuItem(event) {
+ _selectMenuItem({
+ key,
+ target
+ }) {
const items = SelectorEngine__default['default'].find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
if (!items.length) {
return;
- }
-
- let index = items.indexOf(event.target); // Up
-
- if (event.key === ARROW_UP_KEY && index > 0) {
- index--;
- } // Down
+ } // if target isn't included in items (e.g. when expanding the dropdown)
+ // allow cycling to get the last item in case key equals ARROW_UP_KEY
- if (event.key === ARROW_DOWN_KEY && index < items.length - 1) {
- index++;
- } // index is -1 if the first keydown is an ArrowUp
-
-
- index = index === -1 ? 0 : index;
- items[index].focus();
+ getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
} // Static
static dropdownInterface(element, config) {
- let data = Data__default['default'].get(element, DATA_KEY);
-
- const _config = typeof config === 'object' ? config : null;
-
- if (!data) {
- data = new Dropdown(element, _config);
- }
+ const data = Dropdown.getOrCreateInstance(element, config);
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
@@ -563,7 +578,7 @@
const toggles = SelectorEngine__default['default'].find(SELECTOR_DATA_TOGGLE);
for (let i = 0, len = toggles.length; i < len; i++) {
- const context = Data__default['default'].get(toggles[i], DATA_KEY);
+ const context = Dropdown.getInstance(toggles[i]);
if (!context || context._config.autoClose === false) {
continue;
@@ -636,17 +651,19 @@
return;
}
- if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) {
- getToggleButton().click();
+ if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
+ if (!isActive) {
+ getToggleButton().click();
+ }
+
+ Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
+
return;
}
if (!isActive || event.key === SPACE_KEY) {
Dropdown.clearMenus();
- return;
}
-
- Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
}
}
diff --git a/assets/javascripts/bootstrap/modal.js b/assets/javascripts/bootstrap/modal.js
index bf7f3d8..c4c8ff6 100644
--- a/assets/javascripts/bootstrap/modal.js
+++ b/assets/javascripts/bootstrap/modal.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap modal.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap modal.js v5.0.2 (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)
*/
@@ -95,22 +95,17 @@
return typeof obj.nodeType !== 'undefined';
};
- const emulateTransitionEnd = (element, duration) => {
- let called = false;
- const durationPadding = 5;
- const emulatedDuration = duration + durationPadding;
+ const getElement = obj => {
+ if (isElement(obj)) {
+ // it's a jQuery object or a node element
+ return obj.jquery ? obj[0] : obj;
+ }
- function listener() {
- called = true;
- element.removeEventListener(TRANSITION_END, listener);
+ if (typeof obj === 'string' && obj.length > 0) {
+ return SelectorEngine__default['default'].findOne(obj);
}
- element.addEventListener(TRANSITION_END, listener);
- setTimeout(() => {
- if (!called) {
- triggerTransitionEnd(element);
- }
- }, emulatedDuration);
+ return null;
};
const typeCheckConfig = (componentName, config, configTypes) => {
@@ -126,17 +121,11 @@
};
const isVisible = element => {
- if (!element) {
+ if (!isElement(element) || element.getClientRects().length === 0) {
return false;
}
- if (element.style && element.parentNode && element.parentNode.style) {
- const elementStyle = getComputedStyle(element);
- const parentNodeStyle = getComputedStyle(element.parentNode);
- return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
- }
-
- return false;
+ return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
};
const reflow = element => element.offsetHeight;
@@ -153,9 +142,18 @@
return null;
};
+ const DOMContentLoadedCallbacks = [];
+
const onDOMContentLoaded = callback => {
if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', callback);
+ // add listener on the first call when the document is in loading state
+ if (!DOMContentLoadedCallbacks.length) {
+ document.addEventListener('DOMContentLoaded', () => {
+ DOMContentLoadedCallbacks.forEach(callback => callback());
+ });
+ }
+
+ DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
@@ -188,83 +186,143 @@
}
};
+ const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
+ if (!waitForTransition) {
+ execute(callback);
+ return;
+ }
+
+ const durationPadding = 5;
+ const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
+ let called = false;
+
+ const handler = ({
+ target
+ }) => {
+ if (target !== transitionElement) {
+ return;
+ }
+
+ called = true;
+ transitionElement.removeEventListener(TRANSITION_END, handler);
+ execute(callback);
+ };
+
+ transitionElement.addEventListener(TRANSITION_END, handler);
+ setTimeout(() => {
+ if (!called) {
+ triggerTransitionEnd(transitionElement);
+ }
+ }, emulatedDuration);
+ };
+
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): util/scrollBar.js
+ * Bootstrap (v5.0.2): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
const SELECTOR_STICKY_CONTENT = '.sticky-top';
- const getWidth = () => {
- // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
- const documentWidth = document.documentElement.clientWidth;
- return Math.abs(window.innerWidth - documentWidth);
- };
+ class ScrollBarHelper {
+ constructor() {
+ this._element = document.body;
+ }
- const hide = (width = getWidth()) => {
- _disableOverFlow(); // give padding to element to balances the hidden scrollbar width
+ getWidth() {
+ // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
+ const documentWidth = document.documentElement.clientWidth;
+ return Math.abs(window.innerWidth - documentWidth);
+ }
+ hide() {
+ const width = this.getWidth();
- _setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements, to keep shown fullwidth
+ this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width
- _setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
+ this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
- _setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
- };
- const _disableOverFlow = () => {
- const actualValue = document.body.style.overflow;
+ this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
- if (actualValue) {
- Manipulator__default['default'].setDataAttribute(document.body, 'overflow', actualValue);
+ this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
}
- document.body.style.overflow = 'hidden';
- };
+ _disableOverFlow() {
+ this._saveInitialAttribute(this._element, 'overflow');
- const _setElementAttributes = (selector, styleProp, callback) => {
- const scrollbarWidth = getWidth();
- SelectorEngine__default['default'].find(selector).forEach(element => {
- if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
- return;
- }
+ this._element.style.overflow = 'hidden';
+ }
- const actualValue = element.style[styleProp];
- const calculatedValue = window.getComputedStyle(element)[styleProp];
- Manipulator__default['default'].setDataAttribute(element, styleProp, actualValue);
- element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
- });
- };
+ _setElementAttributes(selector, styleProp, callback) {
+ const scrollbarWidth = this.getWidth();
- const reset = () => {
- _resetElementAttributes('body', 'overflow');
+ const manipulationCallBack = element => {
+ if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
+ return;
+ }
- _resetElementAttributes('body', 'paddingRight');
+ this._saveInitialAttribute(element, styleProp);
- _resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
+ const calculatedValue = window.getComputedStyle(element)[styleProp];
+ element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
+ };
- _resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
- };
+ this._applyManipulationCallback(selector, manipulationCallBack);
+ }
- const _resetElementAttributes = (selector, styleProp) => {
- SelectorEngine__default['default'].find(selector).forEach(element => {
- const value = Manipulator__default['default'].getDataAttribute(element, styleProp);
+ reset() {
+ this._resetElementAttributes(this._element, 'overflow');
- if (typeof value === 'undefined') {
- element.style.removeProperty(styleProp);
+ this._resetElementAttributes(this._element, 'paddingRight');
+
+ this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
+
+ this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
+ }
+
+ _saveInitialAttribute(element, styleProp) {
+ const actualValue = element.style[styleProp];
+
+ if (actualValue) {
+ Manipulator__default['default'].setDataAttribute(element, styleProp, actualValue);
+ }
+ }
+
+ _resetElementAttributes(selector, styleProp) {
+ const manipulationCallBack = element => {
+ const value = Manipulator__default['default'].getDataAttribute(element, styleProp);
+
+ if (typeof value === 'undefined') {
+ element.style.removeProperty(styleProp);
+ } else {
+ Manipulator__default['default'].removeDataAttribute(element, styleProp);
+ element.style[styleProp] = value;
+ }
+ };
+
+ this._applyManipulationCallback(selector, manipulationCallBack);
+ }
+
+ _applyManipulationCallback(selector, callBack) {
+ if (isElement(selector)) {
+ callBack(selector);
} else {
- Manipulator__default['default'].removeDataAttribute(element, styleProp);
- element.style[styleProp] = value;
+ SelectorEngine__default['default'].find(selector, this._element).forEach(callBack);
}
- });
- };
+ }
+
+ isOverflowing() {
+ return this.getWidth() > 0;
+ }
+
+ }
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): util/backdrop.js
+ * Bootstrap (v5.0.2): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -272,14 +330,14 @@
isVisible: true,
// if false, we use the backdrop helper without adding any element to the dom
isAnimated: false,
- rootElement: document.body,
+ rootElement: 'body',
// give the choice to place backdrop under different elements
clickCallback: null
};
const DefaultType$1 = {
isVisible: 'boolean',
isAnimated: 'boolean',
- rootElement: 'element',
+ rootElement: '(element|string)',
clickCallback: '(function|null)'
};
const NAME$1 = 'backdrop';
@@ -347,8 +405,9 @@
_getConfig(config) {
config = { ...Default$1,
...(typeof config === 'object' ? config : {})
- };
- config.rootElement = config.rootElement || document.body;
+ }; // 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);
return config;
}
@@ -373,27 +432,20 @@
EventHandler__default['default'].off(this._element, EVENT_MOUSEDOWN);
- this._getElement().parentNode.removeChild(this._element);
+ this._element.remove();
this._isAppended = false;
}
_emulateAnimation(callback) {
- if (!this._config.isAnimated) {
- execute(callback);
- return;
- }
-
- const backdropTransitionDuration = getTransitionDurationFromElement(this._getElement());
- EventHandler__default['default'].one(this._getElement(), 'transitionend', () => execute(callback));
- emulateTransitionEnd(this._getElement(), backdropTransitionDuration);
+ executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
}
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): modal.js
+ * Bootstrap (v5.0.2): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -453,6 +505,7 @@
this._isShown = false;
this._ignoreBackdropClick = false;
this._isTransitioning = false;
+ this._scrollBar = new ScrollBarHelper();
} // Getters
@@ -474,20 +527,22 @@
return;
}
- if (this._isAnimated()) {
- this._isTransitioning = true;
- }
-
const showEvent = EventHandler__default['default'].trigger(this._element, EVENT_SHOW, {
relatedTarget
});
- if (this._isShown || showEvent.defaultPrevented) {
+ if (showEvent.defaultPrevented) {
return;
}
this._isShown = true;
- hide();
+
+ if (this._isAnimated()) {
+ this._isTransitioning = true;
+ }
+
+ this._scrollBar.hide();
+
document.body.classList.add(CLASS_NAME_OPEN);
this._adjustDialog();
@@ -509,7 +564,7 @@
}
hide(event) {
- if (event) {
+ if (event && ['A', 'AREA'].includes(event.target.tagName)) {
event.preventDefault();
}
@@ -576,7 +631,7 @@
_getConfig(config) {
config = { ...Default,
...Manipulator__default['default'].getDataAttributes(this._element),
- ...config
+ ...(typeof config === 'object' ? config : {})
};
typeCheckConfig(NAME, config, DefaultType);
return config;
@@ -679,7 +734,8 @@
this._resetAdjustments();
- reset();
+ this._scrollBar.reset();
+
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
});
}
@@ -716,27 +772,32 @@
return;
}
- const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
+ const {
+ classList,
+ scrollHeight,
+ style
+ } = this._element;
+ const isModalOverflowing = scrollHeight > document.documentElement.clientHeight; // return if the following background transition hasn't yet completed
+
+ if (!isModalOverflowing && style.overflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) {
+ return;
+ }
if (!isModalOverflowing) {
- this._element.style.overflowY = 'hidden';
+ style.overflowY = 'hidden';
}
- this._element.classList.add(CLASS_NAME_STATIC);
+ classList.add(CLASS_NAME_STATIC);
- const modalTransitionDuration = getTransitionDurationFromElement(this._dialog);
- EventHandler__default['default'].off(this._element, 'transitionend');
- EventHandler__default['default'].one(this._element, 'transitionend', () => {
- this._element.classList.remove(CLASS_NAME_STATIC);
+ this._queueCallback(() => {
+ classList.remove(CLASS_NAME_STATIC);
if (!isModalOverflowing) {
- EventHandler__default['default'].one(this._element, 'transitionend', () => {
- this._element.style.overflowY = '';
- });
- emulateTransitionEnd(this._element, modalTransitionDuration);
+ this._queueCallback(() => {
+ style.overflowY = '';
+ }, this._dialog);
}
- });
- emulateTransitionEnd(this._element, modalTransitionDuration);
+ }, this._dialog);
this._element.focus();
} // ----------------------------------------------------------------------
@@ -746,7 +807,9 @@
_adjustDialog() {
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
- const scrollbarWidth = getWidth();
+
+ const scrollbarWidth = this._scrollBar.getWidth();
+
const isBodyOverflowing = scrollbarWidth > 0;
if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
@@ -766,7 +829,7 @@
static jQueryInterface(config, relatedTarget) {
return this.each(function () {
- const data = Modal.getInstance(this) || new Modal(this, typeof config === 'object' ? config : {});
+ const data = Modal.getOrCreateInstance(this, config);
if (typeof config !== 'string') {
return;
@@ -807,7 +870,7 @@
}
});
});
- const data = Modal.getInstance(target) || new Modal(target);
+ const data = Modal.getOrCreateInstance(target);
data.toggle(this);
});
/**
diff --git a/assets/javascripts/bootstrap/offcanvas.js b/assets/javascripts/bootstrap/offcanvas.js
index 929cb17..e132db4 100644
--- a/assets/javascripts/bootstrap/offcanvas.js
+++ b/assets/javascripts/bootstrap/offcanvas.js
@@ -1,19 +1,18 @@
/*!
- * Bootstrap offcanvas.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap offcanvas.js v5.0.2 (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/manipulator.js'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./base-component.js')) :
- typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/manipulator', './dom/data', './dom/event-handler', './base-component'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Offcanvas = factory(global.SelectorEngine, global.Manipulator, global.Data, global.EventHandler, global.Base));
-}(this, (function (SelectorEngine, Manipulator, Data, EventHandler, BaseComponent) { 'use strict';
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/manipulator.js'), require('./dom/event-handler.js'), require('./base-component.js')) :
+ typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/manipulator', './dom/event-handler', './base-component'], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Offcanvas = factory(global.SelectorEngine, global.Manipulator, global.EventHandler, global.Base));
+}(this, (function (SelectorEngine, Manipulator, EventHandler, BaseComponent) { 'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
- var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
@@ -96,22 +95,17 @@
return typeof obj.nodeType !== 'undefined';
};
- const emulateTransitionEnd = (element, duration) => {
- let called = false;
- const durationPadding = 5;
- const emulatedDuration = duration + durationPadding;
+ const getElement = obj => {
+ if (isElement(obj)) {
+ // it's a jQuery object or a node element
+ return obj.jquery ? obj[0] : obj;
+ }
- function listener() {
- called = true;
- element.removeEventListener(TRANSITION_END, listener);
+ if (typeof obj === 'string' && obj.length > 0) {
+ return SelectorEngine__default['default'].findOne(obj);
}
- element.addEventListener(TRANSITION_END, listener);
- setTimeout(() => {
- if (!called) {
- triggerTransitionEnd(element);
- }
- }, emulatedDuration);
+ return null;
};
const typeCheckConfig = (componentName, config, configTypes) => {
@@ -127,17 +121,11 @@
};
const isVisible = element => {
- if (!element) {
+ if (!isElement(element) || element.getClientRects().length === 0) {
return false;
}
- if (element.style && element.parentNode && element.parentNode.style) {
- const elementStyle = getComputedStyle(element);
- const parentNodeStyle = getComputedStyle(element.parentNode);
- return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden';
- }
-
- return false;
+ return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
};
const isDisabled = element => {
@@ -170,9 +158,18 @@
return null;
};
+ const DOMContentLoadedCallbacks = [];
+
const onDOMContentLoaded = callback => {
if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', callback);
+ // add listener on the first call when the document is in loading state
+ if (!DOMContentLoadedCallbacks.length) {
+ document.addEventListener('DOMContentLoaded', () => {
+ DOMContentLoadedCallbacks.forEach(callback => callback());
+ });
+ }
+
+ DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
@@ -203,83 +200,143 @@
}
};
+ const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
+ if (!waitForTransition) {
+ execute(callback);
+ return;
+ }
+
+ const durationPadding = 5;
+ const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
+ let called = false;
+
+ const handler = ({
+ target
+ }) => {
+ if (target !== transitionElement) {
+ return;
+ }
+
+ called = true;
+ transitionElement.removeEventListener(TRANSITION_END, handler);
+ execute(callback);
+ };
+
+ transitionElement.addEventListener(TRANSITION_END, handler);
+ setTimeout(() => {
+ if (!called) {
+ triggerTransitionEnd(transitionElement);
+ }
+ }, emulatedDuration);
+ };
+
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): util/scrollBar.js
+ * Bootstrap (v5.0.2): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
const SELECTOR_STICKY_CONTENT = '.sticky-top';
- const getWidth = () => {
- // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
- const documentWidth = document.documentElement.clientWidth;
- return Math.abs(window.innerWidth - documentWidth);
- };
+ class ScrollBarHelper {
+ constructor() {
+ this._element = document.body;
+ }
- const hide = (width = getWidth()) => {
- _disableOverFlow(); // give padding to element to balances the hidden scrollbar width
+ getWidth() {
+ // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
+ const documentWidth = document.documentElement.clientWidth;
+ return Math.abs(window.innerWidth - documentWidth);
+ }
+ hide() {
+ const width = this.getWidth();
- _setElementAttributes('body', 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements, to keep shown fullwidth
+ this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width
- _setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
+ this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
- _setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
- };
- const _disableOverFlow = () => {
- const actualValue = document.body.style.overflow;
+ this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
- if (actualValue) {
- Manipulator__default['default'].setDataAttribute(document.body, 'overflow', actualValue);
+ this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
}
- document.body.style.overflow = 'hidden';
- };
+ _disableOverFlow() {
+ this._saveInitialAttribute(this._element, 'overflow');
- const _setElementAttributes = (selector, styleProp, callback) => {
- const scrollbarWidth = getWidth();
- SelectorEngine__default['default'].find(selector).forEach(element => {
- if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) {
- return;
- }
+ this._element.style.overflow = 'hidden';
+ }
- const actualValue = element.style[styleProp];
- const calculatedValue = window.getComputedStyle(element)[styleProp];
- Manipulator__default['default'].setDataAttribute(element, styleProp, actualValue);
- element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
- });
- };
+ _setElementAttributes(selector, styleProp, callback) {
+ const scrollbarWidth = this.getWidth();
- const reset = () => {
- _resetElementAttributes('body', 'overflow');
+ const manipulationCallBack = element => {
+ if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
+ return;
+ }
- _resetElementAttributes('body', 'paddingRight');
+ this._saveInitialAttribute(element, styleProp);
- _resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
+ const calculatedValue = window.getComputedStyle(element)[styleProp];
+ element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
+ };
- _resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
- };
+ this._applyManipulationCallback(selector, manipulationCallBack);
+ }
+
+ reset() {
+ this._resetElementAttributes(this._element, 'overflow');
+
+ this._resetElementAttributes(this._element, 'paddingRight');
+
+ this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
+
+ this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
+ }
+
+ _saveInitialAttribute(element, styleProp) {
+ const actualValue = element.style[styleProp];
+
+ if (actualValue) {
+ Manipulator__default['default'].setDataAttribute(element, styleProp, actualValue);
+ }
+ }
- const _resetElementAttributes = (selector, styleProp) => {
- SelectorEngine__default['default'].find(selector).forEach(element => {
- const value = Manipulator__default['default'].getDataAttribute(element, styleProp);
+ _resetElementAttributes(selector, styleProp) {
+ const manipulationCallBack = element => {
+ const value = Manipulator__default['default'].getDataAttribute(element, styleProp);
- if (typeof value === 'undefined') {
- element.style.removeProperty(styleProp);
+ if (typeof value === 'undefined') {
+ element.style.removeProperty(styleProp);
+ } else {
+ Manipulator__default['default'].removeDataAttribute(element, styleProp);
+ element.style[styleProp] = value;
+ }
+ };
+
+ this._applyManipulationCallback(selector, manipulationCallBack);
+ }
+
+ _applyManipulationCallback(selector, callBack) {
+ if (isElement(selector)) {
+ callBack(selector);
} else {
- Manipulator__default['default'].removeDataAttribute(element, styleProp);
- element.style[styleProp] = value;
+ SelectorEngine__default['default'].find(selector, this._element).forEach(callBack);
}
- });
- };
+ }
+
+ isOverflowing() {
+ return this.getWidth() > 0;
+ }
+
+ }
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): util/backdrop.js
+ * Bootstrap (v5.0.2): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -287,14 +344,14 @@
isVisible: true,
// if false, we use the backdrop helper without adding any element to the dom
isAnimated: false,
- rootElement: document.body,
+ rootElement: 'body',
// give the choice to place backdrop under different elements
clickCallback: null
};
const DefaultType$1 = {
isVisible: 'boolean',
isAnimated: 'boolean',
- rootElement: 'element',
+ rootElement: '(element|string)',
clickCallback: '(function|null)'
};
const NAME$1 = 'backdrop';
@@ -362,8 +419,9 @@
_getConfig(config) {
config = { ...Default$1,
...(typeof config === 'object' ? config : {})
- };
- config.rootElement = config.rootElement || document.body;
+ }; // 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);
return config;
}
@@ -388,27 +446,20 @@
EventHandler__default['default'].off(this._element, EVENT_MOUSEDOWN);
- this._getElement().parentNode.removeChild(this._element);
+ this._element.remove();
this._isAppended = false;
}
_emulateAnimation(callback) {
- if (!this._config.isAnimated) {
- execute(callback);
- return;
- }
-
- const backdropTransitionDuration = getTransitionDurationFromElement(this._getElement());
- EventHandler__default['default'].one(this._getElement(), 'transitionend', () => execute(callback));
- emulateTransitionEnd(this._getElement(), backdropTransitionDuration);
+ executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
}
}
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): offcanvas.js
+ * Bootstrap (v5.0.2): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -495,7 +546,7 @@
this._backdrop.show();
if (!this._config.scroll) {
- hide();
+ new ScrollBarHelper().hide();
this._enforceFocusOnElement(this._element);
}
@@ -548,7 +599,7 @@
this._element.style.visibility = 'hidden';
if (!this._config.scroll) {
- reset();
+ new ScrollBarHelper().reset();
}
EventHandler__default['default'].trigger(this._element, EVENT_HIDDEN);
@@ -606,7 +657,7 @@
static jQueryInterface(config) {
return this.each(function () {
- const data = Data__default['default'].get(this, DATA_KEY) || new Offcanvas(this, typeof config === 'object' ? config : {});
+ const data = Offcanvas.getOrCreateInstance(this, config);
if (typeof config !== 'string') {
return;
@@ -652,12 +703,10 @@
Offcanvas.getInstance(allReadyOpen).hide();
}
- const data = Data__default['default'].get(target, DATA_KEY) || new Offcanvas(target);
+ const data = Offcanvas.getOrCreateInstance(target);
data.toggle(this);
});
- EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => {
- SelectorEngine__default['default'].find(OPEN_SELECTOR).forEach(el => (Data__default['default'].get(el, DATA_KEY) || new Offcanvas(el)).show());
- });
+ EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => SelectorEngine__default['default'].find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
/**
* ------------------------------------------------------------------------
* jQuery
diff --git a/assets/javascripts/bootstrap/popover.js b/assets/javascripts/bootstrap/popover.js
index e482216..8a29737 100644
--- a/assets/javascripts/bootstrap/popover.js
+++ b/assets/javascripts/bootstrap/popover.js
@@ -1,18 +1,17 @@
/*!
- * Bootstrap popover.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap popover.js v5.0.2 (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('./tooltip.js')) :
- typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/data', './tooltip'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.SelectorEngine, global.Data, global.Tooltip));
-}(this, (function (SelectorEngine, Data, Tooltip) { 'use strict';
+ 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';
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 Tooltip__default = /*#__PURE__*/_interopDefaultLegacy(Tooltip);
const getjQuery = () => {
@@ -27,9 +26,18 @@
return null;
};
+ const DOMContentLoadedCallbacks = [];
+
const onDOMContentLoaded = callback => {
if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', callback);
+ // add listener on the first call when the document is in loading state
+ if (!DOMContentLoadedCallbacks.length) {
+ document.addEventListener('DOMContentLoaded', () => {
+ DOMContentLoadedCallbacks.forEach(callback => callback());
+ });
+ }
+
+ DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
@@ -56,7 +64,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): popover.js
+ * Bootstrap (v5.0.2): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -126,6 +134,24 @@
return this.getTitle() || this._getContent();
}
+ getTipElement() {
+ if (this.tip) {
+ return this.tip;
+ }
+
+ 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
@@ -162,18 +188,7 @@
static jQueryInterface(config) {
return this.each(function () {
- let data = Data__default['default'].get(this, DATA_KEY);
-
- const _config = typeof config === 'object' ? config : null;
-
- if (!data && /dispose|hide/.test(config)) {
- return;
- }
-
- if (!data) {
- data = new Popover(this, _config);
- Data__default['default'].set(this, DATA_KEY, data);
- }
+ const data = Popover.getOrCreateInstance(this, config);
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
diff --git a/assets/javascripts/bootstrap/scrollspy.js b/assets/javascripts/bootstrap/scrollspy.js
index e2c45b7..181ce92 100644
--- a/assets/javascripts/bootstrap/scrollspy.js
+++ b/assets/javascripts/bootstrap/scrollspy.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap scrollspy.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap scrollspy.js v5.0.2 (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)
*/
@@ -18,7 +18,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): util/index.js
+ * Bootstrap (v5.0.2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -117,9 +117,18 @@
return null;
};
+ const DOMContentLoadedCallbacks = [];
+
const onDOMContentLoaded = callback => {
if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', callback);
+ // add listener on the first call when the document is in loading state
+ if (!DOMContentLoadedCallbacks.length) {
+ document.addEventListener('DOMContentLoaded', () => {
+ DOMContentLoadedCallbacks.forEach(callback => callback());
+ });
+ }
+
+ DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
@@ -146,7 +155,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): scrollspy.js
+ * Bootstrap (v5.0.2): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -361,7 +370,7 @@
static jQueryInterface(config) {
return this.each(function () {
- const data = ScrollSpy.getInstance(this) || new ScrollSpy(this, typeof config === 'object' ? config : {});
+ const data = ScrollSpy.getOrCreateInstance(this, config);
if (typeof config !== 'string') {
return;
diff --git a/assets/javascripts/bootstrap/tab.js b/assets/javascripts/bootstrap/tab.js
index 933c793..1a201b4 100644
--- a/assets/javascripts/bootstrap/tab.js
+++ b/assets/javascripts/bootstrap/tab.js
@@ -1,18 +1,17 @@
/*!
- * Bootstrap tab.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap tab.js v5.0.2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./base-component.js')) :
- typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/data', './dom/event-handler', './base-component'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Tab = factory(global.SelectorEngine, global.Data, global.EventHandler, global.Base));
-}(this, (function (SelectorEngine, Data, EventHandler, BaseComponent) { 'use strict';
+ 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';
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 BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
@@ -75,9 +74,18 @@
return null;
};
+ const DOMContentLoadedCallbacks = [];
+
const onDOMContentLoaded = callback => {
if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', callback);
+ // add listener on the first call when the document is in loading state
+ if (!DOMContentLoadedCallbacks.length) {
+ document.addEventListener('DOMContentLoaded', () => {
+ DOMContentLoadedCallbacks.forEach(callback => callback());
+ });
+ }
+
+ DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
@@ -104,7 +112,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): tab.js
+ * Bootstrap (v5.0.2): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -259,7 +267,7 @@
static jQueryInterface(config) {
return this.each(function () {
- const data = Data__default['default'].get(this, DATA_KEY) || new Tab(this);
+ const data = Tab.getOrCreateInstance(this);
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
@@ -288,7 +296,7 @@
return;
}
- const data = Data__default['default'].get(this, DATA_KEY) || new Tab(this);
+ const data = Tab.getOrCreateInstance(this);
data.show();
});
/**
diff --git a/assets/javascripts/bootstrap/toast.js b/assets/javascripts/bootstrap/toast.js
index 56be199..27793e6 100644
--- a/assets/javascripts/bootstrap/toast.js
+++ b/assets/javascripts/bootstrap/toast.js
@@ -1,17 +1,16 @@
/*!
- * Bootstrap toast.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap toast.js v5.0.2 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./base-component.js')) :
- typeof define === 'function' && define.amd ? define(['./dom/data', './dom/event-handler', './dom/manipulator', './base-component'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.Data, global.EventHandler, global.Manipulator, global.Base));
-}(this, (function (Data, EventHandler, Manipulator, BaseComponent) { 'use strict';
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./base-component.js')) :
+ typeof define === 'function' && define.amd ? define(['./dom/event-handler', './dom/manipulator', './base-component'], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.EventHandler, global.Manipulator, global.Base));
+}(this, (function (EventHandler, Manipulator, BaseComponent) { 'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
- var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
@@ -62,9 +61,18 @@
return null;
};
+ const DOMContentLoadedCallbacks = [];
+
const onDOMContentLoaded = callback => {
if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', callback);
+ // add listener on the first call when the document is in loading state
+ if (!DOMContentLoadedCallbacks.length) {
+ document.addEventListener('DOMContentLoaded', () => {
+ DOMContentLoadedCallbacks.forEach(callback => callback());
+ });
+ }
+
+ DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
@@ -91,7 +99,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): toast.js
+ * Bootstrap (v5.0.2): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -291,13 +299,7 @@
static jQueryInterface(config) {
return this.each(function () {
- let data = Data__default['default'].get(this, DATA_KEY);
-
- const _config = typeof config === 'object' && config;
-
- if (!data) {
- data = new Toast(this, _config);
- }
+ const data = Toast.getOrCreateInstance(this, config);
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
diff --git a/assets/javascripts/bootstrap/tooltip.js b/assets/javascripts/bootstrap/tooltip.js
index 4d61bc1..53d66e7 100644
--- a/assets/javascripts/bootstrap/tooltip.js
+++ b/assets/javascripts/bootstrap/tooltip.js
@@ -1,5 +1,5 @@
/*!
- * Bootstrap tooltip.js v5.0.1 (https://getbootstrap.com/)
+ * Bootstrap tooltip.js v5.0.2 (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)
*/
@@ -40,7 +40,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): util/index.js
+ * Bootstrap (v5.0.2): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -143,9 +143,18 @@
return null;
};
+ const DOMContentLoadedCallbacks = [];
+
const onDOMContentLoaded = callback => {
if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', callback);
+ // add listener on the first call when the document is in loading state
+ if (!DOMContentLoadedCallbacks.length) {
+ document.addEventListener('DOMContentLoaded', () => {
+ DOMContentLoadedCallbacks.forEach(callback => callback());
+ });
+ }
+
+ DOMContentLoadedCallbacks.push(callback);
} else {
callback();
}
@@ -174,7 +183,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): util/sanitizer.js
+ * Bootstrap (v5.0.2): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -269,7 +278,7 @@
const elName = el.nodeName.toLowerCase();
if (!allowlistKeys.includes(elName)) {
- el.parentNode.removeChild(el);
+ el.remove();
continue;
}
@@ -287,7 +296,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.1): tooltip.js
+ * Bootstrap (v5.0.2): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -456,8 +465,8 @@
clearTimeout(this._timeout);
EventHandler__default['default'].off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
- if (this.tip && this.tip.parentNode) {
- this.tip.parentNode.removeChild(this.tip);
+ if (this.tip) {
+ this.tip.remove();
}
if (this._popper) {
@@ -562,8 +571,8 @@
return;
}
- if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
- tip.parentNode.removeChild(tip);
+ if (this._hoverState !== HOVER_STATE_SHOW) {
+ tip.remove();
}
this._cleanTipClass();
@@ -950,17 +959,7 @@
static jQueryInterface(config) {
return this.each(function () {
- let data = Data__default['default'].get(this, DATA_KEY);
-
- const _config = typeof config === 'object' && config;
-
- if (!data && /dispose|hide/.test(config)) {
- return;
- }
-
- if (!data) {
- data = new Tooltip(this, _config);
- }
+ const data = Tooltip.getOrCreateInstance(this, config);
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {