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="row">
<div class="form-group col-md-6"> <div class="form-group col-md-6">
<label>Title</label> <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>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label>Id</label> <label>Id</label>

View File

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

View File

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

View File

@ -6,15 +6,17 @@
<i>{{group.extendedDescription}}</i> <i>{{group.extendedDescription}}</i>
</h5> --> </h5> -->
<div *ngFor="let compositeField of group.compositeFields; let i = index;"> <div *ngFor="let compositeField of group.compositeFields; let i = index;">
<div *ngIf="(compositeField?.multiplicity?.max - 1) > (compositeField?.multiplicityItems?.length)"> <div *ngIf="visibilityRulesService.isElementVisible(null,compositeField.id)">
<a (click)="addMultipleField(i)" style="cursor: pointer"> <div *ngIf="(compositeField?.multiplicity?.max - 1) > (compositeField?.multiplicityItems?.length)">
Add one more field + <a (click)="addMultipleField(i)" style="cursor: pointer">
</a> Add one more field +
</a>
</div>
</div> </div>
<df-composite-field [compositeField]="compositeField" [form]="form.get('compositeFields').get(''+i)" [path]="path" [pathName]="pathName+'.compositeFields.'+i"></df-composite-field> <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;"> <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)" <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> </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.fields = new JsonSerializer<Field>().fromJSONArray(item.fields, Field);
this.ordinal = item.ordinal; this.ordinal = item.ordinal;
this.id = item.id; this.id = item.id;
//this.multiplicity = new JsonSerializer<Multiplicity>().fromJSONObject(item.multiplicity, Multiplicity); this.multiplicity = new JsonSerializer<Multiplicity>().fromJSONObject(item.multiplicity, Multiplicity);
this.multiplicity = new Multiplicity(); //this.multiplicity = new Multiplicity();
//this.multiplicity.max = 2; //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; return this;
} }

View File

@ -29,12 +29,12 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
this.viewStyle = item.viewStyle; this.viewStyle = item.viewStyle;
this.defaultVisibility = item.defaultVisibility; this.defaultVisibility = item.defaultVisibility;
this.page = item.page; 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.defaultValue = new JsonSerializer<DefaultValue>().fromJSONObject(item.defaultValue, DefaultValue);
this.value = this.defaultValue.value && !item.value ? this.defaultValue.value : item.value; 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.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; this.data = item.data;
return this; return this;
} }