@gravitee/ui-particles-angular 5.20.1 → 5.21.0-json-schema-disabled-95af247

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.
Files changed (31) hide show
  1. package/assets/gio-icons.svg +1040 -1005
  2. package/esm2020/lib/gio-form-json-schema/gio-form-json-schema.component.mjs +25 -3
  3. package/esm2020/lib/gio-form-json-schema/gio-form-json-schema.module.mjs +27 -6
  4. package/esm2020/lib/gio-form-json-schema/gio-formly-json-schema.service.mjs +12 -1
  5. package/esm2020/lib/gio-form-json-schema/model/GioJsonSchema.mjs +1 -1
  6. package/esm2020/lib/gio-form-json-schema/type-component/code-editor-type.component.mjs +58 -0
  7. package/esm2020/lib/gio-form-json-schema/wrappers/gio-banner-wrapper.component.mjs +28 -0
  8. package/esm2020/lib/gio-monaco-editor/gio-monaco-editor-form-field.directive.mjs +149 -0
  9. package/esm2020/lib/gio-monaco-editor/gio-monaco-editor.component.mjs +26 -28
  10. package/esm2020/lib/gio-monaco-editor/gio-monaco-editor.module.mjs +5 -4
  11. package/esm2020/lib/gio-monaco-editor/gio-monaco-editor.testing.component.mjs +3 -17
  12. package/esm2020/lib/gio-monaco-editor/services/gio-language-json.service.mjs +2 -1
  13. package/esm2020/lib/public-api.mjs +2 -1
  14. package/fesm2015/gravitee-ui-particles-angular.mjs +1058 -830
  15. package/fesm2015/gravitee-ui-particles-angular.mjs.map +1 -1
  16. package/fesm2020/gravitee-ui-particles-angular.mjs +1070 -840
  17. package/fesm2020/gravitee-ui-particles-angular.mjs.map +1 -1
  18. package/lib/gio-form-json-schema/gio-form-json-schema.component.d.ts +2 -1
  19. package/lib/gio-form-json-schema/gio-form-json-schema.module.d.ts +16 -13
  20. package/lib/gio-form-json-schema/gio-formly-json-schema.service.d.ts +1 -0
  21. package/lib/gio-form-json-schema/model/GioJsonSchema.d.ts +4 -1
  22. package/lib/gio-form-json-schema/type-component/code-editor-type.component.d.ts +13 -0
  23. package/lib/gio-form-json-schema/wrappers/gio-banner-wrapper.component.d.ts +6 -0
  24. package/lib/gio-monaco-editor/gio-monaco-editor-form-field.directive.d.ts +45 -0
  25. package/lib/gio-monaco-editor/gio-monaco-editor.component.d.ts +9 -8
  26. package/lib/gio-monaco-editor/gio-monaco-editor.module.d.ts +5 -4
  27. package/lib/gio-monaco-editor/services/gio-language-json.service.d.ts +1 -0
  28. package/lib/public-api.d.ts +1 -0
  29. package/package.json +1 -1
  30. package/esm2020/lib/gio-form-json-schema/wrappers/gio-form-field-wrapper.component.mjs +0 -28
  31. package/lib/gio-form-json-schema/wrappers/gio-form-field-wrapper.component.d.ts +0 -6
@@ -12,7 +12,7 @@ import { ComponentHarness, HarnessPredicate, parallel, TestKey } from '@angular/
12
12
  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
- import { isEmpty, toLower, dropRight, isNil, isArray, remove, isObject, cloneDeep, set, uniqueId } from 'lodash';
15
+ import { isEmpty, toLower, dropRight, isNil, isArray, remove, isObject, cloneDeep, uniqueId, set } from 'lodash';
16
16
  import { startWith, map, distinctUntilChanged, tap, debounce, takeUntil, delay, filter, switchMap, 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';
@@ -46,7 +46,7 @@ import { toSvg } from 'jdenticon';
46
46
  import * as i1$3 from '@ngx-formly/core/json-schema';
47
47
  import * as i1$4 from '@ngx-formly/core';
48
48
  import { FieldType, FieldArrayType, FieldWrapper, FormlyModule } from '@ngx-formly/core';
49
- import { FormlyMaterialModule } from '@ngx-formly/material';
49
+ import { FieldType as FieldType$1, FormlyMaterialModule } from '@ngx-formly/material';
50
50
  import * as i3$2 from '@angular/material/slide-toggle';
51
51
  import { MatSlideToggle, MatSlideToggleModule } from '@angular/material/slide-toggle';
52
52
  import { TestBed } from '@angular/core/testing';
@@ -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
  });
@@ -2861,6 +2862,9 @@ class GioFormlyJsonSchemaService {
2861
2862
  type: 'password',
2862
2863
  };
2863
2864
  }
2865
+ else if (mapSource.type === 'string' && mapSource.format === 'gio-code-editor') {
2866
+ mappedField.type = 'gio-code-editor';
2867
+ }
2864
2868
  return mappedField;
2865
2869
  }
2866
2870
  bannerMap(mappedField, mapSource) {
@@ -2876,6 +2880,13 @@ class GioFormlyJsonSchemaService {
2876
2880
  }
2877
2881
  return mappedField;
2878
2882
  }
2883
+ disabledMap(mappedField, _mapSource) {
2884
+ mappedField.expressions = {
2885
+ ...mappedField.expressions,
2886
+ 'props.disabled': 'formState.disabled',
2887
+ };
2888
+ return mappedField;
2889
+ }
2879
2890
  }
2880
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 });
2881
2892
  GioFormlyJsonSchemaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormlyJsonSchemaService });
@@ -2918,6 +2929,7 @@ class GioFormJsonSchemaComponent {
2918
2929
  this.model = {};
2919
2930
  this.fields = [];
2920
2931
  this.loading = true;
2932
+ this.isDisabled = false;
2921
2933
  this._onChange = () => ({});
2922
2934
  this._onTouched = () => ({});
2923
2935
  this.touched = false;
@@ -2931,6 +2943,9 @@ class GioFormJsonSchemaComponent {
2931
2943
  fm.monitor(elRef.nativeElement, true)
2932
2944
  .pipe(takeUntil(this.unsubscribe$))
2933
2945
  .subscribe(() => {
2946
+ if (this.isDisabled) {
2947
+ return;
2948
+ }
2934
2949
  this._onTouched();
2935
2950
  this.touched = true;
2936
2951
  });
@@ -2948,6 +2963,9 @@ class GioFormJsonSchemaComponent {
2948
2963
  // Subscribe to state changes to manage touches, status and value
2949
2964
  this.stateChanges$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
2950
2965
  const { status, value, touched } = this.formGroup;
2966
+ if (this.isDisabled) {
2967
+ return;
2968
+ }
2951
2969
  if (touched) {
2952
2970
  this._onTouched();
2953
2971
  this.touched = true;
@@ -2968,6 +2986,9 @@ class GioFormJsonSchemaComponent {
2968
2986
  parentControl?.statusChanges
2969
2987
  ?.pipe(takeUntil(this.unsubscribe$), map(() => parentControl?.touched), filter(touched => touched === true), distinctUntilChanged())
2970
2988
  .subscribe(() => {
2989
+ if (this.isDisabled) {
2990
+ return;
2991
+ }
2971
2992
  this.formGroup.markAllAsTouched();
2972
2993
  this.stateChanges$.next();
2973
2994
  });
@@ -2999,8 +3020,20 @@ class GioFormJsonSchemaComponent {
2999
3020
  this._onTouched = fn;
3000
3021
  }
3001
3022
  // From ControlValueAccessor
3002
- setDisabledState(_isDisabled) {
3003
- 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();
3004
3037
  }
3005
3038
  }
3006
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 });
@@ -3176,67 +3209,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3176
3209
  * See the License for the specific language governing permissions and
3177
3210
  * limitations under the License.
3178
3211
  */
3179
- class GioFjsNullTypeComponent extends FieldType {
3180
- }
3181
- GioFjsNullTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsNullTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3182
- GioFjsNullTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsNullTypeComponent, selector: "gio-fjs-null-type", usesInheritance: true, ngImport: i0, template: ``, isInline: true });
3183
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsNullTypeComponent, decorators: [{
3184
- type: Component,
3185
- args: [{
3186
- selector: 'gio-fjs-null-type',
3187
- template: ``,
3188
- }]
3189
- }] });
3190
-
3191
- /*
3192
- * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
3193
- *
3194
- * Licensed under the Apache License, Version 2.0 (the "License");
3195
- * you may not use this file except in compliance with the License.
3196
- * You may obtain a copy of the License at
3197
- *
3198
- * http://www.apache.org/licenses/LICENSE-2.0
3199
- *
3200
- * Unless required by applicable law or agreed to in writing, software
3201
- * distributed under the License is distributed on an "AS IS" BASIS,
3202
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3203
- * See the License for the specific language governing permissions and
3204
- * limitations under the License.
3205
- */
3206
- class GioFjsObjectTypeComponent extends FieldType {
3207
- }
3208
- GioFjsObjectTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsObjectTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3209
- GioFjsObjectTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsObjectTypeComponent, selector: "gio-fjs-object-type", usesInheritance: true, ngImport: i0, template: `
3210
- <div class="wrapper">
3211
- <div class="wrapper__title" *ngIf="to.label">{{ to.label }}</div>
3212
- <p *ngIf="to.description">{{ to.description }}</p>
3213
- <div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
3214
- <formly-validation-message [field]="field"></formly-validation-message>
3215
- </div>
3216
- <div class="wrapper__fields">
3217
- <ng-container *ngFor="let f of field.fieldGroup">
3218
- <formly-field *ngIf="f.type" class="wrapper__fields__field" [field]="f"></formly-field>
3219
- </ng-container>
3220
- </div>
3221
- </div>
3222
- `, isInline: true, styles: [".wrapper{display:flex;flex-direction:column}.wrapper__title{font:600 18px/24px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:16px}.wrapper:empty{display:none}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}.wrapper__fields{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper__fields:empty{display:none}.wrapper__fields:has(> .wrapper__fields__field:only-child):has(> .wrapper__fields__field:empty){display:none}.wrapper__fields__field:empty{display:none}.wrapper__fields__field+.wrapper__fields__field:not(:empty){display:block;margin-top:8px}\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"] }] });
3223
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsObjectTypeComponent, decorators: [{
3224
- type: Component,
3225
- args: [{ selector: 'gio-fjs-object-type', template: `
3226
- <div class="wrapper">
3227
- <div class="wrapper__title" *ngIf="to.label">{{ to.label }}</div>
3228
- <p *ngIf="to.description">{{ to.description }}</p>
3229
- <div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
3230
- <formly-validation-message [field]="field"></formly-validation-message>
3231
- </div>
3232
- <div class="wrapper__fields">
3233
- <ng-container *ngFor="let f of field.fieldGroup">
3234
- <formly-field *ngIf="f.type" class="wrapper__fields__field" [field]="f"></formly-field>
3235
- </ng-container>
3236
- </div>
3237
- </div>
3238
- `, styles: [".wrapper{display:flex;flex-direction:column}.wrapper__title{font:600 18px/24px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:16px}.wrapper:empty{display:none}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}.wrapper__fields{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper__fields:empty{display:none}.wrapper__fields:has(> .wrapper__fields__field:only-child):has(> .wrapper__fields__field:empty){display:none}.wrapper__fields__field:empty{display:none}.wrapper__fields__field+.wrapper__fields__field:not(:empty){display:block;margin-top:8px}\n"] }]
3239
- }] });
3212
+ const GIO_MONACO_EDITOR_CONFIG = new InjectionToken('gio-monaco-editor-config');
3240
3213
 
3241
3214
  /*
3242
3215
  * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
@@ -3253,119 +3226,55 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3253
3226
  * See the License for the specific language governing permissions and
3254
3227
  * limitations under the License.
3255
3228
  */
