@gravitee/ui-particles-angular 17.7.2 → 17.7.3-renovate-all-devdependencies-minor-patch-28ed155
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.
|
@@ -3331,6 +3331,9 @@ class GioFormJsonSchemaComponent {
|
|
|
3331
3331
|
this.touched = false;
|
|
3332
3332
|
this.isValid$ = new ReplaySubject(1); // Wait JsonSchema to be loaded to check if it's valid
|
|
3333
3333
|
this.stateChanges$ = new Subject();
|
|
3334
|
+
this.isWritingValue = false;
|
|
3335
|
+
this.isStable = false;
|
|
3336
|
+
this.isUpdatingParent = false;
|
|
3334
3337
|
if (ngControl) {
|
|
3335
3338
|
// Setting the value accessor directly (instead of using
|
|
3336
3339
|
// the providers `NG_VALUE_ACCESSOR`) to avoid running into a circular import.
|
|
@@ -3377,9 +3380,9 @@ class GioFormJsonSchemaComponent {
|
|
|
3377
3380
|
// Sync control value with default value (without emit event) as long as the component is not ready
|
|
3378
3381
|
// When formly is initialised, it emits several values as it builds up step by step.
|
|
3379
3382
|
this.formGroup.valueChanges
|
|
3380
|
-
.pipe(distinctUntilChanged(isEqual), tap(value => {
|
|
3381
|
-
this.
|
|
3382
|
-
}), takeUntil(this.
|
|
3383
|
+
.pipe(distinctUntilChanged(isEqual), filter(() => !this.isWritingValue && this.isStable), tap(value => {
|
|
3384
|
+
this.syncValueToParent(value);
|
|
3385
|
+
}), takeUntil(this.unsubscribe$))
|
|
3383
3386
|
.subscribe();
|
|
3384
3387
|
// Avoid ExpressionChangedAfterItHasBeenCheckedError on project
|
|
3385
3388
|
this.changeDetectorRef.markForCheck();
|
|
@@ -3437,7 +3440,22 @@ class GioFormJsonSchemaComponent {
|
|
|
3437
3440
|
}
|
|
3438
3441
|
// From ControlValueAccessor
|
|
3439
3442
|
writeValue(value) {
|
|
3443
|
+
if (this.isUpdatingParent)
|
|
3444
|
+
return;
|
|
3445
|
+
this.isWritingValue = true;
|
|
3446
|
+
this.isStable = false;
|
|
3440
3447
|
this.model = cloneDeep(value) ?? {};
|
|
3448
|
+
setTimeout(() => {
|
|
3449
|
+
this.isWritingValue = false;
|
|
3450
|
+
this.isStable = true;
|
|
3451
|
+
this.syncValueToParent(this.formGroup.value);
|
|
3452
|
+
this.changeDetectorRef.markForCheck();
|
|
3453
|
+
}, 0);
|
|
3454
|
+
}
|
|
3455
|
+
syncValueToParent(value) {
|
|
3456
|
+
this.isUpdatingParent = true;
|
|
3457
|
+
this.ngControl?.control?.setValue(value, { emitEvent: false });
|
|
3458
|
+
this.isUpdatingParent = false;
|
|
3441
3459
|
}
|
|
3442
3460
|
// From ControlValueAccessor
|
|
3443
3461
|
registerOnChange(fn) {
|