diff options
author | Johann-S <johann.servoire@gmail.com> | 2017-10-30 01:29:13 +0300 |
---|---|---|
committer | Mark Otto <markd.otto@gmail.com> | 2017-10-30 01:29:13 +0300 |
commit | e454c8ec1e5197d959baf48fb089719bf900fb2a (patch) | |
tree | c7222c85329f59ae8fba5c350cf1ba7538422b2e /js/src/dropdown.js | |
parent | b1623c44290b414b656bb4d9e3baaaa3093bda8f (diff) |
Add dropright and dropleft (right and left placements for our dropdown) (#23860)
* Add dropright (right placement for our dropdown)
* Add dropleft
* moves drop left arrow to the left
Diffstat (limited to 'js/src/dropdown.js')
-rw-r--r-- | js/src/dropdown.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/js/src/dropdown.js b/js/src/dropdown.js index 18b051b894..45d061c93a 100644 --- a/js/src/dropdown.js +++ b/js/src/dropdown.js @@ -55,6 +55,8 @@ const Dropdown = (($) => { DISABLED : 'disabled', SHOW : 'show', DROPUP : 'dropup', + DROPRIGHT : 'dropright', + DROPLEFT : 'dropleft', MENURIGHT : 'dropdown-menu-right', MENULEFT : 'dropdown-menu-left' } @@ -71,7 +73,11 @@ const Dropdown = (($) => { TOP : 'top-start', TOPEND : 'top-end', BOTTOM : 'bottom-start', - BOTTOMEND : 'bottom-end' + BOTTOMEND : 'bottom-end', + RIGHT : 'right-start', + RIGHTEND : 'right-end', + LEFT : 'left-start', + LEFTEND : 'left-end' } const Default = { @@ -227,7 +233,7 @@ const Dropdown = (($) => { _getPlacement() { const $parentDropdown = $(this._element).parent() - let placement = AttachmentMap.BOTTOM + let placement = AttachmentMap.BOTTOM // Handle dropup if ($parentDropdown.hasClass(ClassName.DROPUP)) { @@ -235,6 +241,10 @@ const Dropdown = (($) => { if ($(this._menu).hasClass(ClassName.MENURIGHT)) { placement = AttachmentMap.TOPEND } + } else if ($parentDropdown.hasClass(ClassName.DROPRIGHT)) { + placement = AttachmentMap.RIGHT + } else if ($parentDropdown.hasClass(ClassName.DROPLEFT)) { + placement = AttachmentMap.LEFT } else if ($(this._menu).hasClass(ClassName.MENURIGHT)) { placement = AttachmentMap.BOTTOMEND } |