34 lines
955 B
TypeScript
34 lines
955 B
TypeScript
|
import { Rule } from '../../entities/common/rule';
|
||
|
export class FieldBase<T>{
|
||
|
value: T;
|
||
|
key: string;
|
||
|
label: string;
|
||
|
required:boolean;
|
||
|
order:number;
|
||
|
rules: Rule[];
|
||
|
visible: boolean;
|
||
|
controlType:string;
|
||
|
group:string;
|
||
|
|
||
|
constructor(options: {
|
||
|
value?: T,
|
||
|
key?: string,
|
||
|
label?: string,
|
||
|
required?:boolean,
|
||
|
order?: number,
|
||
|
rules?: Rule[],
|
||
|
visible?: boolean,
|
||
|
controlType?: string
|
||
|
group?: string
|
||
|
} = {}) {
|
||
|
this.value = options.value;
|
||
|
this.key = options.key || '';
|
||
|
this.label = options.label || '';
|
||
|
this.required = !! options.required;
|
||
|
this.order = options.order === undefined ? 1 : options.order;
|
||
|
this.rules = options.rules;
|
||
|
this.visible = options.visible;
|
||
|
this.controlType = options.controlType || '';
|
||
|
this.group = options.group || '';
|
||
|
}
|
||
|
}
|