@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';
|
|
@@ -13,8 +13,8 @@ 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 } from 'lodash';
|
|
17
|
-
import { startWith, map, distinctUntilChanged, tap, debounce, takeUntil, delay, filter, switchMap } from 'rxjs/operators';
|
|
16
|
+
import { isEmpty, toLower, dropRight, isNil, isArray, remove, isObject, cloneDeep, set, uniqueId } from 'lodash';
|
|
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';
|
|
20
20
|
import * as i2$2 from '@angular/cdk/a11y';
|
|
@@ -50,6 +50,7 @@ import { FieldType, FieldArrayType, FieldWrapper, FormlyModule } from '@ngx-form
|
|
|
50
50
|
import { 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
|
+
import { TestBed } from '@angular/core/testing';
|
|
53
54
|
|
|
54
55
|
/*
|
|
55
56
|
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
@@ -2822,6 +2823,7 @@ class GioFormJsonSchemaComponent {
|
|
|
2822
2823
|
this.options = {};
|
|
2823
2824
|
this.model = {};
|
|
2824
2825
|
this.fields = [];
|
|
2826
|
+
this.loading = true;
|
|
2825
2827
|
this._onChange = () => ({});
|
|
2826
2828
|
this._onTouched = () => ({});
|
|
2827
2829
|
this.touched = false;
|
|
@@ -2844,6 +2846,10 @@ class GioFormJsonSchemaComponent {
|
|
|
2844
2846
|
}
|
|
2845
2847
|
}
|
|
2846
2848
|
ngOnInit() {
|
|
2849
|
+
var _a, _b, _c;
|
|
2850
|
+
// When the parent form is touched, mark all the sub formGroup as touched
|
|
2851
|
+
const parentControl = (_b = (_a = this.ngControl) === null || _a === void 0 ? void 0 : _a.control) === null || _b === void 0 ? void 0 : _b.parent;
|
|
2852
|
+
(_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), tap(() => this.formGroup.markAllAsTouched())).subscribe();
|
|
2847
2853
|
this.formGroup.statusChanges.pipe(takeUntil(this.unsubscribe$)).subscribe(status => {
|
|
2848
2854
|
var _a, _b, _c, _d;
|
|
2849
2855
|
if (status === 'VALID') {
|
|
@@ -2856,7 +2862,9 @@ class GioFormJsonSchemaComponent {
|
|
|
2856
2862
|
// To simulate the behavior of classic form controls, emit value only when the form is touched
|
|
2857
2863
|
// Allow to keep the formControl pristine until the user interact with it
|
|
2858
2864
|
this.formGroup.valueChanges
|
|
2859
|
-
.pipe(takeUntil(this.unsubscribe$),
|
|
2865
|
+
.pipe(takeUntil(this.unsubscribe$),
|
|
2866
|
+
// Group all valueChanges events emit by formly in a single one
|
|
2867
|
+
debounceTime(50), filter(() => this.touched))
|
|
2860
2868
|
.subscribe(value => {
|
|
2861
2869
|
this._onChange(value);
|
|
2862
2870
|
});
|
|
@@ -3097,28 +3105,28 @@ GioFjsObjectTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
|
|
|
3097
3105
|
<div class="wrapper">
|
|
3098
3106
|
<div class="wrapper__title" *ngIf="to.label">{{ to.label }}</div>
|
|
3099
3107
|
<p *ngIf="to.description">{{ to.description }}</p>
|
|
3100
|
-
<div class="wrapper__error" *ngIf="showError && formControl.errors">
|
|
3108
|
+
<div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
|
|
3101
3109
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
3102
3110
|
</div>
|
|
3103
3111
|
<div class="wrapper__fields">
|
|
3104
3112
|
<formly-field *ngFor="let f of field.fieldGroup" class="wrapper__fields__field" [field]="f"></formly-field>
|
|
3105
3113
|
</div>
|
|
3106
3114
|
</div>
|
|
3107
|
-
`, 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"] }] });
|
|
3115
|
+
`, 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"] }] });
|
|
3108
3116
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsObjectTypeComponent, decorators: [{
|
|
3109
3117
|
type: Component,
|
|
3110
3118
|
args: [{ selector: 'gio-fjs-object-type', template: `
|
|
3111
3119
|
<div class="wrapper">
|
|
3112
3120
|
<div class="wrapper__title" *ngIf="to.label">{{ to.label }}</div>
|
|
3113
3121
|
<p *ngIf="to.description">{{ to.description }}</p>
|
|
3114
|
-
<div class="wrapper__error" *ngIf="showError && formControl.errors">
|
|
3122
|
+
<div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
|
|
3115
3123
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
3116
3124
|
</div>
|
|
3117
3125
|
<div class="wrapper__fields">
|
|
3118
3126
|
<formly-field *ngFor="let f of field.fieldGroup" class="wrapper__fields__field" [field]="f"></formly-field>
|
|
3119
3127
|
</div>
|
|
3120
3128
|
</div>
|
|
3121
|
-
`, 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"] }]
|
|
3129
|
+
`, 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"] }]
|
|
3122
3130
|
}] });
|
|
3123
3131
|
|
|
3124
3132
|
/*
|
|
@@ -3144,7 +3152,7 @@ class GioFjsArrayTypeComponent extends FieldArrayType {
|
|
|
3144
3152
|
}
|
|
3145
3153
|
GioFjsArrayTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsArrayTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3146
3154
|
GioFjsArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsArrayTypeComponent, selector: "gio-fjs-array-type", usesInheritance: true, ngImport: i0, template: `
|
|
3147
|
-
<div class="wrapper">
|
|
3155
|
+
<div class="wrapper" [class.error]="formControl.touched && formControl.invalid">
|
|
3148
3156
|
<div class="wrapper__header">
|
|
3149
3157
|
<div class="wrapper__header__text">
|
|
3150
3158
|
<div class="wrapper__header__text__title" *ngIf="to.label">{{ to.label }}</div>
|
|
@@ -3157,11 +3165,11 @@ GioFjsArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0
|
|
|
3157
3165
|
</div>
|
|
3158
3166
|
</div>
|
|
3159
3167
|
|
|
3160
|
-
<div class="wrapper__error" *ngIf="showError && formControl.errors">
|
|
3168
|
+
<div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
|
|
3161
3169
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
3162
3170
|
</div>
|
|
3163
3171
|
|
|
3164
|
-
<div
|
|
3172
|
+
<div [hidden]="collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
|
|
3165
3173
|
<div *ngFor="let field of field.fieldGroup; let i = index" class="wrapper__rows__row">
|
|
3166
3174
|
<formly-field class="wrapper__rows__row__field" [field]="field"></formly-field>
|
|
3167
3175
|
<div class="wrapper__rows__row__remove">
|
|
@@ -3176,11 +3184,11 @@ GioFjsArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0
|
|
|
3176
3184
|
</div>
|
|
3177
3185
|
</div>
|
|
3178
3186
|
</div>
|
|
3179
|
-
`, 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"] }] });
|
|
3187
|
+
`, 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"] }] });
|
|
3180
3188
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsArrayTypeComponent, decorators: [{
|
|
3181
3189
|
type: Component,
|
|
3182
3190
|
args: [{ selector: 'gio-fjs-array-type', template: `
|
|
3183
|
-
<div class="wrapper">
|
|
3191
|
+
<div class="wrapper" [class.error]="formControl.touched && formControl.invalid">
|
|
3184
3192
|
<div class="wrapper__header">
|
|
3185
3193
|
<div class="wrapper__header__text">
|
|
3186
3194
|
<div class="wrapper__header__text__title" *ngIf="to.label">{{ to.label }}</div>
|
|
@@ -3193,11 +3201,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3193
3201
|
</div>
|
|
3194
3202
|
</div>
|
|
3195
3203
|
|
|
3196
|
-
<div class="wrapper__error" *ngIf="showError && formControl.errors">
|
|
3204
|
+
<div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
|
|
3197
3205
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
3198
3206
|
</div>
|
|
3199
3207
|
|
|
3200
|
-
<div
|
|
3208
|
+
<div [hidden]="collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
|
|
3201
3209
|
<div *ngFor="let field of field.fieldGroup; let i = index" class="wrapper__rows__row">
|
|
3202
3210
|
<formly-field class="wrapper__rows__row__field" [field]="field"></formly-field>
|
|
3203
3211
|
<div class="wrapper__rows__row__remove">
|
|
@@ -3212,7 +3220,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3212
3220
|
</div>
|
|
3213
3221
|
</div>
|
|
3214
3222
|
</div>
|
|
3215
|
-
`, 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"] }]
|
|
3223
|
+
`, 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"] }]
|
|
3216
3224
|
}] });
|
|
3217
3225
|
|
|
3218
3226
|
function minItemsValidationMessage(error, field) {
|
|
@@ -3319,7 +3327,7 @@ GioFjsMultiSchemaTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
|
3319
3327
|
<div class="wrapper">
|
|
3320
3328
|
<div class="wrapper__title" *ngIf="props.label">{{ props.label }}</div>
|
|
3321
3329
|
<p *ngIf="props.description">{{ props.description }}</p>
|
|
3322
|
-
<div class="wrapper__error" *ngIf="showError && formControl.errors">
|
|
3330
|
+
<div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
|
|
3323
3331
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
3324
3332
|
</div>
|
|
3325
3333
|
<formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
|
|
@@ -3331,7 +3339,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3331
3339
|
<div class="wrapper">
|
|
3332
3340
|
<div class="wrapper__title" *ngIf="props.label">{{ props.label }}</div>
|
|
3333
3341
|
<p *ngIf="props.description">{{ props.description }}</p>
|
|
3334
|
-
<div class="wrapper__error" *ngIf="showError && formControl.errors">
|
|
3342
|
+
<div class="wrapper__error gio-ng-invalid" *ngIf="showError && formControl.errors">
|
|
3335
3343
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
3336
3344
|
</div>
|
|
3337
3345
|
<formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
|
|
@@ -3619,6 +3627,551 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3619
3627
|
}]
|
|
3620
3628
|
}] });
|
|
3621
3629
|
|
|
3630
|
+
/*
|
|
3631
|
+
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
3632
|
+
*
|
|
3633
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3634
|
+
* you may not use this file except in compliance with the License.
|
|
3635
|
+
* You may obtain a copy of the License at
|
|
3636
|
+
*
|
|
3637
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3638
|
+
*
|
|
3639
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3640
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3641
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3642
|
+
* See the License for the specific language governing permissions and
|
|
3643
|
+
* limitations under the License.
|
|
3644
|
+
*/
|
|
3645
|
+
class GioFormFocusInvalidDirective {
|
|
3646
|
+
constructor(renderer, formGroupDirective) {
|
|
3647
|
+
this.renderer = renderer;
|
|
3648
|
+
this.formGroupDirective = formGroupDirective;
|
|
3649
|
+
}
|
|
3650
|
+
onFormSubmit() {
|
|
3651
|
+
const selector = '.ng-invalid[formControlName],input.ng-invalid,mat-select.ng-invalid,textarea.ng-invalid,.gio-ng-invalid';
|
|
3652
|
+
try {
|
|
3653
|
+
let invalidControl = this.renderer.selectRootElement(selector, true);
|
|
3654
|
+
// If the form is a GioFormJsonSchema, we need to focus the first invalid control inside
|
|
3655
|
+
if (invalidControl.tagName === 'GIO-FORM-JSON-SCHEMA') {
|
|
3656
|
+
invalidControl = invalidControl.querySelector(selector);
|
|
3657
|
+
}
|
|
3658
|
+
if (invalidControl) {
|
|
3659
|
+
// Mark all controls as touched to display errors
|
|
3660
|
+
if (this.formGroupDirective) {
|
|
3661
|
+
this.formGroupDirective.control.markAllAsTouched();
|
|
3662
|
+
this.formGroupDirective.control.updateValueAndValidity();
|
|
3663
|
+
}
|
|
3664
|
+
invalidControl.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
3665
|
+
invalidControl.focus({ preventScroll: true });
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
catch (error) {
|
|
3669
|
+
// Best effort. If the focus doesn't work it's not very important
|
|
3670
|
+
// 🧪 Useful to avoid som error in tests
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
3674
|
+
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 });
|
|
3675
|
+
GioFormFocusInvalidDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: GioFormFocusInvalidDirective, selector: "form[gioFormFocusInvalid]", host: { listeners: { "submit": "onFormSubmit()" } }, ngImport: i0 });
|
|
3676
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidDirective, decorators: [{
|
|
3677
|
+
type: Directive,
|
|
3678
|
+
args: [{
|
|
3679
|
+
selector: 'form[gioFormFocusInvalid]',
|
|
3680
|
+
}]
|
|
3681
|
+
}], ctorParameters: function () {
|
|
3682
|
+
return [{ type: i0.Renderer2 }, { type: i7.FormGroupDirective, decorators: [{
|
|
3683
|
+
type: Optional
|
|
3684
|
+
}] }];
|
|
3685
|
+
}, propDecorators: { onFormSubmit: [{
|
|
3686
|
+
type: HostListener,
|
|
3687
|
+
args: ['submit']
|
|
3688
|
+
}] } });
|
|
3689
|
+
|
|
3690
|
+
/*
|
|
3691
|
+
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
3692
|
+
*
|
|
3693
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3694
|
+
* you may not use this file except in compliance with the License.
|
|
3695
|
+
* You may obtain a copy of the License at
|
|
3696
|
+
*
|
|
3697
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3698
|
+
*
|
|
3699
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3700
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3701
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3702
|
+
* See the License for the specific language governing permissions and
|
|
3703
|
+
* limitations under the License.
|
|
3704
|
+
*/
|
|
3705
|
+
class GioFormFocusInvalidModule {
|
|
3706
|
+
}
|
|
3707
|
+
GioFormFocusInvalidModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3708
|
+
GioFormFocusInvalidModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, declarations: [GioFormFocusInvalidDirective], exports: [GioFormFocusInvalidDirective] });
|
|
3709
|
+
GioFormFocusInvalidModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule });
|
|
3710
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFocusInvalidModule, decorators: [{
|
|
3711
|
+
type: NgModule,
|
|
3712
|
+
args: [{
|
|
3713
|
+
declarations: [GioFormFocusInvalidDirective],
|
|
3714
|
+
exports: [GioFormFocusInvalidDirective],
|
|
3715
|
+
}]
|
|
3716
|
+
}] });
|
|
3717
|
+
|
|
3718
|
+
/*
|
|
3719
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
3720
|
+
*
|
|
3721
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3722
|
+
* you may not use this file except in compliance with the License.
|
|
3723
|
+
* You may obtain a copy of the License at
|
|
3724
|
+
*
|
|
3725
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3726
|
+
*
|
|
3727
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3728
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3729
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3730
|
+
* See the License for the specific language governing permissions and
|
|
3731
|
+
* limitations under the License.
|
|
3732
|
+
*/
|
|
3733
|
+
const GIO_MONACO_EDITOR_CONFIG = new InjectionToken('gio-monaco-editor-config');
|
|
3734
|
+
|
|
3735
|
+
/*
|
|
3736
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
3737
|
+
*
|
|
3738
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3739
|
+
* you may not use this file except in compliance with the License.
|
|
3740
|
+
* You may obtain a copy of the License at
|
|
3741
|
+
*
|
|
3742
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3743
|
+
*
|
|
3744
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3745
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3746
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3747
|
+
* See the License for the specific language governing permissions and
|
|
3748
|
+
* limitations under the License.
|
|
3749
|
+
*/
|
|
3750
|
+
class GioMonacoEditorService {
|
|
3751
|
+
constructor() {
|
|
3752
|
+
this.loaded$ = new ReplaySubject(1);
|
|
3753
|
+
this.loaded = false;
|
|
3754
|
+
}
|
|
3755
|
+
loadEditor() {
|
|
3756
|
+
if (this.loaded) {
|
|
3757
|
+
// Already loaded, do nothing.
|
|
3758
|
+
return Promise.resolve();
|
|
3759
|
+
}
|
|
3760
|
+
this.loaded = true;
|
|
3761
|
+
return new Promise(resolve => {
|
|
3762
|
+
// Monaco is already loaded
|
|
3763
|
+
if (typeof window.monaco === 'object') {
|
|
3764
|
+
resolve();
|
|
3765
|
+
return;
|
|
3766
|
+
}
|
|
3767
|
+
const onGotAmdLoader = () => {
|
|
3768
|
+
// Load Monaco
|
|
3769
|
+
window.require.config({ paths: { vs: 'assets/monaco-editor/min/vs' } });
|
|
3770
|
+
window.require(['vs/editor/editor.main'], () => {
|
|
3771
|
+
resolve();
|
|
3772
|
+
});
|
|
3773
|
+
};
|
|
3774
|
+
// Load AMD loader if necessary
|
|
3775
|
+
if (!window.require) {
|
|
3776
|
+
const loaderScript = document.createElement('script');
|
|
3777
|
+
loaderScript.type = 'text/javascript';
|
|
3778
|
+
loaderScript.src = 'assets/monaco-editor/min/vs/loader.js';
|
|
3779
|
+
loaderScript.addEventListener('load', onGotAmdLoader);
|
|
3780
|
+
document.body.appendChild(loaderScript);
|
|
3781
|
+
}
|
|
3782
|
+
else {
|
|
3783
|
+
onGotAmdLoader();
|
|
3784
|
+
}
|
|
3785
|
+
}).then(() => {
|
|
3786
|
+
this.loaded$.next({ monaco: window.monaco });
|
|
3787
|
+
});
|
|
3788
|
+
}
|
|
3789
|
+
}
|
|
3790
|
+
GioMonacoEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3791
|
+
GioMonacoEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorService, providedIn: 'root' });
|
|
3792
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorService, decorators: [{
|
|
3793
|
+
type: Injectable,
|
|
3794
|
+
args: [{
|
|
3795
|
+
providedIn: 'root',
|
|
3796
|
+
}]
|
|
3797
|
+
}] });
|
|
3798
|
+
|
|
3799
|
+
/*
|
|
3800
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
3801
|
+
*
|
|
3802
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3803
|
+
* you may not use this file except in compliance with the License.
|
|
3804
|
+
* You may obtain a copy of the License at
|
|
3805
|
+
*
|
|
3806
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3807
|
+
*
|
|
3808
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3809
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3810
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3811
|
+
* See the License for the specific language governing permissions and
|
|
3812
|
+
* limitations under the License.
|
|
3813
|
+
*/
|
|
3814
|
+
class GioLanguageJsonService {
|
|
3815
|
+
constructor(codeEditorService) {
|
|
3816
|
+
this.unsubscribe$ = new Subject();
|
|
3817
|
+
codeEditorService.loaded$.pipe(takeUntil(this.unsubscribe$)).subscribe(event => {
|
|
3818
|
+
this.setup(event.monaco);
|
|
3819
|
+
});
|
|
3820
|
+
}
|
|
3821
|
+
ngOnDestroy() {
|
|
3822
|
+
this.unsubscribe$.next();
|
|
3823
|
+
this.unsubscribe$.complete();
|
|
3824
|
+
}
|
|
3825
|
+
setup(monaco) {
|
|
3826
|
+
if (!monaco) {
|
|
3827
|
+
throw new Error('Monaco is not loaded');
|
|
3828
|
+
}
|
|
3829
|
+
this.monaco = monaco;
|
|
3830
|
+
const defaults = monaco.languages.json.jsonDefaults;
|
|
3831
|
+
defaults.setDiagnosticsOptions({
|
|
3832
|
+
validate: true,
|
|
3833
|
+
allowComments: true,
|
|
3834
|
+
});
|
|
3835
|
+
}
|
|
3836
|
+
addSchemas(id, definitions = []) {
|
|
3837
|
+
if (!this.monaco) {
|
|
3838
|
+
throw new Error('Monaco is not loaded');
|
|
3839
|
+
}
|
|
3840
|
+
const defaults = this.monaco.languages.json.jsonDefaults;
|
|
3841
|
+
const options = defaults.diagnosticsOptions;
|
|
3842
|
+
let schemas = definitions.map(({ uri, schema }) => ({
|
|
3843
|
+
uri,
|
|
3844
|
+
schema,
|
|
3845
|
+
fileMatch: [id || '*.json'],
|
|
3846
|
+
}));
|
|
3847
|
+
if (options && options.schemas && options.schemas.length > 0) {
|
|
3848
|
+
schemas = [...options.schemas, ...schemas];
|
|
3849
|
+
}
|
|
3850
|
+
defaults.setDiagnosticsOptions(Object.assign(Object.assign({}, options), { schemas: schemas }));
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3853
|
+
GioLanguageJsonService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioLanguageJsonService, deps: [{ token: GioMonacoEditorService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3854
|
+
GioLanguageJsonService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioLanguageJsonService, providedIn: 'root' });
|
|
3855
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioLanguageJsonService, decorators: [{
|
|
3856
|
+
type: Injectable,
|
|
3857
|
+
args: [{
|
|
3858
|
+
providedIn: 'root',
|
|
3859
|
+
}]
|
|
3860
|
+
}], ctorParameters: function () { return [{ type: GioMonacoEditorService }]; } });
|
|
3861
|
+
|
|
3862
|
+
/*
|
|
3863
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
3864
|
+
*
|
|
3865
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3866
|
+
* you may not use this file except in compliance with the License.
|
|
3867
|
+
* You may obtain a copy of the License at
|
|
3868
|
+
*
|
|
3869
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3870
|
+
*
|
|
3871
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3872
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3873
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3874
|
+
* See the License for the specific language governing permissions and
|
|
3875
|
+
* limitations under the License.
|
|
3876
|
+
*/
|
|
3877
|
+
class GioMonacoEditorComponent {
|
|
3878
|
+
constructor(config, monacoEditorService, languageJsonService, hostElement, changeDetectorRef, ngZone) {
|
|
3879
|
+
this.config = config;
|
|
3880
|
+
this.monacoEditorService = monacoEditorService;
|
|
3881
|
+
this.languageJsonService = languageJsonService;
|
|
3882
|
+
this.hostElement = hostElement;
|
|
3883
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
3884
|
+
this.ngZone = ngZone;
|
|
3885
|
+
this.options = {};
|
|
3886
|
+
this.id = uniqueId('gio-monaco-editor-');
|
|
3887
|
+
this.loading = true;
|
|
3888
|
+
this.defaultOptions = {
|
|
3889
|
+
contextmenu: false,
|
|
3890
|
+
minimap: {
|
|
3891
|
+
enabled: true,
|
|
3892
|
+
},
|
|
3893
|
+
automaticLayout: true,
|
|
3894
|
+
scrollBeyondLastLine: false,
|
|
3895
|
+
};
|
|
3896
|
+
this.value = '';
|
|
3897
|
+
this.readOnly = false;
|
|
3898
|
+
this._onChange = () => ({});
|
|
3899
|
+
this._onTouched = () => ({});
|
|
3900
|
+
this.unsubscribe$ = new Subject();
|
|
3901
|
+
this.monacoEditorService.loadEditor();
|
|
3902
|
+
}
|
|
3903
|
+
ngAfterViewInit() {
|
|
3904
|
+
// Wait until monaco editor is available
|
|
3905
|
+
this.monacoEditorService.loaded$.pipe(takeUntil(this.unsubscribe$)).subscribe(({ monaco }) => {
|
|
3906
|
+
this.setupEditor(monaco);
|
|
3907
|
+
this.loading = false;
|
|
3908
|
+
this.changeDetectorRef.detectChanges();
|
|
3909
|
+
});
|
|
3910
|
+
}
|
|
3911
|
+
ngOnDestroy() {
|
|
3912
|
+
if (this.standaloneCodeEditor) {
|
|
3913
|
+
this.standaloneCodeEditor.dispose();
|
|
3914
|
+
this.standaloneCodeEditor = undefined;
|
|
3915
|
+
}
|
|
3916
|
+
if (this.textModel) {
|
|
3917
|
+
this.textModel.dispose();
|
|
3918
|
+
this.textModel = undefined;
|
|
3919
|
+
}
|
|
3920
|
+
this.unsubscribe$.next();
|
|
3921
|
+
this.unsubscribe$.complete();
|
|
3922
|
+
}
|
|
3923
|
+
// From ControlValueAccessor interface
|
|
3924
|
+
writeValue(_value) {
|
|
3925
|
+
if (_value) {
|
|
3926
|
+
this.value = _value;
|
|
3927
|
+
}
|
|
3928
|
+
if (this.textModel) {
|
|
3929
|
+
this.textModel.setValue(this.value);
|
|
3930
|
+
}
|
|
3931
|
+
}
|
|
3932
|
+
// From ControlValueAccessor interface
|
|
3933
|
+
registerOnChange(fn) {
|
|
3934
|
+
this._onChange = fn;
|
|
3935
|
+
}
|
|
3936
|
+
// From ControlValueAccessor interface
|
|
3937
|
+
registerOnTouched(fn) {
|
|
3938
|
+
this._onTouched = fn;
|
|
3939
|
+
}
|
|
3940
|
+
// From ControlValueAccessor interface
|
|
3941
|
+
setDisabledState(isDisabled) {
|
|
3942
|
+
this.readOnly = isDisabled;
|
|
3943
|
+
}
|
|
3944
|
+
setupEditor(monaco) {
|
|
3945
|
+
var _a, _b, _c, _d, _e;
|
|
3946
|
+
if (!this.hostElement) {
|
|
3947
|
+
throw new Error('No editor ref found.');
|
|
3948
|
+
}
|
|
3949
|
+
const domElement = this.hostElement.nativeElement;
|
|
3950
|
+
const settings = {
|
|
3951
|
+
value: this.value,
|
|
3952
|
+
language: (_b = (_a = this.languageConfig) === null || _a === void 0 ? void 0 : _a.language) !== null && _b !== void 0 ? _b : 'text',
|
|
3953
|
+
uri: `code-${uniqueId()}`,
|
|
3954
|
+
};
|
|
3955
|
+
this.ngZone.runOutsideAngular(() => {
|
|
3956
|
+
this.textModel = monaco.editor.createModel(settings.value, settings.language, monaco.Uri.parse(settings.uri));
|
|
3957
|
+
});
|
|
3958
|
+
const options = Object.assign({}, this.defaultOptions, this.options, {
|
|
3959
|
+
readOnly: this.readOnly,
|
|
3960
|
+
theme: (_c = this.config.theme) !== null && _c !== void 0 ? _c : 'vs',
|
|
3961
|
+
model: this.textModel,
|
|
3962
|
+
});
|
|
3963
|
+
this.standaloneCodeEditor = monaco.editor.create(domElement, Object.assign({}, options));
|
|
3964
|
+
(_d = this.textModel) === null || _d === void 0 ? void 0 : _d.onDidChangeContent(() => {
|
|
3965
|
+
var _a;
|
|
3966
|
+
const newValue = (_a = this.textModel) === null || _a === void 0 ? void 0 : _a.getValue();
|
|
3967
|
+
this.ngZone.run(() => {
|
|
3968
|
+
newValue && this._onChange(newValue);
|
|
3969
|
+
this._onTouched();
|
|
3970
|
+
});
|
|
3971
|
+
});
|
|
3972
|
+
(_e = this.standaloneCodeEditor) === null || _e === void 0 ? void 0 : _e.onDidBlurEditorWidget(() => {
|
|
3973
|
+
this.ngZone.run(() => {
|
|
3974
|
+
this._onTouched();
|
|
3975
|
+
});
|
|
3976
|
+
});
|
|
3977
|
+
this.setupLanguage(settings.uri, this.languageConfig);
|
|
3978
|
+
}
|
|
3979
|
+
setupLanguage(uri, languageConfig) {
|
|
3980
|
+
if (!languageConfig) {
|
|
3981
|
+
return;
|
|
3982
|
+
}
|
|
3983
|
+
const { language } = languageConfig;
|
|
3984
|
+
if (language) {
|
|
3985
|
+
const lang = language.toLowerCase();
|
|
3986
|
+
switch (lang) {
|
|
3987
|
+
case 'json':
|
|
3988
|
+
if (languageConfig.schemas) {
|
|
3989
|
+
this.languageJsonService.addSchemas(uri, languageConfig.schemas);
|
|
3990
|
+
}
|
|
3991
|
+
break;
|
|
3992
|
+
default:
|
|
3993
|
+
break;
|
|
3994
|
+
}
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
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 });
|
|
3999
|
+
GioMonacoEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioMonacoEditorComponent, selector: "gio-monaco-editor", inputs: { languageConfig: "languageConfig", options: "options" }, providers: [
|
|
4000
|
+
{
|
|
4001
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4002
|
+
useExisting: forwardRef(() => GioMonacoEditorComponent),
|
|
4003
|
+
multi: true,
|
|
4004
|
+
},
|
|
4005
|
+
], 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"] }] });
|
|
4006
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorComponent, decorators: [{
|
|
4007
|
+
type: Component,
|
|
4008
|
+
args: [{ selector: 'gio-monaco-editor', template: ` <div *ngIf="loading">Loading...</div>`, providers: [
|
|
4009
|
+
{
|
|
4010
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4011
|
+
useExisting: forwardRef(() => GioMonacoEditorComponent),
|
|
4012
|
+
multi: true,
|
|
4013
|
+
},
|
|
4014
|
+
], styles: [":host{display:block;height:100%;min-height:150px}\n"] }]
|
|
4015
|
+
}], ctorParameters: function () {
|
|
4016
|
+
return [{ type: undefined, decorators: [{
|
|
4017
|
+
type: Inject,
|
|
4018
|
+
args: [GIO_MONACO_EDITOR_CONFIG]
|
|
4019
|
+
}] }, { type: GioMonacoEditorService }, { type: GioLanguageJsonService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }];
|
|
4020
|
+
}, propDecorators: { languageConfig: [{
|
|
4021
|
+
type: Input
|
|
4022
|
+
}], options: [{
|
|
4023
|
+
type: Input
|
|
4024
|
+
}] } });
|
|
4025
|
+
|
|
4026
|
+
/*
|
|
4027
|
+
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
4028
|
+
*
|
|
4029
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4030
|
+
* you may not use this file except in compliance with the License.
|
|
4031
|
+
* You may obtain a copy of the License at
|
|
4032
|
+
*
|
|
4033
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4034
|
+
*
|
|
4035
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4036
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4037
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4038
|
+
* See the License for the specific language governing permissions and
|
|
4039
|
+
* limitations under the License.
|
|
4040
|
+
*/
|
|
4041
|
+
class GioMonacoEditorModule {
|
|
4042
|
+
static forRoot(config) {
|
|
4043
|
+
return {
|
|
4044
|
+
ngModule: GioMonacoEditorModule,
|
|
4045
|
+
providers: [
|
|
4046
|
+
{
|
|
4047
|
+
provide: GIO_MONACO_EDITOR_CONFIG,
|
|
4048
|
+
useValue: config,
|
|
4049
|
+
},
|
|
4050
|
+
],
|
|
4051
|
+
};
|
|
4052
|
+
}
|
|
4053
|
+
}
|
|
4054
|
+
GioMonacoEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
4055
|
+
GioMonacoEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, declarations: [GioMonacoEditorComponent], imports: [CommonModule, HttpClientModule, ReactiveFormsModule], exports: [GioMonacoEditorComponent] });
|
|
4056
|
+
GioMonacoEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, providers: [
|
|
4057
|
+
{
|
|
4058
|
+
provide: GIO_MONACO_EDITOR_CONFIG,
|
|
4059
|
+
useValue: {},
|
|
4060
|
+
},
|
|
4061
|
+
], imports: [[CommonModule, HttpClientModule, ReactiveFormsModule]] });
|
|
4062
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorModule, decorators: [{
|
|
4063
|
+
type: NgModule,
|
|
4064
|
+
args: [{
|
|
4065
|
+
imports: [CommonModule, HttpClientModule, ReactiveFormsModule],
|
|
4066
|
+
declarations: [GioMonacoEditorComponent],
|
|
4067
|
+
exports: [GioMonacoEditorComponent],
|
|
4068
|
+
providers: [
|
|
4069
|
+
{
|
|
4070
|
+
provide: GIO_MONACO_EDITOR_CONFIG,
|
|
4071
|
+
useValue: {},
|
|
4072
|
+
},
|
|
4073
|
+
],
|
|
4074
|
+
}]
|
|
4075
|
+
}] });
|
|
4076
|
+
|
|
4077
|
+
/*
|
|
4078
|
+
* Copyright (C) 2023 The Gravitee team (http://gravitee.io)
|
|
4079
|
+
*
|
|
4080
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4081
|
+
* you may not use this file except in compliance with the License.
|
|
4082
|
+
* You may obtain a copy of the License at
|
|
4083
|
+
*
|
|
4084
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4085
|
+
*
|
|
4086
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4087
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4088
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4089
|
+
* See the License for the specific language governing permissions and
|
|
4090
|
+
* limitations under the License.
|
|
4091
|
+
*/
|
|
4092
|
+
/**
|
|
4093
|
+
* This component is used to test the GioMonacoEditorComponent.
|
|
4094
|
+
* This component simulates monaco editor with a simple input.
|
|
4095
|
+
*/
|
|
4096
|
+
class GioMonacoEditorTestingComponent extends GioMonacoEditorComponent {
|
|
4097
|
+
get getValue() {
|
|
4098
|
+
return this.value;
|
|
4099
|
+
}
|
|
4100
|
+
changeValue(value) {
|
|
4101
|
+
this._onTouched();
|
|
4102
|
+
this._onChange(value);
|
|
4103
|
+
}
|
|
4104
|
+
}
|
|
4105
|
+
GioMonacoEditorTestingComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorTestingComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4106
|
+
GioMonacoEditorTestingComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioMonacoEditorTestingComponent, selector: "gio-monaco-editor", providers: [
|
|
4107
|
+
{
|
|
4108
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4109
|
+
useExisting: forwardRef(() => GioMonacoEditorTestingComponent),
|
|
4110
|
+
multi: true,
|
|
4111
|
+
},
|
|
4112
|
+
], usesInheritance: true, ngImport: i0, template: '<input type="text" [value]="getValue" (input)="changeValue($any($event).target?.value)" />', isInline: true });
|
|
4113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioMonacoEditorTestingComponent, decorators: [{
|
|
4114
|
+
type: Component,
|
|
4115
|
+
args: [{
|
|
4116
|
+
selector: 'gio-monaco-editor',
|
|
4117
|
+
template: '<input type="text" [value]="getValue" (input)="changeValue($any($event).target?.value)" />',
|
|
4118
|
+
providers: [
|
|
4119
|
+
{
|
|
4120
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4121
|
+
useExisting: forwardRef(() => GioMonacoEditorTestingComponent),
|
|
4122
|
+
multi: true,
|
|
4123
|
+
},
|
|
4124
|
+
],
|
|
4125
|
+
}]
|
|
4126
|
+
}] });
|
|
4127
|
+
|
|
4128
|
+
// Hack to replace the default gio-monaco-editor component with fake one for testing purpose.
|
|
4129
|
+
try {
|
|
4130
|
+
TestBed.overrideModule(GioMonacoEditorModule, {
|
|
4131
|
+
remove: {
|
|
4132
|
+
declarations: [GioMonacoEditorComponent],
|
|
4133
|
+
exports: [GioMonacoEditorComponent],
|
|
4134
|
+
},
|
|
4135
|
+
add: {
|
|
4136
|
+
declarations: [GioMonacoEditorTestingComponent],
|
|
4137
|
+
exports: [GioMonacoEditorTestingComponent],
|
|
4138
|
+
},
|
|
4139
|
+
});
|
|
4140
|
+
}
|
|
4141
|
+
catch (e) {
|
|
4142
|
+
// Do nothing
|
|
4143
|
+
}
|
|
4144
|
+
class GioMonacoEditorHarness extends ComponentHarness {
|
|
4145
|
+
constructor() {
|
|
4146
|
+
super(...arguments);
|
|
4147
|
+
this.getInputEl = this.locatorFor('input');
|
|
4148
|
+
}
|
|
4149
|
+
/**
|
|
4150
|
+
* Gets a `HarnessPredicate` that can be used to search for a `GioMonacoEditorHarness` that meets
|
|
4151
|
+
* certain criteria.
|
|
4152
|
+
*
|
|
4153
|
+
* @param options Options for filtering which input instances are considered a match.
|
|
4154
|
+
* @return a `HarnessPredicate` configured with the given options.
|
|
4155
|
+
*/
|
|
4156
|
+
static with(options = {}) {
|
|
4157
|
+
return new HarnessPredicate(GioMonacoEditorHarness, options);
|
|
4158
|
+
}
|
|
4159
|
+
setValue(value) {
|
|
4160
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4161
|
+
const inputEl = yield this.getInputEl();
|
|
4162
|
+
yield inputEl.clear();
|
|
4163
|
+
yield inputEl.sendKeys(value);
|
|
4164
|
+
});
|
|
4165
|
+
}
|
|
4166
|
+
getValue() {
|
|
4167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
4168
|
+
const inputEl = yield this.getInputEl();
|
|
4169
|
+
return inputEl.getProperty('value');
|
|
4170
|
+
});
|
|
4171
|
+
}
|
|
4172
|
+
}
|
|
4173
|
+
GioMonacoEditorHarness.hostSelector = 'gio-monaco-editor';
|
|
4174
|
+
|
|
3622
4175
|
/*
|
|
3623
4176
|
* Copyright (C) 2021 The Gravitee team (http://gravitee.io)
|
|
3624
4177
|
*
|
|
@@ -3655,5 +4208,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
3655
4208
|
* Generated bundle index. Do not edit.
|
|
3656
4209
|
*/
|
|
3657
4210
|
|
|
3658
|
-
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 };
|
|
4211
|
+
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 };
|
|
3659
4212
|
//# sourceMappingURL=gravitee-ui-particles-angular.mjs.map
|