import { FormControl } from '@angular/forms'; import { TranslateService } from '@ngx-translate/core'; import { IconValue, HintValue, FormFieldContent, FormFieldControl, ValidatorArguments } from '../form-field.control'; /** * An enum that represents the appearance style of an `InputControl`. */ export declare enum TextInputAppearance { /** * The `standard` appearance is the default style. It shows the input box with an underline underneath it. */ standard = "standard", /** * The `fill` appearance displays the form field with a filled background box in addition to the underline. */ fill = "fill", /** * The `outline` appearance shows the form field with a border all the way around, not just an underline. */ outline = "outline" } /** * A base interface that represents the content of an `InputControl`. */ export interface InputContent extends FormFieldContent { /** * Returns the `FormControl` that tracks the value and validity state of the internal control that contains the text input. * Implementation notes: There are two cases: * - You only have the `content.formControl` field as the `InputEmailComponent` class. * - You have the `content.formControl` and `InputControl.internalComponent` fields as the `InputIssnComponent` class. * - It must be specified; otherwise, an exception is thrown. */ formControl?: FormControl; /** * Returns the control's appearance. * By default, its value is `TextInputAppearance.standard`. */ appearance?: TextInputAppearance; /** * Returns the control's prefix icon. * By default, its value is `undefined`. */ prefixIcon?: IconValue; /** * Returns the control's suffix icon. * By default, its value is `undefined`. */ suffixIcon?: IconValue; /** * Returns the control's prefix text. * By default, its value is `undefined`. */ prefixText?: string; /** * Returns the control's suffix text. * By default, its value is `undefined`. */ suffixText?: string; /** * Returns the control's start hint. * By default, its value is `undefined`. */ startHint?: HintValue; /** * Returns the control's end hint. * By default, its value is `undefined`. */ endHint?: HintValue; } /** * An interface which allows to manipulate the internal component that contains the text input. * This interface is implemented when it is created a custom `MatFormFieldControl`. */ export interface IInternalComponent { /** * Tracks the value and validity state of the internal control that contains the text input. */ readonly formControl: FormControl; /** * Returns or sets the value of the control. */ value: any | undefined; /** * Returns true if the control is empty; otherwise, false. * A control is empty if its value is `undefined` or empty string. */ readonly empty: boolean; /** * Returns true if the control is in an error state; otherwise, false. */ readonly errorState: boolean; /** * Returns an error string if the control is in an error state; otherwise, empty string. */ getErrorMessage(): string; } /** * Represents the base abstract class for a control that allows the writing/selection of a text. */ export declare abstract class InputControl extends FormFieldControl { /** * Returns a `FormControl` by default. * Its value is empty, and does not have validators. * @param validatorArguments A collection of key/value elements, where the key is the validator name * and the value is the value that the validator needs to check. */ static getFormControlByDefault(validatorArguments?: ValidatorArguments): FormControl; /** * Input field that contains the content of this class. */ content: InputContent; /** * Tracks the value and validity state of the internal component that contains the text input. * Implementation notes: There are two cases: * - You only have the `content.formControl` field as the `InputEmailComponent` class. * - You have the `content.formControl` and `internalComponent` fields as the `InputIssnComponent` class. */ protected readonly internalComponent: IInternalComponent; protected static toco_ng_Error_Msg_Requerido: string; /** * Represents the validation error of required. Its default value can be overwritten. */ protected validationError_required: string; /** * Constructs a new instance of this class. */ constructor(); /** * Sets the new language. * @param transServ The `TranslateService` instance injected. */ protected setNewLanguage(transServ: TranslateService): void; /** * Initializes the `content` input property. * @param label The default label to use. It is used if the `content.label` is not specified. * @param placeholder The default placeholder to use. It is used if the `content.placeholder` is not specified. * @param isAbbreviation If it is true then the `label` argument represents an abbreviation; otherwise, false. * @param alwaysHint If it is true then there is always at leat one hint start-aligned. */ protected init(label: string, placeholder?: string, isAbbreviation?: boolean, alwaysHint?: boolean): void; /** * Initializes the control's value. It uses the `content.value` and it is already different of `undefined`. * It also checks if the specified `content.value` is correct. For internal use only. */ protected initValue(): void; /** * Returns this instance. */ readonly getInstance: InputControl; /** * Returns true if the control is empty; otherwise, false. * A control is empty if its value is `undefined` or empty string. */ readonly empty: boolean; /** * Returns true if the control is in a hint state; otherwise, false. */ readonly hintState: boolean; /** * Returns true if the control is in an error state; otherwise, false. */ readonly errorState: boolean; /** * Handler method that is called when the control's value changes in the UI. For internal use only. * If a derived class wants to do some specific handling then it must overwrite * the `handleSpecificInput` method. */ handleInput(): void; /** * Returns the control's default value. * This function can be overwrite in the derived class. */ readonly getDefaultValue: any; /** * Returns an error string if the control is in an error state; otherwise, empty string. * This function can be overwrite in the derived class. */ getErrorMessage(): string; /** * Handler method that is called by the internal logic when the control's value changes in the UI. * This method contains the specific handling of the input that the derived class wants to do. * This function can be overwrite in the derived class. */ handleSpecificInput(): void; }