-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface_type.ts
More file actions
68 lines (56 loc) · 1.23 KB
/
interface_type.ts
File metadata and controls
68 lines (56 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
enum ESectionType {
FIELDS = 'fields',
TABLE = 'table'
}
enum EInputType {
TEXT = 'text',
SELECT = 'select',
BUTTON = 'button'
}
interface IDependency {
dependency: string;
section: string;
fields: Array<{as: string, key: string}>;
}
type TField = ITextField | ISelect | IButton;
interface IInput {
name: string;
label: string;
required: boolean;
readOnly: boolean;
inputWidth: number;
fieldWidth: number;
dependencies?: Array<IDependency>;
}
interface ITextField extends IInput {
type: EInputType.TEXT;
}
interface ISelect extends IInput {
type: EInputType.SELECT;
selectQuery: string;
}
enum EButtonType {
ADD = 'add',
EDIT = 'edit',
SAVE = 'save',
DELETE = 'delete',
CANCEL = 'cancel'
}
interface IButton extends IInput {
type: EInputType.BUTTON;
buttonType: EButtonType;
value: string;
}
interface IFieldsSection {
section: string;
sectionType: ESectionType.FIELDS;
fields: Array<TField>;
}
interface ITableSection {
section: string;
sectionType: ESectionType.TABLE;
caption?: TField;
columns: Array<TField>;
}
type TColumn = TField & {columnWidth: number};
type TForm = Array<IFieldsSection | ITableSection>;