@gravitee/ui-particles-angular 5.21.0 → 5.22.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.
@@ -2839,6 +2839,7 @@ class GioFormlyJsonSchemaService {
2839
2839
  mappedField = this.formatMap(mappedField, mapSource);
2840
2840
  mappedField = this.bannerMap(mappedField, mapSource);
2841
2841
  mappedField = this.toggleMap(mappedField, mapSource);
2842
+ mappedField = this.disabledMap(mappedField, mapSource);
2842
2843
  return mappedField;
2843
2844
  },
2844
2845
  });
@@ -2879,6 +2880,13 @@ class GioFormlyJsonSchemaService {
2879
2880
  }
2880
2881
  return mappedField;
2881
2882
  }
2883
+ disabledMap(mappedField, _mapSource) {
2884
+ mappedField.expressions = {
2885
+ ...mappedField.expressions,
2886
+ 'props.disabled': field => field.options?.formState.disabled === true || field.props?.disabled === true,
2887
+ };
2888
+ return mappedField;
2889
+ }
2882
2890
  }
2883
2891
  GioFormlyJsonSchemaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormlyJsonSchemaService, deps: [{ token: i1$3.FormlyJsonschema }, { token: i1$4.FormlyFormBuilder }], target: i0.ɵɵFactoryTarget.Injectable });
2884
2892
  GioFormlyJsonSchemaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormlyJsonSchemaService });
@@ -2921,6 +2929,7 @@ class GioFormJsonSchemaComponent {
2921
2929
  this.model = {};
2922
2930
  this.fields = [];
2923
2931
  this.loading = true;
2932
+ this.isDisabled = false;
2924
2933
  this._onChange = () => ({});
2925
2934
  this._onTouched = () => ({});
2926
2935
  this.touched = false;
@@ -2934,6 +2943,9 @@ class GioFormJsonSchemaComponent {
2934
2943
  fm.monitor(elRef.nativeElement, true)
2935
2944
  .pipe(takeUntil(this.unsubscribe$))
2936
2945
  .subscribe(() => {
2946
+ if (this.isDisabled) {
2947
+ return;
2948
+ }
2937
2949
  this._onTouched();
2938
2950
  this.touched = true;
2939
2951
  });
@@ -2951,6 +2963,9 @@ class GioFormJsonSchemaComponent {
2951
2963
  // Subscribe to state changes to manage touches, status and value
2952
2964
  this.stateChanges$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2953
2965
  const { status, value, touched } = this.formGroup;
2966
+ if (this.isDisabled) {
2967
+ return;
2968
+ }
2954
2969
  if (touched) {
2955
2970
  this._onTouched();
2956
2971
  this.touched = true;
@@ -2971,6 +2986,9 @@ class GioFormJsonSchemaComponent {
2971
2986
  parentControl?.statusChanges
2972
2987
  ?.pipe(takeUntil(this.unsubscribe$), map(() => parentControl?.touched), filter(touched => touched === true), distinctUntilChanged())
2973
2988
  .subscribe(() => {
2989
+ if (this.isDisabled) {
2990
+ return;
2991
+ }
2974
2992
  this.formGroup.markAllAsTouched();
2975
2993
  this.stateChanges$.next();
2976
2994
  });
@@ -3002,8 +3020,20 @@ class GioFormJsonSchemaComponent {
3002
3020
  this._onTouched = fn;
3003
3021
  }
3004
3022
  // From ControlValueAccessor
3005
- setDisabledState(_isDisabled) {
3006
- throw new Error('Method not implemented.');
3023
+ setDisabledState(isDisabled) {
3024
+ if (this.isDisabled === isDisabled) {
3025
+ return;
3026
+ }
3027
+ this.isDisabled = isDisabled;
3028
+ this.options = {
3029
+ ...this.options,
3030
+ formState: {
3031
+ ...this.options.formState,
3032
+ disabled: isDisabled,
3033
+ },
3034
+ };
3035
+ isDisabled ? this.formGroup.disable() : this.formGroup.enable();
3036
+ this.stateChanges$.next();
3007
3037
  }
3008
3038
  }
3009
3039
  GioFormJsonSchemaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, deps: [{ token: GioFormlyJsonSchemaService }, { token: i0.ElementRef }, { token: i2$2.FocusMonitor }, { token: i0.ChangeDetectorRef }, { token: i7.NgControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });