51 lines
1.1 KiB
TypeScript
51 lines
1.1 KiB
TypeScript
import { Serializable } from "../Serializable";
|
|
import { FormGenerator } from "../interfaces/FormGenerator";
|
|
import { FormGroup, FormBuilder } from "@angular/forms";
|
|
|
|
export enum DMPProfileType {
|
|
INPUT = 0
|
|
}
|
|
|
|
export enum DMPProfileFieldDataType {
|
|
DATE = 0,
|
|
NUMBER = 1,
|
|
TEXT = 2
|
|
}
|
|
|
|
export class DataManagementProfileField implements Serializable<DataManagementProfileField>, FormGenerator<FormGroup>{
|
|
|
|
|
|
public type: DMPProfileType;
|
|
|
|
public dataType: DMPProfileFieldDataType;
|
|
|
|
public required: boolean = false;
|
|
|
|
public label: string;
|
|
|
|
public id: string
|
|
|
|
public value:any
|
|
|
|
fromJSONObject(item: any): DataManagementProfileField {
|
|
this.type = item.type;
|
|
this.dataType = item.dataType;
|
|
this.required = item.required;
|
|
this.label = item.label;
|
|
this.id = item.id
|
|
this.value = item.value
|
|
return this;
|
|
}
|
|
|
|
buildForm(): FormGroup {
|
|
return new FormBuilder().group({
|
|
type: [this.type],
|
|
id: [this.id],
|
|
dataType: [this.dataType],
|
|
required: [this.required],
|
|
label: [this.label]
|
|
})
|
|
}
|
|
}
|
|
|