import { NgModel, NgControl } from "@angular/forms"; import { Observable } from "rxjs"; import { ValueAccessorBase } from "./ValueAccessorBase"; import { AsyncValidatorArray, ValidatorArray, ValidationResult } from "./validate"; import { NgTranslations } from "../../services/infra/NgTranslations"; /** * Provides observable values to its parent about its validity state. * Provides a validate method which can also be used in the control and which works off of validators * injected through hierarchical dependency injection (eg. a required or minlength directive). */ export declare abstract class ElementBase extends ValueAccessorBase { protected validators: ValidatorArray; protected asyncValidators: AsyncValidatorArray; protected ngControl: NgControl; protected translations: NgTranslations; /** Unique id of the element. */ id: string; /** If true, label is persistent and sits next the input (side-by-side on one line). */ oneLineAttribute: string; /** Label for the control */ label: string; /** * Name of the component. * NOTE: Will also be set as id, unless id is separately defined, so keep this unique within a view or set id. */ name: string; /** Placeholder text */ placeholder: string; /** The ngModel directive of the inner component */ protected model: NgModel; /** Unique id for this input. */ private _uid; /** Identifier if set by the programmer */ private _id; /** * Creates a new ElementBase * @param validators - Synchronous validators. * Use "@Optional() @Inject(NG_VALIDATORS) validators: any[]" to get this in the control component. * @param asyncValidators - Asynchronous validators. * Use "@Optional() @Inject(NG_ASYNC_VALIDATORS) asyncValidators: any[]" to get this in the control component. * @param ngControl - NgControl if one is bound to this component. * Use "@Optional() @Self() ngControl: NgControl" to get this in the control component. * @param translations - NgTranslations service should be provided by dependency injection. */ constructor(validators: ValidatorArray, asyncValidators: AsyncValidatorArray, ngControl: NgControl, translations: NgTranslations); /** * Gets the ng-classes for the input (ng-touched, ng-dirty, ng-invalid etc.). * These are used at least in the wrapping ion-item object. */ getInputStateClasses(): {} | { "ng-untouched": boolean; "ng-touched": boolean; "ng-pristine": boolean; "ng-dirty": boolean; "ng-valid": boolean; "ng-invalid": boolean; }; /** Returns true if the control is disabled. */ getIsDisabled(): boolean; /** * Returns an Observable of an object containing keys for any failed validators. */ protected validate(): Observable; /** * Observable returning true when any of the validators attached to * the control through the dependency injector are failing */ protected readonly invalid: Observable; /** * Gets a collection of validation error messages that can be shown to the end-user. */ protected readonly failures: Observable; /** * Gets the messages for UI purposes. * @param filter Logical filter for the messages. * default: All messages except "required" (shown as UI indication only). * all: All messages */ protected getMessages(filter?: "default" | "all"): Observable; /** Returns true if the required directive is applied to this element. */ protected readonly isRequired: boolean; /** Gets the type of the label used. */ protected readonly labelType: "hidden" | "stacked" | "floating" | "fixed"; /** The text that is shown at the end. May contain formatting, transaltions etc. */ protected readonly labelText: any; /** The placeholder text translated and null converted to empty string */ protected readonly placeholderText: any; }