[ACA-1696] contextmenu (#587)

* enbale contextmenu by default

* attach event only when backdrop is set

* outside event for contextmenu

* apply outside event directive

* workaround fro contextmenu event row selection

* remove Output parameter

* update dockerfile

* update docker compose file
This commit is contained in:
Cilibiu Bogdan
2018-08-29 15:44:47 +03:00
committed by Denys Vuika
parent 5759ea1b62
commit 091e0d3e3f
14 changed files with 141 additions and 20 deletions

View File

@@ -0,0 +1,28 @@
import { Directive, Output, EventEmitter, OnInit, OnDestroy } from '@angular/core';
import { fromEvent, Subscription } from 'rxjs';
import { delay } from 'rxjs/operators';
@Directive({
selector: '[acaContextMenuOutsideEvent]'
})
export class OutsideEventDirective implements OnInit, OnDestroy {
private subscriptions: Subscription[] = [];
@Output() clickOutside: EventEmitter<null> = new EventEmitter();
constructor() {}
ngOnInit() {
this.subscriptions = this.subscriptions.concat([
fromEvent(document, 'click')
.pipe(delay(1))
.subscribe(() => this.clickOutside.next())
]);
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => subscription.unsubscribe());
this.subscriptions = [];
}
}