mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[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:
committed by
Denys Vuika
parent
5759ea1b62
commit
091e0d3e3f
@@ -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 = [];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user