-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui5-menu-item): add endContent slot
New slot `endContent` is introduced in `ui5-menu-item` component. This slot accepts components that are displayed at the end of the Menu Item if it does not have sub-menu. If there are components slotted and also `additionalText` is being set, the `additionalText` will not be shown as well. It is strongly recommended to slot only icon-only `ui5-button`, `ui5-icon` or `ui5-link` components in order to preserve the intended design. BGSOFUIBALKAN-8160 #6350
- Loading branch information
1 parent
f9c04d3
commit dc3cfde
Showing
12 changed files
with
205 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/website/docs/_samples/main/Menu/MenuEndContent/MenuEndContent.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import html from '!!raw-loader!./sample.html'; | ||
import js from '!!raw-loader!./main.js'; | ||
|
||
<Editor html={html} js={js} /> |
36 changes: 36 additions & 0 deletions
36
packages/website/docs/_samples/main/Menu/MenuEndContent/main.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import "@ui5/webcomponents/dist/Menu.js"; | ||
import "@ui5/webcomponents/dist/MenuItem.js"; | ||
import "@ui5/webcomponents/dist/Button.js"; | ||
|
||
import "@ui5/webcomponents-icons/dist/add-document.js"; | ||
import "@ui5/webcomponents-icons/dist/add-folder.js"; | ||
import "@ui5/webcomponents-icons/dist/open-folder.js"; | ||
import "@ui5/webcomponents-icons/dist/action-settings.js"; | ||
import "@ui5/webcomponents-icons/dist/journey-arrive.js"; | ||
import "@ui5/webcomponents-icons/dist/slim-arrow-down.js"; | ||
import "@ui5/webcomponents-icons/dist/add.js"; | ||
import "@ui5/webcomponents-icons/dist/hint.js"; | ||
import "@ui5/webcomponents-icons/dist/favorite.js"; | ||
|
||
const btnOpenEndContent = document.getElementById("btnOpenEndContent"); | ||
const menuEndContent = document.getElementById("menuEndContent"); | ||
const btnNewAdd = document.getElementById("newAdd"); | ||
const btnNewHint = document.getElementById("newHint"); | ||
const btnNewFavorite = document.getElementById("newFavorite"); | ||
|
||
btnOpenEndContent.addEventListener("click", function(event) { | ||
menuEndContent.opener = btnOpenEndContent; | ||
menuEndContent.open = !menuEndContent.open; | ||
}); | ||
|
||
btnNewAdd.addEventListener("click", function(event) { | ||
alert("Add button pressed"); | ||
}); | ||
|
||
btnNewHint.addEventListener("click", function(event) { | ||
alert("Hint button pressed"); | ||
}); | ||
|
||
btnNewFavorite.addEventListener("click", function(event) { | ||
alert("Favorite button pressed"); | ||
}); |
41 changes: 41 additions & 0 deletions
41
packages/website/docs/_samples/main/Menu/MenuEndContent/sample.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!-- playground-fold --> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Sample</title> | ||
</head> | ||
|
||
<body style="background-color: var(--sapBackgroundColor); height: 350px"> | ||
<!-- playground-fold-end --> | ||
|
||
<ui5-button id="btnOpenEndContent">Open Menu</ui5-button> | ||
|
||
<ui5-menu id="menuEndContent" header-text="My ui5-menu"> | ||
<ui5-menu-item text="New File" accessible-name="Opens a file explorer" additional-text="Ctrl+Alt+Shift+N" tooltip="Select a file - prevent default" icon="add-document"> | ||
<ui5-button id="newAdd" slot="endContent" icon="add" design="Transparent"></ui5-button> | ||
<ui5-button id="newHint" slot="endContent" icon="hint" design="Transparent"></ui5-button> | ||
<ui5-button id="newFavorite" slot="endContent" icon="favorite" design="Transparent"></ui5-button> | ||
</ui5-menu-item> | ||
<ui5-menu-item text="New Folder" additional-text="Ctrl+F" icon="add-folder"></ui5-menu-item> | ||
<ui5-menu-item text="Open" icon="open-folder" accessible-name="Choose platform" starts-section> | ||
<ui5-menu-item text="Open Locally" icon="open-folder" additional-text="Ctrl+K"></ui5-menu-item> | ||
<ui5-menu-item text="Open from SAP Cloud" additional-text="Ctrl+L"></ui5-menu-item> | ||
</ui5-menu-item> | ||
<ui5-menu-item text="Save with very long title for a menu item text inside" icon="save"> | ||
<ui5-menu-item text="Save Locally" icon="save"></ui5-menu-item> | ||
<ui5-menu-item text="Save on Cloud" icon="upload-to-cloud"></ui5-menu-item> | ||
</ui5-menu-item> | ||
<ui5-menu-item text="Close" additional-text="Ctrl+W"></ui5-menu-item> | ||
<ui5-menu-item text="Preferences" icon="action-settings" starts-section></ui5-menu-item> | ||
<ui5-menu-item text="Exit" icon="journey-arrive"></ui5-menu-item> | ||
</ui5-menu> | ||
|
||
<!-- playground-fold --> | ||
<script type="module" src="main.js"></script> | ||
</body> | ||
|
||
</html> | ||
<!-- playground-fold-end --> |