form renderer fixes (#1882)

- provide support for showing generated documents in Display Value widget
This commit is contained in:
Denys Vuika 2017-05-18 16:29:54 +01:00 committed by Eugenio Romano
parent a90423aa21
commit e63802ef4f
3 changed files with 18 additions and 0 deletions

View File

@ -34,6 +34,7 @@ export class FormFieldTypes {
static NUMBER: string = 'integer';
static DATE: string = 'date';
static AMOUNT: string = 'amount';
static DOCUMENT: string = 'document';
static READONLY_TYPES: string[] = [
FormFieldTypes.HYPERLINK,

View File

@ -51,6 +51,11 @@
</div>
</div>
</div>
<div *ngSwitchCase="'document'">
<div *ngIf="hasFile">
<activiti-content [id]="id" [showDocumentContent]="true"></activiti-content>
</div>
</div>
<div *ngSwitchDefault
class="mdl-textfield mdl-js-textfield text-widget is-disabled is-dirty is-upgraded">
<label [attr.for]="field.id">{{field.name}}</label>

View File

@ -98,6 +98,18 @@ export class DisplayValueWidget extends WidgetComponent implements OnInit {
this.hasFile = false;
}
break;
case FormFieldTypes.DOCUMENT:
console.log('document');
const file = this.field.value;
if (file) {
this.value = decodeURI(file.name);
this.id = file.id;
this.hasFile = true;
} else {
this.value = null;
this.hasFile = false;
}
break;
case FormFieldTypes.TYPEAHEAD:
this.loadRestFieldValue();
break;