### File

`src/lib/form-group.ts`

### Extends

`UntypedFormGroup`

### Index

###### Properties

- Readonly controlId
- Public controls
- dirty$
- Readonly disabled$
- Readonly enabled$
- Readonly errors
- Readonly errors$
- Readonly status
- Readonly status$
- Readonly statusChanges
- touch$
- Readonly value
- Readonly value$
- Readonly valueChanges

###### Methods

- Public addControl
- Public contains
- Public disabledWhile
- Public enabledWhile
- Public get
- Public get
- Public get
- Public get
- Public get
- Public getControl
- Public getControl
- Public getControl
- Public getControl
- Public getControl
- Public getError
- Public getError
- Public getError
- Public getError
- Public getError
- Public getRawValue
- Public hasError
- Public hasError
- Public hasError
- Public hasError
- Public hasError
- Public hasErrorAndDirty
- Public hasErrorAndDirty
- Public hasErrorAndDirty
- Public hasErrorAndDirty
- Public hasErrorAndDirty
- Public hasErrorAndTouched
- Public hasErrorAndTouched
- Public hasErrorAndTouched
- Public hasErrorAndTouched
- Public hasErrorAndTouched
- Public markAllAsDirty
- Public markAllAsPristine
- Public markAllAsUntouched
- Public markAsDirty
- Public markAsPristine
- Public markAsTouched
- Public markAsUntouched
- Public mergeAsyncValidators
- Public mergeValidators
- Public patchValue
- Public patchValue
- Public patchValue
- Public removeControl
- Public reset
- Public select
- Public setAsyncValidators
- Public setControl
- Public setDisable
- Public setEnable
- Public setErrors
- Public setValidators
- Public setValue
- Public setValue
- Public setValue
- Public validateOn

###### Accessors

- readonly
- controlPath
- fullControlPath

### Constructor

`constructor(controls: ExtractAbstractControl<KeyValueControls<T> | T>, options: FormGroupOptions)`
Defined in src/lib/form-group.ts:127

Parameters :

Name | Type | Optional
controls | `ExtractAbstractControl<KeyValueControls<T> | T>` | No
options | `FormGroupOptions` | No

### Properties

Readonly controlId
Type : `string`
Defined in src/lib/form-group.ts:103

Public controls
Type : `ExtractAbstractControl<KeyValueControls<T> | T>`
Defined in src/lib/form-group.ts:130

dirty$
Default value : `this.dirtyChanges.asObservable().pipe(distinctUntilChanged())`
Defined in src/lib/form-group.ts:95

Readonly disabled$
Default value : `controlDisabled$<T>(this)`
Defined in src/lib/form-group.ts:98

Readonly enabled$
Default value : `controlEnabled$<T>(this)`
Defined in src/lib/form-group.ts:99

Readonly errors
Type : `E | null`
Defined in src/lib/form-group.ts:85

Readonly errors$
Default value : `controlErrorChanges$<E>(this)`
Defined in src/lib/form-group.ts:101

Readonly status
Type : `ControlState`
Defined in src/lib/form-group.ts:88

Readonly status$
Default value : `controlStatusChanges$<T>(this)`
Defined in src/lib/form-group.ts:100

Readonly statusChanges
Type : `Observable<ControlState>`
Defined in src/lib/form-group.ts:89

touch$
Default value : `this.touchChanges.asObservable().pipe(distinctUntilChanged())`
Defined in src/lib/form-group.ts:94

Readonly value
Type : `T`
Defined in src/lib/form-group.ts:84

Readonly value$
Type : `Observable<T>`
Default value : `controlValueChanges$<T>(this)`
Defined in src/lib/form-group.ts:97

Readonly valueChanges
Type : `Observable<T>`
Defined in src/lib/form-group.ts:86

### Methods

Public addControl
`addControl(name: K, control: AbstractControl<>)`
Defined in src/lib/form-group.ts:184

Type parameters :

- K

Parameters :

Name | Type | Optional
name | `K` | No
control | `AbstractControl<>` | No

Returns : `void`

Public contains
`contains(controlName: ExtractStrings<T>)`
Defined in src/lib/form-group.ts:195

Parameters :

Name | Type | Optional
controlName | `ExtractStrings<T>` | No

Returns : `boolean`

Public disabledWhile
`disabledWhile(observable: Observable<boolean>, options?: ControlOptions)`
Defined in src/lib/form-group.ts:268

Parameters :

