@gravitee/ui-particles-angular 7.17.1 → 7.17.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,7 +13,7 @@ import { coerceBooleanProperty } from '@angular/cdk/coercion';
13
13
  import * as i3$1 from '@angular/material/form-field';
14
14
  import { MatFormFieldControl, MatFormFieldModule, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
15
15
  import { isEmpty, toLower, dropRight, isNil, isArray, remove, isObject, cloneDeep, uniqueId, set } from 'lodash';
16
- import { startWith, map, distinctUntilChanged, tap, debounce, takeUntil, delay, filter, switchMap, take, debounceTime } from 'rxjs/operators';
16
+ import { startWith, map, distinctUntilChanged, tap, debounce, takeUntil, delay, filter, switchMap, debounceTime, take } from 'rxjs/operators';
17
17
  import * as i7 from '@angular/forms';
18
18
  import { FormsModule, FormArray, FormGroup, FormControl, NG_VALUE_ACCESSOR, ReactiveFormsModule, NgControl } from '@angular/forms';
19
19
  import * as i2$2 from '@angular/cdk/a11y';
@@ -2974,11 +2974,6 @@ class GioFormJsonSchemaComponent {
2974
2974
  }
2975
2975
  }
2976
2976
  ngOnInit() {
2977
- // Invalid by default.
2978
- this.ngControl?.control?.addAsyncValidators(() => {
2979
- return this.isValid$.pipe(takeUntil(this.unsubscribe$), take(1), map(isValid => (isValid ? null : { invalid: true })));
2980
- });
2981
- this.ngControl?.control?.updateValueAndValidity({ emitEvent: false });
2982
2977
  // When the parent form is touched, mark all the sub formGroup as touched if not already touched
2983
2978
  const parentControl = this.ngControl?.control?.parent;
2984
2979
  parentControl?.statusChanges
@@ -2998,6 +2993,11 @@ class GioFormJsonSchemaComponent {
2998
2993
  });
2999
2994
  }
3000
2995
  ngAfterViewInit() {
2996
+ // Add async validator to the parent
2997
+ this.ngControl?.control?.addAsyncValidators(() => {
2998
+ return this.isValid$.pipe(takeUntil(this.unsubscribe$), take(1), map(isValid => (isValid ? null : { invalid: true })));
2999
+ });
3000
+ this.ngControl?.control?.updateValueAndValidity({ emitEvent: false });
3001
3001
  // Subscribe to state changes to manage touches, status and value
3002
3002
  this.stateChanges$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
3003
3003
  const { status, value, touched } = this.formGroup;