From 174e57f62b74428e2983438bd7edc02d4820fc0e Mon Sep 17 00:00:00 2001 From: Diamantis Tziotzios Date: Thu, 8 Feb 2024 19:48:14 +0200 Subject: [PATCH] more description editor changes --- .../editor/description-editor.component.ts | 15 +- .../editor/description-editor.model.ts | 2 +- .../form-field/form-field.component.html | 252 +++++------------- .../form-field/form-field.component.ts | 1 + .../description-form.module.ts | 4 +- .../reference-field.component.html | 3 +- .../reference-field.component.ts | 3 + 7 files changed, 88 insertions(+), 192 deletions(-) diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts b/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts index 12fe1f764..031931313 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.component.ts @@ -555,7 +555,7 @@ export class DescriptionEditorComponent extends BaseEditor void): void { diff --git a/dmp-frontend/src/app/ui/description/editor/description-editor.model.ts b/dmp-frontend/src/app/ui/description/editor/description-editor.model.ts index 4c97f140a..94a95087b 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-editor.model.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-editor.model.ts @@ -312,7 +312,7 @@ export class DescriptionPropertyDefinitionFieldSetItemEditorModel implements Des if (item) { this.comment = item.comment; this.ordinal = item.ordinal; - if (item.fields) { item.fields?.forEach((value, key) => this.fields.set(key, new DescriptionFieldEditorModel(this.validationErrorModel).fromModel(value, definitionFieldSet?.fields?.find(x => x.id == key), descriptionReferences))); } + if (item.fields) { Object.keys(item.fields)?.forEach(key => this.fields.set(key, new DescriptionFieldEditorModel(this.validationErrorModel).fromModel(item.fields[key], definitionFieldSet?.fields?.find(x => x.id == key), descriptionReferences))); } } return this; } diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html index 8c1d20051..c29c404f9 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.html @@ -116,7 +116,7 @@
{{field.data.label}} - {{propertiesFormGroup?.get(field.id).get('textValue').getError('backendError').message}} + {{propertiesFormGroup?.get(field.id).get('textValue').getError('backendError').message}}
@@ -187,164 +187,94 @@
-
- - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} - -
+ + + + + +
-
-
- - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} - -
+ + + + + +
-
- - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} - -
+ + + + + +
-
- - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - \ - {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} - -
+ + + + + +
-
-
- - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} - -
+ + + + + +
-
-
- - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} - -
+ + + + + +
-
-
- - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} - -
+ + + + + +
-
-
- - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} - -
+ + + + + +
-
-
- - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} - -
+ + + + + +
+
+ + + + + + +
+
+ + + + + + +
+
@@ -355,44 +285,6 @@
-
-
- - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} - -
-
- -
-
- - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - - {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - {{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.EXTERNAL-SOURCE-HINT" | translate }} - -
-
-
diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts index 8c97dbdb9..d4213b3fa 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-field/form-field.component.ts @@ -35,6 +35,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn @Input() propertiesFormGroup: UntypedFormGroup; @Input() visibilityRulesService: VisibilityRulesService; isRequired: boolean = false; + referenceTypeEnum = ReferenceType; // @Input() field: Field; diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.module.ts b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.module.ts index ea7aa38d2..bab54aee1 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/description-form.module.ts +++ b/dmp-frontend/src/app/ui/description/editor/description-form/description-form.module.ts @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core'; import { FormattingModule } from "@app/core/formatting.module"; import { AutoCompleteModule } from '@app/library/auto-complete/auto-complete.module'; import { RichTextEditorModule } from "@app/library/rich-text-editor/rich-text-editor.module"; +import { ReferenceFieldModule } from '@app/ui/reference/reference-field/reference-field.module'; import { CommonFormsModule } from '@common/forms/common-forms.module'; import { CommonUiModule } from '@common/ui/common-ui.module'; import { NgxDropzoneModule } from "ngx-dropzone"; @@ -20,7 +21,8 @@ import { DescriptionFormComponent } from './description-form.component'; AutoCompleteModule, RichTextEditorModule, NgxDropzoneModule, - FormattingModule + FormattingModule, + ReferenceFieldModule ], declarations: [ DescriptionFormComponent, diff --git a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html index 6f85c7994..291258b89 100644 --- a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html +++ b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.html @@ -1,9 +1,10 @@ {{label ?? enumUtils.toReferenceTypeString(referenceType)}} - + {{form.getError('backendError').message}} {{'GENERAL.VALIDATION.REQUIRED' | translate}} + {{hint}}
{{'REFERENCE-FIELD.COULD-NOT-FIND-MESSAGE' | translate}} diff --git a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts index ce35d8dae..fbd0ff75d 100644 --- a/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts +++ b/dmp-frontend/src/app/ui/reference/reference-field/reference-field.component.ts @@ -17,6 +17,9 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit { @Input() form: UntypedFormGroup = null; @Input() label: string = null; @Input() placeholder: string = "Enter text"; + @Input() required: boolean = false; + @Input() multiple: boolean = true; + @Input() hint: string; multipleAutoCompleteSearchConfiguration: MultipleAutoCompleteConfiguration;