@gravitee/ui-particles-angular 7.36.0 → 7.37.0

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.
@@ -3333,9 +3333,12 @@ class GioFormJsonSchemaComponent {
3333
3333
  this.gioFormFocusInvalidIgnore = true;
3334
3334
  this.formGroup = new FormGroup({});
3335
3335
  this.options = {};
3336
+ // When true the form is ready and control status are up-to-date
3337
+ // Useful to know when initial control status can be used
3338
+ this.ready = new EventEmitter();
3339
+ this.isReady = false;
3336
3340
  this.model = {};
3337
3341
  this.fields = [];
3338
- this.loading = true;
3339
3342
  this.isDisabled = false;
3340
3343
  this._onChange = () => ({});
3341
3344
  this._onTouched = () => ({});
@@ -3367,6 +3370,12 @@ class GioFormJsonSchemaComponent {
3367
3370
  this.fields = [this.gioFormlyJsonSchema.toFormlyFieldConfig(jsonSchema)];
3368
3371
  }
3369
3372
  }
3373
+ ngOnChanges(changes) {
3374
+ if (changes.jsonSchema) {
3375
+ this.isReady = false;
3376
+ this.ready.next(false);
3377
+ }
3378
+ }
3370
3379
  ngOnInit() {
3371
3380
  // When the parent form is touched, mark all the sub formGroup as touched if not already touched
3372
3381
  const parentControl = this.ngControl?.control?.parent;
@@ -3412,16 +3421,26 @@ class GioFormJsonSchemaComponent {
3412
3421
  this.ngControl?.control?.updateValueAndValidity({
3413
3422
  emitEvent: false,
3414
3423
  });
3424
+ // After the first state change, the form is ready
3425
+ if (!this.isReady) {
3426
+ this.isReady = true;
3427
+ this.ready.emit(true);
3428
+ }
3415
3429
  });
3416
3430
  }
3417
3431
  ngAfterViewInit() {
3432
+ // Init control value with default value without emit event
3433
+ this.ngControl?.control?.setValue(this.formGroup.value, { emitEvent: false });
3434
+ this.changeDetectorRef.markForCheck();
3435
+ this.changeDetectorRef.detectChanges();
3418
3436
  // Group all valueChanges events emit by formly in a single one
3419
3437
  merge(this.formGroup.statusChanges, this.formGroup.valueChanges)
3420
- .pipe(debounceTime(100), takeUntil(this.unsubscribe$))
3438
+ .pipe(
3439
+ // Force fist stateChanges$
3440
+ startWith({}), debounceTime(100), takeUntil(this.unsubscribe$))
3421
3441
  .subscribe(() => {
3422
3442
  this.stateChanges$.next();
3423
3443
  });
3424
- this.stateChanges$.next();
3425
3444
  }
3426
3445
  ngOnDestroy() {
3427
3446
  this.unsubscribe$.next();
@@ -3456,7 +3475,7 @@ class GioFormJsonSchemaComponent {
3456
3475
  }
3457
3476
  }
3458
3477
  GioFormJsonSchemaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, deps: [{ token: GioFormlyJsonSchemaService }, { token: i0.ElementRef }, { token: i1$1.FocusMonitor }, { token: i0.ChangeDetectorRef }, { token: i7.NgControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });
3459
- GioFormJsonSchemaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormJsonSchemaComponent, selector: "gio-form-json-schema", inputs: { jsonSchema: "jsonSchema", options: "options" }, host: { properties: { "attr.gioFormFocusInvalidIgnore": "this.gioFormFocusInvalidIgnore" } }, ngImport: i0, template: `<formly-form *ngIf="formGroup" [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`, isInline: true, styles: ["::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{margin-bottom:-1.34375em}\n"], components: [{ type: i1$5.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
3478
+ GioFormJsonSchemaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormJsonSchemaComponent, selector: "gio-form-json-schema", inputs: { jsonSchema: "jsonSchema", options: "options" }, outputs: { ready: "ready" }, host: { properties: { "attr.gioFormFocusInvalidIgnore": "this.gioFormFocusInvalidIgnore" } }, usesOnChanges: true, ngImport: i0, template: `<formly-form *ngIf="formGroup" [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`, isInline: true, styles: ["::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{margin-bottom:-1.34375em}\n"], components: [{ type: i1$5.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
3460
3479
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, decorators: [{
3461
3480
  type: Component,
3462
3481
  args: [{ selector: 'gio-form-json-schema', template: `<formly-form *ngIf="formGroup" [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`, styles: ["::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-outline:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)){padding-bottom:0}::ng-deep gio-form-json-schema .mat-form-field.mat-form-field-appearance-fill:not(::ng-deep :has(mat-hint),::ng-deep :has(mat-error)) .mat-form-field-wrapper{margin-bottom:-1.34375em}\n"] }]
@@ -3471,6 +3490,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3471
3490
  type: Input
3472
3491
  }], options: [{
3473
3492
  type: Input
3493
+ }], ready: [{
3494
+ type: Output
3474
3495
  }] } });
3475
3496
 
3476
3497
  /*