@alfresco/adf-core
Version:
26 lines (25 loc) • 1.22 kB
TypeScript
import { CanDeactivate } from '@angular/router';
import { Observable } from 'rxjs';
import { MatDialog } from '@angular/material/dialog';
import { UnsavedChangesDialogData } from './unsaved-changes-dialog.model';
import { AuthenticationService, AuthGuardService } from '../../auth';
import * as i0 from "@angular/core";
/**
* Guard responsible for protecting leaving page with unsaved changes.
*/
export declare class UnsavedChangesGuard implements CanDeactivate<any> {
private dialog;
private authenticationService;
private authGuardBaseService;
unsaved: boolean;
data: UnsavedChangesDialogData;
constructor(dialog: MatDialog, authenticationService: AuthenticationService, authGuardBaseService: AuthGuardService);
/**
* Allows to deactivate route when there is no unsaved changes, otherwise displays dialog to confirm discarding changes.
*
* @returns boolean | Observable<boolean> true when there is no unsaved changes or changes can be discarded, false otherwise.
*/
canDeactivate(): boolean | Observable<boolean>;
static ɵfac: i0.ɵɵFactoryDeclaration<UnsavedChangesGuard, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<UnsavedChangesGuard>;
}