3256
- class GioFjsArrayTypeComponent extends FieldArrayType {
3229
+ class GioMonacoEditorService {
3257
3230
  constructor() {
3258
- super(...arguments);
3259
- this.collapse = false;
3231
+ this.loaded$ = new ReplaySubject(1);
3232
+ this.loaded = false;
3233
+ }
3234
+ loadEditor() {
3235
+ if (this.loaded) {
3236
+ // Already loaded, do nothing.
3237
+ return Promise.resolve();
3238
+ }
3239
+ this.loaded = true;
3240
+ return new Promise(resolve => {
3241
+ // Monaco is already loaded
3242
+ if (typeof window.monaco === 'object') {
3243
+ resolve();
3244
+ return;
3245
+ }
3246
+ const onGotAmdLoader = () => {
3247
+ // Load Monaco
3248
+ window.require.config({ paths: { vs: 'assets/monaco-editor/min/vs' } });
3249
+ window.require(['vs/editor/editor.main'], () => {
3250
+ resolve();
3251
+ });
3252
+ };
3253
+ // Load AMD loader if necessary
3254
+ if (!window.require) {
3255
+ const loaderScript = document.createElement('script');
3256
+ loaderScript.type = 'text/javascript';
3257
+ loaderScript.src = 'assets/monaco-editor/min/vs/loader.js';
3258
+ loaderScript.addEventListener('load', onGotAmdLoader);
3259
+ document.body.appendChild(loaderScript);
3260
+ }
3261
+ else {
3262
+ onGotAmdLoader();
3263
+ }
3264
+ }).then(() => {
3265
+ this.loaded$.next({ monaco: window.monaco });
3266
+ });
3260
3267
  }
3261
3268
  }
3262
- GioFjsArrayTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsArrayTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3263
- GioFjsArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsArrayTypeComponent, selector: "gio-fjs-array-type", usesInheritance: true, ngImport: i0, template: `
3264
- <div class="wrapper" [class.error]="formControl.touched && formControl.invalid">
3265
- <div class="wrapper__header">
3266
- <div class="wrapper__header__text">
3267
- <div class="wrapper__header__text__title" *ngIf="to.label">{{ to.label }}</div>
3268
- <p *ngIf="to.description">{{ to.description }}</p>
3269
- </div>
3270
- <div class="wrapper__header__collapse">
3271
- <button type="button" mat-icon-button aria-label="Collapse" (click)="collapse = !collapse">
3272
- <mat-icon [class.collapse-open]="collapse" [class.collapse-close]="!collapse" svgIcon="gio:nav-arrow-down"></mat-icon>
3273
- </button>
3274
- </div>
3275
- </div>
3276
-
3277
- <div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
3278
- <formly-validation-message [field]="field"></formly-validation-message>
3279
- </div>
3280
-
3281
- <div [hidden]="collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
3282
- <div *ngFor="let field of field.fieldGroup; let i = index" class="wrapper__rows__row">
3283
- <formly-field class="wrapper__rows__row__field" [field]="field"></formly-field>
3284
- <div class="wrapper__rows__row__remove">
3285
- <button type="button" mat-icon-button aria-label="Remove" (click)="remove(i)">
3286
- <mat-icon svgIcon="gio:cancel"></mat-icon>
3287
- </button>
3288
- </div>
3289
- </div>
3290
-
3291
- <div>
3292
- <button type="button" mat-stroked-button aria-label="Add" (click)="add()"><mat-icon svgIcon="gio:plus"></mat-icon> Add</button>
3293
- </div>
3294
- </div>
3295
- </div>
3296
- `, isInline: true, styles: [".wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper.error{border-color:#ec4899}.wrapper:empty{display:none}.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}.wrapper__rows__row{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}.wrapper__rows__row+.wrapper__rows__row{padding-top:3px;border-top:1px solid #d3d5dc;margin-top:4px}.wrapper__rows__row__field{flex:1 1 auto}.wrapper__rows__row__remove{flex:0 0 auto}\n"], components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { 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"] }] });
3297
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsArrayTypeComponent, decorators: [{
3298
- type: Component,
3299
- args: [{ selector: 'gio-fjs-array-type', template: `
3300
- <div class="wrapper" [class.error]="formControl.touched && formControl.invalid">
3301
- <div class="wrapper__header">
3302
- <div class="wrapper__header__text">
3303
- <div class="wrapper__header__text__title" *ngIf="to.label">{{ to.label }}</div>
3304
- <p *ngIf="to.description">{{ to.description }}</p>
3305
- </div>
3306
- <div class="wrapper__header__collapse">
3307
- <button type="button" mat-icon-button aria-label="Collapse" (click)="collapse = !collapse">
3308
- <mat-icon [class.collapse-open]="collapse" [class.collapse-close]="!collapse" svgIcon="gio:nav-arrow-down"></mat-icon>
3309
- </button>
3310
- </div>
3311
- </div>
3312
-
3313
- <div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
3314
- <formly-validation-message [field]="field"></formly-validation-message>
3315
- </div>
3316
-
3317
- <div [hidden]="collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
3318
- <div *ngFor="let field of field.fieldGroup; let i = index" class="wrapper__rows__row">
3319
- <formly-field class="wrapper__rows__row__field" [field]="field"></formly-field>
3320
- <div class="wrapper__rows__row__remove">
3321
- <button type="button" mat-icon-button aria-label="Remove" (click)="remove(i)">
3322
- <mat-icon svgIcon="gio:cancel"></mat-icon>
3323
- </button>
3324
- </div>
3325
- </div>
3326
-
3327
- <div>
3328
- <button type="button" mat-stroked-button aria-label="Add" (click)="add()"><mat-icon svgIcon="gio:plus"></mat-icon> Add</button>
3329
- </div>
3330
- </div>
3331
- </div>
3332
- `, styles: [".wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper.error{border-color:#ec4899}.wrapper:empty{display:none}.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}.wrapper__rows__row{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}.wrapper__rows__row+.wrapper__rows__row{padding-top:3px;border-top:1px solid #d3d5dc;margin-top:4px}.wrapper__rows__row__field{flex:1 1 auto}.wrapper__rows__row__remove{flex:0 0 auto}\n"] }]
3269
+ GioMonacoEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3270
+ GioMonacoEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorService, providedIn: 'root' });
3271
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorService, decorators: [{
3272
+ type: Injectable,
3273
+ args: [{
3274
+ providedIn: 'root',
3275
+ }]
3333
3276
  }] });
3334
3277
 
3335
- function minItemsValidationMessage(error, field) {
3336
- return `Should NOT have fewer than ${field.props?.minItems} items`;
3337
- }
3338
- function maxItemsValidationMessage(error, field) {
3339
- return `Should NOT have more than ${field.props?.maxItems} items`;
3340
- }
3341
- function minLengthValidationMessage(error, field) {
3342
- return `Should NOT be shorter than ${field.props?.minLength} characters`;
3343
- }
3344
- function maxLengthValidationMessage(error, field) {
3345
- return `Should NOT be longer than ${field.props?.maxLength} characters`;
3346
- }
3347
- function minValidationMessage(error, field) {
3348
- return `Should be >= ${field.props?.min}`;
3349
- }
3350
- function maxValidationMessage(error, field) {
3351
- return `Should be <= ${field.props?.max}`;
3352
- }
3353
- function multipleOfValidationMessage(error, field) {
3354
- return `Should be multiple of ${field.props?.step}`;
3355
- }
3356
- function exclusiveMinimumValidationMessage(error, field) {
3357
- return `Should be > ${field.props?.step}`;
3358
- }
3359
- function exclusiveMaximumValidationMessage(error, field) {
3360
- return `Should be < ${field.props?.step}`;
3361
- }
3362
- function constValidationMessage(error, field) {
3363
- return `Should be equal to constant "${field.props?.const}"`;
3364
- }
3365
- function typeValidationMessage({ schemaType }) {
3366
- return `Should be "${schemaType[0]}".`;
3367
- }
3368
-
3369
3278
  /*
3370
3279
  * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
3371
3280
  *
@@ -3381,28 +3290,61 @@ function typeValidationMessage({ schemaType }) {
3381
3290
  * See the License for the specific language governing permissions and
3382
3291
  * limitations under the License.
3383
3292
  */
