import { StepperSelectionEvent } from '@angular/cdk/stepper'; import { ChangeDetectorRef } from '@angular/core'; import { AbstractControl, FormGroup, NgForm } from '@angular/forms'; import { MatStepper } from '@angular/material/stepper'; import { ActivatedRoute } from '@angular/router'; import { Observable } from 'rxjs'; import { IEntity } from '../../common/models/entity'; import { SaveAction } from '../../common/models/save-action'; import { FormFieldGroup } from '../../forms/models/form-field-group'; import { GenericService } from '../../http/services/generic.service'; import { TableMenuItem } from '../../table/models/table-menu-item'; import { BaseComponent } from './base.component'; import * as i0 from "@angular/core"; export declare abstract class GenericFormBaseComponent> extends BaseComponent { entityCtor: { new (): TEntity; }; protected service: TService; protected route: ActivatedRoute; protected changeDetectorRef: ChangeDetectorRef; /** * The action of the form (add | edit) */ action: string; /** * A url to return to after save */ returnUrl: string; /** * Action = edit? */ isEditMode: boolean; /** * Save action */ SaveAction: typeof SaveAction; /** * Routes */ editSaveAndCloseRoute: string; addSaveAndCloseRoute: string; addSaveAndEditRoute: string; addSaveAndNewRoute: string; listRoute: string; /** * The id of the item to load */ id: number | string; /** * The current item to add or edit */ item: TEntity; /** * Represents the request errors */ errors: Array; /** * Includes */ includes: string[]; /** * Update includes */ updateIncludes: string[]; /** * Get params */ query: any; /** * The current date */ currentDate: Date; /** * Date & time mask */ dateTimeMask: (string | number | RegExp)[]; /** * Date mask */ dateMask: (string | number | RegExp)[]; /** * Time mask */ timeMask: (string | RegExp)[]; /** * A pattern to validate dates */ datePattern: string; /** * Phone prefix validation pattern */ phonePrefixPattern: string; /** * Phone number validation pattern */ phoneNumberPattern: string; /** * Password validation pattern */ passwordPattern: string; /** * Defaults modules and toolbar */ editorOptions: { modules: { toolbar: (string[] | { list: string; }[] | { indent: string; }[] | { size: (string | boolean)[]; }[] | { header: (number | boolean)[]; }[] | ({ color: any[]; background?: undefined; } | { background: any[]; color?: undefined; })[])[]; clipboard: { matchVisual: boolean; }; }; }; /** * If true, show the menu 'Delete' */ deletable: boolean; /** * Toolbar menu items */ toolbarMenuItems: TableMenuItem[]; /** * MatStepper ref */ protected matStepper: MatStepper; /** * A reference to the input element */ input: any; /** * Form group */ form: NgForm | FormGroup; /** * Gets form value */ abstract get formValue(): TEntity | any; /** * fieldGroups: FormFieldGroup[] */ fieldGroups: FormFieldGroup[]; /** * panelId: string */ protected panelId: string; /** * Constructor * @param service */ constructor(entityCtor: { new (): TEntity; }, service: TService, route: ActivatedRoute, changeDetectorRef: ChangeDetectorRef); /** * Called after the constructor, initializing input properties, * and the first call to ngOnChanges. */ ngOnInit(): void; /** * Lifecycle hook that is called after a component's view has been fully initialized. */ ngAfterViewInit(): void; /** * Loads an item by ID */ loadItem(): void; /** * Loads an item by ID asyncly */ loadItemAsync(): Observable; /** * Saves data into database. * @param action */ save(action?: SaveAction, form?: NgForm | FormGroup): void; /** * Saves data and navigates to edit view */ apply(): void; /** * Deletes the current record. */ delete(): void; /** * Builds a new form */ protected buildForm(): void; /** * Validates the form * @param form */ validateForm(form?: NgForm | FormGroup): void; /** * Validates the form * @param form */ isFormValid(form?: NgForm | FormGroup): boolean; /** * Resets form controls * @param form * @returns */ resetForm(form: NgForm): void; /** * Invalidate controls recursively * @param control */ protected invalidateControl(control: AbstractControl): void; /** * Shows form errors * @param form */ protected debugForm(form?: NgForm | FormGroup): void; /** * Add toolbar menu items */ protected addToolbarMenuItems(): void; /** * Loads the previous URL in the history list. * @param action */ back(action?: SaveAction): void; /** * Creates a new instance of the TEntity */ protected newInstance(): TEntity; /** * Creates the entity * @param httpOptions * @returns */ protected create(httpOptions?: Object): Observable; /** * Updates the entity * @param httpOptions * @returns */ protected update(httpOptions?: Object): Observable; /** * Includes some navigations * @param inc * @param update */ protected include(inc: string, update?: boolean): void; /** * Check if the item is deletable */ protected canDelete(): boolean; /** * Event emitted when the selected step has changed. * @param $event */ protected onAfterStepChange($event: StepperSelectionEvent): void; /** * Event emitted when the entity has been loaded. */ protected onAfterItemLoaded(): void; /** * Event emitted before the form has built. */ protected onBeforeFormBuild(): void; /** * Event emitted when the form has built. */ protected onAfterFormBuild(): void; /** * Event emitted when the entity has been created. */ protected onBeforeCreate(): void; /** * Event emitted when the entity has been updated. */ protected onBeforeUpdate(): void; /** * Called before data submition */ protected beforeSubmit(_?: SaveAction): void; /** * Event emitted after data submition * @param action * @param response */ protected onAfterSubmit(action?: SaveAction, response?: any): void; /** * Called after page reloaded */ protected afterReload(): void; /** * Sets focus to first input */ protected focus(): void; /** * Gets element error * @param nativeElement */ protected getElementError(nativeElement: any): string; /** * Responds to user-initiated events * @param event */ handleKeyboardEvent(event: KeyboardEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, never, never, { "item": "item"; }, {}, never>; }