Pull request #383: RED-4819: Menu closes on any button click.

Merge in RED/ui from RED-4819 to master

* commit 'e3845e35e99c5946a70af83b4c711e5eef4250dc':
  RED-4819: Menu closes on any button click.
This commit is contained in:
Nicoleta Panaghiu 2022-08-31 17:32:14 +02:00
commit 4e94dd6fd7
2 changed files with 10 additions and 2 deletions

View File

@ -54,7 +54,7 @@
></iqser-circle-button>
<mat-menu #hiddenButtonsMenu="matMenu" class="padding-bottom-8">
<button (click)="btn.action($event)" *ngFor="let btn of hiddenButtons" [disabled]="btn.disabled" mat-menu-item>
<button (click)="onButtonClick(btn, $event)" *ngFor="let btn of hiddenButtons" [disabled]="btn.disabled" mat-menu-item>
<ng-container *ngIf="btn.type === 'circleBtn'">
<mat-icon [svgIcon]="btn.icon"></mat-icon>
{{ btn.tooltip | translate }}

View File

@ -1,10 +1,11 @@
import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges } from '@angular/core';
import { ChangeDetectionStrategy, Component, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core';
import { Action, ActionTypes, File } from '@red/domain';
import { CircleButtonType, IqserTooltipPosition, ScrollableParentView, ScrollableParentViews, Toaster } from '@iqser/common-ui';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import { FileDownloadService } from '@upload-download/services/file-download.service';
import { PermissionsService } from '@services/permissions.service';
import { firstValueFrom } from 'rxjs';
import { MatMenuTrigger } from '@angular/material/menu';
@Component({
selector: 'redaction-expandable-file-actions',
@ -25,6 +26,8 @@ export class ExpandableFileActionsComponent implements OnChanges {
expanded = false;
scrollableParentView: ScrollableParentView;
@ViewChild(MatMenuTrigger) matMenu: MatMenuTrigger;
constructor(
private readonly _fileDownloadService: FileDownloadService,
private readonly _toaster: Toaster,
@ -80,4 +83,9 @@ export class ExpandableFileActionsComponent implements OnChanges {
await firstValueFrom(this._fileDownloadService.downloadFiles(filesIds, dossierId));
this._toaster.info(_('download-status.queued'));
}
onButtonClick(button: Action, $event: MouseEvent) {
button.action($event);
this.matMenu.closeMenu();
}
}