Merge remote-tracking branch 'origin/Development' into Development

This commit is contained in:
George Kalampokis 2021-12-16 11:44:57 +02:00
commit cff9af75c6
13 changed files with 83 additions and 32 deletions

View File

@ -120,6 +120,7 @@ public class ExportXmlBuilderDatasetProfile {
Element multiplicity = element.createElement("multiplicity"); Element multiplicity = element.createElement("multiplicity");
multiplicity.setAttribute("max", "" + field.getMultiplicity().getMax()); multiplicity.setAttribute("max", "" + field.getMultiplicity().getMax());
multiplicity.setAttribute("min", "" + field.getMultiplicity().getMin()); multiplicity.setAttribute("min", "" + field.getMultiplicity().getMin());
multiplicity.setAttribute("placeholder", field.getMultiplicity().getPlaceholder());
composite.appendChild(multiplicity); composite.appendChild(multiplicity);
} }
if (field.getTitle() != null && !field.getTitle().isEmpty()) { if (field.getTitle() != null && !field.getTitle().isEmpty()) {

View File

@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlRootElement;
public class Multiplicity { public class Multiplicity {
private int max; private int max;
private int min; private int min;
private String placeholder;
@XmlAttribute(name = "max") @XmlAttribute(name = "max")
public int getMax() { public int getMax() {
@ -27,10 +28,20 @@ public class Multiplicity {
this.min = min; this.min = min;
} }
@XmlAttribute(name = "placeholder")
public String getPlaceholder() {
return placeholder;
}
public void setPlaceholder(String placeholder) {
this.placeholder = placeholder;
}
public eu.eudat.models.data.components.commons.Multiplicity toAdminCompositeModelSection() { public eu.eudat.models.data.components.commons.Multiplicity toAdminCompositeModelSection() {
eu.eudat.models.data.components.commons.Multiplicity multiplicityEntity = new eu.eudat.models.data.components.commons.Multiplicity(); eu.eudat.models.data.components.commons.Multiplicity multiplicityEntity = new eu.eudat.models.data.components.commons.Multiplicity();
multiplicityEntity.setMax(max); multiplicityEntity.setMax(max);
multiplicityEntity.setMin(min); multiplicityEntity.setMin(min);
multiplicityEntity.setPlaceholder(placeholder);
return multiplicityEntity; return multiplicityEntity;
} }
} }

View File

@ -4,6 +4,7 @@ public class Multiplicity {
private int min; private int min;
private int max; private int max;
private String placeholder;
public int getMin() { public int getMin() {
return min; return min;
@ -21,5 +22,11 @@ public class Multiplicity {
this.max = max; this.max = max;
} }
public String getPlaceholder() {
return placeholder;
}
public void setPlaceholder(String placeholder) {
this.placeholder = placeholder;
}
} }

View File

@ -121,6 +121,7 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
Element multiplicity = doc.createElement("multiplicity"); Element multiplicity = doc.createElement("multiplicity");
multiplicity.setAttribute("min", "" + this.multiplicity.getMin()); multiplicity.setAttribute("min", "" + this.multiplicity.getMin());
multiplicity.setAttribute("max", "" + this.multiplicity.getMax()); multiplicity.setAttribute("max", "" + this.multiplicity.getMax());
multiplicity.setAttribute("placeholder", this.multiplicity.getPlaceholder());
Element commentField = doc.createElement("commentField"); Element commentField = doc.createElement("commentField");
commentField.setAttribute("hasCommentField", "" + this.hasCommentField); commentField.setAttribute("hasCommentField", "" + this.hasCommentField);
@ -183,6 +184,7 @@ public class FieldSet implements DatabaseViewStyleDefinition, XmlSerializable<Fi
this.multiplicity.setMin(Integer.parseInt(multiplicity.getAttribute("min"))); this.multiplicity.setMin(Integer.parseInt(multiplicity.getAttribute("min")));
this.multiplicity.setMax(Integer.parseInt(multiplicity.getAttribute("max"))); this.multiplicity.setMax(Integer.parseInt(multiplicity.getAttribute("max")));
this.multiplicity.setPlaceholder(multiplicity.getAttribute("placeholder"));
return this; return this;
} }

View File

@ -44,6 +44,7 @@ export interface FieldSet {
export interface Multiplicity { export interface Multiplicity {
min: number; min: number;
max: number; max: number;
placeholder: string;
} }
export interface Field { export interface Field {

View File

@ -3,5 +3,6 @@
export interface Multiplicity { export interface Multiplicity {
min: number; min: number;
max: number; max: number;
placeholder: string;
} }

View File

@ -1,22 +1,27 @@
import { FormGroup } from '@angular/forms'; import {FormGroup} from '@angular/forms';
import { Multiplicity } from '../../../../core/model/admin/dataset-profile/dataset-profile'; import {Multiplicity} from '../../../../core/model/admin/dataset-profile/dataset-profile';
import { BaseFormModel } from '../../../../core/model/base-form-model'; import {BaseFormModel} from '../../../../core/model/base-form-model';
export class MultiplicityEditorModel extends BaseFormModel { export class MultiplicityEditorModel extends BaseFormModel {
public min: number; public min: number;
public max: number; public max: number;
public placeholder: string;
fromModel(item: Multiplicity): MultiplicityEditorModel { fromModel(item: Multiplicity): MultiplicityEditorModel {
this.min = item.min; this.min = item.min;
this.max = item.max; this.max = item.max;
this.placeholder = item.placeholder;
return this; return this;
} }
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup { buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
const formGroup = this.formBuilder.group({ return this.formBuilder.group({
min: [{ value: this.min, disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.min')) }], min: [{value: this.min, disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.min'))}],
max: [{ value: this.max, disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.max')) }] max: [{value: this.max, disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.max'))}],
placeholder: [{
value: this.placeholder,
disabled: (disabled && !skipDisable.includes('MultiplicityEditorModel.placeholder'))
}]
}); });
return formGroup;
} }
} }