3384
- class GioFormFieldWrapperComponent extends FieldWrapper {
3385
- }
3386
- GioFormFieldWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFieldWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3387
- GioFormFieldWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormFieldWrapperComponent, selector: "gio-form-field-wrapper", usesInheritance: true, ngImport: i0, template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<div class=\"wrapper\">\n <div class=\"banner\">\n <div class=\"banner__icon\"><mat-icon svgIcon=\"gio:info\"></mat-icon></div>\n <div>\n <div class=\"banner__title\" [innerHTML]=\"props.bannerTitle\"></div>\n <div class=\"banner__text\" [innerHTML]=\"props.bannerText\"></div>\n </div>\n </div>\n <ng-container #fieldComponent></ng-container>\n</div>\n", styles: [".wrapper{padding:8px 0}.banner{display:flex;flex-direction:row;align-items:flex-start;padding:8px;border-radius:8px;margin-bottom:8px;background:#e7e8ef;gap:8px}.banner__icon{padding-top:2px}.banner__icon mat-icon{width:16px;height:16px;color:#6c59bd}.banner__title{font:600 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px}.banner__text{font:400 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;color:#606274}\n"], components: [{ type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
3388
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFieldWrapperComponent, decorators: [{
3389
- type: Component,
3390
- args: [{ selector: 'gio-form-field-wrapper', template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<div class=\"wrapper\">\n <div class=\"banner\">\n <div class=\"banner__icon\"><mat-icon svgIcon=\"gio:info\"></mat-icon></div>\n <div>\n <div class=\"banner__title\" [innerHTML]=\"props.bannerTitle\"></div>\n <div class=\"banner__text\" [innerHTML]=\"props.bannerText\"></div>\n </div>\n </div>\n <ng-container #fieldComponent></ng-container>\n</div>\n", styles: [".wrapper{padding:8px 0}.banner{display:flex;flex-direction:row;align-items:flex-start;padding:8px;border-radius:8px;margin-bottom:8px;background:#e7e8ef;gap:8px}.banner__icon{padding-top:2px}.banner__icon mat-icon{width:16px;height:16px;color:#6c59bd}.banner__title{font:600 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px}.banner__text{font:400 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;color:#606274}\n"] }]
3391
- }] });
3392
-
3393
- function bannerExtension(field) {
3394
- if (!field.props || (field.wrappers && field.wrappers.indexOf('gio-with-banner') !== -1)) {
3395
- return;
3293
+ class GioLanguageJsonService {
3294
+ constructor(codeEditorService) {
3295
+ this.codeEditorService = codeEditorService;
3296
+ this.unsubscribe$ = new Subject();
3297
+ codeEditorService.loaded$.pipe(takeUntil(this.unsubscribe$)).subscribe(event => {
3298
+ this.setup(event.monaco);
3299
+ });
3396
3300
  }
3397
- if (field.props.bannerTitle || field.props.bannerText) {
3398
- // WARNING: 'gio-with-banner' must be placed before field wrappers in order to put banner before mat-form-field if exists
3399
- field.wrappers = ['gio-with-banner', ...(field.wrappers || [])];
3301
+ ngOnDestroy() {
3302
+ this.unsubscribe$.next();
3303
+ this.unsubscribe$.complete();
3400
3304
  }
3401
- }
3402
-
3403
- /*
3404
- * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
3405
- *
3305
+ setup(monaco) {
3306
+ if (!monaco) {
3307
+ throw new Error('Monaco is not loaded');
3308
+ }
3309
+ this.monaco = monaco;
3310
+ const defaults = monaco.languages.json.jsonDefaults;
3311
+ defaults.setDiagnosticsOptions({
3312
+ validate: true,
3313
+ allowComments: true,
3314
+ });
3315
+ }
3316
+ addSchemas(id, definitions = []) {
3317
+ if (!this.monaco) {
3318
+ throw new Error('Monaco is not loaded');
3319
+ }
3320
+ const defaults = this.monaco.languages.json.jsonDefaults;
3321
+ const options = defaults.diagnosticsOptions;
3322
+ let schemas = definitions.map(({ uri, schema }) => ({
3323
+ uri,
3324
+ schema,
3325
+ fileMatch: [id || '*.json'],
3326
+ }));
3327
+ if (options && options.schemas && options.schemas.length > 0) {
3328
+ schemas = [...options.schemas, ...schemas];
3329
+ }
3330
+ defaults.setDiagnosticsOptions({
3331
+ ...options,
3332
+ schemas: schemas,
3333
+ });
3334
+ }
3335
+ }
3336
+ GioLanguageJsonService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioLanguageJsonService, deps: [{ token: GioMonacoEditorService }], target: i0.ɵɵFactoryTarget.Injectable });
3337
+ GioLanguageJsonService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioLanguageJsonService, providedIn: 'root' });
3338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioLanguageJsonService, decorators: [{
3339
+ type: Injectable,
3340
+ args: [{
3341
+ providedIn: 'root',
3342
+ }]
3343
+ }], ctorParameters: function () { return [{ type: GioMonacoEditorService }]; } });
3344
+
3345
+ /*
3346
+ * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
3347
+ *
3406
3348
  * Licensed under the Apache License, Version 2.0 (the "License");
3407
3349
  * you may not use this file except in compliance with the License.
3408
3350
  * You may obtain a copy of the License at
@@ -3415,35 +3357,341 @@ function bannerExtension(field) {
3415
3357
  * See the License for the specific language governing permissions and
3416
3358
  * limitations under the License.
3417
3359
  */
3418
- class GioFjsMultiSchemaTypeComponent extends FieldType {
3419
- ngOnInit() {
3420
- set(this.field, 'fieldGroup[0].props.appearance', 'fill');
3421
- set(this.field, 'fieldGroup[0].props.label', 'Select option');
3360
+ class GioMonacoEditorComponent {
3361
+ constructor(hostElement, config, monacoEditorService, languageJsonService, changeDetectorRef, ngZone, ngControl) {
3362
+ this.hostElement = hostElement;
3363
+ this.config = config;
3364
+ this.monacoEditorService = monacoEditorService;
3365
+ this.languageJsonService = languageJsonService;
3366
+ this.changeDetectorRef = changeDetectorRef;
3367
+ this.ngZone = ngZone;
3368
+ this.ngControl = ngControl;
3369
+ this.options = {};
3370
+ this.loaded$ = new ReplaySubject(1);
3371
+ this.defaultOptions = {
3372
+ contextmenu: false,
3373
+ minimap: {
3374
+ enabled: true,
3375
+ },
3376
+ automaticLayout: true,
3377
+ scrollBeyondLastLine: false,
3378
+ };
3379
+ this.value = '';
3380
+ this.readOnly = false;
3381
+ this._onChange = () => ({});
3382
+ this._onTouched = () => ({});
3383
+ this.unsubscribe$ = new Subject();
3384
+ if (this.ngControl) {
3385
+ // Set the value accessor directly (instead of providing
3386
+ // NG_VALUE_ACCESSOR) to avoid running into a circular import
3387
+ this.ngControl.valueAccessor = this;
3388
+ }
3389
+ this.monacoEditorService.loadEditor();
3390
+ }
3391
+ ngAfterViewInit() {
3392
+ // Wait until monaco editor is available
3393
+ this.monacoEditorService.loaded$.pipe(takeUntil(this.unsubscribe$)).subscribe(({ monaco }) => {
3394
+ this.setupEditor(monaco);
3395
+ this.loaded$.next(false);
3396
+ this.changeDetectorRef.detectChanges();
3397
+ });
3398
+ }
3399
+ ngOnDestroy() {
3400
+ if (this.standaloneCodeEditor) {
3401
+ this.standaloneCodeEditor.dispose();
3402
+ this.standaloneCodeEditor = undefined;
3403
+ }
3404
+ if (this.textModel) {
3405
+ this.textModel.dispose();
3406
+ this.textModel = undefined;
3407
+ }
3408
+ this.unsubscribe$.next();
3409
+ this.unsubscribe$.complete();
3410
+ }
3411
+ // From ControlValueAccessor interface
3412
+ writeValue(_value) {
3413
+ if (_value) {
3414
+ this.value = _value;
3415
+ }
3416
+ if (this.textModel) {
3417
+ this.textModel.setValue(this.value);
3418
+ }
3419
+ }
3420
+ // From ControlValueAccessor interface
3421
+ registerOnChange(fn) {
3422
+ this._onChange = fn;
3423
+ }
3424
+ // From ControlValueAccessor interface
3425
+ registerOnTouched(fn) {
3426
+ this._onTouched = fn;
3427
+ }
3428
+ // From ControlValueAccessor interface
3429
+ setDisabledState(isDisabled) {
3430
+ this.readOnly = isDisabled;
3431
+ }
3432
+ setupEditor(monaco) {
3433
+ if (!this.hostElement) {
3434
+ throw new Error('No editor ref found.');
3435
+ }
3436
+ const domElement = this.hostElement.nativeElement;
3437
+ const settings = {
3438
+ value: this.value,
3439
+ language: this.languageConfig?.language ?? 'text',
3440
+ uri: `code-${uniqueId()}`,
3441
+ };
3442
+ this.ngZone.runOutsideAngular(() => {
3443
+ this.textModel = monaco.editor.createModel(settings.value, settings.language, monaco.Uri.parse(settings.uri));
3444
+ });
3445
+ const options = Object.assign({}, this.defaultOptions, this.options, {
3446
+ readOnly: this.readOnly,
3447
+ theme: this.config.theme ?? 'vs',
3448
+ model: this.textModel,
3449
+ });
3450
+ this.standaloneCodeEditor = monaco.editor.create(domElement, {
3451
+ ...options,
3452
+ });
3453
+ this.textModel?.onDidChangeContent(() => {
3454
+ const newValue = this.textModel?.getValue();
3455
+ this.ngZone.run(() => {
3456
+ this.value = newValue ?? '';
3457
+ this._onChange(newValue ?? '');
3458
+ this._onTouched();
3459
+ });
3460
+ });
3461
+ this.standaloneCodeEditor?.onDidBlurEditorWidget(() => {
3462
+ this.ngZone.run(() => {
3463
+ this._onTouched();
3464
+ });
3465
+ });
3466
+ this.setupLanguage(settings.uri, this.languageConfig);
3467
+ }
3468
+ setupLanguage(uri, languageConfig) {
3469
+ if (!languageConfig) {
3470
+ return;
3471
+ }
3472
+ const { language } = languageConfig;
3473
+ if (language) {
3474
+ const lang = language.toLowerCase();
3475
+ switch (lang) {
3476
+ case 'json':
3477
+ if (languageConfig.schemas) {
3478
+ this.languageJsonService.addSchemas(uri, languageConfig.schemas);
3479
+ }
3480
+ break;
3481
+ default:
3482
+ break;
3483
+ }
3484
+ }
3422
3485
  }
3423
3486
  }
3424
- GioFjsMultiSchemaTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsMultiSchemaTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3425
- GioFjsMultiSchemaTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsMultiSchemaTypeComponent, selector: "gio-fjs-multi-schema-type", usesInheritance: true, ngImport: i0, template: `
3426
- <div class="wrapper">
3427
- <div class="wrapper__title" *ngIf="props.label">{{ props.label }}</div>
3428
- <p *ngIf="props.description">{{ props.description }}</p>
3429
- <div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
3430
- <formly-validation-message [field]="field"></formly-validation-message>
3431
- </div>
3432
- <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
3433
- </div>
3434
- `, 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"] }] });
3435
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsMultiSchemaTypeComponent, decorators: [{
3487
+ GioMonacoEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorComponent, deps: [{ token: i0.ElementRef }, { token: GIO_MONACO_EDITOR_CONFIG }, { token: GioMonacoEditorService }, { token: GioLanguageJsonService }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i7.NgControl, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Component });
3488
+ GioMonacoEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioMonacoEditorComponent, selector: "gio-monaco-editor", inputs: { languageConfig: "languageConfig", options: "options" }, ngImport: i0, template: ` <div *ngIf="loaded$ | async">Loading...</div>`, isInline: true, styles: [":host{display:block;height:100%;min-height:150px;transition:opacity .2s ease-out}:host-context(.hidden){opacity:0}\n"], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i2$1.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
3489
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorComponent, decorators: [{
3436
3490
  type: Component,
3437
- args: [{ selector: 'gio-fjs-multi-schema-type', template: `
3438
- <div class="wrapper">
3439
- <div class="wrapper__title" *ngIf="props.label">{{ props.label }}</div>
3440
- <p *ngIf="props.description">{{ props.description }}</p>
3441
- <div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
3442
- <formly-validation-message [field]="field"></formly-validation-message>
3443
- </div>
3444
- <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
3445
- </div>
3446
- `, 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"] }]
3491
+ args: [{ selector: 'gio-monaco-editor', template: ` <div *ngIf="loaded$ | async">Loading...</div>`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;height:100%;min-height:150px;transition:opacity .2s ease-out}:host-context(.hidden){opacity:0}\n"] }]
3492
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: undefined, decorators: [{
3493
+ type: Inject,
3494
+ args: [GIO_MONACO_EDITOR_CONFIG]
3495
+ }] }, { type: GioMonacoEditorService }, { type: GioLanguageJsonService }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i7.NgControl, decorators: [{
3496
+ type: Optional
3497
+ }, {
3498
+ type: Self
3499
+ }] }]; }, propDecorators: { languageConfig: [{
3500
+ type: Input
3501
+ }], options: [{
3502
+ type: Input
3503
+ }] } });
3504
+
3505
+ class GioMonacoEditorFormFieldDirective {
3506
+ constructor(elementRef, focusMonitor, renderer, changeDetectorRef, hostGioMonacoEditorComponent) {
3507
+ this.elementRef = elementRef;
3508
+ this.focusMonitor = focusMonitor;
3509
+ this.renderer = renderer;
3510
+ this.changeDetectorRef = changeDetectorRef;
3511
+ this.hostGioMonacoEditorComponent = hostGioMonacoEditorComponent;
3512
+ this.stateChanges = new Subject();
3513
+ this.id = `gio-monaco-editor-${GioMonacoEditorFormFieldDirective.nextId++}`;
3514
+ this.userAriaDescribedBy = '';
3515
+ this.ngControl = null;
3516
+ this.focused = false;
3517
+ this.errorState = false;
3518
+ this.controlType = 'gio-monaco-editor';
3519
+ // autofilled?: boolean | undefined;
3520
+ this._placeholder = '';
3521
+ this._required = false;
3522
+ this._disabled = false;
3523
+ this.maxHeight = 500;
3524
+ this.unsubscribe$ = new Subject();
3525
+ }
3526
+ get value() {
3527
+ return this.hostGioMonacoEditorComponent?.value ?? null;
3528
+ }
3529
+ set placeholder(placeholder) {
3530
+ this._placeholder = placeholder;
3531
+ this.stateChanges.next();
3532
+ }
3533
+ get placeholder() {
3534
+ return this._placeholder;
3535
+ }
3536
+ set required(required) {
3537
+ this._required = coerceBooleanProperty(required);
3538
+ this.stateChanges.next();
3539
+ }
3540
+ get required() {
3541
+ return this._required;
3542
+ }
3543
+ set disabled(disabled) {
3544
+ this._disabled = coerceBooleanProperty(disabled);
3545
+ if (this.focused) {
3546
+ this.focused = false;
3547
+ this.stateChanges.next();
3548
+ }
3549
+ }
3550
+ get disabled() {
3551
+ if (this.ngControl && this.ngControl.disabled !== null) {
3552
+ return this.ngControl.disabled;
3553
+ }
3554
+ return this._disabled;
3555
+ }
3556
+ get empty() {
3557
+ return !this.value;
3558
+ }
3559
+ get shouldLabelFloat() {
3560
+ return this.focused || !this.empty;
3561
+ }
3562
+ get shouldHideEditor() {
3563
+ return !this.shouldLabelFloat;
3564
+ }
3565
+ ngOnInit() {
3566
+ this.stateChanges.pipe(takeUntil(this.unsubscribe$)).subscribe(() => this.changeDetectorRef.markForCheck());
3567
+ this.focusMonitor
3568
+ .monitor(this.elementRef.nativeElement, true)
3569
+ .pipe(takeUntil(this.unsubscribe$))
3570
+ .subscribe(origin => {
3571
+ this.focused = !!origin;
3572
+ this.stateChanges.next();
3573
+ });
3574
+ this.ngControl = this.hostGioMonacoEditorComponent?.ngControl;
3575
+ this.hostGioMonacoEditorComponent.loaded$.pipe(takeUntil(this.unsubscribe$)).subscribe(() => {
3576
+ // Auto resize editor
3577
+ this.hostGioMonacoEditorComponent.standaloneCodeEditor?.onDidContentSizeChange(() => {
3578
+ const height = Math.min(this.hostGioMonacoEditorComponent.standaloneCodeEditor?.getContentHeight() ?? this.maxHeight, this.maxHeight);
3579
+ this.renderer.setStyle(this.elementRef.nativeElement, 'height', `${height}px`);
3580
+ this.hostGioMonacoEditorComponent.standaloneCodeEditor?.layout();
3581
+ this.stateChanges.next();
3582
+ });
3583
+ });
3584
+ }
3585
+ ngDoCheck() {
3586
+ if (this.ngControl) {
3587
+ this.errorState = !!this.ngControl.invalid && !!this.ngControl.touched;
3588
+ this.stateChanges.next();
3589
+ }
3590
+ }
3591
+ ngOnDestroy() {
3592
+ this.unsubscribe$.next();
3593
+ this.unsubscribe$.complete();
3594
+ this.focusMonitor.stopMonitoring(this.elementRef.nativeElement);
3595
+ }
3596
+ setDescribedByIds(ids) {
3597
+ this.userAriaDescribedBy = ids.join(' ');
3598
+ }
3599
+ onContainerClick(_event) {
3600
+ if (!this.focused) {
3601
+ this.hostGioMonacoEditorComponent.standaloneCodeEditor?.focus();
3602
+ }
3603
+ }
3604
+ }
3605
+ GioMonacoEditorFormFieldDirective.nextId = 0;
3606
+ GioMonacoEditorFormFieldDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorFormFieldDirective, deps: [{ token: i0.ElementRef }, { token: i2$2.FocusMonitor }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: GioMonacoEditorComponent, host: true, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive });
3607
+ GioMonacoEditorFormFieldDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioMonacoEditorFormFieldDirective, selector: "[gioMonacoEditorFormField]", inputs: { placeholder: "placeholder", required: "required", disabled: "disabled" }, host: { properties: { "id": "this.id", "attr.aria-describedBy": "this.userAriaDescribedBy", "class.hidden": "this.shouldHideEditor" } }, providers: [
3608
+ {
3609
+ provide: MatFormFieldControl,
3610
+ useExisting: forwardRef(() => GioMonacoEditorFormFieldDirective),
3611
+ },
3612
+ ], ngImport: i0 });
3613
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorFormFieldDirective, decorators: [{
3614
+ type: Directive,
3615
+ args: [{
3616
+ selector: '[gioMonacoEditorFormField]',
3617
+ providers: [
3618
+ {
3619
+ provide: MatFormFieldControl,
3620
+ useExisting: forwardRef(() => GioMonacoEditorFormFieldDirective),
3621
+ },
3622
+ ],
3623
+ }]
3624
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2$2.FocusMonitor }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: GioMonacoEditorComponent, decorators: [{
3625
+ type: Host
3626
+ }, {
3627
+ type: Self
3628
+ }, {
3629
+ type: Optional
3630
+ }] }]; }, propDecorators: { id: [{
3631
+ type: HostBinding
3632
+ }], userAriaDescribedBy: [{
3633
+ type: HostBinding,
3634
+ args: ['attr.aria-describedBy']
3635
+ }], placeholder: [{
3636
+ type: Input
3637
+ }], required: [{
3638
+ type: Input
3639
+ }], disabled: [{
3640
+ type: Input
3641
+ }], shouldHideEditor: [{
3642
+ type: HostBinding,
3643
+ args: ['class.hidden']
3644
+ }] } });
3645
+
3646
+ /*
3647
+ * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
3648
+ *
3649
+ * Licensed under the Apache License, Version 2.0 (the "License");
3650
+ * you may not use this file except in compliance with the License.
3651
+ * You may obtain a copy of the License at
3652
+ *
3653
+ * http://www.apache.org/licenses/LICENSE-2.0
3654
+ *
3655
+ * Unless required by applicable law or agreed to in writing, software
3656
+ * distributed under the License is distributed on an "AS IS" BASIS,
3657
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3658
+ * See the License for the specific language governing permissions and
3659
+ * limitations under the License.
3660
+ */
3661
+ class GioMonacoEditorModule {
3662
+ static forRoot(config) {
3663
+ return {
3664
+ ngModule: GioMonacoEditorModule,
3665
+ providers: [
3666
+ {
3667
+ provide: GIO_MONACO_EDITOR_CONFIG,
3668
+ useValue: config,
3669
+ },
3670
+ ],
3671
+ };
3672
+ }
3673
+ }
3674
+ GioMonacoEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3675
+ GioMonacoEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, declarations: [GioMonacoEditorComponent, GioMonacoEditorFormFieldDirective], imports: [CommonModule, HttpClientModule, ReactiveFormsModule], exports: [GioMonacoEditorComponent, GioMonacoEditorFormFieldDirective] });
3676
+ GioMonacoEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, providers: [
3677
+ {
3678
+ provide: GIO_MONACO_EDITOR_CONFIG,
3679
+ useValue: {},
3680
+ },
3681
+ ], imports: [[CommonModule, HttpClientModule, ReactiveFormsModule]] });
3682
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, decorators: [{
3683
+ type: NgModule,
3684
+ args: [{
3685
+ imports: [CommonModule, HttpClientModule, ReactiveFormsModule],
3686
+ declarations: [GioMonacoEditorComponent, GioMonacoEditorFormFieldDirective],
3687
+ exports: [GioMonacoEditorComponent, GioMonacoEditorFormFieldDirective],
3688
+ providers: [
3689
+ {
3690
+ provide: GIO_MONACO_EDITOR_CONFIG,
3691
+ useValue: {},
3692
+ },
3693
+ ],
3694
+ }]
3447
3695
  }] });
3448
3696
 
3449
3697
  /*
@@ -3461,39 +3709,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3461
3709
  * See the License for the specific language governing permissions and
3462
3710
  * limitations under the License.
3463
3711
  */
3464
- class GioFjsToggleTypeComponent extends FieldType {
3712
+ class GioFjsNullTypeComponent extends FieldType {
3465
3713
  }
3466
- GioFjsToggleTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsToggleTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3467
- GioFjsToggleTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsToggleTypeComponent, selector: "gio-fjs-toggle-type", usesInheritance: true, ngImport: i0, template: `
3468
- <gio-form-slide-toggle>
3469
- <gio-form-label>{{ props.label }}</gio-form-label>
3470
- {{ props.description }}
3471
- <mat-slide-toggle
3472
- gioFormSlideToggle
3473
- [id]="id"
3474
- [formControl]="formControl"
3475
- [formlyAttributes]="field"
3476
- [tabIndex]="props.tabindex"
3477
- ></mat-slide-toggle>
3478
- </gio-form-slide-toggle>
3479
- `, isInline: true, components: [{ type: GioFormSlideToggleComponent, selector: "gio-form-slide-toggle", inputs: ["appearance"] }, { type: GioFormLabelComponent, selector: "gio-form-label" }, { type: i3$2.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex", "name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "checked"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }], directives: [{ type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i1$4.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }] });
3480
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsToggleTypeComponent, decorators: [{
3714
+ GioFjsNullTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsNullTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3715
+ GioFjsNullTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsNullTypeComponent, selector: "gio-fjs-null-type", usesInheritance: true, ngImport: i0, template: ``, isInline: true });
3716
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsNullTypeComponent, decorators: [{
3481
3717
  type: Component,
3482
3718
  args: [{
3483
- selector: 'gio-fjs-toggle-type',
3484
- template: `
3485
- <gio-form-slide-toggle>
3486
- <gio-form-label>{{ props.label }}</gio-form-label>
3487
- {{ props.description }}
3488
- <mat-slide-toggle
3489
- gioFormSlideToggle
3490
- [id]="id"
3491
- [formControl]="formControl"
3492
- [formlyAttributes]="field"
3493
- [tabIndex]="props.tabindex"
3494
- ></mat-slide-toggle>
3495
- </gio-form-slide-toggle>
3496
- `,
3719
+ selector: 'gio-fjs-null-type',
3720
+ template: ``,
3497
3721
  }]
3498
3722
  }] });
