mirror of
https://github.com/twbs/bootstrap.git
synced 2025-08-10 07:37:27 +02:00
dist
This commit is contained in:
25
js/dist/dropdown.js
vendored
25
js/dist/dropdown.js
vendored
@@ -1,3 +1,5 @@
|
||||
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
@@ -50,7 +52,8 @@ var Dropdown = function ($) {
|
||||
DROPRIGHT: 'dropright',
|
||||
DROPLEFT: 'dropleft',
|
||||
MENURIGHT: 'dropdown-menu-right',
|
||||
MENULEFT: 'dropdown-menu-left'
|
||||
MENULEFT: 'dropdown-menu-left',
|
||||
POSITION_STATIC: 'position-static'
|
||||
};
|
||||
var Selector = {
|
||||
DATA_TOGGLE: '[data-toggle="dropdown"]',
|
||||
@@ -71,11 +74,13 @@ var Dropdown = function ($) {
|
||||
};
|
||||
var Default = {
|
||||
offset: 0,
|
||||
flip: true
|
||||
flip: true,
|
||||
boundary: 'scrollParent'
|
||||
};
|
||||
var DefaultType = {
|
||||
offset: '(number|string|function)',
|
||||
flip: 'boolean'
|
||||
flip: 'boolean',
|
||||
boundary: '(string|element)'
|
||||
/**
|
||||
* ------------------------------------------------------------------------
|
||||
* Class Definition
|
||||
@@ -142,6 +147,13 @@ var Dropdown = function ($) {
|
||||
if ($(this._menu).hasClass(ClassName.MENULEFT) || $(this._menu).hasClass(ClassName.MENURIGHT)) {
|
||||
element = parent;
|
||||
}
|
||||
} // 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).addClass(ClassName.POSITION_STATIC);
|
||||
}
|
||||
|
||||
this._popper = new Popper(element, this._menu, this._getPopperConfig());
|
||||
@@ -197,7 +209,7 @@ var Dropdown = function ($) {
|
||||
};
|
||||
|
||||
_proto._getConfig = function _getConfig(config) {
|
||||
config = $.extend({}, this.constructor.Default, $(this._element).data(), config);
|
||||
config = _extends({}, this.constructor.Default, $(this._element).data(), config);
|
||||
Util.typeCheckConfig(NAME, config, this.constructor.DefaultType);
|
||||
return config;
|
||||
};
|
||||
@@ -244,7 +256,7 @@ var Dropdown = function ($) {
|
||||
|
||||
if (typeof this._config.offset === 'function') {
|
||||
offsetConf.fn = function (data) {
|
||||
data.offsets = $.extend({}, data.offsets, _this2._config.offset(data.offsets) || {});
|
||||
data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets) || {});
|
||||
return data;
|
||||
};
|
||||
} else {
|
||||
@@ -257,6 +269,9 @@ var Dropdown = function ($) {
|
||||
offset: offsetConf,
|
||||
flip: {
|
||||
enabled: this._config.flip
|
||||
},
|
||||
preventOverflow: {
|
||||
boundariesElement: this._config.boundary
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user