RED-8882 - removed base dialog

This commit is contained in:
Valentin Mihai 2024-05-20 19:06:58 +03:00
parent 174d77d2ea
commit 4811d301e6

View File

@ -1,6 +1,6 @@
import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core';
import { ChangeDetectionStrategy, Component, HostListener, OnDestroy, OnInit } from '@angular/core';
import { MatDialogRef } from '@angular/material/dialog';
import { BaseDialogComponent } from '../../dialog';
import { Subscription } from 'rxjs';
const HIGHER_CDK_OVERLAY_CONTAINER_ZINDEX = '1200';
const DEFAULT_CDK_OVERLAY_CONTAINER_ZINDEX = '800';
@ -10,11 +10,18 @@ const DEFAULT_CDK_OVERLAY_CONTAINER_ZINDEX = '800';
styleUrls: ['./help-mode-dialog.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HelpModeDialogComponent extends BaseDialogComponent implements OnInit, OnDestroy {
export class HelpModeDialogComponent implements OnInit, OnDestroy {
#backdropClickSubscription: Subscription;
protected doNotShowAgainOption = false;
constructor(protected readonly _dialogRef: MatDialogRef<HelpModeDialogComponent>) {
super(_dialogRef);
this.#backdropClickSubscription = this._dialogRef.backdropClick().subscribe(() => this.close());
}
@HostListener('window:keydown.Enter', ['$event'])
@HostListener('window:keydown.Escape', ['$event'])
close() {
return this._dialogRef.close(this.doNotShowAgainOption);
}
ngOnInit(): void {
@ -23,20 +30,13 @@ export class HelpModeDialogComponent extends BaseDialogComponent implements OnIn
ngOnDestroy(): void {
this._setCdkOverlayContainerZIndex(DEFAULT_CDK_OVERLAY_CONTAINER_ZINDEX);
this.#backdropClickSubscription.unsubscribe();
}
setDoNotShowAgainOption(checked: boolean): void {
this.doNotShowAgainOption = checked;
}
save() {
this.close();
}
close() {
return this._dialogRef.close(this.doNotShowAgainOption);
}
private _setCdkOverlayContainerZIndex(zIndex: string): void {
const cdkOverlayContainer = document.querySelector<HTMLElement>('.cdk-overlay-container');
if (cdkOverlayContainer) {