@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
63 lines • 2.69 kB
TypeScript
import { AfterContentInit, DoCheck, OnDestroy } from '@angular/core';
import { FormControl, FormControlName, NgModel, ValidationErrors } from '@angular/forms';
import { MessagesComponent } from './messages.component';
import * as i0 from "@angular/core";
/**
* A form group helps to validate an input of a form element.
*
* ```html
* <c8y-form-group [hasWarning]="user.email.length === 0">
* <label translate for="userEmail">Email</label>
* <input
* id="userEmail"
* class="form-control"
* type="email"
* name="email"
* [maxlength]="254"
* autocomplete="off"
* placeholder="{{'e.g. joe.doe@exmpl.com' | translate}}"
* [(ngModel)]="user.email"
* email
* required
* >
* <c8y-messages>
* <c8y-message *ngIf="user.email.length === 0" translate></c8y-message>
* <c8y-message name="required" text="The E-Mail is SUPER required"></c8y-message>
* </c8y-messages>
* </c8y-form-group>
* ```
*
* @param status The current status could be error, warning or success.
* @param hasError Set this to true to display a error.
* @param hasWarning Set this to true to display a warning.
* @param hasSuccess Set this to true to display a success.
* @param novalidation Set this to true to disable automatic validation by this component.
*/
export declare class FormGroupComponent implements AfterContentInit, DoCheck, OnDestroy {
hasError: boolean;
hasWarning: boolean;
hasSuccess: boolean;
novalidation: boolean;
status: string;
get error(): boolean;
get warning(): boolean;
get success(): boolean;
customErrorMessage: MessagesComponent;
model: NgModel;
formControlName: FormControlName;
errors: ValidationErrors;
private control;
private controlTouched$;
private readonly VALIDATION_DEBOUNCE_MS;
private destroyed$;
ngAfterContentInit(): void;
initNgModel(): void;
initFormControl(): void;
observeControl(control: FormControl | NgModel): void;
updateErrors(control: FormControl | NgModel): void;
ngDoCheck(): void;
ngOnDestroy(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<FormGroupComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<FormGroupComponent, "c8y-form-group", never, { "hasError": { "alias": "hasError"; "required": false; }; "hasWarning": { "alias": "hasWarning"; "required": false; }; "hasSuccess": { "alias": "hasSuccess"; "required": false; }; "novalidation": { "alias": "novalidation"; "required": false; }; "status": { "alias": "status"; "required": false; }; }, {}, ["customErrorMessage", "model", "formControlName"], ["*"], true, never>;
}
//# sourceMappingURL=form-group.component.d.ts.map