From e454c8ec1e5197d959baf48fb089719bf900fb2a Mon Sep 17 00:00:00 2001 From: Johann-S Date: Sun, 29 Oct 2017 23:29:13 +0100 Subject: 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 --- js/src/dropdown.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'js/src') diff --git a/js/src/dropdown.js b/js/src/dropdown.js index 18b051b89..45d061c93 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 } -- cgit v1.2.3