diff options
author | Mark Otto <markdotto@gmail.com> | 2017-05-27 06:20:10 +0300 |
---|---|---|
committer | Mark Otto <markdotto@gmail.com> | 2017-05-27 06:20:10 +0300 |
commit | 4282d892f37e6b44f31c5f6bc0fa693f147c6e59 (patch) | |
tree | c9e2641b2ff2acc7d8e7ea0845284da8ad9db9ec /dist/js/bootstrap.js | |
parent | c8c51186f58886b114fbcc4e0b01dd2df3d74d36 (diff) |
build
Diffstat (limited to 'dist/js/bootstrap.js')
-rw-r--r-- | dist/js/bootstrap.js | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/dist/js/bootstrap.js b/dist/js/bootstrap.js index f050083066..3b5aff522d 100644 --- a/dist/js/bootstrap.js +++ b/dist/js/bootstrap.js @@ -1428,7 +1428,10 @@ var Dropdown = function ($) { var ClassName = { DISABLED: 'disabled', - SHOW: 'show' + SHOW: 'show', + DROPUP: 'dropup', + MENURIGHT: 'dropdown-menu-right', + MENULEFT: 'dropdown-menu-left' }; var Selector = { @@ -1441,7 +1444,9 @@ var Dropdown = function ($) { var AttachmentMap = { TOP: 'top-start', - BOTTOM: 'bottom-start' + TOPEND: 'top-end', + BOTTOM: 'bottom-start', + BOTTOMEND: 'bottom-end' }; var Default = { @@ -1503,10 +1508,15 @@ var Dropdown = function ($) { return; } - // Handle dropup - var dropdownPlacement = $(this._element).parent().hasClass('dropup') ? AttachmentMap.TOP : this._config.placement; - this._popper = new Popper(this._element, this._menu, { - placement: dropdownPlacement, + var element = this._element; + // for dropup with alignment we use the parent as popper container + if ($(parent).hasClass(ClassName.DROPUP)) { + if ($(this._menu).hasClass(ClassName.MENULEFT) || $(this._menu).hasClass(ClassName.MENURIGHT)) { + element = parent; + } + } + this._popper = new Popper(element, this._menu, { + placement: this._getPlacement(), modifiers: { offset: { offset: this._config.offset @@ -1582,6 +1592,24 @@ var Dropdown = function ($) { return this._menu; }; + Dropdown.prototype._getPlacement = function _getPlacement() { + var $parentDropdown = $(this._element).parent(); + var placement = this._config.placement; + + // Handle dropup + if ($parentDropdown.hasClass(ClassName.DROPUP) || this._config.placement === AttachmentMap.TOP) { + placement = AttachmentMap.TOP; + if ($(this._menu).hasClass(ClassName.MENURIGHT)) { + placement = AttachmentMap.TOPEND; + } + } else { + if ($(this._menu).hasClass(ClassName.MENURIGHT)) { + placement = AttachmentMap.BOTTOMEND; + } + } + return placement; + }; + // static Dropdown._jQueryInterface = function _jQueryInterface(config) { @@ -2944,6 +2972,7 @@ var Tooltip = function ($) { }; var AttachmentMap = { + AUTO: 'auto', TOP: 'top', RIGHT: 'right', BOTTOM: 'bottom', @@ -2952,7 +2981,7 @@ var Tooltip = function ($) { var Default = { animation: true, - template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', + template: '<div class="tooltip" role="tooltip">' + '<div class="arrow" x-arrow></div>' + '<div class="tooltip-inner"></div></div>', trigger: 'hover focus', title: '', delay: 0, @@ -3592,7 +3621,7 @@ var Popover = function ($) { placement: 'right', trigger: 'click', content: '', - template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-title"></h3>' + '<div class="popover-content"></div></div>' + template: '<div class="popover" role="tooltip">' + '<div class="arrow" x-arrow></div>' + '<h3 class="popover-title"></h3>' + '<div class="popover-content"></div></div>' }); var DefaultType = $.extend({}, Tooltip.DefaultType, { |