ngx-reactive-form-class-validator
Version:
A lightweight library for dynamically validate Angular reactive forms using class-validator library.
56 lines • 2.79 kB
TypeScript
import { AbstractControl, AbstractControlOptions, AsyncValidatorFn, FormGroup, ValidatorFn, ɵOptionalKeys } from '@angular/forms';
import { ClassType } from './types';
export declare class ClassValidatorFormGroup<TControl extends {
[K in keyof TControl]: AbstractControl<any>;
} = any> extends FormGroup<TControl> {
private readonly formClassType;
private classValue;
/**
* Creates a new `ClassValidatorFormGroup` instance.
*
* @param formClassType the `classType` containing `class-validator` decorators to be used to validate form
* @param controls A collection of child controls. The key for each child is the name
* under which it is registered.
*
* @param validatorOrOpts A synchronous validator function, or an array of
* such functions, or an `AbstractControlOptions` object that contains validation functions
* and a validation trigger.
*
* @param asyncValidator A single async validator or array of async validator functions
*
*/
constructor(formClassType: ClassType<any>, controls: TControl, validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null);
/**
* Add a control to this group.
*
* This method also updates the value and validity of the control.
*
* @param name The control name to add to the collection
* @param control Provides the control for the given name
* @param options Specifies whether this FormGroup instance should emit events after a new
* control is added.
* * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
* `valueChanges` observables emit events with the latest status and value when the control is
* added. When false, no events are emitted.
*
*/
addControl<K extends string & keyof TControl>(name: K, control: Required<TControl>[K], options?: {
emitEvent?: boolean;
}): void;
/**
* Remove a control from this group.
*
* @param name The control name to remove from the collection
* @param options Specifies whether this FormGroup instance should emit events after a
* control is removed.
* * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
* `valueChanges` observables emit events with the latest status and value when the control is
* removed. When false, no events are emitted.
*/
removeControl<S extends string>(name: ɵOptionalKeys<TControl> & S, options?: {
emitEvent?: boolean;
}): void;
private setClassValidatorControlsContainerGroupClassValue;
private assignFormValueToClassValue;
}
//# sourceMappingURL=class-validator-form-group.d.ts.map