View File

@ -111,6 +111,12 @@
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
</div> </div>
<div class="row">
<mat-form-field *ngIf="isMultiplicityEnabled" class="col pl-0 underline-line-field" appearance="legacy">
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-PLACEHOLDER' | translate}}"
type="text" [formControl]="form.get('multiplicity').get('placeholder')">
</mat-form-field>
</div>
</div> </div>

View File

@ -104,7 +104,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
try{ try{
const multiplicity = this.form.get('multiplicity').value; const multiplicity = this.form.get('multiplicity').value;
this.isMultiplicityEnabled = multiplicity.min > 0 || multiplicity.max >0; this.isMultiplicityEnabled = multiplicity.min > 0 || multiplicity.max >0;
} catch{ } catch{
this.isMultiplicityEnabled = false; this.isMultiplicityEnabled = false;
} }
@ -120,7 +120,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
} }
} }
ngOnInit() { ngOnInit() {
@ -255,7 +255,7 @@ export class DatasetProfileEditorCompositeFieldComponent extends BaseComponent i
description: formValue.description, description: formValue.description,
hasCommentField: formValue.hasCommentField, hasCommentField: formValue.hasCommentField,
commentFieldValue: '', commentFieldValue: '',
multiplicity: {max:formValue.multiplicity.max, min : formValue.multiplicity.min}, multiplicity: {max: formValue.multiplicity.max, min: formValue.multiplicity.min, placeholder: formValue.multiplicity.placeholder},
multiplicityItems:null, multiplicityItems:null,
fields: fields.map(editorField=>{ fields: fields.map(editorField=>{
const model = new DatasetDescriptionFieldEditorModel().fromModel(editorField); const model = new DatasetDescriptionFieldEditorModel().fromModel(editorField);

View File

@ -1,15 +1,15 @@
<ng-container *ngIf="form"> <ng-container *ngIf="form">
<div *ngFor="let compositeFieldFormGroup of form.get('compositeFields')['controls']; let i = index;" class="col-12"> <div *ngFor="let compositeFieldFormGroup of form.get('compositeFields')['controls']; let i = index;" class="col-12">
<div class="row" *ngIf="this.visibilityRulesService.checkElementVisibility(compositeFieldFormGroup.get('id').value) && this.visibilityRulesService.scanIfChildsOfCompositeFieldHasVisibleItems(compositeFieldFormGroup)"> <div class="row" *ngIf="this.visibilityRulesService.checkElementVisibility(compositeFieldFormGroup.get('id').value) && this.visibilityRulesService.scanIfChildsOfCompositeFieldHasVisibleItems(compositeFieldFormGroup)">
<div class="col-12"> <div class="col-12">
<div class="row"> <div class="row">
<app-form-composite-field class="align-self-center col" [form]="compositeFieldFormGroup" [datasetProfileId]="datasetProfileId" <app-form-composite-field class="align-self-center col" [form]="compositeFieldFormGroup" [datasetProfileId]="datasetProfileId"
[isChild]="false" [showDelete]="(compositeFieldFormGroup.get('multiplicityItems').length) > 0"></app-form-composite-field> [isChild]="false" [showDelete]="(compositeFieldFormGroup.get('multiplicityItems').length) > 0"></app-form-composite-field>
</div> </div>
</div> </div>
<div *ngIf="compositeFieldFormGroup" class="col-12"> <div *ngIf="compositeFieldFormGroup" class="col-12">
<div class="row"> <div class="row">
<div class="col-12" *ngFor="let multipleCompositeFieldFormGroup of compositeFieldFormGroup.get('multiplicityItems')['controls']; let j = index"> <div class="col-12" *ngFor="let multipleCompositeFieldFormGroup of compositeFieldFormGroup.get('multiplicityItems')['controls']; let j = index">
@ -19,10 +19,14 @@
</div> </div>
</div> </div>
<div *ngIf="(compositeFieldFormGroup.get('multiplicity').value.max - 1) > (compositeFieldFormGroup.get('multiplicityItems').length)" <div *ngIf="(compositeFieldFormGroup.get('multiplicity').value.max - 1) > (compositeFieldFormGroup.get('multiplicityItems').length)"
class="col-12 ml-0 mr-0 addOneFieldButton"> class="col-12 mt-1 ml-0 mr-0 addOneFieldButton">
<button mat-icon-button color="primary" (click)="addMultipleField(i)" [disabled]="compositeFieldFormGroup.disabled" matTooltip="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}"> <span matTooltip="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}"
<mat-icon>add_circle</mat-icon> class="pointer d-inline-flex align-items-center">
</button> <button mat-icon-button color="primary" (click)="addMultipleField(i)" [disabled]="compositeFieldFormGroup.disabled">
<mat-icon>add_circle</mat-icon>
</button>
<span class="mt-1" *ngIf="compositeFieldFormGroup.get('multiplicity').value.placeholder">{{compositeFieldFormGroup.get('multiplicity').value.placeholder}}</span>
</span>
</div> </div>
<mat-form-field *ngIf="compositeFieldFormGroup.get('hasCommentField').value" class="col-12 mb-2" [formGroup]="compositeFieldFormGroup"> <mat-form-field *ngIf="compositeFieldFormGroup.get('hasCommentField').value" class="col-12 mb-2" [formGroup]="compositeFieldFormGroup">
<input matInput formControlName="commentFieldValue" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate}}"> <input matInput formControlName="commentFieldValue" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate}}">
@ -36,4 +40,4 @@
</div> </div>
</div> </div>
</div> </div>
</ng-container> </ng-container>

View File

@ -31,10 +31,14 @@
</div> </div>
</div> </div>
<div *ngIf="(compositeFieldFormGroup.get('multiplicity').value.max - 1) > (compositeFieldFormGroup.get('multiplicityItems').length)" <div *ngIf="(compositeFieldFormGroup.get('multiplicity').value.max - 1) > (compositeFieldFormGroup.get('multiplicityItems').length)"
class="col-12 addOneFieldButton"> class="col-12 mt-1 ml-0 mr-0 addOneFieldButton">
<button mat-icon-button type="button" color="primary" (click)="addMultipleField(i)" [disabled]="compositeFieldFormGroup.disabled" matTooltip="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}"> <span matTooltip="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}"
<mat-icon>add_circle</mat-icon> class="pointer d-inline-flex align-items-center">
</button> <button mat-icon-button color="primary" (click)="addMultipleField(i)" [disabled]="compositeFieldFormGroup.disabled">
<mat-icon>add_circle</mat-icon>
</button>
<span class="mt-1" *ngIf="compositeFieldFormGroup.get('multiplicity').value.placeholder">{{compositeFieldFormGroup.get('multiplicity').value.placeholder}}</span>
</span>
</div> </div>
<mat-form-field *ngIf="compositeFieldFormGroup.get('hasCommentField').value" class="col-12 mb-2" [formGroup]="compositeFieldFormGroup"> <mat-form-field *ngIf="compositeFieldFormGroup.get('hasCommentField').value" class="col-12 mb-2" [formGroup]="compositeFieldFormGroup">
<input matInput formControlName="commentFieldValue" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate}}"> <input matInput formControlName="commentFieldValue" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate}}">
@ -79,14 +83,14 @@
<!-- <div *ngIf="isElementVisible(compositeField)" class="row"> --> <!-- <div *ngIf="isElementVisible(compositeField)" class="row"> -->
<!-- *ngIf="this.visibilityRulesService.checkElementVisibility(compositeFieldFormGroup.get('id').value)" --> <!-- *ngIf="this.visibilityRulesService.checkElementVisibility(compositeFieldFormGroup.get('id').value)" -->
<div class="row" *ngIf="(this.visibilityRulesService.checkElementVisibility(fieldsetEntry.form.get('id').value) && this.visibilityRulesService.scanIfChildsOfCompositeFieldHasVisibleItems(fieldsetEntry.form)) && !hiddenEntriesIds.includes(fieldsetEntry.id)"> <div class="row" *ngIf="(this.visibilityRulesService.checkElementVisibility(fieldsetEntry.form.get('id').value) && this.visibilityRulesService.scanIfChildsOfCompositeFieldHasVisibleItems(fieldsetEntry.form)) && !hiddenEntriesIds.includes(fieldsetEntry.id)">
<div class="col-12"> <div class="col-12">
<div class="row"> <div class="row">
<app-form-composite-field [tocentry]="fieldsetEntry" class="align-self-center col" [form]="fieldsetEntry.form" [datasetProfileId]="datasetProfileId" <app-form-composite-field [tocentry]="fieldsetEntry" class="align-self-center col" [form]="fieldsetEntry.form" [datasetProfileId]="datasetProfileId"
[isChild]="false" [showDelete]="(fieldsetEntry.form.get('multiplicityItems').length) > 0"></app-form-composite-field> [isChild]="false" [showDelete]="(fieldsetEntry.form.get('multiplicityItems').length) > 0"></app-form-composite-field>
</div> </div>
</div> </div>
<div *ngIf="fieldsetEntry.form" class="col-12"> <div *ngIf="fieldsetEntry.form" class="col-12">
<div class="row"> <div class="row">
<div class="col-12" *ngFor="let multipleCompositeFieldFormGroup of fieldsetEntry.form.get('multiplicityItems')['controls']; let j = index"> <div class="col-12" *ngFor="let multipleCompositeFieldFormGroup of fieldsetEntry.form.get('multiplicityItems')['controls']; let j = index">
@ -96,10 +100,14 @@
</div> </div>
</div> </div>
<div *ngIf="(fieldsetEntry.form.get('multiplicity').value.max - 1) > (fieldsetEntry.form.get('multiplicityItems').length)" <div *ngIf="(fieldsetEntry.form.get('multiplicity').value.max - 1) > (fieldsetEntry.form.get('multiplicityItems').length)"
class="col-12 addOneFieldButton"> class="col-12 mt-1 ml-0 mr-0 addOneFieldButton">
<button mat-icon-button type="button" color="primary" (click)="addMultipleField(i)" [disabled]="fieldsetEntry.form.disabled" matTooltip="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}"> <span matTooltip="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.MULTIPLICITY-ADD-ONE-FIELD' | translate}}"
<mat-icon>add_circle</mat-icon> class="pointer d-inline-flex align-items-center">
</button> <button mat-icon-button color="primary" (click)="addMultipleField(i)" [disabled]="fieldsetEntry.form.disabled">
<mat-icon>add_circle</mat-icon>
</button>
<span class="mt-1" *ngIf="fieldsetEntry.form.get('multiplicity').value.placeholder">{{fieldsetEntry.form.get('multiplicity').value.placeholder}}</span>
</span>
</div> </div>
<mat-form-field *ngIf="fieldsetEntry.form.get('hasCommentField').value" class="col-12 mb-2" [formGroup]="fieldsetEntry.form"> <mat-form-field *ngIf="fieldsetEntry.form.get('hasCommentField').value" class="col-12 mb-2" [formGroup]="fieldsetEntry.form">
<input matInput formControlName="commentFieldValue" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate}}"> <input matInput formControlName="commentFieldValue" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.COMPOSITE-FIELD.FIELDS.COMMENT-PLACEHOLDER' | translate}}">
@ -111,12 +119,12 @@
</button> --> </button> -->
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</ng-container> </ng-container>
<ng-container *ngSwitchCase="tocentriesType.Section"> <ng-container *ngSwitchCase="tocentriesType.Section">
<!-- SECTION CASE --> <!-- SECTION CASE -->
@ -132,7 +140,7 @@
</ng-container> </ng-container>
</div> </div>
</ng-container> </ng-container>
</ng-container> </ng-container>
</ng-template> </ng-template>

