Fix Multiplicity Back And Ftrond New Ids
Create DeleteButon To RadioBox AndWordList Try To fix ProgressBar
This commit is contained in:
parent
0b171bc67d
commit
8e0b869a80
|
@ -141,7 +141,7 @@ public class Field implements Comparable, PropertiesModelBuilder, ViewStyleDefin
|
||||||
Field newField = new Field();
|
Field newField = new Field();
|
||||||
newField.id = key;
|
newField.id = key;
|
||||||
newField.ordinal = this.ordinal;
|
newField.ordinal = this.ordinal;
|
||||||
newField.value = (String) properties.get(key);
|
newField.value = properties.containsKey(key)? (String) properties.get(key): null;
|
||||||
newField.viewStyle = this.viewStyle;
|
newField.viewStyle = this.viewStyle;
|
||||||
newField.datatype = this.datatype;
|
newField.datatype = this.datatype;
|
||||||
newField.page = this.page;
|
newField.page = this.page;
|
||||||
|
|
|
@ -5,7 +5,9 @@ import eu.eudat.models.data.properties.PropertiesGenerator;
|
||||||
import eu.eudat.models.data.user.composite.PropertiesModelBuilder;
|
import eu.eudat.models.data.user.composite.PropertiesModelBuilder;
|
||||||
import eu.eudat.logic.utilities.builders.ModelBuilder;
|
import eu.eudat.logic.utilities.builders.ModelBuilder;
|
||||||
import eu.eudat.logic.utilities.interfaces.ViewStyleDefinition;
|
import eu.eudat.logic.utilities.interfaces.ViewStyleDefinition;
|
||||||
|
import sun.rmi.runtime.NewThreadAction;
|
||||||
|
|
||||||
|
import java.security.Key;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -149,35 +151,32 @@ public class FieldSet implements Comparable, PropertiesModelBuilder, ViewStyleDe
|
||||||
this.fields.forEach(item -> {
|
this.fields.forEach(item -> {
|
||||||
item.fromJsonObject(properties);
|
item.fromJsonObject(properties);
|
||||||
});
|
});
|
||||||
|
List<String> compositeKeysFather = properties.keySet().stream().filter(keys -> keys.startsWith("multiple_" + this.getId())).collect(Collectors.toList());
|
||||||
List<String> compositeKeys = properties.keySet().stream().filter(keys -> keys.startsWith("multiple_" + this.getId())).collect(Collectors.toList());
|
List<String> Ids=new ArrayList<>();
|
||||||
for (String key : compositeKeys) {
|
for (String composite : compositeKeysFather) {
|
||||||
this.multiplicityItems.add(this.cloneForMultiplicity(key, compositeKeys.indexOf(key), properties));
|
String[] split = composite.split("_");
|
||||||
|
if (!Ids.contains(split[2])) {
|
||||||
|
Ids.add(split[2]);
|
||||||
|
this.multiplicityItems.add(this.CloneForMultiplicity2(properties.keySet().stream().filter(keys -> keys.startsWith("multiple_" + this.getId() + "_" + split[2])).collect(Collectors.toList()), properties,split));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private FieldSet cloneForMultiplicity(String key, int index, Map<String, Object> properties) {
|
private FieldSet CloneForMultiplicity2(List<String> key, Map<String, Object> properties,String[] ids){
|
||||||
FieldSet newFieldSet = new FieldSet();
|
FieldSet newFieldSet = new FieldSet();
|
||||||
newFieldSet.id = key;
|
newFieldSet.id = ids[0]+"_"+ids[1]+"_"+ids[2];
|
||||||
newFieldSet.description = this.description;
|
newFieldSet.description = this.description;
|
||||||
newFieldSet.extendedDescription = this.extendedDescription;
|
newFieldSet.extendedDescription = this.extendedDescription;
|
||||||
newFieldSet.title = this.title;
|
newFieldSet.title = this.title;
|
||||||
|
|
||||||
newFieldSet.ordinal = this.ordinal;
|
newFieldSet.ordinal = this.ordinal;
|
||||||
newFieldSet.fields = new LinkedList();
|
newFieldSet.fields = new LinkedList();
|
||||||
this.fields.forEach(item -> {
|
for (Field field: this.fields) {
|
||||||
newFieldSet.fields.add(item.cloneForMultiplicity(key, properties));
|
newFieldSet.fields.add(field.cloneForMultiplicity(newFieldSet.id + "_" + field.getId(), properties));
|
||||||
});
|
}
|
||||||
//newFieldSet.fields.forEach(item->item.fromJsonObject(properties));
|
|
||||||
return newFieldSet;
|
return newFieldSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createMultiplicityFields(List<FieldSet> fieldSet, Field field) {
|
|
||||||
FieldSet newFieldSet = new FieldSet();
|
|
||||||
newFieldSet.fields = new LinkedList<Field>();
|
|
||||||
newFieldSet.fields.add(field);
|
|
||||||
fieldSet.add(newFieldSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Object o) {
|
public int compareTo(Object o) {
|
||||||
|
|
|
@ -1,24 +1,32 @@
|
||||||
<div class="row" *ngIf="form.get('data')">
|
<div class="row" *ngIf="form.get('data')">
|
||||||
|
|
||||||
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-TITLE' | translate}}</h5>
|
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-TITLE'
|
||||||
|
| translate}}</h5>
|
||||||
|
|
||||||
<mat-form-field class="col-12">
|
<mat-form-field class="col-12">
|
||||||
<input matInput type="string" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-PLACEHOLDER' | translate}}" [formControl]="form.get('data').get('label')">
|
<input matInput type="string" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-PLACEHOLDER' | translate}}"
|
||||||
|
[formControl]="form.get('data').get('label')">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div *ngFor="let option of form.get('data').get('options')['controls'] index as i" class="row">
|
<div *ngFor="let option of form.get('data').get('options')['controls'] index as i" class="row">
|
||||||
<mat-form-field class="col">
|
<mat-form-field class="col">
|
||||||
<input matInput type="string" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-LABEL' | translate}}" [formControl]="this.form.get('data').get('options').get(''+i).get('label')">
|
<input matInput type="string" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-LABEL' | translate}}"
|
||||||
|
[formControl]="this.form.get('data').get('options').get(''+i).get('label')">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field class="col">
|
<mat-form-field class="col">
|
||||||
<input matInput type="string" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-VALUE' | translate}}" [formControl]="this.form.get('data').get('options').get(''+i).get('value')">
|
<input matInput type="string" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-RADIO-BOX-VALUE' | translate}}"
|
||||||
|
[formControl]="this.form.get('data').get('options').get(''+i).get('value')">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<button mat-icon-button class="col-auto" (click)="deleteRow(i)" type="button"><mat-icon>delete</mat-icon></button>
|
<button mat-icon-button class="col-auto" (click)="deleteRow(i)" type="button">
|
||||||
|
<mat-icon>delete</mat-icon>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto">
|
<div class="col-auto">
|
||||||
<button mat-icon-button (click)="addNewRow()" type="button"><mat-icon>add</mat-icon></button>
|
<button mat-icon-button (click)="addNewRow()" type="button">
|
||||||
|
<mat-icon>add</mat-icon>
|
||||||
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -1,22 +1,29 @@
|
||||||
<div class="row" *ngIf="form.get('data')">
|
<div class="row" *ngIf="form.get('data')">
|
||||||
|
|
||||||
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-TITLE' | translate}}</h5>
|
<h5 style="font-weight: bold" class="col-12">{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-TITLE'
|
||||||
|
| translate}}</h5>
|
||||||
|
|
||||||
<mat-form-field class="col-12">
|
<mat-form-field class="col-12">
|
||||||
<input matInput type="string" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-PLACEHOLDER' | translate}}" [formControl]="form.get('data').get('label')">
|
<input matInput type="string" placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-PLACEHOLDER' | translate}}"
|
||||||
|
[formControl]="form.get('data').get('label')">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div *ngFor="let option of form.get('data').get('options')['controls'] index as i" class="row">
|
<div *ngFor="let option of form.get('data').get('options')['controls'] index as i" class="row">
|
||||||
<mat-form-field class="col-md-6">
|
<mat-form-field class="col">
|
||||||
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-LABEL' | translate}}" type="text" [formControl]="form.get('data').get('options').get(''+i).get('label')">
|
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-LABEL' | translate}}"
|
||||||
|
type="text" [formControl]="form.get('data').get('options').get(''+i).get('label')">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field class="col-md-6">
|
<mat-form-field class="col">
|
||||||
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-VALUE' | translate}}" [formControl]="form.get('data').get('options').get(''+i).get('value')">
|
<input matInput placeholder="{{'DATASET-PROFILE-EDITOR.STEPS.FORM.FIELD.FIELDS.FIELD-WORD-LIST-VALUE' | translate}}"
|
||||||
|
[formControl]="form.get('data').get('options').get(''+i).get('value')">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<button mat-icon-button class="col-auto" (click)="deleteRow(i)" type="button">
|
||||||
|
<mat-icon>delete</mat-icon>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto"><button mat-icon-button (click)="addNewRow()">
|
<div class="col-auto"><button mat-icon-button (click)="addNewRow()">
|
||||||
<mat-icon>add</mat-icon>
|
<mat-icon>add</mat-icon>
|
||||||
</button></div>
|
</button></div>
|
||||||
</div>
|
</div>
|
|
@ -22,4 +22,8 @@ export class DatasetProfileEditorWordListFieldComponent implements OnInit {
|
||||||
const wordListOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
|
const wordListOptions: FieldDataOptionEditorModel = new FieldDataOptionEditorModel();
|
||||||
(<FormArray>this.form.get('data').get('options')).push(wordListOptions.buildForm());
|
(<FormArray>this.form.get('data').get('options')).push(wordListOptions.buildForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteRow(intex: number) {
|
||||||
|
if (this.form.get('data').get('options')) { (<FormArray>this.form.get('data').get('options')).removeAt(intex); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,17 @@
|
||||||
Mark For Consideration
|
Mark For Consideration
|
||||||
</a> -->
|
</a> -->
|
||||||
</h5>
|
</h5>
|
||||||
<h6 *ngIf="form.get('description').value && !isChild">{{form.get('description').value}}</h6>
|
<h6 *ngIf="form.get('description').value && !isChild" class="col-12">{{form.get('description').value}}</h6>
|
||||||
<h6 *ngIf="form.get('extendedDescription').value && !isChild" class="col-12">
|
<h6 *ngIf="form.get('extendedDescription').value && !isChild" class="col-12">
|
||||||
<i>{{form.get('extendedDescription').value}}</i>
|
<i>{{form.get('extendedDescription').value}}</i>
|
||||||
</h6>
|
</h6>
|
||||||
<app-form-field class="col-12" [form]="form.get('fields')['controls'][0]" [datasetProfileId]="datasetProfileId" [isChild]="isChild"></app-form-field>
|
<app-form-field class="col-12" [form]="form.get('fields')['controls'][0]" [datasetProfileId]="datasetProfileId"
|
||||||
|
[isChild]="isChild"></app-form-field>
|
||||||
|
|
||||||
|
<!-- <button mat-icon-button type="button" *ngIf="!isChild" class="deleteBtn col-auto" (click)="DeleteField();">
|
||||||
|
<mat-icon>delete</mat-icon>
|
||||||
|
</button> -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="form.get('fields').length > 1" class="col-12">
|
<div *ngIf="form.get('fields').length > 1" class="col-12">
|
||||||
|
@ -22,25 +28,24 @@
|
||||||
<h5 *ngIf="form.get('title').value && !isChild" style="font-weight:bold; color: #3a3737;" class="col-12">{{form.get('numbering').value}}
|
<h5 *ngIf="form.get('title').value && !isChild" style="font-weight:bold; color: #3a3737;" class="col-12">{{form.get('numbering').value}}
|
||||||
{{form.get('title').value}}</h5>
|
{{form.get('title').value}}</h5>
|
||||||
<h5 *ngIf="form.get('description').value && !isChild" class="col-12">{{form.get('description').value}}</h5>
|
<h5 *ngIf="form.get('description').value && !isChild" class="col-12">{{form.get('description').value}}</h5>
|
||||||
<h5 *ngIf="form.get('extendedDescription').value && !isChild" class="col-12">
|
<h5 *ngIf="form.get('extendedDescription').value && !isChild" class="col-12"><i>{{form.get('extendedDescription').value}}</i></h5>
|
||||||
<i>{{form.get('extendedDescription').value}}</i>
|
|
||||||
</h5>
|
|
||||||
<div *ngFor="let fieldFormGroup of form.get('fields')['controls']; let i = index;" class="col-12">
|
<div *ngFor="let fieldFormGroup of form.get('fields')['controls']; let i = index;" class="col-12">
|
||||||
<div class="row">
|
<!-- <div class="row">
|
||||||
<div class="col-12" *ngIf="(fieldFormGroup.get('multiplicity')?.value?.max - 1) > (fieldFormGroup.get('multiplicityItems')?.length)">
|
<div class="col-12" *ngIf="(fieldFormGroup.get('multiplicity')?.value?.max - 1) > (fieldFormGroup.get('multiplicityItems')?.length)">
|
||||||
<a (click)="addMultipleField(i+1)" style="cursor: pointer">
|
<a (click)="addMultipleField(i+1)" style="cursor: pointer">
|
||||||
Add one more field +
|
Add one more field +
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<app-form-field [form]="fieldFormGroup" class="col-12" [datasetProfileId]="datasetProfileId" [isChild]="true"></app-form-field>
|
<app-form-field [form]="fieldFormGroup" class="col-12" [datasetProfileId]="datasetProfileId" [isChild]="true"></app-form-field>
|
||||||
<div *ngIf="fieldFormGroup" class="col-12">
|
<!-- <div *ngIf="fieldFormGroup" class="col-12">
|
||||||
<div *ngFor="let multipleField of fieldFormGroup.get('multiplicityItems')['controls']; let j = index" class="row">
|
<div *ngFor="let multipleField of fieldFormGroup.get('multiplicityItems')['controls']; let j = index" class="row">
|
||||||
<app-form-field class="col-12" [form]="multipleField" [datasetProfileId]="datasetProfileId"[isChild]="true"></app-form-field>
|
<app-form-field class="col-12" [form]="multipleField" [datasetProfileId]="datasetProfileId" [isChild]="true"></app-form-field>
|
||||||
|
<button mat-icon-button type="button" *ngIf="isChild" class="deleteBtn col-auto" (click)="DeleteField(i);">
|
||||||
|
<mat-icon>delete</mat-icon>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -23,11 +23,11 @@ export class FormCompositeFieldComponent {
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
addMultipleField(fieldIndex: number) {
|
// addMultipleField(fieldIndex: number) {
|
||||||
const compositeFieldToBeCloned = (this.form.get('compositeFields').get('' + fieldIndex) as FormGroup).getRawValue();
|
// const compositeFieldToBeCloned = (this.form.get('compositeFields').get('' + fieldIndex) as FormGroup).getRawValue();
|
||||||
const compositeField: DatasetDescriptionCompositeFieldEditorModel = new DatasetDescriptionCompositeFieldEditorModel().cloneForMultiplicity(compositeFieldToBeCloned);
|
// const compositeField: DatasetDescriptionCompositeFieldEditorModel = new DatasetDescriptionCompositeFieldEditorModel().cloneForMultiplicity(compositeFieldToBeCloned);
|
||||||
(<FormArray>(this.form.get('compositeFields').get('' + fieldIndex).get('multiplicityItems'))).push(compositeField.buildForm());
|
// (<FormArray>(this.form.get('compositeFields').get('' + fieldIndex).get('multiplicityItems'))).push(compositeField.buildForm());
|
||||||
}
|
// }
|
||||||
|
|
||||||
// markForConsideration() {
|
// markForConsideration() {
|
||||||
// this.markForConsiderationService.markForConsideration(this.compositeField);
|
// this.markForConsiderationService.markForConsideration(this.compositeField);
|
||||||
|
|
|
@ -20,7 +20,7 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
||||||
// @Input() field: Field;
|
// @Input() field: Field;
|
||||||
@Input() form: FormGroup;
|
@Input() form: FormGroup;
|
||||||
@Input() datasetProfileId: String;
|
@Input() datasetProfileId: String;
|
||||||
@Input() isChild: Boolean =false;
|
@Input() isChild: Boolean = false;
|
||||||
|
|
||||||
// change: Subscription;
|
// change: Subscription;
|
||||||
// trackByFn = (index, item) => item ? item['id'] : null;
|
// trackByFn = (index, item) => item ? item['id'] : null;
|
||||||
|
@ -35,7 +35,9 @@ export class FormFieldComponent extends BaseComponent implements OnInit {
|
||||||
) { super(); }
|
) { super(); }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
//if (this.field) {
|
if (this.form.get('value').value) {
|
||||||
|
this.visibilityRulesService.updateValueAndVisibility(this.form.get('id').value, this.form.get('value').value);
|
||||||
|
}
|
||||||
|
|
||||||
// Setup autocomplete configuration if needed
|
// Setup autocomplete configuration if needed
|
||||||
if (this.form.get('viewStyle').value.renderStyle === DatasetProfileFieldViewStyle.ComboBox && this.form.get('data').value.type === DatasetProfileComboBoxType.Autocomplete) {
|
if (this.form.get('viewStyle').value.renderStyle === DatasetProfileFieldViewStyle.ComboBox && this.form.get('data').value.type === DatasetProfileComboBoxType.Autocomplete) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ export class FormProgressIndicationComponent extends BaseComponent implements On
|
||||||
const progressSoFar = this.countFormControlsWithValue(this.formGroup);
|
const progressSoFar = this.countFormControlsWithValue(this.formGroup);
|
||||||
const total = this.getFormControlDepthLength(this.formGroup);
|
const total = this.getFormControlDepthLength(this.formGroup);
|
||||||
const perc = (progressSoFar / total) * 100;
|
const perc = (progressSoFar / total) * 100;
|
||||||
|
// const perc = ((progressSoFar-this.StandarValues) / total) * 100;
|
||||||
this.value = Number.parseFloat(perc.toPrecision(this.progressValueAccuracy));
|
this.value = Number.parseFloat(perc.toPrecision(this.progressValueAccuracy));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,21 +38,31 @@ export class FormProgressIndicationComponent extends BaseComponent implements On
|
||||||
let value = 0;
|
let value = 0;
|
||||||
Object.keys(form.controls).forEach(key => {
|
Object.keys(form.controls).forEach(key => {
|
||||||
const control = form.controls[key];
|
const control = form.controls[key];
|
||||||
if (control instanceof FormGroup) { value += this.countFormControlsWithValue(control); } else if (control instanceof FormArray) {
|
if (control instanceof FormGroup) {
|
||||||
|
value += this.countFormControlsWithValue(control);
|
||||||
|
} else if (control instanceof FormArray) {
|
||||||
const formArray = (<FormArray>control);
|
const formArray = (<FormArray>control);
|
||||||
for (let i = 0; i < formArray.length; i++) {
|
for (let i = 0; i < formArray.length; i++) {
|
||||||
value += this.countFormControlsWithValue(<FormGroup>formArray.get('' + i));
|
value += this.countFormControlsWithValue(<FormGroup>formArray.get('' + i));
|
||||||
}
|
}
|
||||||
} else if (key === 'value' && control.value != null && control.value !== '') { value++; }
|
} else if (key === 'value' && control.value != null && control.value !== '' && this.visibilityRulesService.checkElementVisibility(form.controls['id'].value)) {
|
||||||
|
value++;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
getFormControlDepthLength(form: FormGroup): number {
|
getFormControlDepthLength(form: FormGroup): number {
|
||||||
let value = 0;
|
let value = 0;
|
||||||
Object.keys(form.controls).forEach(key => {
|
Object.keys(form.controls).forEach(key => {
|
||||||
const control = form.controls[key];
|
const control = form.controls[key];
|
||||||
if (control instanceof FormGroup) { value += this.getFormControlDepthLength(control); } else if (control instanceof FormArray) {
|
if (control instanceof FormGroup) {
|
||||||
|
value += this.getFormControlDepthLength(control);
|
||||||
|
} else if (control instanceof FormArray) {
|
||||||
const formArray = (<FormArray>control);
|
const formArray = (<FormArray>control);
|
||||||
for (let i = 0; i < formArray.length; i++) {
|
for (let i = 0; i < formArray.length; i++) {
|
||||||
if (<FormGroup>formArray.get('' + i).value && this.visibilityRulesService.checkElementVisibility(formArray.get('' + i).value.id)) {
|
if (<FormGroup>formArray.get('' + i).value && this.visibilityRulesService.checkElementVisibility(formArray.get('' + i).value.id)) {
|
||||||
|
|
|
@ -20,11 +20,21 @@
|
||||||
Add one more fieldset +
|
Add one more fieldset +
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<app-form-composite-field class="col-12" [form]="compositeFieldFormGroup" [datasetProfileId]="datasetProfileId" [isChild]="false"></app-form-composite-field>
|
<app-form-composite-field class="align-self-center col-12" [form]="compositeFieldFormGroup" [datasetProfileId]="datasetProfileId"
|
||||||
|
[isChild]="false"></app-form-composite-field>
|
||||||
<div *ngIf="compositeFieldFormGroup" class="col-12">
|
<div *ngIf="compositeFieldFormGroup" class="col-12">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<app-form-composite-field 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">
|
||||||
[form]="multipleCompositeFieldFormGroup" [datasetProfileId]="datasetProfileId" [isChild]="true"></app-form-composite-field>
|
<div class="styleBorder row">
|
||||||
|
<app-form-composite-field class=" align-self-center col" [form]="multipleCompositeFieldFormGroup" [datasetProfileId]="datasetProfileId"
|
||||||
|
[isChild]="true"></app-form-composite-field>
|
||||||
|
<div class="col-auto align-self-center">
|
||||||
|
<button mat-icon-button type="button" class="deleteBtn" (click)="deleteMultipeFieldFromCompositeFormGroup(i,j);">
|
||||||
|
<mat-icon>delete</mat-icon>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<mat-form-field *ngIf="compositeFieldFormGroup.get('hasCommentField').value" class="col-12" [formGroup]="compositeFieldFormGroup">
|
<mat-form-field *ngIf="compositeFieldFormGroup.get('hasCommentField').value" class="col-12" [formGroup]="compositeFieldFormGroup">
|
||||||
<input matInput formControlName="commentFieldValue" placeholder="comment">
|
<input matInput formControlName="commentFieldValue" placeholder="comment">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
|
@ -3,3 +3,8 @@
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.styleBorder{
|
||||||
|
border: 1px solid lightgray;
|
||||||
|
border-radius: 0.5em;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
|
|
@ -39,6 +39,10 @@ export class FormSectionComponent implements OnInit {
|
||||||
(<FormArray>(this.form.get('compositeFields').get('' + fieldsetIndex).get('multiplicityItems'))).push(compositeField.buildForm());
|
(<FormArray>(this.form.get('compositeFields').get('' + fieldsetIndex).get('multiplicityItems'))).push(compositeField.buildForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteMultipeFieldFromCompositeFormGroup(compositeFildIndex: number, fildIndex: number) {
|
||||||
|
(<FormArray>(this.form.get('compositeFields').get('' + compositeFildIndex).get('multiplicityItems'))).removeAt(fildIndex);
|
||||||
|
}
|
||||||
|
|
||||||
// isElementVisible(fieldSet: CompositeField): boolean {
|
// isElementVisible(fieldSet: CompositeField): boolean {
|
||||||
// return fieldSet && fieldSet.fields && fieldSet.fields.length > 0
|
// return fieldSet && fieldSet.fields && fieldSet.fields.length > 0
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -188,7 +188,7 @@ export class DatasetDescriptionCompositeFieldEditorModel extends BaseFormModel {
|
||||||
const newItem: DatasetDescriptionCompositeFieldEditorModel = new DatasetDescriptionCompositeFieldEditorModel();
|
const newItem: DatasetDescriptionCompositeFieldEditorModel = new DatasetDescriptionCompositeFieldEditorModel();
|
||||||
newItem.id = 'multiple_' + item.id + '_' + Guid.create();
|
newItem.id = 'multiple_' + item.id + '_' + Guid.create();
|
||||||
item.fields.forEach((field, index) => {
|
item.fields.forEach((field, index) => {
|
||||||
newItem.fields.push(new DatasetDescriptionFieldEditorModel().cloneForMultiplicity(field, newItem.id + '_'));
|
newItem.fields.push(new DatasetDescriptionFieldEditorModel().cloneForMultiplicity(field, newItem.id));
|
||||||
});
|
});
|
||||||
newItem.ordinal = item.ordinal;
|
newItem.ordinal = item.ordinal;
|
||||||
return newItem;
|
return newItem;
|
||||||
|
@ -275,10 +275,11 @@ export class DatasetDescriptionFieldEditorModel extends BaseFormModel {
|
||||||
|
|
||||||
// return newItem;
|
// return newItem;
|
||||||
// }
|
// }
|
||||||
cloneForMultiplicity(item: Field,idPath: string): DatasetDescriptionFieldEditorModel {
|
cloneForMultiplicity(item: Field, idPath: string): DatasetDescriptionFieldEditorModel {
|
||||||
const newItem: DatasetDescriptionFieldEditorModel = new DatasetDescriptionFieldEditorModel();
|
const newItem: DatasetDescriptionFieldEditorModel = new DatasetDescriptionFieldEditorModel();
|
||||||
|
|
||||||
newItem.id = idPath ? idPath + Guid.create() : 'multiple_' + item.id + '_' + Guid.create();
|
//newItem.id = idPath ? idPath : 'multiple_' + item.id + '_' + Guid.create();
|
||||||
|
newItem.id = idPath ? idPath + '_' + item.id : 'multiple_' + Guid.create() + '_' + item.id;
|
||||||
newItem.title = item.title;
|
newItem.title = item.title;
|
||||||
newItem.description = item.description;
|
newItem.description = item.description;
|
||||||
newItem.extendedDescription = item.extendedDescription;
|
newItem.extendedDescription = item.extendedDescription;
|
||||||
|
|
Loading…
Reference in New Issue