UNPKG

@rxap/forms

Version:

This package provides a set of tools and directives to simplify working with Angular forms, including reactive forms, custom validators, and form directives for handling loading, submitting, and error states. It offers decorators for defining forms and co

24 lines (23 loc) 2.37 kB
import { Observable, Subscription } from 'rxjs'; import { AbstractControl, ControlOptions, ControlPath, ControlState, ValidatorFn } from './types'; import { RxapFormArray } from './form-array'; import { RxapFormGroup } from './form-group'; import { RxapFormControl } from './form-control'; export declare function controlValueChanges$<T>(control: AbstractControl<T>): Observable<T>; export declare function controlDisabled$<T>(control: AbstractControl<T>): Observable<boolean>; export declare function controlEnabled$<T>(control: AbstractControl<T>): Observable<boolean>; export declare function controlReadonly$<T>(control: AbstractControl<T>): Observable<boolean>; export declare function controlStatusChanges$<T>(control: AbstractControl<T>): Observable<ControlState>; export declare function controlErrorChanges$<E>(control: AbstractControl): Observable<E | null>; export declare function enableControl<T>(control: AbstractControl<T>, enabled: boolean, opts?: ControlOptions): void; export declare function disableControl<T>(control: AbstractControl<T>, disabled: boolean, opts?: ControlOptions): void; export declare function controlDisabledWhile<T>(control: AbstractControl<T>, observable: Observable<boolean>, opts?: ControlOptions): Subscription; export declare function controlEnabledWhile<T>(control: AbstractControl<T>, observable: Observable<boolean>, opts?: ControlOptions): Subscription; export declare function mergeControlValidators<T, Control extends AbstractControl<T>>(control: Control, validators: ValidatorFn<T> | ValidatorFn<T>[]): void; export declare function validateControlOn<T>(control: AbstractControl<T>, validation: Observable<null | object>): Subscription; export declare function hasErrorAndTouched<T>(control: AbstractControl<T>, error: string, path?: ControlPath): boolean; export declare function hasErrorAndDirty<T>(control: AbstractControl<T>, error: string, path?: ControlPath): boolean; export declare function markAllDirty<T>(control: RxapFormArray<T> | RxapFormGroup<T>): void; export declare function markAllPristine<T>(control: RxapFormArray<T> | RxapFormGroup<T>): void; export declare function markAllUntouched<T>(control: RxapFormArray<T> | RxapFormGroup<T>): void; export declare function selectControlValue$<T, R>(control: RxapFormGroup<T> | RxapFormArray<T> | RxapFormControl<T>, mapFn: (state: T) => R): Observable<R>;