3499
3723
 
@@ -3512,31 +3736,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3512
3736
  * See the License for the specific language governing permissions and
3513
3737
  * limitations under the License.
3514
3738
  */
3515
- class GioFjsHeadersTypeComponent extends FieldType {
3739
+ class GioFjsObjectTypeComponent extends FieldType {
3740
+ }
3741
+ GioFjsObjectTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsObjectTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3742
+ GioFjsObjectTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsObjectTypeComponent, selector: "gio-fjs-object-type", usesInheritance: true, ngImport: i0, template: `
3743
+ <div class="wrapper">
3744
+ <div class="wrapper__title" *ngIf="to.label">{{ to.label }}</div>
3745
+ <p *ngIf="to.description">{{ to.description }}</p>
3746
+ <div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
3747
+ <formly-validation-message [field]="field"></formly-validation-message>
3748
+ </div>
3749
+ <div class="wrapper__fields">
3750
+ <ng-container *ngFor="let f of field.fieldGroup">
3751
+ <formly-field *ngIf="f.type" class="wrapper__fields__field" [field]="f"></formly-field>
3752
+ </ng-container>
3753
+ </div>
3754
+ </div>
3755
+ `, isInline: true, styles: [".wrapper{display:flex;flex-direction:column}.wrapper__title{font:600 18px/24px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:16px}.wrapper:empty{display:none}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}.wrapper__fields{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper__fields:empty{display:none}.wrapper__fields:has(> .wrapper__fields__field:only-child):has(> .wrapper__fields__field:empty){display:none}.wrapper__fields__field:empty{display:none}.wrapper__fields__field+.wrapper__fields__field:not(:empty){display:block;margin-top:8px}\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"] }] });
3756
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsObjectTypeComponent, decorators: [{
3757
+ type: Component,
3758
+ args: [{ selector: 'gio-fjs-object-type', template: `
3759
+ <div class="wrapper">
3760
+ <div class="wrapper__title" *ngIf="to.label">{{ to.label }}</div>
3761
+ <p *ngIf="to.description">{{ to.description }}</p>
3762
+ <div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
3763
+ <formly-validation-message [field]="field"></formly-validation-message>
3764
+ </div>
3765
+ <div class="wrapper__fields">
3766
+ <ng-container *ngFor="let f of field.fieldGroup">
3767
+ <formly-field *ngIf="f.type" class="wrapper__fields__field" [field]="f"></formly-field>
3768
+ </ng-container>
3769
+ </div>
3770
+ </div>
3771
+ `, styles: [".wrapper{display:flex;flex-direction:column}.wrapper__title{font:600 18px/24px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:16px}.wrapper:empty{display:none}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}.wrapper__fields{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper__fields:empty{display:none}.wrapper__fields:has(> .wrapper__fields__field:only-child):has(> .wrapper__fields__field:empty){display:none}.wrapper__fields__field:empty{display:none}.wrapper__fields__field+.wrapper__fields__field:not(:empty){display:block;margin-top:8px}\n"] }]
3772
+ }] });
3773
+
3774
+ /*
3775
+ * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
3776
+ *
3777
+ * Licensed under the Apache License, Version 2.0 (the "License");
3778
+ * you may not use this file except in compliance with the License.
3779
+ * You may obtain a copy of the License at
3780
+ *
3781
+ * http://www.apache.org/licenses/LICENSE-2.0
3782
+ *
3783
+ * Unless required by applicable law or agreed to in writing, software
3784
+ * distributed under the License is distributed on an "AS IS" BASIS,
3785
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3786
+ * See the License for the specific language governing permissions and
3787
+ * limitations under the License.
3788
+ */
3789
+ class GioFjsArrayTypeComponent extends FieldArrayType {
3516
3790
  constructor() {
3517
3791
  super(...arguments);
3518
- this.defaultOptions = {
3519
- props: {
3520
- outputConfig: {
3521
- keyName: 'name',
3522
- valueName: 'value',
3523
- },
3524
- },
3525
- };
3526
3792
  this.collapse = false;
3527
3793
  }
3528
- get map() {
3529
- return (headers) => [...(headers ?? [])].map(header => {
3530
- return {
3531
- [this.props.outputConfig.keyName]: header.key,
3532
- [this.props.outputConfig.valueName]: header.value,
3533
- };
3534
- });
3535
- }
3536
3794
  }
3537
- GioFjsHeadersTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsHeadersTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3538
- GioFjsHeadersTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsHeadersTypeComponent, selector: "gio-fjs-headers-type", usesInheritance: true, ngImport: i0, template: `
3539
- <div class="wrapper">
3795
+ GioFjsArrayTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsArrayTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3796
+ GioFjsArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsArrayTypeComponent, selector: "gio-fjs-array-type", usesInheritance: true, ngImport: i0, template: `
3797
+ <div class="wrapper" [class.error]="formControl.touched && formControl.invalid">
3540
3798
  <div class="wrapper__header">
3541
3799
  <div class="wrapper__header__text">
3542
3800
  <div class="wrapper__header__text__title" *ngIf="to.label">{{ to.label }}</div>
@@ -3548,18 +3806,31 @@ GioFjsHeadersTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0
3548
3806
  </button>
3549
3807
  </div>
3550
3808
  </div>
3551
- <div class="wrapper__error" *ngIf="showError && formControl.errors">
3809
+
3810
+ <div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
3552
3811
  <formly-validation-message [field]="field"></formly-validation-message>
3553
3812
  </div>
3554
- <div *ngIf="!collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
3555
- <gio-form-headers [adaptOutputFn]="map" [formControl]="formControl"></gio-form-headers>
3813
+
3814
+ <div [hidden]="collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
3815
+ <div *ngFor="let field of field.fieldGroup; let i = index" class="wrapper__rows__row">
3816
+ <formly-field class="wrapper__rows__row__field" [field]="field"></formly-field>
3817
+ <div class="wrapper__rows__row__remove">
3818
+ <button type="button" mat-icon-button aria-label="Remove" (click)="remove(i)">
3819
+ <mat-icon svgIcon="gio:cancel"></mat-icon>
3820
+ </button>
3821
+ </div>
3822
+ </div>
3823
+
3824
+ <div>
3825
+ <button type="button" mat-stroked-button aria-label="Add" (click)="add()"><mat-icon svgIcon="gio:plus"></mat-icon> Add</button>
3826
+ </div>
3556
3827
  </div>
3557
3828
  </div>
3558
- `, isInline: true, 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"], components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i1$4.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { type: GioFormHeadersComponent, selector: "gio-form-headers", inputs: ["adaptOutputFn"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
3559
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsHeadersTypeComponent, decorators: [{
3829
+ `, isInline: true, styles: [".wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper.error{border-color:#ec4899}.wrapper:empty{display:none}.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}.wrapper__rows__row{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}.wrapper__rows__row+.wrapper__rows__row{padding-top:3px;border-top:1px solid #d3d5dc;margin-top:4px}.wrapper__rows__row__field{flex:1 1 auto}.wrapper__rows__row__remove{flex:0 0 auto}\n"], components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { 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"] }] });
3830
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsArrayTypeComponent, decorators: [{
3560
3831
  type: Component,
3561
- args: [{ selector: 'gio-fjs-headers-type', template: `
3562
- <div class="wrapper">
3832
+ args: [{ selector: 'gio-fjs-array-type', template: `
3833
+ <div class="wrapper" [class.error]="formControl.touched && formControl.invalid">
3563
3834
  <div class="wrapper__header">
3564
3835
  <div class="wrapper__header__text">
3565
3836
  <div class="wrapper__header__text__title" *ngIf="to.label">{{ to.label }}</div>
@@ -3571,16 +3842,63 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3571
3842
  </button>
3572
3843
  </div>
3573
3844
  </div>
3574
- <div class="wrapper__error" *ngIf="showError && formControl.errors">
3845
+
3846
+ <div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
3575
3847
  <formly-validation-message [field]="field"></formly-validation-message>
3576
3848
  </div>
3577
- <div *ngIf="!collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
3578
- <gio-form-headers [adaptOutputFn]="map" [formControl]="formControl"></gio-form-headers>
3849
+
3850
+ <div [hidden]="collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
3851
+ <div *ngFor="let field of field.fieldGroup; let i = index" class="wrapper__rows__row">
3852
+ <formly-field class="wrapper__rows__row__field" [field]="field"></formly-field>
3853
+ <div class="wrapper__rows__row__remove">
3854
+ <button type="button" mat-icon-button aria-label="Remove" (click)="remove(i)">
3855
+ <mat-icon svgIcon="gio:cancel"></mat-icon>
3856
+ </button>
3857
+ </div>
3858
+ </div>
3859
+
3860
+ <div>
3861
+ <button type="button" mat-stroked-button aria-label="Add" (click)="add()"><mat-icon svgIcon="gio:plus"></mat-icon> Add</button>
3862
+ </div>
3579
3863
  </div>
3580
3864
  </div>
3581
- `, 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"] }]
3865
+ `, styles: [".wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper.error{border-color:#ec4899}.wrapper:empty{display:none}.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}.wrapper__rows__row{display:flex;align-items:center;justify-content:space-between;margin-bottom:4px}.wrapper__rows__row+.wrapper__rows__row{padding-top:3px;border-top:1px solid #d3d5dc;margin-top:4px}.wrapper__rows__row__field{flex:1 1 auto}.wrapper__rows__row__remove{flex:0 0 auto}\n"] }]
3582
3866
  }] });
3583
3867
 
3868
+ function minItemsValidationMessage(error, field) {
3869
+ return `Should NOT have fewer than ${field.props?.minItems} items`;
3870
+ }
3871
+ function maxItemsValidationMessage(error, field) {
3872
+ return `Should NOT have more than ${field.props?.maxItems} items`;
3873
+ }
3874
+ function minLengthValidationMessage(error, field) {
3875
+ return `Should NOT be shorter than ${field.props?.minLength} characters`;
3876
+ }
3877
+ function maxLengthValidationMessage(error, field) {
3878
+ return `Should NOT be longer than ${field.props?.maxLength} characters`;
3879
+ }
3880
+ function minValidationMessage(error, field) {
3881
+ return `Should be >= ${field.props?.min}`;
3882
+ }
3883
+ function maxValidationMessage(error, field) {
3884
+ return `Should be <= ${field.props?.max}`;
3885
+ }
3886
+ function multipleOfValidationMessage(error, field) {
3887
+ return `Should be multiple of ${field.props?.step}`;
3888
+ }
3889
+ function exclusiveMinimumValidationMessage(error, field) {
3890
+ return `Should be > ${field.props?.step}`;
3891
+ }
3892
+ function exclusiveMaximumValidationMessage(error, field) {
3893
+ return `Should be < ${field.props?.step}`;
3894
+ }
3895
+ function constValidationMessage(error, field) {
3896
+ return `Should be equal to constant "${field.props?.const}"`;
3897
+ }
3898
+ function typeValidationMessage({ schemaType }) {
3899
+ return `Should be "${schemaType[0]}".`;
3900
+ }
3901
+
3584
3902
  /*
3585
3903
  * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
3586
3904
  *
@@ -3596,61 +3914,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3596
3914
  * See the License for the specific language governing permissions and
3597
3915
  * limitations under the License.
3598
3916
  */
