@react-typed-forms/schemas 15.1.3 → 15.2.0
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/lib/controlBuilder.d.ts +1 -2
- package/lib/controlDefinition.d.ts +42 -36
- package/lib/controlRender.d.ts +36 -85
- package/lib/defaultSchemaInterface.d.ts +2 -6
- package/lib/hooks.d.ts +1 -2
- package/lib/index.cjs +669 -838
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +0 -4
- package/lib/index.js +580 -721
- package/lib/index.js.map +1 -1
- package/lib/renderers.d.ts +1 -0
- package/lib/schemaField.d.ts +133 -1
- package/lib/util.d.ts +11 -9
- package/package.json +1 -1
- package/src/controlBuilder.ts +2 -8
- package/src/controlDefinition.ts +243 -43
- package/src/controlRender.tsx +96 -157
- package/src/createFormRenderer.tsx +2 -1
- package/src/defaultSchemaInterface.ts +5 -15
- package/src/hooks.tsx +7 -7
- package/src/index.ts +0 -4
- package/src/renderers.tsx +1 -0
- package/src/schemaField.ts +400 -1
- package/src/util.ts +89 -116
- package/src/validators.ts +3 -3
- package/lib/formNode.d.ts +0 -46
- package/lib/schemaDataNode.d.ts +0 -31
- package/lib/schemaInterface.d.ts +0 -102
- package/lib/schemaNode.d.ts +0 -54
- package/src/formNode.ts +0 -253
- package/src/schemaDataNode.ts +0 -129
- package/src/schemaInterface.ts +0 -135
- package/src/schemaNode.ts +0 -279
package/lib/controlBuilder.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { AccordionAdornment, ActionControlDefinition, AutocompleteRenderOptions, CheckListRenderOptions, ControlAdornmentType, ControlDefinition, DataControlDefinition, DataRenderType, DisplayControlDefinition, DisplayOnlyRenderOptions, DynamicProperty, GroupedControlsDefinition, JsonataRenderOptions, RadioButtonRenderOptions, RenderOptions, TextfieldRenderOptions } from "./controlDefinition";
|
|
2
2
|
import { ActionRendererProps } from "./controlRender";
|
|
3
3
|
import { DateValidator, JsonataValidator, LengthValidator, ValidatorType } from "./schemaValidator";
|
|
4
|
-
import { SchemaField, SchemaMap } from "./schemaField";
|
|
4
|
+
import { SchemaField, SchemaMap, SchemaNode } from "./schemaField";
|
|
5
5
|
import { DataExpression, DataMatchExpression, EntityExpression, JsonataExpression } from "./entityExpression";
|
|
6
|
-
import { SchemaNode } from "./schemaNode";
|
|
7
6
|
export declare function dataControl(field: string, title?: string | null, options?: Partial<DataControlDefinition>): DataControlDefinition;
|
|
8
7
|
export declare function validatorOptions<A extends {
|
|
9
8
|
type: string;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { SchemaValidator } from "./schemaValidator";
|
|
2
|
-
import { FieldOption, SchemaField } from "./schemaField";
|
|
2
|
+
import { FieldOption, SchemaDataNode, SchemaField, SchemaInterface, SchemaNode } from "./schemaField";
|
|
3
3
|
import { EntityExpression } from "./entityExpression";
|
|
4
|
-
import { SchemaInterface } from "./schemaInterface";
|
|
5
|
-
import { SchemaDataNode } from "./schemaDataNode";
|
|
6
|
-
import { SchemaNode } from "./schemaNode";
|
|
7
4
|
/**
|
|
8
5
|
* Interface representing the form context data.
|
|
9
6
|
*/
|
|
@@ -33,10 +30,8 @@ export interface ControlDefinition {
|
|
|
33
30
|
childRefId?: string | null;
|
|
34
31
|
title?: string | null;
|
|
35
32
|
styleClass?: string | null;
|
|
36
|
-
textClass?: string | null;
|
|
37
33
|
layoutClass?: string | null;
|
|
38
34
|
labelClass?: string | null;
|
|
39
|
-
labelTextClass?: string | null;
|
|
40
35
|
dynamic?: DynamicProperty[] | null;
|
|
41
36
|
adornments?: ControlAdornment[] | null;
|
|
42
37
|
children?: ControlDefinition[] | null;
|
|
@@ -80,19 +75,9 @@ export declare enum ControlAdornmentType {
|
|
|
80
75
|
SetField = "SetField",
|
|
81
76
|
Optional = "Optional"
|
|
82
77
|
}
|
|
83
|
-
export declare enum IconLibrary {
|
|
84
|
-
FontAwesome = "FontAwesome",
|
|
85
|
-
Material = "Material",
|
|
86
|
-
CssClass = "CssClass"
|
|
87
|
-
}
|
|
88
|
-
export interface IconReference {
|
|
89
|
-
library: string;
|
|
90
|
-
name: string;
|
|
91
|
-
}
|
|
92
78
|
export interface IconAdornment extends ControlAdornment {
|
|
93
79
|
type: ControlAdornmentType.Icon;
|
|
94
80
|
iconClass: string;
|
|
95
|
-
icon?: IconReference;
|
|
96
81
|
placement?: AdornmentPlacement | null;
|
|
97
82
|
}
|
|
98
83
|
export interface TooltipAdornment extends ControlAdornment {
|
|
@@ -229,6 +214,7 @@ export interface ArrayRenderOptions extends RenderOptions {
|
|
|
229
214
|
noAdd?: boolean | null;
|
|
230
215
|
noRemove?: boolean | null;
|
|
231
216
|
noReorder?: boolean | null;
|
|
217
|
+
childOptions?: RenderOptions | null;
|
|
232
218
|
editExternal?: boolean | null;
|
|
233
219
|
}
|
|
234
220
|
export interface ArrayElementRenderOptions extends RenderOptions {
|
|
@@ -280,8 +266,7 @@ export declare enum GroupRenderType {
|
|
|
280
266
|
Flex = "Flex",
|
|
281
267
|
Tabs = "Tabs",
|
|
282
268
|
GroupElement = "GroupElement",
|
|
283
|
-
SelectChild = "SelectChild"
|
|
284
|
-
Inline = "Inline"
|
|
269
|
+
SelectChild = "SelectChild"
|
|
285
270
|
}
|
|
286
271
|
export interface StandardGroupRenderer extends GroupRenderOptions {
|
|
287
272
|
type: GroupRenderType.Standard;
|
|
@@ -298,7 +283,6 @@ export interface GroupElementRenderer extends GroupRenderOptions {
|
|
|
298
283
|
export interface GridRenderer extends GroupRenderOptions {
|
|
299
284
|
type: GroupRenderType.Grid;
|
|
300
285
|
columns?: number | null;
|
|
301
|
-
rowClass?: string | null;
|
|
302
286
|
}
|
|
303
287
|
export interface TabsRenderOptions extends GroupRenderOptions {
|
|
304
288
|
type: GroupRenderType.Tabs;
|
|
@@ -328,7 +312,6 @@ export interface TextDisplay extends DisplayData {
|
|
|
328
312
|
export interface IconDisplay extends DisplayData {
|
|
329
313
|
type: DisplayDataType.Icon;
|
|
330
314
|
iconClass: string;
|
|
331
|
-
icon?: IconReference | null;
|
|
332
315
|
}
|
|
333
316
|
export interface HtmlDisplay extends DisplayData {
|
|
334
317
|
type: DisplayDataType.Html;
|
|
@@ -342,17 +325,6 @@ export interface ActionControlDefinition extends ControlDefinition {
|
|
|
342
325
|
type: ControlDefinitionType.Action;
|
|
343
326
|
actionId: string;
|
|
344
327
|
actionData?: string | null;
|
|
345
|
-
icon?: IconReference | null;
|
|
346
|
-
actionStyle?: ActionStyle | null;
|
|
347
|
-
iconPlacement?: IconPlacement | null;
|
|
348
|
-
}
|
|
349
|
-
export declare enum ActionStyle {
|
|
350
|
-
Button = "Button",
|
|
351
|
-
Link = "Link"
|
|
352
|
-
}
|
|
353
|
-
export declare enum IconPlacement {
|
|
354
|
-
BeforeText = "BeforeText",
|
|
355
|
-
AfterText = "AfterText"
|
|
356
328
|
}
|
|
357
329
|
export interface ControlVisitor<A> {
|
|
358
330
|
data(d: DataControlDefinition): A;
|
|
@@ -362,7 +334,6 @@ export interface ControlVisitor<A> {
|
|
|
362
334
|
}
|
|
363
335
|
export declare function visitControlDefinition<A>(x: ControlDefinition, visitor: ControlVisitor<A>, defaultValue: (c: ControlDefinition) => A): A;
|
|
364
336
|
export declare function isGridRenderer(options: GroupRenderOptions): options is GridRenderer;
|
|
365
|
-
export declare function isInlineRenderer(options: GroupRenderOptions): options is GridRenderer;
|
|
366
337
|
export declare function isSelectChildRenderer(options: GroupRenderOptions): options is SelectChildRenderer;
|
|
367
338
|
export declare function isTabsRenderer(options: GroupRenderOptions): options is TabsRenderOptions;
|
|
368
339
|
export declare function isFlexRenderer(options: GroupRenderOptions): options is FlexRenderer;
|
|
@@ -379,6 +350,34 @@ export declare function isActionControl(c: ControlDefinition): c is ActionContro
|
|
|
379
350
|
export declare function isDisplayControl(c: ControlDefinition): c is DisplayControlDefinition;
|
|
380
351
|
export type ControlActionHandler = (actionId: string, actionData: any, ctx: ControlDataContext) => (() => void) | undefined;
|
|
381
352
|
export declare function isCheckEntryClasses(options?: RenderOptions | null): options is CheckEntryClasses & RenderOptions;
|
|
353
|
+
export type ControlMap = {
|
|
354
|
+
[k: string]: ControlDefinition;
|
|
355
|
+
};
|
|
356
|
+
export interface FormNode {
|
|
357
|
+
id: string;
|
|
358
|
+
definition: ControlDefinition;
|
|
359
|
+
tree: FormTree;
|
|
360
|
+
parent?: FormNode;
|
|
361
|
+
getChildNodes(): FormNode[];
|
|
362
|
+
}
|
|
363
|
+
export interface FormTreeLookup {
|
|
364
|
+
getForm(formId: string): FormTree | undefined;
|
|
365
|
+
}
|
|
366
|
+
export declare abstract class FormTree implements FormTreeLookup {
|
|
367
|
+
abstract rootNode: FormNode;
|
|
368
|
+
abstract getByRefId(id: string): FormNode | undefined;
|
|
369
|
+
abstract addChild(parent: FormNode, control: ControlDefinition): FormNode;
|
|
370
|
+
abstract getForm(formId: string): FormTree | undefined;
|
|
371
|
+
createTempNode(id: string, definition: ControlDefinition, children?: FormNode[], parent?: FormNode): FormNode;
|
|
372
|
+
createChildNodes(parent: FormNode, definitions: ControlDefinition[] | undefined | null): FormNode[];
|
|
373
|
+
}
|
|
374
|
+
export declare function legacyFormNode(definition: ControlDefinition): FormNode;
|
|
375
|
+
export declare function createFormTree(controls: ControlDefinition[], getForm?: FormTreeLookup): FormTree;
|
|
376
|
+
export declare function createFormLookup<A extends Record<string, ControlDefinition[]>>(formMap: A): {
|
|
377
|
+
getForm(formId: keyof A): FormTree;
|
|
378
|
+
};
|
|
379
|
+
export declare function fieldPathForDefinition(c: ControlDefinition): string[] | undefined;
|
|
380
|
+
export declare function lookupDataNode(c: ControlDefinition, parentNode: SchemaDataNode): SchemaDataNode | undefined;
|
|
382
381
|
export declare function traverseParents<A, B extends {
|
|
383
382
|
parent?: B | undefined;
|
|
384
383
|
}>(current: B | undefined, get: (b: B) => A, until?: (b: B) => boolean): A[];
|
|
@@ -386,7 +385,14 @@ export declare function getRootDataNode(dataNode: SchemaDataNode): SchemaDataNod
|
|
|
386
385
|
export declare function getJsonPath(dataNode: SchemaDataNode): (string | number)[];
|
|
387
386
|
export declare function getSchemaPath(schemaNode: SchemaNode): SchemaField[];
|
|
388
387
|
export declare function getSchemaFieldList(schema: SchemaNode): SchemaField[];
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
388
|
+
/**
|
|
389
|
+
* @deprecated use visitFormNodeData instead
|
|
390
|
+
*/
|
|
391
|
+
export declare function visitControlDataArray<A>(controls: ControlDefinition[] | undefined | null, context: SchemaDataNode, cb: (definition: DataControlDefinition, node: SchemaDataNode) => A | undefined): A | undefined;
|
|
392
|
+
/**
|
|
393
|
+
* @deprecated use visitFormDataInContext instead
|
|
394
|
+
*/
|
|
395
|
+
export declare function visitControlData<A>(definition: ControlDefinition, ctx: SchemaDataNode, cb: (definition: DataControlDefinition, field: SchemaDataNode) => A | undefined): A | undefined;
|
|
396
|
+
export type ControlDataVisitor<A> = (dataNode: SchemaDataNode, definition: DataControlDefinition) => A | undefined;
|
|
397
|
+
export declare function visitFormData<A>(node: FormNode, dataNode: SchemaDataNode, cb: ControlDataVisitor<A>, notSelf?: boolean): A | undefined;
|
|
398
|
+
export declare function visitFormDataInContext<A>(parentContext: SchemaDataNode, node: FormNode, cb: ControlDataVisitor<A>): A | undefined;
|
package/lib/controlRender.d.ts
CHANGED
|
@@ -1,72 +1,20 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { ButtonHTMLAttributes, ElementType, FC, HTMLAttributes, InputHTMLAttributes, Key, LabelHTMLAttributes, ReactElement, ReactNode } from "react";
|
|
2
2
|
import { Control } from "@react-typed-forms/core";
|
|
3
|
-
import {
|
|
3
|
+
import { AdornmentPlacement, ArrayActionOptions, ControlActionHandler, ControlAdornment, ControlDataContext, ControlDefinition, DataControlDefinition, DisplayData, FormContextData, FormNode, GroupRenderOptions, RenderOptions } from "./controlDefinition";
|
|
4
4
|
import { ControlClasses, JsonPath } from "./util";
|
|
5
5
|
import { EvalExpressionHook, UseEvalExpressionHook } from "./hooks";
|
|
6
6
|
import { ValidationContext } from "./validators";
|
|
7
7
|
import { SchemaValidator } from "./schemaValidator";
|
|
8
|
-
import { FieldOption, SchemaField } from "./schemaField";
|
|
9
|
-
import { FormNode } from "./formNode";
|
|
10
|
-
import { SchemaInterface } from "./schemaInterface";
|
|
11
|
-
import { SchemaDataNode } from "./schemaDataNode";
|
|
12
|
-
export interface HtmlIconProperties {
|
|
13
|
-
className?: string;
|
|
14
|
-
style?: React.CSSProperties;
|
|
15
|
-
iconLibrary?: string;
|
|
16
|
-
iconName?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface HtmlLabelProperties {
|
|
19
|
-
htmlFor?: string;
|
|
20
|
-
className?: string;
|
|
21
|
-
textClass?: string;
|
|
22
|
-
children?: ReactNode;
|
|
23
|
-
}
|
|
24
|
-
export interface HtmlDivProperties {
|
|
25
|
-
id?: string;
|
|
26
|
-
className?: string;
|
|
27
|
-
textClass?: string;
|
|
28
|
-
style?: React.CSSProperties;
|
|
29
|
-
children?: ReactNode;
|
|
30
|
-
text?: string;
|
|
31
|
-
html?: string;
|
|
32
|
-
nativeRef?: (e: HTMLElement | null) => void;
|
|
33
|
-
inline?: boolean;
|
|
34
|
-
}
|
|
35
|
-
export interface HtmlInputProperties {
|
|
36
|
-
id?: string;
|
|
37
|
-
className?: string;
|
|
38
|
-
textClass?: string;
|
|
39
|
-
name?: string;
|
|
40
|
-
type?: string;
|
|
41
|
-
checked?: boolean;
|
|
42
|
-
style?: React.CSSProperties;
|
|
43
|
-
readOnly?: boolean;
|
|
44
|
-
placeholder?: string;
|
|
45
|
-
value?: string | number;
|
|
46
|
-
onBlur?: () => void;
|
|
47
|
-
disabled?: boolean;
|
|
48
|
-
inputRef?: (e: HTMLElement | null) => void;
|
|
49
|
-
onChangeValue?: (value: string) => void;
|
|
50
|
-
onChangeChecked?: (checked: boolean) => void;
|
|
51
|
-
}
|
|
52
|
-
export interface HtmlButtonProperties {
|
|
53
|
-
className?: string;
|
|
54
|
-
textClass?: string;
|
|
55
|
-
disabled?: boolean;
|
|
56
|
-
style?: React.CSSProperties;
|
|
57
|
-
onClick?: () => void;
|
|
58
|
-
inline?: boolean;
|
|
59
|
-
children?: ReactNode;
|
|
60
|
-
}
|
|
8
|
+
import { FieldOption, SchemaDataNode, SchemaField, SchemaInterface } from "./schemaField";
|
|
61
9
|
export interface HtmlComponents {
|
|
62
|
-
Div:
|
|
10
|
+
Div: ElementType<HTMLAttributes<HTMLDivElement>, "div">;
|
|
63
11
|
Span: ElementType<HTMLAttributes<HTMLSpanElement>>;
|
|
64
|
-
Button:
|
|
65
|
-
I:
|
|
66
|
-
Label:
|
|
12
|
+
Button: ElementType<ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
13
|
+
I: ElementType<HTMLAttributes<HTMLElement>>;
|
|
14
|
+
Label: ElementType<LabelHTMLAttributes<HTMLLabelElement>>;
|
|
67
15
|
B: ElementType<HTMLAttributes<HTMLElement>>;
|
|
68
16
|
H1: ElementType<HTMLAttributes<HTMLElement>>;
|
|
69
|
-
Input:
|
|
17
|
+
Input: ElementType<InputHTMLAttributes<HTMLInputElement>, "input">;
|
|
70
18
|
}
|
|
71
19
|
/**
|
|
72
20
|
* Interface for rendering different types of form controls.
|
|
@@ -134,6 +82,7 @@ export interface FormRenderer {
|
|
|
134
82
|
* @returns A React node.
|
|
135
83
|
*/
|
|
136
84
|
renderLabelText: (props: ReactNode) => ReactNode;
|
|
85
|
+
renderText: (props: ReactNode, className?: string) => ReactNode;
|
|
137
86
|
html: HtmlComponents;
|
|
138
87
|
}
|
|
139
88
|
export interface AdornmentProps {
|
|
@@ -178,14 +127,12 @@ export interface RenderedLayout {
|
|
|
178
127
|
className?: string;
|
|
179
128
|
style?: React.CSSProperties;
|
|
180
129
|
wrapLayout: (layout: ReactElement) => ReactElement;
|
|
181
|
-
inline?: boolean;
|
|
182
130
|
}
|
|
183
131
|
export interface RenderedControl {
|
|
184
132
|
children: ReactNode;
|
|
185
133
|
className?: string;
|
|
186
134
|
style?: React.CSSProperties;
|
|
187
135
|
divRef?: (cb: HTMLElement | null) => void;
|
|
188
|
-
inline?: boolean;
|
|
189
136
|
}
|
|
190
137
|
export interface VisibilityRendererProps extends RenderedControl {
|
|
191
138
|
visibility: Control<Visibility | undefined>;
|
|
@@ -198,7 +145,6 @@ export interface ControlLayoutProps {
|
|
|
198
145
|
processLayout?: (props: ControlLayoutProps) => ControlLayoutProps;
|
|
199
146
|
className?: string | null;
|
|
200
147
|
style?: React.CSSProperties;
|
|
201
|
-
inline?: boolean;
|
|
202
148
|
}
|
|
203
149
|
/**
|
|
204
150
|
* Enum representing the types of labels that can be rendered.
|
|
@@ -246,10 +192,6 @@ export interface LabelRendererProps {
|
|
|
246
192
|
* The CSS class name for the label.
|
|
247
193
|
*/
|
|
248
194
|
className?: string;
|
|
249
|
-
/**
|
|
250
|
-
* The CSS class name for the label text.
|
|
251
|
-
*/
|
|
252
|
-
textClass?: string;
|
|
253
195
|
}
|
|
254
196
|
/**
|
|
255
197
|
* Properties for display renderers.
|
|
@@ -271,19 +213,16 @@ export interface DisplayRendererProps {
|
|
|
271
213
|
* The CSS class name for the display renderer.
|
|
272
214
|
*/
|
|
273
215
|
className?: string;
|
|
274
|
-
textClass?: string;
|
|
275
216
|
/**
|
|
276
217
|
* The CSS styles for the display renderer.
|
|
277
218
|
*/
|
|
278
219
|
style?: React.CSSProperties;
|
|
279
|
-
inline?: boolean;
|
|
280
220
|
}
|
|
281
221
|
export type ChildVisibilityFunc = (child: ControlDefinition, parentNode?: SchemaDataNode, dontOverride?: boolean) => EvalExpressionHook<boolean>;
|
|
282
222
|
export interface ParentRendererProps {
|
|
283
223
|
formNode: FormNode;
|
|
284
224
|
renderChild: ChildRenderer;
|
|
285
225
|
className?: string;
|
|
286
|
-
textClass?: string;
|
|
287
226
|
style?: React.CSSProperties;
|
|
288
227
|
dataContext: ControlDataContext;
|
|
289
228
|
useChildVisibility: ChildVisibilityFunc;
|
|
@@ -298,6 +237,7 @@ export interface DataRendererProps extends ParentRendererProps {
|
|
|
298
237
|
renderOptions: RenderOptions;
|
|
299
238
|
definition: DataControlDefinition;
|
|
300
239
|
field: SchemaField;
|
|
240
|
+
elementIndex?: number;
|
|
301
241
|
id: string;
|
|
302
242
|
control: Control<any>;
|
|
303
243
|
readonly: boolean;
|
|
@@ -306,21 +246,15 @@ export interface DataRendererProps extends ParentRendererProps {
|
|
|
306
246
|
hidden: boolean;
|
|
307
247
|
dataNode: SchemaDataNode;
|
|
308
248
|
displayOnly: boolean;
|
|
309
|
-
inline: boolean;
|
|
310
249
|
}
|
|
311
250
|
export interface ActionRendererProps {
|
|
312
251
|
actionId: string;
|
|
313
252
|
actionText: string;
|
|
314
253
|
actionData?: any;
|
|
315
|
-
actionStyle?: ActionStyle;
|
|
316
|
-
icon?: IconReference | null;
|
|
317
|
-
iconPlacement?: IconPlacement;
|
|
318
254
|
onClick: () => void;
|
|
319
255
|
className?: string | null;
|
|
320
|
-
textClass?: string | null;
|
|
321
256
|
style?: React.CSSProperties;
|
|
322
257
|
disabled?: boolean;
|
|
323
|
-
inline?: boolean;
|
|
324
258
|
}
|
|
325
259
|
export interface ControlRenderProps {
|
|
326
260
|
control: Control<any>;
|
|
@@ -331,9 +265,25 @@ export interface FormContextOptions {
|
|
|
331
265
|
hidden?: boolean | null;
|
|
332
266
|
disabled?: boolean | null;
|
|
333
267
|
displayOnly?: boolean;
|
|
334
|
-
inline?: boolean;
|
|
335
268
|
}
|
|
336
|
-
export
|
|
269
|
+
export interface DataControlProps {
|
|
270
|
+
formNode: FormNode;
|
|
271
|
+
definition: DataControlDefinition;
|
|
272
|
+
dataContext: ControlDataContext;
|
|
273
|
+
control: Control<any>;
|
|
274
|
+
formOptions: FormContextOptions;
|
|
275
|
+
style?: React.CSSProperties | undefined;
|
|
276
|
+
renderChild: ChildRenderer;
|
|
277
|
+
elementIndex?: number;
|
|
278
|
+
allowedOptions?: Control<any[] | undefined>;
|
|
279
|
+
useChildVisibility: ChildVisibilityFunc;
|
|
280
|
+
useEvalExpression: UseEvalExpressionHook;
|
|
281
|
+
schemaInterface?: SchemaInterface;
|
|
282
|
+
designMode?: boolean;
|
|
283
|
+
styleClass?: string;
|
|
284
|
+
layoutClass?: string;
|
|
285
|
+
}
|
|
286
|
+
export type CreateDataProps = (controlProps: DataControlProps) => DataRendererProps;
|
|
337
287
|
export interface ControlRenderOptions extends FormContextOptions, ControlClasses {
|
|
338
288
|
useDataHook?: (c: ControlDefinition) => CreateDataProps;
|
|
339
289
|
actionOnClick?: ControlActionHandler;
|
|
@@ -343,6 +293,7 @@ export interface ControlRenderOptions extends FormContextOptions, ControlClasses
|
|
|
343
293
|
adjustLayout?: (context: ControlDataContext, layout: ControlLayoutProps) => ControlLayoutProps;
|
|
344
294
|
clearHidden?: boolean;
|
|
345
295
|
schemaInterface?: SchemaInterface;
|
|
296
|
+
elementIndex?: number;
|
|
346
297
|
formData?: FormContextData;
|
|
347
298
|
}
|
|
348
299
|
export declare function useControlRenderer(definition: ControlDefinition, fields: SchemaField[], renderer: FormRenderer, options?: ControlRenderOptions): FC<ControlRenderProps>;
|
|
@@ -361,18 +312,19 @@ export declare function NewControlRenderer({ definition, renderer, options, pare
|
|
|
361
312
|
options?: ControlRenderOptions;
|
|
362
313
|
parentDataNode: SchemaDataNode;
|
|
363
314
|
}): JSX.Element;
|
|
364
|
-
export declare function defaultDataProps({ formOptions, style, allowedOptions, schemaInterface, styleClass,
|
|
315
|
+
export declare function defaultDataProps({ definition, control, formOptions, style, allowedOptions, schemaInterface, styleClass, ...props }: DataControlProps): DataRendererProps;
|
|
365
316
|
export interface ChildRendererOptions {
|
|
317
|
+
elementIndex?: number;
|
|
366
318
|
parentDataNode?: SchemaDataNode;
|
|
367
319
|
formData?: FormContextData;
|
|
368
|
-
inline?: boolean;
|
|
369
320
|
displayOnly?: boolean;
|
|
370
321
|
styleClass?: string;
|
|
371
322
|
layoutClass?: string;
|
|
372
323
|
labelClass?: string;
|
|
373
324
|
}
|
|
374
325
|
export type ChildRenderer = (k: Key, child: FormNode, options?: ChildRendererOptions) => ReactNode;
|
|
375
|
-
export interface
|
|
326
|
+
export interface RenderControlProps {
|
|
327
|
+
definition: ControlDefinition;
|
|
376
328
|
formNode: FormNode;
|
|
377
329
|
renderer: FormRenderer;
|
|
378
330
|
renderChild: ChildRenderer;
|
|
@@ -381,6 +333,7 @@ export interface RenderLayoutProps {
|
|
|
381
333
|
dataContext: ControlDataContext;
|
|
382
334
|
control?: Control<any>;
|
|
383
335
|
labelText?: Control<string | null | undefined>;
|
|
336
|
+
elementIndex?: number;
|
|
384
337
|
displayControl?: Control<string | undefined>;
|
|
385
338
|
style?: React.CSSProperties;
|
|
386
339
|
allowedOptions?: Control<any[] | undefined>;
|
|
@@ -392,12 +345,10 @@ export interface RenderLayoutProps {
|
|
|
392
345
|
designMode?: boolean;
|
|
393
346
|
customDisplay?: (customId: string, displayProps: DisplayRendererProps) => ReactNode;
|
|
394
347
|
labelClass?: string;
|
|
395
|
-
labelTextClass?: string;
|
|
396
348
|
styleClass?: string;
|
|
397
|
-
textClass?: string;
|
|
398
349
|
}
|
|
399
|
-
export declare function renderControlLayout(props:
|
|
400
|
-
type MarkupKeys = keyof Omit<RenderedLayout, "errorControl" | "style" | "className" | "wrapLayout" | "readonly" | "disabled"
|
|
350
|
+
export declare function renderControlLayout(props: RenderControlProps): ControlLayoutProps;
|
|
351
|
+
type MarkupKeys = keyof Omit<RenderedLayout, "errorControl" | "style" | "className" | "wrapLayout" | "readonly" | "disabled">;
|
|
401
352
|
export declare function appendMarkup(k: MarkupKeys, markup: ReactNode): (layout: RenderedLayout) => void;
|
|
402
353
|
export declare function wrapMarkup(k: MarkupKeys, wrap: (ex: ReactNode) => ReactNode): (layout: RenderedLayout) => void;
|
|
403
354
|
export declare function layoutKeyForPlacement(pos: AdornmentPlacement): MarkupKeys;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { Control, ControlSetup } from "@react-typed-forms/core";
|
|
2
|
-
import { EqualityFunc, FieldOption, SchemaField, ValidationMessageType } from "./schemaField";
|
|
3
|
-
import { SchemaInterface } from "./schemaInterface";
|
|
4
|
-
import { SchemaDataNode } from "./schemaDataNode";
|
|
5
|
-
import { SchemaNode } from "./schemaNode";
|
|
2
|
+
import { EqualityFunc, FieldOption, SchemaDataNode, SchemaField, SchemaInterface, SchemaNode, ValidationMessageType } from "./schemaField";
|
|
6
3
|
export declare class DefaultSchemaInterface implements SchemaInterface {
|
|
7
4
|
protected boolStrings: [string, string];
|
|
8
5
|
protected parseDateTime: (s: string) => number;
|
|
@@ -15,8 +12,7 @@ export declare class DefaultSchemaInterface implements SchemaInterface {
|
|
|
15
12
|
getFilterOptions(array: SchemaDataNode, field: SchemaNode): FieldOption[] | undefined | null;
|
|
16
13
|
isEmptyValue(f: SchemaField, value: any): boolean;
|
|
17
14
|
searchText(field: SchemaField, value: any): string;
|
|
18
|
-
|
|
19
|
-
textValue(field: SchemaField, value: any, element?: boolean | undefined, options?: FieldOption[] | null): string | undefined;
|
|
15
|
+
textValue(field: SchemaField, value: any, element?: boolean | undefined): string | undefined;
|
|
20
16
|
controlLength(f: SchemaField, control: Control<any>): number;
|
|
21
17
|
valueLength(field: SchemaField, value: any): number;
|
|
22
18
|
compareValue(field: SchemaField, v1: unknown, v2: unknown): number;
|
package/lib/hooks.d.ts
CHANGED
|
@@ -3,9 +3,8 @@ import React from "react";
|
|
|
3
3
|
import { Control } from "@react-typed-forms/core";
|
|
4
4
|
import { JsonPath } from "./util";
|
|
5
5
|
import { DynamicHookGenerator } from "./dynamicHooks";
|
|
6
|
+
import { SchemaDataNode, SchemaInterface } from "./schemaField";
|
|
6
7
|
import { EntityExpression } from "./entityExpression";
|
|
7
|
-
import { SchemaInterface } from "./schemaInterface";
|
|
8
|
-
import { SchemaDataNode } from "./schemaDataNode";
|
|
9
8
|
export type EvalExpressionHook<A = any> = DynamicHookGenerator<Control<A | undefined>, ControlDataContext>;
|
|
10
9
|
export type UseEvalExpressionHook = (expr: EntityExpression | undefined | null, coerce: (v: any) => any) => DynamicHookGenerator<Control<any> | undefined, ControlDataContext>;
|
|
11
10
|
export declare function optionalHook(expr: EntityExpression | undefined | null, useHook: UseEvalExpressionHook, coerce: (v: any) => any): DynamicHookGenerator<Control<any> | undefined, ControlDataContext> | undefined;
|