Don't display divider on empty block

This commit is contained in:
Chocobozzz 2024-06-21 10:41:12 +02:00
parent 990266f149
commit 4302802840
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 8 additions and 1 deletions

View File

@ -13,7 +13,7 @@
<ng-container *ngFor="let actions of getActions()"> <ng-container *ngFor="let actions of getActions()">
<ng-container *ngFor="let action of actions"> <ng-container *ngFor="let action of actions">
<div [ngClass]="action.class" *ngIf="action.isDisplayed === undefined || action.isDisplayed(entry) === true"> <div [ngClass]="action.class" *ngIf="isBlockDisplayed(actions, action, entry)">
<ng-template #templateActionLabel let-action> <ng-template #templateActionLabel let-action>
<my-global-icon *ngIf="action.iconName" [iconName]="action.iconName" [ngClass]="'icon-' + action.iconName" aria-hidden="true"></my-global-icon> <my-global-icon *ngIf="action.iconName" [iconName]="action.iconName" [ngClass]="'icon-' + action.iconName" aria-hidden="true"></my-global-icon>

View File

@ -80,4 +80,11 @@ export class ActionDropdownComponent<T> {
return a.isHeader !== true && (a.isDisplayed === undefined || a.isDisplayed(entry)) return a.isHeader !== true && (a.isDisplayed === undefined || a.isDisplayed(entry))
}) })
} }
isBlockDisplayed (allActions: (DropdownAction<T> | DropdownAction<T>[])[], action: DropdownAction<T>, entry: T) {
// Do not display only the header
if (action.isHeader && !this.areActionsDisplayed(allActions, entry)) return false
return action.isDisplayed === undefined || action.isDisplayed(entry) === true
}
} }