3599
- class GioPasswordEyeWrapperComponent extends FieldWrapper {
3600
- constructor() {
3601
- super(...arguments);
3602
- this.hide = true;
3603
- }
3604
- ngAfterViewInit() {
3605
- if (this.matSuffix) {
3606
- this.props.suffix = this.matSuffix;
3607
- }
3608
- }
3609
- addonEyeClick($event) {
3610
- $event.stopPropagation();
3611
- this.hide = !this.hide;
3612
- this.props.type = this.hide ? 'password' : 'text';
3613
- }
3917
+ class GioBannerWrapperComponent extends FieldWrapper {
3614
3918
  }
3615
- GioPasswordEyeWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPasswordEyeWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3616
- 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: `
3617
- <ng-container #fieldComponent></ng-container>
3618
-
3619
- <ng-template #matSuffix>
3620
- <span style="cursor: pointer" (click)="addonEyeClick($event)">
3621
- <mat-icon [svgIcon]="hide ? 'gio:eye-empty' : 'gio:eye-off'"></mat-icon>
3622
- </span>
3623
- </ng-template>
3624
- `, isInline: true, components: [{ type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
3625
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPasswordEyeWrapperComponent, decorators: [{
3919
+ GioBannerWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioBannerWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3920
+ GioBannerWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioBannerWrapperComponent, selector: "gio-banner-wrapper", usesInheritance: true, ngImport: i0, template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<div class=\"wrapper\">\n <div class=\"banner\">\n <div class=\"banner__icon\"><mat-icon svgIcon=\"gio:info\"></mat-icon></div>\n <div>\n <div class=\"banner__title\" [innerHTML]=\"props.bannerTitle\"></div>\n <div class=\"banner__text\" [innerHTML]=\"props.bannerText\"></div>\n </div>\n </div>\n <ng-container #fieldComponent></ng-container>\n</div>\n", styles: ["::ng-deep gio-banner-wrapper ul{padding-inline-start:16px}.wrapper{padding:8px 0}.banner{display:flex;flex-direction:row;align-items:flex-start;padding:8px;border-radius:8px;margin-bottom:8px;background:#e7e8ef;gap:8px}.banner__icon{padding-top:2px}.banner__icon mat-icon{width:16px;height:16px;color:#6c59bd}.banner__title{font:600 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px}.banner__text{font:400 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;color:#606274}\n"], components: [{ type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
3921
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioBannerWrapperComponent, decorators: [{
3626
3922
  type: Component,
3627
- args: [{
3628
- selector: 'gio-password-eye-wrapper',
3629
- template: `
3630
- <ng-container #fieldComponent></ng-container>
3923
+ args: [{ selector: 'gio-banner-wrapper', template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<div class=\"wrapper\">\n <div class=\"banner\">\n <div class=\"banner__icon\"><mat-icon svgIcon=\"gio:info\"></mat-icon></div>\n <div>\n <div class=\"banner__title\" [innerHTML]=\"props.bannerTitle\"></div>\n <div class=\"banner__text\" [innerHTML]=\"props.bannerText\"></div>\n </div>\n </div>\n <ng-container #fieldComponent></ng-container>\n</div>\n", styles: ["::ng-deep gio-banner-wrapper ul{padding-inline-start:16px}.wrapper{padding:8px 0}.banner{display:flex;flex-direction:row;align-items:flex-start;padding:8px;border-radius:8px;margin-bottom:8px;background:#e7e8ef;gap:8px}.banner__icon{padding-top:2px}.banner__icon mat-icon{width:16px;height:16px;color:#6c59bd}.banner__title{font:600 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px}.banner__text{font:400 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;color:#606274}\n"] }]
3924
+ }] });
3631
3925
 
3632
- <ng-template #matSuffix>
3633
- <span style="cursor: pointer" (click)="addonEyeClick($event)">
3634
- <mat-icon [svgIcon]="hide ? 'gio:eye-empty' : 'gio:eye-off'"></mat-icon>
3635
- </span>
3636
- </ng-template>
3637
- `,
3638
- }]
3639
- }], propDecorators: { matSuffix: [{
3640
- type: ViewChild,
3641
- args: ['matSuffix', { static: true }]
3642
- }] } });
3643
- function passwordEyeExtension(field) {
3644
- if (!field.props || (field.wrappers && field.wrappers.indexOf('gio-password-eye') !== -1)) {
3926
+ function bannerExtension(field) {
3927
+ if (!field.props || (field.wrappers && field.wrappers.indexOf('gio-with-banner') !== -1)) {
3645
3928
  return;
3646
3929
  }
3647
- if (field.props.type === 'password') {
3648
- field.wrappers = [...(field.wrappers || []), 'gio-password-eye'];
3930
+ if (field.props.bannerTitle || field.props.bannerText) {
3931
+ // WARNING: 'gio-with-banner' must be placed before field wrappers in order to put banner before mat-form-field if exists
3932
+ field.wrappers = ['gio-with-banner', ...(field.wrappers || [])];
3649
3933
  }
3650
3934
  }
3651
3935
 
3652
3936
  /*
3653
- * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
3937
+ * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
3654
3938
  *
3655
3939
  * Licensed under the Apache License, Version 2.0 (the "License");
3656
3940
  * you may not use this file except in compliance with the License.
@@ -3664,148 +3948,35 @@ function passwordEyeExtension(field) {
3664
3948
  * See the License for the specific language governing permissions and
3665
3949
  * limitations under the License.
3666
3950
  */
3667
- class GioFormJsonSchemaModule {
3668
- }
3669
- GioFormJsonSchemaModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3670
- GioFormJsonSchemaModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, declarations: [GioFormJsonSchemaComponent,
3671
- GioFjsNullTypeComponent,
3672
- GioFjsObjectTypeComponent,
3673
- GioFjsMultiSchemaTypeComponent,
3674
- GioFjsArrayTypeComponent,
3675
- GioFjsToggleTypeComponent,
3676
- GioFjsHeadersTypeComponent,
3677
- GioFormFieldWrapperComponent,
3678
- GioPasswordEyeWrapperComponent], imports: [CommonModule,
3679
- A11yModule,
3680
- ReactiveFormsModule, i1$4.FormlyModule, FormlyMaterialModule,
3681
- GioIconsModule,
3682
- GioFormSlideToggleModule,
3683
- GioFormHeadersModule,
3684
- MatSlideToggleModule,
3685
- MatButtonModule], exports: [GioFormJsonSchemaComponent, FormlyModule] });
3686
- GioFormJsonSchemaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, providers: [GioFormlyJsonSchemaService], imports: [[
3687
- CommonModule,
3688
- A11yModule,
3689
- ReactiveFormsModule,
3690
- FormlyModule.forRoot({
3691
- validationMessages: [
3692
- { name: 'required', message: 'This field is required' },
3693
- { name: 'type', message: typeValidationMessage },
3694
- { name: 'minLength', message: minLengthValidationMessage },
3695
- { name: 'maxLength', message: maxLengthValidationMessage },
3696
- { name: 'min', message: minValidationMessage },
3697
- { name: 'max', message: maxValidationMessage },
3698
- { name: 'multipleOf', message: multipleOfValidationMessage },
3699
- { name: 'exclusiveMinimum', message: exclusiveMinimumValidationMessage },
3700
- { name: 'exclusiveMaximum', message: exclusiveMaximumValidationMessage },
3701
- { name: 'minItems', message: minItemsValidationMessage },
3702
- { name: 'maxItems', message: maxItemsValidationMessage },
3703
- { name: 'uniqueItems', message: 'Should NOT have duplicate items' },
3704
- { name: 'const', message: constValidationMessage },
3705
- ],
3706
- wrappers: [
3707
- { name: 'gio-with-banner', component: GioFormFieldWrapperComponent },
3708
- { name: 'gio-password-eye', component: GioPasswordEyeWrapperComponent },
3709
- ],
3710
- types: [
3711
- { name: 'null', component: GioFjsNullTypeComponent, wrappers: ['form-field'] },
3712
- { name: 'array', component: GioFjsArrayTypeComponent },
3713
- { name: 'object', component: GioFjsObjectTypeComponent },
3714
- { name: 'multischema', component: GioFjsMultiSchemaTypeComponent },
3715
- {
3716
- name: 'toggle',
3717
- component: GioFjsToggleTypeComponent,
3718
- },
3719
- {
3720
- name: 'gio-headers-array',
3721
- component: GioFjsHeadersTypeComponent,
3722
- },
3723
- ],
3724
- extensions: [
3725
- { name: 'banner', extension: { onPopulate: bannerExtension } },
3726
- { name: 'password-eye', extension: { onPopulate: passwordEyeExtension } },
3727
- ],
3728
- extras: {
3729
- checkExpressionOn: 'changeDetectionCheck',
3730
- },
3731
- }),
3732
- FormlyMaterialModule,
3733
- GioIconsModule,
3734
- GioFormSlideToggleModule,
3735
- GioFormHeadersModule,
3736
- MatSlideToggleModule,
3737
- MatButtonModule,
3738
- ], FormlyModule] });
3739
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, decorators: [{
3740
- type: NgModule,
3741
- args: [{
3742
- declarations: [
3743
- GioFormJsonSchemaComponent,
3744
- GioFjsNullTypeComponent,
3745
- GioFjsObjectTypeComponent,
3746
- GioFjsMultiSchemaTypeComponent,
3747
- GioFjsArrayTypeComponent,
3748
- GioFjsToggleTypeComponent,
3749
- GioFjsHeadersTypeComponent,
3750
- GioFormFieldWrapperComponent,
3751
- GioPasswordEyeWrapperComponent,
3752
- ],
3753
- imports: [
3754
- CommonModule,
3755
- A11yModule,
3756
- ReactiveFormsModule,
3757
- FormlyModule.forRoot({
3758
- validationMessages: [
3759
- { name: 'required', message: 'This field is required' },
3760
- { name: 'type', message: typeValidationMessage },
3761
- { name: 'minLength', message: minLengthValidationMessage },
3762
- { name: 'maxLength', message: maxLengthValidationMessage },
3763
- { name: 'min', message: minValidationMessage },
3764
- { name: 'max', message: maxValidationMessage },
3765
- { name: 'multipleOf', message: multipleOfValidationMessage },
3766
- { name: 'exclusiveMinimum', message: exclusiveMinimumValidationMessage },
3767
- { name: 'exclusiveMaximum', message: exclusiveMaximumValidationMessage },
3768
- { name: 'minItems', message: minItemsValidationMessage },
3769
- { name: 'maxItems', message: maxItemsValidationMessage },
3770
- { name: 'uniqueItems', message: 'Should NOT have duplicate items' },
3771
- { name: 'const', message: constValidationMessage },
3772
- ],
3773
- wrappers: [
3774
- { name: 'gio-with-banner', component: GioFormFieldWrapperComponent },
3775
- { name: 'gio-password-eye', component: GioPasswordEyeWrapperComponent },
3776
- ],
3777
- types: [
3778
- { name: 'null', component: GioFjsNullTypeComponent, wrappers: ['form-field'] },
3779
- { name: 'array', component: GioFjsArrayTypeComponent },
3780
- { name: 'object', component: GioFjsObjectTypeComponent },
3781
- { name: 'multischema', component: GioFjsMultiSchemaTypeComponent },
3782
- {
3783
- name: 'toggle',
3784
- component: GioFjsToggleTypeComponent,
3785
- },
3786
- {
3787
- name: 'gio-headers-array',
3788
- component: GioFjsHeadersTypeComponent,
3789
- },
3790
- ],
3791
- extensions: [
3792
- { name: 'banner', extension: { onPopulate: bannerExtension } },
3793
- { name: 'password-eye', extension: { onPopulate: passwordEyeExtension } },
3794
- ],
3795
- extras: {
3796
- checkExpressionOn: 'changeDetectionCheck',
3797
- },
3798
- }),
3799
- FormlyMaterialModule,
3800
- GioIconsModule,
3801
- GioFormSlideToggleModule,
3802
- GioFormHeadersModule,
3803
- MatSlideToggleModule,
3804
- MatButtonModule,
3805
- ],
3806
- exports: [GioFormJsonSchemaComponent, FormlyModule],
3807
- providers: [GioFormlyJsonSchemaService],
3808
- }]
3951
+ class GioFjsMultiSchemaTypeComponent extends FieldType {
3952
+ ngOnInit() {
3953
+ set(this.field, 'fieldGroup[0].props.appearance', 'fill');
3954
+ set(this.field, 'fieldGroup[0].props.label', 'Select option');
3955
+ }
3956
+ }
3957
+ GioFjsMultiSchemaTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsMultiSchemaTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3958
+ GioFjsMultiSchemaTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsMultiSchemaTypeComponent, selector: "gio-fjs-multi-schema-type", usesInheritance: true, ngImport: i0, template: `
3959
+ <div class="wrapper">
3960
+ <div class="wrapper__title" *ngIf="props.label">{{ props.label }}</div>
3961
+ <p *ngIf="props.description">{{ props.description }}</p>
3962
+ <div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
3963
+ <formly-validation-message [field]="field"></formly-validation-message>
3964
+ </div>
3965
+ <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
3966
+ </div>
3967
+ `, 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"] }] });
3968
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsMultiSchemaTypeComponent, decorators: [{
3969
+ type: Component,
3970
+ args: [{ selector: 'gio-fjs-multi-schema-type', template: `
3971
+ <div class="wrapper">
3972
+ <div class="wrapper__title" *ngIf="props.label">{{ props.label }}</div>
3973
+ <p *ngIf="props.description">{{ props.description }}</p>
3974
+ <div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
3975
+ <formly-validation-message [field]="field"></formly-validation-message>
3976
+ </div>
3977
+ <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
3978
+ </div>
3979
+ `, 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"] }]
3809
3980
  }] });
3810
3981
 
3811
3982
  /*
@@ -3823,9 +3994,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3823
3994
  * See the License for the specific language governing permissions and
3824
3995
  * limitations under the License.
3825
3996
  */
3997
+ class GioFjsToggleTypeComponent extends FieldType {
3998
+ }
3999
+ GioFjsToggleTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsToggleTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
4000
+ GioFjsToggleTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsToggleTypeComponent, selector: "gio-fjs-toggle-type", usesInheritance: true, ngImport: i0, template: `
4001
+ <gio-form-slide-toggle>
4002
+ <gio-form-label>{{ props.label }}</gio-form-label>
4003
+ {{ props.description }}
4004
+ <mat-slide-toggle
4005
+ gioFormSlideToggle
4006
+ [id]="id"
4007
+ [formControl]="formControl"
4008
+ [formlyAttributes]="field"
4009
+ [tabIndex]="props.tabindex"
4010
+ ></mat-slide-toggle>
4011
+ </gio-form-slide-toggle>
4012
+ `, isInline: true, components: [{ type: GioFormSlideToggleComponent, selector: "gio-form-slide-toggle", inputs: ["appearance"] }, { type: GioFormLabelComponent, selector: "gio-form-label" }, { type: i3$2.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex", "name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "checked"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }], directives: [{ type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i1$4.ɵFormlyAttributes, selector: "[formlyAttributes]", inputs: ["formlyAttributes", "id"] }] });
4013
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsToggleTypeComponent, decorators: [{
4014
+ type: Component,
4015
+ args: [{
4016
+ selector: 'gio-fjs-toggle-type',
4017
+ template: `
4018
+ <gio-form-slide-toggle>
4019
+ <gio-form-label>{{ props.label }}</gio-form-label>
4020
+ {{ props.description }}
4021
+ <mat-slide-toggle
4022
+ gioFormSlideToggle
4023
+ [id]="id"
4024
+ [formControl]="formControl"
4025
+ [formlyAttributes]="field"
4026
+ [tabIndex]="props.tabindex"
4027
+ ></mat-slide-toggle>
4028
+ </gio-form-slide-toggle>
4029
+ `,
4030
+ }]
4031
+ }] });
3826
4032
 
3827
4033
  /*
3828
- * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
4034
+ * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
3829
4035
  *
3830
4036
  * Licensed under the Apache License, Version 2.0 (the "License");
3831
4037
  * you may not use this file except in compliance with the License.
@@ -3839,83 +4045,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3839
4045
  * See the License for the specific language governing permissions and
3840
4046
  * limitations under the License.
3841
4047
  */
3842
- class GioBaseFormFocusInvalidDirective {
3843
- constructor(hostElement, formGroupDirective) {
3844
- this.hostElement = hostElement;
3845
- this.formGroupDirective = formGroupDirective;
3846
- }
3847
- focusOnFirstInvalid() {
3848
- const selector = '.ng-invalid[formControlName],input.ng-invalid,mat-select.ng-invalid,textarea.ng-invalid,.gio-ng-invalid';
3849
- try {
3850
- // Mark all controls as touched to display errors
3851
- if (this.formGroupDirective) {
3852
- this.formGroupDirective.control.markAllAsTouched();
3853
- this.formGroupDirective.control.updateValueAndValidity();
3854
- }
3855
- const parentForm = this.hostElement.nativeElement.closest('form');
3856
- const invalidFieldElements = parentForm?.querySelectorAll(selector);
3857
- const invalidControl = this.getFirstInvalidControl(invalidFieldElements);
3858
- if (invalidControl) {
3859
- invalidControl.scrollIntoView({ behavior: 'smooth', block: 'center' });
3860
- invalidControl.focus({ preventScroll: true });
3861
- }
3862
- }
3863
- catch (error) {
3864
- // Best effort. If the focus doesn't work it's not very important
3865
- // 🧪 Useful to avoid som error in tests
3866
- }
3867
- }
3868
- getFirstInvalidControl(invalidFieldElements, index = 0) {
3869
- let invalidControl = invalidFieldElements?.item(index);
3870
- const hasIgnoreAttribute = invalidControl?.attributes?.getNamedItem(GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR);
3871
- if (hasIgnoreAttribute) {
3872
- invalidControl = this.getFirstInvalidControl(invalidFieldElements, index + 1);
3873
- }
3874
- return invalidControl;
3875
- }
3876
- }
3877
- GioBaseFormFocusInvalidDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioBaseFormFocusInvalidDirective, deps: [{ token: i0.ElementRef }, { token: i7.FormGroupDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
3878
- GioBaseFormFocusInvalidDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioBaseFormFocusInvalidDirective, ngImport: i0 });
3879
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioBaseFormFocusInvalidDirective, decorators: [{
3880
- type: Directive
3881
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i7.FormGroupDirective, decorators: [{
3882
- type: Optional
3883
- }] }]; } });
3884
- class GioFormFocusInvalidFormDirective extends GioBaseFormFocusInvalidDirective {
3885
- onFormSubmit() {
3886
- this.focusOnFirstInvalid();
4048
+ class GioFjsHeadersTypeComponent extends FieldType {
4049
+ constructor() {
4050
+ super(...arguments);
4051
+ this.defaultOptions = {
4052
+ props: {
4053
+ outputConfig: {
4054
+ keyName: 'name',
4055
+ valueName: 'value',
4056
+ },
4057
+ },
4058
+ };
4059
+ this.collapse = false;
3887
4060
  }
3888
- }
3889
- GioFormFocusInvalidFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidFormDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
3890
- GioFormFocusInvalidFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioFormFocusInvalidFormDirective, selector: "form[gioFormFocusInvalid]", host: { listeners: { "submit": "onFormSubmit()" } }, usesInheritance: true, ngImport: i0 });
3891
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidFormDirective, decorators: [{
3892
- type: Directive,
3893
- args: [{
3894
- selector: 'form[gioFormFocusInvalid]',
3895
- }]
3896
- }], propDecorators: { onFormSubmit: [{
3897
- type: HostListener,
3898
- args: ['submit']
3899
- }] } });
3900
- class GioButtonFocusInvalidButtonDirective extends GioBaseFormFocusInvalidDirective {
3901
- onClick() {
3902
- this.focusOnFirstInvalid();
4061
+ get map() {
4062
+ return (headers) => [...(headers ?? [])].map(header => {
4063
+ return {
4064
+ [this.props.outputConfig.keyName]: header.key,
4065
+ [this.props.outputConfig.valueName]: header.value,
4066
+ };
4067
+ });
3903
4068
  }
3904
4069
  }
3905
- GioButtonFocusInvalidButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioButtonFocusInvalidButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
3906
- GioButtonFocusInvalidButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioButtonFocusInvalidButtonDirective, selector: "button[gioFormFocusInvalid]", host: { listeners: { "click": "onClick()" } }, usesInheritance: true, ngImport: i0 });
3907
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioButtonFocusInvalidButtonDirective, decorators: [{
3908
- type: Directive,
3909
- args: [{
3910
- selector: 'button[gioFormFocusInvalid]',
3911
- }]
3912
- }], propDecorators: { onClick: [{
3913
- type: HostListener,
3914
- args: ['click']
3915
- }] } });
4070
+ GioFjsHeadersTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsHeadersTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
4071
+ GioFjsHeadersTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsHeadersTypeComponent, selector: "gio-fjs-headers-type", usesInheritance: true, ngImport: i0, template: `
4072
+ <div class="wrapper">
4073
+ <div class="wrapper__header">
4074
+ <div class="wrapper__header__text">
4075
+ <div class="wrapper__header__text__title" *ngIf="to.label">{{ to.label }}</div>
4076
+ <p *ngIf="to.description">{{ to.description }}</p>
4077
+ </div>
4078
+ <div class="wrapper__header__collapse">
4079
+ <button type="button" mat-icon-button aria-label="Collapse" (click)="collapse = !collapse">
4080
+ <mat-icon [class.collapse-open]="collapse" [class.collapse-close]="!collapse" svgIcon="gio:nav-arrow-down"></mat-icon>
4081
+ </button>
4082
+ </div>
4083
+ </div>
4084
+ <div class="wrapper__error" *ngIf="showError && formControl.errors">
4085
+ <formly-validation-message [field]="field"></formly-validation-message>
4086
+ </div>
4087
+ <div *ngIf="!collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
4088
+ <gio-form-headers [adaptOutputFn]="map" [formControl]="formControl"></gio-form-headers>
4089
+ </div>
4090
+ </div>
4091
+ `, isInline: true, 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"], components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i1$4.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { type: GioFormHeadersComponent, selector: "gio-form-headers", inputs: ["adaptOutputFn"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
4092
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsHeadersTypeComponent, decorators: [{
4093
+ type: Component,
4094
+ args: [{ selector: 'gio-fjs-headers-type', template: `
4095
+ <div class="wrapper">
4096
+ <div class="wrapper__header">
4097
+ <div class="wrapper__header__text">
4098
+ <div class="wrapper__header__text__title" *ngIf="to.label">{{ to.label }}</div>
4099
+ <p *ngIf="to.description">{{ to.description }}</p>
4100
+ </div>
4101
+ <div class="wrapper__header__collapse">
4102
+ <button type="button" mat-icon-button aria-label="Collapse" (click)="collapse = !collapse">
4103
+ <mat-icon [class.collapse-open]="collapse" [class.collapse-close]="!collapse" svgIcon="gio:nav-arrow-down"></mat-icon>
4104
+ </button>
4105
+ </div>
4106
+ </div>
4107
+ <div class="wrapper__error" *ngIf="showError && formControl.errors">
4108
+ <formly-validation-message [field]="field"></formly-validation-message>
4109
+ </div>
4110
+ <div *ngIf="!collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
4111
+ <gio-form-headers [adaptOutputFn]="map" [formControl]="formControl"></gio-form-headers>
4112
+ </div>
4113
+ </div>
4114
+ `, 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"] }]
4115
+ }] });
3916
4116
 
