fixes, add ordinal & multiplicity fields

This commit is contained in:
annampak 2017-11-28 13:42:30 +02:00
parent d5d3f5ef37
commit f558910905
6 changed files with 51 additions and 23 deletions

View File

@ -1,12 +1,23 @@
<div class= "container">
<h4>FieldSet</h4>
<div *ngFor="let field of dataModel.fields let i=index;">
<field-form [form]="form.get('fields').get(''+i)" [dataModel]="field"></field-form>
<div>
<h4>FieldSet</h4>
<div [formGroup]="form">
<div class="form-row">
<div class="form-group col-md-12">
<div class="form-group col-md-6">
<label>Multiplicity</label>
<input type="nymber" class="form-control" formControlName="multiplicity">
</div>
</div>
</div>
<div>
<a (click)="addNewField()" style="cursor: pointer">
Add another field +
</a>
</div>
</div>
</div>
<div *ngFor="let field of dataModel.fields let i=index;">
<field-form [form]="form.get('fields').get(''+i)" [dataModel]="field"></field-form>
</div>
<div>
<a (click)="addNewField()" style="cursor: pointer">
Add another field +
</a>
</div>
</div>

View File

@ -35,12 +35,12 @@
</div>
<div class="form-group col-md-4">
<label>Ordinal</label>
<input type="number" class="form-control" formControlName="extendedDescription">
<input type="number" class="form-control" formControlName="ordinal">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label>Default Visibility</label>
<div class="form-group col-md-4">
<label class="radio control-label" >Default Visibility</label>
<label class="radio-inline">
<input type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1"> true
</label>
@ -48,13 +48,21 @@
<input type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2"> false
</label>
</div>
<div class="form-group col-md-4">
<label>Multiplicity</label>
<input type="number" class="form-control" formControlName="multiplicity">
</div>
<div class="form-group col-md-4">
<label>Default Value</label>
<input type="text" class="form-control" formControlName="value">
</div>
</div>
</div>
<div *ngFor="let rule of dataModel.rules let i=index;">
<rule-form [form]="form.get('rules').get(''+i)" [dataModel]="rule"></rule-form>
</div>
<div style="padding-left: 15px;">
<div>
<a (click)="addNewRule(form)" style="cursor: pointer">
Add another rule +
</a>

View File

@ -1,4 +1,4 @@
<div class= "container">
<div><!-- style="border-style: solid;"-->
<h4 style="text-decoration: underline;">GroupFields</h4>
<div [formGroup]="form">
<div class="form-row">
@ -11,17 +11,17 @@
<input type="text" class="form-control" formControlName="id">
</div>
<div class="form-group col-md-4">
<label>defaultVisibility</label>
<label>DefaultVisibility</label>
<input type="text" class="form-control" formControlName="defaultVisibility">
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label>description</label>
<label>Description</label>
<input type="text" class="form-control" formControlName="description">
</div>
<div class="form-group col-md-6">
<label>extendedDescription</label>
<label>ExtendedDescription</label>
<input type="text" class="form-control" formControlName="extendedDescription">
</div>
</div>

View File

@ -5,16 +5,19 @@ import { BaseModel } from './BaseModel';
import {Field} from './Field'
export class CompositeField extends BaseModel implements Serializable<CompositeField> {
public fields:Array<Field> = new Array<Field>();
public multiplicity:number;
fromJSONObject(item:any):CompositeField{
this.fields = new JsonSerializer<Field>().fromJSONArray(item.fields,Field);
this.multiplicity = item.multiplicity;
return this;
}
buildForm():FormGroup{
let formGroup = this.formBuilder.group({});
let formGroup = this.formBuilder.group({
multiplicity:[this.multiplicity]
});
let fieldsFormArray = new Array<FormGroup>();
this.fields.forEach(item => {

View File

@ -15,6 +15,8 @@ export class Field extends BaseModel implements Serializable<Field>,FormGenerato
public viewStyle:string;
public defaultVisibility:boolean;
public page:number;
public multiplicity: number;
public ordinal: number;
public rules: Array<Rule> = new Array<Rule>();
fromJSONObject(item:any):Field{
@ -26,6 +28,8 @@ export class Field extends BaseModel implements Serializable<Field>,FormGenerato
this.viewStyle = item.viewStyle;
this.defaultVisibility = item.defaultVisibility;
this.page = item.page;
this.multiplicity = item.multiplicity;
this.ordinal = item.ordinal;
this.rules = new JsonSerializer<Rule>().fromJSONArray(item.rule, Rule);
return this;
}
@ -39,7 +43,9 @@ export class Field extends BaseModel implements Serializable<Field>,FormGenerato
extendedDescription:[this.extendedDescription],
viewStyle: [this.viewStyle],
defaultVisibility:[this.defaultVisibility],
page:[this.page]
page:[this.page] ,
multiplicity: [this.multiplicity],
ordinal:[this.ordinal]
});
let rulesFormArray = new Array<FormGroup>();

View File

@ -1,4 +1,4 @@
<div><!--style="border-style: solid;"-->
<div style="background-color: #f5f5f5;border: 1px solid #e3e3e3;padding: 24px;"><!--style="border-style: solid;"-->
<h4 style="text-decoration: underline;">Section</h4>
<div [formGroup]="form">
<div class="form-row">