Name | Type | Optional
observable | `Observable<boolean>` | No
options | `ControlOptions` | Yes

Returns : `Subscription`

Public enabledWhile
`enabledWhile(observable: Observable<boolean>, options?: ControlOptions)`
Defined in src/lib/form-group.ts:275

Parameters :

Name | Type | Optional
observable | `Observable<boolean>` | No
options | `ControlOptions` | Yes

Returns : `Subscription`

Public get
`get(path: [K1])`
Defined in src/lib/form-group.ts:145

Type parameters :

- K1

Parameters :

Name | Type | Optional
path | `[K1]` | No

Returns : `AbstractControl<>`

Public get
`get(path: [K1, K2])`
Defined in src/lib/form-group.ts:146

Type parameters :

- K1
- K2

Parameters :

Name | Type | Optional
path | `[K1, K2]` | No

Returns : `AbstractControl<>`

Public get
`get(path: [K1, K2, K3])`
Defined in src/lib/form-group.ts:149

Type parameters :

- K1
- K2
- K3

Parameters :

Name | Type | Optional
path | `[K1, K2, K3]` | No

Returns : `AbstractControl<>`

Public get
`get(path: string)`
Defined in src/lib/form-group.ts:154

Parameters :

Name | Type | Optional
path | `string` | No

Returns : `AbstractControl`

Public get
`get(path: any)`
Defined in src/lib/form-group.ts:155

Parameters :

Name | Type | Optional
path | `any` | No

Returns : `AbstractControl | null`

Public getControl
`getControl(prop1: P1)`
Defined in src/lib/form-group.ts:159

Type parameters :

- P1

Parameters :

Name | Type | Optional
prop1 | `P1` | No

Returns : `AbstractControl<>`

Public getControl
`getControl(prop1: P1, prop2: P2)`
Defined in src/lib/form-group.ts:160

Type parameters :

- P1
- P2

Parameters :

Name | Type | Optional
prop1 | `P1` | No
prop2 | `P2` | No

Returns : `AbstractControl<>`

Public getControl
`getControl(prop1: P1, prop2: P2, prop3: P3)`
Defined in src/lib/form-group.ts:164

Type parameters :

- P1
- P2
- P3

Parameters :

Name | Type | Optional
prop1 | `P1` | No
prop2 | `P2` | No
prop3 | `P3` | No

Returns : `AbstractControl<>`

Public getControl
`getControl(prop1: P1, prop2: P2, prop3: P3, prop4: P4)`
Defined in src/lib/form-group.ts:169

Type parameters :

- P1
- P2
- P3
- P4

Parameters :

Name | Type | Optional
prop1 | `P1` | No
prop2 | `P2` | No
prop3 | `P3` | No
prop4 | `P4` | No

Returns : `AbstractControl<>`

Public getControl
`getControl(...names: any)`
Defined in src/lib/form-group.ts:180

Parameters :

Name | Type | Optional
names | `any` | No

Returns : `AbstractControl<any>`

Public getError
`getError(errorCode: K, path?: [K1])`
Defined in src/lib/form-group.ts:376

Type parameters :

- K
- K1

Parameters :

Name | Type | Optional
errorCode | `K` | No
path | `[K1]` | Yes

Returns : `| null`

Public getError
`getError(errorCode: K, path?: [K1, K2])`
Defined in src/lib/form-group.ts:380

Type parameters :

- K
- K1
- K2

Parameters :

Name | Type | Optional
errorCode | `K` | No
path | `[K1, K2]` | Yes

Returns : `| null`

Public getError
`getError(errorCode: K, path?: [K1, K2, K3])`
Defined in src/lib/form-group.ts:385

Type parameters :

- K
- K1
- K2
- K3

Parameters :

Name | Type | Optional
errorCode | `K` | No
path | `[K1, K2, K3]` | Yes

Returns : `| null`

Public getError
`getError(errorCode: K, path?: string)`
Defined in src/lib/form-group.ts:391

Type parameters :

- K

Parameters :

Name | Type | Optional
errorCode | `K` | No
path | `string` | Yes

Returns : `| null`

Public getError
`getError(errorCode: K, path?: any)`
Defined in src/lib/form-group.ts:392

Type parameters :

- K

Parameters :

Name | Type | Optional
errorCode | `K` | No
path | `any` | Yes

Returns : `| null`

Public getRawValue
`getRawValue()`
Defined in src/lib/form-group.ts:141
Returns : `T`

