@gravitee/ui-particles-angular 5.14.0-improve-json-schema-preview-57932da → 5.14.0-renovate-all-devdependencies-minor-patch-e52fed3

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.
@@ -1,7 +1,7 @@
1
1
  import { trigger, transition, style, animate } from '@angular/animations';
2
2
  import * as i0 from '@angular/core';
3
3
  import { EventEmitter, Component, HostBinding, Input, Output, HostListener, NgModule, Optional, Self, ViewChild, Directive, Inject, forwardRef, ChangeDetectionStrategy, Injectable, ViewEncapsulation, ContentChildren, Host, ContentChild, InjectionToken } from '@angular/core';
4
- import { timer, Subject, fromEvent, of, BehaviorSubject, combineLatest, ReplaySubject } from 'rxjs';
4
+ import { timer, Subject, fromEvent, of, BehaviorSubject, ReplaySubject } from 'rxjs';
5
5
  import * as i1 from '@angular/material/card';
6
6
  import { MatCardModule } from '@angular/material/card';
7
7
  import * as i2 from '@angular/material/button';
@@ -2797,7 +2797,6 @@ class GioFormlyJsonSchemaService {
2797
2797
  return this.formlyJsonschema.toFieldConfig(jsonSchema, {
2798
2798
  map: (mappedField, mapSource) => {
2799
2799
  mappedField = this.uiTypeMap(mappedField, mapSource);
2800
- mappedField = this.formatMap(mappedField, mapSource);
2801
2800
  mappedField = this.bannerMap(mappedField, mapSource);
2802
2801
  mappedField = this.toggleMap(mappedField, mapSource);
2803
2802
  return mappedField;
@@ -2808,22 +2807,6 @@ class GioFormlyJsonSchemaService {
2808
2807
  mappedField.type = mapSource.gioConfig?.uiType ?? mappedField.type;
2809
2808
  return mappedField;
2810
2809
  }
2811
- formatMap(mappedField, mapSource) {
2812
- if (mapSource.type === 'string' && mapSource.format === 'text') {
2813
- mappedField.type = 'textarea';
2814
- mappedField.props = {
2815
- ...mappedField.props,
2816
- autosize: true,
2817
- };
2818
- }
2819
- else if (mapSource.type === 'string' && mapSource.format === 'password') {
2820
- mappedField.props = {
2821
- ...mappedField.props,
2822
- type: 'password',
2823
- };
2824
- }
2825
- return mappedField;
2826
- }
2827
2810
  bannerMap(mappedField, mapSource) {
2828
2811
  mappedField.props = {
2829
2812
  ...mappedField.props,
@@ -2880,7 +2863,6 @@ class GioFormJsonSchemaComponent {
2880
2863
  this._onChange = () => ({});
2881
2864
  this._onTouched = () => ({});
2882
2865
  this.touched = false;
2883
- this.stateChanges$ = new Subject();
2884
2866
  if (ngControl) {
2885
2867
  // Setting the value accessor directly (instead of using
2886
2868
  // the providers `NG_VALUE_ACCESSOR`) to avoid running into a circular import.
@@ -2900,38 +2882,27 @@ class GioFormJsonSchemaComponent {
2900
2882
  }
2901
2883
  }
2902
2884
  ngOnInit() {
2903
- // When the parent form is touched, mark all the sub formGroup as touched ony once
2885
+ // When the parent form is touched, mark all the sub formGroup as touched
2904
2886
  const parentControl = this.ngControl?.control?.parent;
2905
2887
  parentControl?.statusChanges
2906
- ?.pipe(takeUntil(this.unsubscribe$), map(() => parentControl?.touched), filter(touched => touched === true), distinctUntilChanged())
2907
- .subscribe(() => {
2908
- this.formGroup.markAllAsTouched();
2909
- this.stateChanges$.next();
2888
+ ?.pipe(takeUntil(this.unsubscribe$), map(() => parentControl?.touched), filter(touched => touched === true), tap(() => this.formGroup.markAllAsTouched()))
2889
+ .subscribe();
2890
+ this.formGroup.statusChanges.pipe(takeUntil(this.unsubscribe$)).subscribe(status => {
2891
+ if (status === 'VALID') {
2892
+ this.ngControl?.control?.setErrors(null);
2893
+ }
2894
+ if (status === 'INVALID') {
2895
+ this.ngControl?.control?.setErrors({ invalid: true });
2896
+ }
2910
2897
  });
2911
2898
  // To simulate the behavior of classic form controls, emit value only when the form is touched
2912
2899
  // Allow to keep the formControl pristine until the user interact with it
2913
- combineLatest([this.formGroup.statusChanges, this.formGroup.valueChanges])
2900
+ this.formGroup.valueChanges
2914
2901
  .pipe(takeUntil(this.unsubscribe$),
2915
2902
  // Group all valueChanges events emit by formly in a single one
2916
- debounceTime(100))
2917
- .subscribe(() => {
2918
- this.stateChanges$.next();
2919
- });
2920
- this.stateChanges$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2921
- const { status, value, touched } = this.formGroup;
2922
- if (touched) {
2923
- this._onTouched();
2924
- this.touched = true;
2925
- }
2926
- if (this.touched) {
2927
- this._onChange(value);
2928
- if (status === 'VALID') {
2929
- this.ngControl?.control?.setErrors(null);
2930
- }
2931
- if (status === 'INVALID') {
2932
- this.ngControl?.control?.setErrors({ invalid: true });
2933
- }
2934
- }
2903
+ debounceTime(200), filter(() => this.touched))
2904
+ .subscribe(value => {
2905
+ this._onChange(value);
2935
2906
  });
2936
2907
  }
2937
2908
  ngOnDestroy() {
@@ -3383,7 +3354,7 @@ GioFjsMultiSchemaTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
3383
3354
  </div>
3384
3355
  <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
3385
3356
  </div>
3386
- `, isInline: true, styles: [".wrapper__title{font-size:16px;font-weight:500;line-height:24px;font:600 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:4px}.wrapper:empty{display:none}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}\n"], components: [{ type: i1$4.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { type: i1$4.FormlyField, selector: "formly-field", inputs: ["field"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
3357
+ `, isInline: true, styles: [".wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper__title{font-size:16px;font-weight:500;line-height:24px;font:600 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:4px}.wrapper:empty{display:none}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}\n"], components: [{ type: i1$4.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { type: i1$4.FormlyField, selector: "formly-field", inputs: ["field"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
3387
3358
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsMultiSchemaTypeComponent, decorators: [{
3388
3359
  type: Component,
3389
3360
  args: [{ selector: 'gio-fjs-multi-schema-type', template: `
@@ -3395,7 +3366,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3395
3366
  </div>
3396
3367
  <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
3397
3368
  </div>
3398
- `, styles: [".wrapper__title{font-size:16px;font-weight:500;line-height:24px;font:600 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:4px}.wrapper:empty{display:none}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}\n"] }]
3369
+ `, styles: [".wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper__title{font-size:16px;font-weight:500;line-height:24px;font:600 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:4px}.wrapper:empty{display:none}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}\n"] }]
3399
3370
  }] });
3400
3371
 
3401
3372
  /*
@@ -3533,74 +3504,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3533
3504
  `, styles: [".wrapper{display:flex;flex-direction:column;padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper__header{display:flex}.wrapper__header__text{flex:1 1 auto}.wrapper__header__text__title{font:600 16px/24px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:8px}.wrapper__header__collapse{flex:0 0 auto}.wrapper__header__collapse .collapse-open{transform:rotate(180deg);transition:transform 225ms cubic-bezier(.4,0,.2,1)}.wrapper__header__collapse .collapse-close{transform:rotate(0);transition:transform 225ms cubic-bezier(.4,0,.2,1)}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}\n"] }]
3534
3505
  }] });
3535
3506
 
3536
- /*
3537
- * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
3538
- *
3539
- * Licensed under the Apache License, Version 2.0 (the "License");
3540
- * you may not use this file except in compliance with the License.
3541
- * You may obtain a copy of the License at
3542
- *
3543
- * http://www.apache.org/licenses/LICENSE-2.0
3544
- *
3545
- * Unless required by applicable law or agreed to in writing, software
3546
- * distributed under the License is distributed on an "AS IS" BASIS,
3547
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3548
- * See the License for the specific language governing permissions and
3549
- * limitations under the License.
3550
- */
3551
- class GioPasswordEyeWrapperComponent extends FieldWrapper {
3552
- constructor() {
3553
- super(...arguments);
3554
- this.hide = true;
3555
- }
3556
- ngAfterViewInit() {
3557
- if (this.matSuffix) {
3558
- this.props.suffix = this.matSuffix;
3559
- }
3560
- }
3561
- addonEyeClick($event) {
3562
- $event.stopPropagation();
3563
- this.hide = !this.hide;
3564
- this.props.type = this.hide ? 'password' : 'text';
3565
- }
3566
- }
3567
- GioPasswordEyeWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPasswordEyeWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3568
- GioPasswordEyeWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioPasswordEyeWrapperComponent, selector: "gio-password-eye-wrapper", viewQueries: [{ propertyName: "matSuffix", first: true, predicate: ["matSuffix"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: `
3569
- <ng-container #fieldComponent></ng-container>
3570
-
3571
- <ng-template #matSuffix>
3572
- <span style="cursor: pointer" (click)="addonEyeClick($event)">
3573
- <mat-icon [svgIcon]="hide ? 'gio:eye-empty' : 'gio:eye-off'"></mat-icon>
3574
- </span>
3575
- </ng-template>
3576
- `, isInline: true, components: [{ type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
3577
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPasswordEyeWrapperComponent, decorators: [{
3578
- type: Component,
3579
- args: [{
3580
- selector: 'gio-password-eye-wrapper',
3581
- template: `
3582
- <ng-container #fieldComponent></ng-container>
3583
-
3584
- <ng-template #matSuffix>
3585
- <span style="cursor: pointer" (click)="addonEyeClick($event)">
3586
- <mat-icon [svgIcon]="hide ? 'gio:eye-empty' : 'gio:eye-off'"></mat-icon>
3587
- </span>
3588
- </ng-template>
3589
- `,
3590
- }]
3591
- }], propDecorators: { matSuffix: [{
3592
- type: ViewChild,
3593
- args: ['matSuffix', { static: true }]
3594
- }] } });
3595
- function passwordEyeExtension(field) {
3596
- if (!field.props || (field.wrappers && field.wrappers.indexOf('gio-password-eye') !== -1)) {
3597
- return;
3598
- }
3599
- if (field.props.type === 'password') {
3600
- field.wrappers = [...(field.wrappers || []), 'gio-password-eye'];
3601
- }
3602
- }
3603
-
3604
3507
  /*
3605
3508
  * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
3606
3509
  *
@@ -3626,8 +3529,7 @@ GioFormJsonSchemaModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0",
3626
3529
  GioFjsArrayTypeComponent,
3627
3530
  GioFjsToggleTypeComponent,
3628
3531
  GioFjsHeadersTypeComponent,
3629
- GioFormFieldWrapperComponent,
3630
- GioPasswordEyeWrapperComponent], imports: [CommonModule,
3532
+ GioFormFieldWrapperComponent], imports: [CommonModule,
3631
3533
  A11yModule,
3632
3534
  ReactiveFormsModule, i1$4.FormlyModule, FormlyMaterialModule,
3633
3535
  GioIconsModule,
@@ -3655,10 +3557,7 @@ GioFormJsonSchemaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
3655
3557
  { name: 'uniqueItems', message: 'Should NOT have duplicate items' },
3656
3558
  { name: 'const', message: constValidationMessage },
3657
3559
  ],
3658
- wrappers: [
3659
- { name: 'gio-with-banner', component: GioFormFieldWrapperComponent },
3660
- { name: 'gio-password-eye', component: GioPasswordEyeWrapperComponent },
3661
- ],
3560
+ wrappers: [{ name: 'gio-with-banner', component: GioFormFieldWrapperComponent }],
3662
3561
  types: [
3663
3562
  { name: 'null', component: GioFjsNullTypeComponent, wrappers: ['form-field'] },
3664
3563
  { name: 'array', component: GioFjsArrayTypeComponent },
@@ -3673,10 +3572,7 @@ GioFormJsonSchemaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
3673
3572
  component: GioFjsHeadersTypeComponent,
3674
3573
  },
3675
3574
  ],
3676
- extensions: [
3677
- { name: 'banner', extension: { onPopulate: bannerExtension } },
3678
- { name: 'password-eye', extension: { onPopulate: passwordEyeExtension } },
3679
- ],
3575
+ extensions: [{ name: 'banner', extension: { onPopulate: bannerExtension } }],
3680
3576
  extras: {
3681
3577
  checkExpressionOn: 'changeDetectionCheck',
3682
3578
  },
@@ -3700,7 +3596,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3700
3596
  GioFjsToggleTypeComponent,
3701
3597
  GioFjsHeadersTypeComponent,
3702
3598
  GioFormFieldWrapperComponent,
3703
- GioPasswordEyeWrapperComponent,
3704
3599
  ],
3705
3600
  imports: [
3706
3601
  CommonModule,
@@ -3722,10 +3617,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3722
3617
  { name: 'uniqueItems', message: 'Should NOT have duplicate items' },
3723
3618
  { name: 'const', message: constValidationMessage },
3724
3619
  ],
3725
- wrappers: [
3726
- { name: 'gio-with-banner', component: GioFormFieldWrapperComponent },
3727
- { name: 'gio-password-eye', component: GioPasswordEyeWrapperComponent },
3728
- ],
3620
+ wrappers: [{ name: 'gio-with-banner', component: GioFormFieldWrapperComponent }],
3729
3621
  types: [
3730
3622
  { name: 'null', component: GioFjsNullTypeComponent, wrappers: ['form-field'] },
3731
3623
  { name: 'array', component: GioFjsArrayTypeComponent },
@@ -3740,10 +3632,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3740
3632
  component: GioFjsHeadersTypeComponent,
3741
3633
  },
3742
3634
  ],
3743
- extensions: [
3744
- { name: 'banner', extension: { onPopulate: bannerExtension } },
3745
- { name: 'password-eye', extension: { onPopulate: passwordEyeExtension } },
3746
- ],
3635
+ extensions: [{ name: 'banner', extension: { onPopulate: bannerExtension } }],
3747
3636
  extras: {
3748
3637
  checkExpressionOn: 'changeDetectionCheck',
3749
3638
  },
@@ -3799,17 +3688,17 @@ class GioFormFocusInvalidDirective {
3799
3688
  onFormSubmit() {
3800
3689
  const selector = '.ng-invalid[formControlName],input.ng-invalid,mat-select.ng-invalid,textarea.ng-invalid,.gio-ng-invalid';
3801
3690
  try {
3802
- // Mark all controls as touched to display errors
3803
- if (this.formGroupDirective) {
3804
- this.formGroupDirective.control.markAllAsTouched();
3805
- this.formGroupDirective.control.updateValueAndValidity();
3806
- }
3807
3691
  let invalidControl = this.renderer.selectRootElement(selector, true);
3808
3692
  // If the form is a GioFormJsonSchema, we need to focus the first invalid control inside
3809
3693
  if (invalidControl.tagName === 'GIO-FORM-JSON-SCHEMA') {
3810
3694
  invalidControl = invalidControl.querySelector(selector);
3811
3695
  }
3812
3696
  if (invalidControl) {
3697
+ // Mark all controls as touched to display errors
3698
+ if (this.formGroupDirective) {
3699
+ this.formGroupDirective.control.markAllAsTouched();
3700
+ this.formGroupDirective.control.updateValueAndValidity();
3701
+ }
3813
3702
  invalidControl.scrollIntoView({ behavior: 'smooth', block: 'center' });
3814
3703
  invalidControl.focus({ preventScroll: true });
3815
3704
  }