mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
* 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
29 lines
806 B
TypeScript
29 lines
806 B
TypeScript
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 = [];
|
|
}
|
|
}
|