Public hasError
`hasError(errorCode: ExtractStrings<E>, path?: [K1])`
Defined in src/lib/form-group.ts:354

Type parameters :

- K1

Parameters :

Name | Type | Optional
errorCode | `ExtractStrings<E>` | No
path | `[K1]` | Yes

Returns : `boolean`

Public hasError
`hasError(errorCode: ExtractStrings<E>, path?: [K1, K2])`
Defined in src/lib/form-group.ts:358

Type parameters :

- K1
- K2

Parameters :

Name | Type | Optional
errorCode | `ExtractStrings<E>` | No
path | `[K1, K2]` | Yes

Returns : `boolean`

Public hasError
`hasError(errorCode: ExtractStrings<E>, path?: [K1, K2, K3])`
Defined in src/lib/form-group.ts:362

Type parameters :

- K1
- K2
- K3

Parameters :

Name | Type | Optional
errorCode | `ExtractStrings<E>` | No
path | `[K1, K2, K3]` | Yes

Returns : `boolean`

Public hasError
`hasError(errorCode: ExtractStrings<E>, path?: string)`
Defined in src/lib/form-group.ts:367

Parameters :

Name | Type | Optional
errorCode | `ExtractStrings<E>` | No
path | `string` | Yes

Returns : `boolean`

Public hasError
`hasError(errorCode: ExtractStrings<E>, path?: any)`
Defined in src/lib/form-group.ts:368

Parameters :

Name | Type | Optional
errorCode | `ExtractStrings<E>` | No
path | `any` | Yes

Returns : `boolean`

Public hasErrorAndDirty
`hasErrorAndDirty(error: ExtractStrings<E>, prop1?: P1)`
Defined in src/lib/form-group.ts:426

Type parameters :

- P1

Parameters :

Name | Type | Optional
error | `ExtractStrings<E>` | No
prop1 | `P1` | Yes

Returns : `boolean`

Public hasErrorAndDirty
`hasErrorAndDirty(error: ExtractStrings<E>, prop1?: P1, prop2?: P2)`
Defined in src/lib/form-group.ts:430

Type parameters :

- P1
- P2

Parameters :

Name | Type | Optional
error | `ExtractStrings<E>` | No
prop1 | `P1` | Yes
prop2 | `P2` | Yes

Returns : `boolean`

Public hasErrorAndDirty
`hasErrorAndDirty(error: ExtractStrings<E>, prop1?: P1, prop2?: P2, prop3?: P3)`
Defined in src/lib/form-group.ts:435

Type parameters :

- P1
- P2
- P3

Parameters :

Name | Type | Optional
error | `ExtractStrings<E>` | No
prop1 | `P1` | Yes
prop2 | `P2` | Yes
prop3 | `P3` | Yes

Returns : `boolean`

Public hasErrorAndDirty
`hasErrorAndDirty(error: ExtractStrings<E>, prop1?: P1, prop2?: P2, prop3?: P3, prop4?: P4)`
Defined in src/lib/form-group.ts:440

Type parameters :

- P1
- P2
- P3
- P4

Parameters :

Name | Type | Optional
error | `ExtractStrings<E>` | No
prop1 | `P1` | Yes
prop2 | `P2` | Yes
prop3 | `P3` | Yes
prop4 | `P4` | Yes

Returns : `boolean`

Public hasErrorAndDirty
`hasErrorAndDirty(error: any, ...path: any)`
Defined in src/lib/form-group.ts:452

Parameters :

Name | Type | Optional
error | `any` | No
path | `any` | No

Returns : `boolean`

Public hasErrorAndTouched
`hasErrorAndTouched(error: ExtractStrings<E>, prop1?: P1)`
Defined in src/lib/form-group.ts:396

Type parameters :

- P1

Parameters :

Name | Type | Optional
error | `ExtractStrings<E>` | No
prop1 | `P1` | Yes

Returns : `boolean`

Public hasErrorAndTouched
`hasErrorAndTouched(error: ExtractStrings<E>, prop1?: P1, prop2?: P2)`
Defined in src/lib/form-group.ts:400

Type parameters :

- P1
- P2

Parameters :

Name | Type | Optional
error | `ExtractStrings<E>` | No
prop1 | `P1` | Yes
prop2 | `P2` | Yes

Returns : `boolean`