3917
4117
  /*
3918
- * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
4118
+ * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
3919
4119
  *
3920
4120
  * Licensed under the Apache License, Version 2.0 (the "License");
3921
4121
  * you may not use this file except in compliance with the License.
@@ -3929,35 +4129,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3929
4129
  * See the License for the specific language governing permissions and
3930
4130
  * limitations under the License.
3931
4131
  */
3932
- class GioFormFocusInvalidModule {
4132
+ class GioPasswordEyeWrapperComponent extends FieldWrapper {
4133
+ constructor() {
4134
+ super(...arguments);
4135
+ this.hide = true;
4136
+ }
4137
+ ngAfterViewInit() {
4138
+ if (this.matSuffix) {
4139
+ this.props.suffix = this.matSuffix;
4140
+ }
4141
+ }
4142
+ addonEyeClick($event) {
4143
+ $event.stopPropagation();
4144
+ this.hide = !this.hide;
4145
+ this.props.type = this.hide ? 'password' : 'text';
4146
+ }
4147
+ }
4148
+ GioPasswordEyeWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPasswordEyeWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
4149
+ 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: `
4150
+ <ng-container #fieldComponent></ng-container>
4151
+
4152
+ <ng-template #matSuffix>
4153
+ <span style="cursor: pointer" (click)="addonEyeClick($event)">
4154
+ <mat-icon [svgIcon]="hide ? 'gio:eye-empty' : 'gio:eye-off'"></mat-icon>
4155
+ </span>
4156
+ </ng-template>
4157
+ `, isInline: true, components: [{ type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
4158
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioPasswordEyeWrapperComponent, decorators: [{
4159
+ type: Component,
4160
+ args: [{
4161
+ selector: 'gio-password-eye-wrapper',
4162
+ template: `
4163
+ <ng-container #fieldComponent></ng-container>
4164
+
4165
+ <ng-template #matSuffix>
4166
+ <span style="cursor: pointer" (click)="addonEyeClick($event)">
4167
+ <mat-icon [svgIcon]="hide ? 'gio:eye-empty' : 'gio:eye-off'"></mat-icon>
4168
+ </span>
4169
+ </ng-template>
4170
+ `,
4171
+ }]
4172
+ }], propDecorators: { matSuffix: [{
4173
+ type: ViewChild,
4174
+ args: ['matSuffix', { static: true }]
4175
+ }] } });
4176
+ function passwordEyeExtension(field) {
4177
+ if (!field.props || (field.wrappers && field.wrappers.indexOf('gio-password-eye') !== -1)) {
4178
+ return;
4179
+ }
4180
+ if (field.props.type === 'password') {
4181
+ field.wrappers = [...(field.wrappers || []), 'gio-password-eye'];
4182
+ }
3933
4183
  }
3934
- GioFormFocusInvalidModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3935
- GioFormFocusInvalidModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, declarations: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective], exports: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective] });
3936
- GioFormFocusInvalidModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule });
3937
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, decorators: [{
3938
- type: NgModule,
3939
- args: [{
3940
- declarations: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective],
3941
- exports: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective],
3942
- }]
3943
- }] });
3944
-
3945
- /*
3946
- * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
3947
- *
3948
- * Licensed under the Apache License, Version 2.0 (the "License");
3949
- * you may not use this file except in compliance with the License.
3950
- * You may obtain a copy of the License at
3951
- *
3952
- * http://www.apache.org/licenses/LICENSE-2.0
3953
- *
3954
- * Unless required by applicable law or agreed to in writing, software
3955
- * distributed under the License is distributed on an "AS IS" BASIS,
3956
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3957
- * See the License for the specific language governing permissions and
3958
- * limitations under the License.
3959
- */
3960
- const GIO_MONACO_EDITOR_CONFIG = new InjectionToken('gio-monaco-editor-config');
3961
4184
 
3962
4185
  /*
3963
4186
  * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
@@ -3974,57 +4197,45 @@ const GIO_MONACO_EDITOR_CONFIG = new InjectionToken('gio-monaco-editor-config');
3974
4197
  * See the License for the specific language governing permissions and
3975
4198
  * limitations under the License.
3976
4199
  */
