import { UntypedFormGroup } from '@angular/forms'; import { Subject } from 'rxjs'; import { LocalStorageCommunicator } from '@ngvip/service'; import { VipDialogService } from '@ngvip/ui'; export declare abstract class AbstractFormComponent { protected dialogService: VipDialogService; protected localStorageCommunicator?: LocalStorageCommunicator; protected dirty: boolean; protected unsubscribe$: Subject; private keyboardEvents; dirtyInterruptOpen: boolean; private _initialFormData; get initialFormData(): { [key: string]: any; }; set initialFormData(data: { [key: string]: any; }); /** * * @param dialogService used to create dialogs in {@link transitionWithUnsavedChanges} * @param localStorageCommunicator used for dirty interrupts * @constructor */ protected constructor(dialogService: VipDialogService, localStorageCommunicator?: LocalStorageCommunicator); /** * When a change occurs iterate over the Object keys in {@link initialFormData} looking for a change * and set the dirty flag appropriately. * @param form FormGroup to track for changes. {@link initialFormData} is set from this. */ protected initializeFormTracking(form: UntypedFormGroup): void; /** * Check if form is dirty, and create dialog if unsaved changes will be lost. * @param [transitionHandler = this.transitionHandler()] - What should be done if not dirty, or the user wants to abandon changes. * @param [forceDirty = false] Force the dialog to show regardless of form state. */ transitionWithUnsavedChanges(transitionHandler?: () => void, forceDirty?: boolean): void; /** * Checks if the tracked form is dirty. * @return true if the tracked form is dirty */ isDirty(): boolean; /** * Check if the form can be saved * @return true if the from cannot be submitted */ abstract disableSave(): boolean; /** * Action to submit the form */ abstract submit(): void; /** * Default handler for {@link transitionWithUnsavedChanges} */ abstract transitionHandler(): void; /** * Check if the form can call {@link transitionWithUnsavedChanges} by hitting Esc */ abstract disableEscToClose(): boolean; /** * Check if the form can call {@link submit} by hitting ctrl+s */ abstract disableCtrlSToSave(): boolean; unsubscribe(): void; }