Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/fiori/src/ShellBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ type ShellBarMenuItemClickEventDetail = {
};

type ShellBarContentItemVisibilityChangeEventDetail = {
items: Array<HTMLElement>
items: Array<HTMLElement>,
revealedItems: Array<HTMLElement>,
};

type ShellBarSearchButtonEventDetail = {
Expand Down Expand Up @@ -302,7 +303,8 @@ type ShellBarSearchFieldClearEventDetail = {
* Fired, when an item from the content slot is hidden or shown.
* **Note:** The `content-item-visibility-change` event is in an experimental state and is a subject to change.
*
* @param {Array<HTMLElement>} array of all the items that are hidden
* @param {Array<HTMLElement>} items array of all the items that are currently hidden
* @param {Array<HTMLElement>} revealedItems array of items that just became visible (were hidden in the previous state)
* @public
* @since 2.7.0
*/
Expand Down Expand Up @@ -810,8 +812,11 @@ class ShellBar extends UI5Element {
const newHiddenContentIds = filterContentIds(newHiddenItemsIds);

if (!arraysAreEqual(oldHiddenContentIds, newHiddenContentIds)) {
const toElement = (id: string) => this.content.find(item => (item as any)._individualSlot as string === id)!;
const revealedContentIds = oldHiddenContentIds.filter(id => !newHiddenContentIds.includes(id));
this.fireDecoratorEvent("content-item-visibility-change", {
items: newHiddenContentIds.map(id => this.content.find(item => (item as any)._individualSlot as string === id)!),
items: newHiddenContentIds.map(toElement),
revealedItems: revealedContentIds.map(toElement),
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/fiori/test/pages/ShellBar_Features.html
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ <h1>ShellBar Feature Toggle</h1>
});

shellbar.addEventListener('ui5-content-item-visibility-change', (e) => {
console.log('Content visibility changed:', e.detail.items.length, 'items hidden');
console.log('Content visibility changed:', e.detail.items.length, 'items hidden,', e.detail.revealedItems.length, 'items revealed');
});

shellbar.addEventListener('ui5-search-field-toggle', (e) => {
Expand Down
Loading