@react-typed-forms/schemas 12.1.0 → 13.0.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/controlRender.d.ts +8 -3
- package/lib/createFormRenderer.d.ts +1 -1
- package/lib/hooks.d.ts +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +0 -12
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types.d.ts +5 -1
- package/lib/util.d.ts +6 -0
- package/package.json +1 -1
- package/lib/components/CheckRenderer.d.ts +0 -26
- package/lib/components/ControlInput.d.ts +0 -13
- package/lib/components/DefaultAccordion.d.ts +0 -12
- package/lib/components/DefaultArrayRenderer.d.ts +0 -18
- package/lib/components/DefaultDisplay.d.ts +0 -9
- package/lib/components/DefaultDisplayOnly.d.ts +0 -11
- package/lib/components/DefaultLayout.d.ts +0 -10
- package/lib/components/DefaultVisibility.d.ts +0 -4
- package/lib/components/JsonataRenderer.d.ts +0 -12
- package/lib/components/MultilineTextfield.d.ts +0 -4
- package/lib/components/NullToggle.d.ts +0 -1
- package/lib/components/SelectDataRenderer.d.ts +0 -24
- package/lib/createDefaultRenderers.d.ts +0 -77
- package/lib/tailwind.d.ts +0 -43
package/lib/types.d.ts
CHANGED
|
@@ -264,7 +264,11 @@ export interface ArrayRenderOptions extends RenderOptions {
|
|
|
264
264
|
noReorder?: boolean | null;
|
|
265
265
|
childOptions?: RenderOptions | null;
|
|
266
266
|
}
|
|
267
|
-
export type ArrayActionOptions = Pick<ArrayRenderOptions, "addText" | "addActionId" | "removeText" | "removeActionId" | "noAdd" | "noRemove" | "noReorder"
|
|
267
|
+
export type ArrayActionOptions = Pick<ArrayRenderOptions, "addText" | "addActionId" | "removeText" | "removeActionId" | "noAdd" | "noRemove" | "noReorder"> & {
|
|
268
|
+
readonly?: boolean;
|
|
269
|
+
disabled?: boolean;
|
|
270
|
+
designMode?: boolean;
|
|
271
|
+
};
|
|
268
272
|
export interface CheckListRenderOptions extends RenderOptions {
|
|
269
273
|
type: DataRenderType.CheckList;
|
|
270
274
|
}
|
package/lib/util.d.ts
CHANGED
|
@@ -2,10 +2,15 @@ import { CompoundField, ControlDefinition, DataControlDefinition, DisplayOnlyRen
|
|
|
2
2
|
import { MutableRefObject } from "react";
|
|
3
3
|
import { SchemaDataNode } from "./treeNodes";
|
|
4
4
|
export type JsonPath = string | number;
|
|
5
|
+
export interface FormContextData {
|
|
6
|
+
option?: FieldOption;
|
|
7
|
+
optionSelected?: boolean;
|
|
8
|
+
}
|
|
5
9
|
export interface ControlDataContext {
|
|
6
10
|
schemaInterface: SchemaInterface;
|
|
7
11
|
dataNode: SchemaDataNode | undefined;
|
|
8
12
|
parentNode: SchemaDataNode;
|
|
13
|
+
formData: FormContextData;
|
|
9
14
|
}
|
|
10
15
|
export declare function applyDefaultValues(v: Record<string, any> | undefined, fields: SchemaField[], doneSet?: Set<Record<string, any>>): any;
|
|
11
16
|
export declare function applyDefaultForField(v: any, field: SchemaField, parent: SchemaField[], notElement?: boolean, doneSet?: Set<Record<string, any>>): any;
|
|
@@ -57,3 +62,4 @@ export declare function toDepString(x: any): string;
|
|
|
57
62
|
export declare function applyLengthRestrictions<Min, Max>(length: number, min: number | null | undefined, max: number | null | undefined, minValue: Min, maxValue: Max): [Min | undefined, Max | undefined];
|
|
58
63
|
export declare function findFieldPath(fields: SchemaField[], fieldPath: string | undefined): SchemaField[] | undefined;
|
|
59
64
|
export declare function mergeObjects<A extends Record<string, any> | undefined>(o1: A, o2: A, doMerge?: (k: keyof NonNullable<A>, v1: unknown, v2: unknown) => unknown): A;
|
|
65
|
+
export declare function coerceToString(v: unknown): string;
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { FieldOption } from "../types";
|
|
2
|
-
import { Control } from "@react-typed-forms/core";
|
|
3
|
-
import React from "react";
|
|
4
|
-
export interface CheckRendererOptions {
|
|
5
|
-
className?: string;
|
|
6
|
-
entryClass?: string;
|
|
7
|
-
checkClass?: string;
|
|
8
|
-
labelClass?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare function createRadioRenderer(options?: CheckRendererOptions): import("../renderers").DataRendererRegistration;
|
|
11
|
-
export declare function createCheckListRenderer(options?: CheckRendererOptions): import("../renderers").DataRendererRegistration;
|
|
12
|
-
export declare function CheckButtons({ control, options, labelClass, checkClass, readonly, entryClass, className, id, type, isChecked, setChecked, }: {
|
|
13
|
-
id?: string;
|
|
14
|
-
className?: string;
|
|
15
|
-
options?: FieldOption[] | null;
|
|
16
|
-
control: Control<any>;
|
|
17
|
-
entryClass?: string;
|
|
18
|
-
checkClass?: string;
|
|
19
|
-
labelClass?: string;
|
|
20
|
-
readonly?: boolean;
|
|
21
|
-
type: "checkbox" | "radio";
|
|
22
|
-
isChecked: (c: Control<any>, o: FieldOption) => boolean;
|
|
23
|
-
setChecked: (c: Control<any>, o: FieldOption, checked: boolean) => void;
|
|
24
|
-
}): React.JSX.Element;
|
|
25
|
-
export declare function setIncluded<A>(array: A[], elem: A, included: boolean): A[];
|
|
26
|
-
export declare function createCheckboxRenderer(options?: CheckRendererOptions): import("../renderers").DataRendererRegistration;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Control } from "@react-typed-forms/core";
|
|
3
|
-
export declare function ControlInput({ control, convert, ...props }: React.InputHTMLAttributes<HTMLInputElement> & {
|
|
4
|
-
control: Control<any>;
|
|
5
|
-
convert: InputConversion;
|
|
6
|
-
}): React.JSX.Element;
|
|
7
|
-
type InputConversion = [
|
|
8
|
-
string,
|
|
9
|
-
(s: string) => any,
|
|
10
|
-
(a: any) => string | number
|
|
11
|
-
];
|
|
12
|
-
export declare function createInputConversion(ft: string): InputConversion;
|
|
13
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties, ReactElement } from "react";
|
|
2
|
-
import { AccordionAdornment } from "../types";
|
|
3
|
-
import { FormRenderer } from "../controlRender";
|
|
4
|
-
import { DefaultAccordionRendererOptions } from "../createDefaultRenderers";
|
|
5
|
-
export declare function DefaultAccordion({ children, accordion, contentStyle, contentClassName, designMode, iconOpenClass, iconClosedClass, className, renderTitle, renderToggler, renderers, titleClass, }: {
|
|
6
|
-
children: ReactElement;
|
|
7
|
-
accordion: Partial<AccordionAdornment>;
|
|
8
|
-
contentStyle?: CSSProperties;
|
|
9
|
-
contentClassName?: string;
|
|
10
|
-
designMode?: boolean;
|
|
11
|
-
renderers: FormRenderer;
|
|
12
|
-
} & DefaultAccordionRendererOptions): React.JSX.Element;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ArrayRendererRegistration, DataRendererRegistration } from "../renderers";
|
|
2
|
-
import { ActionRendererProps, ArrayRendererProps } from "../controlRender";
|
|
3
|
-
import React, { ReactNode } from "react";
|
|
4
|
-
import { ArrayActionOptions } from "../types";
|
|
5
|
-
export declare function createDefaultArrayDataRenderer(defaultActions?: ArrayActionOptions): DataRendererRegistration;
|
|
6
|
-
export interface DefaultArrayRendererOptions extends ArrayActionOptions {
|
|
7
|
-
className?: string;
|
|
8
|
-
removableClass?: string;
|
|
9
|
-
childClass?: string;
|
|
10
|
-
removableChildClass?: string;
|
|
11
|
-
removeActionClass?: string;
|
|
12
|
-
addActionClass?: string;
|
|
13
|
-
}
|
|
14
|
-
export declare function createDefaultArrayRenderer(options?: DefaultArrayRendererOptions): ArrayRendererRegistration;
|
|
15
|
-
export interface DefaultArrayRendererProps extends DefaultArrayRendererOptions, ArrayRendererProps {
|
|
16
|
-
renderAction: (props: ActionRendererProps) => ReactNode;
|
|
17
|
-
}
|
|
18
|
-
export declare function DefaultArrayRenderer(props: DefaultArrayRendererProps): React.JSX.Element;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { DisplayRendererProps } from "../controlRender";
|
|
3
|
-
import { DisplayRendererRegistration } from "../renderers";
|
|
4
|
-
export interface DefaultDisplayRendererOptions {
|
|
5
|
-
textClassName?: string;
|
|
6
|
-
htmlClassName?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function createDefaultDisplayRenderer(options?: DefaultDisplayRendererOptions): DisplayRendererRegistration;
|
|
9
|
-
export declare function DefaultDisplay({ data, display, className, style, ...options }: DefaultDisplayRendererOptions & DisplayRendererProps): React.JSX.Element;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Control } from "@react-typed-forms/core";
|
|
2
|
-
import { SchemaField, SchemaInterface } from "../types";
|
|
3
|
-
import React from "react";
|
|
4
|
-
export declare function DefaultDisplayOnly({ control, className, emptyText, schemaInterface, field, style, }: {
|
|
5
|
-
control: Control<any>;
|
|
6
|
-
field: SchemaField;
|
|
7
|
-
schemaInterface: SchemaInterface;
|
|
8
|
-
className?: string | null;
|
|
9
|
-
style?: React.CSSProperties;
|
|
10
|
-
emptyText?: string | null;
|
|
11
|
-
}): React.JSX.Element;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { RenderedLayout } from "../controlRender";
|
|
2
|
-
import React, { ReactNode } from "react";
|
|
3
|
-
export interface DefaultLayoutRendererOptions {
|
|
4
|
-
className?: string;
|
|
5
|
-
errorClass?: string;
|
|
6
|
-
renderError?: (errorText: string | null | undefined) => ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export declare function DefaultLayout({ errorClass, renderError, layout: { controlEnd, controlStart, label, children, errorControl }, }: DefaultLayoutRendererOptions & {
|
|
9
|
-
layout: RenderedLayout;
|
|
10
|
-
}): React.JSX.Element;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { VisibilityRendererProps } from "../controlRender";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export declare function createDefaultVisibilityRenderer(): import("../renderers").VisibilityRendererRegistration;
|
|
4
|
-
export declare function DefaultVisibility({ visibility, children, className, style, divRef, }: VisibilityRendererProps): React.JSX.Element;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { JsonataRenderOptions } from "../types";
|
|
2
|
-
import { ControlDataContext } from "../util";
|
|
3
|
-
import { Control } from "@react-typed-forms/core";
|
|
4
|
-
import React from "react";
|
|
5
|
-
export declare function createJsonataRenderer(className?: string): import("../renderers").DataRendererRegistration;
|
|
6
|
-
export declare function JsonataRenderer({ control, renderOptions: { expression }, readonly, className, dataContext, }: {
|
|
7
|
-
control: Control<any>;
|
|
8
|
-
renderOptions: JsonataRenderOptions;
|
|
9
|
-
className?: string;
|
|
10
|
-
dataContext: ControlDataContext;
|
|
11
|
-
readonly: boolean;
|
|
12
|
-
}): React.JSX.Element;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { DataRendererProps } from "../controlRender";
|
|
2
|
-
import React from "react";
|
|
3
|
-
export declare function createMultilineFieldRenderer(className?: string): import("../renderers").DataRendererRegistration;
|
|
4
|
-
export declare function MultilineTextfield({ control, className }: DataRendererProps): React.JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function createNullToggleRenderer(): import("../renderers").DataRendererRegistration;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Control } from "@react-typed-forms/core";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { FieldOption } from "../types";
|
|
4
|
-
export interface SelectRendererOptions {
|
|
5
|
-
className?: string;
|
|
6
|
-
emptyText?: string;
|
|
7
|
-
requiredText?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function createSelectRenderer(options?: SelectRendererOptions): import("../renderers").DataRendererRegistration;
|
|
10
|
-
type SelectConversion = (a: any) => string | number;
|
|
11
|
-
export interface SelectDataRendererProps {
|
|
12
|
-
id?: string;
|
|
13
|
-
className?: string;
|
|
14
|
-
options: FieldOption[];
|
|
15
|
-
emptyText?: string;
|
|
16
|
-
requiredText?: string;
|
|
17
|
-
readonly: boolean;
|
|
18
|
-
required: boolean;
|
|
19
|
-
state: Control<any>;
|
|
20
|
-
convert: SelectConversion;
|
|
21
|
-
}
|
|
22
|
-
export declare function SelectDataRenderer({ state, options, className, convert, required, emptyText, requiredText, readonly, ...props }: SelectDataRendererProps): React.JSX.Element;
|
|
23
|
-
export declare function createSelectConversion(ft: string): SelectConversion;
|
|
24
|
-
export {};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { DefaultDisplayRendererOptions } from "./components/DefaultDisplay";
|
|
2
|
-
import { DefaultLayoutRendererOptions } from "./components/DefaultLayout";
|
|
3
|
-
import { ActionRendererRegistration, AdornmentRendererRegistration, DataRendererRegistration, DefaultRenderers, GroupRendererRegistration, LabelRendererRegistration } from "./renderers";
|
|
4
|
-
import { CSSProperties, ReactElement, ReactNode } from "react";
|
|
5
|
-
import { ArrayActionOptions, FieldOption, GridRenderer } from "./types";
|
|
6
|
-
import { SelectRendererOptions } from "./components/SelectDataRenderer";
|
|
7
|
-
import { Control } from "@react-typed-forms/core";
|
|
8
|
-
import { DefaultArrayRendererOptions } from "./components/DefaultArrayRenderer";
|
|
9
|
-
import { CheckRendererOptions } from "./components/CheckRenderer";
|
|
10
|
-
export interface DefaultRendererOptions {
|
|
11
|
-
data?: DefaultDataRendererOptions;
|
|
12
|
-
display?: DefaultDisplayRendererOptions;
|
|
13
|
-
action?: DefaultActionRendererOptions;
|
|
14
|
-
array?: DefaultArrayRendererOptions;
|
|
15
|
-
group?: DefaultGroupRendererOptions;
|
|
16
|
-
label?: DefaultLabelRendererOptions;
|
|
17
|
-
adornment?: DefaultAdornmentRendererOptions;
|
|
18
|
-
layout?: DefaultLayoutRendererOptions;
|
|
19
|
-
}
|
|
20
|
-
interface StyleProps {
|
|
21
|
-
className?: string;
|
|
22
|
-
style?: CSSProperties;
|
|
23
|
-
}
|
|
24
|
-
export interface DefaultActionRendererOptions {
|
|
25
|
-
className?: string;
|
|
26
|
-
renderContent?: (actionText: string, actionId: string, actionData: any) => ReactNode;
|
|
27
|
-
}
|
|
28
|
-
export declare function createButtonActionRenderer(actionId: string | string[] | undefined, options?: DefaultActionRendererOptions): ActionRendererRegistration;
|
|
29
|
-
export interface DefaultGroupRendererOptions {
|
|
30
|
-
className?: string;
|
|
31
|
-
standardClassName?: string;
|
|
32
|
-
gridStyles?: (columns: GridRenderer) => StyleProps;
|
|
33
|
-
gridClassName?: string;
|
|
34
|
-
defaultGridColumns?: number;
|
|
35
|
-
flexClassName?: string;
|
|
36
|
-
defaultFlexGap?: string;
|
|
37
|
-
}
|
|
38
|
-
export declare function createDefaultGroupRenderer(options?: DefaultGroupRendererOptions): GroupRendererRegistration;
|
|
39
|
-
export declare const DefaultBoolOptions: FieldOption[];
|
|
40
|
-
export interface DefaultDataRendererOptions {
|
|
41
|
-
inputClass?: string;
|
|
42
|
-
displayOnlyClass?: string;
|
|
43
|
-
selectOptions?: SelectRendererOptions;
|
|
44
|
-
checkboxOptions?: CheckRendererOptions;
|
|
45
|
-
checkOptions?: CheckRendererOptions;
|
|
46
|
-
radioOptions?: CheckRendererOptions;
|
|
47
|
-
checkListOptions?: CheckRendererOptions;
|
|
48
|
-
booleanOptions?: FieldOption[];
|
|
49
|
-
optionRenderer?: DataRendererRegistration;
|
|
50
|
-
multilineClass?: string;
|
|
51
|
-
jsonataClass?: string;
|
|
52
|
-
arrayOptions?: ArrayActionOptions;
|
|
53
|
-
}
|
|
54
|
-
export declare function createDefaultDataRenderer(options?: DefaultDataRendererOptions): DataRendererRegistration;
|
|
55
|
-
export interface DefaultAccordionRendererOptions {
|
|
56
|
-
className?: string;
|
|
57
|
-
titleClass?: string;
|
|
58
|
-
togglerClass?: string;
|
|
59
|
-
iconOpenClass?: string;
|
|
60
|
-
iconClosedClass?: string;
|
|
61
|
-
renderTitle?: (title: string | undefined, current: Control<boolean>) => ReactNode;
|
|
62
|
-
renderToggler?: (current: Control<boolean>, title: ReactNode) => ReactNode;
|
|
63
|
-
}
|
|
64
|
-
export interface DefaultAdornmentRendererOptions {
|
|
65
|
-
accordion?: DefaultAccordionRendererOptions;
|
|
66
|
-
}
|
|
67
|
-
export declare function createDefaultAdornmentRenderer(options?: DefaultAdornmentRendererOptions): AdornmentRendererRegistration;
|
|
68
|
-
interface DefaultLabelRendererOptions {
|
|
69
|
-
className?: string;
|
|
70
|
-
groupLabelClass?: string;
|
|
71
|
-
controlLabelClass?: string;
|
|
72
|
-
requiredElement?: ReactNode;
|
|
73
|
-
labelContainer?: (children: ReactElement) => ReactElement;
|
|
74
|
-
}
|
|
75
|
-
export declare function createDefaultLabelRenderer(options?: DefaultLabelRendererOptions): LabelRendererRegistration;
|
|
76
|
-
export declare function createDefaultRenderers(options?: DefaultRendererOptions): DefaultRenderers;
|
|
77
|
-
export {};
|
package/lib/tailwind.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export declare const defaultTailwindTheme: {
|
|
3
|
-
label: {
|
|
4
|
-
groupLabelClass: string;
|
|
5
|
-
requiredElement: React.JSX.Element;
|
|
6
|
-
};
|
|
7
|
-
array: {
|
|
8
|
-
removableClass: string;
|
|
9
|
-
childClass: string;
|
|
10
|
-
addActionClass: string;
|
|
11
|
-
};
|
|
12
|
-
group: {
|
|
13
|
-
standardClassName: string;
|
|
14
|
-
gridClassName: string;
|
|
15
|
-
flexClassName: string;
|
|
16
|
-
};
|
|
17
|
-
action: {
|
|
18
|
-
className: string;
|
|
19
|
-
};
|
|
20
|
-
layout: {
|
|
21
|
-
className: string;
|
|
22
|
-
errorClass: string;
|
|
23
|
-
};
|
|
24
|
-
data: {
|
|
25
|
-
displayOnlyClass: string;
|
|
26
|
-
checkOptions: {
|
|
27
|
-
className: string;
|
|
28
|
-
entryClass: string;
|
|
29
|
-
};
|
|
30
|
-
selectOptions: {
|
|
31
|
-
emptyText: string;
|
|
32
|
-
};
|
|
33
|
-
multilineClass: string;
|
|
34
|
-
};
|
|
35
|
-
adornment: {
|
|
36
|
-
accordion: {
|
|
37
|
-
className: string;
|
|
38
|
-
titleClass: string;
|
|
39
|
-
iconOpenClass: string;
|
|
40
|
-
iconClosedClass: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
};
|