3977
- class GioMonacoEditorService {
3978
- constructor() {
3979
- this.loaded$ = new ReplaySubject(1);
3980
- this.loaded = false;
3981
- }
3982
- loadEditor() {
3983
- if (this.loaded) {
3984
- // Already loaded, do nothing.
3985
- return Promise.resolve();
3986
- }
3987
- this.loaded = true;
3988
- return new Promise(resolve => {
3989
- // Monaco is already loaded
3990
- if (typeof window.monaco === 'object') {
3991
- resolve();
3992
- return;
3993
- }
3994
- const onGotAmdLoader = () => {
3995
- // Load Monaco
3996
- window.require.config({ paths: { vs: 'assets/monaco-editor/min/vs' } });
3997
- window.require(['vs/editor/editor.main'], () => {
3998
- resolve();
3999
- });
4000
- };
4001
- // Load AMD loader if necessary
4002
- if (!window.require) {
4003
- const loaderScript = document.createElement('script');
4004
- loaderScript.type = 'text/javascript';
4005
- loaderScript.src = 'assets/monaco-editor/min/vs/loader.js';
4006
- loaderScript.addEventListener('load', onGotAmdLoader);
4007
- document.body.appendChild(loaderScript);
4008
- }
4009
- else {
4010
- onGotAmdLoader();
4011
- }
4012
- }).then(() => {
4013
- this.loaded$.next({ monaco: window.monaco });
4014
- });
4200
+ class GioFjsCodeEditorTypeComponent extends FieldType$1 {
4201
+ ngOnInit() {
4202
+ this.languageConfig = undefined;
4015
4203
  }
4016
4204
  }
4017
- GioMonacoEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4018
- GioMonacoEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorService, providedIn: 'root' });
4019
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorService, decorators: [{
4020
- type: Injectable,
4205
+ GioFjsCodeEditorTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsCodeEditorTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
4206
+ GioFjsCodeEditorTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsCodeEditorTypeComponent, selector: "gio-fjs-code-editor-type", usesInheritance: true, ngImport: i0, template: `
4207
+ <gio-monaco-editor
4208
+ gioMonacoEditorFormField
4209
+ ngDefaultControl
4210
+ [formControl]="formControl"
4211
+ [languageConfig]="languageConfig"
4212
+ ></gio-monaco-editor>
4213
+ `, isInline: true, styles: ["gio-monaco-editor{min-height:38px}\n"], components: [{ type: GioMonacoEditorComponent, selector: "gio-monaco-editor", inputs: ["languageConfig", "options"] }], directives: [{ type: GioMonacoEditorFormFieldDirective, selector: "[gioMonacoEditorFormField]", inputs: ["placeholder", "required", "disabled"] }, { type: i7.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4214
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsCodeEditorTypeComponent, decorators: [{
4215
+ type: Component,
4021
4216
  args: [{
4022
- providedIn: 'root',
4217
+ selector: 'gio-fjs-code-editor-type',
4218
+ template: `
4219
+ <gio-monaco-editor
4220
+ gioMonacoEditorFormField
4221
+ ngDefaultControl
4222
+ [formControl]="formControl"
4223
+ [languageConfig]="languageConfig"
4224
+ ></gio-monaco-editor>
4225
+ `,
4226
+ styles: [
4227
+ `
4228
+ gio-monaco-editor {
4229
+ min-height: 38px;
4230
+ }
4231
+ `,
4232
+ ],
4233
+ changeDetection: ChangeDetectionStrategy.OnPush,
4023
4234
  }]
4024
4235
  }] });
4025
4236
 
4026
4237
  /*
4027
- * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
4238
+ * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
4028
4239
  *
4029
4240
  * Licensed under the Apache License, Version 2.0 (the "License");
4030
4241
  * you may not use this file except in compliance with the License.
@@ -4038,56 +4249,167 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
4038
4249
  * See the License for the specific language governing permissions and
4039
4250
  * limitations under the License.
4040
4251
  */
4041
- class GioLanguageJsonService {
4042
- constructor(codeEditorService) {
4043
- this.unsubscribe$ = new Subject();
4044
- codeEditorService.loaded$.pipe(takeUntil(this.unsubscribe$)).subscribe(event => {
4045
- this.setup(event.monaco);
4046
- });
4047
- }
4048
- ngOnDestroy() {
4049
- this.unsubscribe$.next();
4050
- this.unsubscribe$.complete();
4051
- }
4052
- setup(monaco) {
4053
- if (!monaco) {
4054
- throw new Error('Monaco is not loaded');
4055
- }
4056
- this.monaco = monaco;
4057
- const defaults = monaco.languages.json.jsonDefaults;
4058
- defaults.setDiagnosticsOptions({
4059
- validate: true,
4060
- allowComments: true,
4061
- });
4062
- }
4063
- addSchemas(id, definitions = []) {
4064
- if (!this.monaco) {
4065
- throw new Error('Monaco is not loaded');
4066
- }
4067
- const defaults = this.monaco.languages.json.jsonDefaults;
4068
- const options = defaults.diagnosticsOptions;
4069
- let schemas = definitions.map(({ uri, schema }) => ({
4070
- uri,
4071
- schema,
4072
- fileMatch: [id || '*.json'],
4073
- }));
4074
- if (options && options.schemas && options.schemas.length > 0) {
4075
- schemas = [...options.schemas, ...schemas];
4076
- }
4077
- defaults.setDiagnosticsOptions({
4078
- ...options,
4079
- schemas: schemas,
4080
- });
4081
- }
4252
+ class GioFormJsonSchemaModule {
4082
4253
  }
4083
- GioLanguageJsonService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioLanguageJsonService, deps: [{ token: GioMonacoEditorService }], target: i0.ɵɵFactoryTarget.Injectable });
4084
- GioLanguageJsonService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioLanguageJsonService, providedIn: 'root' });
4085
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioLanguageJsonService, decorators: [{
4086
- type: Injectable,
4254
+ GioFormJsonSchemaModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4255
+ GioFormJsonSchemaModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, declarations: [GioFormJsonSchemaComponent,
4256
+ GioFjsNullTypeComponent,
4257
+ GioFjsObjectTypeComponent,
4258
+ GioFjsMultiSchemaTypeComponent,
4259
+ GioFjsArrayTypeComponent,
4260
+ GioFjsToggleTypeComponent,
4261
+ GioFjsHeadersTypeComponent,
4262
+ GioFjsCodeEditorTypeComponent,
4263
+ GioBannerWrapperComponent,
4264
+ GioPasswordEyeWrapperComponent], imports: [CommonModule,
4265
+ A11yModule,
4266
+ ReactiveFormsModule, i1$4.FormlyModule, FormlyMaterialModule,
4267
+ MatInputModule,
4268
+ GioIconsModule,
4269
+ GioFormSlideToggleModule,
4270
+ GioFormHeadersModule,
4271
+ GioMonacoEditorModule,
4272
+ MatSlideToggleModule,
4273
+ MatButtonModule], exports: [GioFormJsonSchemaComponent, FormlyModule] });
4274
+ GioFormJsonSchemaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, providers: [GioFormlyJsonSchemaService], imports: [[
4275
+ CommonModule,
4276
+ A11yModule,
4277
+ ReactiveFormsModule,
4278
+ FormlyModule.forRoot({
4279
+ validationMessages: [
4280
+ { name: 'required', message: 'This field is required' },
4281
+ { name: 'type', message: typeValidationMessage },
4282
+ { name: 'minLength', message: minLengthValidationMessage },
4283
+ { name: 'maxLength', message: maxLengthValidationMessage },
4284
+ { name: 'min', message: minValidationMessage },
4285
+ { name: 'max', message: maxValidationMessage },
4286
+ { name: 'multipleOf', message: multipleOfValidationMessage },
4287
+ { name: 'exclusiveMinimum', message: exclusiveMinimumValidationMessage },
4288
+ { name: 'exclusiveMaximum', message: exclusiveMaximumValidationMessage },
4289
+ { name: 'minItems', message: minItemsValidationMessage },
4290
+ { name: 'maxItems', message: maxItemsValidationMessage },
4291
+ { name: 'uniqueItems', message: 'Should NOT have duplicate items' },
4292
+ { name: 'const', message: constValidationMessage },
4293
+ ],
4294
+ wrappers: [
4295
+ { name: 'gio-with-banner', component: GioBannerWrapperComponent },
4296
+ { name: 'gio-password-eye', component: GioPasswordEyeWrapperComponent },
4297
+ ],
4298
+ types: [
4299
+ { name: 'null', component: GioFjsNullTypeComponent, wrappers: ['form-field'] },
4300
+ { name: 'array', component: GioFjsArrayTypeComponent },
4301
+ { name: 'object', component: GioFjsObjectTypeComponent },
4302
+ { name: 'multischema', component: GioFjsMultiSchemaTypeComponent },
4303
+ {
4304
+ name: 'toggle',
4305
+ component: GioFjsToggleTypeComponent,
4306
+ },
4307
+ {
4308
+ name: 'gio-code-editor',
4309
+ component: GioFjsCodeEditorTypeComponent,
4310
+ wrappers: ['form-field'],
4311
+ },
4312
+ {
4313
+ name: 'gio-headers-array',
4314
+ component: GioFjsHeadersTypeComponent,
4315
+ },
4316
+ ],
4317
+ extensions: [
4318
+ { name: 'banner', extension: { onPopulate: bannerExtension } },
4319
+ { name: 'password-eye', extension: { onPopulate: passwordEyeExtension } },
4320
+ ],
4321
+ extras: {
4322
+ checkExpressionOn: 'changeDetectionCheck',
4323
+ },
4324
+ }),
4325
+ FormlyMaterialModule,
4326
+ MatInputModule,
4327
+ GioIconsModule,
4328
+ GioFormSlideToggleModule,
4329
+ GioFormHeadersModule,
4330
+ GioMonacoEditorModule,
4331
+ MatSlideToggleModule,
4332
+ MatButtonModule,
4333
+ ], FormlyModule] });
4334
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, decorators: [{
4335
+ type: NgModule,
4087
4336
  args: [{
4088
- providedIn: 'root',
4337
+ declarations: [
4338
+ GioFormJsonSchemaComponent,
4339
+ GioFjsNullTypeComponent,
4340
+ GioFjsObjectTypeComponent,
4341
+ GioFjsMultiSchemaTypeComponent,
4342
+ GioFjsArrayTypeComponent,
4343
+ GioFjsToggleTypeComponent,
4344
+ GioFjsHeadersTypeComponent,
4345
+ GioFjsCodeEditorTypeComponent,
4346
+ GioBannerWrapperComponent,
4347
+ GioPasswordEyeWrapperComponent,
4348
+ ],
4349
+ imports: [
4350
+ CommonModule,
4351
+ A11yModule,
4352
+ ReactiveFormsModule,
4353
+ FormlyModule.forRoot({
4354
+ validationMessages: [
4355
+ { name: 'required', message: 'This field is required' },
4356
+ { name: 'type', message: typeValidationMessage },
4357
+ { name: 'minLength', message: minLengthValidationMessage },
4358
+ { name: 'maxLength', message: maxLengthValidationMessage },
4359
+ { name: 'min', message: minValidationMessage },
4360
+ { name: 'max', message: maxValidationMessage },
4361
+ { name: 'multipleOf', message: multipleOfValidationMessage },
4362
+ { name: 'exclusiveMinimum', message: exclusiveMinimumValidationMessage },
4363
+ { name: 'exclusiveMaximum', message: exclusiveMaximumValidationMessage },
4364
+ { name: 'minItems', message: minItemsValidationMessage },
4365
+ { name: 'maxItems', message: maxItemsValidationMessage },
4366
+ { name: 'uniqueItems', message: 'Should NOT have duplicate items' },
4367
+ { name: 'const', message: constValidationMessage },
4368
+ ],
4369
+ wrappers: [
4370
+ { name: 'gio-with-banner', component: GioBannerWrapperComponent },
4371
+ { name: 'gio-password-eye', component: GioPasswordEyeWrapperComponent },
4372
+ ],
4373
+ types: [
4374
+ { name: 'null', component: GioFjsNullTypeComponent, wrappers: ['form-field'] },
4375
+ { name: 'array', component: GioFjsArrayTypeComponent },
4376
+ { name: 'object', component: GioFjsObjectTypeComponent },
4377
+ { name: 'multischema', component: GioFjsMultiSchemaTypeComponent },
4378
+ {
4379
+ name: 'toggle',
4380
+ component: GioFjsToggleTypeComponent,
4381
+ },
4382
+ {
4383
+ name: 'gio-code-editor',
4384
+ component: GioFjsCodeEditorTypeComponent,
4385
+ wrappers: ['form-field'],
4386
+ },
4387
+ {
4388
+ name: 'gio-headers-array',
4389
+ component: GioFjsHeadersTypeComponent,
4390
+ },
4391
+ ],
4392
+ extensions: [
4393
+ { name: 'banner', extension: { onPopulate: bannerExtension } },
4394
+ { name: 'password-eye', extension: { onPopulate: passwordEyeExtension } },
4395
+ ],
4396
+ extras: {
4397
+ checkExpressionOn: 'changeDetectionCheck',
4398
+ },
4399
+ }),
4400
+ FormlyMaterialModule,
4401
+ MatInputModule,
4402
+ GioIconsModule,
4403
+ GioFormSlideToggleModule,
4404
+ GioFormHeadersModule,
4405
+ GioMonacoEditorModule,
4406
+ MatSlideToggleModule,
4407
+ MatButtonModule,
4408
+ ],
4409
+ exports: [GioFormJsonSchemaComponent, FormlyModule],
4410
+ providers: [GioFormlyJsonSchemaService],
4089
4411
  }]
4090
- }], ctorParameters: function () { return [{ type: GioMonacoEditorService }]; } });
4412
+ }] });
4091
4413
 
4092
4414
  /*
4093
4415
  * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
@@ -4104,151 +4426,95 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
4104
4426
  * See the License for the specific language governing permissions and
4105
4427
  * limitations under the License.
4106
4428
  */
