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

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dist/js/bootstrap.js')
-rw-r--r--dist/js/bootstrap.js249
1 files changed, 115 insertions, 134 deletions
diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js
index 1d6c166efb..7ff5c561f3 100644
--- a/dist/js/bootstrap.js
+++ b/dist/js/bootstrap.js
@@ -1,17 +1,35 @@
/*!
- * Bootstrap v5.0.0-alpha3 (https://getbootstrap.com/)
+ * Bootstrap v5.0.0-beta1 (https://getbootstrap.com/)
* Copyright 2011-2020 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('popper.js')) :
- typeof define === 'function' && define.amd ? define(['popper.js'], factory) :
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core')) :
+ typeof define === 'function' && define.amd ? define(['@popperjs/core'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory(global.Popper));
}(this, (function (Popper) { 'use strict';
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
+ function _interopNamespace(e) {
+ if (e && e.__esModule) return e;
+ var n = Object.create(null);
+ if (e) {
+ Object.keys(e).forEach(function (k) {
+ if (k !== 'default') {
+ var d = Object.getOwnPropertyDescriptor(e, k);
+ Object.defineProperty(n, k, d.get ? d : {
+ enumerable: true,
+ get: function () {
+ return e[k];
+ }
+ });
+ }
+ });
+ }
+ n['default'] = e;
+ return Object.freeze(n);
+ }
- var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper);
+ var Popper__namespace = /*#__PURE__*/_interopNamespace(Popper);
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
@@ -55,7 +73,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha3): util/index.js
+ * Bootstrap (v5.0.0-beta1): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -240,7 +258,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha3): dom/data.js
+ * Bootstrap (v5.0.0-beta1): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -307,7 +325,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha3): dom/event-handler.js
+ * Bootstrap (v5.0.0-beta1): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -586,7 +604,7 @@
* ------------------------------------------------------------------------
*/
- var VERSION = '5.0.0-alpha3';
+ var VERSION = '5.0.0-beta1';
var BaseComponent = /*#__PURE__*/function () {
function BaseComponent(element) {
@@ -869,7 +887,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha3): dom/manipulator.js
+ * Bootstrap (v5.0.0-beta1): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -941,7 +959,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha3): dom/selector-engine.js
+ * Bootstrap (v5.0.0-beta1): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -2065,9 +2083,7 @@
var CLASS_NAME_DROPUP = 'dropup';
var CLASS_NAME_DROPEND = 'dropend';
var CLASS_NAME_DROPSTART = 'dropstart';
- var CLASS_NAME_MENUEND = 'dropdown-menu-end';
var CLASS_NAME_NAVBAR = 'navbar';
- var CLASS_NAME_POSITION_STATIC = 'position-static';
var SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="dropdown"]';
var SELECTOR_FORM_CHILD = '.dropdown form';
var SELECTOR_MENU = '.dropdown-menu';
@@ -2082,7 +2098,7 @@
var Default$2 = {
offset: 0,
flip: true,
- boundary: 'scrollParent',
+ boundary: 'clippingParents',
reference: 'toggle',
display: 'dynamic',
popperConfig: null
@@ -2155,7 +2171,7 @@
if (!this._inNavbar) {
- if (typeof Popper__default['default'] === 'undefined') {
+ if (typeof Popper__namespace === 'undefined') {
throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
}
@@ -2169,16 +2185,9 @@
if (typeof this._config.reference.jquery !== 'undefined') {
referenceElement = this._config.reference[0];
}
- } // If boundary is not `scrollParent`, then set position to `static`
- // to allow the menu to "escape" the scroll parent's boundaries
- // https://github.com/twbs/bootstrap/issues/24251
-
-
- if (this._config.boundary !== 'scrollParent') {
- parent.classList.add(CLASS_NAME_POSITION_STATIC);
}
- this._popper = new Popper__default['default'](referenceElement, this._menu, this._getPopperConfig());
+ this._popper = Popper.createPopper(referenceElement, this._menu, this._getPopperConfig());
} // If this is a touch-enabled device we add extra
// empty mouseover listeners to the body's immediate children;
// only needed because of broken event delegation on iOS
@@ -2247,7 +2256,7 @@
this._inNavbar = this._detectNavbar();
if (this._popper) {
- this._popper.scheduleUpdate();
+ this._popper.update();
}
} // Private
;
@@ -2275,60 +2284,46 @@
_proto._getPlacement = function _getPlacement() {
var parentDropdown = this._element.parentNode;
- var placement = PLACEMENT_BOTTOM; // Handle dropup
- if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
- placement = this._menu.classList.contains(CLASS_NAME_MENUEND) ? PLACEMENT_TOPEND : PLACEMENT_TOP;
- } else if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
- placement = PLACEMENT_RIGHT;
- } else if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
- placement = PLACEMENT_LEFT;
- } else if (this._menu.classList.contains(CLASS_NAME_MENUEND)) {
- placement = PLACEMENT_BOTTOMEND;
+ if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
+ return PLACEMENT_RIGHT;
}
- return placement;
- };
+ if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
+ return PLACEMENT_LEFT;
+ } // We need to trim the value because custom properties can also include spaces
- _proto._detectNavbar = function _detectNavbar() {
- return Boolean(this._element.closest("." + CLASS_NAME_NAVBAR));
- };
-
- _proto._getOffset = function _getOffset() {
- var _this3 = this;
- var offset = {};
+ var isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
- if (typeof this._config.offset === 'function') {
- offset.fn = function (data) {
- data.offsets = _extends({}, data.offsets, _this3._config.offset(data.offsets, _this3._element) || {});
- return data;
- };
- } else {
- offset.offset = this._config.offset;
+ if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
+ return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
}
- return offset;
+ return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
+ };
+
+ _proto._detectNavbar = function _detectNavbar() {
+ return this._element.closest("." + CLASS_NAME_NAVBAR) !== null;
};
_proto._getPopperConfig = function _getPopperConfig() {
var popperConfig = {
placement: this._getPlacement(),
- modifiers: {
- offset: this._getOffset(),
- flip: {
- enabled: this._config.flip
- },
- preventOverflow: {
- boundariesElement: this._config.boundary
+ modifiers: [{
+ name: 'preventOverflow',
+ options: {
+ altBoundary: this._config.flip,
+ rootBoundary: this._config.boundary
}
- }
+ }]
}; // Disable Popper if we have a static display
if (this._config.display === 'static') {
- popperConfig.modifiers.applyStyle = {
+ popperConfig.modifiers = [{
+ name: 'applyStyles',
enabled: false
- };
+ }];
}
return _extends({}, popperConfig, this._config.popperConfig);
@@ -3169,7 +3164,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha3): util/sanitizer.js
+ * Bootstrap (v5.0.0-beta1): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -3315,9 +3310,8 @@
html: 'boolean',
selector: '(string|boolean)',
placement: '(string|function)',
- offset: '(number|string|function)',
container: '(string|element|boolean)',
- fallbackPlacement: '(string|array)',
+ fallbackPlacements: '(null|array)',
boundary: '(string|element)',
customClass: '(string|function)',
sanitize: 'boolean',
@@ -3341,10 +3335,9 @@
html: false,
selector: false,
placement: 'top',
- offset: 0,
container: false,
- fallbackPlacement: 'flip',
- boundary: 'scrollParent',
+ fallbackPlacements: null,
+ boundary: 'clippingParents',
customClass: '',
sanitize: true,
sanitizeFn: null,
@@ -3385,7 +3378,7 @@
function Tooltip(element, config) {
var _this;
- if (typeof Popper__default['default'] === 'undefined') {
+ if (typeof Popper__namespace === 'undefined') {
throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
}
@@ -3521,7 +3514,7 @@
}
EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
- this._popper = new Popper__default['default'](this._element, tip, this._getPopperConfig(attachment));
+ this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
tip.classList.add(CLASS_NAME_SHOW$3);
var customClass = typeof this.config.customClass === 'function' ? this.config.customClass() : this.config.customClass;
@@ -3544,10 +3537,6 @@
}
var complete = function complete() {
- if (_this2.config.animation) {
- _this2._fixTransition();
- }
-
var prevHoverState = _this2._hoverState;
_this2._hoverState = null;
EventHandler.trigger(_this2._element, _this2.constructor.Event.SHOWN);
@@ -3587,7 +3576,11 @@
EventHandler.trigger(_this3._element, _this3.constructor.Event.HIDDEN);
- _this3._popper.destroy();
+ if (_this3._popper) {
+ _this3._popper.destroy();
+
+ _this3._popper = null;
+ }
};
var hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
@@ -3624,7 +3617,7 @@
_proto.update = function update() {
if (this._popper !== null) {
- this._popper.scheduleUpdate();
+ this._popper.update();
}
} // Protected
;
@@ -3710,27 +3703,41 @@
_proto._getPopperConfig = function _getPopperConfig(attachment) {
var _this4 = this;
+ var flipModifier = {
+ name: 'flip',
+ options: {
+ altBoundary: true
+ }
+ };
+
+ if (this.config.fallbackPlacements) {
+ flipModifier.options.fallbackPlacements = this.config.fallbackPlacements;
+ }
+
var defaultBsConfig = {
placement: attachment,
- modifiers: {
- offset: this._getOffset(),
- flip: {
- behavior: this.config.fallbackPlacement
- },
- arrow: {
+ modifiers: [flipModifier, {
+ name: 'preventOverflow',
+ options: {
+ rootBoundary: this.config.boundary
+ }
+ }, {
+ name: 'arrow',
+ options: {
element: "." + this.constructor.NAME + "-arrow"
- },
- preventOverflow: {
- boundariesElement: this.config.boundary
}
- },
- onCreate: function onCreate(data) {
- if (data.originalPlacement !== data.placement) {
+ }, {
+ name: 'onChange',
+ enabled: true,
+ phase: 'afterWrite',
+ fn: function fn(data) {
+ return _this4._handlePopperPlacementChange(data);
+ }
+ }],
+ onFirstUpdate: function onFirstUpdate(data) {
+ if (data.options.placement !== data.placement) {
_this4._handlePopperPlacementChange(data);
}
- },
- onUpdate: function onUpdate(data) {
- return _this4._handlePopperPlacementChange(data);
}
};
return _extends({}, defaultBsConfig, this.config.popperConfig);
@@ -3740,23 +3747,6 @@
this.getTipElement().classList.add(CLASS_PREFIX + "-" + this.updateAttachment(attachment));
};
- _proto._getOffset = function _getOffset() {
- var _this5 = this;
-
- var offset = {};
-
- if (typeof this.config.offset === 'function') {
- offset.fn = function (data) {
- data.offsets = _extends({}, data.offsets, _this5.config.offset(data.offsets, _this5._element) || {});
- return data;
- };
- } else {
- offset.offset = this.config.offset;
- }
-
- return offset;
- };
-
_proto._getContainer = function _getContainer() {
if (this.config.container === false) {
return document.body;
@@ -3774,29 +3764,29 @@
};
_proto._setListeners = function _setListeners() {
- var _this6 = this;
+ var _this5 = this;
var triggers = this.config.trigger.split(' ');
triggers.forEach(function (trigger) {
if (trigger === 'click') {
- EventHandler.on(_this6._element, _this6.constructor.Event.CLICK, _this6.config.selector, function (event) {
- return _this6.toggle(event);
+ EventHandler.on(_this5._element, _this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
+ return _this5.toggle(event);
});
} else if (trigger !== TRIGGER_MANUAL) {
- var eventIn = trigger === TRIGGER_HOVER ? _this6.constructor.Event.MOUSEENTER : _this6.constructor.Event.FOCUSIN;
- var eventOut = trigger === TRIGGER_HOVER ? _this6.constructor.Event.MOUSELEAVE : _this6.constructor.Event.FOCUSOUT;
- EventHandler.on(_this6._element, eventIn, _this6.config.selector, function (event) {
- return _this6._enter(event);
+ var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
+ var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
+ EventHandler.on(_this5._element, eventIn, _this5.config.selector, function (event) {
+ return _this5._enter(event);
});
- EventHandler.on(_this6._element, eventOut, _this6.config.selector, function (event) {
- return _this6._leave(event);
+ EventHandler.on(_this5._element, eventOut, _this5.config.selector, function (event) {
+ return _this5._leave(event);
});
}
});
this._hideModalHandler = function () {
- if (_this6._element) {
- _this6.hide();
+ if (_this5._element) {
+ _this5.hide();
}
};
@@ -3969,26 +3959,17 @@
};
_proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
- this.tip = popperData.instance.popper;
-
- this._cleanTipClass();
-
- this._addAttachmentClass(this._getAttachment(popperData.placement));
- };
-
- _proto._fixTransition = function _fixTransition() {
- var tip = this.getTipElement();
- var initConfigAnimation = this.config.animation;
+ var state = popperData.state;
- if (tip.getAttribute('x-placement') !== null) {
+ if (!state) {
return;
}
- tip.classList.remove(CLASS_NAME_FADE$1);
- this.config.animation = false;
- this.hide();
- this.show();
- this.config.animation = initConfigAnimation;
+ this.tip = state.elements.popper;
+
+ this._cleanTipClass();
+
+ this._addAttachmentClass(this._getAttachment(state.placement));
} // Static
;
@@ -5003,7 +4984,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0-alpha3): index.umd.js
+ * Bootstrap (v5.0.0-beta1): index.umd.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/