diff options
Diffstat (limited to 'dist/js/bootstrap.bundle.js')
-rw-r--r-- | dist/js/bootstrap.bundle.js | 136 |
1 files changed, 84 insertions, 52 deletions
diff --git a/dist/js/bootstrap.bundle.js b/dist/js/bootstrap.bundle.js index 969ecb04bd..a8be9ae7c9 100644 --- a/dist/js/bootstrap.bundle.js +++ b/dist/js/bootstrap.bundle.js @@ -1,5 +1,5 @@ /*! - * Bootstrap v5.1.0 (https://getbootstrap.com/) + * Bootstrap v5.1.1 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ @@ -11,7 +11,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): util/index.js + * Bootstrap (v5.1.1): util/index.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -322,7 +322,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): dom/event-handler.js + * Bootstrap (v5.1.1): dom/event-handler.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -385,7 +385,6 @@ event.delegateTarget = target; if (handler.oneOff) { - // eslint-disable-next-line unicorn/consistent-destructuring EventHandler.off(element, event.type, selector, fn); } @@ -611,7 +610,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): dom/data.js + * Bootstrap (v5.1.1): dom/data.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -665,7 +664,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): base-component.js + * Bootstrap (v5.1.1): base-component.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -675,7 +674,7 @@ * ------------------------------------------------------------------------ */ - const VERSION = '5.1.0'; + const VERSION = '5.1.1'; class BaseComponent { constructor(element) { @@ -731,7 +730,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): util/component-functions.js + * Bootstrap (v5.1.1): util/component-functions.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -757,7 +756,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): alert.js + * Bootstrap (v5.1.1): alert.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -846,7 +845,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): button.js + * Bootstrap (v5.1.1): button.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -917,7 +916,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): dom/manipulator.js + * Bootstrap (v5.1.1): dom/manipulator.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -991,7 +990,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): dom/selector-engine.js + * Bootstrap (v5.1.1): dom/selector-engine.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -1061,7 +1060,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): carousel.js + * Bootstrap (v5.1.1): carousel.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -1286,8 +1285,12 @@ } _addTouchEventListeners() { + const hasPointerPenTouch = event => { + return this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH); + }; + const start = event => { - if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) { + if (hasPointerPenTouch(event)) { this.touchStartX = event.clientX; } else if (!this._pointerEvent) { this.touchStartX = event.touches[0].clientX; @@ -1300,7 +1303,7 @@ }; const end = event => { - if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) { + if (hasPointerPenTouch(event)) { this.touchDeltaX = event.clientX - this.touchStartX; } @@ -1606,7 +1609,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): collapse.js + * Bootstrap (v5.1.1): collapse.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -1640,7 +1643,7 @@ const CLASS_NAME_HORIZONTAL = 'collapse-horizontal'; const WIDTH = 'width'; const HEIGHT = 'height'; - const SELECTOR_ACTIVES = '.show, .collapsing'; + const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; /** * ------------------------------------------------------------------------ @@ -2089,9 +2092,17 @@ var scaleY = 1; if (isHTMLElement(element) && includeScale) { + var offsetHeight = element.offsetHeight; + var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale // Fallback to 1 in case both values are `0` - scaleX = rect.width / element.offsetWidth || 1; - scaleY = rect.height / element.offsetHeight || 1; + + if (offsetWidth > 0) { + scaleX = rect.width / offsetWidth || 1; + } + + if (offsetHeight > 0) { + scaleY = rect.height / offsetHeight || 1; + } } return { @@ -2357,6 +2368,10 @@ requiresIfExists: ['preventOverflow'] }; + function getVariation(placement) { + return placement.split('-')[1]; + } + var unsetSides = { top: 'auto', right: 'auto', @@ -2383,6 +2398,7 @@ var popper = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, + variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, @@ -2409,7 +2425,7 @@ if (offsetParent === getWindow(popper)) { offsetParent = getDocumentElement(popper); - if (getComputedStyle$1(offsetParent).position !== 'static') { + if (getComputedStyle$1(offsetParent).position !== 'static' && position === 'absolute') { heightProp = 'scrollHeight'; widthProp = 'scrollWidth'; } @@ -2418,14 +2434,14 @@ offsetParent = offsetParent; - if (placement === top) { + if (placement === top || (placement === left || placement === right) && variation === end) { sideY = bottom; // $FlowFixMe[prop-missing] y -= offsetParent[heightProp] - popperRect.height; y *= gpuAcceleration ? 1 : -1; } - if (placement === left) { + if (placement === left || (placement === top || placement === bottom) && variation === end) { sideX = right; // $FlowFixMe[prop-missing] x -= offsetParent[widthProp] - popperRect.width; @@ -2440,7 +2456,7 @@ if (gpuAcceleration) { var _Object$assign; - return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) < 2 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign)); + return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign)); } return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2)); @@ -2458,6 +2474,7 @@ var commonStyles = { placement: getBasePlacement(state.placement), + variation: getVariation(state.placement), popper: state.elements.popper, popperRect: state.rects.popper, gpuAcceleration: gpuAcceleration @@ -2760,10 +2777,6 @@ return clippingRect; } - function getVariation(placement) { - return placement.split('-')[1]; - } - function computeOffsets(_ref) { var reference = _ref.reference, element = _ref.element, @@ -2849,11 +2862,10 @@ padding = _options$padding === void 0 ? 0 : _options$padding; var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements)); var altContext = elementContext === popper ? reference : popper; - var referenceElement = state.elements.reference; var popperRect = state.rects.popper; var element = state.elements[altBoundary ? altContext : elementContext]; var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary); - var referenceClientRect = getBoundingClientRect(referenceElement); + var referenceClientRect = getBoundingClientRect(state.elements.reference); var popperOffsets = computeOffsets({ reference: referenceClientRect, element: popperRect, @@ -3501,7 +3513,8 @@ var isDestroyed = false; var instance = { state: state, - setOptions: function setOptions(options) { + setOptions: function setOptions(setOptionsAction) { + var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction; cleanupModifierEffects(); state.options = Object.assign({}, defaultOptions, state.options, options); state.scrollParents = { @@ -3700,7 +3713,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): dropdown.js + * Bootstrap (v5.1.1): dropdown.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -4162,7 +4175,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): util/scrollBar.js + * Bootstrap (v5.1.1): util/scrollBar.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -4266,7 +4279,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): util/backdrop.js + * Bootstrap (v5.1.1): util/backdrop.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ @@ -4390,7 +4403,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): util/focustrap.js + * Bootstrap (v5.1.1): util/focustrap.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ @@ -4493,7 +4506,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): modal.js + * Bootstrap (v5.1.1): modal.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -4533,6 +4546,7 @@ const CLASS_NAME_FADE$3 = 'fade'; const CLASS_NAME_SHOW$4 = 'show'; const CLASS_NAME_STATIC = 'modal-static'; + const OPEN_SELECTOR$1 = '.modal.show'; const SELECTOR_DIALOG = '.modal-dialog'; const SELECTOR_MODAL_BODY = '.modal-body'; const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; @@ -4898,7 +4912,14 @@ this.focus(); } }); - }); + }); // avoid conflict when clicking moddal toggler while another one is open + + const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1); + + if (allReadyOpen) { + Modal.getInstance(allReadyOpen).hide(); + } + const data = Modal.getOrCreateInstance(target); data.toggle(this); }); @@ -4914,7 +4935,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): offcanvas.js + * Bootstrap (v5.1.1): offcanvas.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ @@ -5170,7 +5191,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): util/sanitizer.js + * Bootstrap (v5.1.1): util/sanitizer.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -5283,7 +5304,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): tooltip.js + * Bootstrap (v5.1.1): tooltip.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -5457,9 +5478,7 @@ this.tip.remove(); } - if (this._popper) { - this._popper.destroy(); - } + this._disposePopper(); super.dispose(); } @@ -5479,6 +5498,15 @@ if (showEvent.defaultPrevented || !isInTheDom) { return; + } // A trick to recreate a tooltip in case a new title is given by using the NOT documented `data-bs-original-title` + // This will be removed later in favor of a `setContent` method + + + if (this.constructor.NAME === 'tooltip' && this.tip && this.getTitle() !== this.tip.querySelector(SELECTOR_TOOLTIP_INNER).innerHTML) { + this._disposePopper(); + + this.tip.remove(); + this.tip = null; } const tip = this.getTipElement(); @@ -5568,11 +5596,7 @@ EventHandler.trigger(this._element, this.constructor.Event.HIDDEN); - if (this._popper) { - this._popper.destroy(); - - this._popper = null; - } + this._disposePopper(); }; const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE); @@ -5952,6 +5976,14 @@ this._cleanTipClass(); this._addAttachmentClass(this._getAttachment(state.placement)); + } + + _disposePopper() { + if (this._popper) { + this._popper.destroy(); + + this._popper = null; + } } // Static @@ -5982,7 +6014,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): popover.js + * Bootstrap (v5.1.1): popover.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -6092,7 +6124,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): scrollspy.js + * Bootstrap (v5.1.1): scrollspy.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -6327,7 +6359,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): tab.js + * Bootstrap (v5.1.1): tab.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -6525,7 +6557,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): toast.js + * Bootstrap (v5.1.1): toast.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -6755,7 +6787,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.1.0): index.umd.js + * Bootstrap (v5.1.1): index.umd.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ |