@gravitee/ui-particles-angular 7.17.2 → 7.17.3

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, debounceTime, take } from 'rxjs/operators';
16
+ import { startWith, map, distinctUntilChanged, tap, debounce, takeUntil, delay, filter, switchMap, take, debounceTime } 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';
@@ -2985,32 +2985,22 @@ class GioFormJsonSchemaComponent {
2985
2985
  this.formGroup.markAllAsTouched();
2986
2986
  this.stateChanges$.next();
2987
2987
  });
2988
- // Group all valueChanges events emit by formly in a single one
2989
- merge(this.formGroup.statusChanges, this.formGroup.valueChanges)
2990
- .pipe(takeUntil(this.unsubscribe$), debounceTime(100))
2991
- .subscribe(() => {
2992
- this.stateChanges$.next();
2993
- });
2994
- }
2995
- ngAfterViewInit() {
2996
2988
  // Add async validator to the parent
2997
2989
  this.ngControl?.control?.addAsyncValidators(() => {
2998
2990
  return this.isValid$.pipe(takeUntil(this.unsubscribe$), take(1), map(isValid => (isValid ? null : { invalid: true })));
2999
2991
  });
3000
- this.ngControl?.control?.updateValueAndValidity({ emitEvent: false });
3001
2992
  // Subscribe to state changes to manage touches, status and value
3002
- this.stateChanges$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2993
+ this.stateChanges$
2994
+ .pipe(tap(() => {
3003
2995
  const { status, value, touched } = this.formGroup;
3004
2996
  if (this.isDisabled) {
3005
2997
  return;
3006
2998
  }
3007
2999
  if (status === 'VALID') {
3008
3000
  this.isValid$.next(true);
3009
- this.ngControl?.control?.setErrors(null);
3010
3001
  }
3011
3002
  if (status === 'INVALID') {
3012
3003
  this.isValid$.next(false);
3013
- this.ngControl?.control?.setErrors({ invalid: true });
3014
3004
  }
3015
3005
  if (touched && !this.touched) {
3016
3006
  this._onTouched();
@@ -3019,8 +3009,21 @@ class GioFormJsonSchemaComponent {
3019
3009
  if (this.touched) {
3020
3010
  this._onChange(value);
3021
3011
  }
3022
- this.ngControl?.control?.updateValueAndValidity({ emitEvent: false });
3012
+ }), delay(0),
3013
+ // Keep at the end
3014
+ takeUntil(this.unsubscribe$))
3015
+ .subscribe(() => {
3016
+ this.changeDetectorRef.markForCheck();
3023
3017
  this.changeDetectorRef.detectChanges();
3018
+ this.ngControl?.control?.updateValueAndValidity();
3019
+ });
3020
+ }
3021
+ ngAfterViewInit() {
3022
+ // Group all valueChanges events emit by formly in a single one
3023
+ merge(this.formGroup.statusChanges, this.formGroup.valueChanges)
3024
+ .pipe(takeUntil(this.unsubscribe$), debounceTime(100))
3025
+ .subscribe(() => {
3026
+ this.stateChanges$.next();
3024
3027
  });
3025
3028
  this.stateChanges$.next();
3026
3029
  }