Public hasErrorAndTouched
`hasErrorAndTouched(error: ExtractStrings<E>, prop1?: P1, prop2?: P2, prop3?: P3)`
Defined in src/lib/form-group.ts:405

Type parameters :

- P1
- P2
- P3

Parameters :

Name | Type | Optional
error | `ExtractStrings<E>` | No
prop1 | `P1` | Yes
prop2 | `P2` | Yes
prop3 | `P3` | Yes

Returns : `boolean`

Public hasErrorAndTouched
`hasErrorAndTouched(error: ExtractStrings<E>, prop1?: P1, prop2?: P2, prop3?: P3, prop4?: P4)`
Defined in src/lib/form-group.ts:410

Type parameters :

- P1
- P2
- P3
- P4

Parameters :

Name | Type | Optional
error | `ExtractStrings<E>` | No
prop1 | `P1` | Yes
prop2 | `P2` | Yes
prop3 | `P3` | Yes
prop4 | `P4` | Yes

Returns : `boolean`

Public hasErrorAndTouched
`hasErrorAndTouched(error: any, ...path: any)`
Defined in src/lib/form-group.ts:422

Parameters :

Name | Type | Optional
error | `any` | No
path | `any` | No

Returns : `boolean`

Public markAllAsDirty
`markAllAsDirty()`
Defined in src/lib/form-group.ts:314
Returns : `void`

Public markAllAsPristine
`markAllAsPristine()`
Defined in src/lib/form-group.ts:318
Returns : `void`

Public markAllAsUntouched
`markAllAsUntouched()`
Defined in src/lib/form-group.ts:322
Returns : `void`

Public markAsDirty
`markAsDirty(opts?: OnlySelf)`
Defined in src/lib/form-group.ts:309

Parameters :

Name | Type | Optional
opts | `OnlySelf` | Yes

Returns : `void`

Public markAsPristine
`markAsPristine(opts?: OnlySelf)`
Defined in src/lib/form-group.ts:304

Parameters :

Name | Type | Optional
opts | `OnlySelf` | Yes

Returns : `void`

Public markAsTouched
`markAsTouched(opts?: OnlySelf)`
Defined in src/lib/form-group.ts:294

Parameters :

Name | Type | Optional
opts | `OnlySelf` | Yes

Returns : `void`

Public markAsUntouched
`markAsUntouched(opts?: OnlySelf)`
Defined in src/lib/form-group.ts:299

Parameters :

Name | Type | Optional
opts | `OnlySelf` | Yes

Returns : `void`

Public mergeAsyncValidators
`mergeAsyncValidators(validators: AsyncValidator)`
Defined in src/lib/form-group.ts:286

Parameters :

Name | Type | Optional
validators | `AsyncValidator` | No

Returns : `void`

Public mergeValidators
`mergeValidators(validators: Validator)`
Defined in src/lib/form-group.ts:282

Parameters :

Name | Type | Optional
validators | `Validator` | No

Returns : `void`

Public patchValue
`patchValue(valueOrObservable: Observable<Partial<T>>, options?: ControlEventOptions)`
Defined in src/lib/form-group.ts:246

Parameters :

Name | Type | Optional
valueOrObservable | `Observable<Partial<T>>` | No
options | `ControlEventOptions` | Yes

Returns : `Subscription`

Public patchValue
`patchValue(valueOrObservable: Partial<T>, options?: ControlEventOptions)`
Defined in src/lib/form-group.ts:250

Parameters :

Name | Type | Optional
valueOrObservable | `Partial<T>` | No
options | `ControlEventOptions` | Yes

Returns : `void`

Public patchValue
`patchValue(valueOrObservable: any, options?: ControlEventOptions)`
Defined in src/lib/form-group.ts:254

Parameters :

Name | Type | Optional
valueOrObservable | `any` | No
options | `ControlEventOptions` | Yes

Returns : `Subscription | void`

Public removeControl
`removeControl(name: ExtractStrings<T>)`
Defined in src/lib/form-group.ts:191

Parameters :

Name | Type | Optional
name | `ExtractStrings<T>` | No

Returns : `void`

Public reset
`reset(formState?: Partial<T>, options?: ControlEventOptions)`
Defined in src/lib/form-group.ts:326

Parameters :

Name | Type | Optional
formState | `Partial<T>` | Yes
options | `ControlEventOptions` | Yes

Returns : `void`

Public select
`select(mapFn: (state: T) => void)`
Defined in src/lib/form-group.ts:137

Type parameters :

- R

Parameters :

