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