@gravitee/ui-particles-angular 5.7.3-improve-form-json-compo-cb73491 → 5.7.3-json-schema-77b8f57

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.
@@ -1,6 +1,6 @@
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 } from '@angular/core';
3
+ import { EventEmitter, Component, HostBinding, Input, Output, HostListener, NgModule, Optional, Self, ViewChild, Directive, Inject, forwardRef, ChangeDetectionStrategy, Injectable, ViewEncapsulation, ContentChildren } from '@angular/core';
4
4
  import { timer, Subject, fromEvent, of, BehaviorSubject } from 'rxjs';
5
5
  import * as i1 from '@angular/material/card';
6
6
  import { MatCardModule } from '@angular/material/card';
@@ -12,7 +12,7 @@ import { ComponentHarness, HarnessPredicate, parallel, TestKey } from '@angular/
12
12
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
13
13
  import * as i3$1 from '@angular/material/form-field';
14
14
  import { MatFormFieldControl, MatFormFieldModule, MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
15
- import { isEmpty, toLower, dropRight, isNil, isArray, remove, isObject, cloneDeep } from 'lodash';
15
+ import { isEmpty as isEmpty$1, toLower, dropRight, isNil, isArray, remove, cloneDeep, isObject as isObject$1, set } from 'lodash';
16
16
  import { startWith, map, distinctUntilChanged, tap, debounce, takeUntil, delay, filter, switchMap } from 'rxjs/operators';
17
17
  import * as i7 from '@angular/forms';
18
18
  import { FormsModule, FormArray, FormGroup, FormControl, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
@@ -43,9 +43,8 @@ import * as i6$2 from 'ngx-file-helpers';
43
43
  import { ReadMode, NgxFileHelpersModule } from 'ngx-file-helpers';
44
44
  import { MatSelectHarness } from '@angular/material/select/testing';
45
45
  import { toSvg } from 'jdenticon';
46
- import * as i1$3 from '@ngx-formly/core/json-schema';
47
- import * as i1$4 from '@ngx-formly/core';
48
- import { FieldType, FieldArrayType, FieldWrapper, FormlyModule } from '@ngx-formly/core';
46
+ import * as i1$3 from '@ngx-formly/core';
47
+ import { ɵhasKey, ɵgetFieldValue, ɵreverseDeepMerge, ɵclone, FieldType, FieldArrayType, FieldWrapper, FormlyModule } from '@ngx-formly/core';
49
48
  import { FormlyMaterialModule } from '@ngx-formly/material';
50
49
 
51
50
  /*
@@ -324,7 +323,7 @@ class GioFormTagsInputComponent {
324
323
  }
325
324
  // From ControlValueAccessor interface
326
325
  get empty() {
327
- return isEmpty(this.value) && isEmpty(this._tagInput?.nativeElement?.value);
326
+ return isEmpty$1(this.value) && isEmpty$1(this._tagInput?.nativeElement?.value);
328
327
  }
329
328
  // From ControlValueAccessor interface
330
329
  get shouldLabelFloat() {
@@ -386,7 +385,7 @@ class GioFormTagsInputComponent {
386
385
  addChipToFormControl(event) {
387
386
  const input = this._tagInput?.nativeElement;
388
387
  const tagToAdd = (event.value ?? '').trim();
389
- if (isEmpty(tagToAdd)) {
388
+ if (isEmpty$1(tagToAdd)) {
390
389
  return;
391
390
  }
392
391
  // Add the tag only if shouldAddTag in validationCb return true
@@ -1170,7 +1169,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1170
1169
  }] } });
1171
1170
  const removeLastEmptyHeader = (headers) => {
1172
1171
  const lastHeader = headers[headers.length - 1];
1173
- if (lastHeader && isEmpty(lastHeader.key) && isEmpty(lastHeader.value)) {
1172
+ if (lastHeader && isEmpty$1(lastHeader.key) && isEmpty$1(lastHeader.value)) {
1174
1173
  return dropRight(headers);
1175
1174
  }
1176
1175
  return headers;
@@ -2778,75 +2777,607 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
2778
2777
  * See the License for the specific language governing permissions and
2779
2778
  * limitations under the License.
2780
2779
  */
2781
- class GioFormJsonSchemaComponent {
2782
- constructor(formlyJsonschema, elRef, fm, ngControl) {
2783
- this.formlyJsonschema = formlyJsonschema;
2784
- this.elRef = elRef;
2785
- this.fm = fm;
2786
- this.ngControl = ngControl;
2787
- this.unsubscribe$ = new Subject();
2788
- this.formGroup = new FormGroup({});
2789
- this.options = {};
2790
- this.model = {};
2791
- this.fields = [];
2792
- this._onChange = () => ({});
2793
- this._onTouched = () => ({});
2794
- this.touched = false;
2795
- if (ngControl) {
2796
- // Setting the value accessor directly (instead of using
2797
- // the providers `NG_VALUE_ACCESSOR`) to avoid running into a circular import.
2798
- ngControl.valueAccessor = this;
2780
+ // https://stackoverflow.com/a/27865285
2781
+ function decimalPlaces(a) {
2782
+ if (!isFinite(a)) {
2783
+ return 0;
2784
+ }
2785
+ let e = 1, p = 0;
2786
+ while (Math.round(a * e) / e !== a) {
2787
+ e *= 10;
2788
+ p++;
2789
+ }
2790
+ return p;
2791
+ }
2792
+ function isEmpty(v) {
2793
+ return v === '' || v == null;
2794
+ }
2795
+ function isObject(v) {
2796
+ return v != null && typeof v === 'object' && !Array.isArray(v);
2797
+ }
2798
+ function isInteger(value) {
2799
+ return Number.isInteger ? Number.isInteger(value) : typeof value === 'number' && Math.floor(value) === value;
2800
+ }
2801
+ function isConst(schema) {
2802
+ return typeof schema === 'object' && (schema.hasOwnProperty('const') || (schema.enum && schema.enum.length === 1));
2803
+ }
2804
+ function totalMatchedFields(field) {
2805
+ if (!field.fieldGroup) {
2806
+ return ɵhasKey(field) && ɵgetFieldValue(field) !== undefined ? 1 : 0;
2807
+ }
2808
+ const total = field.fieldGroup.reduce((s, f) => totalMatchedFields(f) + s, 0);
2809
+ if (total === 0 && ɵhasKey(field)) {
2810
+ const value = ɵgetFieldValue(field);
2811
+ if (value === null || (value !== undefined && ((field.fieldArray && Array.isArray(value)) || (!field.fieldArray && isObject(value))))) {
2812
+ return 1;
2799
2813
  }
2800
- // When the user interact with the form, mark it as touched
2801
- fm.monitor(elRef.nativeElement, true)
2802
- .pipe(takeUntil(this.unsubscribe$))
2803
- .subscribe(() => {
2804
- this._onTouched();
2805
- this.touched = true;
2814
+ }
2815
+ return total;
2816
+ }
2817
+ class GioJsonschema {
2818
+ toFieldConfig(schema, options) {
2819
+ return this._toFieldConfig(schema, { schema, ...(options || {}) });
2820
+ }
2821
+ _toFieldConfig(schema, { key, ...options }) {
2822
+ schema = this.resolveSchema(schema, options);
2823
+ const types = this.guessSchemaType(schema);
2824
+ let field = {
2825
+ type: types[0],
2826
+ defaultValue: schema.default,
2827
+ props: {
2828
+ label: schema.title,
2829
+ readonly: schema.readOnly,
2830
+ description: schema.description,
2831
+ },
2832
+ };
2833
+ if (key != null) {
2834
+ field.key = key;
2835
+ }
2836
+ if (!options.ignoreDefault && (schema.readOnly || options.readOnly)) {
2837
+ field.props.disabled = true;
2838
+ options = { ...options, readOnly: true };
2839
+ }
2840
+ if (options.resetOnHide) {
2841
+ field.resetOnHide = true;
2842
+ }
2843
+ if (key && options.strict) {
2844
+ this.addValidator(field, 'type', (c, f) => {
2845
+ const value = ɵgetFieldValue(f);
2846
+ if (value != null) {
2847
+ switch (field.type) {
2848
+ case 'string': {
2849
+ return typeof value === 'string';
2850
+ }
2851
+ case 'integer': {
2852
+ return isInteger(value);
2853
+ }
2854
+ case 'number': {
2855
+ return typeof value === 'number';
2856
+ }
2857
+ case 'object': {
2858
+ return isObject(value);
2859
+ }
2860
+ case 'array': {
2861
+ return Array.isArray(value);
2862
+ }
2863
+ }
2864
+ }
2865
+ return true;
2866
+ });
2867
+ }
2868
+ if (options.shareFormControl === false) {
2869
+ field.shareFormControl = false;
2870
+ }
2871
+ if (options.ignoreDefault) {
2872
+ delete field.defaultValue;
2873
+ }
2874
+ this.addValidator(field, 'type', {
2875
+ schemaType: types,
2876
+ expression: ({ value }) => {
2877
+ if (value === undefined) {
2878
+ return true;
2879
+ }
2880
+ if (value === null && types.indexOf('null') !== -1) {
2881
+ return true;
2882
+ }
2883
+ switch (types[0]) {
2884
+ case 'null': {
2885
+ return typeof value === null;
2886
+ }
2887
+ case 'string': {
2888
+ return typeof value === 'string';
2889
+ }
2890
+ case 'integer': {
2891
+ return isInteger(value);
2892
+ }
2893
+ case 'number': {
2894
+ return typeof value === 'number';
2895
+ }
2896
+ case 'object': {
2897
+ return isObject(value);
2898
+ }
2899
+ case 'array': {
2900
+ return Array.isArray(value);
2901
+ }
2902
+ }
2903
+ return true;
2904
+ },
2806
2905
  });
2906
+ switch (field.type) {
2907
+ case 'number':
2908
+ case 'integer': {
2909
+ field.parsers = [(v) => (isEmpty(v) ? undefined : Number(v))];
2910
+ if (schema.hasOwnProperty('minimum')) {
2911
+ field.props.min = schema.minimum;
2912
+ }
2913
+ if (schema.hasOwnProperty('maximum')) {
2914
+ field.props.max = schema.maximum;
2915
+ }
2916
+ if (schema.hasOwnProperty('exclusiveMinimum')) {
2917
+ field.props.exclusiveMinimum = schema.exclusiveMinimum;
2918
+ this.addValidator(field, 'exclusiveMinimum', ({ value }) => isEmpty(value) || value > schema.exclusiveMinimum);
2919
+ }
2920
+ if (schema.hasOwnProperty('exclusiveMaximum')) {
2921
+ field.props.exclusiveMaximum = schema.exclusiveMaximum;
2922
+ this.addValidator(field, 'exclusiveMaximum', ({ value }) => isEmpty(value) || value < schema.exclusiveMaximum);
2923
+ }
2924
+ if (schema.hasOwnProperty('multipleOf')) {
2925
+ field.props.step = schema.multipleOf;
2926
+ this.addValidator(field, 'multipleOf', ({ value }) => {
2927
+ if (isEmpty(value) || typeof value !== 'number' || value === 0 || schema.multipleOf <= 0) {
2928
+ return true;
2929
+ }
2930
+ // https://github.com/ajv-validator/ajv/issues/652#issue-283610859
2931
+ const multiplier = Math.pow(10, decimalPlaces(schema.multipleOf));
2932
+ return Math.round(value * multiplier) % Math.round(schema.multipleOf * multiplier) === 0;
2933
+ });
2934
+ }
2935
+ break;
2936
+ }
2937
+ case 'string': {
2938
+ field.parsers = [
2939
+ v => {
2940
+ if (types.indexOf('null') !== -1) {
2941
+ v = isEmpty(v) ? null : v;
2942
+ }
2943
+ else if (!field.props.required) {
2944
+ v = v === '' ? undefined : v;
2945
+ }
2946
+ return v;
2947
+ },
2948
+ ];
2949
+ ['minLength', 'maxLength', 'pattern'].forEach(prop => {
2950
+ if (schema.hasOwnProperty(prop)) {
2951
+ field.props[prop] = schema[prop];
2952
+ }
2953
+ });
2954
+ break;
2955
+ }
2956
+ case 'object': {
2957
+ if (!field.fieldGroup) {
2958
+ field.fieldGroup = [];
2959
+ }
2960
+ const { propDeps, schemaDeps } = this.resolveDependencies(schema);
2961
+ Object.keys(schema.properties || {}).forEach(property => {
2962
+ const isRequired = Array.isArray(schema.required) && schema.required.indexOf(property) !== -1;
2963
+ const f = this._toFieldConfig(schema.properties[property], {
2964
+ ...options,
2965
+ key: property,
2966
+ isOptional: options.isOptional || !isRequired,
2967
+ });
2968
+ field.fieldGroup.push(f);
2969
+ if (isRequired || propDeps[property]) {
2970
+ f.expressions = {
2971
+ ...(f.expressions || {}),
2972
+ 'props.required': f => {
2973
+ let parent = f.parent;
2974
+ const model = f.fieldGroup && f.key != null ? parent.model : f.model;
2975
+ while (parent.key == null && parent.parent) {
2976
+ parent = parent.parent;
2977
+ }
2978
+ const required = parent && parent.props ? parent.props.required : false;
2979
+ if (!model && !required) {
2980
+ return false;
2981
+ }
2982
+ if (Array.isArray(schema.required) && schema.required.indexOf(property) !== -1) {
2983
+ return true;
2984
+ }
2985
+ return propDeps[property] && f.model && propDeps[property].some(k => !isEmpty(f.model[k]));
2986
+ },
2987
+ };
2988
+ }
2989
+ if (schemaDeps[property]) {
2990
+ const getConstValue = (s) => {
2991
+ return s.hasOwnProperty('const') ? s.const : s.enum[0];
2992
+ };
2993
+ const oneOfSchema = schemaDeps[property].oneOf;
2994
+ if (oneOfSchema && oneOfSchema.every(o => o.properties && o.properties[property] && isConst(o.properties[property]))) {
2995
+ oneOfSchema.forEach(oneOfSchemaItem => {
2996
+ const { [property]: constSchema, ...properties } = oneOfSchemaItem.properties;
2997
+ field.fieldGroup.push({
2998
+ ...this._toFieldConfig({ ...oneOfSchemaItem, properties }, { ...options, resetOnHide: true }),
2999
+ expressions: {
3000
+ hide: f => !f.model || getConstValue(constSchema) !== f.model[property],
3001
+ },
3002
+ });
3003
+ });
3004
+ }
3005
+ else {
3006
+ field.fieldGroup.push({
3007
+ ...this._toFieldConfig(schemaDeps[property], options),
3008
+ expressions: {
3009
+ hide: f => !f.model || isEmpty(f.model[property]),
3010
+ },
3011
+ });
3012
+ }
3013
+ }
3014
+ });
3015
+ console.log('schema', cloneDeep(schema));
3016
+ if (schema.oneOf) {
3017
+ console.log(cloneDeep(field.fieldGroup));
3018
+ field.fieldGroup.push(this.resolveMultiSchema('oneOf', schema.oneOf, { ...options, shareFormControl: false }));
3019
+ }
3020
+ if (schema.anyOf) {
3021
+ field.fieldGroup.push(this.resolveMultiSchema('anyOf', schema.anyOf, options));
3022
+ }
3023
+ break;
3024
+ }
3025
+ case 'array': {
3026
+ if (schema.hasOwnProperty('minItems')) {
3027
+ field.props.minItems = schema.minItems;
3028
+ this.addValidator(field, 'minItems', (c, f) => {
3029
+ const value = ɵgetFieldValue(f);
3030
+ return isEmpty(value) || value.length >= schema.minItems;
3031
+ });
3032
+ if (!options.isOptional && schema.minItems > 0 && field.defaultValue === undefined) {
3033
+ field.defaultValue = Array.from(new Array(schema.minItems));
3034
+ }
3035
+ }
3036
+ if (schema.hasOwnProperty('maxItems')) {
3037
+ field.props.maxItems = schema.maxItems;
3038
+ this.addValidator(field, 'maxItems', (c, f) => {
3039
+ const value = ɵgetFieldValue(f);
3040
+ return isEmpty(value) || value.length <= schema.maxItems;
3041
+ });
3042
+ }
3043
+ if (schema.hasOwnProperty('uniqueItems')) {
3044
+ field.props.uniqueItems = schema.uniqueItems;
3045
+ this.addValidator(field, 'uniqueItems', (c, f) => {
3046
+ const value = ɵgetFieldValue(f);
3047
+ if (isEmpty(value) || !schema.uniqueItems) {
3048
+ return true;
3049
+ }
3050
+ const uniqueItems = Array.from(new Set(value.map((v) => JSON.stringify(v))));
3051
+ return uniqueItems.length === value.length;
3052
+ });
3053
+ }
3054
+ // resolve items schema needed for isEnum check
3055
+ if (schema.items && !Array.isArray(schema.items)) {
3056
+ schema.items = this.resolveSchema(schema.items, options);
3057
+ }
3058
+ // TODO: remove isEnum check once adding an option to skip extension
3059
+ if (!this.isEnum(schema)) {
3060
+ field.fieldArray = (root) => {
3061
+ if (!Array.isArray(schema.items)) {
3062
+ // When items is a single schema, the additionalItems keyword is meaningless, and it should not be used.
3063
+ const f = schema.items ? this._toFieldConfig(schema.items, options) : {};
3064
+ if (f.props) {
3065
+ f.props.required = true;
3066
+ }
3067
+ return f;
3068
+ }
3069
+ const length = root.fieldGroup ? root.fieldGroup.length : 0;
3070
+ const itemSchema = schema.items[length] ? schema.items[length] : schema.additionalItems;
3071
+ const f = itemSchema ? this._toFieldConfig(itemSchema, options) : {};
3072
+ if (f.props) {
3073
+ f.props.required = true;
3074
+ }
3075
+ if (schema.items[length]) {
3076
+ f.props.removable = false;
3077
+ }
3078
+ return f;
3079
+ };
3080
+ }
3081
+ break;
3082
+ }
3083
+ }
3084
+ if (schema.hasOwnProperty('const')) {
3085
+ field.props.const = schema.const;
3086
+ this.addValidator(field, 'const', ({ value }) => value === schema.const);
3087
+ if (!field.type) {
3088
+ field.defaultValue = schema.const;
3089
+ }
3090
+ }
3091
+ if (this.isEnum(schema)) {
3092
+ field.props.multiple = field.type === 'array';
3093
+ field.type = 'enum';
3094
+ field.props.options = this.toEnumOptions(schema);
3095
+ }
3096
+ if (schema.oneOf && !field.type) {
3097
+ delete field.key;
3098
+ field.fieldGroup = [this.resolveMultiSchema('oneOf', schema.oneOf, { ...options, key, shareFormControl: false })];
3099
+ }
3100
+ // map in possible formlyConfig options from the widget property
3101
+ if (schema.widget?.formlyConfig) {
3102
+ field = this.mergeFields(field, schema.widget.formlyConfig);
3103
+ }
3104
+ field.templateOptions = field.props;
3105
+ // if there is a map function passed in, use it to allow the user to
3106
+ // further customize how fields are being mapped
3107
+ return options.map ? options.map(field, schema) : field;
3108
+ }
3109
+ resolveSchema(schema, options) {
3110
+ if (schema && schema.$ref) {
3111
+ console.log('resolveSchema', { schema });
3112
+ schema = this.resolveDefinition(schema, options);
3113
+ console.log('resolved', { schema });
3114
+ }
3115
+ if (schema && schema.allOf) {
3116
+ console.log('noopo');
3117
+ schema = this.resolveAllOf(schema, options);
3118
+ }
3119
+ return schema;
2807
3120
  }
2808
- set jsonSchema(jsonSchema) {
2809
- if (isObject(jsonSchema)) {
2810
- this.fields = [this.toFormlyFieldConfig(jsonSchema)];
3121
+ resolveAllOf({ allOf, ...baseSchema }, options) {
3122
+ console.log('resolveAllOf', { allOf });
3123
+ if (!allOf.length) {
3124
+ throw Error(`allOf array can not be empty ${allOf}.`);
2811
3125
  }
3126
+ return allOf.reduce((base, schema) => {
3127
+ schema = this.resolveSchema(schema, options);
3128
+ console.log('resolveAllOf > resolveSchema', { schema });
3129
+ if (base.required && schema.required) {
3130
+ base.required = [...base.required, ...schema.required];
3131
+ }
3132
+ if (schema.uniqueItems) {
3133
+ base.uniqueItems = schema.uniqueItems;
3134
+ }
3135
+ // resolve to min value
3136
+ ['maxLength', 'maximum', 'exclusiveMaximum', 'maxItems', 'maxProperties'].forEach(prop => {
3137
+ if (!isEmpty(base[prop]) && !isEmpty(schema[prop])) {
3138
+ base[prop] = base[prop] < schema[prop] ? base[prop] : schema[prop];
3139
+ }
3140
+ });
3141
+ // resolve to max value
3142
+ ['minLength', 'minimum', 'exclusiveMinimum', 'minItems', 'minProperties'].forEach(prop => {
3143
+ if (!isEmpty(base[prop]) && !isEmpty(schema[prop])) {
3144
+ base[prop] = base[prop] > schema[prop] ? base[prop] : schema[prop];
3145
+ }
3146
+ });
3147
+ return ɵreverseDeepMerge(base, schema);
3148
+ }, baseSchema);
2812
3149
  }
2813
- ngOnInit() {
2814
- this.formGroup.statusChanges.pipe(takeUntil(this.unsubscribe$)).subscribe(status => {
2815
- if (status === 'VALID') {
2816
- this.ngControl?.control?.setErrors(null);
3150
+ resolveMultiSchema(mode, schemas, options) {
3151
+ console.log('resolveMultiSchema', { mode, schemas, options });
3152
+ return {
3153
+ type: 'multischema',
3154
+ fieldGroup: [
3155
+ {
3156
+ type: 'enum',
3157
+ defaultValue: -1,
3158
+ props: {
3159
+ multiple: mode === 'anyOf',
3160
+ options: schemas.map((s, i) => ({ label: s.title, value: i, disabled: s.readOnly })),
3161
+ },
3162
+ hooks: {
3163
+ onInit: f => f.formControl.valueChanges.pipe(tap(() => f.options.detectChanges(f.parent))),
3164
+ },
3165
+ },
3166
+ {
3167
+ fieldGroup: schemas.map((s, i) => ({
3168
+ ...this._toFieldConfig(s, { ...options, resetOnHide: true }),
3169
+ expressions: {
3170
+ hide: (f, forceUpdate) => {
3171
+ const control = f.parent.parent.fieldGroup[0].formControl;
3172
+ if (control.value === -1 || forceUpdate) {
3173
+ let value = f.parent.fieldGroup
3174
+ .map((f, i) => [f, i, this.isFieldValid(f, i, schemas, options)])
3175
+ .sort(([f1, , f1Valid], [f2, , f2Valid]) => {
3176
+ if (f1Valid !== f2Valid) {
3177
+ return f2Valid ? 1 : -1;
3178
+ }
3179
+ const matchedFields1 = totalMatchedFields(f1);
3180
+ const matchedFields2 = totalMatchedFields(f2);
3181
+ if (matchedFields1 === matchedFields2) {
3182
+ if (f1.props.disabled === f2.props.disabled) {
3183
+ return 0;
3184
+ }
3185
+ return matchedFields2 > matchedFields1 ? 1 : -1;
3186
+ }
3187
+ return matchedFields2 > matchedFields1 ? 1 : -1;
3188
+ })
3189
+ .map(([, i]) => i);
3190
+ if (mode === 'anyOf') {
3191
+ const definedValue = value.filter(i => totalMatchedFields(f.parent.fieldGroup[i]));
3192
+ value = definedValue.length > 0 ? definedValue : [value[0] || 0];
3193
+ }
3194
+ value = value.length > 0 ? value : [0];
3195
+ control.setValue(mode === 'anyOf' ? value : value[0]);
3196
+ }
3197
+ return Array.isArray(control.value) ? control.value.indexOf(i) === -1 : control.value !== i;
3198
+ },
3199
+ },
3200
+ })),
3201
+ },
3202
+ ],
3203
+ };
3204
+ }
3205
+ resolveDefinition(schema, options) {
3206
+ const [uri, pointer] = schema.$ref.split('#/');
3207
+ if (uri) {
3208
+ throw Error(`Remote schemas for ${schema.$ref} not supported yet.`);
3209
+ }
3210
+ const definition = !pointer
3211
+ ? null
3212
+ : pointer.split('/').reduce((def, path) => (def?.hasOwnProperty(path) ? def[path] : null), options.schema);
3213
+ if (!definition) {
3214
+ throw Error(`Cannot find a definition for ${schema.$ref}.`);
3215
+ }
3216
+ if (definition.$ref) {
3217
+ return this.resolveDefinition(definition, options);
3218
+ }
3219
+ console.log({ definition, schema });
3220
+ return {
3221
+ ...definition,
3222
+ ...(schema.properties ? { properties: { ...schema.properties, ...definition.properties } } : {}),
3223
+ ...['title', 'description', 'default', 'widget'].reduce((annotation, p) => {
3224
+ if (schema.hasOwnProperty(p)) {
3225
+ annotation[p] = schema[p];
3226
+ }
3227
+ return annotation;
3228
+ }, {}),
3229
+ };
3230
+ }
3231
+ resolveDependencies(schema) {
3232
+ const propDeps = {};
3233
+ const schemaDeps = {};
3234
+ Object.keys(schema.dependencies || {}).forEach(prop => {
3235
+ const dependency = schema.dependencies[prop];
3236
+ if (Array.isArray(dependency)) {
3237
+ // Property dependencies
3238
+ dependency.forEach(dep => {
3239
+ if (!propDeps[dep]) {
3240
+ propDeps[dep] = [prop];
3241
+ }
3242
+ else {
3243
+ propDeps[dep].push(prop);
3244
+ }
3245
+ });
2817
3246
  }
2818
- if (status === 'INVALID') {
2819
- this.ngControl?.control?.setErrors({ invalid: true });
3247
+ else {
3248
+ // schema dependencies
3249
+ schemaDeps[prop] = dependency;
2820
3250
  }
2821
3251
  });
2822
- // To simulate the behavior of classic form controls, emit value only when the form is touched
2823
- // Allow to keep the formControl pristine until the user interact with it
2824
- this.formGroup.valueChanges
2825
- .pipe(takeUntil(this.unsubscribe$), filter(() => this.touched))
2826
- .subscribe(value => {
2827
- this._onChange(value);
2828
- });
3252
+ return { propDeps, schemaDeps };
2829
3253
  }
2830
- ngOnDestroy() {
2831
- this.unsubscribe$.next();
2832
- this.unsubscribe$.unsubscribe();
2833
- this.fm.stopMonitoring(this.elRef.nativeElement);
3254
+ guessSchemaType(schema) {
3255
+ const type = schema?.type;
3256
+ if (!type && schema?.properties) {
3257
+ return ['object'];
3258
+ }
3259
+ if (Array.isArray(type)) {
3260
+ if (type.length === 1) {
3261
+ return type;
3262
+ }
3263
+ if (type.length === 2 && type.indexOf('null') !== -1) {
3264
+ return type.sort(t1 => (t1 == 'null' ? 1 : -1));
3265
+ }
3266
+ return type;
3267
+ }
3268
+ return type ? [type] : [];
2834
3269
  }
2835
- // From ControlValueAccessor
2836
- writeValue(value) {
2837
- this.model = cloneDeep(value) ?? {};
3270
+ addValidator(field, name, validator) {
3271
+ field.validators = field.validators || {};
3272
+ field.validators[name] = validator;
2838
3273
  }
2839
- // From ControlValueAccessor
2840
- registerOnChange(fn) {
2841
- this._onChange = fn;
3274
+ isEnum(schema) {
3275
+ return (!!schema.enum ||
3276
+ (schema.anyOf && schema.anyOf.every(isConst)) ||
3277
+ (schema.oneOf && schema.oneOf.every(isConst)) ||
3278
+ (schema.uniqueItems && schema.items && !Array.isArray(schema.items) && this.isEnum(schema.items)));
2842
3279
  }
2843
- // From ControlValueAccessor
2844
- registerOnTouched(fn) {
2845
- this._onTouched = fn;
3280
+ toEnumOptions(schema) {
3281
+ if (schema.enum) {
3282
+ return schema.enum.map(value => ({ value, label: value }));
3283
+ }
3284
+ const toEnum = (s) => {
3285
+ const value = s.hasOwnProperty('const') ? s.const : s.enum[0];
3286
+ const option = { value, label: s.title || value };
3287
+ if (s.readOnly) {
3288
+ option.disabled = true;
3289
+ }
3290
+ return option;
3291
+ };
3292
+ if (schema.anyOf) {
3293
+ return schema.anyOf.map(toEnum);
3294
+ }
3295
+ if (schema.oneOf) {
3296
+ return schema.oneOf.map(toEnum);
3297
+ }
3298
+ return this.toEnumOptions(schema.items);
2846
3299
  }
2847
- // From ControlValueAccessor
2848
- setDisabledState(_isDisabled) {
2849
- throw new Error('Method not implemented.');
3300
+ isFieldValid(root, i, schemas, options) {
3301
+ if (!root._schemasFields) {
3302
+ Object.defineProperty(root, '_schemasFields', { enumerable: false, writable: true, configurable: true });
3303
+ root._schemasFields = {};
3304
+ }
3305
+ let field = root._schemasFields[i];
3306
+ const model = root.model ? ɵclone(root.model) : root.fieldArray ? [] : {};
3307
+ if (!field) {
3308
+ field = root._schemasFields[i] = root.options.build({
3309
+ form: Array.isArray(model) ? new FormArray([]) : new FormGroup({}),
3310
+ fieldGroup: [
3311
+ this._toFieldConfig(schemas[i], {
3312
+ ...options,
3313
+ resetOnHide: true,
3314
+ ignoreDefault: true,
3315
+ map: null,
3316
+ strict: true,
3317
+ }),
3318
+ ],
3319
+ model,
3320
+ options: {},
3321
+ });
3322
+ }
3323
+ else {
3324
+ field.model = model;
3325
+ root.options.build(field);
3326
+ }
3327
+ return field.form.valid;
3328
+ }
3329
+ mergeFields(f1, f2) {
3330
+ for (let prop in f2) {
3331
+ const f1Prop = prop === 'templateOptions' ? 'props' : prop;
3332
+ if (isObject(f1[f1Prop]) && isObject(f2[prop])) {
3333
+ f1[f1Prop] = this.mergeFields(f1[f1Prop], f2[prop]);
3334
+ }
3335
+ else if (f2[prop] != null) {
3336
+ f1[f1Prop] = f2[prop];
3337
+ }
3338
+ }
3339
+ return f1;
3340
+ }
3341
+ }
3342
+ GioJsonschema.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioJsonschema, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3343
+ GioJsonschema.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioJsonschema, providedIn: 'root' });
3344
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioJsonschema, decorators: [{
3345
+ type: Injectable,
3346
+ args: [{ providedIn: 'root' }]
3347
+ }] });
3348
+
3349
+ /*
3350
+ * Copyright (C) 2023 The Gravitee team (http://gravitee.io)
3351
+ *
3352
+ * Licensed under the Apache License, Version 2.0 (the "License");
3353
+ * you may not use this file except in compliance with the License.
3354
+ * You may obtain a copy of the License at
3355
+ *
3356
+ * http://www.apache.org/licenses/LICENSE-2.0
3357
+ *
3358
+ * Unless required by applicable law or agreed to in writing, software
3359
+ * distributed under the License is distributed on an "AS IS" BASIS,
3360
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3361
+ * See the License for the specific language governing permissions and
3362
+ * limitations under the License.
3363
+ */
3364
+ class GioFormJsonSchemaComponent {
3365
+ constructor(formlyJsonschema) {
3366
+ this.formlyJsonschema = formlyJsonschema;
3367
+ this.formGroup = new FormGroup({});
3368
+ this.options = {};
3369
+ this.model = {};
3370
+ this.fields = [];
3371
+ }
3372
+ set jsonSchema(jsonSchema) {
3373
+ if (isObject$1(jsonSchema)) {
3374
+ this.fields = [this.toFormlyFieldConfig(jsonSchema)];
3375
+ }
3376
+ }
3377
+ set initialValue(initialValue) {
3378
+ if (initialValue) {
3379
+ this.model = cloneDeep(initialValue);
3380
+ }
2850
3381
  }
2851
3382
  toFormlyFieldConfig(jsonSchema) {
2852
3383
  return this.formlyJsonschema.toFieldConfig(jsonSchema, {
@@ -2868,23 +3399,22 @@ class GioFormJsonSchemaComponent {
2868
3399
  };
2869
3400
  }
2870
3401
  }
2871
- GioFormJsonSchemaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, deps: [{ token: i1$3.FormlyJsonschema }, { token: i0.ElementRef }, { token: i2$2.FocusMonitor }, { token: i7.NgControl, host: true, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2872
- GioFormJsonSchemaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormJsonSchemaComponent, selector: "gio-form-json-schema", inputs: { jsonSchema: "jsonSchema", options: "options" }, ngImport: i0, template: `<formly-form *ngIf="formGroup" [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`, isInline: true, components: [{ type: i1$4.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }], directives: [{ type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
3402
+ GioFormJsonSchemaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, deps: [{ token: GioJsonschema }], target: i0.ɵɵFactoryTarget.Component });
3403
+ GioFormJsonSchemaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFormJsonSchemaComponent, selector: "gio-form-json-schema", inputs: { jsonSchema: "jsonSchema", formGroup: "formGroup", options: "options", initialValue: "initialValue" }, ngImport: i0, template: `<formly-form [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`, isInline: true, components: [{ type: i1$3.FormlyForm, selector: "formly-form", inputs: ["form", "model", "fields", "options"], outputs: ["modelChange"] }] });
2873
3404
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaComponent, decorators: [{
2874
3405
  type: Component,
2875
3406
  args: [{
2876
3407
  selector: 'gio-form-json-schema',
2877
- template: `<formly-form *ngIf="formGroup" [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`,
2878
- changeDetection: ChangeDetectionStrategy.OnPush,
3408
+ template: `<formly-form [fields]="fields" [options]="options" [form]="formGroup" [model]="model"></formly-form>`,
2879
3409
  }]
2880
- }], ctorParameters: function () { return [{ type: i1$3.FormlyJsonschema }, { type: i0.ElementRef }, { type: i2$2.FocusMonitor }, { type: i7.NgControl, decorators: [{
2881
- type: Host
2882
- }, {
2883
- type: Optional
2884
- }] }]; }, propDecorators: { jsonSchema: [{
3410
+ }], ctorParameters: function () { return [{ type: GioJsonschema }]; }, propDecorators: { jsonSchema: [{
3411
+ type: Input
3412
+ }], formGroup: [{
2885
3413
  type: Input
2886
3414
  }], options: [{
2887
3415
  type: Input
3416
+ }], initialValue: [{
3417
+ type: Input
2888
3418
  }] } });
2889
3419
 
2890
3420
  /*
@@ -2939,30 +3469,27 @@ class GioFjsObjectTypeComponent extends FieldType {
2939
3469
  }
2940
3470
  GioFjsObjectTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsObjectTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2941
3471
  GioFjsObjectTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsObjectTypeComponent, selector: "gio-fjs-object-type", usesInheritance: true, ngImport: i0, template: `
2942
- <div>
2943
- <legend *ngIf="to.label">{{ to.label }}</legend>
3472
+ <div class="wrapper">
3473
+ <h4 *ngIf="to.label">{{ to.label }}</h4>
2944
3474
  <p *ngIf="to.description">{{ to.description }}</p>
2945
3475
  <div class="alert alert-danger" role="alert" *ngIf="showError && formControl.errors">
2946
3476
  <formly-validation-message [field]="field"></formly-validation-message>
2947
3477
  </div>
2948
3478
  <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
2949
3479
  </div>
2950
- `, isInline: true, 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"] }] });
3480
+ `, isInline: true, styles: [".wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px;display:flex;flex-direction:column}.wrapper:empty{display:none}.wrapper formly-field+formly-field{margin-top:8px}\n"], components: [{ type: i1$3.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { type: i1$3.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"] }] });
2951
3481
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsObjectTypeComponent, decorators: [{
2952
3482
  type: Component,
2953
- args: [{
2954
- selector: 'gio-fjs-object-type',
2955
- template: `
2956
- <div>
2957
- <legend *ngIf="to.label">{{ to.label }}</legend>
3483
+ args: [{ selector: 'gio-fjs-object-type', template: `
3484
+ <div class="wrapper">
3485
+ <h4 *ngIf="to.label">{{ to.label }}</h4>
2958
3486
  <p *ngIf="to.description">{{ to.description }}</p>
2959
3487
  <div class="alert alert-danger" role="alert" *ngIf="showError && formControl.errors">
2960
3488
  <formly-validation-message [field]="field"></formly-validation-message>
2961
3489
  </div>
2962
3490
  <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
2963
3491
  </div>
2964
- `,
2965
- }]
3492
+ `, styles: [".wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px;display:flex;flex-direction:column}.wrapper:empty{display:none}.wrapper formly-field+formly-field{margin-top:8px}\n"] }]
2966
3493
  }] });
2967
3494
 
2968
3495
  /*
@@ -2984,8 +3511,8 @@ class GioFjsArrayTypeComponent extends FieldArrayType {
2984
3511
  }
2985
3512
  GioFjsArrayTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsArrayTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2986
3513
  GioFjsArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsArrayTypeComponent, selector: "gio-fjs-array-type", usesInheritance: true, ngImport: i0, template: `
2987
- <div>
2988
- <legend *ngIf="to.label">{{ to.label }}</legend>
3514
+ <div class="wrapper">
3515
+ <h4 *ngIf="to.label">{{ to.label }}</h4>
2989
3516
  <p *ngIf="to.description">{{ to.description }}</p>
2990
3517
 
2991
3518
  <div class="alert alert-danger" role="alert" *ngIf="showError && formControl.errors">
@@ -3003,14 +3530,12 @@ GioFjsArrayTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0
3003
3530
  <button class="btn btn-primary" type="button" (click)="add()">+</button>
3004
3531
  </div>
3005
3532
  </div>
3006
- `, isInline: true, 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"] }] });
3533
+ `, isInline: true, styles: [".wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper:empty{display:none}.wrapper formly-field+formly-field{margin-top:8px;display:block}\n"], components: [{ type: i1$3.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { type: i1$3.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"] }] });
3007
3534
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsArrayTypeComponent, decorators: [{
3008
3535
  type: Component,
3009
- args: [{
3010
- selector: 'gio-fjs-array-type',
3011
- template: `
3012
- <div>
3013
- <legend *ngIf="to.label">{{ to.label }}</legend>
3536
+ args: [{ selector: 'gio-fjs-array-type', template: `
3537
+ <div class="wrapper">
3538
+ <h4 *ngIf="to.label">{{ to.label }}</h4>
3014
3539
  <p *ngIf="to.description">{{ to.description }}</p>
3015
3540
 
3016
3541
  <div class="alert alert-danger" role="alert" *ngIf="showError && formControl.errors">
@@ -3028,8 +3553,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3028
3553
  <button class="btn btn-primary" type="button" (click)="add()">+</button>
3029
3554
  </div>
3030
3555
  </div>
3031
- `,
3032
- }]
3556
+ `, styles: [".wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper:empty{display:none}.wrapper formly-field+formly-field{margin-top:8px;display:block}\n"] }]
3033
3557
  }] });
3034
3558
 
3035
3559
  function minItemsValidationMessage(error, field) {
@@ -3116,37 +3640,33 @@ function bannerExtension(field) {
3116
3640
  * limitations under the License.
3117
3641
  */
3118
3642
  class GioFjsMultiSchemaTypeComponent extends FieldType {
3643
+ ngOnInit() {
3644
+ set(this.field, 'fieldGroup[0].props.appearance', 'fill');
3645
+ }
3119
3646
  }
3120
3647
  GioFjsMultiSchemaTypeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsMultiSchemaTypeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
3121
3648
  GioFjsMultiSchemaTypeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: GioFjsMultiSchemaTypeComponent, selector: "gio-fjs-multi-schema-type", usesInheritance: true, ngImport: i0, template: `
3122
- <div class="card mb-3">
3123
- <div class="card-body">
3124
- <legend *ngIf="props.label">{{ props.label }}</legend>
3125
- <p *ngIf="props.description">{{ props.description }}</p>
3126
- <div class="alert alert-danger" role="alert" *ngIf="showError && formControl.errors">
3127
- <formly-validation-message [field]="field"></formly-validation-message>
3128
- </div>
3129
- <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
3649
+ <div class="wrapper">
3650
+ <h5 *ngIf="props.label">{{ props.label }}</h5>
3651
+ <p *ngIf="props.description">{{ props.description }}</p>
3652
+ <div role="alert" *ngIf="showError && formControl.errors">
3653
+ <formly-validation-message [field]="field"></formly-validation-message>
3130
3654
  </div>
3655
+ <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
3131
3656
  </div>
3132
- `, isInline: true, 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"] }] });
3657
+ `, isInline: true, styles: ["::ng-deep gio-fjs-multi-schema-type .wrapper formly-field:first-child mat-form-field{padding-bottom:0}.wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper:empty{display:none}\n"], components: [{ type: i1$3.ɵFormlyValidationMessage, selector: "formly-validation-message", inputs: ["field"] }, { type: i1$3.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"] }] });
3133
3658
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFjsMultiSchemaTypeComponent, decorators: [{
3134
3659
  type: Component,
3135
- args: [{
3136
- selector: 'gio-fjs-multi-schema-type',
3137
- template: `
3138
- <div class="card mb-3">
3139
- <div class="card-body">
3140
- <legend *ngIf="props.label">{{ props.label }}</legend>
3141
- <p *ngIf="props.description">{{ props.description }}</p>
3142
- <div class="alert alert-danger" role="alert" *ngIf="showError && formControl.errors">
3143
- <formly-validation-message [field]="field"></formly-validation-message>
3144
- </div>
3145
- <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
3660
+ args: [{ selector: 'gio-fjs-multi-schema-type', template: `
3661
+ <div class="wrapper">
3662
+ <h5 *ngIf="props.label">{{ props.label }}</h5>
3663
+ <p *ngIf="props.description">{{ props.description }}</p>
3664
+ <div role="alert" *ngIf="showError && formControl.errors">
3665
+ <formly-validation-message [field]="field"></formly-validation-message>
3146
3666
  </div>
3667
+ <formly-field *ngFor="let f of field.fieldGroup" [field]="f"></formly-field>
3147
3668
  </div>
3148
- `,
3149
- }]
3669
+ `, styles: ["::ng-deep gio-fjs-multi-schema-type .wrapper formly-field:first-child mat-form-field{padding-bottom:0}.wrapper{padding:8px;border:1px solid #d3d5dc;border-radius:8px}.wrapper:empty{display:none}\n"] }]
3150
3670
  }] });
3151
3671
 
3152
3672
  /*
@@ -3173,12 +3693,10 @@ GioFormJsonSchemaModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0",
3173
3693
  GioFjsMultiSchemaTypeComponent,
3174
3694
  GioFjsArrayTypeComponent,
3175
3695
  GioFormFieldWrapperComponent], imports: [CommonModule,
3176
- A11yModule,
3177
- ReactiveFormsModule, i1$4.FormlyModule, FormlyMaterialModule,
3696
+ ReactiveFormsModule, i1$3.FormlyModule, FormlyMaterialModule,
3178
3697
  GioIconsModule], exports: [GioFormJsonSchemaComponent, FormlyModule] });
3179
3698
  GioFormJsonSchemaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: GioFormJsonSchemaModule, imports: [[
3180
3699
  CommonModule,
3181
- A11yModule,
3182
3700
  ReactiveFormsModule,
3183
3701
  FormlyModule.forRoot({
3184
3702
  validationMessages: [
@@ -3204,9 +3722,6 @@ GioFormJsonSchemaModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
3204
3722
  { name: 'multischema', component: GioFjsMultiSchemaTypeComponent },
3205
3723
  ],
3206
3724
  extensions: [{ name: 'banner', extension: { onPopulate: bannerExtension } }],
3207
- extras: {
3208
- checkExpressionOn: 'changeDetectionCheck',
3209
- },
3210
3725
  }),
3211
3726
  FormlyMaterialModule,
3212
3727
  GioIconsModule,
@@ -3224,7 +3739,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3224
3739
  ],
3225
3740
  imports: [
3226
3741
  CommonModule,
3227
- A11yModule,
3228
3742
  ReactiveFormsModule,
3229
3743
  FormlyModule.forRoot({
3230
3744
  validationMessages: [
@@ -3250,9 +3764,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3250
3764
  { name: 'multischema', component: GioFjsMultiSchemaTypeComponent },
3251
3765
  ],
3252
3766
  extensions: [{ name: 'banner', extension: { onPopulate: bannerExtension } }],
3253
- extras: {
3254
- checkExpressionOn: 'changeDetectionCheck',
3255
- },
3256
3767
  }),
3257
3768
  FormlyMaterialModule,
3258
3769
  GioIconsModule,