Name | Type | Optional
mapFn | `function` | No

Returns : `Observable<R>`

Public setAsyncValidators
`setAsyncValidators(newValidator: AsyncValidator, updateValueAndValidity)`
Defined in src/lib/form-group.ts:340

Parameters :

Name | Type | Optional | Default value
newValidator | `AsyncValidator` | No |
updateValueAndValidity |  | No | `true`

Returns : `void`

Public setControl
`setControl(name: K, control: AbstractControl<>)`
Defined in src/lib/form-group.ts:199

Type parameters :

- K

Parameters :

Name | Type | Optional
name | `K` | No
control | `AbstractControl<>` | No

Returns : `void`

Public setDisable
`setDisable(disable, opts?: ControlEventOptions)`
Defined in src/lib/form-group.ts:460

Parameters :

Name | Type | Optional | Default value
disable |  | No | `true`
opts | `ControlEventOptions` | Yes |

Returns : `void`

Public setEnable
`setEnable(enable, opts?: ControlEventOptions)`
Defined in src/lib/form-group.ts:456

Parameters :

Name | Type | Optional | Default value
enable |  | No | `true`
opts | `ControlEventOptions` | Yes |

Returns : `void`

Public setErrors
`setErrors(errors: Partial<E> | null, opts: EmitEvent)`
Defined in src/lib/form-group.ts:372

Parameters :

Name | Type | Optional | Default value
errors | `Partial<E> | null` | No |
opts | `EmitEvent` | No | `{}`

Returns : `any`

Public setValidators
`setValidators(newValidator: Validator, updateValueAndValidity)`
Defined in src/lib/form-group.ts:330

Parameters :

Name | Type | Optional | Default value
newValidator | `Validator` | No |
updateValueAndValidity |  | No | `true`

Returns : `void`

Public setValue
`setValue(valueOrObservable: Observable<T>, options?: ControlEventOptions)`
Defined in src/lib/form-group.ts:206

Parameters :

Name | Type | Optional
valueOrObservable | `Observable<T>` | No
options | `ControlEventOptions` | Yes

Returns : `Subscription`

Public setValue
`setValue(valueOrObservable: T, options?: ControlEventOptions)`
Defined in src/lib/form-group.ts:210

Parameters :

Name | Type | Optional
valueOrObservable | `T` | No
options | `ControlEventOptions` | Yes

Returns : `void`

Public setValue
`setValue(valueOrObservable: any, options?: ControlEventOptions)`
Defined in src/lib/form-group.ts:211

Parameters :

Name | Type | Optional
valueOrObservable | `any` | No
options | `ControlEventOptions` | Yes

Returns : `any`

Public validateOn
`validateOn(observableValidation: Observable<null | object>)`
Defined in src/lib/form-group.ts:350

Parameters :

Name | Type | Optional
observableValidation | `Observable<null | object>` | No

Returns : `any`

### Accessors

readonly
get `readonly()`
Defined in src/lib/form-group.ts:70
set `readonly(value: boolean)`
Defined in src/lib/form-group.ts:74

Parameters :

Name | Type | Optional
value | `boolean` | No

Returns : `void`

controlPath
get `controlPath()`
Defined in src/lib/form-group.ts:105

