This commit is contained in:
Nicolas Constant 2019-07-03 20:08:05 -04:00
parent a2e0789a9c
commit 90157c1ee7
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
2 changed files with 7 additions and 8 deletions

View File

@ -27,11 +27,10 @@
<fa-icon [icon]="faWindowCloseRegular"></fa-icon> <fa-icon [icon]="faWindowCloseRegular"></fa-icon>
</a> </a>
<a href class="action-bar__link action-bar__link--more" (click)="onContextMenu($event, item)" title="More" <a href class="action-bar__link action-bar__link--more" (click)="onContextMenu($event)" title="More">
[contextMenu]="basicMenu" [contextMenuSubject]="item"> <fa-icon [icon]="faEllipsisH"></fa-icon>
<fa-icon [icon]="faEllipsisH" [contextMenu]="basicMenu" [contextMenuSubject]="item"></fa-icon>
</a> </a>
<context-menu #basicMenu> <context-menu #contextMenu>
<ng-template contextMenuItem (execute)="expandStatus()"> <ng-template contextMenuItem (execute)="expandStatus()">
Expand status Expand status
</ng-template> </ng-template>

View File

@ -28,7 +28,7 @@ export class ActionBarComponent implements OnInit, OnDestroy {
faEllipsisH = faEllipsisH; faEllipsisH = faEllipsisH;
faLock = faLock; faLock = faLock;
@ViewChild(ContextMenuComponent) public basicMenu: ContextMenuComponent; @ViewChild(ContextMenuComponent) public contextMenu: ContextMenuComponent;
public items = [ public items = [
{ name: 'John', otherProperty: 'Foo' }, { name: 'John', otherProperty: 'Foo' },
{ name: 'Joe', otherProperty: 'Bar' } { name: 'Joe', otherProperty: 'Bar' }
@ -241,12 +241,12 @@ export class ActionBarComponent implements OnInit, OnDestroy {
return false; return false;
} }
public onContextMenu($event: MouseEvent, item: any): void { public onContextMenu($event: MouseEvent): void {
this.contextMenuService.show.next({ this.contextMenuService.show.next({
// Optional - if unspecified, all context menu components will open // Optional - if unspecified, all context menu components will open
contextMenu: this.basicMenu, contextMenu: this.contextMenu,
event: $event, event: $event,
item: item, item: null
}); });
$event.preventDefault(); $event.preventDefault();
$event.stopPropagation(); $event.stopPropagation();