description template frontend changes

This commit is contained in:
Diamantis Tziotzios 2024-01-30 19:27:55 +02:00
parent 16222fc02c
commit f296bc44f9
32 changed files with 105 additions and 106 deletions

View File

@ -89,13 +89,7 @@ public class ComboBoxOptionPersist {
.failOn(ComboBoxOptionPersist._label).failWith(messageSource.getMessage("Validation_Required", new Object[]{ComboBoxOptionPersist._label}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getValue()))
.failOn(ComboBoxOptionPersist._value).failWith(messageSource.getMessage("Validation_Required", new Object[]{ComboBoxOptionPersist._value}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getSource()))
.failOn(ComboBoxOptionPersist._source).failWith(messageSource.getMessage("Validation_Required", new Object[]{ComboBoxOptionPersist._source}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getUri()))
.failOn(ComboBoxOptionPersist._uri).failWith(messageSource.getMessage("Validation_Required", new Object[]{ComboBoxOptionPersist._uri}, LocaleContextHolder.getLocale()))
.failOn(ComboBoxOptionPersist._value).failWith(messageSource.getMessage("Validation_Required", new Object[]{ComboBoxOptionPersist._value}, LocaleContextHolder.getLocale()))
);
}
}

View File

@ -10,6 +10,7 @@ import org.springframework.context.annotation.Scope;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -47,8 +48,12 @@ public class RadioBoxDataPersist extends BaseFieldDataPersist {
@Override
protected List<Specification> specifications(RadioBoxDataPersist item) {
List<Specification> specifications = getBaseSpecifications(item);
specifications.addAll(Arrays.asList(
// For Radio Box we don't have label, since it's the actual title of the question.
return new ArrayList<>(Arrays.asList(
this.spec()
.must(() -> !this.isNull(item.getFieldType()))
.failOn(BaseFieldDataPersist._fieldType).failWith(messageSource.getMessage("Validation_Required", new Object[]{BaseFieldDataPersist._fieldType}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isNull(item.getOptions()))
.failOn(RadioBoxDataPersist._options).failWith(messageSource.getMessage("Validation_Required", new Object[]{RadioBoxDataPersist._options}, LocaleContextHolder.getLocale())),
@ -58,7 +63,6 @@ public class RadioBoxDataPersist extends BaseFieldDataPersist {
.over(item.getOptions())
.using((itm) -> this.validatorFactory.validator(RadioBoxOptionPersist.RadioBoxOptionPersistValidator.class))
));
return specifications;
}
}

View File

@ -178,6 +178,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
} else {
data = new DescriptionTemplateEntity();
data.setId(UUID.randomUUID());
data.setStatus(DescriptionTemplateStatus.Draft);
data.setIsActive(IsActive.Active);
data.setCreatedAt(Instant.now());
data.setGroupId(UUID.randomUUID());
@ -219,7 +220,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
if (newStatus.equals(DescriptionTemplateStatus.Finalized)) {
List<DescriptionTemplateEntity> latestVersionDescriptionTemplates = this.queryFactory.query(DescriptionTemplateQuery.class).versionStatuses(DescriptionTemplateVersionStatus.Current).isActive(IsActive.Active).groupIds(data.getGroupId()).collect();
if (latestVersionDescriptionTemplates.size() > 1) throw new MyValidationException("Multiple previous template found");
DescriptionTemplateEntity oldDescriptionTemplateEntity = latestVersionDescriptionTemplates.getFirst();
DescriptionTemplateEntity oldDescriptionTemplateEntity = latestVersionDescriptionTemplates.stream().findFirst().orElse(null);
data.setVersionStatus(DescriptionTemplateVersionStatus.Current);

View File

@ -83,6 +83,7 @@ public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM ext
@Override
public BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist, BaseFieldDataEntity<?> data){
data.setLabel(persist.getLabel());
data.setFieldType(persist.getFieldType());
return this.applyPersistInternal((PM)persist, (D)data);
}

View File

@ -1,4 +0,0 @@
export enum DescriptionTemplateFieldDataComboBoxType {
Autocomplete = 'autocomplete',
Wordlist = 'wordlist'
}

View File

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

View File

@ -173,7 +173,7 @@ export interface DescriptionTemplateDatasetIdentifierDataPersist extends Descrip
export interface DescriptionTemplateCurrencyDataPersist extends DescriptionTemplateBaseFieldDataPersist {
}
export interface DescriptionTemplateWordListDataPersist extends DescriptionTemplateBaseFieldDataPersist {
export interface DescriptionTemplateSelectDataPersist extends DescriptionTemplateBaseFieldDataPersist {
options: DescriptionTemplateComboBoxOptionPersist[];
multiList: boolean;
}

View File

@ -186,7 +186,7 @@ export interface DescriptionTemplateUploadData extends DescriptionTemplateBaseFi
export interface DescriptionTemplateValidationData extends DescriptionTemplateBaseFieldData {
}
export interface DescriptionTemplateWordListData extends DescriptionTemplateBaseFieldData {
export interface DescriptionTemplateSelectData extends DescriptionTemplateBaseFieldData {
options: DescriptionTemplateComboBoxOption[];
multiList: boolean;
}

View File

@ -34,7 +34,7 @@ export class FieldValuePipe implements PipeTransform {
case DescriptionTemplateFieldType.FREE_TEXT:
return value;
case DescriptionTemplateFieldType.AUTO_COMPLETE:
case DescriptionTemplateFieldType.WORD_LIST:
case DescriptionTemplateFieldType.SELECT:
if (value && controlValue.data.options && !controlValue.data.multiList) {
return controlValue.data.options.find(option => value == option.value).label;
} else if (value && controlValue.data.options && controlValue.data.multiList) {

View File

@ -156,7 +156,7 @@ export class EnumUtils {
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.WORD_LIST: return this.language.instant('TYPES.DESCRIPTION-TEMPLATE-FIELD-TYPE.WORD-LIST');
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');

View File

@ -16,7 +16,7 @@ import { DescriptionTemplateEditorDefaultValueComponent } from './editor/compone
import { DescriptionTemplateEditorAutoCompleteFieldComponent } from './editor/components/field-type/auto-complete/description-template-editor-auto-complete-field.component';
import { DescriptionTemplateEditorMultiplicityFieldComponent } from './editor/components/field-type/multiplicity-field/description-template-editor-multiplicity-field.component';
import { DescriptionTemplateEditorPlaceholderFieldComponent } from './editor/components/field-type/placeholder-field/description-template-editor-placeholder-field.component';
import { DescriptionTemplateEditorWordListFieldComponent } from './editor/components/field-type/word-list/description-template-editor-word-list-field.component';
import { DescriptionTemplateEditorSelectFieldComponent } from './editor/components/field-type/select/description-template-editor-select-field.component';
import { DescriptionTemplateEditorFieldComponent } from './editor/components/field/description-template-editor-field.component';
import { DescriptionTemplateEditorSectionFieldSetComponent } from './editor/components/section-fieldset/description-template-editor-section-fieldset.component';
import { DescriptionTemplateEditorSectionComponent } from './editor/components/section/description-template-editor-section.component';
@ -27,6 +27,7 @@ import { DescriptionTemplateTableOfContentsInternalSection } from './editor/tabl
import { DescriptionTemplateListingComponent } from './listing/description-template-listing.component';
import { DescriptionTemplateListingFiltersComponent } from "./listing/filters/description-template-listing-filters.component";
import { ImportDescriptionTemplateDialogComponent } from './listing/import-description-template/import-description-template.dialog.component';
import { DescriptionTemplateEditorRadioBoxFieldComponent } from './editor/components/field-type/radio-box/description-template-editor-radio-box-field.component';
@NgModule({
imports: [
@ -66,9 +67,10 @@ import { ImportDescriptionTemplateDialogComponent } from './listing/import-descr
DescriptionTemplateEditorRuleComponent,
DescriptionTemplateEditorAutoCompleteFieldComponent,
DescriptionTemplateEditorWordListFieldComponent,
DescriptionTemplateEditorSelectFieldComponent,
DescriptionTemplateEditorPlaceholderFieldComponent,
DescriptionTemplateEditorMultiplicityFieldComponent,
DescriptionTemplateEditorRadioBoxFieldComponent
]
})
export class DescriptionTemplateModule { }

View File

@ -159,11 +159,11 @@
<img src="/assets/images/editor/icons/radio_box.svg" class="input_icon" alt="RadioBox icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.RADIO_BOX)}}
</button>
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.COMBO_BOX)">
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.SELECT)">
<span class="input_icon">
<img src="/assets/images/editor/icons/select.svg" alt="Select icon">
</span>
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.COMBO_BOX)}}
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.SELECT)}}
</button>
<button mat-list-item (click)="addNewInput(descriptionTemplateFieldTypeEnum.CHECK_BOX)">
<img src="/assets/images/editor/icons/checkbox.svg" class="input_icon" alt="CheckBox Icon">

View File

@ -30,7 +30,7 @@ import {
DescriptionTemplateTextAreaData,
DescriptionTemplateUploadData,
DescriptionTemplateValidationData,
DescriptionTemplateWordListData
DescriptionTemplateSelectData
} 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';
@ -519,11 +519,11 @@ export class DescriptionTemplateEditorCompositeFieldComponent extends BaseCompon
case DescriptionTemplateFieldType.COMBO_BOX: {
const firstOption = { label: '', value: '' } as DescriptionTemplateComboBoxOption;
const data: DescriptionTemplateWordListData = {
const data: DescriptionTemplateSelectData = {
label: '',
multiList: false,
options: [firstOption],
fieldType: DescriptionTemplateFieldType.WORD_LIST
fieldType: DescriptionTemplateFieldType.SELECT
}
field.data = data;
break;

View File

@ -26,7 +26,7 @@
</mat-form-field>
<!-- ComboBox -->
<mat-form-field class="col-md-12" *ngIf="fieldType === descriptionTemplateFieldTypeEnum.WORD_LIST">
<mat-form-field class="col-md-12" *ngIf="fieldType === descriptionTemplateFieldTypeEnum.SELECT">
<mat-label>{{placeHolder}}</mat-label>
<mat-select [formControl]="form" [placeholder]="placeHolder">
<mat-option [value]="null">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.DEFAULT-VALUES.NONE' | translate }}</mat-option>

View File

@ -1,29 +0,0 @@
import { Component, Input, OnInit } from '@angular/core';
import { UntypedFormArray, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { FieldDataOptionEditorModel } from '../../../../admin/field-data/field-data-option-editor-model';
import { RadioBoxFieldDataEditorModel } from '../../../../admin/field-data/radio-box-field-data-editor-model';
@Component({
selector: 'app-dataset-profile-editor-radio-box-field-component',
styleUrls: ['./dataset-profile-editor-radio-box-field.component.scss'],
templateUrl: './dataset-profile-editor-radio-box-field.component.html'
})
export class DatasetProfileEditorRadioBoxFieldComponent implements OnInit {
@Input() form: UntypedFormGroup;
private data: RadioBoxFieldDataEditorModel = new RadioBoxFieldDataEditorModel();
ngOnInit() {
if (!this.form.get('data')) { this.form.addControl('data', this.data.buildForm()); }
}
addNewRow() {
const radioListOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
if (!this.form.get('data').get('options')) { (<UntypedFormGroup>this.form.get('data')).addControl('options', new UntypedFormBuilder().array([])); }
(<UntypedFormArray>this.form.get('data').get('options')).push(radioListOptions.buildForm());
}
deleteRow(intex: number) {
if (this.form.get('data').get('options')) { (<UntypedFormArray>this.form.get('data').get('options')).removeAt(intex); }
}
}

View File

@ -0,0 +1,26 @@
import { Component, Input, OnInit } from '@angular/core';
import { UntypedFormArray, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { DescriptionTemplateRadioBoxDataEditorModel } from '../../../description-template-editor.model';
@Component({
selector: 'app-description-template-editor-radio-box-field-component',
styleUrls: ['./description-template-editor-radio-box-field.component.scss'],
templateUrl: './description-template-editor-radio-box-field.component.html'
})
export class DescriptionTemplateEditorRadioBoxFieldComponent implements OnInit {
@Input() form: UntypedFormGroup;
ngOnInit() {
}
addNewRow() {
const radioListOptions: DescriptionTemplateRadioBoxDataEditorModel = new DescriptionTemplateRadioBoxDataEditorModel();
if (!this.form.get('data').get('options')) { (<UntypedFormGroup>this.form.get('data')).addControl('options', new UntypedFormBuilder().array([])); }
(<UntypedFormArray>this.form.get('data').get('options')).push(radioListOptions.buildForm());
}
deleteRow(intex: number) {
if (this.form.get('data').get('options')) { (<UntypedFormArray>this.form.get('data').get('options')).removeAt(intex); }
}
}

View File

@ -1,7 +1,7 @@
<div class="row" *ngIf="form.get('data')">
<div class="col-12">
<h5 style="font-weight: bold; display: inline-block; margin-right: 2em;">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-TITLE' | translate}}</h5>
<h5 style="font-weight: bold; display: inline-block; margin-right: 2em;">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-SELECT-TITLE' | translate}}</h5>
<ng-container *ngIf="form.get('data').errors?.emptyArray && form.get('data').touched">
<mat-icon class="text-danger translateY-3">warning_amber</mat-icon>
@ -9,12 +9,12 @@
</ng-container>
</div>
<mat-checkbox class="col-auto" [formControl]="this.form.get('data').get('multiList')">
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-WORDLIST' | translate}}
{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-MULTIPLE-SELECT' | translate}}
<mat-error *ngIf="form.get('data').get('multiList').hasError('backendError')">{{form.get('data').get('multiList').getError('backendError').message}}</mat-error>
</mat-checkbox>
<mat-form-field class="col-12">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-PLACEHOLDER' | translate}}</mat-label>
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-SELECT-PLACEHOLDER' | translate}}</mat-label>
<input matInput type="string" [formControl]="form.get('data').get('label')">
<mat-error *ngIf="form.get('data').get('label').hasError('backendError')">{{form.get('data').get('label').getError('backendError').message}}</mat-error>
</mat-form-field>
@ -22,12 +22,12 @@
<div class="col-12">
<div *ngFor="let option of form.get('data').get('options')['controls'] index as i" class="row">
<mat-form-field class="col">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-LABEL' | translate}}</mat-label>
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-SELECT-LABEL' | translate}}</mat-label>
<input matInput type="text" [formControl]="form.get('data').get('options').get(''+i).get('label')">
<mat-error *ngIf="form.get('data').get('options').get(''+i).get('label').hasError('backendError')">{{form.get('data').get('options').get(''+i).get('label').getError('backendError').message}}</mat-error>
</mat-form-field>
<mat-form-field class="col">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-VALUE' | translate}}</mat-label>
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-SELECT-VALUE' | translate}}</mat-label>
<input matInput [formControl]="form.get('data').get('options').get(''+i).get('value')">
<mat-error *ngIf="form.get('data').get('options').get(''+i).get('value').hasError('backendError')">{{form.get('data').get('options').get(''+i).get('value').getError('backendError').message}}</mat-error>
</mat-form-field>

View File

@ -3,11 +3,11 @@ import { UntypedFormArray, UntypedFormGroup } from '@angular/forms';
import { DescriptionTemplateComboBoxOptionEditorModel } from '../../../description-template-editor.model';
@Component({
selector: 'app-description-template-editor-word-list-field-component',
styleUrls: ['./description-template-editor-word-list-field.component.scss'],
templateUrl: './description-template-editor-word-list-field.component.html'
selector: 'app-description-template-editor-select-field-component',
styleUrls: ['./description-template-editor-select-field.component.scss'],
templateUrl: './description-template-editor-select-field.component.html'
})
export class DescriptionTemplateEditorWordListFieldComponent implements OnInit {
export class DescriptionTemplateEditorSelectFieldComponent implements OnInit {
@Input() form: UntypedFormGroup;
@ -15,8 +15,8 @@ export class DescriptionTemplateEditorWordListFieldComponent implements OnInit {
}
addNewRow() {
const wordListOptions: DescriptionTemplateComboBoxOptionEditorModel = new DescriptionTemplateComboBoxOptionEditorModel();
(<UntypedFormArray>this.form.get('data').get('options')).push(wordListOptions.buildForm());
const selectOptions: DescriptionTemplateComboBoxOptionEditorModel = new DescriptionTemplateComboBoxOptionEditorModel();
(<UntypedFormArray>this.form.get('data').get('options')).push(selectOptions.buildForm());
}
deleteRow(intex: number) {

View File

@ -61,11 +61,11 @@
<img src="/assets/images/editor/icons/radio_box.svg" class="input_icon" alt="RadioBox icon">
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.RADIO_BOX)}}
</mat-option>
<mat-option [value]="descriptionTemplateFieldTypeEnum.COMBO_BOX">
<mat-option [value]="descriptionTemplateFieldTypeEnum.SELECT">
<span class="input_icon">
<img src="/assets/images/editor/icons/select.svg" style="padding-right: 7px;" alt="Select icon">
</span>
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.COMBO_BOX)}}
{{enumUtils.toDescriptionTemplateFieldTypeString(descriptionTemplateFieldTypeEnum.SELECT)}}
</mat-option>
<mat-option [value]="descriptionTemplateFieldTypeEnum.CHECK_BOX">
<img src="/assets/images/editor/icons/checkbox.svg" class="input_icon" alt="CheckBox icon">
@ -200,11 +200,11 @@
<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-word-list-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.WORD_LIST" class="col-12" [form]="form"></app-description-template-editor-word-list-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>
<!-- <app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.BOOLEAN_DECISION" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component> -->
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.BOOLEAN_DECISION" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.CHECK_BOX" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.FREE_TEXT" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>
<app-description-template-editor-placeholder-field-component *ngSwitchCase="descriptionTemplateFieldTypeEnum.TEXT_AREA" class="col-12" [form]="form"></app-description-template-editor-placeholder-field-component>

View File

@ -31,7 +31,7 @@ import {
DescriptionTemplateTextAreaData,
DescriptionTemplateUploadData,
DescriptionTemplateValidationData,
DescriptionTemplateWordListData
DescriptionTemplateSelectData
} 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";
@ -160,14 +160,14 @@ export class DescriptionTemplateEditorFieldComponent extends BaseComponent imple
break;
}
case DescriptionTemplateFieldType.COMBO_BOX: {
case DescriptionTemplateFieldType.SELECT: {
const firstOption = { label: '', value: '' } as DescriptionTemplateComboBoxOption;
const data: DescriptionTemplateWordListData = {
const data: DescriptionTemplateSelectData = {
label: '',
multiList: false,
options: [firstOption],
fieldType: DescriptionTemplateFieldType.WORD_LIST
fieldType: DescriptionTemplateFieldType.SELECT
}
field.data = data;
break;

View File

@ -200,8 +200,8 @@
<div class="col">
<div class="col-12" *ngIf="selectedTocEntry">
<div class="col-12 content-displayer" *ngIf="selectedTocEntry.type === tocEntryEnumValues.Page" [@fade-in-fast]>
<formGroup [formGroup]="selectedTocEntry.form" class="page-infos">
<div class="col-12 content-displayer page-infos" *ngIf="selectedTocEntry.type === tocEntryEnumValues.Page" [@fade-in-fast]>
<formGroup [formGroup]="selectedTocEntry.form">
<div class="row">
<div class="col-12">
<div class="heading">{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.PAGE-INFO.PAGE-NAME' | translate}} *</div>

View File

@ -1013,7 +1013,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
// DatasetProfileFieldViewStyle.DatePicker,
// DatasetProfileFieldViewStyle.ComboBox,
// ].includes(renderStyle)) {
// if (((renderStyle === DatasetProfileFieldViewStyle) && (field.get('data').get('type').value === DatasetProfileComboBoxType.WordList))) {
// if (((renderStyle === DatasetProfileFieldViewStyle) && (field.get('data').get('type').value === DatasetProfileComboBoxType.Select))) {
// return false;
// }
// try {
@ -1068,7 +1068,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
}
get numOfPages() {
return (<UntypedFormArray>this.formGroup.get('pages'))?.length;
return (<UntypedFormArray>this.formGroup.get('definition').get('pages'))?.length;
}
checkFormValidation() {

View File

@ -5,7 +5,7 @@ import { DescriptionTemplateFieldValidationType } from "@app/core/common/enum/de
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, DescriptionTemplateWordListDataPersist, UserDescriptionTemplatePersist } from "@app/core/model/description-template/description-template-persist";
import { DescriptionTemplateAuthAutoCompleteDataPersist, DescriptionTemplateAutoCompleteDataPersist, DescriptionTemplateAutoCompleteSingleDataPersist, DescriptionTemplateBaseFieldDataPersist, DescriptionTemplateComboBoxOptionPersist, DescriptionTemplateDefinitionPersist, DescriptionTemplateFieldPersist, DescriptionTemplateFieldSetPersist, DescriptionTemplateMultiplicityPersist, DescriptionTemplatePagePersist, DescriptionTemplatePersist, DescriptionTemplatePlaceholderAndMultiplicityDataPersist, DescriptionTemplateRadioBoxDataPersist, DescriptionTemplateRadioBoxOptionPersist, DescriptionTemplateRulePersist, DescriptionTemplateSectionPersist, DescriptionTemplateUploadDataPersist, DescriptionTemplateUploadOptionPersist, DescriptionTemplateSelectDataPersist, UserDescriptionTemplatePersist } 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";
@ -814,8 +814,8 @@ export class DescriptionTemplateFieldEditorModel implements DescriptionTemplateF
return new DescriptionTemplateAutoCompleteFieldEditorModel(this.validationErrorModel);
case DescriptionTemplateFieldType.RADIO_BOX:
return new DescriptionTemplateRadioBoxFieldEditorModel(this.validationErrorModel);
case DescriptionTemplateFieldType.WORD_LIST:
return new DescriptionTemplateRadioBoxFieldEditorModel(this.validationErrorModel);
case DescriptionTemplateFieldType.SELECT:
return new DescriptionTemplateSelectFieldEditorModel(this.validationErrorModel);
case DescriptionTemplateFieldType.BOOLEAN_DECISION:
case DescriptionTemplateFieldType.CHECK_BOX:
case DescriptionTemplateFieldType.FREE_TEXT:
@ -1522,10 +1522,10 @@ export class DescriptionTemplateRadioBoxDataEditorModel implements DescriptionTe
//
//
// Wordlist Field
// Select Field
//
//
export class DescriptionTemplateWordListFieldEditorModel extends DescriptionTemplateBaseFieldEditorModel implements DescriptionTemplateWordListDataPersist {
export class DescriptionTemplateSelectFieldEditorModel extends DescriptionTemplateBaseFieldEditorModel implements DescriptionTemplateSelectDataPersist {
options: DescriptionTemplateComboBoxOptionEditorModel[] = [];
multiList: boolean;
protected formBuilder: UntypedFormBuilder = new UntypedFormBuilder();
@ -1534,7 +1534,7 @@ export class DescriptionTemplateWordListFieldEditorModel extends DescriptionTemp
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel()
) { super(validationErrorModel); }
fromModel(item: DescriptionTemplateWordListDataPersist): DescriptionTemplateWordListFieldEditorModel {
fromModel(item: DescriptionTemplateSelectDataPersist): DescriptionTemplateSelectFieldEditorModel {
if (item) {
super.fromModel(item);
this.multiList = item.multiList;
@ -1550,7 +1550,7 @@ export class DescriptionTemplateWordListFieldEditorModel extends DescriptionTemp
}): UntypedFormGroup {
let { context = null, disabled = false, rootPath } = params ?? {}
if (context == null) {
context = DescriptionTemplateWordListFieldEditorModel.createValidationContext({
context = DescriptionTemplateSelectFieldEditorModel.createValidationContext({
validationErrorModel: this.validationErrorModel,
rootPath
});
@ -1587,7 +1587,7 @@ export class DescriptionTemplateWordListFieldEditorModel extends DescriptionTemp
}): void {
const { formGroup, rootPath, validationErrorModel } = params;
const context = DescriptionTemplateWordListFieldEditorModel.createValidationContext({
const context = DescriptionTemplateSelectFieldEditorModel.createValidationContext({
rootPath,
validationErrorModel
});

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, DescriptionTemplateBaseFieldData, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection } from '@app/core/model/description-template/description-template';
import { DescriptionTemplate, DescriptionTemplateAutoCompleteData, DescriptionTemplateBaseFieldData, DescriptionTemplateComboBoxOption, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateMultiplicity, DescriptionTemplatePage, DescriptionTemplateRadioBoxData, DescriptionTemplateRadioBoxOption, 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';
@ -71,6 +71,10 @@ export class DescriptionTemplateEditorResolver extends BaseEditorResolver {
[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.createdAt),
nameof<DescriptionTemplate>(x => x.hash),

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateComboBoxOption, DescriptionTemplateDefinition, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplatePage, DescriptionTemplateRule, DescriptionTemplateSection, DescriptionTemplateWordListData } from '@app/core/model/description-template/description-template';
import { DescriptionTemplate, DescriptionTemplateBaseFieldData, DescriptionTemplateComboBoxOption, 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 { Dmp, DmpDescriptionTemplate } from '@app/core/model/dmp/dmp';
@ -100,10 +100,10 @@ export class DescriptionEditorResolver extends BaseEditorResolver {
(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<DescriptionTemplateWordListData>(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<DescriptionTemplateWordListData>(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<DescriptionTemplateWordListData>(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<DescriptionTemplateWordListData>(x => x.multiList)].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('.'),
]
}

View File

@ -35,7 +35,7 @@
</mat-form-field>
</div>
</div>
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.WORD_LIST" class="col-12">
<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">

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, DescriptionTemplateWordListData } from '@app/core/model/description-template/description-template';
import { DescriptionTemplateAutoCompleteData, DescriptionTemplateAutoCompleteSingleData, DescriptionTemplateField, DescriptionTemplateFieldSet, DescriptionTemplateUploadData, DescriptionTemplateSelectData } 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';
@ -135,8 +135,8 @@ export class DescriptionFormFieldComponent extends BaseComponent implements OnIn
this.isRequired = this.field.validations?.includes(DescriptionTemplateFieldValidationType.Required);
if (this.field?.data?.fieldType === DescriptionTemplateFieldType.WORD_LIST) {
if ((this.field.data as DescriptionTemplateWordListData).multiList) {
if (this.field?.data?.fieldType === DescriptionTemplateFieldType.SELECT) {
if ((this.field.data as DescriptionTemplateSelectData).multiList) {
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('"'));
@ -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.WordList && 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.multiList) {
// item.forEach(element => {
// this.visibilityRulesService.updateValueAndVisibility(this.field?.id, element);
// });

View File

@ -506,10 +506,10 @@
"FIELD-FREE-TEXT-TITLE": "Free Text Data",
"FIELD-FREE-TEXT-PLACEHOLDER": "Input Placeholder Text",
"FIELD-COMBO-BOX-TYPE": "Type of Combo Box",
"FIELD-WORD-LIST-TITLE": "Word List Data",
"FIELD-WORD-LIST-PLACEHOLDER": "Input Placeholder Text",
"FIELD-WORD-LIST-LABEL": "Label",
"FIELD-WORD-LIST-VALUE": "Value",
"FIELD-SELECT-TITLE": "Word List Data",
"FIELD-SELECT-PLACEHOLDER": "Input Placeholder Text",
"FIELD-SELECT-LABEL": "Label",
"FIELD-SELECT-VALUE": "Value",
"FIELD-INTERNAL-DMP-ENTITIES-TYPE": "Type of Internal DMP Entity",
"FIELD-RESEARCHERS-TITLE": "Researchers Autocomplete",
"FIELD-RESEARCHERS-PLACEHOLDER": "Input Placeholder Text",
@ -2213,7 +2213,7 @@
"DESCRIPTION-TEMPLATE-FIELD-TYPE": {
"COMBO-BOX": "Combo Box",
"AUTO-COMPLETE": "Custom",
"WORD-LIST": "Word List",
"SELECT": "Select",
"BOOLEAN-DECISION": "Boolean Decision",
"RADIO-BOX": "Radio Box",
"INTERNAL-DMP-ENTITIES": "Internal DMP Entities",
@ -2247,7 +2247,7 @@
"DOWNLOAD": "Download file"
},
"DATASET-PROFILE-COMBO-BOX-TYPE": {
"WORD-LIST": "Word List",
"SELECT": "Word List",
"AUTOCOMPLETE": "Autocomplete",
"EXTERNAL-SOURCE-HINT": "List of values provided by external source(s)",
"ACTIONS": {

View File

@ -10,7 +10,7 @@
"FieldSetEditorModel.additionalInformation",
"TextAreaFieldDataEditorModel.label",
"FreeTextFieldDataEditorModel.label",
"WordListFieldDataEditorModel.label",
"SelectFieldDataEditorModel.label",
"FieldDataOptionEditorModel.label",
"FieldSetEditorModel.schematics",
"FieldSetEditorModel.export"