Skip to content

Commit 161af0f

Browse files
authored
feat(ui5-menu): menu item groups with checkable menu items (#10028)
This PR introduces **MenuItemGroup** component that can hold regular **MenuItem** components. The **MenuItemGroup** has a property named `itemCheckMode` which can have values among `None` (default), `Single` and `Multiple`. **MenuItemGroup** can be slotted in a **Menu** or **MenuItem** default slot as any other regular **MenuItem**. Nesting of **MenuItemGroup** components is not allowed, but any **Menu** or **MenuItem** can contain more than one **MenuItemGroup** components with different `itemCheckMode` settings. When `itemCheckMode` is: * `None`, the **Menu** acts exactly like until now. * `Single` means that zero or one **MenuItems** can be checked at a time. * `Multiple` means that zero or many **MenuItems** can be checked at a time. There is also new property `checked` introduced in **MenuItem**. By setting it the item is marked as **checked** and this is visualized as checkmark at the end of the item. This property is taken into account only when the corresponding item is a member of MenuItemGroup with `Single` or `Multiple` value of `itemCheckMode`. ![image](https://github.com/user-attachments/assets/13c409bc-bd97-4815-8c1b-b9ffc81eb8b2) It is recommended to place separators before and after each **MenuItemGroup**, but this is not mandatory and depends on the application developers.
1 parent 1fdce6a commit 161af0f

File tree

17 files changed

+979
-45
lines changed

17 files changed

+979
-45
lines changed

packages/fiori/src/UserMenuItem.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { customElement, slot } from "@ui5/webcomponents-base/dist/decorators.js";
2-
import MenuItem from "@ui5/webcomponents/dist/MenuItem.js";
2+
import MenuItem, { isInstanceOfMenuItem } from "@ui5/webcomponents/dist/MenuItem.js";
33

44
import UserMenuItemTemplate from "./UserMenuItemTemplate.js";
55

@@ -45,7 +45,7 @@ class UserMenuItem extends MenuItem {
4545
declare items: Array<UserMenuItem>;
4646

4747
get _menuItems() {
48-
return this.items.filter(item => !item.isSeparator);
48+
return this.items.filter(isInstanceOfMenuItem);
4949
}
5050
}
5151

0 commit comments

Comments
 (0)