View File

@ -318,17 +318,20 @@ export class DatasetDescriptionFieldEditorModel extends BaseFormModel {
export class DatasetDescriptionMultiplicityEditorModel extends BaseFormModel { export class DatasetDescriptionMultiplicityEditorModel extends BaseFormModel {
public min: number; public min: number;
public max: number; public max: number;
public placeholder: string;
fromModel(item: Multiplicity): DatasetDescriptionMultiplicityEditorModel { fromModel(item: Multiplicity): DatasetDescriptionMultiplicityEditorModel {
this.min = item.min; this.min = item.min;
this.max = item.max; this.max = item.max;
this.placeholder = item.placeholder;
return this; return this;
} }
buildForm(): FormGroup { buildForm(): FormGroup {
const formGroup = this.formBuilder.group({ const formGroup = this.formBuilder.group({
min: [this.min], min: [this.min],
max: [this.max] max: [this.max],
placeholder: [this.placeholder]
}); });
return formGroup; return formGroup;
} }

View File

@ -367,6 +367,7 @@
"ADDITIONAL-INFORMATION": "Additional Information", "ADDITIONAL-INFORMATION": "Additional Information",
"MULTIPLICITY-MIN": "Multiplicity Min", "MULTIPLICITY-MIN": "Multiplicity Min",
"MULTIPLICITY-MAX": "Multiplicity Max", "MULTIPLICITY-MAX": "Multiplicity Max",
"MULTIPLICITY-PLACEHOLDER": "Multiplicity Placeholder Text",
"MULTIPLICITY-ADD-ONE-FIELD": "Add one more fieldset", "MULTIPLICITY-ADD-ONE-FIELD": "Add one more fieldset",
"ORDER": "Order", "ORDER": "Order",
"COMMENT-PLACEHOLDER": "Please Specify", "COMMENT-PLACEHOLDER": "Please Specify",
@ -385,6 +386,7 @@
"VIEW-STYLE": "Type", "VIEW-STYLE": "Type",
"MULTIPLICITY-MIN": "Multiplicity Min", "MULTIPLICITY-MIN": "Multiplicity Min",
"MULTIPLICITY-MAX": "Multiplicity Max", "MULTIPLICITY-MAX": "Multiplicity Max",
"MULTIPLICITY-PLACEHOLDER": "Multiplicity Placeholder Text",
"ORDER": "Order", "ORDER": "Order",
"DEFAULT-VALUE": "Default Value", "DEFAULT-VALUE": "Default Value",
"VALIDATION": "Validation", "VALIDATION": "Validation",