@gravitee/ui-particles-angular 7.25.0 → 7.26.0-json-schema-e93b38b
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-form-headers/gio-form-headers.component.mjs +23 -7
- package/esm2020/lib/gio-form-json-schema/gio-formly-json-schema.service.mjs +17 -1
- package/esm2020/lib/gio-form-json-schema/model/GioJsonSchema.mjs +1 -1
- package/esm2020/lib/gio-form-json-schema/type-component/headers-type.component.mjs +10 -15
- package/esm2020/lib/gio-form-tags-input/gio-form-tags-input.component.mjs +47 -8
- package/fesm2015/gravitee-ui-particles-angular.mjs +91 -27
- package/fesm2015/gravitee-ui-particles-angular.mjs.map +1 -1
- package/fesm2020/gravitee-ui-particles-angular.mjs +91 -26
- package/fesm2020/gravitee-ui-particles-angular.mjs.map +1 -1
- package/lib/gio-form-headers/gio-form-headers.component.d.ts +8 -4
- package/lib/gio-form-json-schema/gio-formly-json-schema.service.d.ts +1 -0
- package/lib/gio-form-json-schema/model/GioJsonSchema.d.ts +1 -0
- package/lib/gio-form-json-schema/type-component/headers-type.component.d.ts +2 -4
- package/lib/gio-form-tags-input/gio-form-tags-input.component.d.ts +17 -4
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import * as i0 from '@angular/core';
|
|
|
4
4
|
import { Injectable, SecurityContext, APP_ID, Component, Inject, Input, NgModule, EventEmitter, HostBinding, Output, HostListener, Optional, Self, ViewChild, Directive, forwardRef, ChangeDetectionStrategy, ViewEncapsulation, ContentChildren, Host, ContentChild, InjectionToken } from '@angular/core';
|
|
5
5
|
import * as i4 from '@angular/common/http';
|
|
6
6
|
import { HttpClientModule } from '@angular/common/http';
|
|
7
|
-
import { shareReplay, switchMap, catchError, takeUntil, startWith, map, distinctUntilChanged,
|
|
7
|
+
import { shareReplay, switchMap, catchError, takeUntil, tap, startWith, map, distinctUntilChanged, debounce, delay, filter, take, debounceTime } from 'rxjs/operators';
|
|
8
8
|
import { Observable, of, ReplaySubject, Subject, forkJoin, timer, fromEvent, BehaviorSubject, merge } from 'rxjs';
|
|
9
9
|
import * as i3 from '@angular/platform-browser';
|
|
10
10
|
import { trigger, transition, style, animate } from '@angular/animations';
|
|
@@ -550,6 +550,7 @@ class GioFormTagsInputComponent {
|
|
|
550
550
|
this.focused = false;
|
|
551
551
|
this._required = false;
|
|
552
552
|
this._disabled = false;
|
|
553
|
+
this.displayValueCache = {};
|
|
553
554
|
// From ControlValueAccessor interface
|
|
554
555
|
this.describedBy = '';
|
|
555
556
|
// Replace the provider from above with this.
|
|
@@ -569,6 +570,21 @@ class GioFormTagsInputComponent {
|
|
|
569
570
|
this._autocompleteOptions = v;
|
|
570
571
|
this.initAutocomplete();
|
|
571
572
|
}
|
|
573
|
+
/**
|
|
574
|
+
* Get the label of an option value.
|
|
575
|
+
* To use with autocompleteOptions label & value mode.
|
|
576
|
+
* Function called each time a tag needs to be displayed id defined.
|
|
577
|
+
*/
|
|
578
|
+
set displayValueWith(displayValueWith) {
|
|
579
|
+
this._displayValueWith = (value) => {
|
|
580
|
+
if (this.displayValueCache[value]) {
|
|
581
|
+
return of(this.displayValueCache[value]);
|
|
582
|
+
}
|
|
583
|
+
return displayValueWith(value).pipe(tap(label => {
|
|
584
|
+
this.displayValueCache[value] = label;
|
|
585
|
+
}));
|
|
586
|
+
};
|
|
587
|
+
}
|
|
572
588
|
set tagInput(v) {
|
|
573
589
|
this._tagInput = v;
|
|
574
590
|
this.initAutocomplete();
|
|
@@ -689,8 +705,17 @@ class GioFormTagsInputComponent {
|
|
|
689
705
|
}
|
|
690
706
|
initAutocomplete() {
|
|
691
707
|
if (this._autocompleteOptions && this._tagInput?.nativeElement) {
|
|
692
|
-
this.autocompleteFilteredOptions$ = fromEvent(this._tagInput.nativeElement, 'keyup').pipe(startWith([]),
|
|
693
|
-
|
|
708
|
+
this.autocompleteFilteredOptions$ = fromEvent(this._tagInput.nativeElement, 'keyup').pipe(startWith([]), switchMap(() => {
|
|
709
|
+
if (typeof this._autocompleteOptions === 'function') {
|
|
710
|
+
return this._autocompleteOptions(this._tagInput?.nativeElement.value ?? '').pipe(map(options => sanitizeAutocompleteOptions(options)),
|
|
711
|
+
// Add options to displayValueCache to avoid call on select
|
|
712
|
+
tap(options => {
|
|
713
|
+
options.forEach(option => {
|
|
714
|
+
this.displayValueCache[option.value] = option.label;
|
|
715
|
+
});
|
|
716
|
+
}));
|
|
717
|
+
}
|
|
718
|
+
return of(defaultAutocompleteFilter(this._autocompleteOptions ?? [], this._tagInput?.nativeElement.value ?? ''));
|
|
694
719
|
}), distinctUntilChanged());
|
|
695
720
|
this.changeDetectorRef.detectChanges();
|
|
696
721
|
}
|
|
@@ -698,12 +723,12 @@ class GioFormTagsInputComponent {
|
|
|
698
723
|
}
|
|
699
724
|
GioFormTagsInputComponent.nextId = 0;
|
|
700
725
|
GioFormTagsInputComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormTagsInputComponent, deps: [{ token: i7.NgControl, optional: true, self: true }, { token: i0.ElementRef }, { token: i2$2.FocusMonitor }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
701
|
-
GioFormTagsInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormTagsInputComponent, selector: "gio-form-tags-input", inputs: { ariaLabel: ["aria-label", "ariaLabel"], addOnBlur: "addOnBlur", tagValidationHook: "tagValidationHook", autocompleteOptions: "autocompleteOptions", placeholder: "placeholder", required: "required", disabled: "disabled" }, host: { properties: { "id": "this.id", "class.floating": "this.shouldLabelFloat", "attr.aria-describedby": "this.describedBy" } }, providers: [
|
|
726
|
+
GioFormTagsInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormTagsInputComponent, selector: "gio-form-tags-input", inputs: { ariaLabel: ["aria-label", "ariaLabel"], addOnBlur: "addOnBlur", tagValidationHook: "tagValidationHook", autocompleteOptions: "autocompleteOptions", displayValueWith: "displayValueWith", placeholder: "placeholder", required: "required", disabled: "disabled" }, host: { properties: { "id": "this.id", "class.floating": "this.shouldLabelFloat", "attr.aria-describedby": "this.describedBy" } }, providers: [
|
|
702
727
|
{
|
|
703
728
|
provide: MatFormFieldControl,
|
|
704
729
|
useExisting: GioFormTagsInputComponent,
|
|
705
730
|
},
|
|
706
|
-
], viewQueries: [{ propertyName: "tagInput", first: true, predicate: ["tagInput"], descendants: true }], ngImport: i0, template: "<!--\n\n Copyright (C) 2015 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<mat-chip-list #tagChipList [attr.aria-label]=\"ariaLabel\" multiple [disabled]=\"disabled\">\n <mat-chip *ngFor=\"let tag of value\" [selectable]=\"false\" [removable]=\"!disabled\" (removed)=\"removeChipToFormControl(tag)\">\n {{ tag }}\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip>\n <input\n *ngIf=\"!disabled\"\n #tagInput\n [matAutocompleteDisabled]=\"!_autocompleteOptions\"\n [matAutocomplete]=\"auto\"\n [placeholder]=\"placeholder\"\n [matChipInputFor]=\"tagChipList\"\n [matChipInputAddOnBlur]=\"addOnBlur\"\n (matChipInputTokenEnd)=\"onMatChipTokenEnd()\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onAutocompleteSelect($event)\">\n <mat-option *ngFor=\"let
|
|
731
|
+
], viewQueries: [{ propertyName: "tagInput", first: true, predicate: ["tagInput"], descendants: true }], ngImport: i0, template: "<!--\n\n Copyright (C) 2015 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<mat-chip-list #tagChipList [attr.aria-label]=\"ariaLabel\" multiple [disabled]=\"disabled\">\n <mat-chip *ngFor=\"let tag of value\" [selectable]=\"false\" [removable]=\"!disabled\" (removed)=\"removeChipToFormControl(tag)\">\n {{ _displayValueWith ? (_displayValueWith(tag) | async) : tag }}\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip>\n <input\n *ngIf=\"!disabled\"\n #tagInput\n [matAutocompleteDisabled]=\"!_autocompleteOptions\"\n [matAutocomplete]=\"auto\"\n [placeholder]=\"placeholder\"\n [matChipInputFor]=\"tagChipList\"\n [matChipInputAddOnBlur]=\"addOnBlur\"\n (matChipInputTokenEnd)=\"onMatChipTokenEnd()\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onAutocompleteSelect($event)\">\n <mat-option *ngFor=\"let option of autocompleteFilteredOptions$ | async\" [value]=\"option.value\">\n {{ option.label }}\n </mat-option>\n </mat-autocomplete>\n</mat-chip-list>\n", styles: [""], components: [{ type: i3$1.MatChipList, selector: "mat-chip-list", inputs: ["errorStateMatcher", "multiple", "compareWith", "value", "required", "placeholder", "disabled", "aria-orientation", "selectable", "tabIndex"], outputs: ["change", "valueChange"], exportAs: ["matChipList"] }, { type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i5.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { type: i2$3.MatOption, selector: "mat-option", exportAs: ["matOption"] }], directives: [{ type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i3$1.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["color", "disableRipple", "tabIndex", "selected", "value", "selectable", "disabled", "removable"], outputs: ["selectionChange", "destroyed", "removed"], exportAs: ["matChip"] }, { type: i3$1.MatChipRemove, selector: "[matChipRemove]" }, { type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { type: i3$1.MatChipInput, selector: "input[matChipInputFor]", inputs: ["matChipInputFor", "matChipInputAddOnBlur", "matChipInputSeparatorKeyCodes", "placeholder", "id", "disabled"], outputs: ["matChipInputTokenEnd"], exportAs: ["matChipInput", "matChipInputFor"] }], pipes: { "async": i2$1.AsyncPipe } });
|
|
707
732
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormTagsInputComponent, decorators: [{
|
|
708
733
|
type: Component,
|
|
709
734
|
args: [{ selector: 'gio-form-tags-input', providers: [
|
|
@@ -711,7 +736,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
711
736
|
provide: MatFormFieldControl,
|
|
712
737
|
useExisting: GioFormTagsInputComponent,
|
|
713
738
|
},
|
|
714
|
-
], template: "<!--\n\n Copyright (C) 2015 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<mat-chip-list #tagChipList [attr.aria-label]=\"ariaLabel\" multiple [disabled]=\"disabled\">\n <mat-chip *ngFor=\"let tag of value\" [selectable]=\"false\" [removable]=\"!disabled\" (removed)=\"removeChipToFormControl(tag)\">\n {{ tag }}\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip>\n <input\n *ngIf=\"!disabled\"\n #tagInput\n [matAutocompleteDisabled]=\"!_autocompleteOptions\"\n [matAutocomplete]=\"auto\"\n [placeholder]=\"placeholder\"\n [matChipInputFor]=\"tagChipList\"\n [matChipInputAddOnBlur]=\"addOnBlur\"\n (matChipInputTokenEnd)=\"onMatChipTokenEnd()\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onAutocompleteSelect($event)\">\n <mat-option *ngFor=\"let
|
|
739
|
+
], template: "<!--\n\n Copyright (C) 2015 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<mat-chip-list #tagChipList [attr.aria-label]=\"ariaLabel\" multiple [disabled]=\"disabled\">\n <mat-chip *ngFor=\"let tag of value\" [selectable]=\"false\" [removable]=\"!disabled\" (removed)=\"removeChipToFormControl(tag)\">\n {{ _displayValueWith ? (_displayValueWith(tag) | async) : tag }}\n <mat-icon matChipRemove>cancel</mat-icon>\n </mat-chip>\n <input\n *ngIf=\"!disabled\"\n #tagInput\n [matAutocompleteDisabled]=\"!_autocompleteOptions\"\n [matAutocomplete]=\"auto\"\n [placeholder]=\"placeholder\"\n [matChipInputFor]=\"tagChipList\"\n [matChipInputAddOnBlur]=\"addOnBlur\"\n (matChipInputTokenEnd)=\"onMatChipTokenEnd()\"\n />\n <mat-autocomplete #auto=\"matAutocomplete\" (optionSelected)=\"onAutocompleteSelect($event)\">\n <mat-option *ngFor=\"let option of autocompleteFilteredOptions$ | async\" [value]=\"option.value\">\n {{ option.label }}\n </mat-option>\n </mat-autocomplete>\n</mat-chip-list>\n", styles: [""] }]
|
|
715
740
|
}], ctorParameters: function () { return [{ type: i7.NgControl, decorators: [{
|
|
716
741
|
type: Optional
|
|
717
742
|
}, {
|
|
@@ -725,6 +750,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
725
750
|
type: Input
|
|
726
751
|
}], autocompleteOptions: [{
|
|
727
752
|
type: Input
|
|
753
|
+
}], displayValueWith: [{
|
|
754
|
+
type: Input
|
|
728
755
|
}], tagInput: [{
|
|
729
756
|
type: ViewChild,
|
|
730
757
|
args: ['tagInput']
|
|
@@ -744,6 +771,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
744
771
|
type: HostBinding,
|
|
745
772
|
args: ['attr.aria-describedby']
|
|
746
773
|
}] } });
|
|
774
|
+
const defaultAutocompleteFilter = (options, search) => {
|
|
775
|
+
return sanitizeAutocompleteOptions(options).filter(defaultHeader => defaultHeader.label.toLowerCase().includes((search ?? '').toLowerCase()) ||
|
|
776
|
+
defaultHeader.value.toLowerCase().includes((search ?? '').toLowerCase()));
|
|
777
|
+
};
|
|
778
|
+
const sanitizeAutocompleteOptions = (options) => {
|
|
779
|
+
return options.map(option => {
|
|
780
|
+
if (option && typeof option !== 'string' && 'value' in option && 'label' in option) {
|
|
781
|
+
return option;
|
|
782
|
+
}
|
|
783
|
+
return { value: option, label: option };
|
|
784
|
+
});
|
|
785
|
+
};
|
|
747
786
|
|
|
748
787
|
/*
|
|
749
788
|
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
|
|
@@ -1305,6 +1344,10 @@ class GioFormHeadersComponent {
|
|
|
1305
1344
|
constructor(fm, elRef) {
|
|
1306
1345
|
this.fm = fm;
|
|
1307
1346
|
this.elRef = elRef;
|
|
1347
|
+
this.headerFieldMapper = {
|
|
1348
|
+
keyName: 'key',
|
|
1349
|
+
valueName: 'value',
|
|
1350
|
+
};
|
|
1308
1351
|
this.headersFormArray = new FormArray([
|
|
1309
1352
|
new FormGroup({
|
|
1310
1353
|
key: new FormControl('', Validators.pattern('^\\S*$')),
|
|
@@ -1325,18 +1368,30 @@ class GioFormHeadersComponent {
|
|
|
1325
1368
|
if (!value) {
|
|
1326
1369
|
return;
|
|
1327
1370
|
}
|
|
1328
|
-
this.headers = value ?? []
|
|
1371
|
+
this.headers = [...(value ?? [])].map((header) => {
|
|
1372
|
+
return {
|
|
1373
|
+
key: header[this.headerFieldMapper.keyName],
|
|
1374
|
+
value: header[this.headerFieldMapper.valueName],
|
|
1375
|
+
};
|
|
1376
|
+
});
|
|
1329
1377
|
this.initHeadersForm();
|
|
1330
1378
|
}
|
|
1331
1379
|
// From ControlValueAccessor interface
|
|
1332
1380
|
registerOnChange(fn) {
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
this._onChange = (headers) => fn(adaptOutputFn(headers));
|
|
1381
|
+
if (this.headerFieldMapper) {
|
|
1382
|
+
this._onChange = (headers) => fn(this.toHeaders(headers));
|
|
1336
1383
|
return;
|
|
1337
1384
|
}
|
|
1338
1385
|
this._onChange = fn;
|
|
1339
1386
|
}
|
|
1387
|
+
toHeaders(headers) {
|
|
1388
|
+
return [...(headers ?? [])].map(header => {
|
|
1389
|
+
return {
|
|
1390
|
+
[this.headerFieldMapper.keyName]: header.key,
|
|
1391
|
+
[this.headerFieldMapper.valueName]: header.value,
|
|
1392
|
+
};
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1340
1395
|
// From ControlValueAccessor interface
|
|
1341
1396
|
registerOnTouched(fn) {
|
|
1342
1397
|
this._onTouched = fn;
|
|
@@ -1429,7 +1484,7 @@ class GioFormHeadersComponent {
|
|
|
1429
1484
|
}
|
|
1430
1485
|
}
|
|
1431
1486
|
GioFormHeadersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormHeadersComponent, deps: [{ token: i2$2.FocusMonitor }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1432
|
-
GioFormHeadersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormHeadersComponent, selector: "gio-form-headers", inputs: {
|
|
1487
|
+
GioFormHeadersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormHeadersComponent, selector: "gio-form-headers", inputs: { headerFieldMapper: "headerFieldMapper" }, host: { properties: { "class.disabled": "this.disabled" } }, providers: [
|
|
1433
1488
|
{
|
|
1434
1489
|
provide: NG_VALUE_ACCESSOR,
|
|
1435
1490
|
useExisting: forwardRef(() => GioFormHeadersComponent),
|
|
@@ -1455,7 +1510,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
1455
1510
|
multi: true,
|
|
1456
1511
|
},
|
|
1457
1512
|
], template: "<!--\n\n Copyright (C) 2015 The Gravitee team (http://gravitee.io)\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<table class=\"gio-form-headers__table gio-table-light\" [formGroup]=\"mainForm\">\n <thead>\n <tr>\n <th>KEY</th>\n <th>VALUE</th>\n </tr>\n </thead>\n <tbody formArrayName=\"headers\">\n <tr\n *ngFor=\"let control of headersFormArray.controls; index as headerIndex\"\n class=\"gio-form-headers__table__header-row\"\n [formGroupName]=\"headerIndex\"\n >\n <td class=\"gio-form-headers__table__header-row__td-key\">\n <mat-form-field class=\"gio-form-headers__table__header-row__td-key__field\" [floatLabel]=\"'never'\" appearance=\"standard\">\n <textarea\n formControlName=\"key\"\n matInput\n placeholder=\"Name...\"\n cdkTextareaAutosize\n cdkAutosizeMinRows=\"1\"\n [matAutocomplete]=\"headerNamesAutocomplete\"\n ></textarea>\n </mat-form-field>\n <mat-error *ngIf=\"control.get('key')?.hasError('pattern')\">\n Header name must not contain spaces. (RegExp: {{ control.get('key')?.getError('pattern')?.requiredPattern }})\n </mat-error>\n <mat-autocomplete #headerNamesAutocomplete=\"matAutocomplete\">\n <mat-option *ngFor=\"let headerName of getFilteredHeaderNames(headerIndex, control.value) | async\" [value]=\"headerName\">{{\n headerName\n }}</mat-option>\n </mat-autocomplete>\n </td>\n <td class=\"gio-form-headers__table__header-row__td-value\">\n <mat-form-field class=\"gio-form-headers__table__header-row__td-value__field\" [floatLabel]=\"'never'\" appearance=\"standard\">\n <textarea formControlName=\"value\" matInput placeholder=\"Value...\" cdkTextareaAutosize cdkAutosizeMinRows=\"1\"></textarea>\n </mat-form-field>\n <button\n class=\"gio-form-headers__table__header-row__td-value__button\"\n *ngIf=\"headersFormArray.controls.length - 1 !== headerIndex\"\n mat-icon-button\n aria-label=\"Delete\"\n (click)=\"onDeleteHeader(headerIndex)\"\n >\n <mat-icon svgIcon=\"gio:cancel\"></mat-icon>\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n", styles: [":host{display:block;overflow:hidden}.gio-form-headers__table{width:100%}.gio-form-headers__table__header-row__td-key,.gio-form-headers__table__header-row__td-value{position:relative;width:50%}.gio-form-headers__table__header-row__td-key__field,.gio-form-headers__table__header-row__td-value__field{display:flex;overflow:hidden;width:100%;max-height:32px;flex-direction:column;justify-content:center;padding-bottom:0}.gio-form-headers__table__header-row__td-key__field *,.gio-form-headers__table__header-row__td-value__field *{top:0;overflow:hidden;max-height:32px}.gio-form-headers__table__header-row__td-key__field:focus-within,.gio-form-headers__table__header-row__td-value__field:focus-within{z-index:100;height:auto;background-color:#fff}.gio-form-headers__table__header-row__td-key__field:focus-within *,.gio-form-headers__table__header-row__td-value__field:focus-within *{max-height:none}.gio-form-headers__table__header-row__td-key__button,.gio-form-headers__table__header-row__td-value__button{position:absolute;top:3px;right:3px;display:none}.gio-form-headers__table__header-row__td-remove{width:32px;height:32px;padding:0}.gio-form-headers__table__header-row:hover .gio-form-headers__table__header-row__td-value__button{z-index:110;display:block;background-color:#fff;opacity:.9}::ng-deep gio-form-headers .gio-form-headers__table__header-row .mat-form-field-infix{width:inherit}\n"] }]
|
|
1458
|
-
}], ctorParameters: function () { return [{ type: i2$2.FocusMonitor }, { type: i0.ElementRef }]; }, propDecorators: {
|
|
1513
|
+
}], ctorParameters: function () { return [{ type: i2$2.FocusMonitor }, { type: i0.ElementRef }]; }, propDecorators: { headerFieldMapper: [{
|
|
1459
1514
|
type: Input
|
|
1460
1515
|
}], disabled: [{
|
|
1461
1516
|
type: HostBinding,
|
|
@@ -3131,6 +3186,7 @@ class GioFormlyJsonSchemaService {
|
|
|
3131
3186
|
mappedField = this.bannerMap(mappedField, mapSource);
|
|
3132
3187
|
mappedField = this.toggleMap(mappedField, mapSource);
|
|
3133
3188
|
mappedField = this.disabledMap(mappedField, mapSource);
|
|
3189
|
+
mappedField = this.enumLabelMap(mappedField, mapSource);
|
|
3134
3190
|
return mappedField;
|
|
3135
3191
|
},
|
|
3136
3192
|
});
|
|
@@ -3192,6 +3248,20 @@ class GioFormlyJsonSchemaService {
|
|
|
3192
3248
|
};
|
|
3193
3249
|
return mappedField;
|
|
3194
3250
|
}
|
|
3251
|
+
enumLabelMap(mappedField, mapSource) {
|
|
3252
|
+
if (mapSource.enum && !isEmpty(mapSource.enum) && mapSource.gioConfig?.enumLabelMap && isArray(mappedField.props?.options)) {
|
|
3253
|
+
mappedField.props = {
|
|
3254
|
+
...mappedField.props,
|
|
3255
|
+
options: mappedField.props?.options?.map(({ value }) => {
|
|
3256
|
+
return {
|
|
3257
|
+
label: value ? mapSource.gioConfig?.enumLabelMap?.[value] : value,
|
|
3258
|
+
value: value,
|
|
3259
|
+
};
|
|
3260
|
+
}),
|
|
3261
|
+
};
|
|
3262
|
+
}
|
|
3263
|
+
return mappedField;
|
|
3264
|
+
}
|
|
3195
3265
|
}
|
|
3196
3266
|
GioFormlyJsonSchemaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormlyJsonSchemaService, deps: [{ token: i1$3.FormlyJsonschema }, { token: i1$4.FormlyFormBuilder }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
3197
3267
|
GioFormlyJsonSchemaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormlyJsonSchemaService });
|
|
@@ -4385,21 +4455,16 @@ class GioFjsHeadersTypeComponent extends FieldType {
|
|
|
4385
4455
|
super(...arguments);
|
|
4386
4456
|
this.defaultOptions = {
|
|
4387
4457
|
props: {
|
|
4388
|
-
outputConfig:
|
|
4389
|
-
keyName: 'name',
|
|
4390
|
-
valueName: 'value',
|
|
4391
|
-
},
|
|
4458
|
+
outputConfig: this.outputConfig,
|
|
4392
4459
|
},
|
|
4393
4460
|
};
|
|
4394
4461
|
this.collapse = false;
|
|
4395
4462
|
}
|
|
4396
|
-
get
|
|
4397
|
-
return
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
};
|
|
4402
|
-
});
|
|
4463
|
+
get outputConfig() {
|
|
4464
|
+
return {
|
|
4465
|
+
keyName: 'name',
|
|
4466
|
+
valueName: 'value',
|
|
4467
|
+
};
|
|
4403
4468
|
}
|
|
4404
4469
|
}
|
|
4405
4470
|
GioFjsHeadersTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsHeadersTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -4420,10 +4485,10 @@ GioFjsHeadersTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0
|
|
|
4420
4485
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
4421
4486
|
</div>
|
|
4422
4487
|
<div *ngIf="!collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
|
|
4423
|
-
<gio-form-headers [
|
|
4488
|
+
<gio-form-headers [headerFieldMapper]="outputConfig" [formControl]="formControl"></gio-form-headers>
|
|
4424
4489
|
</div>
|
|
4425
4490
|
</div>
|
|
4426
|
-
`, isInline: true, styles: [".wrapper{display:flex;flex-direction:column;padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper__header{display:flex}.wrapper__header__text{flex:1 1 auto}.wrapper__header__text__title{font:600 16px/24px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:8px}.wrapper__header__collapse{flex:0 0 auto}.wrapper__header__collapse .collapse-open{transform:rotate(180deg);transition:transform 225ms cubic-bezier(.4,0,.2,1)}.wrapper__header__collapse .collapse-close{transform:rotate(0);transition:transform 225ms cubic-bezier(.4,0,.2,1)}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}\n"], components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i1$4.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { type: GioFormHeadersComponent, selector: "gio-form-headers", inputs: ["
|
|
4491
|
+
`, isInline: true, styles: [".wrapper{display:flex;flex-direction:column;padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper__header{display:flex}.wrapper__header__text{flex:1 1 auto}.wrapper__header__text__title{font:600 16px/24px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:8px}.wrapper__header__collapse{flex:0 0 auto}.wrapper__header__collapse .collapse-open{transform:rotate(180deg);transition:transform 225ms cubic-bezier(.4,0,.2,1)}.wrapper__header__collapse .collapse-close{transform:rotate(0);transition:transform 225ms cubic-bezier(.4,0,.2,1)}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}\n"], components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i1$4.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { type: GioFormHeadersComponent, selector: "gio-form-headers", inputs: ["headerFieldMapper"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i7.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }] });
|
|
4427
4492
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsHeadersTypeComponent, decorators: [{
|
|
4428
4493
|
type: Component,
|
|
4429
4494
|
args: [{ selector: 'gio-fjs-headers-type', template: `
|
|
@@ -4443,7 +4508,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
4443
4508
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
4444
4509
|
</div>
|
|
4445
4510
|
<div *ngIf="!collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
|
|
4446
|
-
<gio-form-headers [
|
|
4511
|
+
<gio-form-headers [headerFieldMapper]="outputConfig" [formControl]="formControl"></gio-form-headers>
|
|
4447
4512
|
</div>
|
|
4448
4513
|
</div>
|
|
4449
4514
|
`, styles: [".wrapper{display:flex;flex-direction:column;padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper__header{display:flex}.wrapper__header__text{flex:1 1 auto}.wrapper__header__text__title{font:600 16px/24px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;margin-bottom:8px}.wrapper__header__collapse{flex:0 0 auto}.wrapper__header__collapse .collapse-open{transform:rotate(180deg);transition:transform 225ms cubic-bezier(.4,0,.2,1)}.wrapper__header__collapse .collapse-close{transform:rotate(0);transition:transform 225ms cubic-bezier(.4,0,.2,1)}.wrapper__error{font:400 12px/16px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:normal;color:#ec4899}\n"] }]
|