mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-17 01:31:25 +01:00
modal messages
This commit is contained in:
parent
e5d6861662
commit
c63ff4485e
@ -9,6 +9,8 @@ import {
|
|||||||
ViewContainerRef,
|
ViewContainerRef,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import { MessagingService } from '../../abstractions/messaging.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-modal',
|
selector: 'app-modal',
|
||||||
template: `<ng-template #container></ng-template>`,
|
template: `<ng-template #container></ng-template>`,
|
||||||
@ -22,7 +24,8 @@ export class ModalComponent implements OnDestroy {
|
|||||||
parentContainer: ViewContainerRef = null;
|
parentContainer: ViewContainerRef = null;
|
||||||
fade: boolean = true;
|
fade: boolean = true;
|
||||||
|
|
||||||
constructor(protected componentFactoryResolver: ComponentFactoryResolver) { }
|
constructor(protected componentFactoryResolver: ComponentFactoryResolver,
|
||||||
|
protected messagingService: MessagingService) { }
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
document.body.classList.remove('modal-open');
|
document.body.classList.remove('modal-open');
|
||||||
@ -31,6 +34,7 @@ export class ModalComponent implements OnDestroy {
|
|||||||
|
|
||||||
show<T>(type: Type<T>, parentContainer: ViewContainerRef, fade: boolean = true): T {
|
show<T>(type: Type<T>, parentContainer: ViewContainerRef, fade: boolean = true): T {
|
||||||
this.onShow.emit();
|
this.onShow.emit();
|
||||||
|
this.messagingService.send('modalShow');
|
||||||
this.parentContainer = parentContainer;
|
this.parentContainer = parentContainer;
|
||||||
this.fade = fade;
|
this.fade = fade;
|
||||||
|
|
||||||
@ -54,12 +58,15 @@ export class ModalComponent implements OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.onShown.emit();
|
this.onShown.emit();
|
||||||
|
this.messagingService.send('modalShown');
|
||||||
return componentRef.instance;
|
return componentRef.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
this.onClose.emit();
|
this.onClose.emit();
|
||||||
|
this.messagingService.send('modalClose');
|
||||||
this.onClosed.emit();
|
this.onClosed.emit();
|
||||||
|
this.messagingService.send('modalClosed');
|
||||||
if (this.parentContainer != null) {
|
if (this.parentContainer != null) {
|
||||||
this.parentContainer.clear();
|
this.parentContainer.clear();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user