@gravitee/ui-particles-angular 7.25.0 → 7.26.0
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/type-component/headers-type.component.mjs +10 -15
- package/fesm2015/gravitee-ui-particles-angular.mjs +31 -20
- package/fesm2015/gravitee-ui-particles-angular.mjs.map +1 -1
- package/fesm2020/gravitee-ui-particles-angular.mjs +31 -20
- 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/type-component/headers-type.component.d.ts +2 -4
- package/package.json +1 -1
|
@@ -1305,6 +1305,10 @@ class GioFormHeadersComponent {
|
|
|
1305
1305
|
constructor(fm, elRef) {
|
|
1306
1306
|
this.fm = fm;
|
|
1307
1307
|
this.elRef = elRef;
|
|
1308
|
+
this.headerFieldMapper = {
|
|
1309
|
+
keyName: 'key',
|
|
1310
|
+
valueName: 'value',
|
|
1311
|
+
};
|
|
1308
1312
|
this.headersFormArray = new FormArray([
|
|
1309
1313
|
new FormGroup({
|
|
1310
1314
|
key: new FormControl('', Validators.pattern('^\\S*$')),
|
|
@@ -1325,18 +1329,30 @@ class GioFormHeadersComponent {
|
|
|
1325
1329
|
if (!value) {
|
|
1326
1330
|
return;
|
|
1327
1331
|
}
|
|
1328
|
-
this.headers = value ?? []
|
|
1332
|
+
this.headers = [...(value ?? [])].map((header) => {
|
|
1333
|
+
return {
|
|
1334
|
+
key: header[this.headerFieldMapper.keyName],
|
|
1335
|
+
value: header[this.headerFieldMapper.valueName],
|
|
1336
|
+
};
|
|
1337
|
+
});
|
|
1329
1338
|
this.initHeadersForm();
|
|
1330
1339
|
}
|
|
1331
1340
|
// From ControlValueAccessor interface
|
|
1332
1341
|
registerOnChange(fn) {
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
this._onChange = (headers) => fn(adaptOutputFn(headers));
|
|
1342
|
+
if (this.headerFieldMapper) {
|
|
1343
|
+
this._onChange = (headers) => fn(this.toHeaders(headers));
|
|
1336
1344
|
return;
|
|
1337
1345
|
}
|
|
1338
1346
|
this._onChange = fn;
|
|
1339
1347
|
}
|
|
1348
|
+
toHeaders(headers) {
|
|
1349
|
+
return [...(headers ?? [])].map(header => {
|
|
1350
|
+
return {
|
|
1351
|
+
[this.headerFieldMapper.keyName]: header.key,
|
|
1352
|
+
[this.headerFieldMapper.valueName]: header.value,
|
|
1353
|
+
};
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1340
1356
|
// From ControlValueAccessor interface
|
|
1341
1357
|
registerOnTouched(fn) {
|
|
1342
1358
|
this._onTouched = fn;
|
|
@@ -1429,7 +1445,7 @@ class GioFormHeadersComponent {
|
|
|
1429
1445
|
}
|
|
1430
1446
|
}
|
|
1431
1447
|
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: {
|
|
1448
|
+
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
1449
|
{
|
|
1434
1450
|
provide: NG_VALUE_ACCESSOR,
|
|
1435
1451
|
useExisting: forwardRef(() => GioFormHeadersComponent),
|
|
@@ -1455,7 +1471,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
1455
1471
|
multi: true,
|
|
1456
1472
|
},
|
|
1457
1473
|
], 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: {
|
|
1474
|
+
}], ctorParameters: function () { return [{ type: i2$2.FocusMonitor }, { type: i0.ElementRef }]; }, propDecorators: { headerFieldMapper: [{
|
|
1459
1475
|
type: Input
|
|
1460
1476
|
}], disabled: [{
|
|
1461
1477
|
type: HostBinding,
|
|
@@ -4385,21 +4401,16 @@ class GioFjsHeadersTypeComponent extends FieldType {
|
|
|
4385
4401
|
super(...arguments);
|
|
4386
4402
|
this.defaultOptions = {
|
|
4387
4403
|
props: {
|
|
4388
|
-
outputConfig:
|
|
4389
|
-
keyName: 'name',
|
|
4390
|
-
valueName: 'value',
|
|
4391
|
-
},
|
|
4404
|
+
outputConfig: this.outputConfig,
|
|
4392
4405
|
},
|
|
4393
4406
|
};
|
|
4394
4407
|
this.collapse = false;
|
|
4395
4408
|
}
|
|
4396
|
-
get
|
|
4397
|
-
return
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
};
|
|
4402
|
-
});
|
|
4409
|
+
get outputConfig() {
|
|
4410
|
+
return {
|
|
4411
|
+
keyName: 'name',
|
|
4412
|
+
valueName: 'value',
|
|
4413
|
+
};
|
|
4403
4414
|
}
|
|
4404
4415
|
}
|
|
4405
4416
|
GioFjsHeadersTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsHeadersTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -4420,10 +4431,10 @@ GioFjsHeadersTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0
|
|
|
4420
4431
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
4421
4432
|
</div>
|
|
4422
4433
|
<div *ngIf="!collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
|
|
4423
|
-
<gio-form-headers [
|
|
4434
|
+
<gio-form-headers [headerFieldMapper]="outputConfig" [formControl]="formControl"></gio-form-headers>
|
|
4424
4435
|
</div>
|
|
4425
4436
|
</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: ["
|
|
4437
|
+
`, 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
4438
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsHeadersTypeComponent, decorators: [{
|
|
4428
4439
|
type: Component,
|
|
4429
4440
|
args: [{ selector: 'gio-fjs-headers-type', template: `
|
|
@@ -4443,7 +4454,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
|
|
|
4443
4454
|
<formly-validation-message [field]="field"></formly-validation-message>
|
|
4444
4455
|
</div>
|
|
4445
4456
|
<div *ngIf="!collapse" class="wrapper__rows" [class.collapse-open]="collapse" [class.collapse-close]="!collapse">
|
|
4446
|
-
<gio-form-headers [
|
|
4457
|
+
<gio-form-headers [headerFieldMapper]="outputConfig" [formControl]="formControl"></gio-form-headers>
|
|
4447
4458
|
</div>
|
|
4448
4459
|
</div>
|
|
4449
4460
|
`, 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"] }]
|