import { FormArray, FormControl, ValidatorFn } from "@angular/forms"; import * as i0 from "@angular/core"; import { OnDestroy, OnInit, QueryList } from "@angular/core"; import { IAbstractFormAliasBaseAliasControls } from "@hmcts/opal-frontend-common/components/abstract/abstract-form-alias-base/interfaces"; import { AbstractFormBaseComponent } from "@hmcts/opal-frontend-common/components/abstract/abstract-form-base"; import { IAbstractFormArrayControl, IAbstractFormArrayControlValidation, IAbstractFormArrayControls } from "@hmcts/opal-frontend-common/components/abstract/interfaces"; import { GovukTextInputComponent } from "@hmcts/opal-frontend-common/components/govuk/govuk-text-input"; export declare abstract class AbstractFormAliasBaseComponent extends AbstractFormBaseComponent implements OnInit, OnDestroy { aliasFirstField: QueryList; aliasControls: IAbstractFormAliasBaseAliasControls[]; aliasControlsValidation: IAbstractFormArrayControlValidation[]; aliasFields: string[]; /** * Builds an array of form controls for the given form array. * * @param formControlCount - An array of numbers representing the number of form controls to create. * @param formArrayName - The name of the form array. * @param fieldNames - An array of field names. * @param controlValidation - An array of control validation objects. * @returns An array of form controls for the given form array. */ private buildFormAliasControls; /** * Adds alias controls to the form array. * * @param index - The index of the form array. * @param formArrayName - The name of the form array. * @param fieldNames - The names of the fields for the alias controls. * @param controlValidation - The validation rules for the alias controls. * @returns An object containing the form controls. */ private addAliasControls; /** * Removes all form alias controls from a FormArray and clears any associated error messages. * * @param formArrayControls - An array of form array controls. * @param formArrayName - The name of the FormArray. * @param fieldNames - An array of field names associated with the form array controls. * @returns An empty array of form array controls. */ private removeAllFormAliasControls; /** * Creates a FormArray with the specified validators and controls. * * @param validators - An array of validators to apply to the FormArray. * @param controls - An optional array of initial FormControl instances to add to the FormArray. * @returns A new FormArray instance. */ protected createFormAlias(validators: ValidatorFn[], controls?: FormControl[]): FormArray; /** * Removes a form alias control at the specified index from the given form array controls. * * @param index - The index of the form alias control to remove. * @param formArrayControls - The array of form array controls. * @returns The updated array of form array controls after removing the specified control. */ protected removeFormAliasControl(index: number, formArrayControls: IAbstractFormArrayControls[]): IAbstractFormArrayControls[]; /** * Sets up the alias form controls based on the provided alias count array and form array name. * If there are any aliases, the alias controls will be re-populated. * * @param aliasCountArray - An array containing the count of aliases. * @param formArrayName - The name of the form array. */ protected setupAliasFormControls(aliasCountArray: number[], formArrayName: string): void; /** * Removes the form alias controls errors for a specific index in a form array. * * @param index - The index of the form array control. * @param formArrayControls - An array of form array controls. * @param fieldNames - An array of field names to remove errors from. */ protected removeFormAliasControlsErrors(index: number, formArrayControls: IAbstractFormArrayControls[], fieldNames: string[]): void; /** * Creates alias controls for the given fields and index. * @param fields - The list of fields for which alias controls need to be created. * @param index - The index value used to generate unique identifiers for the controls. * @returns An object containing the alias controls. */ protected createAliasControls(fields: string[], index: number): { [key: string]: IAbstractFormArrayControl; }; /** * Sets up the alias checkbox listener. * * @param formCheckboxName - The name of the checkbox control in the form. * @param formArrayName - The name of the form array control in the form. */ protected setUpAliasCheckboxListener(formCheckboxName: string, formArrayName: string): void; /** * Sets focus to the first input field of a newly added alias row. */ focusFirstAliasField(): void; /** * Removes a form alias control from a form array and updates the list of form array controls. * @param index - The index of the form alias control to be removed. * @param formArrayName - The name of the form array. * @param formArrayControls - The list of form array controls. * @param fieldNames - The names of the fields associated with the form array controls. * @returns The updated list of form array controls after removing the specified control. */ removeFormAliasControls(index: number, formArrayName: string, formArrayControls: IAbstractFormArrayControls[], fieldNames: string[]): IAbstractFormArrayControls[]; /** * Adds an alias to the specified index of the form array. * Sets user focus to the first field of the newly added alias. * * @param index - The index at which to add the alias. * @param formArrayName - The name of the form array. */ addAlias(index: number, formArrayName: string): void; /** * Removes an alias from the form array. * * @param index - The index of the alias to remove. * @param formArrayName - The name of the form array. * @param event - The event object from the click event, used to prevent default behavior. */ removeAlias(index: number, formArrayName: string, event?: Event): void; ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; }