diff options
author | Mark Otto <markdotto@gmail.com> | 2017-12-23 03:21:54 +0300 |
---|---|---|
committer | Mark Otto <markdotto@gmail.com> | 2017-12-23 03:21:54 +0300 |
commit | 935d45f461e8448b8862e16cde35a3737d6649fd (patch) | |
tree | 9a3cedbc41384726b709041a552490de08c2f085 /js/dist/dropdown.js | |
parent | 13150872c6637d0d224aa9d14fe8e103aff3139e (diff) |
dist
Diffstat (limited to 'js/dist/dropdown.js')
-rw-r--r-- | js/dist/dropdown.js | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/js/dist/dropdown.js b/js/dist/dropdown.js index 83e24f31ac..3dc5be77d7 100644 --- a/js/dist/dropdown.js +++ b/js/dist/dropdown.js @@ -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 } } }; |