diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/composite-field/description-template-editor-composite-field.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/composite-field/description-template-editor-composite-field.component.html index b2a04c4f3..fddc460a8 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/composite-field/description-template-editor-composite-field.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/composite-field/description-template-editor-composite-field.component.html @@ -98,7 +98,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/composite-field/description-template-editor-composite-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/composite-field/description-template-editor-composite-field.component.ts index 7b7cd9267..63c5d8906 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/composite-field/description-template-editor-composite-field.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/composite-field/description-template-editor-composite-field.component.ts @@ -79,6 +79,7 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon public enumUtils: EnumUtils, public datasetProfileService: DescriptionTemplateService, private configurationService: ConfigurationService, + public visibilityRulesService: VisibilityRulesService ) { super(); } @@ -289,6 +290,7 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon this.previewPropertiesFormGroup = descriptionEditorModel.properties.fieldSets.get(fieldSet.id).buildForm() as UntypedFormGroup; this.previewFieldSet = fieldSet; + this.visibilityRulesService.setContext(mockDescription.descriptionTemplate.definition, this.previewPropertiesFormGroup); // this.previewSubject$.next(section); } @@ -561,10 +563,6 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon break; } - case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: { - //TODO: refactor - break; - } case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS: { const data: DescriptionTemplateLabelAndMultiplicityData = { diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/default-value/description-template-editor-default-value.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/default-value/description-template-editor-default-value.component.html index f44fa5a1f..13dd0f1dc 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/default-value/description-template-editor-default-value.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/default-value/description-template-editor-default-value.component.html @@ -27,10 +27,10 @@ {{'GENERAL.VALIDATION.REQUIRED' | translate}} - + {{placeHolder}} - + {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.NONE' | translate }} {{opt.get('label').value}} diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.ts index e2586572f..2cbb44a9d 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/field/description-template-editor-field.component.ts @@ -161,10 +161,6 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple break; } - case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: { - //TODO: refactor - break; - } case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS: case DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS:{ const data: DescriptionTemplateLabelAndMultiplicityData = { diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.html index be1d8a544..ec44fbce4 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.ts index 299c36886..dfd1b102c 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/final-preview/final-preview.component.ts @@ -21,13 +21,20 @@ export class FinalPreviewComponent implements OnInit { @Input() descriptionTemplatePersist: DescriptionTemplatePersist; descriptionTemplate: DescriptionTemplate; - previewPropertiesFormGroup - @Input() formGroup = null; + previewPropertiesFormGroup: UntypedFormGroup; constructor(public visibilityRulesService: VisibilityRulesService) { } + ngOnInit(): void { + this.generatePreviewForm(); + } + + ngOnChanges(changes: SimpleChanges) { + if(changes['descriptionTemplatePersist']) this.generatePreviewForm(); + } + private generatePreviewForm() { this.descriptionTemplate = this.buildDescriptionTemplate(this.descriptionTemplatePersist); @@ -132,12 +139,4 @@ export class FinalPreviewComponent implements OnInit { return convertedField; } - ngOnInit(): void { - this.generatePreviewForm(); - } - - // ngOnChanges(changes: SimpleChanges) { - // if(changes['descriptionTemplatePersist']) this.generatePreviewForm(); - // } - } diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/visibility-rule/description-template-editor-visibility-rule.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/components/visibility-rule/description-template-editor-visibility-rule.component.html index 1565b3ffd..193137eee 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/visibility-rule/description-template-editor-visibility-rule.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/visibility-rule/description-template-editor-visibility-rule.component.html @@ -3,6 +3,7 @@ + diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/components/visibility-rule/description-template-editor-visibility-rule.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/components/visibility-rule/description-template-editor-visibility-rule.component.ts index 89a1ed900..a8858a03f 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/components/visibility-rule/description-template-editor-visibility-rule.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/components/visibility-rule/description-template-editor-visibility-rule.component.ts @@ -43,12 +43,12 @@ export class DescriptionTemplateEditorRuleComponent implements OnInit { return type == DescriptionTemplateFieldType.FREE_TEXT || type == DescriptionTemplateFieldType.CHECK_BOX || type == DescriptionTemplateFieldType.TEXT_AREA || type == DescriptionTemplateFieldType.RICH_TEXT_AREA || type == DescriptionTemplateFieldType.BOOLEAN_DECISION || type == DescriptionTemplateFieldType.RADIO_BOX || - type == DescriptionTemplateFieldType.CURRENCY || type == DescriptionTemplateFieldType.SELECT; + type == DescriptionTemplateFieldType.CURRENCY; } isTextListType(type: DescriptionTemplateFieldType){ return type == DescriptionTemplateFieldType.TAGS || type == DescriptionTemplateFieldType.INTERNAL_ENTRIES_DMPS || - type == DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS; + type == DescriptionTemplateFieldType.INTERNAL_ENTRIES_DESCRIPTIONS || type == DescriptionTemplateFieldType.SELECT; } isDateType(type: DescriptionTemplateFieldType){ diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html index 3350341c6..abd722118 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.html @@ -268,7 +268,7 @@
- +
diff --git a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts index a4aaf654f..276639b3a 100644 --- a/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts +++ b/dmp-frontend/src/app/ui/admin/description-template/editor/description-template-editor.component.ts @@ -78,6 +78,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor { - // return { - // id: editorField.id, - // ordinal: editorField.ordinal, - // numbering: '', - // schematics: editorField.schematics, - // defaultValue: editorField.defaultValue, - // visibilityRules: editorField.visibilityRules, - // validations: editorField.validations, - // includeInExport: editorField.includeInExport, - // data: editorField.data - // } - // }); - - // const fieldSet: DescriptionTemplateFieldSet = { - // id: formValue.id, - // ordinal: formValue.ordinal, - // numbering: '', - // title: formValue.title, - // description: formValue.description, - // extendedDescription: formValue.extendedDescription, - // additionalInformation: formValue.additionalInformation, - // multiplicity: { - // max: formValue.multiplicity.max, min: formValue.multiplicity.min, - // placeholder: formValue.multiplicity.placeholder, tableView: formValue.multiplicity.tableView - // }, - // hasCommentField: formValue.hasCommentField, - // fields: fields - // } - - // const mockDescription: Description = { - // descriptionTemplate: { - // definition: { - // pages: [ - // { - // sections: [{ - // fieldSets: [fieldSet] - // }] - // } - // ] - // } - // } - // } - - // const descriptionEditorModel = new DescriptionEditorModel().fromModel(mockDescription, mockDescription.descriptionTemplate); - // this.previewPropertiesFormGroup = descriptionEditorModel.properties.fieldSets.get(fieldSet.id).buildForm() as UntypedFormGroup; - // this.previewFieldSet = fieldSet; - // let data = this.form.getRawValue(); - // this.datasetProfileService.preview(data).subscribe(x => { - // this.datasetWizardModel = new DatasetWizardEditorModel().fromModel({ - // datasetProfileDefinition: x - // }); - // this.updateVisibilityRules(); - // this.formGroup = this.datasetWizardModel.buildForm().get('datasetProfileDefinition'); - // }); + this.finalPreviewDescriptionTemplatePersist = this.formGroup.getRawValue(); } // diff --git a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html index 97ac3dbac..b1bed6675 100644 --- a/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html +++ b/dmp-frontend/src/app/ui/description/editor/description-form/components/form-section/form-section.component.html @@ -3,7 +3,7 @@ -
{{path}}.section {{section.title}}
+
{{path}}.section {{section.title}}
{{path}} {{section.title}}