@gravitee/ui-particles-angular 5.6.0 → 5.7.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.
@@ -45,7 +45,7 @@ import { MatSelectHarness } from '@angular/material/select/testing';
45
45
  import { toSvg } from 'jdenticon';
46
46
  import * as i1$3 from '@ngx-formly/core/json-schema';
47
47
  import * as i1$4 from '@ngx-formly/core';
48
- import { FieldType, FieldArrayType, FormlyModule } from '@ngx-formly/core';
48
+ import { FieldType, FieldArrayType, FieldWrapper, FormlyModule } from '@ngx-formly/core';
49
49
  import { FormlyMaterialModule } from '@ngx-formly/material';
50
50
 
51
51
  /*
@@ -2797,7 +2797,23 @@ class GioFormJsonSchemaComponent {
2797
2797
  }
2798
2798
  }
2799
2799
  toFormlyFieldConfig(jsonSchema) {
2800
- return this.formlyJsonschema.toFieldConfig(jsonSchema);
2800
+ return this.formlyJsonschema.toFieldConfig(jsonSchema, {
2801
+ map: (mappedField, mapSource) => {
2802
+ // Casting fields into our specific type
2803
+ const gioMapSource = mapSource;
2804
+ mappedField.props = {
2805
+ ...mappedField.props,
2806
+ ...(gioMapSource.gioConfig?.banner ? this.getBannerProperties(gioMapSource.gioConfig.banner) : {}),
2807
+ };
2808
+ return mappedField;
2809
+ },
2810
+ });
2811
+ }
2812
+ getBannerProperties(banner) {
2813
+ return {
2814
+ bannerText: banner.text,
2815
+ bannerTitle: 'title' in banner ? banner.title : undefined,
2816
+ };
2801
2817
  }
2802
2818
  }
2803
2819
  GioFormJsonSchemaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, deps: [{ token: i1$3.FormlyJsonschema }], target: i0.ɵɵFactoryTarget.Component });
@@ -2836,11 +2852,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
2836
2852
  class GioFjsNullTypeComponent extends FieldType {
2837
2853
  }
2838
2854
  GioFjsNullTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsNullTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2839
- GioFjsNullTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsNullTypeComponent, selector: "gio-fjs-object-type", usesInheritance: true, ngImport: i0, template: ``, isInline: true });
2855
+ GioFjsNullTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsNullTypeComponent, selector: "gio-fjs-null-type", usesInheritance: true, ngImport: i0, template: ``, isInline: true });
2840
2856
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsNullTypeComponent, decorators: [{
2841
2857
  type: Component,
2842
2858
  args: [{
2843
- selector: 'gio-fjs-object-type',
2859
+ selector: 'gio-fjs-null-type',
2844
2860
  template: ``,
2845
2861
  }]
2846
2862
  }] });
@@ -2997,6 +3013,40 @@ function typeValidationMessage({ schemaType }) {
2997
3013
  return `Should be "${schemaType[0]}".`;
2998
3014
  }
2999
3015
 
3016
+ /*
3017
+ * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
3018
+ *
3019
+ * Licensed under the Apache License, Version 2.0 (the "License");
3020
+ * you may not use this file except in compliance with the License.
3021
+ * You may obtain a copy of the License at
3022
+ *
3023
+ * http://www.apache.org/licenses/LICENSE-2.0
3024
+ *
3025
+ * Unless required by applicable law or agreed to in writing, software
3026
+ * distributed under the License is distributed on an "AS IS" BASIS,
3027
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3028
+ * See the License for the specific language governing permissions and
3029
+ * limitations under the License.
3030
+ */
3031
+ class GioFormFieldWrapperComponent extends FieldWrapper {
3032
+ }
3033
+ GioFormFieldWrapperComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFieldWrapperComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3034
+ GioFormFieldWrapperComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormFieldWrapperComponent, selector: "gio-form-field-wrapper", usesInheritance: true, ngImport: i0, template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<div class=\"wrapper\">\n <div class=\"banner\">\n <div class=\"banner__icon\"><mat-icon svgIcon=\"gio:info\"></mat-icon></div>\n <div>\n <div class=\"banner__title\">{{ props.bannerTitle }}</div>\n <div class=\"banner__text\">{{ props.bannerText }}</div>\n </div>\n </div>\n <ng-container #fieldComponent></ng-container>\n</div>\n", styles: [".wrapper{padding:8px 0}.banner{display:flex;flex-direction:row;align-items:flex-start;padding:8px;border-radius:8px;margin-bottom:8px;background:#e7e8ef;gap:8px}.banner__icon{padding-top:2px}.banner__icon mat-icon{width:16px;height:16px;color:#6c59bd}.banner__title{font:600 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px}.banner__text{font:400 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;color:#606274}\n"], components: [{ type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
3035
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormFieldWrapperComponent, decorators: [{
3036
+ type: Component,
3037
+ args: [{ selector: 'gio-form-field-wrapper', template: "<!--\n\n Copyright (C) 2023 The Gravitee team (http://gravitee.io)\n \n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n \n http://www.apache.org/licenses/LICENSE-2.0\n \n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n-->\n<div class=\"wrapper\">\n <div class=\"banner\">\n <div class=\"banner__icon\"><mat-icon svgIcon=\"gio:info\"></mat-icon></div>\n <div>\n <div class=\"banner__title\">{{ props.bannerTitle }}</div>\n <div class=\"banner__text\">{{ props.bannerText }}</div>\n </div>\n </div>\n <ng-container #fieldComponent></ng-container>\n</div>\n", styles: [".wrapper{padding:8px 0}.banner{display:flex;flex-direction:row;align-items:flex-start;padding:8px;border-radius:8px;margin-bottom:8px;background:#e7e8ef;gap:8px}.banner__icon{padding-top:2px}.banner__icon mat-icon{width:16px;height:16px;color:#6c59bd}.banner__title{font:600 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px}.banner__text{font:400 14px/20px Golos UI,Roboto,Helvetica Neue,sans-serif;letter-spacing:.4px;color:#606274}\n"] }]
3038
+ }] });
3039
+
3040
+ function bannerExtension(field) {
3041
+ if (!field.props || (field.wrappers && field.wrappers.indexOf('gio-with-banner') !== -1)) {
3042
+ return;
3043
+ }
3044
+ if (field.props.bannerTitle || field.props.bannerText) {
3045
+ // WARNING: 'gio-with-banner' must be placed before field wrappers in order to put banner before mat-form-field if exists
3046
+ field.wrappers = ['gio-with-banner', ...(field.wrappers || [])];
3047
+ }
3048
+ }
3049
+
3000
3050
  /*
3001
3051
  * Copyright (C) 2015 The Gravitee team (http://gravitee.io)
3002
3052
  *
@@ -3015,8 +3065,13 @@ function typeValidationMessage({ schemaType }) {
3015
3065
  class GioFormJsonSchemaModule {
3016
3066
  }
3017
3067
  GioFormJsonSchemaModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3018
- GioFormJsonSchemaModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, declarations: [GioFormJsonSchemaComponent, GioFjsNullTypeComponent, GioFjsObjectTypeComponent, GioFjsArrayTypeComponent], imports: [CommonModule,
3019
- ReactiveFormsModule, i1$4.FormlyModule, FormlyMaterialModule], exports: [GioFormJsonSchemaComponent, FormlyModule] });
3068
+ GioFormJsonSchemaModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, declarations: [GioFormJsonSchemaComponent,
3069
+ GioFjsNullTypeComponent,
3070
+ GioFjsObjectTypeComponent,
3071
+ GioFjsArrayTypeComponent,
3072
+ GioFormFieldWrapperComponent], imports: [CommonModule,
3073
+ ReactiveFormsModule, i1$4.FormlyModule, FormlyMaterialModule,
3074
+ GioIconsModule], exports: [GioFormJsonSchemaComponent, FormlyModule] });
3020
3075
  GioFormJsonSchemaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, imports: [[
3021
3076
  CommonModule,
3022
3077
  ReactiveFormsModule,
@@ -3036,18 +3091,27 @@ GioFormJsonSchemaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
3036
3091
  { name: 'uniqueItems', message: 'Should NOT have duplicate items' },
3037
3092
  { name: 'const', message: constValidationMessage },
3038
3093
  ],
3094
+ wrappers: [{ name: 'gio-with-banner', component: GioFormFieldWrapperComponent }],
3039
3095
  types: [
3040
3096
  { name: 'null', component: GioFjsNullTypeComponent, wrappers: ['form-field'] },
3041
3097
  { name: 'array', component: GioFjsArrayTypeComponent },
3042
3098
  { name: 'object', component: GioFjsObjectTypeComponent },
3043
3099
  ],
3100
+ extensions: [{ name: 'banner', extension: { onPopulate: bannerExtension } }],
3044
3101
  }),
3045
3102
  FormlyMaterialModule,
3103
+ GioIconsModule,
3046
3104
  ], FormlyModule] });
3047
3105
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, decorators: [{
3048
3106
  type: NgModule,
3049
3107
  args: [{
3050
- declarations: [GioFormJsonSchemaComponent, GioFjsNullTypeComponent, GioFjsObjectTypeComponent, GioFjsArrayTypeComponent],
3108
+ declarations: [
3109
+ GioFormJsonSchemaComponent,
3110
+ GioFjsNullTypeComponent,
3111
+ GioFjsObjectTypeComponent,
3112
+ GioFjsArrayTypeComponent,
3113
+ GioFormFieldWrapperComponent,
3114
+ ],
3051
3115
  imports: [
3052
3116
  CommonModule,
3053
3117
  ReactiveFormsModule,
@@ -3067,13 +3131,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3067
3131
  { name: 'uniqueItems', message: 'Should NOT have duplicate items' },
3068
3132
  { name: 'const', message: constValidationMessage },
3069
3133
  ],
3134
+ wrappers: [{ name: 'gio-with-banner', component: GioFormFieldWrapperComponent }],
3070
3135
  types: [
3071
3136
  { name: 'null', component: GioFjsNullTypeComponent, wrappers: ['form-field'] },
3072
3137
  { name: 'array', component: GioFjsArrayTypeComponent },
3073
3138
  { name: 'object', component: GioFjsObjectTypeComponent },
3074
3139
  ],
3140
+ extensions: [{ name: 'banner', extension: { onPopulate: bannerExtension } }],
3075
3141
  }),
3076
3142
  FormlyMaterialModule,
3143
+ GioIconsModule,
3077
3144
  ],
3078
3145
  exports: [GioFormJsonSchemaComponent, FormlyModule],
3079
3146
  }]