@gravitee/ui-particles-angular 5.11.0 → 5.12.0-improve-json-schema-preview-3034689
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.
- package/esm2020/lib/gio-confirm-and-validate-dialog/gio-confirm-and-validate-dialog.module.mjs +2 -2
- package/esm2020/lib/gio-form-focus-first-invalid/gio-form-focus-first-invalid.directive.mjs +61 -0
- package/esm2020/lib/gio-form-focus-first-invalid/gio-form-focus-first-invalid.module.mjs +31 -0
- package/esm2020/lib/gio-form-json-schema/gio-form-json-schema.component.mjs +11 -3
- package/esm2020/lib/gio-form-json-schema/model/GioJsonSchema.mjs +1 -1
- package/esm2020/lib/gio-form-json-schema/type-component/array-type.component.mjs +9 -9
- package/esm2020/lib/gio-form-json-schema/type-component/multischema-type.component.mjs +3 -3
- package/esm2020/lib/gio-form-json-schema/type-component/object-type.component.mjs +5 -5
- package/esm2020/lib/gio-monaco-editor/gio-monaco-editor.component.mjs +172 -0
- package/esm2020/lib/gio-monaco-editor/gio-monaco-editor.harness.mjs +63 -0
- package/esm2020/lib/gio-monaco-editor/gio-monaco-editor.module.mjs +58 -0
- package/esm2020/lib/gio-monaco-editor/gio-monaco-editor.testing.component.mjs +55 -0
- package/esm2020/lib/gio-monaco-editor/models/GioMonacoEditorConfig.mjs +18 -0
- package/esm2020/lib/gio-monaco-editor/models/MonacoEditorTheme.mjs +2 -0
- package/esm2020/lib/gio-monaco-editor/services/gio-language-json.service.mjs +71 -0
- package/esm2020/lib/gio-monaco-editor/services/gio-monaco-editor.service.mjs +67 -0
- package/esm2020/lib/public-api.mjs +6 -1
- package/fesm2015/gravitee-ui-particles-angular.mjs +573 -20
- package/fesm2015/gravitee-ui-particles-angular.mjs.map +1 -1
- package/fesm2020/gravitee-ui-particles-angular.mjs +584 -20
- package/fesm2020/gravitee-ui-particles-angular.mjs.map +1 -1
- package/lib/gio-form-focus-first-invalid/gio-form-focus-first-invalid.directive.d.ts +11 -0
- package/lib/gio-form-focus-first-invalid/gio-form-focus-first-invalid.module.d.ts +7 -0
- package/lib/gio-form-json-schema/gio-form-json-schema.component.d.ts +1 -0
- package/lib/gio-form-json-schema/model/GioJsonSchema.d.ts +17 -11
- package/lib/gio-monaco-editor/gio-monaco-editor.component.d.ts +45 -0
- package/lib/gio-monaco-editor/gio-monaco-editor.harness.d.ts +16 -0
- package/lib/gio-monaco-editor/gio-monaco-editor.module.d.ts +18 -0
- package/lib/gio-monaco-editor/gio-monaco-editor.testing.component.d.ts +12 -0
- package/lib/gio-monaco-editor/models/GioMonacoEditorConfig.d.ts +6 -0
- package/lib/gio-monaco-editor/models/MonacoEditorTheme.d.ts +1 -0
- package/lib/gio-monaco-editor/services/gio-language-json.service.d.ts +17 -0
- package/lib/gio-monaco-editor/services/gio-monaco-editor.service.d.ts +18 -0
- package/lib/public-api.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { trigger, transition, style, animate } from '@angular/animations';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { EventEmitter, Component, HostBinding, Input, Output, HostListener, NgModule, Optional, Self, ViewChild, Directive, Inject, forwardRef, ChangeDetectionStrategy, Injectable, ViewEncapsulation, ContentChildren, Host, ContentChild } from '@angular/core';
|
|
4
|
-
import { timer, Subject, fromEvent, of, BehaviorSubject } from 'rxjs';
|
|
3
|
+
import { EventEmitter, Component, HostBinding, Input, Output, HostListener, NgModule, Optional, Self, ViewChild, Directive, Inject, forwardRef, ChangeDetectionStrategy, Injectable, ViewEncapsulation, ContentChildren, Host, ContentChild, InjectionToken } from '@angular/core';
|
|
4
|
+
import { timer, Subject, fromEvent, of, BehaviorSubject, ReplaySubject } from 'rxjs';
|
|
5
5
|
import * as i1 from '@angular/material/card';
|
|
6
6
|
import { MatCardModule } from '@angular/material/card';
|
|
7
7
|
import * as i2 from '@angular/material/button';
|
|
@@ -12,8 +12,8 @@ import { ComponentHarness, HarnessPredicate, parallel, TestKey } from '@angular/
|
|
|
12
12
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
13
13
|
import * as i3$1 from '@angular/material/form-field';
|
|
14
14
|
import { MatFormFieldControl, MatFormFieldModule, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
15
|
-
import { isEmpty, toLower, dropRight, isNil, isArray, remove, isObject, cloneDeep, set } from 'lodash';
|
|
16
|
-
import { startWith, map, distinctUntilChanged, tap, debounce, takeUntil, delay, filter, switchMap } from 'rxjs/operators';
|
|
15
|
+
import { isEmpty, toLower, dropRight, isNil, isArray, remove, isObject, cloneDeep, set, uniqueId } from 'lodash';
|
|
16
|
+
import { startWith, map, distinctUntilChanged, tap, debounce, takeUntil, delay, filter, switchMap, debounceTime } from 'rxjs/operators';
|
|
17
17
|
import * as i7 from '@angular/forms';
|
|
18
18
|
import { FormsModule, FormArray, FormGroup, FormControl, NG_VALUE_ACCESSOR, ReactiveFormsModule, NgControl } from '@angular/forms';
|
|
19
19
|
import * as i2$2 from '@angular/cdk/a11y';
|
|
@@ -49,6 +49,7 @@ import { FieldType, FieldArrayType, FieldWrapper, FormlyModule } from '@ngx-form
|
|
|
49
49
|
import { FormlyMaterialModule } from '@ngx-formly/material';
|
|
50
50
|
import * as i3$2 from '@angular/material/slide-toggle';
|
|
51
51
|
import { MatSlideToggle, MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
52
|
+
import { TestBed } from '@angular/core/testing';
|
|
52
53
|
|
|
53
54
|
/*
|
|
54
55
|
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
@@ -2858,6 +2859,7 @@ class GioFormJsonSchemaComponent {
|
|
|
2858
2859
|
this.options = {};
|
|
2859
2860
|
this.model = {};
|
|
2860
2861
|
this.fields = [];
|
|
2862
|
+
this.loading = true;
|
|
2861
2863
|
this._onChange = () => ({});
|
|
2862
2864
|
this._onTouched = () => ({});
|
|
2863
2865
|
this.touched = false;
|
|
@@ -2880,6 +2882,11 @@ class GioFormJsonSchemaComponent {
|
|
|
2880
2882
|
}
|
|
2881
2883
|
}
|
|
2882
2884
|
ngOnInit() {
|
|
2885
|
+
// When the parent form is touched, mark all the sub formGroup as touched
|
|
2886
|
+
const parentControl = this.ngControl?.control?.parent;
|
|
2887
|
+
parentControl?.statusChanges
|
|
2888
|
+
?.pipe(takeUntil(this.unsubscribe$), map(() => parentControl?.touched), filter(touched => touched === true), tap(() => this.formGroup.markAllAsTouched()))
|
|
2889
|
+
.subscribe();
|
|
2883
2890
|
this.formGroup.statusChanges.pipe(takeUntil(this.unsubscribe$)).subscribe(status => {
|
|
2884
2891
|
if (status === 'VALID') {
|
|
2885
2892
|
this.ngControl?.control?.setErrors(null);
|
|
@@ -2891,7 +2898,9 @@ class GioFormJsonSchemaComponent {
|
|
|
2891
2898
|
// To simulate the behavior of classic form controls, emit value only when the form is touched
|
|
2892
2899
|
// Allow to keep the formControl pristine until the user interact with it
|
|
2893
2900
|
this.formGroup.valueChanges
|
|
2894
|
-
.pipe(takeUntil(this.unsubscribe$),
|
|
2901
|
+
.pipe(takeUntil(this.unsubscribe$),
|
|
2902
|
+
// Group all valueChanges events emit by formly in a single one
|
|
2903
|
+
debounceTime(50), filter(() => this.touched))
|
|
2895
2904
|
.subscribe(value => {
|
|
2896
2905
|
this._onChange(value);
|
|
2897
2906
|
});
|
|
@@ -3128,28 +3137,28 @@ GioFjsObjectTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
|
|
|
3128
3137
|
<div class="wrapper">
|
|
3129
3138
|
<div class="wrapper__title" *ngIf="to.label">{{ to.label }}</div>
|
|
3130
3139
|
<p *ngIf="to.description">{{ to.description }}</p>
|
|
3131
|
-
<div class="wrapper__error" *ngIf="showError && formControl.errors">
|
|
3140
|
+
<div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
|
|
3132
3141
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
3133
3142
|
</div>
|
|
3134
3143
|
<div class="wrapper__fields">
|
|
3135
3144
|
<formly-field *ngFor="let f of field.fieldGroup" class="wrapper__fields__field" [field]="f"></formly-field>
|
|
3136
3145
|
</div>
|
|
3137
3146
|
</div>
|
|
3138
|
-
`, 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__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"] }] });
|
|
3147
|
+
`, 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: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"] }] });
|
|
3139
3148
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsObjectTypeComponent, decorators: [{
|
|
3140
3149
|
type: Component,
|
|
3141
3150
|
args: [{ selector: 'gio-fjs-object-type', template: `
|
|
3142
3151
|
<div class="wrapper">
|
|
3143
3152
|
<div class="wrapper__title" *ngIf="to.label">{{ to.label }}</div>
|
|
3144
3153
|
<p *ngIf="to.description">{{ to.description }}</p>
|
|
3145
|
-
<div class="wrapper__error" *ngIf="showError && formControl.errors">
|
|
3154
|
+
<div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
|
|
3146
3155
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
3147
3156
|
</div>
|
|
3148
3157
|
<div class="wrapper__fields">
|
|
3149
3158
|
<formly-field *ngFor="let f of field.fieldGroup" class="wrapper__fields__field" [field]="f"></formly-field>
|
|
3150
3159
|
</div>
|
|
3151
3160
|
</div>
|
|
3152
|
-
`, 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__field:empty{display:none}.wrapper__fields__field+.wrapper__fields__field:not(:empty){display:block;margin-top:8px}\n"] }]
|
|
3161
|
+
`, 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: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"] }]
|
|
3153
3162
|
}] });
|
|
3154
3163
|
|
|
3155
3164
|
/*
|
|
@@ -3175,7 +3184,7 @@ class GioFjsArrayTypeComponent extends FieldArrayType {
|
|
|
3175
3184
|
}
|
|
3176
3185
|
GioFjsArrayTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsArrayTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3177
3186
|
GioFjsArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsArrayTypeComponent, selector: "gio-fjs-array-type", usesInheritance: true, ngImport: i0, template: `
|
|
3178
|
-
<div class="wrapper">
|
|
3187
|
+
<div class="wrapper" [class.error]="formControl.touched && formControl.invalid">
|
|
3179
3188
|
<div class="wrapper__header">
|
|
3180
3189
|
<div class="wrapper__header__text">
|
|
3181
3190
|
<div class="wrapper__header__text__title" *ngIf="to.label">{{ to.label }}</div>
|
|
@@ -3188,11 +3197,11 @@ GioFjsArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0
|
|
|
3188
3197
|
</div>
|
|
3189
3198
|
</div>
|
|
3190
3199
|
|
|
3191
|
-
<div class="wrapper__error" *ngIf="showError && formControl.errors">
|
|
3200
|
+
<div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
|
|
3192
3201
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
3193
3202
|
</div>
|
|
3194
3203
|
|
|
3195
|
-
<div
|
|
3204
|
+
<div [hidden]="collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
|
|
3196
3205
|
<div *ngFor="let field of field.fieldGroup; let i = index" class="wrapper__rows__row">
|
|
3197
3206
|
<formly-field class="wrapper__rows__row__field" [field]="field"></formly-field>
|
|
3198
3207
|
<div class="wrapper__rows__row__remove">
|
|
@@ -3207,11 +3216,11 @@ GioFjsArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0
|
|
|
3207
3216
|
</div>
|
|
3208
3217
|
</div>
|
|
3209
3218
|
</div>
|
|
3210
|
-
`, isInline: true, styles: [".wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.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"] }] });
|
|
3219
|
+
`, 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"] }] });
|
|
3211
3220
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsArrayTypeComponent, decorators: [{
|
|
3212
3221
|
type: Component,
|
|
3213
3222
|
args: [{ selector: 'gio-fjs-array-type', template: `
|
|
3214
|
-
<div class="wrapper">
|
|
3223
|
+
<div class="wrapper" [class.error]="formControl.touched && formControl.invalid">
|
|
3215
3224
|
<div class="wrapper__header">
|
|
3216
3225
|
<div class="wrapper__header__text">
|
|
3217
3226
|
<div class="wrapper__header__text__title" *ngIf="to.label">{{ to.label }}</div>
|
|
@@ -3224,11 +3233,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3224
3233
|
</div>
|
|
3225
3234
|
</div>
|
|
3226
3235
|
|
|
3227
|
-
<div class="wrapper__error" *ngIf="showError && formControl.errors">
|
|
3236
|
+
<div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
|
|
3228
3237
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
3229
3238
|
</div>
|
|
3230
3239
|
|
|
3231
|
-
<div
|
|
3240
|
+
<div [hidden]="collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
|
|
3232
3241
|
<div *ngFor="let field of field.fieldGroup; let i = index" class="wrapper__rows__row">
|
|
3233
3242
|
<formly-field class="wrapper__rows__row__field" [field]="field"></formly-field>
|
|
3234
3243
|
<div class="wrapper__rows__row__remove">
|
|
@@ -3243,7 +3252,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3243
3252
|
</div>
|
|
3244
3253
|
</div>
|
|
3245
3254
|
</div>
|
|
3246
|
-
`, styles: [".wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.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"] }]
|
|
3255
|
+
`, 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"] }]
|
|
3247
3256
|
}] });
|
|
3248
3257
|
|
|
3249
3258
|
function minItemsValidationMessage(error, field) {
|
|
@@ -3340,7 +3349,7 @@ GioFjsMultiSchemaTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
|
3340
3349
|
<div class="wrapper">
|
|
3341
3350
|
<div class="wrapper__title" *ngIf="props.label">{{ props.label }}</div>
|
|
3342
3351
|
<p *ngIf="props.description">{{ props.description }}</p>
|
|
3343
|
-
<div class="wrapper__error" *ngIf="showError && formControl.errors">
|
|
3352
|
+
<div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
|
|
3344
3353
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
3345
3354
|
</div>
|
|
3346
3355
|
<formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
|
|
@@ -3352,7 +3361,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3352
3361
|
<div class="wrapper">
|
|
3353
3362
|
<div class="wrapper__title" *ngIf="props.label">{{ props.label }}</div>
|
|
3354
3363
|
<p *ngIf="props.description">{{ props.description }}</p>
|
|
3355
|
-
<div class="wrapper__error" *ngIf="showError && formControl.errors">
|
|
3364
|
+
<div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
|
|
3356
3365
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
3357
3366
|
</div>
|
|
3358
3367
|
<formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
|
|
@@ -3656,6 +3665,561 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3656
3665
|
* limitations under the License.
|
|
3657
3666
|
*/
|
|
3658
3667
|
|
|
3668
|
+
/*
|
|
3669
|
+
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
3670
|
+
*
|
|
3671
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3672
|
+
* you may not use this file except in compliance with the License.
|
|
3673
|
+
* You may obtain a copy of the License at
|
|
3674
|
+
*
|
|
3675
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3676
|
+
*
|
|
3677
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3678
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3679
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3680
|
+
* See the License for the specific language governing permissions and
|
|
3681
|
+
* limitations under the License.
|
|
3682
|
+
*/
|
|
3683
|
+
class GioFormFocusInvalidDirective {
|
|
3684
|
+
constructor(renderer, formGroupDirective) {
|
|
3685
|
+
this.renderer = renderer;
|
|
3686
|
+
this.formGroupDirective = formGroupDirective;
|
|
3687
|
+
}
|
|
3688
|
+
onFormSubmit() {
|
|
3689
|
+
const selector = '.ng-invalid[formControlName],input.ng-invalid,mat-select.ng-invalid,textarea.ng-invalid,.gio-ng-invalid';
|
|
3690
|
+
try {
|
|
3691
|
+
let invalidControl = this.renderer.selectRootElement(selector, true);
|
|
3692
|
+
// If the form is a GioFormJsonSchema, we need to focus the first invalid control inside
|
|
3693
|
+
if (invalidControl.tagName === 'GIO-FORM-JSON-SCHEMA') {
|
|
3694
|
+
invalidControl = invalidControl.querySelector(selector);
|
|
3695
|
+
}
|
|
3696
|
+
if (invalidControl) {
|
|
3697
|
+
// Mark all controls as touched to display errors
|
|
3698
|
+
if (this.formGroupDirective) {
|
|
3699
|
+
this.formGroupDirective.control.markAllAsTouched();
|
|
3700
|
+
this.formGroupDirective.control.updateValueAndValidity();
|
|
3701
|
+
}
|
|
3702
|
+
invalidControl.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
3703
|
+
invalidControl.focus({ preventScroll: true });
|
|
3704
|
+
}
|
|
3705
|
+
}
|
|
3706
|
+
catch (error) {
|
|
3707
|
+
// Best effort. If the focus doesn't work it's not very important
|
|
3708
|
+
// 🧪 Useful to avoid som error in tests
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
}
|
|
3712
|
+
GioFormFocusInvalidDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidDirective, deps: [{ token: i0.Renderer2 }, { token: i7.FormGroupDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
3713
|
+
GioFormFocusInvalidDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioFormFocusInvalidDirective, selector: "form[gioFormFocusInvalid]", host: { listeners: { "submit": "onFormSubmit()" } }, ngImport: i0 });
|
|
3714
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidDirective, decorators: [{
|
|
3715
|
+
type: Directive,
|
|
3716
|
+
args: [{
|
|
3717
|
+
selector: 'form[gioFormFocusInvalid]',
|
|
3718
|
+
}]
|
|
3719
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i7.FormGroupDirective, decorators: [{
|
|
3720
|
+
type: Optional
|
|
3721
|
+
}] }]; }, propDecorators: { onFormSubmit: [{
|
|
3722
|
+
type: HostListener,
|
|
3723
|
+
args: ['submit']
|
|
3724
|
+
}] } });
|
|
3725
|
+
|
|
3726
|
+
/*
|
|
3727
|
+
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
3728
|
+
*
|
|
3729
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3730
|
+
* you may not use this file except in compliance with the License.
|
|
3731
|
+
* You may obtain a copy of the License at
|
|
3732
|
+
*
|
|
3733
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3734
|
+
*
|
|
3735
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3736
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3737
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3738
|
+
* See the License for the specific language governing permissions and
|
|
3739
|
+
* limitations under the License.
|
|
3740
|
+
*/
|
|
3741
|
+
class GioFormFocusInvalidModule {
|
|
3742
|
+
}
|
|
3743
|
+
GioFormFocusInvalidModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3744
|
+
GioFormFocusInvalidModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, declarations: [GioFormFocusInvalidDirective], exports: [GioFormFocusInvalidDirective] });
|
|
3745
|
+
GioFormFocusInvalidModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule });
|
|
3746
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, decorators: [{
|
|
3747
|
+
type: NgModule,
|
|
3748
|
+
args: [{
|
|
3749
|
+
declarations: [GioFormFocusInvalidDirective],
|
|
3750
|
+
exports: [GioFormFocusInvalidDirective],
|
|
3751
|
+
}]
|
|
3752
|
+
}] });
|
|
3753
|
+
|
|
3754
|
+
/*
|
|
3755
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
3756
|
+
*
|
|
3757
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3758
|
+
* you may not use this file except in compliance with the License.
|
|
3759
|
+
* You may obtain a copy of the License at
|
|
3760
|
+
*
|
|
3761
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3762
|
+
*
|
|
3763
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3764
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3765
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3766
|
+
* See the License for the specific language governing permissions and
|
|
3767
|
+
* limitations under the License.
|
|
3768
|
+
*/
|
|
3769
|
+
const GIO_MONACO_EDITOR_CONFIG = new InjectionToken('gio-monaco-editor-config');
|
|
3770
|
+
|
|
3771
|
+
/*
|
|
3772
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
3773
|
+
*
|
|
3774
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3775
|
+
* you may not use this file except in compliance with the License.
|
|
3776
|
+
* You may obtain a copy of the License at
|
|
3777
|
+
*
|
|
3778
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3779
|
+
*
|
|
3780
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3781
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3782
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3783
|
+
* See the License for the specific language governing permissions and
|
|
3784
|
+
* limitations under the License.
|
|
3785
|
+
*/
|
|
3786
|
+
class GioMonacoEditorService {
|
|
3787
|
+
constructor() {
|
|
3788
|
+
this.loaded$ = new ReplaySubject(1);
|
|
3789
|
+
this.loaded = false;
|
|
3790
|
+
}
|
|
3791
|
+
loadEditor() {
|
|
3792
|
+
if (this.loaded) {
|
|
3793
|
+
// Already loaded, do nothing.
|
|
3794
|
+
return Promise.resolve();
|
|
3795
|
+
}
|
|
3796
|
+
this.loaded = true;
|
|
3797
|
+
return new Promise(resolve => {
|
|
3798
|
+
// Monaco is already loaded
|
|
3799
|
+
if (typeof window.monaco === 'object') {
|
|
3800
|
+
resolve();
|
|
3801
|
+
return;
|
|
3802
|
+
}
|
|
3803
|
+
const onGotAmdLoader = () => {
|
|
3804
|
+
// Load Monaco
|
|
3805
|
+
window.require.config({ paths: { vs: 'assets/monaco-editor/min/vs' } });
|
|
3806
|
+
window.require(['vs/editor/editor.main'], () => {
|
|
3807
|
+
resolve();
|
|
3808
|
+
});
|
|
3809
|
+
};
|
|
3810
|
+
// Load AMD loader if necessary
|
|
3811
|
+
if (!window.require) {
|
|
3812
|
+
const loaderScript = document.createElement('script');
|
|
3813
|
+
loaderScript.type = 'text/javascript';
|
|
3814
|
+
loaderScript.src = 'assets/monaco-editor/min/vs/loader.js';
|
|
3815
|
+
loaderScript.addEventListener('load', onGotAmdLoader);
|
|
3816
|
+
document.body.appendChild(loaderScript);
|
|
3817
|
+
}
|
|
3818
|
+
else {
|
|
3819
|
+
onGotAmdLoader();
|
|
3820
|
+
}
|
|
3821
|
+
}).then(() => {
|
|
3822
|
+
this.loaded$.next({ monaco: window.monaco });
|
|
3823
|
+
});
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
GioMonacoEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3827
|
+
GioMonacoEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorService, providedIn: 'root' });
|
|
3828
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorService, decorators: [{
|
|
3829
|
+
type: Injectable,
|
|
3830
|
+
args: [{
|
|
3831
|
+
providedIn: 'root',
|
|
3832
|
+
}]
|
|
3833
|
+
}] });
|
|
3834
|
+
|
|
3835
|
+
/*
|
|
3836
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
3837
|
+
*
|
|
3838
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3839
|
+
* you may not use this file except in compliance with the License.
|
|
3840
|
+
* You may obtain a copy of the License at
|
|
3841
|
+
*
|
|
3842
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3843
|
+
*
|
|
3844
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3845
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3846
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3847
|
+
* See the License for the specific language governing permissions and
|
|
3848
|
+
* limitations under the License.
|
|
3849
|
+
*/
|
|
3850
|
+
class GioLanguageJsonService {
|
|
3851
|
+
constructor(codeEditorService) {
|
|
3852
|
+
this.unsubscribe$ = new Subject();
|
|
3853
|
+
codeEditorService.loaded$.pipe(takeUntil(this.unsubscribe$)).subscribe(event => {
|
|
3854
|
+
this.setup(event.monaco);
|
|
3855
|
+
});
|
|
3856
|
+
}
|
|
3857
|
+
ngOnDestroy() {
|
|
3858
|
+
this.unsubscribe$.next();
|
|
3859
|
+
this.unsubscribe$.complete();
|
|
3860
|
+
}
|
|
3861
|
+
setup(monaco) {
|
|
3862
|
+
if (!monaco) {
|
|
3863
|
+
throw new Error('Monaco is not loaded');
|
|
3864
|
+
}
|
|
3865
|
+
this.monaco = monaco;
|
|
3866
|
+
const defaults = monaco.languages.json.jsonDefaults;
|
|
3867
|
+
defaults.setDiagnosticsOptions({
|
|
3868
|
+
validate: true,
|
|
3869
|
+
allowComments: true,
|
|
3870
|
+
});
|
|
3871
|
+
}
|
|
3872
|
+
addSchemas(id, definitions = []) {
|
|
3873
|
+
if (!this.monaco) {
|
|
3874
|
+
throw new Error('Monaco is not loaded');
|
|
3875
|
+
}
|
|
3876
|
+
const defaults = this.monaco.languages.json.jsonDefaults;
|
|
3877
|
+
const options = defaults.diagnosticsOptions;
|
|
3878
|
+
let schemas = definitions.map(({ uri, schema }) => ({
|
|
3879
|
+
uri,
|
|
3880
|
+
schema,
|
|
3881
|
+
fileMatch: [id || '*.json'],
|
|
3882
|
+
}));
|
|
3883
|
+
if (options && options.schemas && options.schemas.length > 0) {
|
|
3884
|
+
schemas = [...options.schemas, ...schemas];
|
|
3885
|
+
}
|
|
3886
|
+
defaults.setDiagnosticsOptions({
|
|
3887
|
+
...options,
|
|
3888
|
+
schemas: schemas,
|
|
3889
|
+
});
|
|
3890
|
+
}
|
|
3891
|
+
}
|
|
3892
|
+
GioLanguageJsonService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioLanguageJsonService, deps: [{ token: GioMonacoEditorService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3893
|
+
GioLanguageJsonService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioLanguageJsonService, providedIn: 'root' });
|
|
3894
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioLanguageJsonService, decorators: [{
|
|
3895
|
+
type: Injectable,
|
|
3896
|
+
args: [{
|
|
3897
|
+
providedIn: 'root',
|
|
3898
|
+
}]
|
|
3899
|
+
}], ctorParameters: function () { return [{ type: GioMonacoEditorService }]; } });
|
|
3900
|
+
|
|
3901
|
+
/*
|
|
3902
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
3903
|
+
*
|
|
3904
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3905
|
+
* you may not use this file except in compliance with the License.
|
|
3906
|
+
* You may obtain a copy of the License at
|
|
3907
|
+
*
|
|
3908
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3909
|
+
*
|
|
3910
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3911
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3912
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3913
|
+
* See the License for the specific language governing permissions and
|
|
3914
|
+
* limitations under the License.
|
|
3915
|
+
*/
|
|
3916
|
+
class GioMonacoEditorComponent {
|
|
3917
|
+
constructor(config, monacoEditorService, languageJsonService, hostElement, changeDetectorRef, ngZone) {
|
|
3918
|
+
this.config = config;
|
|
3919
|
+
this.monacoEditorService = monacoEditorService;
|
|
3920
|
+
this.languageJsonService = languageJsonService;
|
|
3921
|
+
this.hostElement = hostElement;
|
|
3922
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
3923
|
+
this.ngZone = ngZone;
|
|
3924
|
+
this.options = {};
|
|
3925
|
+
this.id = uniqueId('gio-monaco-editor-');
|
|
3926
|
+
this.loading = true;
|
|
3927
|
+
this.defaultOptions = {
|
|
3928
|
+
contextmenu: false,
|
|
3929
|
+
minimap: {
|
|
3930
|
+
enabled: true,
|
|
3931
|
+
},
|
|
3932
|
+
automaticLayout: true,
|
|
3933
|
+
scrollBeyondLastLine: false,
|
|
3934
|
+
};
|
|
3935
|
+
this.value = '';
|
|
3936
|
+
this.readOnly = false;
|
|
3937
|
+
this._onChange = () => ({});
|
|
3938
|
+
this._onTouched = () => ({});
|
|
3939
|
+
this.unsubscribe$ = new Subject();
|
|
3940
|
+
this.monacoEditorService.loadEditor();
|
|
3941
|
+
}
|
|
3942
|
+
ngAfterViewInit() {
|
|
3943
|
+
// Wait until monaco editor is available
|
|
3944
|
+
this.monacoEditorService.loaded$.pipe(takeUntil(this.unsubscribe$)).subscribe(({ monaco }) => {
|
|
3945
|
+
this.setupEditor(monaco);
|
|
3946
|
+
this.loading = false;
|
|
3947
|
+
this.changeDetectorRef.detectChanges();
|
|
3948
|
+
});
|
|
3949
|
+
}
|
|
3950
|
+
ngOnDestroy() {
|
|
3951
|
+
if (this.standaloneCodeEditor) {
|
|
3952
|
+
this.standaloneCodeEditor.dispose();
|
|
3953
|
+
this.standaloneCodeEditor = undefined;
|
|
3954
|
+
}
|
|
3955
|
+
if (this.textModel) {
|
|
3956
|
+
this.textModel.dispose();
|
|
3957
|
+
this.textModel = undefined;
|
|
3958
|
+
}
|
|
3959
|
+
this.unsubscribe$.next();
|
|
3960
|
+
this.unsubscribe$.complete();
|
|
3961
|
+
}
|
|
3962
|
+
// From ControlValueAccessor interface
|
|
3963
|
+
writeValue(_value) {
|
|
3964
|
+
if (_value) {
|
|
3965
|
+
this.value = _value;
|
|
3966
|
+
}
|
|
3967
|
+
if (this.textModel) {
|
|
3968
|
+
this.textModel.setValue(this.value);
|
|
3969
|
+
}
|
|
3970
|
+
}
|
|
3971
|
+
// From ControlValueAccessor interface
|
|
3972
|
+
registerOnChange(fn) {
|
|
3973
|
+
this._onChange = fn;
|
|
3974
|
+
}
|
|
3975
|
+
// From ControlValueAccessor interface
|
|
3976
|
+
registerOnTouched(fn) {
|
|
3977
|
+
this._onTouched = fn;
|
|
3978
|
+
}
|
|
3979
|
+
// From ControlValueAccessor interface
|
|
3980
|
+
setDisabledState(isDisabled) {
|
|
3981
|
+
this.readOnly = isDisabled;
|
|
3982
|
+
}
|
|
3983
|
+
setupEditor(monaco) {
|
|
3984
|
+
if (!this.hostElement) {
|
|
3985
|
+
throw new Error('No editor ref found.');
|
|
3986
|
+
}
|
|
3987
|
+
const domElement = this.hostElement.nativeElement;
|
|
3988
|
+
const settings = {
|
|
3989
|
+
value: this.value,
|
|
3990
|
+
language: this.languageConfig?.language ?? 'text',
|
|
3991
|
+
uri: `code-${uniqueId()}`,
|
|
3992
|
+
};
|
|
3993
|
+
this.ngZone.runOutsideAngular(() => {
|
|
3994
|
+
this.textModel = monaco.editor.createModel(settings.value, settings.language, monaco.Uri.parse(settings.uri));
|
|
3995
|
+
});
|
|
3996
|
+
const options = Object.assign({}, this.defaultOptions, this.options, {
|
|
3997
|
+
readOnly: this.readOnly,
|
|
3998
|
+
theme: this.config.theme ?? 'vs',
|
|
3999
|
+
model: this.textModel,
|
|
4000
|
+
});
|
|
4001
|
+
this.standaloneCodeEditor = monaco.editor.create(domElement, {
|
|
4002
|
+
...options,
|
|
4003
|
+
});
|
|
4004
|
+
this.textModel?.onDidChangeContent(() => {
|
|
4005
|
+
const newValue = this.textModel?.getValue();
|
|
4006
|
+
this.ngZone.run(() => {
|
|
4007
|
+
newValue && this._onChange(newValue);
|
|
4008
|
+
this._onTouched();
|
|
4009
|
+
});
|
|
4010
|
+
});
|
|
4011
|
+
this.standaloneCodeEditor?.onDidBlurEditorWidget(() => {
|
|
4012
|
+
this.ngZone.run(() => {
|
|
4013
|
+
this._onTouched();
|
|
4014
|
+
});
|
|
4015
|
+
});
|
|
4016
|
+
this.setupLanguage(settings.uri, this.languageConfig);
|
|
4017
|
+
}
|
|
4018
|
+
setupLanguage(uri, languageConfig) {
|
|
4019
|
+
if (!languageConfig) {
|
|
4020
|
+
return;
|
|
4021
|
+
}
|
|
4022
|
+
const { language } = languageConfig;
|
|
4023
|
+
if (language) {
|
|
4024
|
+
const lang = language.toLowerCase();
|
|
4025
|
+
switch (lang) {
|
|
4026
|
+
case 'json':
|
|
4027
|
+
if (languageConfig.schemas) {
|
|
4028
|
+
this.languageJsonService.addSchemas(uri, languageConfig.schemas);
|
|
4029
|
+
}
|
|
4030
|
+
break;
|
|
4031
|
+
default:
|
|
4032
|
+
break;
|
|
4033
|
+
}
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
4037
|
+
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 });
|
|
4038
|
+
GioMonacoEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioMonacoEditorComponent, selector: "gio-monaco-editor", inputs: { languageConfig: "languageConfig", options: "options" }, providers: [
|
|
4039
|
+
{
|
|
4040
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4041
|
+
useExisting: forwardRef(() => GioMonacoEditorComponent),
|
|
4042
|
+
multi: true,
|
|
4043
|
+
},
|
|
4044
|
+
], 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"] }] });
|
|
4045
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorComponent, decorators: [{
|
|
4046
|
+
type: Component,
|
|
4047
|
+
args: [{ selector: 'gio-monaco-editor', template: ` <div *ngIf="loading">Loading...</div>`, providers: [
|
|
4048
|
+
{
|
|
4049
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4050
|
+
useExisting: forwardRef(() => GioMonacoEditorComponent),
|
|
4051
|
+
multi: true,
|
|
4052
|
+
},
|
|
4053
|
+
], styles: [":host{display:block;height:100%;min-height:150px}\n"] }]
|
|
4054
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
4055
|
+
type: Inject,
|
|
4056
|
+
args: [GIO_MONACO_EDITOR_CONFIG]
|
|
4057
|
+
}] }, { type: GioMonacoEditorService }, { type: GioLanguageJsonService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }]; }, propDecorators: { languageConfig: [{
|
|
4058
|
+
type: Input
|
|
4059
|
+
}], options: [{
|
|
4060
|
+
type: Input
|
|
4061
|
+
}] } });
|
|
4062
|
+
|
|
4063
|
+
/*
|
|
4064
|
+
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
4065
|
+
*
|
|
4066
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4067
|
+
* you may not use this file except in compliance with the License.
|
|
4068
|
+
* You may obtain a copy of the License at
|
|
4069
|
+
*
|
|
4070
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4071
|
+
*
|
|
4072
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4073
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4074
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4075
|
+
* See the License for the specific language governing permissions and
|
|
4076
|
+
* limitations under the License.
|
|
4077
|
+
*/
|
|
4078
|
+
class GioMonacoEditorModule {
|
|
4079
|
+
static forRoot(config) {
|
|
4080
|
+
return {
|
|
4081
|
+
ngModule: GioMonacoEditorModule,
|
|
4082
|
+
providers: [
|
|
4083
|
+
{
|
|
4084
|
+
provide: GIO_MONACO_EDITOR_CONFIG,
|
|
4085
|
+
useValue: config,
|
|
4086
|
+
},
|
|
4087
|
+
],
|
|
4088
|
+
};
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
GioMonacoEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4092
|
+
GioMonacoEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, declarations: [GioMonacoEditorComponent], imports: [CommonModule, HttpClientModule, ReactiveFormsModule], exports: [GioMonacoEditorComponent] });
|
|
4093
|
+
GioMonacoEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, providers: [
|
|
4094
|
+
{
|
|
4095
|
+
provide: GIO_MONACO_EDITOR_CONFIG,
|
|
4096
|
+
useValue: {},
|
|
4097
|
+
},
|
|
4098
|
+
], imports: [[CommonModule, HttpClientModule, ReactiveFormsModule]] });
|
|
4099
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, decorators: [{
|
|
4100
|
+
type: NgModule,
|
|
4101
|
+
args: [{
|
|
4102
|
+
imports: [CommonModule, HttpClientModule, ReactiveFormsModule],
|
|
4103
|
+
declarations: [GioMonacoEditorComponent],
|
|
4104
|
+
exports: [GioMonacoEditorComponent],
|
|
4105
|
+
providers: [
|
|
4106
|
+
{
|
|
4107
|
+
provide: GIO_MONACO_EDITOR_CONFIG,
|
|
4108
|
+
useValue: {},
|
|
4109
|
+
},
|
|
4110
|
+
],
|
|
4111
|
+
}]
|
|
4112
|
+
}] });
|
|
4113
|
+
|
|
4114
|
+
/*
|
|
4115
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
4116
|
+
*
|
|
4117
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4118
|
+
* you may not use this file except in compliance with the License.
|
|
4119
|
+
* You may obtain a copy of the License at
|
|
4120
|
+
*
|
|
4121
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4122
|
+
*
|
|
4123
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4124
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4125
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4126
|
+
* See the License for the specific language governing permissions and
|
|
4127
|
+
* limitations under the License.
|
|
4128
|
+
*/
|
|
4129
|
+
/**
|
|
4130
|
+
* This component is used to test the GioMonacoEditorComponent.
|
|
4131
|
+
* This component simulates monaco editor with a simple input.
|
|
4132
|
+
*/
|
|
4133
|
+
class GioMonacoEditorTestingComponent extends GioMonacoEditorComponent {
|
|
4134
|
+
get getValue() {
|
|
4135
|
+
return this.value;
|
|
4136
|
+
}
|
|
4137
|
+
changeValue(value) {
|
|
4138
|
+
this._onTouched();
|
|
4139
|
+
this._onChange(value);
|
|
4140
|
+
}
|
|
4141
|
+
}
|
|
4142
|
+
GioMonacoEditorTestingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorTestingComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4143
|
+
GioMonacoEditorTestingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioMonacoEditorTestingComponent, selector: "gio-monaco-editor", providers: [
|
|
4144
|
+
{
|
|
4145
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4146
|
+
useExisting: forwardRef(() => GioMonacoEditorTestingComponent),
|
|
4147
|
+
multi: true,
|
|
4148
|
+
},
|
|
4149
|
+
], usesInheritance: true, ngImport: i0, template: '<input type="text" [value]="getValue" (input)="changeValue($any($event).target?.value)" />', isInline: true });
|
|
4150
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorTestingComponent, decorators: [{
|
|
4151
|
+
type: Component,
|
|
4152
|
+
args: [{
|
|
4153
|
+
selector: 'gio-monaco-editor',
|
|
4154
|
+
template: '<input type="text" [value]="getValue" (input)="changeValue($any($event).target?.value)" />',
|
|
4155
|
+
providers: [
|
|
4156
|
+
{
|
|
4157
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4158
|
+
useExisting: forwardRef(() => GioMonacoEditorTestingComponent),
|
|
4159
|
+
multi: true,
|
|
4160
|
+
},
|
|
4161
|
+
],
|
|
4162
|
+
}]
|
|
4163
|
+
}] });
|
|
4164
|
+
|
|
4165
|
+
/*
|
|
4166
|
+
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
4167
|
+
*
|
|
4168
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4169
|
+
* you may not use this file except in compliance with the License.
|
|
4170
|
+
* You may obtain a copy of the License at
|
|
4171
|
+
*
|
|
4172
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4173
|
+
*
|
|
4174
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4175
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4176
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4177
|
+
* See the License for the specific language governing permissions and
|
|
4178
|
+
* limitations under the License.
|
|
4179
|
+
*/
|
|
4180
|
+
// Hack to replace the default gio-monaco-editor component with fake one for testing purpose.
|
|
4181
|
+
try {
|
|
4182
|
+
TestBed.overrideModule(GioMonacoEditorModule, {
|
|
4183
|
+
remove: {
|
|
4184
|
+
declarations: [GioMonacoEditorComponent],
|
|
4185
|
+
exports: [GioMonacoEditorComponent],
|
|
4186
|
+
},
|
|
4187
|
+
add: {
|
|
4188
|
+
declarations: [GioMonacoEditorTestingComponent],
|
|
4189
|
+
exports: [GioMonacoEditorTestingComponent],
|
|
4190
|
+
},
|
|
4191
|
+
});
|
|
4192
|
+
}
|
|
4193
|
+
catch (e) {
|
|
4194
|
+
// Do nothing
|
|
4195
|
+
}
|
|
4196
|
+
class GioMonacoEditorHarness extends ComponentHarness {
|
|
4197
|
+
constructor() {
|
|
4198
|
+
super(...arguments);
|
|
4199
|
+
this.getInputEl = this.locatorFor('input');
|
|
4200
|
+
}
|
|
4201
|
+
/**
|
|
4202
|
+
* Gets a `HarnessPredicate` that can be used to search for a `GioMonacoEditorHarness` that meets
|
|
4203
|
+
* certain criteria.
|
|
4204
|
+
*
|
|
4205
|
+
* @param options Options for filtering which input instances are considered a match.
|
|
4206
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
4207
|
+
*/
|
|
4208
|
+
static with(options = {}) {
|
|
4209
|
+
return new HarnessPredicate(GioMonacoEditorHarness, options);
|
|
4210
|
+
}
|
|
4211
|
+
async setValue(value) {
|
|
4212
|
+
const inputEl = await this.getInputEl();
|
|
4213
|
+
await inputEl.clear();
|
|
4214
|
+
await inputEl.sendKeys(value);
|
|
4215
|
+
}
|
|
4216
|
+
async getValue() {
|
|
4217
|
+
const inputEl = await this.getInputEl();
|
|
4218
|
+
return inputEl.getProperty('value');
|
|
4219
|
+
}
|
|
4220
|
+
}
|
|
4221
|
+
GioMonacoEditorHarness.hostSelector = 'gio-monaco-editor';
|
|
4222
|
+
|
|
3659
4223
|
/*
|
|
3660
4224
|
* Copyright (C) 2021 The Gravitee team (http://gravitee.io)
|
|
3661
4225
|
*
|
|
@@ -3692,5 +4256,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3692
4256
|
* Generated bundle index. Do not edit.
|
|
3693
4257
|
*/
|
|
3694
4258
|
|
|
3695
|
-
export { GioAvatarComponent, GioAvatarModule, GioBannerActionDirective, GioBannerBodyDirective, GioBannerComponent, GioBannerErrorComponent, GioBannerInfoComponent, GioBannerModule, GioBannerSuccessComponent, GioBannerWarningComponent, GioBreadcrumbComponent, GioBreadcrumbItemDirective, GioBreadcrumbModule, GioConfirmAndValidateDialogComponent, GioConfirmAndValidateDialogHarness, GioConfirmAndValidateDialogModule, GioConfirmDialogComponent, GioConfirmDialogHarness, GioConfirmDialogModule, GioFormFilePickerAddButtonComponent, GioFormFilePickerComponent, GioFormFilePickerEmptyComponent, GioFormFilePickerInputHarness, GioFormFilePickerLabelComponent, GioFormFilePickerModule, GioFormHeadersComponent, GioFormHeadersHarness, GioFormHeadersModule, GioFormJsonSchemaComponent, GioFormJsonSchemaModule, GioFormLabelComponent, GioFormPrefixDirective, GioFormSlideToggleComponent, GioFormSlideToggleDirective, GioFormSlideToggleModule, GioFormTagsInputComponent, GioFormTagsInputHarness, GioFormTagsInputModule, GioIconsModule, GioMatConfigModule, GioMenuComponent, GioMenuFooterComponent, GioMenuHeaderComponent, GioMenuItemComponent, GioMenuListComponent, GioMenuModule, GioMenuSelectorComponent, GioMenuSelectorHarness, GioMenuService, GioSaveBarComponent, GioSaveBarHarness, GioSaveBarModule, GioSubmenuComponent, GioSubmenuGroupComponent, GioSubmenuItemComponent, GioSubmenuModule, GioSubmenuTitleDirective, GioTopBarComponent, GioTopBarContentComponent, GioTopBarLinkComponent, GioTopBarLinkModule, GioTopBarMenuComponent, GioTopBarMenuModule, GioTopBarModule, NewFile };
|
|
4259
|
+
export { GioAvatarComponent, GioAvatarModule, GioBannerActionDirective, GioBannerBodyDirective, GioBannerComponent, GioBannerErrorComponent, GioBannerInfoComponent, GioBannerModule, GioBannerSuccessComponent, GioBannerWarningComponent, GioBreadcrumbComponent, GioBreadcrumbItemDirective, GioBreadcrumbModule, GioConfirmAndValidateDialogComponent, GioConfirmAndValidateDialogHarness, GioConfirmAndValidateDialogModule, GioConfirmDialogComponent, GioConfirmDialogHarness, GioConfirmDialogModule, GioFormFilePickerAddButtonComponent, GioFormFilePickerComponent, GioFormFilePickerEmptyComponent, GioFormFilePickerInputHarness, GioFormFilePickerLabelComponent, GioFormFilePickerModule, GioFormFocusInvalidDirective, GioFormFocusInvalidModule, GioFormHeadersComponent, GioFormHeadersHarness, GioFormHeadersModule, GioFormJsonSchemaComponent, GioFormJsonSchemaModule, GioFormLabelComponent, GioFormPrefixDirective, GioFormSlideToggleComponent, GioFormSlideToggleDirective, GioFormSlideToggleModule, GioFormTagsInputComponent, GioFormTagsInputHarness, GioFormTagsInputModule, GioIconsModule, 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 };
|
|
3696
4260
|
//# sourceMappingURL=gravitee-ui-particles-angular.mjs.map
|