description template changes in frontend

This commit is contained in:
Diamantis Tziotzios 2024-01-31 21:16:39 +02:00
parent 3c32e57aad
commit 8b5a54814d
32 changed files with 559 additions and 1016 deletions

View File

@ -1,4 +0,0 @@
export enum DescriptionTemplateFieldAutocompleteType {
UNCACHED = 0,
CACHED = 1
}

View File

@ -1,7 +1,6 @@
export enum DescriptionTemplateFieldType { export enum DescriptionTemplateFieldType {
COMBO_BOX = "combobox", //Delete EXTERNAL_SELECT = "externalSelect",
AUTO_COMPLETE = "autocomplete", SELECT = "select",
SELECT = "wordlist",
BOOLEAN_DECISION = "booleanDecision", BOOLEAN_DECISION = "booleanDecision",
RADIO_BOX = "radiobox", RADIO_BOX = "radiobox",
INTERNAL_DMP_ENTRIES = "internalDmpEntities", //Delete INTERNAL_DMP_ENTRIES = "internalDmpEntities", //Delete

View File

@ -1,4 +1,3 @@
import { DescriptionTemplateFieldAutocompleteType } from "@app/core/common/enum/description-template-field-autocomplete-type";
import { DescriptionTemplateFieldDataExternalDatasetType } from "@app/core/common/enum/description-template-field-data-external-dataset-type"; import { DescriptionTemplateFieldDataExternalDatasetType } from "@app/core/common/enum/description-template-field-data-external-dataset-type";
import { DescriptionTemplateFieldType } from "@app/core/common/enum/description-template-field-type"; import { DescriptionTemplateFieldType } from "@app/core/common/enum/description-template-field-type";
import { DescriptionTemplateFieldValidationType } from "@app/core/common/enum/description-template-field-validation-type"; import { DescriptionTemplateFieldValidationType } from "@app/core/common/enum/description-template-field-validation-type";
@ -25,7 +24,6 @@ export interface UserDescriptionTemplatePersist {
export interface DescriptionTemplateDefinitionPersist { export interface DescriptionTemplateDefinitionPersist {
pages?: DescriptionTemplatePagePersist[]; pages?: DescriptionTemplatePagePersist[];
sections?: DescriptionTemplateSectionPersist[];
} }
@ -33,6 +31,7 @@ export interface DescriptionTemplatePagePersist {
id: string; id: string;
ordinal: number; ordinal: number;
title: string; title: string;
sections: DescriptionTemplateSectionPersist[];
} }
export interface DescriptionTemplateSectionPersist { export interface DescriptionTemplateSectionPersist {
@ -40,7 +39,6 @@ export interface DescriptionTemplateSectionPersist {
ordinal: number; ordinal: number;
defaultVisibility: boolean; defaultVisibility: boolean;
multiplicity: boolean; multiplicity: boolean;
page: string;
title: string; title: string;
description: string; description: string;
@ -92,115 +90,47 @@ export interface DescriptionTemplateBaseFieldDataPersist {
// //
// Field Types // Field Types
// //
export interface DescriptionTemplateAutoCompleteDataPersist extends DescriptionTemplateBaseFieldDataPersist {
multiAutoComplete: boolean;
autoCompleteSingleDataList: DescriptionTemplateAutoCompleteSingleDataPersist[];
}
export interface DescriptionTemplateBooleanDecisionDataPersist extends DescriptionTemplateBaseFieldDataPersist { export interface DescriptionTemplateExternalDatasetDataPersist extends DescriptionTemplateLabelAndMultiplicityDataPersist {
}
export interface DescriptionTemplateDatasetAutoCompleteDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
}
export interface DescriptionTemplateDmpAutoCompleteDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
}
export interface DescriptionTemplateCheckBoxDataPersist extends DescriptionTemplateBaseFieldDataPersist {
}
export interface DescriptionTemplateDatePickerDataPersist extends DescriptionTemplateBaseFieldDataPersist {
}
export interface DescriptionTemplateExternalDatasetDataPersist extends DescriptionTemplateBaseFieldDataPersist {
multiAutoComplete: boolean;
type: DescriptionTemplateFieldDataExternalDatasetType; type: DescriptionTemplateFieldDataExternalDatasetType;
} }
export interface DescriptionTemplateFreeTextDataPersist extends DescriptionTemplateBaseFieldDataPersist { export interface DescriptionTemplateExternalSelectDataPersist extends DescriptionTemplateLabelAndMultiplicityDataPersist {
sources: DescriptionTemplateExternalSelectSourcePersist[];
} }
export interface DescriptionTemplatePlaceholderAndMultiplicityDataPersist extends DescriptionTemplateBaseFieldDataPersist { export interface DescriptionTemplateLabelAndMultiplicityDataPersist extends DescriptionTemplateBaseFieldDataPersist {
multiAutoComplete: boolean; multipleSelect: boolean;
}
export interface DescriptionTemplateLicenseDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
} }
export interface DescriptionTemplateOrganizationDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist { export interface DescriptionTemplateLabelDataPersist extends DescriptionTemplateBaseFieldDataPersist {
}
export interface DescriptionTemplatePublicationDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
} }
export interface DescriptionTemplateRadioBoxDataPersist extends DescriptionTemplateBaseFieldDataPersist { export interface DescriptionTemplateRadioBoxDataPersist extends DescriptionTemplateBaseFieldDataPersist {
options: DescriptionTemplateRadioBoxOptionPersist[]; options: DescriptionTemplateRadioBoxOptionPersist[];
} }
export interface DescriptionTemplateRegistryDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist { export interface DescriptionTemplateSelectDataPersist extends DescriptionTemplateLabelAndMultiplicityDataPersist {
} options: DescriptionTemplateSelectOptionPersist[];
export interface DescriptionTemplateResearcherAutoCompleteDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
}
export interface DescriptionTemplateResearcherDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
}
export interface DescriptionTemplateRichTextAreaDataPersist extends DescriptionTemplateBaseFieldDataPersist {
}
export interface DescriptionTemplateServiceDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
}
export interface DescriptionTemplateTagDataPersist extends DescriptionTemplateBaseFieldDataPersist {
}
export interface DescriptionTemplateTaxonomyDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
}
export interface DescriptionTemplateTextAreaDataPersist extends DescriptionTemplateBaseFieldDataPersist {
} }
export interface DescriptionTemplateUploadDataPersist extends DescriptionTemplateBaseFieldDataPersist { export interface DescriptionTemplateUploadDataPersist extends DescriptionTemplateBaseFieldDataPersist {
types: DescriptionTemplateUploadOptionPersist[]; types: DescriptionTemplateUploadOptionPersist[];
} }
export interface DescriptionTemplateValidationDataPersist extends DescriptionTemplateBaseFieldDataPersist {
}
export interface DescriptionTemplateDatasetIdentifierDataPersist extends DescriptionTemplateBaseFieldDataPersist {
}
export interface DescriptionTemplateCurrencyDataPersist extends DescriptionTemplateBaseFieldDataPersist {
}
export interface DescriptionTemplateSelectDataPersist extends DescriptionTemplateBaseFieldDataPersist {
options: DescriptionTemplateComboBoxOptionPersist[];
multiList: boolean;
}
export interface DescriptionTemplateDataRepositoryDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
}
export interface DescriptionTemplateJournalRepositoryDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
}
export interface DescriptionTemplatePublicationRepositoryDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
}
// //
// Others // Others
// //
export interface DescriptionTemplateAutoCompleteSingleDataPersist { export interface DescriptionTemplateExternalSelectSourcePersist {
autocompleteType: DescriptionTemplateFieldAutocompleteType;
url: string; url: string;
autoCompleteOptions: DescriptionTemplateComboBoxOptionPersist;
optionsRoot: string;
hasAuth: boolean;
auth: DescriptionTemplateAuthAutoCompleteDataPersist
method: string; method: string;
optionsRoot: string;
sourceBinding: DescriptionTemplateExternalSelectSourceBindingPersist;
hasAuth: boolean;
auth: DescriptionTemplateExternalSelectAuthDataPersist
} }
export interface DescriptionTemplateAuthAutoCompleteDataPersist { export interface DescriptionTemplateExternalSelectAuthDataPersist {
url: string; url: string;
method: string; method: string;
body: string; body: string;
@ -208,11 +138,15 @@ export interface DescriptionTemplateAuthAutoCompleteDataPersist {
type: string; type: string;
} }
export interface DescriptionTemplateComboBoxOptionPersist { export interface DescriptionTemplateSelectOptionPersist {
label: string;
value: string;
}
export interface DescriptionTemplateExternalSelectSourceBindingPersist {
label: string; label: string;
value: string; value: string;
source: string; source: string;
uri: string;
} }
export interface DescriptionTemplateRadioBoxOptionPersist { export interface DescriptionTemplateRadioBoxOptionPersist {

View File

@ -29,7 +29,6 @@ export interface UserDescriptionTemplate extends BaseEntity {
export interface DescriptionTemplateDefinition { export interface DescriptionTemplateDefinition {
pages?: DescriptionTemplatePage[]; pages?: DescriptionTemplatePage[];
sections?: DescriptionTemplateSection[];
} }
@ -37,6 +36,7 @@ export interface DescriptionTemplatePage {
id: string; id: string;
ordinal: number; ordinal: number;
title: string; title: string;
sections: DescriptionTemplateSection[];
} }
export interface DescriptionTemplateSection { export interface DescriptionTemplateSection {
@ -44,13 +44,9 @@ export interface DescriptionTemplateSection {
ordinal: number; ordinal: number;
defaultVisibility: boolean; defaultVisibility: boolean;
multiplicity: boolean; multiplicity: boolean;
numbering: string;
page: string;
title: string; title: string;
description: string; description: string;
extendedDescription: string; sections: DescriptionTemplateSection[];
sections?: DescriptionTemplateSection[];
fieldSets: DescriptionTemplateFieldSet[]; fieldSets: DescriptionTemplateFieldSet[];
} }
@ -100,82 +96,27 @@ export interface DescriptionTemplateBaseFieldData {
// //
// Field Types // Field Types
// //
export interface DescriptionTemplateAutoCompleteData extends DescriptionTemplateBaseFieldData { export interface DescriptionTemplateLabelData extends DescriptionTemplateBaseFieldData {
multiAutoComplete: boolean;
autoCompleteSingleDataList: DescriptionTemplateAutoCompleteSingleData[];
} }
export interface DescriptionTemplateBooleanDecisionData extends DescriptionTemplateBaseFieldData { export interface DescriptionTemplateLabelAndMultiplicityData extends DescriptionTemplateBaseFieldData {
multipleSelect: boolean;
} }
export interface DescriptionTemplateCheckBoxData extends DescriptionTemplateBaseFieldData { export interface DescriptionTemplateExternalDatasetData extends DescriptionTemplateLabelAndMultiplicityData {
}
export interface DescriptionTemplateCurrencyData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateDataRepositoryData extends DescriptionTemplatePlaceholderAndMultiplicityData {
}
export interface DescriptionTemplateDatasetAutoCompleteData extends DescriptionTemplatePlaceholderAndMultiplicityData {
}
export interface DescriptionTemplateDatasetIdentifierData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateDatePickerData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateDmpAutoCompleteData extends DescriptionTemplatePlaceholderAndMultiplicityData {
}
export interface DescriptionTemplateExternalDatasetData extends DescriptionTemplateBaseFieldData {
multiAutoComplete: boolean;
type?: DescriptionTemplateFieldDataExternalDatasetType; type?: DescriptionTemplateFieldDataExternalDatasetType;
} }
export interface DescriptionTemplateFreeTextData extends DescriptionTemplateBaseFieldData { export interface DescriptionTemplateExternalSelectData extends DescriptionTemplateLabelAndMultiplicityData {
} sources: DescriptionTemplateExternalSelectSource[];
export interface DescriptionTemplatePlaceholderAndMultiplicityData extends DescriptionTemplateBaseFieldData {
multiAutoComplete: boolean;
}
export interface DescriptionTemplateLicenseData extends DescriptionTemplatePlaceholderAndMultiplicityData {
}
export interface DescriptionTemplateOrganizationData extends DescriptionTemplatePlaceholderAndMultiplicityData {
}
export interface DescriptionTemplatePublicationData extends DescriptionTemplatePlaceholderAndMultiplicityData {
} }
export interface DescriptionTemplateRadioBoxData extends DescriptionTemplateBaseFieldData { export interface DescriptionTemplateRadioBoxData extends DescriptionTemplateBaseFieldData {
options: DescriptionTemplateRadioBoxOption[]; options: DescriptionTemplateRadioBoxOption[];
} }
export interface DescriptionTemplateRegistryData extends DescriptionTemplatePlaceholderAndMultiplicityData { export interface DescriptionTemplateSelectData extends DescriptionTemplateLabelAndMultiplicityData {
} options: DescriptionTemplateSelectOption[];
export interface DescriptionTemplateResearcherAutoCompleteData extends DescriptionTemplatePlaceholderAndMultiplicityData {
}
export interface DescriptionTemplateResearcherData extends DescriptionTemplatePlaceholderAndMultiplicityData {
}
export interface DescriptionTemplateRichTextAreaData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateServiceData extends DescriptionTemplatePlaceholderAndMultiplicityData {
}
export interface DescriptionTemplateTagData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateTaxonomyData extends DescriptionTemplatePlaceholderAndMultiplicityData {
}
export interface DescriptionTemplateTextAreaData extends DescriptionTemplateBaseFieldData {
} }
export interface DescriptionTemplateUploadData extends DescriptionTemplateBaseFieldData { export interface DescriptionTemplateUploadData extends DescriptionTemplateBaseFieldData {
@ -183,28 +124,20 @@ export interface DescriptionTemplateUploadData extends DescriptionTemplateBaseFi
maxFileSizeInMB: number; maxFileSizeInMB: number;
} }
export interface DescriptionTemplateValidationData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateSelectData extends DescriptionTemplateBaseFieldData {
options: DescriptionTemplateComboBoxOption[];
multiList: boolean;
}
// //
// Others // Others
// //
export interface DescriptionTemplateAutoCompleteSingleData { export interface DescriptionTemplateExternalSelectSource {
autocompleteType: string;
url: string; url: string;
autoCompleteOptions: DescriptionTemplateComboBoxOption;
optionsRoot: string;
hasAuth: boolean;
auth: DescriptionTemplateAuthAutoCompleteData
method: string; method: string;
optionsRoot: string;
sourceBinding: DescriptionTemplateExternalSelectSourceBinding;
hasAuth: boolean;
auth: DescriptionTemplateExternalSelectAuthData
} }
export interface DescriptionTemplateAuthAutoCompleteData { export interface DescriptionTemplateExternalSelectAuthData {
url: string; url: string;
method: string; method: string;
body: string; body: string;
@ -212,11 +145,15 @@ export interface DescriptionTemplateAuthAutoCompleteData {
type: string; type: string;
} }
export interface DescriptionTemplateComboBoxOption { export interface DescriptionTemplateExternalSelectSourceBinding {
label: string; label: string;
value: string; value: string;
source: string; source: string;
uri: string; }
export interface DescriptionTemplateSelectOption {
label: string;
value: string;
} }
export interface DescriptionTemplateRadioBoxOption { export interface DescriptionTemplateRadioBoxOption {

View File

@ -33,11 +33,11 @@ export class FieldValuePipe implements PipeTransform {
return this.date.transform(controlValue.value, 'dd/MM/yyyy'); return this.date.transform(controlValue.value, 'dd/MM/yyyy');
case DescriptionTemplateFieldType.FREE_TEXT: case DescriptionTemplateFieldType.FREE_TEXT:
return value; return value;
case DescriptionTemplateFieldType.AUTO_COMPLETE: case DescriptionTemplateFieldType.EXTERNAL_SELECT:
case DescriptionTemplateFieldType.SELECT: case DescriptionTemplateFieldType.SELECT:
if (value && controlValue.data.options && !controlValue.data.multiList) { if (value && controlValue.data.options && !controlValue.data.multipleSelect) {
return controlValue.data.options.find(option => value == option.value).label; return controlValue.data.options.find(option => value == option.value).label;
} else if (value && controlValue.data.options && controlValue.data.multiList) { } else if (value && controlValue.data.options && controlValue.data.multipleSelect) {
return controlValue.data.options.filter(option => value.includes(option.value)).map(option => option.label).join(','); return controlValue.data.options.filter(option => value.includes(option.value)).map(option => option.label).join(',');
} }
break; break;

View File

@ -156,12 +156,10 @@ export class EnumUtils {
toDescriptionTemplateFieldTypeString(status: DescriptionTemplateFieldType): string { toDescriptionTemplateFieldTypeString(status: DescriptionTemplateFieldType): string {
switch (status) { switch (status) {
case DescriptionTemplateFieldType.COMBO_BOX: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.COMBO-BOX'); case DescriptionTemplateFieldType.EXTERNAL_SELECT: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.EXTERNAL-SELECT');
case DescriptionTemplateFieldType.AUTO_COMPLETE: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.AUTO-COMPLETE');
case DescriptionTemplateFieldType.SELECT: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.SELECT'); case DescriptionTemplateFieldType.SELECT: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.SELECT');
case DescriptionTemplateFieldType.BOOLEAN_DECISION: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.BOOLEAN-DECISION'); case DescriptionTemplateFieldType.BOOLEAN_DECISION: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.BOOLEAN-DECISION');
case DescriptionTemplateFieldType.RADIO_BOX: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.RADIO-BOX'); case DescriptionTemplateFieldType.RADIO_BOX: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.RADIO-BOX');
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES');
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-RESEARCHERS'); case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-RESEARCHERS');
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-DMPS'); case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-DMPS');
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DATASETS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-DATASETS'); case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DATASETS: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.INTERNAL-DMP-ENTITIES-DATASETS');

View File

@ -233,9 +233,9 @@
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Publications icon"> <img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Publications icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.PUBLICATIONS)}} {{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.PUBLICATIONS)}}
</button> </button>
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.AUTO_COMPLETE)"> <button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT)">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Other icon"> <img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Other icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.AUTO_COMPLETE)}} {{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT)}}
</button> </button>
</mat-action-list> </mat-action-list>

View File

@ -5,32 +5,15 @@ import { MatDialog } from '@angular/material/dialog';
import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type'; import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type';
import { ValidationType } from '@app/core/common/enum/validation-type'; import { ValidationType } from '@app/core/common/enum/validation-type';
import { import {
DescriptionTemplateAutoCompleteData, DescriptionTemplateExternalSelectData,
DescriptionTemplateBooleanDecisionData, DescriptionTemplateSelectOption,
DescriptionTemplateCheckBoxData,
DescriptionTemplateComboBoxOption,
DescriptionTemplateCurrencyData,
DescriptionTemplateDataRepositoryData,
DescriptionTemplateDatasetIdentifierData,
DescriptionTemplateDatePickerData,
DescriptionTemplateDmpAutoCompleteData,
DescriptionTemplateExternalDatasetData, DescriptionTemplateExternalDatasetData,
DescriptionTemplateField, DescriptionTemplateField,
DescriptionTemplateFreeTextData,
DescriptionTemplateLicenseData,
DescriptionTemplateOrganizationData,
DescriptionTemplatePublicationData,
DescriptionTemplateRadioBoxData, DescriptionTemplateRadioBoxData,
DescriptionTemplateRegistryData,
DescriptionTemplateResearcherAutoCompleteData,
DescriptionTemplateRichTextAreaData,
DescriptionTemplateServiceData,
DescriptionTemplateTagData,
DescriptionTemplateTaxonomyData,
DescriptionTemplateTextAreaData,
DescriptionTemplateUploadData, DescriptionTemplateUploadData,
DescriptionTemplateValidationData, DescriptionTemplateSelectData,
DescriptionTemplateSelectData DescriptionTemplateLabelData,
DescriptionTemplateLabelAndMultiplicityData
} from '@app/core/model/description-template/description-template'; } from '@app/core/model/description-template/description-template';
import { ConfigurationService } from "@app/core/services/configuration/configuration.service"; import { ConfigurationService } from "@app/core/services/configuration/configuration.service";
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
@ -497,258 +480,91 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
} as DescriptionTemplateField; } as DescriptionTemplateField;
switch (type) { switch (type) {
case DescriptionTemplateFieldType.BOOLEAN_DECISION: { case DescriptionTemplateFieldType.EXTERNAL_SELECT: {
const data: DescriptionTemplateExternalSelectData = {
const data: DescriptionTemplateBooleanDecisionData = { sources: [],
multipleSelect: false,
label: '', label: '',
fieldType: DescriptionTemplateFieldType.BOOLEAN_DECISION, fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.CHECK_BOX: {
const data: DescriptionTemplateCheckBoxData = {
label: '',
fieldType: DescriptionTemplateFieldType.CHECK_BOX,
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.COMBO_BOX: {
const firstOption = { label: '', value: '' } as DescriptionTemplateComboBoxOption;
const data: DescriptionTemplateSelectData = {
label: '',
multiList: false,
options: [firstOption],
fieldType: DescriptionTemplateFieldType.SELECT
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.AUTO_COMPLETE: {
const data: DescriptionTemplateAutoCompleteData = {
autoCompleteSingleDataList: [],
multiAutoComplete: false,
label: '',
fieldType: DescriptionTemplateFieldType.AUTO_COMPLETE
}
field.data = data;
break;
} case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES: {
const data: DescriptionTemplateDmpAutoCompleteData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.FREE_TEXT: {
const data: DescriptionTemplateFreeTextData = {
label: '',
fieldType: DescriptionTemplateFieldType.FREE_TEXT
} }
field.data = data; field.data = data;
break; break;
} }
case DescriptionTemplateFieldType.RADIO_BOX: { case DescriptionTemplateFieldType.RADIO_BOX: {
const data: DescriptionTemplateRadioBoxData = { const data: DescriptionTemplateRadioBoxData = {
label: '', label: '',
options: [], options: [],
fieldType: DescriptionTemplateFieldType.RADIO_BOX fieldType: type
} }
field.data = data; field.data = data;
break; break;
} }
case DescriptionTemplateFieldType.TEXT_AREA: { case DescriptionTemplateFieldType.SELECT: {
const firstOption = { label: '', value: '' } as DescriptionTemplateSelectOption;
const data: DescriptionTemplateTextAreaData = { const data: DescriptionTemplateSelectData = {
label: '', label: '',
fieldType: DescriptionTemplateFieldType.TEXT_AREA multipleSelect: false,
options: [firstOption],
fieldType: type
} }
field.data = data; field.data = data;
break; break;
} }
case DescriptionTemplateFieldType.RICH_TEXT_AREA: { case DescriptionTemplateFieldType.BOOLEAN_DECISION:
case DescriptionTemplateFieldType.CHECK_BOX:
const data: DescriptionTemplateRichTextAreaData = { case DescriptionTemplateFieldType.FREE_TEXT:
case DescriptionTemplateFieldType.TEXT_AREA:
case DescriptionTemplateFieldType.RICH_TEXT_AREA:
case DescriptionTemplateFieldType.DATE_PICKER:
case DescriptionTemplateFieldType.TAGS:
case DescriptionTemplateFieldType.DATASET_IDENTIFIER:
case DescriptionTemplateFieldType.CURRENCY:
case DescriptionTemplateFieldType.VALIDATION: {
const data: DescriptionTemplateLabelData = {
label: '', label: '',
fieldType: DescriptionTemplateFieldType.RICH_TEXT_AREA fieldType: type
} }
field.data = data; field.data = data;
break; break;
} }
case DescriptionTemplateFieldType.UPLOAD: { case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS:
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS:
const data: DescriptionTemplateUploadData = { case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DATASETS:
case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
case DescriptionTemplateFieldType.DATA_REPOSITORIES:
case DescriptionTemplateFieldType.JOURNAL_REPOSITORIES:
case DescriptionTemplateFieldType.PUB_REPOSITORIES:
case DescriptionTemplateFieldType.LICENSES:
case DescriptionTemplateFieldType.TAXONOMIES:
case DescriptionTemplateFieldType.PUBLICATIONS:
case DescriptionTemplateFieldType.REGISTRIES:
case DescriptionTemplateFieldType.SERVICES:
case DescriptionTemplateFieldType.RESEARCHERS:
case DescriptionTemplateFieldType.ORGANIZATIONS: {
const data: DescriptionTemplateLabelAndMultiplicityData = {
label: '', label: '',
types: [], multipleSelect: false,
maxFileSizeInMB: this.configurationService.maxFileSizeInMB, fieldType: type
fieldType: DescriptionTemplateFieldType.UPLOAD
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.DATE_PICKER: {
const data: DescriptionTemplateDatePickerData = {
label: '',
fieldType: DescriptionTemplateFieldType.DATE_PICKER
} }
field.data = data; field.data = data;
break; break;
} }
case DescriptionTemplateFieldType.EXTERNAL_DATASETS: { case DescriptionTemplateFieldType.EXTERNAL_DATASETS: {
const data: DescriptionTemplateExternalDatasetData = { const data: DescriptionTemplateExternalDatasetData = {
label: '', label: '',
multiAutoComplete: false, multipleSelect: false,
fieldType: DescriptionTemplateFieldType.EXTERNAL_DATASETS fieldType: type
} }
field.data = data; field.data = data;
break; break;
} }
case DescriptionTemplateFieldType.DATA_REPOSITORIES: { case DescriptionTemplateFieldType.UPLOAD: {
const data: DescriptionTemplateUploadData = {
const data: DescriptionTemplateDataRepositoryData = {
label: '', label: '',
multiAutoComplete: false, types: [],
fieldType: DescriptionTemplateFieldType.DATA_REPOSITORIES maxFileSizeInMB: this.configurationService.maxFileSizeInMB,
} fieldType: type
field.data = data;
break;
}
case DescriptionTemplateFieldType.PUB_REPOSITORIES: {
const data: DescriptionTemplateDataRepositoryData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.DATA_REPOSITORIES
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.JOURNAL_REPOSITORIES: {
const data: DescriptionTemplateDataRepositoryData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.DATA_REPOSITORIES
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.TAXONOMIES: {
const data: DescriptionTemplateTaxonomyData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.TAXONOMIES
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.LICENSES: {
const data: DescriptionTemplateLicenseData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.LICENSES
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.PUBLICATIONS: {
const data: DescriptionTemplatePublicationData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.PUBLICATIONS
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.REGISTRIES: {
const data: DescriptionTemplateRegistryData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.REGISTRIES
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.SERVICES: {
const data: DescriptionTemplateServiceData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.SERVICES
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.TAGS: {
const data: DescriptionTemplateTagData = {
label: '',
fieldType: DescriptionTemplateFieldType.TAGS
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.RESEARCHERS: {
const data: DescriptionTemplateResearcherAutoCompleteData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.ORGANIZATIONS: {
const data: DescriptionTemplateOrganizationData = {
// autoCompleteSingleDataList: [], //TODO maybe remove
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.ORGANIZATIONS
};
field.data = data;
break;
}
case DescriptionTemplateFieldType.DATASET_IDENTIFIER: {
const data: DescriptionTemplateDatasetIdentifierData = {
label: '',
fieldType: DescriptionTemplateFieldType.DATASET_IDENTIFIER
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.CURRENCY: {
const data: DescriptionTemplateCurrencyData = {
label: '',
fieldType: DescriptionTemplateFieldType.CURRENCY
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.VALIDATION: {
const data: DescriptionTemplateValidationData = {
label: '',
fieldType: DescriptionTemplateFieldType.VALIDATION
} }
field.data = data; field.data = data;
break; break;

View File

@ -1,9 +1,9 @@
<div class="row" *ngIf="form.get('data')"> <div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-auto">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}</h5> <h5 style="font-weight: bold" class="col-auto">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}</h5>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multiAutoComplete')"> <mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}} {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
<mat-error *ngIf="form.get('data').get('multiAutoComplete').hasError('backendError')">{{form.get('data').get('multiAutoComplete').getError('backendError').message}}</mat-error> <mat-error *ngIf="form.get('data').get('multipleSelect').hasError('backendError')">{{form.get('data').get('multipleSelect').getError('backendError').message}}</mat-error>
</mat-checkbox> </mat-checkbox>
<mat-form-field class="col-12"> <mat-form-field class="col-12">
@ -50,20 +50,20 @@
</mat-form-field> </mat-form-field>
<mat-form-field class="col-md-3"> <mat-form-field class="col-md-3">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-LABEL' | translate}}</mat-label> <mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-LABEL' | translate}}</mat-label>
<input matInput [formControl]="singleForm.get('autoCompleteOptions').get('label')"> <input matInput [formControl]="singleForm.get('sourceBinding').get('label')">
<mat-error *ngIf="singleForm.get('autoCompleteOptions').get('label').hasError('backendError')">{{singleForm.get('autoCompleteOptions').get('label').getError('backendError').message}}</mat-error> <mat-error *ngIf="singleForm.get('sourceBinding').get('label').hasError('backendError')">{{singleForm.get('sourceBinding').get('label').getError('backendError').message}}</mat-error>
<mat-error *ngIf="singleForm.get('autoCompleteOptions').get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="singleForm.get('sourceBinding').get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="col-md-3"> <mat-form-field class="col-md-3">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-VALUE' | translate}}</mat-label> <mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-VALUE' | translate}}</mat-label>
<input matInput [formControl]="singleForm.get('autoCompleteOptions').get('value')"> <input matInput [formControl]="singleForm.get('sourceBinding').get('value')">
<mat-error *ngIf="singleForm.get('autoCompleteOptions').get('value').hasError('backendError')">{{singleForm.get('autoCompleteOptions').get('value').getError('backendError').message}}</mat-error> <mat-error *ngIf="singleForm.get('sourceBinding').get('value').hasError('backendError')">{{singleForm.get('sourceBinding').get('value').getError('backendError').message}}</mat-error>
</mat-form-field> </mat-form-field>
<mat-form-field class="col-md-3"> <mat-form-field class="col-md-3">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-SOURCE' | translate}}</mat-label> <mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-SOURCE' | translate}}</mat-label>
<input matInput [formControl]="singleForm.get('autoCompleteOptions').get('source')"> <input matInput [formControl]="singleForm.get('sourceBinding').get('source')">
<mat-error *ngIf="singleForm.get('autoCompleteOptions').get('source').hasError('backendError')">{{singleForm.get('autoCompleteOptions').get('source').getError('backendError').message}}</mat-error> <mat-error *ngIf="singleForm.get('sourceBinding').get('source').hasError('backendError')">{{singleForm.get('sourceBinding').get('source').getError('backendError').message}}</mat-error>
<mat-error *ngIf="singleForm.get('autoCompleteOptions').get('source').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="singleForm.get('sourceBinding').get('source').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field> </mat-form-field>
<mat-checkbox class="col-12" [formControl]="singleForm.get('hasAuth')">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-HAS-AUTH' | translate}}</mat-checkbox> <mat-checkbox class="col-12" [formControl]="singleForm.get('hasAuth')">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-HAS-AUTH' | translate}}</mat-checkbox>
<div *ngIf="singleForm.get('hasAuth').value === true" class="col-12"> <div *ngIf="singleForm.get('hasAuth').value === true" class="col-12">

View File

@ -1,6 +1,6 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { UntypedFormArray, UntypedFormGroup } from '@angular/forms'; import { UntypedFormArray, UntypedFormGroup } from '@angular/forms';
import { DescriptionTemplateAutoCompleteFieldEditorModel } from '../../../description-template-editor.model'; import { DescriptionTemplateExternalSelectDataEditorModel } from '../../../description-template-editor.model';
@Component({ @Component({
selector: 'app-description-template-editor-auto-complete-field-component', selector: 'app-description-template-editor-auto-complete-field-component',
@ -13,11 +13,11 @@ export class DescriptionTemplateEditorAutoCompleteFieldComponent implements OnIn
multiForm: UntypedFormArray; multiForm: UntypedFormArray;
ngOnInit() { ngOnInit() {
this.multiForm = (<UntypedFormArray>this.form.get('data').get('autoCompleteSingleDataList')); this.multiForm = (<UntypedFormArray>this.form.get('data').get('sources'));
} }
addSource() { addSource() {
(<UntypedFormArray>this.multiForm).push(new DescriptionTemplateAutoCompleteFieldEditorModel().buildForm()); (<UntypedFormArray>this.multiForm).push(new DescriptionTemplateExternalSelectDataEditorModel().buildForm());
} }
removeSource(index: number) { removeSource(index: number) {

View File

@ -1,7 +1,7 @@
<div class="row" *ngIf="form.get('data')"> <div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-auto">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}</h5> <h5 style="font-weight: bold" class="col-auto">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}</h5>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multiAutoComplete')"> <mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}} {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
</mat-checkbox> </mat-checkbox>

View File

@ -1,7 +1,7 @@
<div class="row" *ngIf="form.get('data')"> <div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-auto">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}</h5> <h5 style="font-weight: bold" class="col-auto">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}</h5>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multiAutoComplete')"> <mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}} {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
</mat-checkbox> </mat-checkbox>

View File

@ -1,7 +1,7 @@
<div class="row" *ngIf="form.get('data')"> <div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-EXTERNAL-DATASETS-TITLE' <h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-EXTERNAL-DATASETS-TITLE'
| translate}}</h5> | translate}}</h5>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multiAutoComplete')"> <mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}} {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
</mat-checkbox> </mat-checkbox>

View File

@ -1,6 +1,6 @@
<div class="row" *ngIf="form.get('data')"> <div class="row" *ngIf="form.get('data')">
<!-- <h5 style="font-weight: bold" class="col-12">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-LICENSES-TITLE' | translate}}</h5> --> <!-- <h5 style="font-weight: bold" class="col-12">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-LICENSES-TITLE' | translate}}</h5> -->
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multiAutoComplete')"> <mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}} {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
</mat-checkbox> </mat-checkbox>
<mat-form-field class="col-12"> <mat-form-field class="col-12">

View File

@ -1,7 +1,7 @@
<div class="row" *ngIf="form.get('data')"> <div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-auto">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}</h5> <h5 style="font-weight: bold" class="col-auto">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-TITLE' | translate}}</h5>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multiAutoComplete')"> <mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}} {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
</mat-checkbox> </mat-checkbox>

View File

@ -1,7 +1,7 @@
<div class="row" *ngIf="form.get('data')"> <div class="row" *ngIf="form.get('data')">
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RESEARCHERS-TITLE' <h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RESEARCHERS-TITLE'
| translate}}</h5> | translate}}</h5>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multiAutoComplete')"> <mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}} {{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-AUTOCOMPLETE' | translate}}
</mat-checkbox> </mat-checkbox>
<mat-form-field class="col-12"> <mat-form-field class="col-12">

View File

@ -8,9 +8,9 @@
<small class="text-danger">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-SELECT-AT-LEAST-ONE-REQUIRED' |translate}}</small> <small class="text-danger">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.ERROR-MESSAGES.FIELD-SELECT-AT-LEAST-ONE-REQUIRED' |translate}}</small>
</ng-container> </ng-container>
</div> </div>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multiList')"> <mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multipleSelect')">
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-SELECT' | translate}} {{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-SELECT' | translate}}
<mat-error *ngIf="form.get('data').get('multiList').hasError('backendError')">{{form.get('data').get('multiList').getError('backendError').message}}</mat-error> <mat-error *ngIf="form.get('data').get('multipleSelect').hasError('backendError')">{{form.get('data').get('multipleSelect').getError('backendError').message}}</mat-error>
</mat-checkbox> </mat-checkbox>
<mat-form-field class="col-12"> <mat-form-field class="col-12">

View File

@ -1,6 +1,6 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { UntypedFormArray, UntypedFormGroup } from '@angular/forms'; import { UntypedFormArray, UntypedFormGroup } from '@angular/forms';
import { DescriptionTemplateComboBoxOptionEditorModel } from '../../../description-template-editor.model'; import { DescriptionTemplateSelectOptionEditorModel } from '../../../description-template-editor.model';
@Component({ @Component({
selector: 'app-description-template-editor-select-field-component', selector: 'app-description-template-editor-select-field-component',
@ -15,7 +15,7 @@ export class DescriptionTemplateEditorSelectFieldComponent implements OnInit {
} }
addNewRow() { addNewRow() {
const selectOptions: DescriptionTemplateComboBoxOptionEditorModel = new DescriptionTemplateComboBoxOptionEditorModel(); const selectOptions: DescriptionTemplateSelectOptionEditorModel = new DescriptionTemplateSelectOptionEditorModel();
(<UntypedFormArray>this.form.get('data').get('options')).push(selectOptions.buildForm()); (<UntypedFormArray>this.form.get('data').get('options')).push(selectOptions.buildForm());
} }

View File

@ -131,17 +131,25 @@
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Publications icon"> <img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Publications icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.PUBLICATIONS)}} {{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.PUBLICATIONS)}}
</mat-option> </mat-option>
<mat-option [value]="descriptionTemplateFieldTypeEnum.AUTO_COMPLETE"> <mat-option [value]="descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Other icon"> <img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Other icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.AUTO_COMPLETE)}} {{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT)}}
</mat-option> </mat-option>
</mat-optgroup> </mat-optgroup>
<!-- TODO --> <!-- TODO -->
<mat-divider></mat-divider> <mat-divider></mat-divider>
<mat-optgroup label="Argos Entities"> <mat-optgroup label="Argos Entities">
<mat-option [value]="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES"> <mat-option [value]="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DMPS">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="InternalDmpEntities icon"> <img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="InternalDmpEntities icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES)}} {{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DMPS)}}
</mat-option>
<mat-option [value]="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DATASETS">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="InternalDmpEntities icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DATASETS)}}
</mat-option>
<mat-option [value]="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_RESEARCHERS">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="InternalDmpEntities icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_RESEARCHERS)}}
</mat-option> </mat-option>
<mat-option [value]="descriptionTemplateFieldTypeEnum.TAGS"> <mat-option [value]="descriptionTemplateFieldTypeEnum.TAGS">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Tags icon"> <img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Tags icon">
@ -199,7 +207,7 @@
</div> </div>
<div class="row" [ngSwitch]="form.get('data')?.get('fieldType')?.value " *ngIf="expandView"> <div class="row" [ngSwitch]="form.get('data')?.get('fieldType')?.value " *ngIf="expandView">
<app-description-template-editor-auto-complete-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.AUTO_COMPLETE" class="col-12" [form]="form"></app-description-template-editor-auto-complete-field-component> <app-description-template-editor-auto-complete-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT" class="col-12" [form]="form"></app-description-template-editor-auto-complete-field-component>
<app-description-template-editor-select-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.SELECT" class="col-12" [form]="form"></app-description-template-editor-select-field-component> <app-description-template-editor-select-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.SELECT" class="col-12" [form]="form"></app-description-template-editor-select-field-component>
<app-description-template-editor-radio-box-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.RADIO_BOX" class="col-12" [form]="form"></app-description-template-editor-radio-box-field-component> <app-description-template-editor-radio-box-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.RADIO_BOX" class="col-12" [form]="form"></app-description-template-editor-radio-box-field-component>
<app-description-template-editor-upload-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.UPLOAD" class="col-12" [form]="form"></app-description-template-editor-upload-field-component> <app-description-template-editor-upload-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.UPLOAD" class="col-12" [form]="form"></app-description-template-editor-upload-field-component>

View File

@ -7,31 +7,14 @@ import { MatSlideToggleChange } from '@angular/material/slide-toggle';
import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type'; import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type';
import { ValidationType } from '@app/core/common/enum/validation-type'; import { ValidationType } from '@app/core/common/enum/validation-type';
import { import {
DescriptionTemplateAutoCompleteData,
DescriptionTemplateBooleanDecisionData,
DescriptionTemplateCheckBoxData,
DescriptionTemplateComboBoxOption,
DescriptionTemplateCurrencyData,
DescriptionTemplateDataRepositoryData,
DescriptionTemplateDatasetIdentifierData,
DescriptionTemplateDatePickerData,
DescriptionTemplateDmpAutoCompleteData,
DescriptionTemplateExternalDatasetData, DescriptionTemplateExternalDatasetData,
DescriptionTemplateFreeTextData, DescriptionTemplateExternalSelectData,
DescriptionTemplateLicenseData, DescriptionTemplateLabelAndMultiplicityData,
DescriptionTemplateOrganizationData, DescriptionTemplateLabelData,
DescriptionTemplatePublicationData,
DescriptionTemplateRadioBoxData, DescriptionTemplateRadioBoxData,
DescriptionTemplateRegistryData, DescriptionTemplateSelectData,
DescriptionTemplateResearcherAutoCompleteData, DescriptionTemplateSelectOption,
DescriptionTemplateRichTextAreaData, DescriptionTemplateUploadData
DescriptionTemplateServiceData,
DescriptionTemplateTagData,
DescriptionTemplateTaxonomyData,
DescriptionTemplateTextAreaData,
DescriptionTemplateUploadData,
DescriptionTemplateValidationData,
DescriptionTemplateSelectData
} from '@app/core/model/description-template/description-template'; } from '@app/core/model/description-template/description-template';
import { DescriptionTemplateFieldPersist } from '@app/core/model/description-template/description-template-persist'; import { DescriptionTemplateFieldPersist } from '@app/core/model/description-template/description-template-persist';
import { ConfigurationService } from "@app/core/services/configuration/configuration.service"; import { ConfigurationService } from "@app/core/services/configuration/configuration.service";
@ -121,7 +104,8 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
case DescriptionTemplateFieldType.FREE_TEXT: case DescriptionTemplateFieldType.FREE_TEXT:
case DescriptionTemplateFieldType.BOOLEAN_DECISION: case DescriptionTemplateFieldType.BOOLEAN_DECISION:
case DescriptionTemplateFieldType.RADIO_BOX: case DescriptionTemplateFieldType.RADIO_BOX:
case DescriptionTemplateFieldType.COMBO_BOX: case DescriptionTemplateFieldType.SELECT:
case DescriptionTemplateFieldType.EXTERNAL_SELECT:
case DescriptionTemplateFieldType.CHECK_BOX: case DescriptionTemplateFieldType.CHECK_BOX:
case DescriptionTemplateFieldType.DATE_PICKER: case DescriptionTemplateFieldType.DATE_PICKER:
return true; return true;
@ -131,7 +115,7 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
onInputTypeChange() { onInputTypeChange() {
const x = this.fieldType; const type = this.fieldType;
const field: DescriptionTemplateFieldPersist = this.form.getRawValue(); const field: DescriptionTemplateFieldPersist = this.form.getRawValue();
field.defaultValue = undefined; field.defaultValue = undefined;
@ -139,260 +123,92 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
field.visibilityRules = []; field.visibilityRules = [];
} }
switch (type) {
switch (x) { case DescriptionTemplateFieldType.EXTERNAL_SELECT: {
case DescriptionTemplateFieldType.BOOLEAN_DECISION: { const data: DescriptionTemplateExternalSelectData = {
sources: [],
const data: DescriptionTemplateBooleanDecisionData = { multipleSelect: false,
label: '', label: '',
fieldType: DescriptionTemplateFieldType.BOOLEAN_DECISION, fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.CHECK_BOX: {
const data: DescriptionTemplateCheckBoxData = {
label: '',
fieldType: DescriptionTemplateFieldType.CHECK_BOX,
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.SELECT: {
const firstOption = { label: '', value: '' } as DescriptionTemplateComboBoxOption;
const data: DescriptionTemplateSelectData = {
label: '',
multiList: false,
options: [firstOption],
fieldType: DescriptionTemplateFieldType.SELECT
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.AUTO_COMPLETE: {
const data: DescriptionTemplateAutoCompleteData = {
autoCompleteSingleDataList: [],
multiAutoComplete: false,
label: '',
fieldType: DescriptionTemplateFieldType.AUTO_COMPLETE
}
field.data = data;
break;
} case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES: {
const data: DescriptionTemplateDmpAutoCompleteData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.FREE_TEXT: {
const data: DescriptionTemplateFreeTextData = {
label: '',
fieldType: DescriptionTemplateFieldType.FREE_TEXT
} }
field.data = data; field.data = data;
break; break;
} }
case DescriptionTemplateFieldType.RADIO_BOX: { case DescriptionTemplateFieldType.RADIO_BOX: {
const data: DescriptionTemplateRadioBoxData = { const data: DescriptionTemplateRadioBoxData = {
label: '', label: '',
options: [], options: [],
fieldType: DescriptionTemplateFieldType.RADIO_BOX fieldType: type
} }
field.data = data; field.data = data;
break; break;
} }
case DescriptionTemplateFieldType.TEXT_AREA: { case DescriptionTemplateFieldType.SELECT: {
const firstOption = { label: '', value: '' } as DescriptionTemplateSelectOption;
const data: DescriptionTemplateTextAreaData = { const data: DescriptionTemplateSelectData = {
label: '', label: '',
fieldType: DescriptionTemplateFieldType.TEXT_AREA multipleSelect: false,
options: [firstOption],
fieldType: type
} }
field.data = data; field.data = data;
break; break;
} }
case DescriptionTemplateFieldType.RICH_TEXT_AREA: { case DescriptionTemplateFieldType.BOOLEAN_DECISION:
case DescriptionTemplateFieldType.CHECK_BOX:
const data: DescriptionTemplateRichTextAreaData = { case DescriptionTemplateFieldType.FREE_TEXT:
case DescriptionTemplateFieldType.TEXT_AREA:
case DescriptionTemplateFieldType.RICH_TEXT_AREA:
case DescriptionTemplateFieldType.DATE_PICKER:
case DescriptionTemplateFieldType.TAGS:
case DescriptionTemplateFieldType.DATASET_IDENTIFIER:
case DescriptionTemplateFieldType.CURRENCY:
case DescriptionTemplateFieldType.VALIDATION: {
const data: DescriptionTemplateLabelData = {
label: '', label: '',
fieldType: DescriptionTemplateFieldType.RICH_TEXT_AREA fieldType: type
} }
field.data = data; field.data = data;
break; break;
} }
case DescriptionTemplateFieldType.UPLOAD: { case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS:
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS:
const data: DescriptionTemplateUploadData = { case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DATASETS:
case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
case DescriptionTemplateFieldType.DATA_REPOSITORIES:
case DescriptionTemplateFieldType.JOURNAL_REPOSITORIES:
case DescriptionTemplateFieldType.PUB_REPOSITORIES:
case DescriptionTemplateFieldType.LICENSES:
case DescriptionTemplateFieldType.TAXONOMIES:
case DescriptionTemplateFieldType.PUBLICATIONS:
case DescriptionTemplateFieldType.REGISTRIES:
case DescriptionTemplateFieldType.SERVICES:
case DescriptionTemplateFieldType.RESEARCHERS:
case DescriptionTemplateFieldType.ORGANIZATIONS: {
const data: DescriptionTemplateLabelAndMultiplicityData = {
label: '', label: '',
types: [], multipleSelect: false,
maxFileSizeInMB: this.configurationService.maxFileSizeInMB, fieldType: type
fieldType: DescriptionTemplateFieldType.UPLOAD
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.DATE_PICKER: {
const data: DescriptionTemplateDatePickerData = {
label: '',
fieldType: DescriptionTemplateFieldType.DATE_PICKER
} }
field.data = data; field.data = data;
break; break;
} }
case DescriptionTemplateFieldType.EXTERNAL_DATASETS: { case DescriptionTemplateFieldType.EXTERNAL_DATASETS: {
const data: DescriptionTemplateExternalDatasetData = { const data: DescriptionTemplateExternalDatasetData = {
label: '', label: '',
multiAutoComplete: false, multipleSelect: false,
fieldType: DescriptionTemplateFieldType.EXTERNAL_DATASETS fieldType: type
} }
field.data = data; field.data = data;
break; break;
} }
case DescriptionTemplateFieldType.DATA_REPOSITORIES: { case DescriptionTemplateFieldType.UPLOAD: {
const data: DescriptionTemplateUploadData = {
const data: DescriptionTemplateDataRepositoryData = {
label: '', label: '',
multiAutoComplete: false, types: [],
fieldType: DescriptionTemplateFieldType.DATA_REPOSITORIES maxFileSizeInMB: this.configurationService.maxFileSizeInMB,
} fieldType: type
field.data = data;
break;
}
case DescriptionTemplateFieldType.PUB_REPOSITORIES: {
const data: DescriptionTemplateDataRepositoryData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.DATA_REPOSITORIES
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.JOURNAL_REPOSITORIES: {
const data: DescriptionTemplateDataRepositoryData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.DATA_REPOSITORIES
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.TAXONOMIES: {
const data: DescriptionTemplateTaxonomyData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.TAXONOMIES
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.LICENSES: {
const data: DescriptionTemplateLicenseData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.LICENSES
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.PUBLICATIONS: {
const data: DescriptionTemplatePublicationData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.PUBLICATIONS
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.REGISTRIES: {
const data: DescriptionTemplateRegistryData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.REGISTRIES
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.SERVICES: {
const data: DescriptionTemplateServiceData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.SERVICES
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.TAGS: {
const data: DescriptionTemplateTagData = {
label: '',
fieldType: DescriptionTemplateFieldType.TAGS
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.RESEARCHERS: {
const data: DescriptionTemplateResearcherAutoCompleteData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.RESEARCHERS
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.ORGANIZATIONS: {
const data: DescriptionTemplateOrganizationData = {
// autoCompleteSingleDataList: [], //TODO maybe remove
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.ORGANIZATIONS
};
field.data = data;
break;
}
case DescriptionTemplateFieldType.DATASET_IDENTIFIER: {
const data: DescriptionTemplateDatasetIdentifierData = {
label: '',
fieldType: DescriptionTemplateFieldType.DATASET_IDENTIFIER
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.CURRENCY: {
const data: DescriptionTemplateCurrencyData = {
label: '',
fieldType: DescriptionTemplateFieldType.CURRENCY
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.VALIDATION: {
const data: DescriptionTemplateValidationData = {
label: '',
fieldType: DescriptionTemplateFieldType.VALIDATION
} }
field.data = data; field.data = data;
break; break;

View File

@ -19,12 +19,7 @@
<ng-container *ngTemplateOutlet="actions"></ng-container> <ng-container *ngTemplateOutlet="actions"></ng-container>
</div> </div>
</div> </div>
<!-- {{formGroup?.value | json}} -->
<div class="row stepper-navigation-outer-wrapper"> <div class="row stepper-navigation-outer-wrapper">
<!-- Steps Navigation --> <!-- Steps Navigation -->
<div id="stepper-navigation-wrapper"> <div id="stepper-navigation-wrapper">
<div class="col-12 d-flex" *ngIf="steps" id="stepper-navigation"> <div class="col-12 d-flex" *ngIf="steps" id="stepper-navigation">
@ -50,9 +45,6 @@
</div> </div>
</div> </div>
<mat-horizontal-stepper [linear]="true" #stepper class="stepper" (selectionChange)="onMatStepperSelectionChange($event)" style="padding-left: 8px; padding-right: 15px;"> <mat-horizontal-stepper [linear]="true" #stepper class="stepper" (selectionChange)="onMatStepperSelectionChange($event)" style="padding-left: 8px; padding-right: 15px;">
<!-- IMPORTANT TO BE !INVALID (WHEN THE TEMPLATE IS FINALIZED THE CONTORLS ARE DISABLED) --> <!-- IMPORTANT TO BE !INVALID (WHEN THE TEMPLATE IS FINALIZED THE CONTORLS ARE DISABLED) -->

View File

@ -432,47 +432,51 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
//build parent pages //build parent pages
(this.formGroup.get('definition').get('pages') as UntypedFormArray).controls.forEach((pageElement, i) => { (this.formGroup.get('definition').get('pages') as UntypedFormArray).controls.forEach((pageElement, i) => {
result.push({
const page = {
id: pageElement.get('id').value, id: pageElement.get('id').value,
label: pageElement.get('title').value, label: pageElement.get('title').value,
type: ToCEntryType.Page, type: ToCEntryType.Page,
form: pageElement, form: pageElement,
numbering: (i + 1).toString(), numbering: (i + 1).toString(),
subEntriesType: ToCEntryType.Section subEntriesType: ToCEntryType.Section,
} as ToCEntry) subEntries: []
});
// build first level sections
(this.formGroup.get('definition').get('sections') as UntypedFormArray).controls.forEach((sectionElement, i) => {
const currentSectionPageId = sectionElement.get('page').value;
const pageToAdd = result.filter(x => x.id == currentSectionPageId)[0];
if (pageToAdd.subEntries == null) pageToAdd.subEntries = [];
const item = {
id: sectionElement.get('id').value,
label: sectionElement.get('title').value,
type: ToCEntryType.Section,
form: sectionElement,
numbering: pageToAdd.numbering + '.' + (pageToAdd.subEntries.length + 1)
} as ToCEntry; } as ToCEntry;
const sectionItems = this.populateSections(sectionElement.get('sections') as UntypedFormArray, item.numbering);
const fieldSetItems = this.populateFieldSets(sectionElement.get('fieldSets') as UntypedFormArray, item.numbering); const subEntries = [];
if (sectionItems != null) { (pageElement.get('sections') as UntypedFormArray).controls.forEach((sectionElement, i) => {
item.subEntries = sectionItems;
item.subEntriesType = ToCEntryType.Section; const item = {
} id: sectionElement.get('id').value,
if (fieldSetItems != null) { label: sectionElement.get('title').value,
if (item.subEntries == null) { type: ToCEntryType.Section,
item.subEntries = fieldSetItems; form: sectionElement,
} else { numbering: page.numbering + '.' + (subEntries.length + 1)
item.subEntries.push(...fieldSetItems); } as ToCEntry;
const sectionItems = this.populateSections(sectionElement.get('sections') as UntypedFormArray, item.numbering);
const fieldSetItems = this.populateFieldSets(sectionElement.get('fieldSets') as UntypedFormArray, item.numbering);
if (sectionItems != null) {
item.subEntries = sectionItems;
item.subEntriesType = ToCEntryType.Section;
} }
item.subEntriesType = ToCEntryType.FieldSet;
} if (fieldSetItems != null) {
pageToAdd.subEntries.push(item); if (item.subEntries == null) {
item.subEntries = fieldSetItems;
} else {
item.subEntries.push(...fieldSetItems);
}
item.subEntriesType = ToCEntryType.FieldSet;
}
subEntries.push(item);
});
page.subEntries = subEntries;
result.push(page);
}); });
this._sortToCentries(result);//ordeby ordinal this._sortToCentries(result);//ordeby ordinal
this._updateNumbering(result, '');//update nubering if needed this._updateNumbering(result, '');//update nubering if needed
return result; return result;
@ -555,7 +559,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
return tocEntryFound ? tocEntryFound : null; return tocEntryFound ? tocEntryFound : null;
} }
private reaplyValidators(){ private reaplyValidators() {
DescriptionTemplateEditorModel.reApplyDefinitionValidators( DescriptionTemplateEditorModel.reApplyDefinitionValidators(
{ {
formGroup: this.formGroup, formGroup: this.formGroup,
@ -567,7 +571,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
addNewEntry(tce: NewEntryType) { addNewEntry(tce: NewEntryType) {
const parent = tce.parent; const parent = tce.parent;
//define entry type // define entry type
switch (tce.childType) { switch (tce.childType) {
case ToCEntryType.Page: case ToCEntryType.Page:
const pagesArray = (this.formGroup.get('definition').get('pages') as UntypedFormArray); const pagesArray = (this.formGroup.get('definition').get('pages') as UntypedFormArray);
@ -591,13 +595,9 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
let sectionsArray: UntypedFormArray; let sectionsArray: UntypedFormArray;
if (parent.type === ToCEntryType.Page) {//FIRST LEVEL SECTION if (parent.type === ToCEntryType.Page) {//FIRST LEVEL SECTION
sectionsArray = this.formGroup.get('definition').get('sections') as UntypedFormArray; sectionsArray = (this.formGroup.get('definition').get('pages') as FormArray).controls.find(x => x.get('id')?.value === parent.id).get('sections') as UntypedFormArray;
section.page = parent.id;
try { try {
const max = sectionsArray.controls.filter(control => control.get('page').value === parent.id) const max = sectionsArray.controls.map(control => control.get('ordinal').value)
.map(control => control.get('ordinal').value)
.reduce((a, b) => Math.max(a, b)); .reduce((a, b) => Math.max(a, b));
section.ordinal = max + 1; section.ordinal = max + 1;
@ -612,7 +612,6 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
sectionsArray = parent.form.get('sections') as UntypedFormArray; sectionsArray = parent.form.get('sections') as UntypedFormArray;
//adding page parent MAYBE NOT NEEDED //adding page parent MAYBE NOT NEEDED
section.page = parent.form.get('page').value;
try { try {
const maxOrdinal = sectionsArray.controls.map(control => control.get('ordinal').value).reduce((a, b) => Math.max(a, b)); const maxOrdinal = sectionsArray.controls.map(control => control.get('ordinal').value).reduce((a, b) => Math.max(a, b));
section.ordinal = maxOrdinal + 1; section.ordinal = maxOrdinal + 1;
@ -640,9 +639,11 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
case ToCEntryType.FieldSet: case ToCEntryType.FieldSet:
let sectionIndex = -1; let sectionIndex = -1;
const sections = (this.formGroup.get('definition').get('sections') as UntypedFormArray); const pages = (this.formGroup.get('definition').get('pages') as UntypedFormArray);
for (let i = 0; i < sections.length; i++) { for (let j = 0; j < pages.length; j++) {
const sections = (this.formGroup.get('definition').get('pages') as UntypedFormArray).at(j).get('sections') as UntypedFormArray;
for (let i = 0; i < sections?.length; i++) {
let section = sections.at(i); let section = sections.at(i);
@ -652,7 +653,8 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
break; break;
} }
} }
if(sectionIndex > -1 ){ }
if (sectionIndex > -1) {
//create one field form fieldset //create one field form fieldset
const field: DescriptionTemplateFieldEditorModel = new DescriptionTemplateFieldEditorModel(this.editorModel.validationErrorModel); const field: DescriptionTemplateFieldEditorModel = new DescriptionTemplateFieldEditorModel(this.editorModel.validationErrorModel);
field.id = Guid.create().toString(); field.id = Guid.create().toString();
@ -665,7 +667,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
// field.ordinal = fieldSet.fields.length-1; // field.ordinal = fieldSet.fields.length-1;
const fieldSetsArray = parent.form.get('fieldSets') as UntypedFormArray const fieldSetsArray = parent.form.get('fieldSets') as UntypedFormArray
const fieldForm = field.buildForm({ rootPath: 'definition.sections[' + sectionIndex + '].fieldSets[' + fieldSetsArray.length + '].fields['+ 0 + '].'}); const fieldForm = field.buildForm({ rootPath: 'definition.sections[' + sectionIndex + '].fieldSets[' + fieldSetsArray.length + '].fields[' + 0 + '].' });
//give fieldset id and ordinal //give fieldset id and ordinal
const fieldSet: DescriptionTemplateFieldSetEditorModel = new DescriptionTemplateFieldSetEditorModel(this.editorModel.validationErrorModel); const fieldSet: DescriptionTemplateFieldSetEditorModel = new DescriptionTemplateFieldSetEditorModel(this.editorModel.validationErrorModel);
@ -678,7 +680,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
} catch { } catch {
fieldSet.ordinal = fieldSetsArray.length; fieldSet.ordinal = fieldSetsArray.length;
} }
const fieldsetForm = fieldSet.buildForm({ rootPath: 'definition.sections[' + sectionIndex + '].fieldSets[' + fieldSetsArray.length + '].'}); const fieldsetForm = fieldSet.buildForm({ rootPath: 'definition.sections[' + sectionIndex + '].fieldSets[' + fieldSetsArray.length + '].' });
(fieldsetForm.get('fields') as UntypedFormArray).push(fieldForm); (fieldsetForm.get('fields') as UntypedFormArray).push(fieldForm);
fieldSetsArray.push(fieldsetForm); fieldSetsArray.push(fieldsetForm);
@ -688,7 +690,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
// fieldForm.updateValueAndValidity(); // fieldForm.updateValueAndValidity();
break; break;
} }
default: default:
break; break;

View File

@ -1,12 +1,11 @@
import { FormArray, FormControl, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms"; import { FormArray, FormControl, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, Validators } from "@angular/forms";
import { DescriptionTemplateFieldAutocompleteType } from "@app/core/common/enum/description-template-field-autocomplete-type";
import { DescriptionTemplateFieldDataExternalDatasetType } from "@app/core/common/enum/description-template-field-data-external-dataset-type"; import { DescriptionTemplateFieldDataExternalDatasetType } from "@app/core/common/enum/description-template-field-data-external-dataset-type";
import { DescriptionTemplateFieldType } from "@app/core/common/enum/description-template-field-type"; import { DescriptionTemplateFieldType } from "@app/core/common/enum/description-template-field-type";
import { DescriptionTemplateFieldValidationType } from "@app/core/common/enum/description-template-field-validation-type"; import { DescriptionTemplateFieldValidationType } from "@app/core/common/enum/description-template-field-validation-type";
import { DescriptionTemplateStatus } from "@app/core/common/enum/description-template-status"; import { DescriptionTemplateStatus } from "@app/core/common/enum/description-template-status";
import { UserDescriptionTemplateRole } from "@app/core/common/enum/user-description-template-role"; import { UserDescriptionTemplateRole } from "@app/core/common/enum/user-description-template-role";
import { DescriptionTemplate, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection } from "@app/core/model/description-template/description-template"; import { DescriptionTemplate, DescriptionTemplateDefinition, DescriptionTemplateExternalSelectSourceBinding, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateLabelData, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection } from "@app/core/model/description-template/description-template";
import { DescriptionTemplateAuthAutoCompleteDataPersist, DescriptionTemplateAutoCompleteDataPersist, DescriptionTemplateAutoCompleteSingleDataPersist, DescriptionTemplateBaseFieldDataPersist, DescriptionTemplateComboBoxOptionPersist, DescriptionTemplateDefinitionPersist, DescriptionTemplateFieldPersist, DescriptionTemplateFieldSetPersist, DescriptionTemplateMultiplicityPersist, DescriptionTemplatePagePersist, DescriptionTemplatePersist, DescriptionTemplatePlaceholderAndMultiplicityDataPersist, DescriptionTemplateRadioBoxDataPersist, DescriptionTemplateRadioBoxOptionPersist, DescriptionTemplateRulePersist, DescriptionTemplateSectionPersist, DescriptionTemplateUploadDataPersist, DescriptionTemplateUploadOptionPersist, DescriptionTemplateSelectDataPersist, UserDescriptionTemplatePersist, DescriptionTemplateExternalDatasetDataPersist } from "@app/core/model/description-template/description-template-persist"; import { DescriptionTemplateExternalSelectAuthDataPersist, DescriptionTemplateExternalSelectDataPersist, DescriptionTemplateExternalSelectSourcePersist, DescriptionTemplateBaseFieldDataPersist, DescriptionTemplateSelectOptionPersist, DescriptionTemplateDefinitionPersist, DescriptionTemplateFieldPersist, DescriptionTemplateFieldSetPersist, DescriptionTemplateMultiplicityPersist, DescriptionTemplatePagePersist, DescriptionTemplatePersist, DescriptionTemplateLabelAndMultiplicityDataPersist, DescriptionTemplateRadioBoxDataPersist, DescriptionTemplateRadioBoxOptionPersist, DescriptionTemplateRulePersist, DescriptionTemplateSectionPersist, DescriptionTemplateUploadDataPersist, DescriptionTemplateUploadOptionPersist, DescriptionTemplateSelectDataPersist, UserDescriptionTemplatePersist, DescriptionTemplateExternalDatasetDataPersist, DescriptionTemplateExternalSelectSourceBindingPersist, DescriptionTemplateLabelDataPersist } from "@app/core/model/description-template/description-template-persist";
import { BaseEditorModel } from "@common/base/base-form-editor-model"; import { BaseEditorModel } from "@common/base/base-form-editor-model";
import { BackendErrorValidator } from "@common/forms/validation/custom-validator"; import { BackendErrorValidator } from "@common/forms/validation/custom-validator";
import { ValidationErrorModel } from "@common/forms/validation/error-model/validation-error-model"; import { ValidationErrorModel } from "@common/forms/validation/error-model/validation-error-model";
@ -110,12 +109,6 @@ export class DescriptionTemplateEditorModel extends BaseEditorModel implements D
validationErrorModel: validationErrorModel validationErrorModel: validationErrorModel
}); });
DescriptionTemplateDefinitionEditorModel.reapplySectionsValidators({
formArray: control.get('sections') as UntypedFormArray,
rootPath: `definition.`,
validationErrorModel: validationErrorModel
});
(formGroup.get('users') as FormArray).controls?.forEach( (formGroup.get('users') as FormArray).controls?.forEach(
(control, index) => UserDescriptionTemplateEditorModel.reapplyValidators({ (control, index) => UserDescriptionTemplateEditorModel.reapplyValidators({
formGroup: control as UntypedFormGroup, formGroup: control as UntypedFormGroup,
@ -202,7 +195,6 @@ export class UserDescriptionTemplateEditorModel implements UserDescriptionTempla
export class DescriptionTemplateDefinitionEditorModel implements DescriptionTemplateDefinitionPersist { export class DescriptionTemplateDefinitionEditorModel implements DescriptionTemplateDefinitionPersist {
pages: DescriptionTemplatePageEditorModel[] = []; pages: DescriptionTemplatePageEditorModel[] = [];
sections: DescriptionTemplateSectionEditorModel[] = [];
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
@ -213,7 +205,6 @@ export class DescriptionTemplateDefinitionEditorModel implements DescriptionTemp
public fromModel(item: DescriptionTemplateDefinition): DescriptionTemplateDefinitionEditorModel { public fromModel(item: DescriptionTemplateDefinition): DescriptionTemplateDefinitionEditorModel {
if (item) { if (item) {
if (item.pages) { item.pages.map(x => this.pages.push(new DescriptionTemplatePageEditorModel(this.validationErrorModel).fromModel(x))); } if (item.pages) { item.pages.map(x => this.pages.push(new DescriptionTemplatePageEditorModel(this.validationErrorModel).fromModel(x))); }
if (item.sections) { item.sections.map(x => this.sections.push(new DescriptionTemplateSectionEditorModel(this.validationErrorModel).fromModel(x))); }
} }
return this; return this;
} }
@ -241,15 +232,6 @@ export class DescriptionTemplateDefinitionEditorModel implements DescriptionTemp
}), context.getValidation('pages') }), context.getValidation('pages')
) )
), ),
sections: this.formBuilder.array(
(this.sections ?? []).map(
(item, index) => new DescriptionTemplateSectionEditorModel(
this.validationErrorModel
).fromModel(item).buildForm({
rootPath: `${rootPath}sections[${index}].`
}), context.getValidation('sections')
)
),
}); });
} }
@ -262,7 +244,6 @@ export class DescriptionTemplateDefinitionEditorModel implements DescriptionTemp
const baseContext: ValidationContext = new ValidationContext(); const baseContext: ValidationContext = new ValidationContext();
const baseValidationArray: Validation[] = new Array<Validation>(); const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'pages', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}pages`)] }); baseValidationArray.push({ key: 'pages', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}pages`)] });
baseValidationArray.push({ key: 'sections', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}sections`)] });
baseContext.validation = baseValidationArray; baseContext.validation = baseValidationArray;
return baseContext; return baseContext;
@ -283,27 +264,13 @@ export class DescriptionTemplateDefinitionEditorModel implements DescriptionTemp
); );
} }
static reapplySectionsValidators(params: {
formArray: UntypedFormArray,
validationErrorModel: ValidationErrorModel,
rootPath: string
}): void {
const { validationErrorModel, rootPath, formArray } = params;
formArray?.controls?.forEach(
(control, index) => DescriptionTemplateSectionEditorModel.reapplyValidators({
formGroup: control as UntypedFormGroup,
rootPath: `${rootPath}sections[${index}].`,
validationErrorModel: validationErrorModel
})
);
}
} }
export class DescriptionTemplatePageEditorModel implements DescriptionTemplatePagePersist { export class DescriptionTemplatePageEditorModel implements DescriptionTemplatePagePersist {
id: string; id: string;
ordinal: number; ordinal: number;
title: string; title: string;
sections: DescriptionTemplateSectionEditorModel[] = [];
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
@ -316,6 +283,7 @@ export class DescriptionTemplatePageEditorModel implements DescriptionTemplatePa
this.id = item.id; this.id = item.id;
this.ordinal = item.ordinal; this.ordinal = item.ordinal;
this.title = item.title; this.title = item.title;
if (item.sections) { item.sections.map(x => this.sections.push(new DescriptionTemplateSectionEditorModel(this.validationErrorModel).fromModel(x))); }
} }
return this; return this;
} }
@ -336,7 +304,16 @@ export class DescriptionTemplatePageEditorModel implements DescriptionTemplatePa
return this.formBuilder.group({ return this.formBuilder.group({
id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators], id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators],
ordinal: [{ value: this.ordinal, disabled: disabled }, context.getValidation('ordinal').validators], ordinal: [{ value: this.ordinal, disabled: disabled }, context.getValidation('ordinal').validators],
title: [{ value: this.title, disabled: disabled }, context.getValidation('title').validators] title: [{ value: this.title, disabled: disabled }, context.getValidation('title').validators],
sections: this.formBuilder.array(
(this.sections ?? []).map(
(item, index) => new DescriptionTemplateSectionEditorModel(
this.validationErrorModel
).fromModel(item).buildForm({
rootPath: `${rootPath}sections[${index}].`
}), context.getValidation('sections')
)
),
}); });
} }
@ -351,11 +328,21 @@ export class DescriptionTemplatePageEditorModel implements DescriptionTemplatePa
baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}id`)] }); baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}id`)] });
baseValidationArray.push({ key: 'ordinal', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}ordinal`)] }); baseValidationArray.push({ key: 'ordinal', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}ordinal`)] });
baseValidationArray.push({ key: 'title', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}title`)] }); baseValidationArray.push({ key: 'title', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}title`)] });
baseValidationArray.push({ key: 'sections', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}sections`)] });
baseContext.validation = baseValidationArray; baseContext.validation = baseValidationArray;
return baseContext; return baseContext;
} }
static reapplySectionsValidators(params: {
formArray: UntypedFormArray,
validationErrorModel: ValidationErrorModel,
rootPath: string
}): void {
const { validationErrorModel, rootPath, formArray } = params;
}
static reapplyValidators(params: { static reapplyValidators(params: {
formGroup: UntypedFormGroup, formGroup: UntypedFormGroup,
validationErrorModel: ValidationErrorModel, validationErrorModel: ValidationErrorModel,
@ -368,6 +355,14 @@ export class DescriptionTemplatePageEditorModel implements DescriptionTemplatePa
validationErrorModel validationErrorModel
}); });
(formGroup.get('sections') as FormArray)?.controls?.forEach(
(control, index) => DescriptionTemplateSectionEditorModel.reapplyValidators({
formGroup: control as UntypedFormGroup,
rootPath: `${rootPath}sections[${index}].`,
validationErrorModel: validationErrorModel
})
);
['id', 'ordinal', 'title'].forEach(keyField => { ['id', 'ordinal', 'title'].forEach(keyField => {
const control = formGroup?.get(keyField); const control = formGroup?.get(keyField);
control?.clearValidators(); control?.clearValidators();
@ -382,10 +377,9 @@ export class DescriptionTemplateSectionEditorModel implements DescriptionTemplat
ordinal: number; ordinal: number;
defaultVisibility: boolean = false; // TODO: check if used and remove defaultVisibility: boolean = false; // TODO: check if used and remove
multiplicity: boolean = false; multiplicity: boolean = false;
page: string;
title: string; title: string;
description: string; description: string;
sections?: DescriptionTemplateSectionEditorModel[] = []; sections: DescriptionTemplateSectionEditorModel[] = [];
fieldSets: DescriptionTemplateFieldSetEditorModel[] = []; fieldSets: DescriptionTemplateFieldSetEditorModel[] = [];
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
@ -400,7 +394,6 @@ export class DescriptionTemplateSectionEditorModel implements DescriptionTemplat
this.ordinal = item.ordinal; this.ordinal = item.ordinal;
this.defaultVisibility = item.defaultVisibility; this.defaultVisibility = item.defaultVisibility;
this.multiplicity = item.multiplicity; this.multiplicity = item.multiplicity;
this.page = item.page;
this.title = item.title; this.title = item.title;
this.description = item.description; this.description = item.description;
if (item.sections) { item.sections.map(x => this.sections.push(new DescriptionTemplateSectionEditorModel(this.validationErrorModel).fromModel(x))); } if (item.sections) { item.sections.map(x => this.sections.push(new DescriptionTemplateSectionEditorModel(this.validationErrorModel).fromModel(x))); }
@ -427,7 +420,6 @@ export class DescriptionTemplateSectionEditorModel implements DescriptionTemplat
ordinal: [{ value: this.ordinal, disabled: disabled }, context.getValidation('ordinal').validators], ordinal: [{ value: this.ordinal, disabled: disabled }, context.getValidation('ordinal').validators],
defaultVisibility: [{ value: this.defaultVisibility, disabled: disabled }, context.getValidation('defaultVisibility').validators], defaultVisibility: [{ value: this.defaultVisibility, disabled: disabled }, context.getValidation('defaultVisibility').validators],
multiplicity: [{ value: this.multiplicity, disabled: disabled }, context.getValidation('multiplicity').validators], multiplicity: [{ value: this.multiplicity, disabled: disabled }, context.getValidation('multiplicity').validators],
page: [{ value: this.page, disabled: disabled }, context.getValidation('page').validators],
title: [{ value: this.title, disabled: disabled }, context.getValidation('title').validators], title: [{ value: this.title, disabled: disabled }, context.getValidation('title').validators],
description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators], description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators],
sections: this.formBuilder.array( sections: this.formBuilder.array(
@ -463,7 +455,6 @@ export class DescriptionTemplateSectionEditorModel implements DescriptionTemplat
baseValidationArray.push({ key: 'ordinal', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}ordinal`)] }); baseValidationArray.push({ key: 'ordinal', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}ordinal`)] });
baseValidationArray.push({ key: 'defaultVisibility', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}defaultVisibility`)] }); baseValidationArray.push({ key: 'defaultVisibility', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}defaultVisibility`)] });
baseValidationArray.push({ key: 'multiplicity', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}multiplicity`)] }); baseValidationArray.push({ key: 'multiplicity', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}multiplicity`)] });
baseValidationArray.push({ key: 'page', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}page`)] });
baseValidationArray.push({ key: 'title', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}title`)] }); baseValidationArray.push({ key: 'title', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}title`)] });
baseValidationArray.push({ key: 'description', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}description`)] }); baseValidationArray.push({ key: 'description', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}description`)] });
baseValidationArray.push({ key: 'sections', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}sections`)] }); baseValidationArray.push({ key: 'sections', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}sections`)] });
@ -731,7 +722,7 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
visibilityRules: DescriptionTemplateRuleEditorModel[] = []; visibilityRules: DescriptionTemplateRuleEditorModel[] = [];
validations: DescriptionTemplateFieldValidationType[] = []; validations: DescriptionTemplateFieldValidationType[] = [];
includeInExport: boolean = false; includeInExport: boolean = false;
data: DescriptionTemplateBaseFieldEditorModel = new DescriptionTemplateBaseFieldEditorModel(); data: DescriptionTemplateLabelDataEditorModel = new DescriptionTemplateLabelDataEditorModel();
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
@ -809,10 +800,10 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
return baseContext; return baseContext;
} }
private getFieldEditorModel(fieldType: DescriptionTemplateFieldType): DescriptionTemplateBaseFieldEditorModel { private getFieldEditorModel(fieldType: DescriptionTemplateFieldType): DescriptionTemplateLabelDataEditorModel {
switch (fieldType) { switch (fieldType) {
case DescriptionTemplateFieldType.AUTO_COMPLETE: case DescriptionTemplateFieldType.EXTERNAL_SELECT:
return new DescriptionTemplateAutoCompleteFieldEditorModel(this.validationErrorModel); return new DescriptionTemplateExternalSelectDataEditorModel(this.validationErrorModel);
case DescriptionTemplateFieldType.RADIO_BOX: case DescriptionTemplateFieldType.RADIO_BOX:
return new DescriptionTemplateRadioBoxFieldEditorModel(this.validationErrorModel); return new DescriptionTemplateRadioBoxFieldEditorModel(this.validationErrorModel);
case DescriptionTemplateFieldType.SELECT: case DescriptionTemplateFieldType.SELECT:
@ -827,7 +818,7 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
case DescriptionTemplateFieldType.DATASET_IDENTIFIER: case DescriptionTemplateFieldType.DATASET_IDENTIFIER:
case DescriptionTemplateFieldType.CURRENCY: case DescriptionTemplateFieldType.CURRENCY:
case DescriptionTemplateFieldType.VALIDATION: case DescriptionTemplateFieldType.VALIDATION:
return new DescriptionTemplateBaseFieldEditorModel(this.validationErrorModel); return new DescriptionTemplateLabelDataEditorModel(this.validationErrorModel);
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS: case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS:
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS: case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS:
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DATASETS: case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DATASETS:
@ -842,7 +833,7 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
case DescriptionTemplateFieldType.SERVICES: case DescriptionTemplateFieldType.SERVICES:
case DescriptionTemplateFieldType.RESEARCHERS: case DescriptionTemplateFieldType.RESEARCHERS:
case DescriptionTemplateFieldType.ORGANIZATIONS: case DescriptionTemplateFieldType.ORGANIZATIONS:
return new DescriptionTemplatePlaceholderAndMultiplicityFieldEditorModel(this.validationErrorModel); return new DescriptionTemplateLabelAndMultiplicityFieldEditorModel(this.validationErrorModel);
case DescriptionTemplateFieldType.EXTERNAL_DATASETS: case DescriptionTemplateFieldType.EXTERNAL_DATASETS:
return new DescriptionTemplateExternalDatasetFieldEditorModel(this.validationErrorModel); return new DescriptionTemplateExternalDatasetFieldEditorModel(this.validationErrorModel);
case DescriptionTemplateFieldType.UPLOAD: case DescriptionTemplateFieldType.UPLOAD:
@ -868,7 +859,7 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
control?.addValidators(context.getValidation(keyField).validators); control?.addValidators(context.getValidation(keyField).validators);
}); });
DescriptionTemplateBaseFieldEditorModel.reapplyBaseFieldValidators({ DescriptionTemplateLabelDataEditorModel.reapplyBaseFieldValidators({
formGroup: formGroup?.get('data') as UntypedFormGroup, formGroup: formGroup?.get('data') as UntypedFormGroup,
rootPath: `${rootPath}data.`, rootPath: `${rootPath}data.`,
validationErrorModel: validationErrorModel validationErrorModel: validationErrorModel
@ -884,7 +875,7 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
} }
} }
export class DescriptionTemplateBaseFieldEditorModel implements DescriptionTemplateBaseFieldDataPersist { export class DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateLabelDataPersist {
label: string; label: string;
fieldType: DescriptionTemplateFieldType; fieldType: DescriptionTemplateFieldType;
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
@ -893,7 +884,7 @@ export class DescriptionTemplateBaseFieldEditorModel implements DescriptionTempl
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
) { } ) { }
fromModel(item: DescriptionTemplateBaseFieldDataPersist): DescriptionTemplateBaseFieldEditorModel { fromModel(item: DescriptionTemplateLabelData): DescriptionTemplateLabelDataEditorModel {
if (item) { if (item) {
this.label = item.label; this.label = item.label;
this.fieldType = item.fieldType; this.fieldType = item.fieldType;
@ -908,7 +899,7 @@ export class DescriptionTemplateBaseFieldEditorModel implements DescriptionTempl
}): UntypedFormGroup { }): UntypedFormGroup {
let { context = null, disabled = false, rootPath } = params ?? {} let { context = null, disabled = false, rootPath } = params ?? {}
if (context == null) { if (context == null) {
context = DescriptionTemplateBaseFieldEditorModel.createValidationContext({ context = DescriptionTemplateLabelDataEditorModel.createValidationContext({
validationErrorModel: this.validationErrorModel, validationErrorModel: this.validationErrorModel,
rootPath rootPath
}); });
@ -942,7 +933,7 @@ export class DescriptionTemplateBaseFieldEditorModel implements DescriptionTempl
}): void { }): void {
const { formGroup, rootPath, validationErrorModel } = params; const { formGroup, rootPath, validationErrorModel } = params;
const context = DescriptionTemplateBaseFieldEditorModel.createValidationContext({ const context = DescriptionTemplateLabelDataEditorModel.createValidationContext({
rootPath, rootPath,
validationErrorModel validationErrorModel
}); });
@ -955,18 +946,18 @@ export class DescriptionTemplateBaseFieldEditorModel implements DescriptionTempl
} }
} }
export class DescriptionTemplatePlaceholderAndMultiplicityFieldEditorModel extends DescriptionTemplateBaseFieldEditorModel implements DescriptionTemplatePlaceholderAndMultiplicityDataPersist { export class DescriptionTemplateLabelAndMultiplicityFieldEditorModel extends DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateLabelAndMultiplicityDataPersist {
multiAutoComplete: boolean; multipleSelect: boolean;
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
constructor( constructor(
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
) { super(validationErrorModel); } ) { super(validationErrorModel); }
fromModel(item: DescriptionTemplatePlaceholderAndMultiplicityDataPersist): DescriptionTemplatePlaceholderAndMultiplicityFieldEditorModel { fromModel(item: DescriptionTemplateLabelAndMultiplicityDataPersist): DescriptionTemplateLabelAndMultiplicityFieldEditorModel {
if (item) { if (item) {
super.fromModel(item); super.fromModel(item);
this.multiAutoComplete = item.multiAutoComplete; this.multipleSelect = item.multipleSelect;
} }
return this; return this;
} }
@ -978,14 +969,14 @@ export class DescriptionTemplatePlaceholderAndMultiplicityFieldEditorModel exten
}): UntypedFormGroup { }): UntypedFormGroup {
let { context = null, disabled = false, rootPath } = params ?? {} let { context = null, disabled = false, rootPath } = params ?? {}
if (context == null) { if (context == null) {
context = DescriptionTemplatePlaceholderAndMultiplicityFieldEditorModel.createValidationContext({ context = DescriptionTemplateLabelAndMultiplicityFieldEditorModel.createValidationContext({
validationErrorModel: this.validationErrorModel, validationErrorModel: this.validationErrorModel,
rootPath rootPath
}); });
} }
const formGroup = super.buildForm({ context, disabled, rootPath }); const formGroup = super.buildForm({ context, disabled, rootPath });
formGroup.setControl('multiAutoComplete', new FormControl({ value: this.multiAutoComplete, disabled: disabled }, context.getValidation('multiAutoComplete').validators)); formGroup.setControl('multipleSelect', new FormControl({ value: this.multipleSelect, disabled: disabled }, context.getValidation('multipleSelect').validators));
return formGroup; return formGroup;
} }
@ -995,7 +986,7 @@ export class DescriptionTemplatePlaceholderAndMultiplicityFieldEditorModel exten
}): ValidationContext { }): ValidationContext {
const { rootPath = '', validationErrorModel } = params; const { rootPath = '', validationErrorModel } = params;
const baseContext: ValidationContext = super.createValidationContext({ rootPath, validationErrorModel }); const baseContext: ValidationContext = super.createValidationContext({ rootPath, validationErrorModel });
baseContext.validation.push({ key: 'multiAutoComplete', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}multiAutoComplete`)] }); baseContext.validation.push({ key: 'multipleSelect', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}multipleSelect`)] });
return baseContext; return baseContext;
} }
@ -1006,12 +997,12 @@ export class DescriptionTemplatePlaceholderAndMultiplicityFieldEditorModel exten
}): void { }): void {
const { formGroup, rootPath, validationErrorModel } = params; const { formGroup, rootPath, validationErrorModel } = params;
const context = DescriptionTemplatePlaceholderAndMultiplicityFieldEditorModel.createValidationContext({ const context = DescriptionTemplateLabelAndMultiplicityFieldEditorModel.createValidationContext({
rootPath, rootPath,
validationErrorModel validationErrorModel
}); });
['multiAutoComplete'].forEach(keyField => { ['multipleSelect'].forEach(keyField => {
const control = formGroup?.get(keyField); const control = formGroup?.get(keyField);
control?.clearValidators(); control?.clearValidators();
control?.addValidators(context.getValidation(keyField).validators); control?.addValidators(context.getValidation(keyField).validators);
@ -1024,7 +1015,7 @@ export class DescriptionTemplatePlaceholderAndMultiplicityFieldEditorModel exten
// External Dataset Field // External Dataset Field
// //
// //
export class DescriptionTemplateExternalDatasetFieldEditorModel extends DescriptionTemplatePlaceholderAndMultiplicityFieldEditorModel implements DescriptionTemplateExternalDatasetDataPersist { export class DescriptionTemplateExternalDatasetFieldEditorModel extends DescriptionTemplateLabelAndMultiplicityFieldEditorModel implements DescriptionTemplateExternalDatasetDataPersist {
type: DescriptionTemplateFieldDataExternalDatasetType; type: DescriptionTemplateFieldDataExternalDatasetType;
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
@ -1091,23 +1082,23 @@ export class DescriptionTemplateExternalDatasetFieldEditorModel extends Descript
// //
// //
// Autocomplete Field // External Select Field
// //
// //
export class DescriptionTemplateAutoCompleteFieldEditorModel extends DescriptionTemplateBaseFieldEditorModel implements DescriptionTemplateAutoCompleteDataPersist { export class DescriptionTemplateExternalSelectDataEditorModel extends DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateExternalSelectDataPersist {
multiAutoComplete: boolean; multipleSelect: boolean;
autoCompleteSingleDataList: DescriptionTemplateAutoCompleteSingleDataEditorModel[] = []; sources: DescriptionTemplateExternalSelectSourceEditorModel[] = [];
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
constructor( constructor(
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
) { super(validationErrorModel); } ) { super(validationErrorModel); }
fromModel(item: DescriptionTemplateAutoCompleteDataPersist): DescriptionTemplateAutoCompleteFieldEditorModel { fromModel(item: DescriptionTemplateExternalSelectDataPersist): DescriptionTemplateExternalSelectDataEditorModel {
if (item) { if (item) {
super.fromModel(item); super.fromModel(item);
this.multiAutoComplete = item.multiAutoComplete; this.multipleSelect = item.multipleSelect;
if (item.autoCompleteSingleDataList) { item.autoCompleteSingleDataList.map(x => this.autoCompleteSingleDataList.push(new DescriptionTemplateAutoCompleteSingleDataEditorModel(this.validationErrorModel).fromModel(x))); } if (item.sources) { item.sources.map(x => this.sources.push(new DescriptionTemplateExternalSelectSourceEditorModel(this.validationErrorModel).fromModel(x))); }
} }
return this; return this;
} }
@ -1119,21 +1110,21 @@ export class DescriptionTemplateAutoCompleteFieldEditorModel extends Description
}): UntypedFormGroup { }): UntypedFormGroup {
let { context = null, disabled = false, rootPath } = params ?? {} let { context = null, disabled = false, rootPath } = params ?? {}
if (context == null) { if (context == null) {
context = DescriptionTemplateAutoCompleteFieldEditorModel.createValidationContext({ context = DescriptionTemplateExternalSelectDataEditorModel.createValidationContext({
validationErrorModel: this.validationErrorModel, validationErrorModel: this.validationErrorModel,
rootPath rootPath
}); });
} }
const formGroup = super.buildForm({ context, disabled, rootPath }); const formGroup = super.buildForm({ context, disabled, rootPath });
formGroup.setControl('multiAutoComplete', new FormControl({ value: this.multiAutoComplete, disabled: disabled }, context.getValidation('multiAutoComplete').validators)); formGroup.setControl('multipleSelect', new FormControl({ value: this.multipleSelect, disabled: disabled }, context.getValidation('multipleSelect').validators));
formGroup.setControl('autoCompleteSingleDataList', this.formBuilder.array( formGroup.setControl('sources', this.formBuilder.array(
(this.autoCompleteSingleDataList ?? []).map( (this.sources ?? []).map(
(item, index) => new DescriptionTemplateAutoCompleteSingleDataEditorModel( (item, index) => new DescriptionTemplateExternalSelectSourceEditorModel(
this.validationErrorModel this.validationErrorModel
).fromModel(item).buildForm({ ).fromModel(item).buildForm({
rootPath: `${rootPath}autoCompleteSingleDataList[${index}].` rootPath: `${rootPath}sources[${index}].`
}), context.getValidation('autoCompleteSingleDataList') }), context.getValidation('sources')
))); )));
return formGroup; return formGroup;
} }
@ -1144,8 +1135,8 @@ export class DescriptionTemplateAutoCompleteFieldEditorModel extends Description
}): ValidationContext { }): ValidationContext {
const { rootPath = '', validationErrorModel } = params; const { rootPath = '', validationErrorModel } = params;
const baseContext: ValidationContext = super.createValidationContext({ rootPath, validationErrorModel }); const baseContext: ValidationContext = super.createValidationContext({ rootPath, validationErrorModel });
baseContext.validation.push({ key: 'multiAutoComplete', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}multiAutoComplete`)] }); baseContext.validation.push({ key: 'multipleSelect', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}multipleSelect`)] });
baseContext.validation.push({ key: 'autoCompleteSingleDataList', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}autoCompleteSingleDataList`)] }); baseContext.validation.push({ key: 'sources', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}sources`)] });
return baseContext; return baseContext;
} }
@ -1156,21 +1147,21 @@ export class DescriptionTemplateAutoCompleteFieldEditorModel extends Description
}): void { }): void {
const { formGroup, rootPath, validationErrorModel } = params; const { formGroup, rootPath, validationErrorModel } = params;
const context = DescriptionTemplateAutoCompleteFieldEditorModel.createValidationContext({ const context = DescriptionTemplateExternalSelectDataEditorModel.createValidationContext({
rootPath, rootPath,
validationErrorModel validationErrorModel
}); });
['multiAutoComplete'].forEach(keyField => { ['multipleSelect'].forEach(keyField => {
const control = formGroup?.get(keyField); const control = formGroup?.get(keyField);
control?.clearValidators(); control?.clearValidators();
control?.addValidators(context.getValidation(keyField).validators); control?.addValidators(context.getValidation(keyField).validators);
}); });
(formGroup.get('options') as FormArray).controls?.forEach( (formGroup.get('options') as FormArray).controls?.forEach(
(control, index) => DescriptionTemplateAutoCompleteSingleDataEditorModel.reapplyValidators({ (control, index) => DescriptionTemplateExternalSelectSourceEditorModel.reapplyValidators({
formGroup: control as UntypedFormGroup, formGroup: control as UntypedFormGroup,
rootPath: `${rootPath}autoCompleteSingleDataList[${index}].`, rootPath: `${rootPath}sources[${index}].`,
validationErrorModel: validationErrorModel validationErrorModel: validationErrorModel
} }
) )
@ -1178,28 +1169,26 @@ export class DescriptionTemplateAutoCompleteFieldEditorModel extends Description
} }
} }
export class DescriptionTemplateAutoCompleteSingleDataEditorModel implements DescriptionTemplateAutoCompleteSingleDataPersist { export class DescriptionTemplateExternalSelectSourceEditorModel implements DescriptionTemplateExternalSelectSourcePersist {
autocompleteType: DescriptionTemplateFieldAutocompleteType;
url: string; url: string;
autoCompleteOptions: DescriptionTemplateComboBoxOptionEditorModel = new DescriptionTemplateComboBoxOptionEditorModel();
optionsRoot: string;
hasAuth: boolean;
auth: DescriptionTemplateAuthAutoCompleteDataEditorModel = new DescriptionTemplateAuthAutoCompleteDataEditorModel();
method: string; method: string;
optionsRoot: string;
sourceBinding: DescriptionTemplateExternalSelectSourceBindingEditorModel = new DescriptionTemplateExternalSelectSourceBindingEditorModel();
hasAuth: boolean;
auth: DescriptionTemplateExternalSelectAuthDataEditorModel = new DescriptionTemplateExternalSelectAuthDataEditorModel();
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
constructor( constructor(
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
) { } ) { }
fromModel(item: DescriptionTemplateAutoCompleteSingleDataPersist): DescriptionTemplateAutoCompleteSingleDataEditorModel { fromModel(item: DescriptionTemplateExternalSelectSourcePersist): DescriptionTemplateExternalSelectSourceEditorModel {
if (item) { if (item) {
this.autocompleteType = item.autocompleteType;
this.url = item.url; this.url = item.url;
this.autoCompleteOptions = new DescriptionTemplateComboBoxOptionEditorModel(this.validationErrorModel).fromModel(item.autoCompleteOptions); this.sourceBinding = new DescriptionTemplateExternalSelectSourceBindingEditorModel(this.validationErrorModel).fromModel(item.sourceBinding);
this.optionsRoot = item.optionsRoot; this.optionsRoot = item.optionsRoot;
this.hasAuth = item.hasAuth; this.hasAuth = item.hasAuth;
this.auth = new DescriptionTemplateAuthAutoCompleteDataEditorModel(this.validationErrorModel).fromModel(item.auth); this.auth = new DescriptionTemplateExternalSelectAuthDataEditorModel(this.validationErrorModel).fromModel(item.auth);
this.method = item.method; this.method = item.method;
} }
return this; return this;
@ -1212,20 +1201,19 @@ export class DescriptionTemplateAutoCompleteSingleDataEditorModel implements Des
}): UntypedFormGroup { }): UntypedFormGroup {
let { context = null, disabled = false, rootPath } = params ?? {} let { context = null, disabled = false, rootPath } = params ?? {}
if (context == null) { if (context == null) {
context = DescriptionTemplateAutoCompleteSingleDataEditorModel.createValidationContext({ context = DescriptionTemplateExternalSelectSourceEditorModel.createValidationContext({
validationErrorModel: this.validationErrorModel, validationErrorModel: this.validationErrorModel,
rootPath rootPath
}); });
} }
return this.formBuilder.group({ return this.formBuilder.group({
autocompleteType: [{ value: this.autocompleteType, disabled: disabled }, context.getValidation('autocompleteType').validators],
url: [{ value: this.url, disabled: disabled }, context.getValidation('url').validators], url: [{ value: this.url, disabled: disabled }, context.getValidation('url').validators],
optionsRoot: [{ value: this.optionsRoot, disabled: disabled }, context.getValidation('optionsRoot').validators], optionsRoot: [{ value: this.optionsRoot, disabled: disabled }, context.getValidation('optionsRoot').validators],
hasAuth: [{ value: this.hasAuth, disabled: disabled }, context.getValidation('hasAuth').validators], hasAuth: [{ value: this.hasAuth, disabled: disabled }, context.getValidation('hasAuth').validators],
method: [{ value: this.method, disabled: disabled }, context.getValidation('method').validators], method: [{ value: this.method, disabled: disabled }, context.getValidation('method').validators],
autoCompleteOptions: this.autoCompleteOptions.buildForm({ sourceBinding: this.sourceBinding.buildForm({
rootPath: `${rootPath}autoCompleteOptions.` rootPath: `${rootPath}sourceBinding.`
}), }),
auth: this.auth.buildForm({ auth: this.auth.buildForm({
rootPath: `${rootPath}auth.` rootPath: `${rootPath}auth.`
@ -1241,7 +1229,6 @@ export class DescriptionTemplateAutoCompleteSingleDataEditorModel implements Des
const baseContext: ValidationContext = new ValidationContext(); const baseContext: ValidationContext = new ValidationContext();
const baseValidationArray: Validation[] = new Array<Validation>(); const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'autocompleteType', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}autocompleteType`)] });
baseValidationArray.push({ key: 'url', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}url`)] }); baseValidationArray.push({ key: 'url', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}url`)] });
baseValidationArray.push({ key: 'optionsRoot', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}optionsRoot`)] }); baseValidationArray.push({ key: 'optionsRoot', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}optionsRoot`)] });
baseValidationArray.push({ key: 'hasAuth', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}hasAuth`)] }); baseValidationArray.push({ key: 'hasAuth', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}hasAuth`)] });
@ -1262,24 +1249,24 @@ export class DescriptionTemplateAutoCompleteSingleDataEditorModel implements Des
}): void { }): void {
const { formGroup, rootPath, validationErrorModel } = params; const { formGroup, rootPath, validationErrorModel } = params;
const context = DescriptionTemplateAutoCompleteSingleDataEditorModel.createValidationContext({ const context = DescriptionTemplateExternalSelectSourceEditorModel.createValidationContext({
rootPath, rootPath,
validationErrorModel validationErrorModel
}); });
['autocompleteType', 'url', 'optionsRoot', 'hasAuth', 'method'].forEach(keyField => { ['url', 'optionsRoot', 'hasAuth', 'method'].forEach(keyField => {
const control = formGroup?.get(keyField); const control = formGroup?.get(keyField);
control?.clearValidators(); control?.clearValidators();
control?.addValidators(context.getValidation(keyField).validators); control?.addValidators(context.getValidation(keyField).validators);
}); });
DescriptionTemplateComboBoxOptionEditorModel.reapplyValidators({ DescriptionTemplateExternalSelectSourceBindingEditorModel.reapplyValidators({
formGroup: formGroup?.get('autoCompleteOptions') as UntypedFormGroup, formGroup: formGroup?.get('sourceBinding') as UntypedFormGroup,
rootPath: `${rootPath}autoCompleteOptions.`, rootPath: `${rootPath}sourceBinding.`,
validationErrorModel: validationErrorModel validationErrorModel: validationErrorModel
}); });
DescriptionTemplateComboBoxOptionEditorModel.reapplyValidators({ DescriptionTemplateExternalSelectAuthDataEditorModel.reapplyValidators({
formGroup: formGroup?.get('auth') as UntypedFormGroup, formGroup: formGroup?.get('auth') as UntypedFormGroup,
rootPath: `${rootPath}auth.`, rootPath: `${rootPath}auth.`,
validationErrorModel: validationErrorModel validationErrorModel: validationErrorModel
@ -1288,23 +1275,19 @@ export class DescriptionTemplateAutoCompleteSingleDataEditorModel implements Des
} }
} }
export class DescriptionTemplateComboBoxOptionEditorModel implements DescriptionTemplateComboBoxOptionPersist { export class DescriptionTemplateSelectOptionEditorModel implements DescriptionTemplateSelectOptionPersist {
label: string; label: string;
value: string; value: string;
source: string;
uri: string;
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
constructor( constructor(
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
) { } ) { }
fromModel(item: DescriptionTemplateComboBoxOptionPersist): DescriptionTemplateComboBoxOptionEditorModel { fromModel(item: DescriptionTemplateSelectOptionPersist): DescriptionTemplateSelectOptionEditorModel {
if (item) { if (item) {
this.label = item.label; this.label = item.label;
this.value = item.value; this.value = item.value;
this.source = item.source;
this.uri = item.uri;
} }
return this; return this;
} }
@ -1316,7 +1299,80 @@ export class DescriptionTemplateComboBoxOptionEditorModel implements Description
}): UntypedFormGroup { }): UntypedFormGroup {
let { context = null, disabled = false, rootPath } = params ?? {} let { context = null, disabled = false, rootPath } = params ?? {}
if (context == null) { if (context == null) {
context = DescriptionTemplateComboBoxOptionEditorModel.createValidationContext({ context = DescriptionTemplateSelectOptionEditorModel.createValidationContext({
validationErrorModel: this.validationErrorModel,
rootPath
});
}
return this.formBuilder.group({
label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
value: [{ value: this.value, disabled: disabled }, context.getValidation('value').validators],
});
}
static createValidationContext(params: {
rootPath?: string,
validationErrorModel: ValidationErrorModel
}): ValidationContext {
const { rootPath = '', validationErrorModel } = params;
const baseContext: ValidationContext = new ValidationContext();
const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'label', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}label`)] });
baseValidationArray.push({ key: 'value', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}value`)] });
baseContext.validation = baseValidationArray;
return baseContext;
}
static reapplyValidators(params: {
formGroup: UntypedFormGroup,
validationErrorModel: ValidationErrorModel,
rootPath: string
}): void {
const { formGroup, rootPath, validationErrorModel } = params;
const context = DescriptionTemplateSelectOptionEditorModel.createValidationContext({
rootPath,
validationErrorModel
});
['label', 'value'].forEach(keyField => {
const control = formGroup?.get(keyField);
control?.clearValidators();
control?.addValidators(context.getValidation(keyField).validators);
})
}
}
export class DescriptionTemplateExternalSelectSourceBindingEditorModel implements DescriptionTemplateExternalSelectSourceBindingPersist {
label: string;
value: string;
source: string;
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
constructor(
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
) { }
fromModel(item: DescriptionTemplateExternalSelectSourceBinding): DescriptionTemplateExternalSelectSourceBindingEditorModel {
if (item) {
this.label = item.label;
this.value = item.value;
this.source = item.source;
}
return this;
}
buildForm(params?: {
context?: ValidationContext,
disabled?: boolean,
rootPath?: string
}): UntypedFormGroup {
let { context = null, disabled = false, rootPath } = params ?? {}
if (context == null) {
context = DescriptionTemplateExternalSelectSourceBindingEditorModel.createValidationContext({
validationErrorModel: this.validationErrorModel, validationErrorModel: this.validationErrorModel,
rootPath rootPath
}); });
@ -1326,7 +1382,6 @@ export class DescriptionTemplateComboBoxOptionEditorModel implements Description
label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators], label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
value: [{ value: this.value, disabled: disabled }, context.getValidation('value').validators], value: [{ value: this.value, disabled: disabled }, context.getValidation('value').validators],
source: [{ value: this.source, disabled: disabled }, context.getValidation('source').validators], source: [{ value: this.source, disabled: disabled }, context.getValidation('source').validators],
uri: [{ value: this.uri, disabled: disabled }, context.getValidation('uri').validators],
}); });
} }
@ -1341,7 +1396,6 @@ export class DescriptionTemplateComboBoxOptionEditorModel implements Description
baseValidationArray.push({ key: 'label', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}label`)] }); baseValidationArray.push({ key: 'label', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}label`)] });
baseValidationArray.push({ key: 'value', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}value`)] }); baseValidationArray.push({ key: 'value', validators: [Validators.required, BackendErrorValidator(validationErrorModel, `${rootPath}value`)] });
baseValidationArray.push({ key: 'source', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}source`)] }); baseValidationArray.push({ key: 'source', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}source`)] });
baseValidationArray.push({ key: 'uri', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}uri`)] });
baseContext.validation = baseValidationArray; baseContext.validation = baseValidationArray;
return baseContext; return baseContext;
@ -1354,12 +1408,12 @@ export class DescriptionTemplateComboBoxOptionEditorModel implements Description
}): void { }): void {
const { formGroup, rootPath, validationErrorModel } = params; const { formGroup, rootPath, validationErrorModel } = params;
const context = DescriptionTemplateComboBoxOptionEditorModel.createValidationContext({ const context = DescriptionTemplateExternalSelectSourceBindingEditorModel.createValidationContext({
rootPath, rootPath,
validationErrorModel validationErrorModel
}); });
['label', 'value', 'source', 'uri'].forEach(keyField => { ['label', 'value', 'source'].forEach(keyField => {
const control = formGroup?.get(keyField); const control = formGroup?.get(keyField);
control?.clearValidators(); control?.clearValidators();
control?.addValidators(context.getValidation(keyField).validators); control?.addValidators(context.getValidation(keyField).validators);
@ -1367,7 +1421,7 @@ export class DescriptionTemplateComboBoxOptionEditorModel implements Description
} }
} }
export class DescriptionTemplateAuthAutoCompleteDataEditorModel implements DescriptionTemplateAuthAutoCompleteDataPersist { export class DescriptionTemplateExternalSelectAuthDataEditorModel implements DescriptionTemplateExternalSelectAuthDataPersist {
url: string; url: string;
method: string; method: string;
body: string; body: string;
@ -1379,7 +1433,7 @@ export class DescriptionTemplateAuthAutoCompleteDataEditorModel implements Descr
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel() public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
) { } ) { }
fromModel(item: DescriptionTemplateAuthAutoCompleteDataPersist): DescriptionTemplateAuthAutoCompleteDataEditorModel { fromModel(item: DescriptionTemplateExternalSelectAuthDataPersist): DescriptionTemplateExternalSelectAuthDataEditorModel {
if (item) { if (item) {
this.url = item.url; this.url = item.url;
this.method = item.method; this.method = item.method;
@ -1397,7 +1451,7 @@ export class DescriptionTemplateAuthAutoCompleteDataEditorModel implements Descr
}): UntypedFormGroup { }): UntypedFormGroup {
let { context = null, disabled = false, rootPath } = params ?? {} let { context = null, disabled = false, rootPath } = params ?? {}
if (context == null) { if (context == null) {
context = DescriptionTemplateAuthAutoCompleteDataEditorModel.createValidationContext({ context = DescriptionTemplateExternalSelectAuthDataEditorModel.createValidationContext({
validationErrorModel: this.validationErrorModel, validationErrorModel: this.validationErrorModel,
rootPath rootPath
}); });
@ -1437,7 +1491,7 @@ export class DescriptionTemplateAuthAutoCompleteDataEditorModel implements Descr
}): void { }): void {
const { formGroup, rootPath, validationErrorModel } = params; const { formGroup, rootPath, validationErrorModel } = params;
const context = DescriptionTemplateAuthAutoCompleteDataEditorModel.createValidationContext({ const context = DescriptionTemplateExternalSelectAuthDataEditorModel.createValidationContext({
rootPath, rootPath,
validationErrorModel validationErrorModel
}); });
@ -1455,7 +1509,7 @@ export class DescriptionTemplateAuthAutoCompleteDataEditorModel implements Descr
// Radiobox Field // Radiobox Field
// //
// //
export class DescriptionTemplateRadioBoxFieldEditorModel extends DescriptionTemplateBaseFieldEditorModel implements DescriptionTemplateRadioBoxDataPersist { export class DescriptionTemplateRadioBoxFieldEditorModel extends DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateRadioBoxDataPersist {
options: DescriptionTemplateRadioBoxDataEditorModel[] = []; options: DescriptionTemplateRadioBoxDataEditorModel[] = [];
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
@ -1598,9 +1652,9 @@ export class DescriptionTemplateRadioBoxDataEditorModel implements DescriptionTe
// Select Field // Select Field
// //
// //
export class DescriptionTemplateSelectFieldEditorModel extends DescriptionTemplateBaseFieldEditorModel implements DescriptionTemplateSelectDataPersist { export class DescriptionTemplateSelectFieldEditorModel extends DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateSelectDataPersist {
options: DescriptionTemplateComboBoxOptionEditorModel[] = []; options: DescriptionTemplateSelectOptionEditorModel[] = [];
multiList: boolean; multipleSelect: boolean;
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
constructor( constructor(
@ -1610,8 +1664,8 @@ export class DescriptionTemplateSelectFieldEditorModel extends DescriptionTempla
fromModel(item: DescriptionTemplateSelectDataPersist): DescriptionTemplateSelectFieldEditorModel { fromModel(item: DescriptionTemplateSelectDataPersist): DescriptionTemplateSelectFieldEditorModel {
if (item) { if (item) {
super.fromModel(item); super.fromModel(item);
this.multiList = item.multiList; this.multipleSelect = item.multipleSelect;
if (item.options) { item.options.map(x => this.options.push(new DescriptionTemplateComboBoxOptionEditorModel(this.validationErrorModel).fromModel(x))); } if (item.options) { item.options.map(x => this.options.push(new DescriptionTemplateSelectOptionEditorModel(this.validationErrorModel).fromModel(x))); }
} }
return this; return this;
} }
@ -1630,10 +1684,10 @@ export class DescriptionTemplateSelectFieldEditorModel extends DescriptionTempla
} }
const formGroup = super.buildForm({ context, disabled, rootPath }); const formGroup = super.buildForm({ context, disabled, rootPath });
formGroup.setControl('multiList', new FormControl({ value: this.multiList, disabled: disabled }, context.getValidation('multiList').validators)); formGroup.setControl('multipleSelect', new FormControl({ value: this.multipleSelect, disabled: disabled }, context.getValidation('multipleSelect').validators));
formGroup.setControl('options', this.formBuilder.array( formGroup.setControl('options', this.formBuilder.array(
(this.options ?? []).map( (this.options ?? []).map(
(item, index) => new DescriptionTemplateComboBoxOptionEditorModel( (item, index) => new DescriptionTemplateSelectOptionEditorModel(
this.validationErrorModel this.validationErrorModel
).fromModel(item).buildForm({ ).fromModel(item).buildForm({
rootPath: `${rootPath}options[${index}].` rootPath: `${rootPath}options[${index}].`
@ -1649,7 +1703,7 @@ export class DescriptionTemplateSelectFieldEditorModel extends DescriptionTempla
const { rootPath = '', validationErrorModel } = params; const { rootPath = '', validationErrorModel } = params;
const baseContext: ValidationContext = super.createValidationContext({ rootPath, validationErrorModel }); const baseContext: ValidationContext = super.createValidationContext({ rootPath, validationErrorModel });
baseContext.validation.push({ key: 'options', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}options`)] }); baseContext.validation.push({ key: 'options', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}options`)] });
baseContext.validation.push({ key: 'multiList', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}multiList`)] }); baseContext.validation.push({ key: 'multipleSelect', validators: [BackendErrorValidator(validationErrorModel, `${rootPath}multipleSelect`)] });
return baseContext; return baseContext;
} }
@ -1665,14 +1719,14 @@ export class DescriptionTemplateSelectFieldEditorModel extends DescriptionTempla
validationErrorModel validationErrorModel
}); });
['multiList'].forEach(keyField => { ['multipleSelect'].forEach(keyField => {
const control = formGroup?.get(keyField); const control = formGroup?.get(keyField);
control?.clearValidators(); control?.clearValidators();
control?.addValidators(context.getValidation(keyField).validators); control?.addValidators(context.getValidation(keyField).validators);
}); });
(formGroup.get('options') as FormArray).controls?.forEach( (formGroup.get('options') as FormArray).controls?.forEach(
(control, index) => DescriptionTemplateComboBoxOptionEditorModel.reapplyValidators({ (control, index) => DescriptionTemplateSelectOptionEditorModel.reapplyValidators({
formGroup: control as UntypedFormGroup, formGroup: control as UntypedFormGroup,
rootPath: `${rootPath}options[${index}].`, rootPath: `${rootPath}options[${index}].`,
validationErrorModel: validationErrorModel validationErrorModel: validationErrorModel
@ -1686,7 +1740,7 @@ export class DescriptionTemplateSelectFieldEditorModel extends DescriptionTempla
// Upload Field // Upload Field
// //
// //
export class DescriptionTemplateUploadFieldEditorModel extends DescriptionTemplateBaseFieldEditorModel implements DescriptionTemplateUploadDataPersist { export class DescriptionTemplateUploadFieldEditorModel extends DescriptionTemplateLabelDataEditorModel implements DescriptionTemplateUploadDataPersist {
types: DescriptionTemplateUploadOptionEditorModel[] = []; types: DescriptionTemplateUploadOptionEditorModel[] = [];
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder(); protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { DescriptionTemplateType } from '@app/core/model/description-template-type/description-template-type'; import { DescriptionTemplateType } from '@app/core/model/description-template-type/description-template-type';
import { DescriptionTemplate, DescriptionTemplateAutoCompleteData, DescriptionTemplateBaseFieldData, DescriptionTemplateComboBoxOption, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRadioBoxData, DescriptionTemplateRadioBoxOption, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData } from '@app/core/model/description-template/description-template'; import { DescriptionTemplate, DescriptionTemplateExternalSelectData, DescriptionTemplateBaseFieldData, DescriptionTemplateSelectOption, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData } from '@app/core/model/description-template/description-template';
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service'; import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service'; import { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
import { BaseEditorResolver } from '@common/base/base-editor.resolver'; import { BaseEditorResolver } from '@common/base/base-editor.resolver';
@ -33,48 +33,45 @@ export class DescriptionTemplateEditorResolver extends BaseEditorResolver {
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.ordinal)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.ordinal)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.title)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.title)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.id)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.id)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.ordinal)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.ordinal)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.defaultVisibility)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.defaultVisibility)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.multiplicity)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.multiplicity)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.numbering)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.title)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.page)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.description)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.title)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.ordinal)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.description)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.sections)].join('.'), // TODO: it is recursive here
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.extendedDescription)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.ordinal)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.sections)].join('.'), // TODO: it is recursive here
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.id)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.id)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.ordinal)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.ordinal)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.numbering)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.numbering)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.title)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.title)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.description)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.description)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.extendedDescription)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.extendedDescription)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.additionalInformation)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.additionalInformation)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.hasCommentField)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.hasCommentField)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.multiplicity), nameof<DescriptionTemplateMultiplicity>(x => x.min)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.multiplicity), nameof<DescriptionTemplateMultiplicity>(x => x.min)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.multiplicity), nameof<DescriptionTemplateMultiplicity>(x => x.max)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.multiplicity), nameof<DescriptionTemplateMultiplicity>(x => x.max)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.multiplicity), nameof<DescriptionTemplateMultiplicity>(x => x.placeholder)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.multiplicity), nameof<DescriptionTemplateMultiplicity>(x => x.placeholder)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.multiplicity), nameof<DescriptionTemplateMultiplicity>(x => x.tableView)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.multiplicity), nameof<DescriptionTemplateMultiplicity>(x => x.tableView)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.id)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.id)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.ordinal)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.ordinal)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.numbering)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.numbering)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.schematics)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.schematics)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.defaultValue)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.defaultValue)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.defaultValue)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.defaultValue)].join('.'),
// [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.fieldType)].join('.'), // [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.fieldType)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.includeInExport)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.includeInExport)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.validations)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.validations)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.visibilityRules), nameof<DescriptionTemplateRule>(x => x.target)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.visibilityRules), nameof<DescriptionTemplateRule>(x => x.target)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.visibilityRules), nameof<DescriptionTemplateRule>(x => x.value)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.visibilityRules), nameof<DescriptionTemplateRule>(x => x.value)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.label)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.label)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.fieldType)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.fieldType)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.multiList)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.multipleSelect)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateComboBoxOption>(x => x.label)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateSelectOption>(x => x.label)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateComboBoxOption>(x => x.value)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateSelectOption>(x => x.value)].join('.'),
[nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateAutoCompleteData>(x => x.multiAutoComplete)].join('.'), [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateExternalSelectData>(x => x.multipleSelect)].join('.'),
nameof<DescriptionTemplate>(x => x.createdAt), nameof<DescriptionTemplate>(x => x.createdAt),
nameof<DescriptionTemplate>(x => x.hash), nameof<DescriptionTemplate>(x => x.hash),

View File

@ -1,8 +1,8 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateComboBoxOption, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData } from '@app/core/model/description-template/description-template'; import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateSelectOption, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateSelectData } from '@app/core/model/description-template/description-template';
import { Description, DescriptionField, DescriptionReference, DescriptionTag, PropertyDefinition } from '@app/core/model/description/description'; import { Description, DescriptionField, DescriptionReference, DescriptionTag, PropertyDefinition } from '@app/core/model/description/description';
import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection, FieldInSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; import { DescriptionTemplatesInSection, DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
import { Dmp, DmpDescriptionTemplate } from '@app/core/model/dmp/dmp'; import { Dmp, DmpDescriptionTemplate } from '@app/core/model/dmp/dmp';
import { Reference } from '@app/core/model/reference/reference'; import { Reference } from '@app/core/model/reference/reference';
import { Tag } from '@app/core/model/tag/tag'; import { Tag } from '@app/core/model/tag/tag';
@ -80,30 +80,28 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.id)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.id)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.ordinal)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.ordinal)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.title)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.title)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.id)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.id)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.ordinal)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.ordinal)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.page)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.title)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.title)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.description)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.description)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.id)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.extendedDescription)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.ordinal)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.id)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.title)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.ordinal)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.description)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.title)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.extendedDescription)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.description)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.additionalInformation)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.extendedDescription)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.hasCommentField)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.additionalInformation)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.id)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.hasCommentField)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.defaultValue)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.id)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.validations)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.defaultValue)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.visibilityRules), nameof<DescriptionTemplateRule>(x => x.target)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.validations)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.visibilityRules), nameof<DescriptionTemplateRule>(x => x.value)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.visibilityRules), nameof<DescriptionTemplateRule>(x => x.target)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.label)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.visibilityRules), nameof<DescriptionTemplateRule>(x => x.value)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.fieldType)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.label)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateBaseFieldData>(x => x.fieldType)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateSelectOption>(x => x.label)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateSelectOption>(x => x.value)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateComboBoxOption>(x => x.label)].join('.'), (prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.pages), nameof<DescriptionTemplatePage>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.multipleSelect)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateComboBoxOption>(x => x.value)].join('.'),
(prefix ? prefix + '.' : '') + [nameof<DescriptionTemplate>(x => x.definition), nameof<DescriptionTemplateDefinition>(x => x.sections), nameof<DescriptionTemplateSection>(x => x.fieldSets), nameof<DescriptionTemplateFieldSet>(x => x.fields), nameof<DescriptionTemplateField>(x => x.data), nameof<DescriptionTemplateSelectData>(x => x.multiList)].join('.'),
] ]
} }

View File

@ -16,15 +16,15 @@
<mat-error *ngIf="propertiesFormGroup.get(field.id).get('value').hasError('pattern')">{{'GENERAL.VALIDATION.URL.MESSAGE' | translate}}</mat-error> <mat-error *ngIf="propertiesFormGroup.get(field.id).get('value').hasError('pattern')">{{'GENERAL.VALIDATION.URL.MESSAGE' | translate}}</mat-error>
</mat-form-field> </mat-form-field>
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.AUTO_COMPLETE" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT" class="col-12">
<div class="row"> <div class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '')}}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '')}}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="multipleAutoCompleteConfiguration"> [configuration]="multipleAutoCompleteConfiguration">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '')}}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '')}}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="singleAutoCompleteConfiguration" [required]="isRequired"> [configuration]="singleAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -38,7 +38,7 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.SELECT" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.SELECT" class="col-12">
<div class="row"> <div class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<mat-select [formControl]="propertiesFormGroup.get(field.id).get('value')" placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [required]="isRequired" [multiple]="field.data.multiList"> <mat-select [formControl]="propertiesFormGroup.get(field.id).get('value')" placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [required]="isRequired" [multiple]="field.data.multipleSelect">
<mat-option *ngFor="let opt of field.data.options" [value]="opt.value">{{opt.label}} <mat-option *ngFor="let opt of field.data.options" [value]="opt.value">{{opt.label}}
</mat-option> </mat-option>
</mat-select> </mat-select>
@ -50,12 +50,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_RESEARCHERS" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_RESEARCHERS" class="col-12">
<div class="row"> <div class="row">
<mat-form-field class="col-md-12" > <mat-form-field class="col-md-12" >
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="multipleAutoCompleteConfiguration"> [configuration]="multipleAutoCompleteConfiguration">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="singleAutoCompleteConfiguration" [required]="isRequired"> [configuration]="singleAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -69,12 +69,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DATASETS" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DATASETS" class="col-12">
<div class="row"> <div class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="multipleAutoCompleteConfiguration"> [configuration]="multipleAutoCompleteConfiguration">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="singleAutoCompleteConfiguration" [required]="isRequired"> [configuration]="singleAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -88,12 +88,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DMPS" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DMPS" class="col-12">
<div class="row"> <div class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="multipleAutoCompleteConfiguration"> [configuration]="multipleAutoCompleteConfiguration">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="singleAutoCompleteConfiguration" [required]="isRequired"> [configuration]="singleAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -187,12 +187,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_DATASETS" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_DATASETS" class="col-12">
<div class="row"> <div class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="externalDatasetAutoCompleteConfiguration" [required]="isRequired"> [configuration]="externalDatasetAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="externalDatasetAutoCompleteConfiguration" [required]="isRequired"> [configuration]="externalDatasetAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -207,12 +207,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.DATA_REPOSITORIES" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.DATA_REPOSITORIES" class="col-12">
<div class="row"> <div class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="dataRepositoriesAutoCompleteConfiguration" [required]="isRequired"> [configuration]="dataRepositoriesAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="dataRepositoriesAutoCompleteConfiguration" [required]="isRequired"> [configuration]="dataRepositoriesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -226,12 +226,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.PUB_REPOSITORIES" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.PUB_REPOSITORIES" class="col-12">
<div class="row"> <div class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="pubRepositoriesAutoCompleteConfiguration" [required]="isRequired"> [configuration]="pubRepositoriesAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="pubRepositoriesAutoCompleteConfiguration" [required]="isRequired"> [configuration]="pubRepositoriesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -245,12 +245,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.JOURNAL_REPOSITORIES" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.JOURNAL_REPOSITORIES" class="col-12">
<div class="row"> <div class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="journalRepositoriesAutoCompleteConfiguration" [required]="isRequired"> [configuration]="journalRepositoriesAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="journalRepositoriesAutoCompleteConfiguration" [required]="isRequired"> [configuration]="journalRepositoriesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -265,12 +265,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.TAXONOMIES" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.TAXONOMIES" class="col-12">
<div *ngIf="field.data" class="row"> <div *ngIf="field.data" class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="taxonomiesAutoCompleteConfiguration" [required]="isRequired"> [configuration]="taxonomiesAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="taxonomiesAutoCompleteConfiguration" [required]="isRequired"> [configuration]="taxonomiesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -285,12 +285,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.LICENSES" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.LICENSES" class="col-12">
<div *ngIf="field.data" class="row"> <div *ngIf="field.data" class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="licensesAutoCompleteConfiguration" [required]="isRequired"> [configuration]="licensesAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="licensesAutoCompleteConfiguration" [required]="isRequired"> [configuration]="licensesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -305,12 +305,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.PUBLICATIONS" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.PUBLICATIONS" class="col-12">
<div *ngIf="field.data" class="row"> <div *ngIf="field.data" class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="publicationsAutoCompleteConfiguration" [required]="isRequired"> [configuration]="publicationsAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="publicationsAutoCompleteConfiguration" [required]="isRequired"> [configuration]="publicationsAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -325,12 +325,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.REGISTRIES" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.REGISTRIES" class="col-12">
<div class="row"> <div class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="registriesAutoCompleteConfiguration"> [configuration]="registriesAutoCompleteConfiguration">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="registriesAutoCompleteConfiguration" [required]="isRequired"> [configuration]="registriesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -345,12 +345,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.SERVICES" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.SERVICES" class="col-12">
<div class="row"> <div class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="servicesAutoCompleteConfiguration"> [configuration]="servicesAutoCompleteConfiguration">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="servicesAutoCompleteConfiguration" [required]="isRequired"> [configuration]="servicesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -373,12 +373,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.RESEARCHERS" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.RESEARCHERS" class="col-12">
<div class="row"> <div class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="researchersAutoCompleteConfiguration"> [configuration]="researchersAutoCompleteConfiguration">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="researchersAutoCompleteConfiguration" [required]="isRequired"> [configuration]="researchersAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>
@ -393,12 +393,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.ORGANIZATIONS" class="col-12"> <div *ngSwitchCase="descriptionTemplateFieldTypeEnum.ORGANIZATIONS" class="col-12">
<div class="row"> <div class="row">
<mat-form-field class="col-md-12"> <mat-form-field class="col-md-12">
<ng-container *ngIf="field.data.multiAutoComplete"> <ng-container *ngIf="field.data.multipleSelect">
<app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-multiple-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="organisationsAutoCompleteConfiguration"> [configuration]="organisationsAutoCompleteConfiguration">
</app-multiple-auto-complete> </app-multiple-auto-complete>
</ng-container> </ng-container>
<ng-container *ngIf="!(field.data.multiAutoComplete)"> <ng-container *ngIf="!(field.data.multipleSelect)">
<app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')" <app-single-auto-complete placeholder="{{ (field.data.label | translate) + (isRequired? ' *': '') }}" [formControl]="propertiesFormGroup.get(field.id).get('value')"
[configuration]="organisationsAutoCompleteConfiguration" [required]="isRequired"> [configuration]="organisationsAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete> </app-single-auto-complete>

View File

@ -6,7 +6,7 @@ import { MatDialog } from "@angular/material/dialog";
import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type'; import { DescriptionTemplateFieldType } from '@app/core/common/enum/description-template-field-type';
import { DescriptionTemplateFieldValidationType } from '@app/core/common/enum/description-template-field-validation-type'; import { DescriptionTemplateFieldValidationType } from '@app/core/common/enum/description-template-field-validation-type';
import { ReferenceType } from '@app/core/common/enum/reference-type'; import { ReferenceType } from '@app/core/common/enum/reference-type';
import { DescriptionTemplateAutoCompleteData, DescriptionTemplateAutoCompleteSingleData, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateUploadData, DescriptionTemplateSelectData } from '@app/core/model/description-template/description-template'; import { DescriptionTemplateExternalSelectData, DescriptionTemplateExternalSelectSource, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateSelectData, DescriptionTemplateUploadData } from '@app/core/model/description-template/description-template';
import { FetcherReference, Reference } from '@app/core/model/reference/reference'; import { FetcherReference, Reference } from '@app/core/model/reference/reference';
import { ReferenceSearchLookup } from '@app/core/query/reference-search.lookup'; import { ReferenceSearchLookup } from '@app/core/query/reference-search.lookup';
import { DmpService } from '@app/core/services/dmp/dmp.service'; import { DmpService } from '@app/core/services/dmp/dmp.service';
@ -42,7 +42,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
// @Input() form: UntypedFormGroup; // @Input() form: UntypedFormGroup;
@Input() datasetProfileId: any; @Input() datasetProfileId: any;
@Input() isChild: Boolean = false; @Input() isChild: Boolean = false;
autocompleteOptions: DescriptionTemplateAutoCompleteSingleData[]; autocompleteOptions: DescriptionTemplateExternalSelectSource[];
visible: boolean = true; visible: boolean = true;
@ -136,7 +136,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
this.isRequired = this.field.validations?.includes(DescriptionTemplateFieldValidationType.Required); this.isRequired = this.field.validations?.includes(DescriptionTemplateFieldValidationType.Required);
if (this.field?.data?.fieldType === DescriptionTemplateFieldType.SELECT) { if (this.field?.data?.fieldType === DescriptionTemplateFieldType.SELECT) {
if ((this.field.data as DescriptionTemplateSelectData).multiList) { if ((this.field.data as DescriptionTemplateSelectData).multipleSelect) {
const originalValue = <string>this.propertiesFormGroup.get(this.field.id).get('value').value; const originalValue = <string>this.propertiesFormGroup.get(this.field.id).get('value').value;
if (originalValue !== null && typeof originalValue === 'string') { if (originalValue !== null && typeof originalValue === 'string') {
let values = (<string>this.propertiesFormGroup.get(this.field.id).get('value').value).slice(1, -1).split(', ').filter((value) => !value.includes('"')); let values = (<string>this.propertiesFormGroup.get(this.field.id).get('value').value).slice(1, -1).split(', ').filter((value) => !value.includes('"'));
@ -155,8 +155,8 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
} }
// Setup autocomplete configuration if needed // Setup autocomplete configuration if needed
if (this.field?.data?.fieldType === DescriptionTemplateFieldType.AUTO_COMPLETE) { if (this.field?.data?.fieldType === DescriptionTemplateFieldType.EXTERNAL_SELECT) {
if (!((this.field.data as DescriptionTemplateAutoCompleteData).multiAutoComplete)) { if (!((this.field.data as DescriptionTemplateExternalSelectData).multipleSelect)) {
this.singleAutoCompleteConfiguration = { this.singleAutoCompleteConfiguration = {
filterFn: this.searchFromAutocomplete.bind(this), filterFn: this.searchFromAutocomplete.bind(this),
initialItems: () => this.searchFromAutocomplete(''), initialItems: () => this.searchFromAutocomplete(''),
@ -177,7 +177,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
} }
} }
if (isNullOrUndefined(this.datasetProfileId)) { if (isNullOrUndefined(this.datasetProfileId)) {
this.autocompleteOptions = (this.field.data as DescriptionTemplateAutoCompleteData).autoCompleteSingleDataList; this.autocompleteOptions = (this.field.data as DescriptionTemplateExternalSelectData).sources;
} }
} }
@ -350,7 +350,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
distinctUntilChanged() distinctUntilChanged()
) )
.subscribe(item => { .subscribe(item => {
// if (this.field?.data?.fieldType === DescriptionTemplateFieldType.ComboBox && this.form.get('data').value.type === DatasetProfileComboBoxType.Select && this.form.get('data').value.multiList) { // if (this.field?.data?.fieldType === DescriptionTemplateFieldType.ComboBox && this.form.get('data').value.type === DatasetProfileComboBoxType.Select && this.form.get('data').value.multipleSelect) {
// item.forEach(element => { // item.forEach(element => {
// this.visibilityRulesService.updateValueAndVisibility(this.field?.id, element); // this.visibilityRulesService.updateValueAndVisibility(this.field?.id, element);
// }); // });
@ -380,7 +380,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
// const autocompleteRequestItem: RequestItem<DatasetExternalAutocompleteOptionsCriteria> = new RequestItem(); // const autocompleteRequestItem: RequestItem<DatasetExternalAutocompleteOptionsCriteria> = new RequestItem();
// autocompleteRequestItem.criteria = new DatasetExternalAutocompleteOptionsCriteria(); // autocompleteRequestItem.criteria = new DatasetExternalAutocompleteOptionsCriteria();
// //TODO: refactor this // //TODO: refactor this
// //autocompleteRequestItem.criteria.autoCompleteSingleDataList = this.autocompleteOptions; // //autocompleteRequestItem.criteria.sources = this.autocompleteOptions;
// // autocompleteRequestItem.criteria.like = query; // // autocompleteRequestItem.criteria.like = query;
// // return this.datasetExternalAutocompleteService.queryApi(autocompleteRequestItem); // // return this.datasetExternalAutocompleteService.queryApi(autocompleteRequestItem);
// return null; // return null;
@ -439,7 +439,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
} }
makeAutocompleteConfiguration(myfunc: Function, title: string, subtitle?: string): void { makeAutocompleteConfiguration(myfunc: Function, title: string, subtitle?: string): void {
if (!((this.field.data as DescriptionTemplateAutoCompleteData).multiAutoComplete)) { if (!((this.field.data as DescriptionTemplateExternalSelectData).multipleSelect)) {
this.singleAutoCompleteConfiguration = { this.singleAutoCompleteConfiguration = {
filterFn: myfunc.bind(this), filterFn: myfunc.bind(this),
initialItems: (extraData) => myfunc(''), initialItems: (extraData) => myfunc(''),

View File

@ -13,7 +13,7 @@
</h4> </h4>
</mat-panel-title> </mat-panel-title>
</mat-expansion-panel-header> </mat-expansion-panel-header>
<ng-container *ngFor="let section of sectionsPerPage[page.id]; let i = index;"> <ng-container *ngFor="let section of page.sections; let i = index;">
<div class="row"> <div class="row">
<app-form-section class="col-12" [section]="section" [path]="(z+1)+'.'+(i+1)" [pathName]="'pages.'+z+'.sections.'+i" [propertiesFormGroup]="propertiesFormGroup" [visibilityRulesService]="visibilityRulesService" (askedToScroll)="onAskedToScroll(expansionPanel, $event)" [linkToScroll]="linkToScroll"></app-form-section> <app-form-section class="col-12" [section]="section" [path]="(z+1)+'.'+(i+1)" [pathName]="'pages.'+z+'.sections.'+i" [propertiesFormGroup]="propertiesFormGroup" [visibilityRulesService]="visibilityRulesService" (askedToScroll)="onAskedToScroll(expansionPanel, $event)" [linkToScroll]="linkToScroll"></app-form-section>
</div> </div>

View File

@ -32,7 +32,6 @@ export class DescriptionFormComponent extends BaseComponent implements OnInit, A
@Input() TOCENTRY_ID_PREFIX = ""; @Input() TOCENTRY_ID_PREFIX = "";
@Output() visibilityRulesInstance = new EventEmitter<VisibilityRulesService>(); @Output() visibilityRulesInstance = new EventEmitter<VisibilityRulesService>();
public sectionsPerPage: { [key: string]: DescriptionTemplateSection[] } = {};
// public hiddenEntriesIds: string[] = []; // public hiddenEntriesIds: string[] = [];
constructor( constructor(
@ -62,9 +61,7 @@ export class DescriptionFormComponent extends BaseComponent implements OnInit, A
} }
init() { init() {
this.descriptionTemplate?.definition?.pages.forEach(page => {
this.sectionsPerPage[page.id] = this.descriptionTemplate.definition.sections.filter(x => x.page == page.id);
})
// this.tocentries = this.getTocEntries(); // this.tocentries = this.getTocEntries();
// const rules_to_append = this._enrichWithMultiplicityRules(this.tocentries); // const rules_to_append = this._enrichWithMultiplicityRules(this.tocentries);

View File

@ -5,7 +5,7 @@ import { Observable, Subject } from 'rxjs';
import { VisibilityRule } from './models/visibility-rule'; import { VisibilityRule } from './models/visibility-rule';
import { VisibilityRuleSource } from './models/visibility-rule-source'; import { VisibilityRuleSource } from './models/visibility-rule-source';
import { VisibilityRulesContext } from './models/visibility-rules-context'; import { VisibilityRulesContext } from './models/visibility-rules-context';
import { DescriptionTemplate, DescriptionTemplateSection } from '@app/core/model/description-template/description-template'; import { DescriptionTemplate, DescriptionTemplatePage, DescriptionTemplateSection } from '@app/core/model/description-template/description-template';
import { Rule } from './models/rule'; import { Rule } from './models/rule';
@Injectable() @Injectable()
@ -17,7 +17,7 @@ export class VisibilityRulesService {
private visibilityRuleContext: VisibilityRulesContext; private visibilityRuleContext: VisibilityRulesContext;
private form: AbstractControl; private form: AbstractControl;
public isVisibleMap : { [key: string]: boolean } = {}; public isVisibleMap: { [key: string]: boolean } = {};
private elementVisibilityMapSubject = new Subject<{ [key: string]: boolean }>(); private elementVisibilityMapSubject = new Subject<{ [key: string]: boolean }>();
private elementComputationalMap = new Map<String, Map<String, boolean>>(); /// keep saved the values of each form control validity value private elementComputationalMap = new Map<String, Map<String, boolean>>(); /// keep saved the values of each form control validity value
@ -416,24 +416,25 @@ export class VisibilityRulesService {
public getVisibilityRulesFromDescriptionTempalte(descriptionTemplate: DescriptionTemplate): Rule[] { public getVisibilityRulesFromDescriptionTempalte(descriptionTemplate: DescriptionTemplate): Rule[] {
//console.log('getVisibilityRulesFromDescriptionTempalte: ' + descriptionTemplate); //console.log('getVisibilityRulesFromDescriptionTempalte: ' + descriptionTemplate);
const result: Rule[] = this.getVisibilityRulesFromDescriptionTempalteSections(descriptionTemplate?.definition?.sections); const result: Rule[] = this.getVisibilityRulesFromDescriptionTempalteSections(descriptionTemplate?.definition?.pages);
return result; return result;
} }
public getVisibilityRulesFromDescriptionTempalteSections(sections: DescriptionTemplateSection[]): Rule[] { public getVisibilityRulesFromDescriptionTempalteSections(pages: DescriptionTemplatePage[]): Rule[] {
//console.log('getVisibilityRulesFromDescriptionTempalteSections: ' + sections); //console.log('getVisibilityRulesFromDescriptionTempalteSections: ' + sections);
const result: Rule[] = []; const result: Rule[] = [];
pages.forEach(page => {
sections.forEach(section => { page?.sections?.forEach(section => {
if (section.sections != null) { result.push(...this.getVisibilityRulesFromDescriptionTempalteSections(section.sections)); }; if (section.sections != null) { result.push(...this.getVisibilityRulesFromDescriptionTempalteSections(section.sections)); };
section?.fieldSets?.forEach(fieldSet => { section?.fieldSets?.forEach(fieldSet => {
fieldSet?.fields?.forEach(field => { fieldSet?.fields?.forEach(field => {
field.visibilityRules?.forEach(visibilityRule => { field.visibilityRules?.forEach(visibilityRule => {
result.push({ result.push({
sourceField: field.id.toString(), sourceField: field.id.toString(),
targetField: visibilityRule.target, targetField: visibilityRule.target,
requiredValue: visibilityRule.value requiredValue: visibilityRule.value
}) })
});
}); });
}); });
}); });

View File

@ -428,7 +428,7 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
ordinal: pageElement.ordinal ordinal: pageElement.ordinal
}; };
const sections = descriptionTemplate.definition.sections.filter(x => x.page == pageElement.id); const sections = descriptionTemplate.definition.pages.find(x => x.id == pageElement.id)?.sections;
sections.forEach(section => { sections.forEach(section => {
const tempResults = this._buildRecursivelySection(section); const tempResults = this._buildRecursivelySection(section);

View File

@ -2189,7 +2189,6 @@
"DATASET-PROFILE-FIELD-VIEW-STYLE": { "DATASET-PROFILE-FIELD-VIEW-STYLE": {
"BOOLEAN-DECISION": "Boolean Decision", "BOOLEAN-DECISION": "Boolean Decision",
"CHECKBOX": "Checkbox", "CHECKBOX": "Checkbox",
"COMBO-BOX": "Combo Box",
"INTERNAL-DMP-ENTITIES": "Internal DMP Entities", "INTERNAL-DMP-ENTITIES": "Internal DMP Entities",
"FREE-TEXT": "Free Text", "FREE-TEXT": "Free Text",
"RADIO-BOX": "Radio Box", "RADIO-BOX": "Radio Box",
@ -2217,14 +2216,13 @@
}, },
"DESCRIPTION-TEMPLATE-FIELD-TYPE": { "DESCRIPTION-TEMPLATE-FIELD-TYPE": {
"COMBO-BOX": "Combo Box", "COMBO-BOX": "Combo Box",
"AUTO-COMPLETE": "Custom", "EXTERNAL-SELECT": "Custom",
"SELECT": "Select", "SELECT": "Select",
"BOOLEAN-DECISION": "Boolean Decision", "BOOLEAN-DECISION": "Boolean Decision",
"RADIO-BOX": "Radio Box", "RADIO-BOX": "Radio Box",
"INTERNAL-DMP-ENTITIES": "Internal DMP Entities", "INTERNAL-DMP-ENTITIES-RESEARCHERS": "Internal Researchers",
"INTERNAL-DMP-ENTITIES-RESEARCHERS": "Researchers", "INTERNAL-DMP-ENTITIES-DMPS": "Internal DMPs",
"INTERNAL-DMP-ENTITIES-DMPS": "DMPs", "INTERNAL-DMP-ENTITIES-DATASETS": "Internal Descriptions",
"INTERNAL-DMP-ENTITIES-DATASETS": "Descriptions",
"CHECKBOX": "Checkbox", "CHECKBOX": "Checkbox",
"FREE-TEXT": "Free Text", "FREE-TEXT": "Free Text",
"TEXT-AREA": "Text Area", "TEXT-AREA": "Text Area",