multiplicity

This commit is contained in:
annampak 2017-12-13 11:26:02 +02:00
parent 30d136e634
commit b9fa3d1dac
6 changed files with 15 additions and 15 deletions

View File

@ -3,7 +3,7 @@
<div class="row">
<div class="form-group col-md-6">
<label>Title</label>
<input type="text" class="form-control" formControlName="title">
<input data-toggle="tooltip" title="tooltip on second input!" type="text" class="form-control" formControlName="title">
</div>
<div class="form-group col-md-3">
<label>Id</label>

View File

@ -23,7 +23,6 @@ export class FieldFormComponent {
constructon() { }
ngOnInit() {
console.log("init field")
// this.addNewRule();
}

View File

@ -18,8 +18,7 @@ export class GroupFieldFormComponent {
constructor(){}
ngOnInit(){
console.log("init group");
ngOnInit(){
//this.addNewField();
}

View File

@ -6,15 +6,17 @@
<i>{{group.extendedDescription}}</i>
</h5> -->
<div *ngFor="let compositeField of group.compositeFields; let i = index;">
<div *ngIf="(compositeField?.multiplicity?.max - 1) > (compositeField?.multiplicityItems?.length)">
<a (click)="addMultipleField(i)" style="cursor: pointer">
Add one more field +
</a>
<div *ngIf="visibilityRulesService.isElementVisible(null,compositeField.id)">
<div *ngIf="(compositeField?.multiplicity?.max - 1) > (compositeField?.multiplicityItems?.length)">
<a (click)="addMultipleField(i)" style="cursor: pointer">
Add one more field +
</a>
</div>
</div>
<df-composite-field [compositeField]="compositeField" [form]="form.get('compositeFields').get(''+i)" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></df-composite-field>
<div *ngFor="let multipleCompositeField of compositeField.multiplicityItems; let j = index;">
<df-composite-field [compositeField]="multipleCompositeField" [form]="form.get('compositeFields').get(''+i).get('multiplicityItems').get(''+j)"
[pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></df-composite-field>
[pathName]="pathName+'.compositeFields.'+i+'.multiplicityItems.'+j"></df-composite-field>
</div>
</div>
</div>

View File

@ -16,10 +16,10 @@ export class CompositeField extends BaseModel implements Serializable<CompositeF
this.fields = new JsonSerializer<Field>().fromJSONArray(item.fields, Field);
this.ordinal = item.ordinal;
this.id = item.id;
//this.multiplicity = new JsonSerializer<Multiplicity>().fromJSONObject(item.multiplicity, Multiplicity);
this.multiplicity = new Multiplicity();
this.multiplicity = new JsonSerializer<Multiplicity>().fromJSONObject(item.multiplicity, Multiplicity);
//this.multiplicity = new Multiplicity();
//this.multiplicity.max = 2;
this.multiplicityItems = new JsonSerializer<CompositeField>().fromJSONArray(item.multiplicityItems, CompositeField);
if(item.multiplicityItems)this.multiplicityItems = new JsonSerializer<CompositeField>().fromJSONArray(item.multiplicityItems, CompositeField);
return this;
}

View File

@ -29,12 +29,12 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
this.viewStyle = item.viewStyle;
this.defaultVisibility = item.defaultVisibility;
this.page = item.page;
//this.multiplicity = new JsonSerializer<Multiplicity>().fromJSONObject(item.multiplicity, Multiplicity);
this.multiplicity = new JsonSerializer<Multiplicity>().fromJSONObject(item.multiplicity, Multiplicity);
this.defaultValue = new JsonSerializer<DefaultValue>().fromJSONObject(item.defaultValue, DefaultValue);
this.value = this.defaultValue.value && !item.value ? this.defaultValue.value : item.value;
this.multiplicity = new Multiplicity();
//this.multiplicity = new Multiplicity();
//this.multiplicity.max = 2;
this.multiplicityItems = new JsonSerializer<Field>().fromJSONArray(item.multiplicityItems, Field);
if(item.multiplicityItems)this.multiplicityItems = new JsonSerializer<Field>().fromJSONArray(item.multiplicityItems, Field);
this.data = item.data;
return this;
}