@rero/ng-core
Version:
RERO angular core library.
39 lines (38 loc) • 1.49 kB
TypeScript
import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { AbstractCanDeactivateComponent } from '../component/abstract-can-deactivate.component';
import { DialogService, DynamicDialogRef } from 'primeng/dynamicdialog';
import * as i0 from "@angular/core";
/**
* When this guard is configured, it intercepts the form output without
* saving or undoing changes.
*
* Route definition configuration
* { path: 'foo/bar', canDeactivate: [ ComponentCanDeactivateGuard ] },
*
* Custom editor component configuration
* class FooComponent AbstractCanDeactivateComponent {
* canDeactivate: boolean = false;
* ...
* }
*
* Template configuration (add output canDeactivateChange)
* <ng-core-editor
* (canDeactivateChange)="canDeactivateChanged($event)"
* ...
* ></ng-core-editor>
*/
export declare class ComponentCanDeactivateGuard {
protected translateService: TranslateService;
protected dialogService: DialogService;
ref: DynamicDialogRef | undefined;
/**
* Displays a confirmation modal if the user leaves the form without
* saving or canceling
* @param component - AbstractCanDeactivateComponent
* @returns Observable<boolean> or boolean
*/
canDeactivate(component: AbstractCanDeactivateComponent): Observable<boolean> | boolean;
static ɵfac: i0.ɵɵFactoryDeclaration<ComponentCanDeactivateGuard, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ComponentCanDeactivateGuard>;
}