argos/dmp-frontend/src/app/ui/admin/dataset-profile/admin/default-value-editor-model.ts

23 lines
835 B
TypeScript
Raw Normal View History

2019-01-18 18:03:45 +01:00
import { FormGroup } from '@angular/forms';
import { DefaultValue } from '../../../../core/model/admin/dataset-profile/dataset-profile';
import { BaseFormModel } from '../../../../core/model/base-form-model';
export class DefaultValueEditorModel extends BaseFormModel {
public type: string;
public value: string;
fromModel(item: DefaultValue): DefaultValueEditorModel {
this.type = item.type;
this.value = item.value;
return this;
}
buildForm(disabled: boolean = false, skipDisable: Array<String> = []): FormGroup {
2019-01-18 18:03:45 +01:00
const formGroup = this.formBuilder.group({
type: [{ value: this.type, disabled: (disabled && !skipDisable.includes('DefaultValueEditorModel.type')) }],
value: [{ value: this.value, disabled: (disabled && !skipDisable.includes('DefaultValueEditorModel.value')) }]
2019-01-18 18:03:45 +01:00
});
return formGroup;
}
}