@react-typed-forms/schemas 1.0.0-dev.15 → 1.0.0-dev.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +4 -0
- package/.rush/temp/operation/build/state.json +1 -1
- package/.rush/temp/shrinkwrap-deps.json +453 -4
- package/lib/controlRender.d.ts +100 -100
- package/lib/hooks.d.ts +9 -9
- package/lib/index.d.ts +5 -7
- package/lib/index.js +3402 -26
- package/lib/index.js.map +1 -0
- package/lib/schemaBuilder.d.ts +87 -87
- package/lib/types.d.ts +234 -234
- package/lib/util.d.ts +3 -0
- package/package.json +5 -3
- package/src/controlRender.tsx +1 -1
- package/src/index.ts +1 -10
- package/src/util.ts +9 -0
- package/tsconfig.json +4 -3
- package/.rush/temp/operation/build/all.log +0 -1
- package/lib/controlRender.js +0 -215
- package/lib/hooks.js +0 -103
- package/lib/schemaBuilder.js +0 -67
- package/lib/types.js +0 -112
- package/schemas.build.log +0 -1
package/lib/schemaBuilder.d.ts
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import { CompoundField, FieldOption, FieldType, SchemaField } from "./types";
|
|
2
|
-
type AllowedSchema<T> = T extends string ? SchemaField & {
|
|
3
|
-
type: FieldType.String | FieldType.Date | FieldType.DateTime;
|
|
4
|
-
} : T extends number ? SchemaField & {
|
|
5
|
-
type: FieldType.Int | FieldType.Double;
|
|
6
|
-
} : T extends boolean ? SchemaField & {
|
|
7
|
-
type: FieldType.Bool;
|
|
8
|
-
} : T extends Array<infer E> ? AllowedSchema<E> & {
|
|
9
|
-
collection: true;
|
|
10
|
-
} : T extends {
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
} ? CompoundField & {
|
|
13
|
-
type: FieldType.Compound;
|
|
14
|
-
} : SchemaField & {
|
|
15
|
-
type: FieldType.Any;
|
|
16
|
-
};
|
|
17
|
-
type AllowedField<T, K> = (name: string) => (SchemaField & {
|
|
18
|
-
type: K;
|
|
19
|
-
}) | AllowedSchema<T>;
|
|
20
|
-
export declare function buildSchema<T, Custom = "">(def: {
|
|
21
|
-
[K in keyof T]-?: AllowedField<T[K], Custom>;
|
|
22
|
-
}): SchemaField[];
|
|
23
|
-
export declare function stringField(displayName: string, options?: Partial<Omit<SchemaField, "type">>): (name: string) => SchemaField & {
|
|
24
|
-
field?: string | undefined;
|
|
25
|
-
displayName: string | null;
|
|
26
|
-
tags?: string[] | null | undefined;
|
|
27
|
-
system?: boolean | null | undefined;
|
|
28
|
-
collection?: boolean | null | undefined;
|
|
29
|
-
onlyForTypes?: string[] | null | undefined;
|
|
30
|
-
required?: boolean | null | undefined;
|
|
31
|
-
defaultValue?: any;
|
|
32
|
-
isTypeField?: boolean | null | undefined;
|
|
33
|
-
searchable?: boolean | null | undefined;
|
|
34
|
-
options?: FieldOption[] | null | undefined;
|
|
35
|
-
restrictions?: import("./types").SchemaRestrictions | null | undefined;
|
|
36
|
-
type: FieldType.String;
|
|
37
|
-
};
|
|
38
|
-
export declare function stringOptionsField(displayName: string, ...options: FieldOption[]): (name: string) => SchemaField & {
|
|
39
|
-
type: FieldType.String;
|
|
40
|
-
displayName: string;
|
|
41
|
-
options: FieldOption[];
|
|
42
|
-
};
|
|
43
|
-
export declare function withScalarOptions<S extends SchemaField>(options: Partial<SchemaField>, v: (name: string) => S): (name: string) => S;
|
|
44
|
-
export declare function makeScalarField<S extends Partial<SchemaField>>(options: S): (name: string) => SchemaField & S;
|
|
45
|
-
export declare function makeCompoundField<S extends Partial<CompoundField>>(options: S): (name: string) => CompoundField & {
|
|
46
|
-
type: FieldType.Compound;
|
|
47
|
-
} & S;
|
|
48
|
-
export declare function intField(displayName: string, options?: Partial<Omit<SchemaField, "type">>): (name: string) => SchemaField & {
|
|
49
|
-
field?: string | undefined;
|
|
50
|
-
displayName: string | null;
|
|
51
|
-
tags?: string[] | null | undefined;
|
|
52
|
-
system?: boolean | null | undefined;
|
|
53
|
-
collection?: boolean | null | undefined;
|
|
54
|
-
onlyForTypes?: string[] | null | undefined;
|
|
55
|
-
required?: boolean | null | undefined;
|
|
56
|
-
defaultValue?: any;
|
|
57
|
-
isTypeField?: boolean | null | undefined;
|
|
58
|
-
searchable?: boolean | null | undefined;
|
|
59
|
-
options?: FieldOption[] | null | undefined;
|
|
60
|
-
restrictions?: import("./types").SchemaRestrictions | null | undefined;
|
|
61
|
-
type: FieldType.Int;
|
|
62
|
-
};
|
|
63
|
-
export declare function boolField(displayName: string, options?: Partial<Omit<SchemaField, "type">>): (name: string) => SchemaField & {
|
|
64
|
-
field?: string | undefined;
|
|
65
|
-
displayName: string | null;
|
|
66
|
-
tags?: string[] | null | undefined;
|
|
67
|
-
system?: boolean | null | undefined;
|
|
68
|
-
collection?: boolean | null | undefined;
|
|
69
|
-
onlyForTypes?: string[] | null | undefined;
|
|
70
|
-
required?: boolean | null | undefined;
|
|
71
|
-
defaultValue?: any;
|
|
72
|
-
isTypeField?: boolean | null | undefined;
|
|
73
|
-
searchable?: boolean | null | undefined;
|
|
74
|
-
options?: FieldOption[] | null | undefined;
|
|
75
|
-
restrictions?: import("./types").SchemaRestrictions | null | undefined;
|
|
76
|
-
type: FieldType.Bool;
|
|
77
|
-
};
|
|
78
|
-
export declare function compoundField<Other extends Partial<Omit<CompoundField, "type" | "schemaType">>>(displayName: string, fields: SchemaField[], other: Other): (name: string) => CompoundField & {
|
|
79
|
-
collection: Other["collection"];
|
|
80
|
-
};
|
|
81
|
-
export declare function defaultScalarField(field: string, displayName: string): Omit<SchemaField, "type"> & {
|
|
82
|
-
type: FieldType.String;
|
|
83
|
-
};
|
|
84
|
-
export declare function defaultCompoundField(field: string, displayName: string, collection: boolean): CompoundField & {
|
|
85
|
-
type: FieldType.Compound;
|
|
86
|
-
};
|
|
87
|
-
export {};
|
|
1
|
+
import { CompoundField, FieldOption, FieldType, SchemaField } from "./types";
|
|
2
|
+
type AllowedSchema<T> = T extends string ? SchemaField & {
|
|
3
|
+
type: FieldType.String | FieldType.Date | FieldType.DateTime;
|
|
4
|
+
} : T extends number ? SchemaField & {
|
|
5
|
+
type: FieldType.Int | FieldType.Double;
|
|
6
|
+
} : T extends boolean ? SchemaField & {
|
|
7
|
+
type: FieldType.Bool;
|
|
8
|
+
} : T extends Array<infer E> ? AllowedSchema<E> & {
|
|
9
|
+
collection: true;
|
|
10
|
+
} : T extends {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
} ? CompoundField & {
|
|
13
|
+
type: FieldType.Compound;
|
|
14
|
+
} : SchemaField & {
|
|
15
|
+
type: FieldType.Any;
|
|
16
|
+
};
|
|
17
|
+
type AllowedField<T, K> = (name: string) => (SchemaField & {
|
|
18
|
+
type: K;
|
|
19
|
+
}) | AllowedSchema<T>;
|
|
20
|
+
export declare function buildSchema<T, Custom = "">(def: {
|
|
21
|
+
[K in keyof T]-?: AllowedField<T[K], Custom>;
|
|
22
|
+
}): SchemaField[];
|
|
23
|
+
export declare function stringField(displayName: string, options?: Partial<Omit<SchemaField, "type">>): (name: string) => SchemaField & {
|
|
24
|
+
field?: string | undefined;
|
|
25
|
+
displayName: string | null;
|
|
26
|
+
tags?: string[] | null | undefined;
|
|
27
|
+
system?: boolean | null | undefined;
|
|
28
|
+
collection?: boolean | null | undefined;
|
|
29
|
+
onlyForTypes?: string[] | null | undefined;
|
|
30
|
+
required?: boolean | null | undefined;
|
|
31
|
+
defaultValue?: any;
|
|
32
|
+
isTypeField?: boolean | null | undefined;
|
|
33
|
+
searchable?: boolean | null | undefined;
|
|
34
|
+
options?: FieldOption[] | null | undefined;
|
|
35
|
+
restrictions?: import("./types").SchemaRestrictions | null | undefined;
|
|
36
|
+
type: FieldType.String;
|
|
37
|
+
};
|
|
38
|
+
export declare function stringOptionsField(displayName: string, ...options: FieldOption[]): (name: string) => SchemaField & {
|
|
39
|
+
type: FieldType.String;
|
|
40
|
+
displayName: string;
|
|
41
|
+
options: FieldOption[];
|
|
42
|
+
};
|
|
43
|
+
export declare function withScalarOptions<S extends SchemaField>(options: Partial<SchemaField>, v: (name: string) => S): (name: string) => S;
|
|
44
|
+
export declare function makeScalarField<S extends Partial<SchemaField>>(options: S): (name: string) => SchemaField & S;
|
|
45
|
+
export declare function makeCompoundField<S extends Partial<CompoundField>>(options: S): (name: string) => CompoundField & {
|
|
46
|
+
type: FieldType.Compound;
|
|
47
|
+
} & S;
|
|
48
|
+
export declare function intField(displayName: string, options?: Partial<Omit<SchemaField, "type">>): (name: string) => SchemaField & {
|
|
49
|
+
field?: string | undefined;
|
|
50
|
+
displayName: string | null;
|
|
51
|
+
tags?: string[] | null | undefined;
|
|
52
|
+
system?: boolean | null | undefined;
|
|
53
|
+
collection?: boolean | null | undefined;
|
|
54
|
+
onlyForTypes?: string[] | null | undefined;
|
|
55
|
+
required?: boolean | null | undefined;
|
|
56
|
+
defaultValue?: any;
|
|
57
|
+
isTypeField?: boolean | null | undefined;
|
|
58
|
+
searchable?: boolean | null | undefined;
|
|
59
|
+
options?: FieldOption[] | null | undefined;
|
|
60
|
+
restrictions?: import("./types").SchemaRestrictions | null | undefined;
|
|
61
|
+
type: FieldType.Int;
|
|
62
|
+
};
|
|
63
|
+
export declare function boolField(displayName: string, options?: Partial<Omit<SchemaField, "type">>): (name: string) => SchemaField & {
|
|
64
|
+
field?: string | undefined;
|
|
65
|
+
displayName: string | null;
|
|
66
|
+
tags?: string[] | null | undefined;
|
|
67
|
+
system?: boolean | null | undefined;
|
|
68
|
+
collection?: boolean | null | undefined;
|
|
69
|
+
onlyForTypes?: string[] | null | undefined;
|
|
70
|
+
required?: boolean | null | undefined;
|
|
71
|
+
defaultValue?: any;
|
|
72
|
+
isTypeField?: boolean | null | undefined;
|
|
73
|
+
searchable?: boolean | null | undefined;
|
|
74
|
+
options?: FieldOption[] | null | undefined;
|
|
75
|
+
restrictions?: import("./types").SchemaRestrictions | null | undefined;
|
|
76
|
+
type: FieldType.Bool;
|
|
77
|
+
};
|
|
78
|
+
export declare function compoundField<Other extends Partial<Omit<CompoundField, "type" | "schemaType">>>(displayName: string, fields: SchemaField[], other: Other): (name: string) => CompoundField & {
|
|
79
|
+
collection: Other["collection"];
|
|
80
|
+
};
|
|
81
|
+
export declare function defaultScalarField(field: string, displayName: string): Omit<SchemaField, "type"> & {
|
|
82
|
+
type: FieldType.String;
|
|
83
|
+
};
|
|
84
|
+
export declare function defaultCompoundField(field: string, displayName: string, collection: boolean): CompoundField & {
|
|
85
|
+
type: FieldType.Compound;
|
|
86
|
+
};
|
|
87
|
+
export {};
|
package/lib/types.d.ts
CHANGED
|
@@ -1,234 +1,234 @@
|
|
|
1
|
-
export interface SchemaField {
|
|
2
|
-
type: string;
|
|
3
|
-
field: string;
|
|
4
|
-
displayName?: string | null;
|
|
5
|
-
tags?: string[] | null;
|
|
6
|
-
system?: boolean | null;
|
|
7
|
-
collection?: boolean | null;
|
|
8
|
-
onlyForTypes?: string[] | null;
|
|
9
|
-
required?: boolean | null;
|
|
10
|
-
defaultValue?: any;
|
|
11
|
-
isTypeField?: boolean | null;
|
|
12
|
-
searchable?: boolean | null;
|
|
13
|
-
options?: FieldOption[] | null;
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated Use options directly
|
|
16
|
-
*/
|
|
17
|
-
restrictions?: SchemaRestrictions | undefined | null;
|
|
18
|
-
}
|
|
19
|
-
export declare enum FieldType {
|
|
20
|
-
String = "String",
|
|
21
|
-
Bool = "Bool",
|
|
22
|
-
Int = "Int",
|
|
23
|
-
Date = "Date",
|
|
24
|
-
DateTime = "DateTime",
|
|
25
|
-
Double = "Double",
|
|
26
|
-
EntityRef = "EntityRef",
|
|
27
|
-
Compound = "Compound",
|
|
28
|
-
AutoId = "AutoId",
|
|
29
|
-
Image = "Image",
|
|
30
|
-
Any = "Any"
|
|
31
|
-
}
|
|
32
|
-
export interface EntityRefField extends SchemaField {
|
|
33
|
-
type: FieldType.EntityRef;
|
|
34
|
-
entityRefType: string;
|
|
35
|
-
parentField: string;
|
|
36
|
-
}
|
|
37
|
-
export interface SchemaRestrictions {
|
|
38
|
-
options?: FieldOption[] | null;
|
|
39
|
-
}
|
|
40
|
-
export interface FieldOption {
|
|
41
|
-
name: string;
|
|
42
|
-
value: any;
|
|
43
|
-
}
|
|
44
|
-
export interface CompoundField extends SchemaField {
|
|
45
|
-
type: FieldType.Compound;
|
|
46
|
-
children: SchemaField[];
|
|
47
|
-
treeChildren?: boolean;
|
|
48
|
-
}
|
|
49
|
-
export type AnyControlDefinition = DataControlDefinition | GroupedControlsDefinition | ActionControlDefinition | DisplayControlDefinition;
|
|
50
|
-
export interface ControlDefinition {
|
|
51
|
-
type: string;
|
|
52
|
-
title?: string | null;
|
|
53
|
-
dynamic?: DynamicProperty[] | null;
|
|
54
|
-
adornments?: ControlAdornment[] | null;
|
|
55
|
-
}
|
|
56
|
-
export declare enum ControlDefinitionType {
|
|
57
|
-
Data = "Data",
|
|
58
|
-
Group = "Group",
|
|
59
|
-
Display = "Display",
|
|
60
|
-
Action = "Action"
|
|
61
|
-
}
|
|
62
|
-
export interface DynamicProperty {
|
|
63
|
-
type: string;
|
|
64
|
-
expr: EntityExpression;
|
|
65
|
-
}
|
|
66
|
-
export declare enum DynamicPropertyType {
|
|
67
|
-
Visible = "Visible",
|
|
68
|
-
DefaultValue = "DefaultValue"
|
|
69
|
-
}
|
|
70
|
-
export interface EntityExpression {
|
|
71
|
-
type: string;
|
|
72
|
-
}
|
|
73
|
-
export declare enum ExpressionType {
|
|
74
|
-
Jsonata = "Jsonata",
|
|
75
|
-
FieldValue = "FieldValue",
|
|
76
|
-
UserMatch = "UserMatch"
|
|
77
|
-
}
|
|
78
|
-
export interface JsonataExpression extends EntityExpression {
|
|
79
|
-
type: ExpressionType.Jsonata;
|
|
80
|
-
expression: string;
|
|
81
|
-
}
|
|
82
|
-
export interface FieldValueExpression extends EntityExpression {
|
|
83
|
-
type: ExpressionType.FieldValue;
|
|
84
|
-
field: string;
|
|
85
|
-
value: any;
|
|
86
|
-
}
|
|
87
|
-
export interface UserMatchExpression extends EntityExpression {
|
|
88
|
-
type: ExpressionType.UserMatch;
|
|
89
|
-
userMatch: string;
|
|
90
|
-
}
|
|
91
|
-
export interface ControlAdornment {
|
|
92
|
-
type: string;
|
|
93
|
-
}
|
|
94
|
-
export declare enum ControlAdornmentType {
|
|
95
|
-
Tooltip = "Tooltip",
|
|
96
|
-
Accordion = "Accordion"
|
|
97
|
-
}
|
|
98
|
-
export interface TooltipAdornment extends ControlAdornment {
|
|
99
|
-
type: ControlAdornmentType.Tooltip;
|
|
100
|
-
tooltip: string;
|
|
101
|
-
}
|
|
102
|
-
export interface AccordionAdornment extends ControlAdornment {
|
|
103
|
-
type: ControlAdornmentType.Accordion;
|
|
104
|
-
title: string;
|
|
105
|
-
defaultExpanded: boolean;
|
|
106
|
-
}
|
|
107
|
-
export interface DataControlDefinition extends ControlDefinition {
|
|
108
|
-
type: ControlDefinitionType.Data;
|
|
109
|
-
field: string;
|
|
110
|
-
required?: boolean | null;
|
|
111
|
-
renderOptions?: RenderOptions | null;
|
|
112
|
-
defaultValue?: any;
|
|
113
|
-
readonly?: boolean | null;
|
|
114
|
-
}
|
|
115
|
-
export interface RenderOptions {
|
|
116
|
-
type: string;
|
|
117
|
-
}
|
|
118
|
-
export declare enum DataRenderType {
|
|
119
|
-
Standard = "Standard",
|
|
120
|
-
Radio = "Radio",
|
|
121
|
-
HtmlEditor = "HtmlEditor",
|
|
122
|
-
IconList = "IconList",
|
|
123
|
-
CheckList = "CheckList",
|
|
124
|
-
UserSelection = "UserSelection",
|
|
125
|
-
Synchronised = "Synchronised",
|
|
126
|
-
IconSelector = "IconSelector",
|
|
127
|
-
DateTime = "DateTime"
|
|
128
|
-
}
|
|
129
|
-
export interface RadioButtonRenderOptions extends RenderOptions {
|
|
130
|
-
type: DataRenderType.Radio;
|
|
131
|
-
}
|
|
132
|
-
export interface StandardRenderer extends RenderOptions {
|
|
133
|
-
type: DataRenderType.Standard;
|
|
134
|
-
}
|
|
135
|
-
export interface HtmlEditorRenderOptions extends RenderOptions {
|
|
136
|
-
type: DataRenderType.HtmlEditor;
|
|
137
|
-
allowImages: boolean;
|
|
138
|
-
}
|
|
139
|
-
export interface DateTimeRenderOptions extends RenderOptions {
|
|
140
|
-
type: DataRenderType.DateTime;
|
|
141
|
-
format?: string | null;
|
|
142
|
-
}
|
|
143
|
-
export interface IconListRenderOptions extends RenderOptions {
|
|
144
|
-
type: DataRenderType.IconList;
|
|
145
|
-
iconMappings: IconMapping[];
|
|
146
|
-
}
|
|
147
|
-
export interface IconMapping {
|
|
148
|
-
value: string;
|
|
149
|
-
materialIcon?: string | null;
|
|
150
|
-
}
|
|
151
|
-
export interface CheckListRenderOptions extends RenderOptions {
|
|
152
|
-
type: DataRenderType.CheckList;
|
|
153
|
-
}
|
|
154
|
-
export interface SynchronisedRenderOptions extends RenderOptions {
|
|
155
|
-
type: DataRenderType.Synchronised;
|
|
156
|
-
fieldToSync: string;
|
|
157
|
-
syncType: SyncTextType;
|
|
158
|
-
}
|
|
159
|
-
export declare enum SyncTextType {
|
|
160
|
-
Camel = "Camel",
|
|
161
|
-
Snake = "Snake",
|
|
162
|
-
Pascal = "Pascal"
|
|
163
|
-
}
|
|
164
|
-
export interface UserSelectionRenderOptions extends RenderOptions {
|
|
165
|
-
type: DataRenderType.UserSelection;
|
|
166
|
-
noGroups: boolean;
|
|
167
|
-
noUsers: boolean;
|
|
168
|
-
}
|
|
169
|
-
export interface IconSelectionRenderOptions extends RenderOptions {
|
|
170
|
-
type: DataRenderType.IconSelector;
|
|
171
|
-
}
|
|
172
|
-
export interface GroupedControlsDefinition extends ControlDefinition {
|
|
173
|
-
type: ControlDefinitionType.Group;
|
|
174
|
-
children: ControlDefinition[];
|
|
175
|
-
compoundField?: string | null;
|
|
176
|
-
groupOptions: GroupRenderOptions;
|
|
177
|
-
}
|
|
178
|
-
export interface GroupRenderOptions {
|
|
179
|
-
type: string;
|
|
180
|
-
hideTitle?: boolean | null;
|
|
181
|
-
}
|
|
182
|
-
export declare enum GroupRenderType {
|
|
183
|
-
Standard = "Standard",
|
|
184
|
-
Grid = "Grid",
|
|
185
|
-
GroupElement = "GroupElement"
|
|
186
|
-
}
|
|
187
|
-
export interface StandardGroupRenderer extends GroupRenderOptions {
|
|
188
|
-
type: GroupRenderType.Standard;
|
|
189
|
-
}
|
|
190
|
-
export interface GroupElementRenderer extends GroupRenderOptions {
|
|
191
|
-
type: GroupRenderType.GroupElement;
|
|
192
|
-
value: any;
|
|
193
|
-
}
|
|
194
|
-
export interface GridRenderer extends GroupRenderOptions {
|
|
195
|
-
type: GroupRenderType.Grid;
|
|
196
|
-
columns?: number | null;
|
|
197
|
-
}
|
|
198
|
-
export interface DisplayControlDefinition extends ControlDefinition {
|
|
199
|
-
type: ControlDefinitionType.Display;
|
|
200
|
-
displayData: DisplayData;
|
|
201
|
-
}
|
|
202
|
-
export interface DisplayData {
|
|
203
|
-
type: string;
|
|
204
|
-
}
|
|
205
|
-
export declare enum DisplayDataType {
|
|
206
|
-
Text = "Text",
|
|
207
|
-
Html = "Html"
|
|
208
|
-
}
|
|
209
|
-
export interface TextDisplay extends DisplayData {
|
|
210
|
-
type: DisplayDataType.Text;
|
|
211
|
-
text: string;
|
|
212
|
-
}
|
|
213
|
-
export interface HtmlDisplay extends DisplayData {
|
|
214
|
-
type: DisplayDataType.Html;
|
|
215
|
-
html: string;
|
|
216
|
-
}
|
|
217
|
-
export interface ActionControlDefinition extends ControlDefinition {
|
|
218
|
-
type: ControlDefinitionType.Action;
|
|
219
|
-
actionId: string;
|
|
220
|
-
}
|
|
221
|
-
export declare function isDataControlDefinition(x: ControlDefinition): x is DataControlDefinition;
|
|
222
|
-
export declare function isGroupControlsDefinition(x: ControlDefinition): x is GroupedControlsDefinition;
|
|
223
|
-
export declare function isDisplayControlsDefinition(x: ControlDefinition): x is DisplayControlDefinition;
|
|
224
|
-
export declare function isActionControlsDefinition(x: ControlDefinition): x is ActionControlDefinition;
|
|
225
|
-
export interface ControlVisitor<A> {
|
|
226
|
-
data(d: DataControlDefinition): A;
|
|
227
|
-
group(d: GroupedControlsDefinition): A;
|
|
228
|
-
display(d: DisplayControlDefinition): A;
|
|
229
|
-
action(d: ActionControlDefinition): A;
|
|
230
|
-
}
|
|
231
|
-
export declare function visitControlDefinition<A>(x: ControlDefinition, visitor: ControlVisitor<A>, defaultValue: (c: ControlDefinition) => A): A;
|
|
232
|
-
export declare function dataControl(field: string, options?: Partial<DataControlDefinition>): DataControlDefinition;
|
|
233
|
-
export declare function fieldValueExpr(field: string, value: any): FieldValueExpression;
|
|
234
|
-
export declare function visibility(expr: EntityExpression): DynamicProperty;
|
|
1
|
+
export interface SchemaField {
|
|
2
|
+
type: string;
|
|
3
|
+
field: string;
|
|
4
|
+
displayName?: string | null;
|
|
5
|
+
tags?: string[] | null;
|
|
6
|
+
system?: boolean | null;
|
|
7
|
+
collection?: boolean | null;
|
|
8
|
+
onlyForTypes?: string[] | null;
|
|
9
|
+
required?: boolean | null;
|
|
10
|
+
defaultValue?: any;
|
|
11
|
+
isTypeField?: boolean | null;
|
|
12
|
+
searchable?: boolean | null;
|
|
13
|
+
options?: FieldOption[] | null;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use options directly
|
|
16
|
+
*/
|
|
17
|
+
restrictions?: SchemaRestrictions | undefined | null;
|
|
18
|
+
}
|
|
19
|
+
export declare enum FieldType {
|
|
20
|
+
String = "String",
|
|
21
|
+
Bool = "Bool",
|
|
22
|
+
Int = "Int",
|
|
23
|
+
Date = "Date",
|
|
24
|
+
DateTime = "DateTime",
|
|
25
|
+
Double = "Double",
|
|
26
|
+
EntityRef = "EntityRef",
|
|
27
|
+
Compound = "Compound",
|
|
28
|
+
AutoId = "AutoId",
|
|
29
|
+
Image = "Image",
|
|
30
|
+
Any = "Any"
|
|
31
|
+
}
|
|
32
|
+
export interface EntityRefField extends SchemaField {
|
|
33
|
+
type: FieldType.EntityRef;
|
|
34
|
+
entityRefType: string;
|
|
35
|
+
parentField: string;
|
|
36
|
+
}
|
|
37
|
+
export interface SchemaRestrictions {
|
|
38
|
+
options?: FieldOption[] | null;
|
|
39
|
+
}
|
|
40
|
+
export interface FieldOption {
|
|
41
|
+
name: string;
|
|
42
|
+
value: any;
|
|
43
|
+
}
|
|
44
|
+
export interface CompoundField extends SchemaField {
|
|
45
|
+
type: FieldType.Compound;
|
|
46
|
+
children: SchemaField[];
|
|
47
|
+
treeChildren?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export type AnyControlDefinition = DataControlDefinition | GroupedControlsDefinition | ActionControlDefinition | DisplayControlDefinition;
|
|
50
|
+
export interface ControlDefinition {
|
|
51
|
+
type: string;
|
|
52
|
+
title?: string | null;
|
|
53
|
+
dynamic?: DynamicProperty[] | null;
|
|
54
|
+
adornments?: ControlAdornment[] | null;
|
|
55
|
+
}
|
|
56
|
+
export declare enum ControlDefinitionType {
|
|
57
|
+
Data = "Data",
|
|
58
|
+
Group = "Group",
|
|
59
|
+
Display = "Display",
|
|
60
|
+
Action = "Action"
|
|
61
|
+
}
|
|
62
|
+
export interface DynamicProperty {
|
|
63
|
+
type: string;
|
|
64
|
+
expr: EntityExpression;
|
|
65
|
+
}
|
|
66
|
+
export declare enum DynamicPropertyType {
|
|
67
|
+
Visible = "Visible",
|
|
68
|
+
DefaultValue = "DefaultValue"
|
|
69
|
+
}
|
|
70
|
+
export interface EntityExpression {
|
|
71
|
+
type: string;
|
|
72
|
+
}
|
|
73
|
+
export declare enum ExpressionType {
|
|
74
|
+
Jsonata = "Jsonata",
|
|
75
|
+
FieldValue = "FieldValue",
|
|
76
|
+
UserMatch = "UserMatch"
|
|
77
|
+
}
|
|
78
|
+
export interface JsonataExpression extends EntityExpression {
|
|
79
|
+
type: ExpressionType.Jsonata;
|
|
80
|
+
expression: string;
|
|
81
|
+
}
|
|
82
|
+
export interface FieldValueExpression extends EntityExpression {
|
|
83
|
+
type: ExpressionType.FieldValue;
|
|
84
|
+
field: string;
|
|
85
|
+
value: any;
|
|
86
|
+
}
|
|
87
|
+
export interface UserMatchExpression extends EntityExpression {
|
|
88
|
+
type: ExpressionType.UserMatch;
|
|
89
|
+
userMatch: string;
|
|
90
|
+
}
|
|
91
|
+
export interface ControlAdornment {
|
|
92
|
+
type: string;
|
|
93
|
+
}
|
|
94
|
+
export declare enum ControlAdornmentType {
|
|
95
|
+
Tooltip = "Tooltip",
|
|
96
|
+
Accordion = "Accordion"
|
|
97
|
+
}
|
|
98
|
+
export interface TooltipAdornment extends ControlAdornment {
|
|
99
|
+
type: ControlAdornmentType.Tooltip;
|
|
100
|
+
tooltip: string;
|
|
101
|
+
}
|
|
102
|
+
export interface AccordionAdornment extends ControlAdornment {
|
|
103
|
+
type: ControlAdornmentType.Accordion;
|
|
104
|
+
title: string;
|
|
105
|
+
defaultExpanded: boolean;
|
|
106
|
+
}
|
|
107
|
+
export interface DataControlDefinition extends ControlDefinition {
|
|
108
|
+
type: ControlDefinitionType.Data;
|
|
109
|
+
field: string;
|
|
110
|
+
required?: boolean | null;
|
|
111
|
+
renderOptions?: RenderOptions | null;
|
|
112
|
+
defaultValue?: any;
|
|
113
|
+
readonly?: boolean | null;
|
|
114
|
+
}
|
|
115
|
+
export interface RenderOptions {
|
|
116
|
+
type: string;
|
|
117
|
+
}
|
|
118
|
+
export declare enum DataRenderType {
|
|
119
|
+
Standard = "Standard",
|
|
120
|
+
Radio = "Radio",
|
|
121
|
+
HtmlEditor = "HtmlEditor",
|
|
122
|
+
IconList = "IconList",
|
|
123
|
+
CheckList = "CheckList",
|
|
124
|
+
UserSelection = "UserSelection",
|
|
125
|
+
Synchronised = "Synchronised",
|
|
126
|
+
IconSelector = "IconSelector",
|
|
127
|
+
DateTime = "DateTime"
|
|
128
|
+
}
|
|
129
|
+
export interface RadioButtonRenderOptions extends RenderOptions {
|
|
130
|
+
type: DataRenderType.Radio;
|
|
131
|
+
}
|
|
132
|
+
export interface StandardRenderer extends RenderOptions {
|
|
133
|
+
type: DataRenderType.Standard;
|
|
134
|
+
}
|
|
135
|
+
export interface HtmlEditorRenderOptions extends RenderOptions {
|
|
136
|
+
type: DataRenderType.HtmlEditor;
|
|
137
|
+
allowImages: boolean;
|
|
138
|
+
}
|
|
139
|
+
export interface DateTimeRenderOptions extends RenderOptions {
|
|
140
|
+
type: DataRenderType.DateTime;
|
|
141
|
+
format?: string | null;
|
|
142
|
+
}
|
|
143
|
+
export interface IconListRenderOptions extends RenderOptions {
|
|
144
|
+
type: DataRenderType.IconList;
|
|
145
|
+
iconMappings: IconMapping[];
|
|
146
|
+
}
|
|
147
|
+
export interface IconMapping {
|
|
148
|
+
value: string;
|
|
149
|
+
materialIcon?: string | null;
|
|
150
|
+
}
|
|
151
|
+
export interface CheckListRenderOptions extends RenderOptions {
|
|
152
|
+
type: DataRenderType.CheckList;
|
|
153
|
+
}
|
|
154
|
+
export interface SynchronisedRenderOptions extends RenderOptions {
|
|
155
|
+
type: DataRenderType.Synchronised;
|
|
156
|
+
fieldToSync: string;
|
|
157
|
+
syncType: SyncTextType;
|
|
158
|
+
}
|
|
159
|
+
export declare enum SyncTextType {
|
|
160
|
+
Camel = "Camel",
|
|
161
|
+
Snake = "Snake",
|
|
162
|
+
Pascal = "Pascal"
|
|
163
|
+
}
|
|
164
|
+
export interface UserSelectionRenderOptions extends RenderOptions {
|
|
165
|
+
type: DataRenderType.UserSelection;
|
|
166
|
+
noGroups: boolean;
|
|
167
|
+
noUsers: boolean;
|
|
168
|
+
}
|
|
169
|
+
export interface IconSelectionRenderOptions extends RenderOptions {
|
|
170
|
+
type: DataRenderType.IconSelector;
|
|
171
|
+
}
|
|
172
|
+
export interface GroupedControlsDefinition extends ControlDefinition {
|
|
173
|
+
type: ControlDefinitionType.Group;
|
|
174
|
+
children: ControlDefinition[];
|
|
175
|
+
compoundField?: string | null;
|
|
176
|
+
groupOptions: GroupRenderOptions;
|
|
177
|
+
}
|
|
178
|
+
export interface GroupRenderOptions {
|
|
179
|
+
type: string;
|
|
180
|
+
hideTitle?: boolean | null;
|
|
181
|
+
}
|
|
182
|
+
export declare enum GroupRenderType {
|
|
183
|
+
Standard = "Standard",
|
|
184
|
+
Grid = "Grid",
|
|
185
|
+
GroupElement = "GroupElement"
|
|
186
|
+
}
|
|
187
|
+
export interface StandardGroupRenderer extends GroupRenderOptions {
|
|
188
|
+
type: GroupRenderType.Standard;
|
|
189
|
+
}
|
|
190
|
+
export interface GroupElementRenderer extends GroupRenderOptions {
|
|
191
|
+
type: GroupRenderType.GroupElement;
|
|
192
|
+
value: any;
|
|
193
|
+
}
|
|
194
|
+
export interface GridRenderer extends GroupRenderOptions {
|
|
195
|
+
type: GroupRenderType.Grid;
|
|
196
|
+
columns?: number | null;
|
|
197
|
+
}
|
|
198
|
+
export interface DisplayControlDefinition extends ControlDefinition {
|
|
199
|
+
type: ControlDefinitionType.Display;
|
|
200
|
+
displayData: DisplayData;
|
|
201
|
+
}
|
|
202
|
+
export interface DisplayData {
|
|
203
|
+
type: string;
|
|
204
|
+
}
|
|
205
|
+
export declare enum DisplayDataType {
|
|
206
|
+
Text = "Text",
|
|
207
|
+
Html = "Html"
|
|
208
|
+
}
|
|
209
|
+
export interface TextDisplay extends DisplayData {
|
|
210
|
+
type: DisplayDataType.Text;
|
|
211
|
+
text: string;
|
|
212
|
+
}
|
|
213
|
+
export interface HtmlDisplay extends DisplayData {
|
|
214
|
+
type: DisplayDataType.Html;
|
|
215
|
+
html: string;
|
|
216
|
+
}
|
|
217
|
+
export interface ActionControlDefinition extends ControlDefinition {
|
|
218
|
+
type: ControlDefinitionType.Action;
|
|
219
|
+
actionId: string;
|
|
220
|
+
}
|
|
221
|
+
export declare function isDataControlDefinition(x: ControlDefinition): x is DataControlDefinition;
|
|
222
|
+
export declare function isGroupControlsDefinition(x: ControlDefinition): x is GroupedControlsDefinition;
|
|
223
|
+
export declare function isDisplayControlsDefinition(x: ControlDefinition): x is DisplayControlDefinition;
|
|
224
|
+
export declare function isActionControlsDefinition(x: ControlDefinition): x is ActionControlDefinition;
|
|
225
|
+
export interface ControlVisitor<A> {
|
|
226
|
+
data(d: DataControlDefinition): A;
|
|
227
|
+
group(d: GroupedControlsDefinition): A;
|
|
228
|
+
display(d: DisplayControlDefinition): A;
|
|
229
|
+
action(d: ActionControlDefinition): A;
|
|
230
|
+
}
|
|
231
|
+
export declare function visitControlDefinition<A>(x: ControlDefinition, visitor: ControlVisitor<A>, defaultValue: (c: ControlDefinition) => A): A;
|
|
232
|
+
export declare function dataControl(field: string, options?: Partial<DataControlDefinition>): DataControlDefinition;
|
|
233
|
+
export declare function fieldValueExpr(field: string, value: any): FieldValueExpression;
|
|
234
|
+
export declare function visibility(expr: EntityExpression): DynamicProperty;
|
package/lib/util.d.ts
ADDED