Fix action dropdown with query params

pull/5351/head
Chocobozzz 2022-10-12 14:37:27 +02:00
parent 02cb75c7e8
commit d50e8d1aee
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 7 additions and 1 deletions

View File

@ -26,7 +26,7 @@
<a
*ngIf="action.linkBuilder && !action.isHeader" [ngClass]="{ 'with-icon': !!action.iconName }"
class="dropdown-item" [routerLink]="action.linkBuilder(entry)" [queryParams]="action.queryParamsBuilder(entry)" [title]="action.title || ''"
class="dropdown-item" [routerLink]="action.linkBuilder(entry)" [queryParams]="getQueryParams(action, entry)" [title]="action.title || ''"
>
<ng-container *ngTemplateOutlet="templateActionLabel; context:{ $implicit: action }"></ng-container>
</a>

View File

@ -48,6 +48,12 @@ export class ActionDropdownComponent<T> {
return [ this.actions as DropdownAction<T>[] ]
}
getQueryParams (action: DropdownAction<T>, entry: T) {
if (action.queryParamsBuilder) return action.queryParamsBuilder(entry)
return {}
}
areActionsDisplayed (actions: Array<DropdownAction<T> | DropdownAction<T>[]>, entry: T): boolean {
return actions.some(a => {
if (Array.isArray(a)) return this.areActionsDisplayed(a, entry)