fullControlPath
get `fullControlPath()`
Defined in src/lib/form-group.ts:119

    import {
      isObservable,
      Observable,
      Subject,
      Subscription,
    } from 'rxjs';
    import { distinctUntilChanged } from 'rxjs/operators';
    import { UntypedFormGroup } from '@angular/forms';
    import {
      AbstractControl,
      AsyncValidator,
      ControlEventOptions,
      ControlOptions,
      ControlState,
      EmitEvent,
      ExtractAbstractControl,
      ExtractStrings,
      KeyValueControls,
      OnlySelf,
      ValidationErrors,
      Validator,
    } from './types';
    import {
      controlDisabled$,
      controlDisabledWhile,
      controlEnabled$,
      controlEnabledWhile,
      controlErrorChanges$,
      controlStatusChanges$,
      controlValueChanges$,
      disableControl,
      enableControl,
      hasErrorAndDirty,
      hasErrorAndTouched,
      markAllDirty,
      markAllPristine,
      markAllUntouched,
      mergeControlValidators,
      selectControlValue$,
      validateControlOn,
    } from './control-actions';
    import { coerceArray } from '@rxap/utilities';
    import {
      FormDefinition,
      FormGroupOptions,
      FormType,
    } from './model';

    export class RxapFormGroup<
      T = any,
      E extends ValidationErrors = any
    > extends UntypedFormGroup {
      /**
       * @internal
       */
      public get rxapFormDefinition():
        | (FormType<T> & FormDefinition<T>)
        | undefined {
        if (!this.parent) {
          return this._rxapFormDefinition;
        }
        if (this._rxapFormDefinition) {
          return this._rxapFormDefinition;
        }
        return (this.parent as any).rxapFormDefinition;
      }

      private _readonly = false;

      public get readonly(): boolean {
        return (this.parent as any)?.readonly ?? this._readonly;
      }

      public set readonly(value: boolean) {
        this._readonly = value;
        Object.values(this.controls ?? {}).forEach(control => (control as any).stateChanges?.next());
      }

      /**
       * @internal
       */
      private _rxapFormDefinition?: FormType<T> & FormDefinition<T>;

      override readonly value!: T;
      override readonly errors!: E | null;
      override readonly valueChanges!: Observable<T>;
      // @ts-expect-error overwrite the public type
      override readonly status!: ControlState;
      override readonly statusChanges!: Observable<ControlState>;

      private touchChanges = new Subject<boolean>();
      private dirtyChanges = new Subject<boolean>();

      touch$ = this.touchChanges.asObservable().pipe(distinctUntilChanged());
      dirty$ = this.dirtyChanges.asObservable().pipe(distinctUntilChanged());

      readonly value$: Observable<T> = controlValueChanges$<T>(this);
      readonly disabled$ = controlDisabled$<T>(this);
      readonly enabled$ = controlEnabled$<T>(this);
      readonly status$ = controlStatusChanges$<T>(this);
      readonly errors$ = controlErrorChanges$<E>(this);

      readonly controlId: string;

      public get controlPath(): string {
        const parent: any = this.parent;
        if (parent) {
          if (parent.controlPath) {
            if (parent === this.root) {
              return this.controlId;
            } else {
              return [ parent.controlPath, this.controlId ].join('.');
            }
          }
        }
        return '';
      }

      public get fullControlPath(): string {
        const parent: any = this.parent;
        if (parent) {
          if (parent.fullControlPath) {
            return [ parent.fullControlPath, this.controlId ].join('.');
          }
        }
        return this.controlId;
      }

      constructor(
        public override controls: ExtractAbstractControl<KeyValueControls<T>, T>,
        options: FormGroupOptions,
      ) {
        super(controls, options);
        this.controlId = options.controlId;
      }

      public select<R>(mapFn: (state: T) => R): Observable<R> {
        return selectControlValue$<T, R>(this, mapFn);
      }

      public override getRawValue(): T {
        return super.getRawValue();
      }

      public override get<K1 extends keyof T>(path: [ K1 ]): AbstractControl<T[K1]>;
      public override get<K1 extends keyof T, K2 extends keyof T[K1]>(
        path: [ K1, K2 ],
      ): AbstractControl<T[K1][K2]>;
      public override get<
        K1 extends keyof T,
        K2 extends keyof T[K1],
        K3 extends keyof T[K1][K2]
      >(path: [ K1, K2, K3 ]): AbstractControl<T[K1][K2][K3]>;
      public override get(path: string): AbstractControl;
      public override get(path: any): AbstractControl | null {
        return super.get(path);
      }

      public getControl<P1 extends keyof T>(prop1: P1): AbstractControl<T[P1]>;
      public getControl<P1 extends keyof T, P2 extends keyof T[P1]>(
        prop1: P1,
        prop2: P2,
      ): AbstractControl<T[P1][P2]>;
      public getControl<
        P1 extends keyof T,
        P2 extends keyof T[P1],
        P3 extends keyof T[P1][P2]
      >(prop1: P1, prop2: P2, prop3: P3): AbstractControl<T[P1][P2][P3]>;
      public getControl<
        P1 extends keyof T,
        P2 extends keyof T[P1],
        P3 extends keyof T[P1][P2],
        P4 extends keyof T[P1][P2][P3]
      >(
        prop1: P1,
        prop2: P2,
        prop3: P3,
        prop4: P4,
      ): AbstractControl<T[P1][P2][P3][P4]>;
      public getControl(...names: any): AbstractControl<any> {
        return this.get(names.join('.'));
      }

      public override addControl<K extends ExtractStrings<T>>(
        name: K,
        control: AbstractControl<T[K]>,
      ): void {
        super.addControl(name, control);
      }

      public override removeControl(name: ExtractStrings<T>): void {
        super.removeControl(name);
      }

      public override contains(controlName: ExtractStrings<T>): boolean {
        return super.contains(controlName);
      }

      public override setControl<K extends ExtractStrings<T>>(
        name: K,
        control: AbstractControl<T[K]>,
      ): void {
        super.setControl(name, control);
      }

      public override setValue(
        valueOrObservable: Observable<T>,
        options?: ControlEventOptions,
      ): Subscription;
      public override setValue(valueOrObservable: T, options?: ControlEventOptions): void;
      public override setValue(valueOrObservable: any, options?: ControlEventOptions): any {
        if (isObservable(valueOrObservable)) {
          return (valueOrObservable as Observable<T>).subscribe((value) =>
            // TODO : refactor RxapFormGroup to typed FormGroup
            super.setValue(value as any, options),
          );
        }

        super.setValue(valueOrObservable, options);
      }

      private _patchValue(value: T, options?: ControlEventOptions) {
        // Even though the `value` argument type doesn't allow `null` and `undefined` values, the
        // `patchValue` can be called recursively and inner data structures might have these values, so
        // we just ignore such cases when a field containing FormGroup instance receives `null` or
        // `undefined` as a value.
        if (value == null /* both `null` and `undefined` */) {
          return;
        }
        Object.keys(value).forEach(name => {
          // TODO : resolve type issue
          const controls = this.controls as any;
          if (controls[name]) {
            controls[name].patchValue(
              (value as any)[name],
              {
                ...(options ?? {}),
                onlySelf: true,
              },
            );
          }
        });
        this.updateValueAndValidity(options);
      }

      public override patchValue(
        valueOrObservable: Observable<Partial<T>>,
        options?: ControlEventOptions,
      ): Subscription;
      public override patchValue(
        valueOrObservable: Partial<T>,
        options?: ControlEventOptions,
      ): void;
      public override patchValue(
        valueOrObservable: any,
        options?: ControlEventOptions,
      ): Subscription | void {
        if (isObservable(valueOrObservable)) {
          return (valueOrObservable as Observable<T>).subscribe((value) =>
            // TODO : refactor RxapFormGroup to typed FormGroup
            super.patchValue(value as any, options),
          );
        }

        this._patchValue(valueOrObservable, options);
      }

      public disabledWhile(
        observable: Observable<boolean>,
        options?: ControlOptions,
      ): Subscription {
        return controlDisabledWhile(this, observable, options);
      }

      public enabledWhile(
        observable: Observable<boolean>,
        options?: ControlOptions,
      ): Subscription {
        return controlEnabledWhile(this, observable, options);
      }

      public mergeValidators(validators: Validator) {
        mergeControlValidators(this, validators);
      }

      public mergeAsyncValidators(validators: AsyncValidator) {
        this.setAsyncValidators([
          ...coerceArray(this.asyncValidator),
          ...coerceArray(validators),
        ]);
        this.updateValueAndValidity();
      }

      public override markAsTouched(opts?: OnlySelf): void {
        super.markAsTouched(opts);
        this.touchChanges.next(true);
      }

      public override markAsUntouched(opts?: OnlySelf): void {
        super.markAsUntouched(opts);
        this.touchChanges.next(false);
      }

      public override markAsPristine(opts?: OnlySelf): void {
        super.markAsPristine(opts);
        this.dirtyChanges.next(false);
      }

      public override markAsDirty(opts?: OnlySelf): void {
        super.markAsDirty(opts);
        this.dirtyChanges.next(true);
      }

      public markAllAsDirty(): void {
        markAllDirty(this);
      }

      public markAllAsPristine(): void {
        markAllPristine(this);
      }

      public markAllAsUntouched(): void {
        markAllUntouched(this);
      }

      public override reset(formState?: Partial<T>, options?: ControlEventOptions): void {
        super.reset(formState, options);
      }

      public override setValidators(
        newValidator: Validator,
        updateValueAndValidity = true,
      ): void {
        super.setValidators(newValidator);
        if (updateValueAndValidity) {
          super.updateValueAndValidity();
        }
      }

      public override setAsyncValidators(
        newValidator: AsyncValidator,
        updateValueAndValidity = true,
      ): void {
        super.setAsyncValidators(newValidator);
        if (updateValueAndValidity) {
          super.updateValueAndValidity();
        }
      }

      public validateOn(observableValidation: Observable<null | object>) {
        return validateControlOn(this, observableValidation);
      }

      public override hasError<K1 extends keyof T>(
        errorCode: ExtractStrings<E>,
        path?: [ K1 ],
      ): boolean;
      public override hasError<K1 extends keyof T, K2 extends keyof T[K1]>(
        errorCode: ExtractStrings<E>,
        path?: [ K1, K2 ],
      ): boolean;
      public override hasError<
        K1 extends keyof T,
        K2 extends keyof T[K1],
        K3 extends keyof T[K1][K2]
      >(errorCode: ExtractStrings<E>, path?: [ K1, K2, K3 ]): boolean;
      public override hasError(errorCode: ExtractStrings<E>, path?: string): boolean;
      public override hasError(errorCode: ExtractStrings<E>, path?: any): boolean {
        return super.hasError(errorCode, path);
      }

      public override setErrors(errors: Partial<E> | null, opts: EmitEvent = {}) {
        return super.setErrors(errors, opts);
      }

      public override getError<K extends keyof E, K1 extends keyof T>(
        errorCode: K,
        path?: [ K1 ],
      ): E[K] | null;
      public override getError<
        K extends keyof E,
        K1 extends keyof T,
        K2 extends keyof T[K1]
      >(errorCode: K, path?: [ K1, K2 ]): E[K] | null;
      public override getError<
        K extends keyof E,
        K1 extends keyof T,
        K2 extends keyof T[K1],
        K3 extends keyof T[K1][K2]
      >(errorCode: K, path?: [ K1, K2, K3 ]): E[K] | null;
      public override getError<K extends keyof E>(errorCode: K, path?: string): E[K] | null;
      public override getError<K extends keyof E>(errorCode: K, path?: any): E[K] | null {
        return super.getError(errorCode as any, path) as E[K] | null;
      }

      public hasErrorAndTouched<P1 extends keyof T>(
        error: ExtractStrings<E>,
        prop1?: P1,
      ): boolean;
      public hasErrorAndTouched<P1 extends keyof T, P2 extends keyof T[P1]>(
        error: ExtractStrings<E>,
        prop1?: P1,
        prop2?: P2,
      ): boolean;
      public hasErrorAndTouched<
        P1 extends keyof T,
        P2 extends keyof T[P1],
        P3 extends keyof T[P1][P2]
      >(error: ExtractStrings<E>, prop1?: P1, prop2?: P2, prop3?: P3): boolean;
      public hasErrorAndTouched<
        P1 extends keyof T,
        P2 extends keyof T[P1],
        P3 extends keyof T[P1][P2],
        P4 extends keyof T[P1][P2][P3]
      >(
        error: ExtractStrings<E>,
        prop1?: P1,
        prop2?: P2,
        prop3?: P3,
        prop4?: P4,
      ): boolean;
      public hasErrorAndTouched(error: any, ...path: any): boolean {
        return hasErrorAndTouched(this, error, ...path);
      }

      public hasErrorAndDirty<P1 extends keyof T>(
        error: ExtractStrings<E>,
        prop1?: P1,
      ): boolean;
      public hasErrorAndDirty<P1 extends keyof T, P2 extends keyof T[P1]>(
        error: ExtractStrings<E>,
        prop1?: P1,
        prop2?: P2,
      ): boolean;
      public hasErrorAndDirty<
        P1 extends keyof T,
        P2 extends keyof T[P1],
        P3 extends keyof T[P1][P2]
      >(error: ExtractStrings<E>, prop1?: P1, prop2?: P2, prop3?: P3): boolean;
      public hasErrorAndDirty<
        P1 extends keyof T,
        P2 extends keyof T[P1],
        P3 extends keyof T[P1][P2],
        P4 extends keyof T[P1][P2][P3]
      >(
        error: ExtractStrings<E>,
        prop1?: P1,
        prop2?: P2,
        prop3?: P3,
        prop4?: P4,
      ): boolean;
      public hasErrorAndDirty(error: any, ...path: any): boolean {
        return hasErrorAndDirty(this, error, ...path);
      }

      public setEnable(enable = true, opts?: ControlEventOptions) {
        enableControl(this, enable, opts);
      }

      public setDisable(disable = true, opts?: ControlEventOptions) {
        disableControl(this, disable, opts);
      }
    }

# results matching ""

# No results matching ""