data label in field, description, extended description in datasetfield

This commit is contained in:
annampak 2018-01-05 09:49:12 +02:00
parent 3a60d78c81
commit 3faa7c29cb
10 changed files with 16 additions and 30 deletions

View File

@ -1,11 +0,0 @@
import {FieldBase} from '../field-base';
export class TextAreaField extends FieldBase<string> {
controlType = 'textarea';
type: string;
constructor (options: {} = {}) {
super(options);
this.type = options['type'] || '';
}
}

View File

@ -1,3 +0,0 @@
<label>{{field.description}}</label>
<div>{{field.extendedDescription}}</div>
<input matInput [formControlName]="field.key" [id]="field.key" [type]="field.type" required ="field.required">

View File

@ -1,11 +0,0 @@
import {FieldBase} from '../field-base';
export class TextboxField extends FieldBase<string> {
controlType = 'textbox';
type: string;
constructor (options: {} = {}) {
super(options);
this.type = options['type'] || '';
}
}

View File

@ -11,7 +11,7 @@
<div *ngSwitchCase="'freetext'">
<mat-form-field>
<input matInput formControlName="value" placeholder={{field.title}}>
<input matInput formControlName="value" placeholder="{{field.data.label}}">
</mat-form-field>
</div>

View File

@ -1,6 +1,10 @@
<div *ngIf="visibilityRulesService.isElementVisible(pathName,compositeField.id)" [id]="compositeField.id" [formGroup]="form">
<h5 *ngIf="compositeField.title">{{compositeField.title}}</h5>
<h5 *ngIf="compositeField.description">{{compositeField.description}}</h5>
<h5 *ngIf="compositeField.extendedDescription" class="fieldset-extended-desc">
<i>{{compositeField.extendedDescription}}</i>
</h5>
<df-field *ngIf="compositeField.fields.length == 1" [field]="compositeField.fields[0]" [form]="form.get('fields').get(''+0)"
[pathName]="pathName+'.fields.'+0"></df-field>

View File

@ -21,7 +21,7 @@ export class DynamicFormCompositeFieldComponent implements OnInit {
constructor(private visibilityRulesService: VisibilityRulesService) { }
ngOnInit() {
ngOnInit() {debugger;
console.log(this.form);
}

View File

@ -29,4 +29,5 @@
</div>
</mat-sidenav-content>
</mat-sidenav-container>
</div>
</div>
<p>Form value: {{ form.value | json }}</p>

View File

@ -11,6 +11,8 @@ export class CompositeField extends BaseModel implements Serializable<CompositeF
public multiplicity: Multiplicity;
public multiplicityItems: Array<CompositeField> = new Array<CompositeField>();
public title: string
public description: string
public extendedDescription: string
fromJSONObject(item: any): CompositeField {
@ -18,6 +20,8 @@ export class CompositeField extends BaseModel implements Serializable<CompositeF
this.ordinal = item.ordinal;
this.id = item.id;
this.title = item.title;
this.description = item.description;
this.extendedDescription = item.extendedDescription;
this.multiplicity = JsonSerializer.fromJSONObject(item.multiplicity, Multiplicity);
//this.multiplicity = new Multiplicity();
//this.multiplicity.max = 2;
@ -29,7 +33,9 @@ export class CompositeField extends BaseModel implements Serializable<CompositeF
let formGroup = this.formBuilder.group({
id: this.id,
ordinal: this.ordinal,
title: this.title
title: this.title,
description: this.description,
extendedDescription: this.extendedDescription
});
let fieldsFormArray = new Array<FormGroup>();

View File

@ -42,6 +42,7 @@ export class Field extends BaseModel implements Serializable<Field>, FormGenerat
buildForm(): FormGroup {
let formGroup = this.formBuilder.group({
id: [this.id],
data:[this.data],
/* title: [this.title], */
value: [this.value]/* ,
description: [this.description],