4107
- class GioMonacoEditorComponent {
4108
- constructor(config, monacoEditorService, languageJsonService, hostElement, changeDetectorRef, ngZone) {
4109
- this.config = config;
4110
- this.monacoEditorService = monacoEditorService;
4111
- this.languageJsonService = languageJsonService;
4429
+
4430
+ /*
4431
+ * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
4432
+ *
4433
+ * Licensed under the Apache License, Version 2.0 (the "License");
4434
+ * you may not use this file except in compliance with the License.
4435
+ * You may obtain a copy of the License at
4436
+ *
4437
+ * http://www.apache.org/licenses/LICENSE-2.0
4438
+ *
4439
+ * Unless required by applicable law or agreed to in writing, software
4440
+ * distributed under the License is distributed on an "AS IS" BASIS,
4441
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4442
+ * See the License for the specific language governing permissions and
4443
+ * limitations under the License.
4444
+ */
4445
+ class GioBaseFormFocusInvalidDirective {
4446
+ constructor(hostElement, formGroupDirective) {
4112
4447
  this.hostElement = hostElement;
4113
- this.changeDetectorRef = changeDetectorRef;
4114
- this.ngZone = ngZone;
4115
- this.options = {};
4116
- this.id = uniqueId('gio-monaco-editor-');
4117
- this.loading = true;
4118
- this.defaultOptions = {
4119
- contextmenu: false,
4120
- minimap: {
4121
- enabled: true,
4122
- },
4123
- automaticLayout: true,
4124
- scrollBeyondLastLine: false,
4125
- };
4126
- this.value = '';
4127
- this.readOnly = false;
4128
- this._onChange = () => ({});
4129
- this._onTouched = () => ({});
4130
- this.unsubscribe$ = new Subject();
4131
- this.monacoEditorService.loadEditor();
4132
- }
4133
- ngAfterViewInit() {
4134
- // Wait until monaco editor is available
4135
- this.monacoEditorService.loaded$.pipe(takeUntil(this.unsubscribe$)).subscribe(({ monaco }) => {
4136
- this.setupEditor(monaco);
4137
- this.loading = false;
4138
- this.changeDetectorRef.detectChanges();
4139
- });
4448
+ this.formGroupDirective = formGroupDirective;
4140
4449
  }
4141
- ngOnDestroy() {
4142
- if (this.standaloneCodeEditor) {
4143
- this.standaloneCodeEditor.dispose();
4144
- this.standaloneCodeEditor = undefined;
4450
+ focusOnFirstInvalid() {
4451
+ const selector = '.ng-invalid[formControlName],input.ng-invalid,mat-select.ng-invalid,textarea.ng-invalid,.gio-ng-invalid';
4452
+ try {
4453
+ // Mark all controls as touched to display errors
4454
+ if (this.formGroupDirective) {
4455
+ this.formGroupDirective.control.markAllAsTouched();
4456
+ this.formGroupDirective.control.updateValueAndValidity();
4457
+ }
4458
+ const parentForm = this.hostElement.nativeElement.closest('form');
4459
+ const invalidFieldElements = parentForm?.querySelectorAll(selector);
4460
+ const invalidControl = this.getFirstInvalidControl(invalidFieldElements);
4461
+ if (invalidControl) {
4462
+ invalidControl.scrollIntoView({ behavior: 'smooth', block: 'center' });
4463
+ invalidControl.focus({ preventScroll: true });
4464
+ }
4145
4465
  }
4146
- if (this.textModel) {
4147
- this.textModel.dispose();
4148
- this.textModel = undefined;
4466
+ catch (error) {
4467
+ // Best effort. If the focus doesn't work it's not very important
4468
+ // 🧪 Useful to avoid som error in tests
4149
4469
  }
4150
- this.unsubscribe$.next();
4151
- this.unsubscribe$.complete();
4152
4470
  }
4153
- // From ControlValueAccessor interface
4154
- writeValue(_value) {
4155
- if (_value) {
4156
- this.value = _value;
4157
- }
4158
- if (this.textModel) {
4159
- this.textModel.setValue(this.value);
4471
+ getFirstInvalidControl(invalidFieldElements, index = 0) {
4472
+ let invalidControl = invalidFieldElements?.item(index);
4473
+ const hasIgnoreAttribute = invalidControl?.attributes?.getNamedItem(GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR);
4474
+ if (hasIgnoreAttribute) {
4475
+ invalidControl = this.getFirstInvalidControl(invalidFieldElements, index + 1);
4160
4476
  }
4477
+ return invalidControl;
4161
4478
  }
4162
- // From ControlValueAccessor interface
4163
- registerOnChange(fn) {
4164
- this._onChange = fn;
4165
- }
4166
- // From ControlValueAccessor interface
4167
- registerOnTouched(fn) {
4168
- this._onTouched = fn;
4169
- }
4170
- // From ControlValueAccessor interface
4171
- setDisabledState(isDisabled) {
4172
- this.readOnly = isDisabled;
4173
- }
4174
- setupEditor(monaco) {
4175
- if (!this.hostElement) {
4176
- throw new Error('No editor ref found.');
4177
- }
4178
- const domElement = this.hostElement.nativeElement;
4179
- const settings = {
4180
- value: this.value,
4181
- language: this.languageConfig?.language ?? 'text',
4182
- uri: `code-${uniqueId()}`,
4183
- };
4184
- this.ngZone.runOutsideAngular(() => {
4185
- this.textModel = monaco.editor.createModel(settings.value, settings.language, monaco.Uri.parse(settings.uri));
4186
- });
4187
- const options = Object.assign({}, this.defaultOptions, this.options, {
4188
- readOnly: this.readOnly,
4189
- theme: this.config.theme ?? 'vs',
4190
- model: this.textModel,
4191
- });
4192
- this.standaloneCodeEditor = monaco.editor.create(domElement, {
4193
- ...options,
4194
- });
4195
- this.textModel?.onDidChangeContent(() => {
4196
- const newValue = this.textModel?.getValue();
4197
- this.ngZone.run(() => {
4198
- newValue && this._onChange(newValue);
4199
- this._onTouched();
4200
- });
4201
- });
4202
- this.standaloneCodeEditor?.onDidBlurEditorWidget(() => {
4203
- this.ngZone.run(() => {
4204
- this._onTouched();
4205
- });
4206
- });
4207
- this.setupLanguage(settings.uri, this.languageConfig);
4479
+ }
4480
+ GioBaseFormFocusInvalidDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioBaseFormFocusInvalidDirective, deps: [{ token: i0.ElementRef }, { token: i7.FormGroupDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
4481
+ GioBaseFormFocusInvalidDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioBaseFormFocusInvalidDirective, ngImport: i0 });
4482
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioBaseFormFocusInvalidDirective, decorators: [{
4483
+ type: Directive
4484
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i7.FormGroupDirective, decorators: [{
4485
+ type: Optional
4486
+ }] }]; } });
4487
+ class GioFormFocusInvalidFormDirective extends GioBaseFormFocusInvalidDirective {
4488
+ onFormSubmit() {
4489
+ this.focusOnFirstInvalid();
4208
4490
  }
4209
- setupLanguage(uri, languageConfig) {
4210
- if (!languageConfig) {
4211
- return;
4212
- }
4213
- const { language } = languageConfig;
4214
- if (language) {
4215
- const lang = language.toLowerCase();
4216
- switch (lang) {
4217
- case 'json':
4218
- if (languageConfig.schemas) {
4219
- this.languageJsonService.addSchemas(uri, languageConfig.schemas);
4220
- }
4221
- break;
4222
- default:
4223
- break;
4224
- }
4225
- }
4491
+ }
4492
+ GioFormFocusInvalidFormDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidFormDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
4493
+ GioFormFocusInvalidFormDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioFormFocusInvalidFormDirective, selector: "form[gioFormFocusInvalid]", host: { listeners: { "submit": "onFormSubmit()" } }, usesInheritance: true, ngImport: i0 });
4494
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidFormDirective, decorators: [{
4495
+ type: Directive,
4496
+ args: [{
4497
+ selector: 'form[gioFormFocusInvalid]',
4498
+ }]
4499
+ }], propDecorators: { onFormSubmit: [{
4500
+ type: HostListener,
4501
+ args: ['submit']
4502
+ }] } });
4503
+ class GioButtonFocusInvalidButtonDirective extends GioBaseFormFocusInvalidDirective {
4504
+ onClick() {
4505
+ this.focusOnFirstInvalid();
4226
4506
  }
4227
4507
  }
4228
- GioMonacoEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorComponent, deps: [{ token: GIO_MONACO_EDITOR_CONFIG }, { token: GioMonacoEditorService }, { token: GioLanguageJsonService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
4229
- GioMonacoEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioMonacoEditorComponent, selector: "gio-monaco-editor", inputs: { languageConfig: "languageConfig", options: "options" }, providers: [
4230
- {
4231
- provide: NG_VALUE_ACCESSOR,
4232
- useExisting: forwardRef(() => GioMonacoEditorComponent),
4233
- multi: true,
4234
- },
4235
- ], ngImport: i0, template: ` <div *ngIf="loading">Loading...</div>`, isInline: true, styles: [":host{display:block;height:100%;min-height:150px}\n"], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4236
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorComponent, decorators: [{
4237
- type: Component,
4238
- args: [{ selector: 'gio-monaco-editor', template: ` <div *ngIf="loading">Loading...</div>`, providers: [
4239
- {
4240
- provide: NG_VALUE_ACCESSOR,
4241
- useExisting: forwardRef(() => GioMonacoEditorComponent),
4242
- multi: true,
4243
- },
4244
- ], styles: [":host{display:block;height:100%;min-height:150px}\n"] }]
4245
- }], ctorParameters: function () { return [{ type: undefined, decorators: [{
4246
- type: Inject,
4247
- args: [GIO_MONACO_EDITOR_CONFIG]
4248
- }] }, { type: GioMonacoEditorService }, { type: GioLanguageJsonService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { languageConfig: [{
4249
- type: Input
4250
- }], options: [{
4251
- type: Input
4508
+ GioButtonFocusInvalidButtonDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioButtonFocusInvalidButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
4509
+ GioButtonFocusInvalidButtonDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioButtonFocusInvalidButtonDirective, selector: "button[gioFormFocusInvalid]", host: { listeners: { "click": "onClick()" } }, usesInheritance: true, ngImport: i0 });
4510
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioButtonFocusInvalidButtonDirective, decorators: [{
4511
+ type: Directive,
4512
+ args: [{
4513
+ selector: 'button[gioFormFocusInvalid]',
4514
+ }]
4515
+ }], propDecorators: { onClick: [{
4516
+ type: HostListener,
4517
+ args: ['click']
4252
4518
  }] } });
4253
4519
 
4254
4520
  /*
@@ -4266,39 +4532,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
4266
4532
  * See the License for the specific language governing permissions and
4267
4533
  * limitations under the License.
4268
4534
  */
4269
- class GioMonacoEditorModule {
4270
- static forRoot(config) {
4271
- return {
4272
- ngModule: GioMonacoEditorModule,
4273
- providers: [
4274
- {
4275
- provide: GIO_MONACO_EDITOR_CONFIG,
4276
- useValue: config,
4277
- },
4278
- ],
4279
- };
4280
- }
4535
+ class GioFormFocusInvalidModule {
4281
4536
  }
4282
- GioMonacoEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4283
- GioMonacoEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, declarations: [GioMonacoEditorComponent], imports: [CommonModule, HttpClientModule, ReactiveFormsModule], exports: [GioMonacoEditorComponent] });
4284
- GioMonacoEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, providers: [
4285
- {
4286
- provide: GIO_MONACO_EDITOR_CONFIG,
4287
- useValue: {},
4288
- },
4289
- ], imports: [[CommonModule, HttpClientModule, ReactiveFormsModule]] });
4290
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, decorators: [{
4537
+ GioFormFocusInvalidModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4538
+ GioFormFocusInvalidModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, declarations: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective], exports: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective] });
4539
+ GioFormFocusInvalidModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule });
4540
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, decorators: [{
4291
4541
  type: NgModule,
4292
4542
  args: [{
4293
- imports: [CommonModule, HttpClientModule, ReactiveFormsModule],
4294
- declarations: [GioMonacoEditorComponent],
4295
- exports: [GioMonacoEditorComponent],
4296
- providers: [
4297
- {
4298
- provide: GIO_MONACO_EDITOR_CONFIG,
4299
- useValue: {},
4300
- },
4301
- ],
4543
+ declarations: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective],
4544
+ exports: [GioFormFocusInvalidFormDirective, GioButtonFocusInvalidButtonDirective, GioFormFocusInvalidIgnoreDirective],
4302
4545
  }]
4303
4546
  }] });
4304
4547
 
@@ -4331,25 +4574,12 @@ class GioMonacoEditorTestingComponent extends GioMonacoEditorComponent {
4331
4574
  }
4332
4575
  }
4333
4576
  GioMonacoEditorTestingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorTestingComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
4334
- GioMonacoEditorTestingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioMonacoEditorTestingComponent, selector: "gio-monaco-editor", providers: [
4335
- {
4336
- provide: NG_VALUE_ACCESSOR,
4337
- useExisting: forwardRef(() => GioMonacoEditorTestingComponent),
4338
- multi: true,
4339
- },
4340
- ], usesInheritance: true, ngImport: i0, template: '<input type="text" [value]="getValue" (input)="changeValue($any($event).target?.value)" />', isInline: true });
4577
+ GioMonacoEditorTestingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioMonacoEditorTestingComponent, selector: "gio-monaco-editor", usesInheritance: true, ngImport: i0, template: '<input type="text" [value]="getValue" (input)="changeValue($any($event).target?.value)" />', isInline: true });
4341
4578
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorTestingComponent, decorators: [{
4342
4579
  type: Component,
4343
4580
  args: [{
4344
4581
  selector: 'gio-monaco-editor',
4345
4582
  template: '<input type="text" [value]="getValue" (input)="changeValue($any($event).target?.value)" />',
4346
- providers: [
4347
- {
4348
- provide: NG_VALUE_ACCESSOR,
4349
- useExisting: forwardRef(() => GioMonacoEditorTestingComponent),
4350
- multi: true,
4351
- },
4352
- ],
4353
4583
  }]
4354
4584
  }] });
4355
4585
 
@@ -4500,5 +4730,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
4500
4730
  * Generated bundle index. Do not edit.
4501
4731
  */
4502
4732
 
4503
- export { GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR, GioAvatarComponent, GioAvatarModule, GioBannerActionDirective, GioBannerBodyDirective, GioBannerComponent, GioBannerErrorComponent, GioBannerInfoComponent, GioBannerModule, GioBannerSuccessComponent, GioBannerWarningComponent, GioBaseFormFocusInvalidDirective, GioBreadcrumbComponent, GioBreadcrumbItemDirective, GioBreadcrumbModule, GioButtonFocusInvalidButtonDirective, GioConfirmAndValidateDialogComponent, GioConfirmAndValidateDialogHarness, GioConfirmAndValidateDialogModule, GioConfirmDialogComponent, GioConfirmDialogHarness, GioConfirmDialogModule, GioFormFilePickerAddButtonComponent, GioFormFilePickerComponent, GioFormFilePickerEmptyComponent, GioFormFilePickerInputHarness, GioFormFilePickerLabelComponent, GioFormFilePickerModule, GioFormFocusInvalidFormDirective, GioFormFocusInvalidIgnoreDirective, GioFormFocusInvalidModule, GioFormHeadersComponent, GioFormHeadersHarness, GioFormHeadersModule, GioFormJsonSchemaComponent, GioFormJsonSchemaModule, GioFormLabelComponent, GioFormPrefixDirective, GioFormSlideToggleComponent, GioFormSlideToggleDirective, GioFormSlideToggleModule, GioFormTagsInputComponent, GioFormTagsInputHarness, GioFormTagsInputModule, GioIconsModule, GioLoaderComponent, GioLoaderModule, GioMatConfigModule, GioMenuComponent, GioMenuFooterComponent, GioMenuHeaderComponent, GioMenuItemComponent, GioMenuListComponent, GioMenuModule, GioMenuSelectorComponent, GioMenuSelectorHarness, GioMenuService, GioMonacoEditorComponent, GioMonacoEditorHarness, GioMonacoEditorModule, GioSaveBarComponent, GioSaveBarHarness, GioSaveBarModule, GioSubmenuComponent, GioSubmenuGroupComponent, GioSubmenuItemComponent, GioSubmenuModule, GioSubmenuTitleDirective, GioTopBarComponent, GioTopBarContentComponent, GioTopBarLinkComponent, GioTopBarLinkModule, GioTopBarMenuComponent, GioTopBarMenuModule, GioTopBarModule, NewFile };
4733
+ export { GIO_FORM_FOCUS_INVALID_IGNORE_SELECTOR, GioAvatarComponent, GioAvatarModule, GioBannerActionDirective, GioBannerBodyDirective, GioBannerComponent, GioBannerErrorComponent, GioBannerInfoComponent, GioBannerModule, GioBannerSuccessComponent, GioBannerWarningComponent, GioBaseFormFocusInvalidDirective, GioBreadcrumbComponent, GioBreadcrumbItemDirective, GioBreadcrumbModule, GioButtonFocusInvalidButtonDirective, GioConfirmAndValidateDialogComponent, GioConfirmAndValidateDialogHarness, GioConfirmAndValidateDialogModule, GioConfirmDialogComponent, GioConfirmDialogHarness, GioConfirmDialogModule, GioFormFilePickerAddButtonComponent, GioFormFilePickerComponent, GioFormFilePickerEmptyComponent, GioFormFilePickerInputHarness, GioFormFilePickerLabelComponent, GioFormFilePickerModule, GioFormFocusInvalidFormDirective, GioFormFocusInvalidIgnoreDirective, GioFormFocusInvalidModule, GioFormHeadersComponent, GioFormHeadersHarness, GioFormHeadersModule, GioFormJsonSchemaComponent, GioFormJsonSchemaModule, GioFormLabelComponent, GioFormPrefixDirective, GioFormSlideToggleComponent, GioFormSlideToggleDirective, GioFormSlideToggleModule, GioFormTagsInputComponent, GioFormTagsInputHarness, GioFormTagsInputModule, GioIconsModule, GioLoaderComponent, GioLoaderModule, GioMatConfigModule, GioMenuComponent, GioMenuFooterComponent, GioMenuHeaderComponent, GioMenuItemComponent, GioMenuListComponent, GioMenuModule, GioMenuSelectorComponent, GioMenuSelectorHarness, GioMenuService, GioMonacoEditorComponent, GioMonacoEditorFormFieldDirective, GioMonacoEditorHarness, GioMonacoEditorModule, GioSaveBarComponent, GioSaveBarHarness, GioSaveBarModule, GioSubmenuComponent, GioSubmenuGroupComponent, GioSubmenuItemComponent, GioSubmenuModule, GioSubmenuTitleDirective, GioTopBarComponent, GioTopBarContentComponent, GioTopBarLinkComponent, GioTopBarLinkModule, GioTopBarMenuComponent, GioTopBarMenuModule, GioTopBarModule, NewFile };
4504
4734
  //# sourceMappingURL=gravitee-ui-particles-angular.mjs.map