UNPKG

vue-forms-builder

Version:

Typescript forms builder package written specifically for Vue

86 lines (85 loc) 2.59 kB
import { AbstractControl, ControlType } from '../models'; export declare class FormGroup { controls: ControlType; /** * Getter for the controls value * @readonly * @type {*} * @memberof FormGroup */ get value(): any; /** * Getter for controls validity * @readonly * @type {boolean} * @memberof FormGroup */ get valid(): boolean; /** * Getter for the group touched value * @readonly * @type {boolean} * @memberof FormGroup */ get touched(): boolean; /** * Initialize the FormGroup instance * @param controls - controls for the FormGroup */ constructor(controls: ControlType); /** * Get control by given name * @param controlName - name of the control * @returns AbstractControl if exist, if not method returns undefined */ get(controlName: string, formGroup?: FormGroup): AbstractControl | undefined; /** * Marks all the controls in this group as touched */ markAllAsTouched(): void; /** * Patches the value of this group * @param value - object that matches the structure of the group */ patchValue(value: { [key: string]: any; }): void; /** * Resets all the controls in this group to the initial value, * setting all of it as untouched, resetting error * and setting validators to the initial value */ reset(): void; /** * Add a control to this group * @param name - name of a new control * @param control - control for the given name */ addControl(name: string, control: AbstractControl): void; /** * Remove a control from this group * @param name - name of a control to be removed */ removeControl(name: string): void; /** * Check if this group contains a specific control * @param name - name of a control * @returns if control exist returns true, if not returns false */ contains(name: string): boolean; /** * Private method for checking validaty of the controls in this group * @returns if all controls are valid returns true, if not return false */ private _checkIsValid; /** * Private method for getting controls as object of values * @returns object of controls value */ private _getValueAsObject; /** * Private method for checking touched of the controls in this group * @returns true if any control in this group is touched, false if all controls are untouched. */ private _checkIsTouched; }