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 {
COMBO_BOX = "combobox", //Delete
AUTO_COMPLETE = "autocomplete",
SELECT = "wordlist",
EXTERNAL_SELECT = "externalSelect",
SELECT = "select",
BOOLEAN_DECISION = "booleanDecision",
RADIO_BOX = "radiobox",
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 { DescriptionTemplateFieldType } from "@app/core/common/enum/description-template-field-type";
import { DescriptionTemplateFieldValidationType } from "@app/core/common/enum/description-template-field-validation-type";
@ -25,7 +24,6 @@ export interface UserDescriptionTemplatePersist {
export interface DescriptionTemplateDefinitionPersist {
pages?: DescriptionTemplatePagePersist[];
sections?: DescriptionTemplateSectionPersist[];
}
@ -33,6 +31,7 @@ export interface DescriptionTemplatePagePersist {
id: string;
ordinal: number;
title: string;
sections: DescriptionTemplateSectionPersist[];
}
export interface DescriptionTemplateSectionPersist {
@ -40,7 +39,6 @@ export interface DescriptionTemplateSectionPersist {
ordinal: number;
defaultVisibility: boolean;
multiplicity: boolean;
page: string;
title: string;
description: string;
@ -92,115 +90,47 @@ export interface DescriptionTemplateBaseFieldDataPersist {
//
// Field Types
//
export interface DescriptionTemplateAutoCompleteDataPersist extends DescriptionTemplateBaseFieldDataPersist {
multiAutoComplete: boolean;
autoCompleteSingleDataList: DescriptionTemplateAutoCompleteSingleDataPersist[];
}
export interface DescriptionTemplateBooleanDecisionDataPersist extends DescriptionTemplateBaseFieldDataPersist {
}
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;
export interface DescriptionTemplateExternalDatasetDataPersist extends DescriptionTemplateLabelAndMultiplicityDataPersist {
type: DescriptionTemplateFieldDataExternalDatasetType;
}
export interface DescriptionTemplateFreeTextDataPersist extends DescriptionTemplateBaseFieldDataPersist {
export interface DescriptionTemplateExternalSelectDataPersist extends DescriptionTemplateLabelAndMultiplicityDataPersist {
sources: DescriptionTemplateExternalSelectSourcePersist[];
}
export interface DescriptionTemplatePlaceholderAndMultiplicityDataPersist extends DescriptionTemplateBaseFieldDataPersist {
multiAutoComplete: boolean;
}
export interface DescriptionTemplateLicenseDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
export interface DescriptionTemplateLabelAndMultiplicityDataPersist extends DescriptionTemplateBaseFieldDataPersist {
multipleSelect: boolean;
}
export interface DescriptionTemplateOrganizationDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
}
export interface DescriptionTemplatePublicationDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
export interface DescriptionTemplateLabelDataPersist extends DescriptionTemplateBaseFieldDataPersist {
}
export interface DescriptionTemplateRadioBoxDataPersist extends DescriptionTemplateBaseFieldDataPersist {
options: DescriptionTemplateRadioBoxOptionPersist[];
}
export interface DescriptionTemplateRegistryDataPersist extends DescriptionTemplatePlaceholderAndMultiplicityDataPersist {
}
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 DescriptionTemplateSelectDataPersist extends DescriptionTemplateLabelAndMultiplicityDataPersist {
options: DescriptionTemplateSelectOptionPersist[];
}
export interface DescriptionTemplateUploadDataPersist extends DescriptionTemplateBaseFieldDataPersist {
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
//
export interface DescriptionTemplateAutoCompleteSingleDataPersist {
autocompleteType: DescriptionTemplateFieldAutocompleteType;
export interface DescriptionTemplateExternalSelectSourcePersist {
url: string;
autoCompleteOptions: DescriptionTemplateComboBoxOptionPersist;
optionsRoot: string;
hasAuth: boolean;
auth: DescriptionTemplateAuthAutoCompleteDataPersist
method: string;
optionsRoot: string;
sourceBinding: DescriptionTemplateExternalSelectSourceBindingPersist;
hasAuth: boolean;
auth: DescriptionTemplateExternalSelectAuthDataPersist
}
export interface DescriptionTemplateAuthAutoCompleteDataPersist {
export interface DescriptionTemplateExternalSelectAuthDataPersist {
url: string;
method: string;
body: string;
@ -208,11 +138,15 @@ export interface DescriptionTemplateAuthAutoCompleteDataPersist {
type: string;
}
export interface DescriptionTemplateComboBoxOptionPersist {
export interface DescriptionTemplateSelectOptionPersist {
label: string;
value: string;
}
export interface DescriptionTemplateExternalSelectSourceBindingPersist {
label: string;
value: string;
source: string;
uri: string;
}
export interface DescriptionTemplateRadioBoxOptionPersist {

View File

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

View File

@ -33,11 +33,11 @@ export class FieldValuePipe implements PipeTransform {
return this.date.transform(controlValue.value, 'dd/MM/yyyy');
case DescriptionTemplateFieldType.FREE_TEXT:
return value;
case DescriptionTemplateFieldType.AUTO_COMPLETE:
case DescriptionTemplateFieldType.EXTERNAL_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;
} 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(',');
}
break;

View File

@ -156,12 +156,10 @@ export class EnumUtils {
toDescriptionTemplateFieldTypeString(status: DescriptionTemplateFieldType): string {
switch (status) {
case DescriptionTemplateFieldType.COMBO_BOX: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.COMBO-BOX');
case DescriptionTemplateFieldType.AUTO_COMPLETE: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.AUTO-COMPLETE');
case DescriptionTemplateFieldType.EXTERNAL_SELECT: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.EXTERNAL-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.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_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');

View File

@ -233,9 +233,9 @@
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Publications icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.PUBLICATIONS)}}
</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">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.AUTO_COMPLETE)}}
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT)}}
</button>
</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 { ValidationType } from '@app/core/common/enum/validation-type';
import {
DescriptionTemplateAutoCompleteData,
DescriptionTemplateBooleanDecisionData,
DescriptionTemplateCheckBoxData,
DescriptionTemplateComboBoxOption,
DescriptionTemplateCurrencyData,
DescriptionTemplateDataRepositoryData,
DescriptionTemplateDatasetIdentifierData,
DescriptionTemplateDatePickerData,
DescriptionTemplateDmpAutoCompleteData,
DescriptionTemplateExternalSelectData,
DescriptionTemplateSelectOption,
DescriptionTemplateExternalDatasetData,
DescriptionTemplateField,
DescriptionTemplateFreeTextData,
DescriptionTemplateLicenseData,
DescriptionTemplateOrganizationData,
DescriptionTemplatePublicationData,
DescriptionTemplateRadioBoxData,
DescriptionTemplateRegistryData,
DescriptionTemplateResearcherAutoCompleteData,
DescriptionTemplateRichTextAreaData,
DescriptionTemplateServiceData,
DescriptionTemplateTagData,
DescriptionTemplateTaxonomyData,
DescriptionTemplateTextAreaData,
DescriptionTemplateUploadData,
DescriptionTemplateValidationData,
DescriptionTemplateSelectData
DescriptionTemplateSelectData,
DescriptionTemplateLabelData,
DescriptionTemplateLabelAndMultiplicityData
} from '@app/core/model/description-template/description-template';
import { ConfigurationService } from "@app/core/services/configuration/configuration.service";
import { DescriptionTemplateService } from '@app/core/services/description-template/description-template.service';
@ -497,258 +480,91 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
} as DescriptionTemplateField;
switch (type) {
case DescriptionTemplateFieldType.BOOLEAN_DECISION: {
const data: DescriptionTemplateBooleanDecisionData = {
case DescriptionTemplateFieldType.EXTERNAL_SELECT: {
const data: DescriptionTemplateExternalSelectData = {
sources: [],
multipleSelect: false,
label: '',
fieldType: DescriptionTemplateFieldType.BOOLEAN_DECISION,
}
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
fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.RADIO_BOX: {
const data: DescriptionTemplateRadioBoxData = {
label: '',
options: [],
fieldType: DescriptionTemplateFieldType.RADIO_BOX
fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.TEXT_AREA: {
const data: DescriptionTemplateTextAreaData = {
case DescriptionTemplateFieldType.SELECT: {
const firstOption = { label: '', value: '' } as DescriptionTemplateSelectOption;
const data: DescriptionTemplateSelectData = {
label: '',
fieldType: DescriptionTemplateFieldType.TEXT_AREA
multipleSelect: false,
options: [firstOption],
fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.RICH_TEXT_AREA: {
const data: DescriptionTemplateRichTextAreaData = {
case DescriptionTemplateFieldType.BOOLEAN_DECISION:
case DescriptionTemplateFieldType.CHECK_BOX:
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: '',
fieldType: DescriptionTemplateFieldType.RICH_TEXT_AREA
fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.UPLOAD: {
const data: DescriptionTemplateUploadData = {
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS:
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS:
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: '',
types: [],
maxFileSizeInMB: this.configurationService.maxFileSizeInMB,
fieldType: DescriptionTemplateFieldType.UPLOAD
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.DATE_PICKER: {
const data: DescriptionTemplateDatePickerData = {
label: '',
fieldType: DescriptionTemplateFieldType.DATE_PICKER
multipleSelect: false,
fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.EXTERNAL_DATASETS: {
const data: DescriptionTemplateExternalDatasetData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.EXTERNAL_DATASETS
multipleSelect: false,
fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.DATA_REPOSITORIES: {
const data: DescriptionTemplateDataRepositoryData = {
case DescriptionTemplateFieldType.UPLOAD: {
const data: DescriptionTemplateUploadData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.DATA_REPOSITORIES
}
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
types: [],
maxFileSizeInMB: this.configurationService.maxFileSizeInMB,
fieldType: type
}
field.data = data;
break;

View File

@ -1,9 +1,9 @@
<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>
<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}}
<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-form-field class="col-12">
@ -50,20 +50,20 @@
</mat-form-field>
<mat-form-field class="col-md-3">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-LABEL' | translate}}</mat-label>
<input matInput [formControl]="singleForm.get('autoCompleteOptions').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('autoCompleteOptions').get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<input matInput [formControl]="singleForm.get('sourceBinding').get('label')">
<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('sourceBinding').get('label').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
<mat-form-field class="col-md-3">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-VALUE' | translate}}</mat-label>
<input matInput [formControl]="singleForm.get('autoCompleteOptions').get('value')">
<mat-error *ngIf="singleForm.get('autoCompleteOptions').get('value').hasError('backendError')">{{singleForm.get('autoCompleteOptions').get('value').getError('backendError').message}}</mat-error>
<input matInput [formControl]="singleForm.get('sourceBinding').get('value')">
<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 class="col-md-3">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-AUTOCOMPLETE-SOURCE' | translate}}</mat-label>
<input matInput [formControl]="singleForm.get('autoCompleteOptions').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('autoCompleteOptions').get('source').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
<input matInput [formControl]="singleForm.get('sourceBinding').get('source')">
<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('sourceBinding').get('source').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</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>
<div *ngIf="singleForm.get('hasAuth').value === true" class="col-12">

View File

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

View File

@ -1,7 +1,7 @@
<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>
<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}}
</mat-checkbox>

View File

@ -1,7 +1,7 @@
<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>
<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}}
</mat-checkbox>

View File

@ -1,7 +1,7 @@
<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'
| 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}}
</mat-checkbox>

View File

@ -1,6 +1,6 @@
<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> -->
<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}}
</mat-checkbox>
<mat-form-field class="col-12">

View File

@ -1,7 +1,7 @@
<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>
<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}}
</mat-checkbox>

View File

@ -1,7 +1,7 @@
<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'
| 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}}
</mat-checkbox>
<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>
</ng-container>
</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}}
<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-form-field class="col-12">

View File

@ -1,6 +1,6 @@
import { Component, Input, OnInit } from '@angular/core';
import { UntypedFormArray, UntypedFormGroup } from '@angular/forms';
import { DescriptionTemplateComboBoxOptionEditorModel } from '../../../description-template-editor.model';
import { DescriptionTemplateSelectOptionEditorModel } from '../../../description-template-editor.model';
@Component({
selector: 'app-description-template-editor-select-field-component',
@ -15,7 +15,7 @@ export class DescriptionTemplateEditorSelectFieldComponent implements OnInit {
}
addNewRow() {
const selectOptions: DescriptionTemplateComboBoxOptionEditorModel = new DescriptionTemplateComboBoxOptionEditorModel();
const selectOptions: DescriptionTemplateSelectOptionEditorModel = new DescriptionTemplateSelectOptionEditorModel();
(<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">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.PUBLICATIONS)}}
</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">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.AUTO_COMPLETE)}}
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT)}}
</mat-option>
</mat-optgroup>
<!-- TODO -->
<mat-divider></mat-divider>
<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">
{{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 [value]="descriptionTemplateFieldTypeEnum.TAGS">
<img src="/assets/images/editor/icons/api_entity.svg" class="input_icon" alt="Tags icon">
@ -199,7 +207,7 @@
</div>
<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-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>

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 { ValidationType } from '@app/core/common/enum/validation-type';
import {
DescriptionTemplateAutoCompleteData,
DescriptionTemplateBooleanDecisionData,
DescriptionTemplateCheckBoxData,
DescriptionTemplateComboBoxOption,
DescriptionTemplateCurrencyData,
DescriptionTemplateDataRepositoryData,
DescriptionTemplateDatasetIdentifierData,
DescriptionTemplateDatePickerData,
DescriptionTemplateDmpAutoCompleteData,
DescriptionTemplateExternalDatasetData,
DescriptionTemplateFreeTextData,
DescriptionTemplateLicenseData,
DescriptionTemplateOrganizationData,
DescriptionTemplatePublicationData,
DescriptionTemplateExternalSelectData,
DescriptionTemplateLabelAndMultiplicityData,
DescriptionTemplateLabelData,
DescriptionTemplateRadioBoxData,
DescriptionTemplateRegistryData,
DescriptionTemplateResearcherAutoCompleteData,
DescriptionTemplateRichTextAreaData,
DescriptionTemplateServiceData,
DescriptionTemplateTagData,
DescriptionTemplateTaxonomyData,
DescriptionTemplateTextAreaData,
DescriptionTemplateUploadData,
DescriptionTemplateValidationData,
DescriptionTemplateSelectData
DescriptionTemplateSelectData,
DescriptionTemplateSelectOption,
DescriptionTemplateUploadData
} from '@app/core/model/description-template/description-template';
import { DescriptionTemplateFieldPersist } from '@app/core/model/description-template/description-template-persist';
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.BOOLEAN_DECISION:
case DescriptionTemplateFieldType.RADIO_BOX:
case DescriptionTemplateFieldType.COMBO_BOX:
case DescriptionTemplateFieldType.SELECT:
case DescriptionTemplateFieldType.EXTERNAL_SELECT:
case DescriptionTemplateFieldType.CHECK_BOX:
case DescriptionTemplateFieldType.DATE_PICKER:
return true;
@ -131,7 +115,7 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
onInputTypeChange() {
const x = this.fieldType;
const type = this.fieldType;
const field: DescriptionTemplateFieldPersist = this.form.getRawValue();
field.defaultValue = undefined;
@ -139,260 +123,92 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
field.visibilityRules = [];
}
switch (x) {
case DescriptionTemplateFieldType.BOOLEAN_DECISION: {
const data: DescriptionTemplateBooleanDecisionData = {
switch (type) {
case DescriptionTemplateFieldType.EXTERNAL_SELECT: {
const data: DescriptionTemplateExternalSelectData = {
sources: [],
multipleSelect: false,
label: '',
fieldType: DescriptionTemplateFieldType.BOOLEAN_DECISION,
}
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
fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.RADIO_BOX: {
const data: DescriptionTemplateRadioBoxData = {
label: '',
options: [],
fieldType: DescriptionTemplateFieldType.RADIO_BOX
fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.TEXT_AREA: {
const data: DescriptionTemplateTextAreaData = {
case DescriptionTemplateFieldType.SELECT: {
const firstOption = { label: '', value: '' } as DescriptionTemplateSelectOption;
const data: DescriptionTemplateSelectData = {
label: '',
fieldType: DescriptionTemplateFieldType.TEXT_AREA
multipleSelect: false,
options: [firstOption],
fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.RICH_TEXT_AREA: {
const data: DescriptionTemplateRichTextAreaData = {
case DescriptionTemplateFieldType.BOOLEAN_DECISION:
case DescriptionTemplateFieldType.CHECK_BOX:
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: '',
fieldType: DescriptionTemplateFieldType.RICH_TEXT_AREA
fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.UPLOAD: {
const data: DescriptionTemplateUploadData = {
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_RESEARCHERS:
case DescriptionTemplateFieldType.INTERNAL_DMP_ENTRIES_DMPS:
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: '',
types: [],
maxFileSizeInMB: this.configurationService.maxFileSizeInMB,
fieldType: DescriptionTemplateFieldType.UPLOAD
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.DATE_PICKER: {
const data: DescriptionTemplateDatePickerData = {
label: '',
fieldType: DescriptionTemplateFieldType.DATE_PICKER
multipleSelect: false,
fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.EXTERNAL_DATASETS: {
const data: DescriptionTemplateExternalDatasetData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.EXTERNAL_DATASETS
multipleSelect: false,
fieldType: type
}
field.data = data;
break;
}
case DescriptionTemplateFieldType.DATA_REPOSITORIES: {
const data: DescriptionTemplateDataRepositoryData = {
case DescriptionTemplateFieldType.UPLOAD: {
const data: DescriptionTemplateUploadData = {
label: '',
multiAutoComplete: false,
fieldType: DescriptionTemplateFieldType.DATA_REPOSITORIES
}
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
types: [],
maxFileSizeInMB: this.configurationService.maxFileSizeInMB,
fieldType: type
}
field.data = data;
break;

View File

@ -19,12 +19,7 @@
<ng-container *ngTemplateOutlet="actions"></ng-container>
</div>
</div>
<!-- {{formGroup?.value | json}} -->
<div class="row stepper-navigation-outer-wrapper">
<!-- Steps Navigation -->
<div id="stepper-navigation-wrapper">
<div class="col-12 d-flex" *ngIf="steps" id="stepper-navigation">
@ -50,9 +45,6 @@
</div>
</div>
<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) -->

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
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 { BreadcrumbService } from '@app/ui/misc/breadcrumb/breadcrumb.service';
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.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.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.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.sections), nameof<DescriptionTemplateSection>(x => x.page)].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.sections), nameof<DescriptionTemplateSection>(x => x.description)].join('.'),
[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.pages), nameof<DescriptionTemplatePage>(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.ordinal)].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.pages), nameof<DescriptionTemplatePage>(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.title)].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.pages), nameof<DescriptionTemplatePage>(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.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.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.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.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.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.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.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.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.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.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<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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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<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.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.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.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.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.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.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.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.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.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<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.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<DescriptionTemplateSelectData>(x => x.multipleSelect)].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.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.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.hash),

View File

@ -1,8 +1,8 @@
import { Injectable } from '@angular/core';
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 { 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 { Reference } from '@app/core/model/reference/reference';
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.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.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.sections), nameof<DescriptionTemplateSection>(x => x.page)].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.sections), nameof<DescriptionTemplateSection>(x => x.description)].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.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.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.title)].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.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.additionalInformation)].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.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.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.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.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.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.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.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<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<DescriptionTemplateSelectData>(x => x.options), nameof<DescriptionTemplateComboBoxOption>(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), 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('.'),
(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.pages), nameof<DescriptionTemplatePage>(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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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('.'),
]
}

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-form-field>
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.AUTO_COMPLETE" class="col-12">
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_SELECT" class="col-12">
<div class="row">
<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')"
[configuration]="multipleAutoCompleteConfiguration">
</app-multiple-auto-complete>
</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')"
[configuration]="singleAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -38,7 +38,7 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.SELECT" class="col-12">
<div class="row">
<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>
</mat-select>
@ -50,12 +50,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_RESEARCHERS" class="col-12">
<div class="row">
<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')"
[configuration]="multipleAutoCompleteConfiguration">
</app-multiple-auto-complete>
</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')"
[configuration]="singleAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -69,12 +69,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DATASETS" class="col-12">
<div class="row">
<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')"
[configuration]="multipleAutoCompleteConfiguration">
</app-multiple-auto-complete>
</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')"
[configuration]="singleAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -88,12 +88,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.INTERNAL_DMP_ENTRIES_DMPS" class="col-12">
<div class="row">
<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')"
[configuration]="multipleAutoCompleteConfiguration">
</app-multiple-auto-complete>
</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')"
[configuration]="singleAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -187,12 +187,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.EXTERNAL_DATASETS" class="col-12">
<div class="row">
<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')"
[configuration]="externalDatasetAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete>
</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')"
[configuration]="externalDatasetAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -207,12 +207,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.DATA_REPOSITORIES" class="col-12">
<div class="row">
<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')"
[configuration]="dataRepositoriesAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete>
</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')"
[configuration]="dataRepositoriesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -226,12 +226,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.PUB_REPOSITORIES" class="col-12">
<div class="row">
<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')"
[configuration]="pubRepositoriesAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete>
</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')"
[configuration]="pubRepositoriesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -245,12 +245,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.JOURNAL_REPOSITORIES" class="col-12">
<div class="row">
<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')"
[configuration]="journalRepositoriesAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete>
</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')"
[configuration]="journalRepositoriesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -265,12 +265,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.TAXONOMIES" class="col-12">
<div *ngIf="field.data" class="row">
<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')"
[configuration]="taxonomiesAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete>
</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')"
[configuration]="taxonomiesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -285,12 +285,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.LICENSES" class="col-12">
<div *ngIf="field.data" class="row">
<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')"
[configuration]="licensesAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete>
</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')"
[configuration]="licensesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -305,12 +305,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.PUBLICATIONS" class="col-12">
<div *ngIf="field.data" class="row">
<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')"
[configuration]="publicationsAutoCompleteConfiguration" [required]="isRequired">
</app-multiple-auto-complete>
</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')"
[configuration]="publicationsAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -325,12 +325,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.REGISTRIES" class="col-12">
<div class="row">
<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')"
[configuration]="registriesAutoCompleteConfiguration">
</app-multiple-auto-complete>
</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')"
[configuration]="registriesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -345,12 +345,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.SERVICES" class="col-12">
<div class="row">
<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')"
[configuration]="servicesAutoCompleteConfiguration">
</app-multiple-auto-complete>
</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')"
[configuration]="servicesAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -373,12 +373,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.RESEARCHERS" class="col-12">
<div class="row">
<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')"
[configuration]="researchersAutoCompleteConfiguration">
</app-multiple-auto-complete>
</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')"
[configuration]="researchersAutoCompleteConfiguration" [required]="isRequired">
</app-single-auto-complete>
@ -393,12 +393,12 @@
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.ORGANIZATIONS" class="col-12">
<div class="row">
<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')"
[configuration]="organisationsAutoCompleteConfiguration">
</app-multiple-auto-complete>
</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')"
[configuration]="organisationsAutoCompleteConfiguration" [required]="isRequired">
</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 { DescriptionTemplateFieldValidationType } from '@app/core/common/enum/description-template-field-validation-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 { ReferenceSearchLookup } from '@app/core/query/reference-search.lookup';
import { DmpService } from '@app/core/services/dmp/dmp.service';
@ -42,7 +42,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
// @Input() form: UntypedFormGroup;
@Input() datasetProfileId: any;
@Input() isChild: Boolean = false;
autocompleteOptions: DescriptionTemplateAutoCompleteSingleData[];
autocompleteOptions: DescriptionTemplateExternalSelectSource[];
visible: boolean = true;
@ -136,7 +136,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
this.isRequired = this.field.validations?.includes(DescriptionTemplateFieldValidationType.Required);
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;
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('"'));
@ -155,8 +155,8 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
}
// Setup autocomplete configuration if needed
if (this.field?.data?.fieldType === DescriptionTemplateFieldType.AUTO_COMPLETE) {
if (!((this.field.data as DescriptionTemplateAutoCompleteData).multiAutoComplete)) {
if (this.field?.data?.fieldType === DescriptionTemplateFieldType.EXTERNAL_SELECT) {
if (!((this.field.data as DescriptionTemplateExternalSelectData).multipleSelect)) {
this.singleAutoCompleteConfiguration = {
filterFn: this.searchFromAutocomplete.bind(this),
initialItems: () => this.searchFromAutocomplete(''),
@ -177,7 +177,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
}
}
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()
)
.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 => {
// this.visibilityRulesService.updateValueAndVisibility(this.field?.id, element);
// });
@ -380,7 +380,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
// const autocompleteRequestItem: RequestItem<DatasetExternalAutocompleteOptionsCriteria> = new RequestItem();
// autocompleteRequestItem.criteria = new DatasetExternalAutocompleteOptionsCriteria();
// //TODO: refactor this
// //autocompleteRequestItem.criteria.autoCompleteSingleDataList = this.autocompleteOptions;
// //autocompleteRequestItem.criteria.sources = this.autocompleteOptions;
// // autocompleteRequestItem.criteria.like = query;
// // return this.datasetExternalAutocompleteService.queryApi(autocompleteRequestItem);
// return null;
@ -439,7 +439,7 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
}
makeAutocompleteConfiguration(myfunc: Function, title: string, subtitle?: string): void {
if (!((this.field.data as DescriptionTemplateAutoCompleteData).multiAutoComplete)) {
if (!((this.field.data as DescriptionTemplateExternalSelectData).multipleSelect)) {
this.singleAutoCompleteConfiguration = {
filterFn: myfunc.bind(this),
initialItems: (extraData) => myfunc(''),

View File

@ -13,7 +13,7 @@
</h4>
</mat-panel-title>
</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">
<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>

View File

@ -32,7 +32,6 @@ export class DescriptionFormComponent extends BaseComponent implements OnInit, A
@Input() TOCENTRY_ID_PREFIX = "";
@Output() visibilityRulesInstance = new EventEmitter<VisibilityRulesService>();
public sectionsPerPage: { [key: string]: DescriptionTemplateSection[] } = {};
// public hiddenEntriesIds: string[] = [];
constructor(
@ -62,9 +61,7 @@ export class DescriptionFormComponent extends BaseComponent implements OnInit, A
}
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();
// 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 { VisibilityRuleSource } from './models/visibility-rule-source';
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';
@Injectable()
@ -17,7 +17,7 @@ export class VisibilityRulesService {
private visibilityRuleContext: VisibilityRulesContext;
private form: AbstractControl;
public isVisibleMap : { [key: string]: boolean } = {};
public isVisibleMap: { [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
@ -416,15 +416,15 @@ export class VisibilityRulesService {
public getVisibilityRulesFromDescriptionTempalte(descriptionTemplate: DescriptionTemplate): Rule[] {
//console.log('getVisibilityRulesFromDescriptionTempalte: ' + descriptionTemplate);
const result: Rule[] = this.getVisibilityRulesFromDescriptionTempalteSections(descriptionTemplate?.definition?.sections);
const result: Rule[] = this.getVisibilityRulesFromDescriptionTempalteSections(descriptionTemplate?.definition?.pages);
return result;
}
public getVisibilityRulesFromDescriptionTempalteSections(sections: DescriptionTemplateSection[]): Rule[] {
public getVisibilityRulesFromDescriptionTempalteSections(pages: DescriptionTemplatePage[]): Rule[] {
//console.log('getVisibilityRulesFromDescriptionTempalteSections: ' + sections);
const result: Rule[] = [];
sections.forEach(section => {
pages.forEach(page => {
page?.sections?.forEach(section => {
if (section.sections != null) { result.push(...this.getVisibilityRulesFromDescriptionTempalteSections(section.sections)); };
section?.fieldSets?.forEach(fieldSet => {
fieldSet?.fields?.forEach(field => {
@ -438,6 +438,7 @@ export class VisibilityRulesService {
});
});
});
});
return result;
}
}

View File

@ -428,7 +428,7 @@ export class TableOfContentsComponent extends BaseComponent implements OnInit, O
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 => {
const tempResults = this._buildRecursivelySection(section);

View File

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