@react-typed-forms/schemas 9.1.0 → 9.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/components/ControlInput.d.ts +9 -0
- package/lib/components/DefaultDisplay.d.ts +9 -0
- package/lib/components/DefaultDisplayOnly.d.ts +11 -0
- package/lib/components/DefaultLayout.d.ts +9 -0
- package/lib/components/DefaultVisibility.d.ts +4 -0
- package/lib/components/RadioRenderer.d.ts +20 -0
- package/lib/components/SelectDataRenderer.d.ts +24 -0
- package/lib/controlRender.d.ts +1 -0
- package/lib/createDefaultRenderers.d.ts +67 -0
- package/lib/createFormRenderer.d.ts +3 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +578 -494
- package/lib/index.js.map +1 -1
- package/lib/renderers.d.ts +3 -115
- package/lib/types.d.ts +8 -0
- package/package.json +1 -1
package/lib/renderers.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ControlAdornment, FieldOption, GridRenderer, IconAdornment, SchemaField, SchemaInterface } from "./types";
|
|
1
|
+
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { ActionRendererProps, AdornmentProps, AdornmentRenderer, ArrayRendererProps, ControlLayoutProps, DataRendererProps, DisplayRendererProps, FormRenderer, GroupRendererProps, LabelRendererProps, LabelType, RenderedControl, VisibilityRendererProps } from "./controlRender";
|
|
3
|
+
import { ControlAdornment, IconAdornment } from "./types";
|
|
5
4
|
export interface DefaultRenderers {
|
|
6
5
|
data: DataRendererRegistration;
|
|
7
6
|
label: LabelRendererRegistration;
|
|
@@ -61,86 +60,6 @@ export interface VisibilityRendererRegistration {
|
|
|
61
60
|
render: (props: VisibilityRendererProps) => ReactNode;
|
|
62
61
|
}
|
|
63
62
|
export type RendererRegistration = DataRendererRegistration | GroupRendererRegistration | DisplayRendererRegistration | ActionRendererRegistration | LabelRendererRegistration | ArrayRendererRegistration | AdornmentRendererRegistration | LayoutRendererRegistration | VisibilityRendererRegistration;
|
|
64
|
-
export declare function createFormRenderer(customRenderers?: RendererRegistration[], defaultRenderers?: DefaultRenderers): FormRenderer;
|
|
65
|
-
interface DefaultLabelRendererOptions {
|
|
66
|
-
className?: string;
|
|
67
|
-
groupLabelClass?: string;
|
|
68
|
-
controlLabelClass?: string;
|
|
69
|
-
requiredElement?: ReactNode;
|
|
70
|
-
}
|
|
71
|
-
interface DefaultActionRendererOptions {
|
|
72
|
-
className?: string;
|
|
73
|
-
}
|
|
74
|
-
export declare function createDefaultActionRenderer(options?: DefaultActionRendererOptions): ActionRendererRegistration;
|
|
75
|
-
export declare function createDefaultLabelRenderer(options?: DefaultLabelRendererOptions): LabelRendererRegistration;
|
|
76
|
-
interface DefaultArrayRendererOptions {
|
|
77
|
-
className?: string;
|
|
78
|
-
removableClass?: string;
|
|
79
|
-
childClass?: string;
|
|
80
|
-
removableChildClass?: string;
|
|
81
|
-
removeActionClass?: string;
|
|
82
|
-
addActionClass?: string;
|
|
83
|
-
}
|
|
84
|
-
export declare function createDefaultArrayRenderer(options?: DefaultArrayRendererOptions): ArrayRendererRegistration;
|
|
85
|
-
interface StyleProps {
|
|
86
|
-
className?: string;
|
|
87
|
-
style?: CSSProperties;
|
|
88
|
-
}
|
|
89
|
-
interface DefaultGroupRendererOptions {
|
|
90
|
-
className?: string;
|
|
91
|
-
standardClassName?: string;
|
|
92
|
-
gridStyles?: (columns: GridRenderer) => StyleProps;
|
|
93
|
-
gridClassName?: string;
|
|
94
|
-
defaultGridColumns?: number;
|
|
95
|
-
flexClassName?: string;
|
|
96
|
-
defaultFlexGap?: string;
|
|
97
|
-
}
|
|
98
|
-
export declare function createDefaultGroupRenderer(options?: DefaultGroupRendererOptions): GroupRendererRegistration;
|
|
99
|
-
export interface DefaultDisplayRendererOptions {
|
|
100
|
-
textClassName?: string;
|
|
101
|
-
htmlClassName?: string;
|
|
102
|
-
}
|
|
103
|
-
export declare function createDefaultDisplayRenderer(options?: DefaultDisplayRendererOptions): DisplayRendererRegistration;
|
|
104
|
-
export declare function DefaultDisplay({ data, display, className, style, ...options }: DefaultDisplayRendererOptions & DisplayRendererProps): React.JSX.Element;
|
|
105
|
-
export declare const DefaultBoolOptions: FieldOption[];
|
|
106
|
-
interface DefaultDataRendererOptions {
|
|
107
|
-
inputClass?: string;
|
|
108
|
-
displayOnlyClass?: string;
|
|
109
|
-
selectOptions?: SelectRendererOptions;
|
|
110
|
-
booleanOptions?: FieldOption[];
|
|
111
|
-
optionRenderer?: DataRendererRegistration;
|
|
112
|
-
}
|
|
113
|
-
export declare function createDefaultDataRenderer(options?: DefaultDataRendererOptions): DataRendererRegistration;
|
|
114
|
-
export declare function DefaultDisplayOnly({ control, className, emptyText, schemaInterface, field, style, }: {
|
|
115
|
-
control: Control<any>;
|
|
116
|
-
field: SchemaField;
|
|
117
|
-
schemaInterface: SchemaInterface;
|
|
118
|
-
className?: string;
|
|
119
|
-
style?: React.CSSProperties;
|
|
120
|
-
emptyText?: string | null;
|
|
121
|
-
}): React.JSX.Element;
|
|
122
|
-
export declare function ControlInput({ control, convert, ...props }: React.InputHTMLAttributes<HTMLInputElement> & {
|
|
123
|
-
control: Control<any>;
|
|
124
|
-
convert: InputConversion;
|
|
125
|
-
}): React.JSX.Element;
|
|
126
|
-
export interface DefaultAdornmentRendererOptions {
|
|
127
|
-
}
|
|
128
|
-
export declare function createDefaultAdornmentRenderer(options?: DefaultAdornmentRendererOptions): AdornmentRendererRegistration;
|
|
129
|
-
export interface DefaultLayoutRendererOptions {
|
|
130
|
-
className?: string;
|
|
131
|
-
errorClass?: string;
|
|
132
|
-
}
|
|
133
|
-
export interface DefaultRendererOptions {
|
|
134
|
-
data?: DefaultDataRendererOptions;
|
|
135
|
-
display?: DefaultDisplayRendererOptions;
|
|
136
|
-
action?: DefaultActionRendererOptions;
|
|
137
|
-
array?: DefaultArrayRendererOptions;
|
|
138
|
-
group?: DefaultGroupRendererOptions;
|
|
139
|
-
label?: DefaultLabelRendererOptions;
|
|
140
|
-
adornment?: DefaultAdornmentRendererOptions;
|
|
141
|
-
layout?: DefaultLayoutRendererOptions;
|
|
142
|
-
}
|
|
143
|
-
export declare function createDefaultRenderers(options?: DefaultRendererOptions): DefaultRenderers;
|
|
144
63
|
export declare function isIconAdornment(a: ControlAdornment): a is IconAdornment;
|
|
145
64
|
export declare function createLayoutRenderer(render: LayoutRendererRegistration["render"], options?: Partial<LayoutRendererRegistration>): LayoutRendererRegistration;
|
|
146
65
|
export declare function createArrayRenderer(render: ArrayRendererRegistration["render"], options?: Partial<ArrayRendererRegistration>): ArrayRendererRegistration;
|
|
@@ -150,34 +69,3 @@ export declare function createDisplayRenderer(render: DisplayRendererRegistratio
|
|
|
150
69
|
export declare function createLabelRenderer(render: LabelRendererRegistration["render"], options?: Omit<LabelRendererRegistration, "type">): LabelRendererRegistration;
|
|
151
70
|
export declare function createVisibilityRenderer(render: VisibilityRendererRegistration["render"], options?: Partial<VisibilityRendererRegistration>): VisibilityRendererRegistration;
|
|
152
71
|
export declare function createAdornmentRenderer(render: (props: AdornmentProps) => AdornmentRenderer, options?: Partial<AdornmentRendererRegistration>): AdornmentRendererRegistration;
|
|
153
|
-
export interface SelectRendererOptions {
|
|
154
|
-
className?: string;
|
|
155
|
-
emptyText?: string;
|
|
156
|
-
requiredText?: string;
|
|
157
|
-
}
|
|
158
|
-
export declare function createSelectRenderer(options?: SelectRendererOptions): DataRendererRegistration;
|
|
159
|
-
type SelectConversion = (a: any) => string | number;
|
|
160
|
-
interface SelectDataRendererProps {
|
|
161
|
-
id?: string;
|
|
162
|
-
className?: string;
|
|
163
|
-
options: {
|
|
164
|
-
name: string;
|
|
165
|
-
value: any;
|
|
166
|
-
disabled?: boolean;
|
|
167
|
-
}[];
|
|
168
|
-
emptyText?: string;
|
|
169
|
-
requiredText?: string;
|
|
170
|
-
required: boolean;
|
|
171
|
-
state: Control<any>;
|
|
172
|
-
convert: SelectConversion;
|
|
173
|
-
}
|
|
174
|
-
export declare function SelectDataRenderer({ state, options, className, convert, required, emptyText, requiredText, ...props }: SelectDataRendererProps): React.JSX.Element;
|
|
175
|
-
export declare function createSelectConversion(ft: string): SelectConversion;
|
|
176
|
-
type InputConversion = [string, (s: any) => any, (a: any) => string | number];
|
|
177
|
-
export declare function createInputConversion(ft: string): InputConversion;
|
|
178
|
-
export declare function createDefaultVisibilityRenderer(): VisibilityRendererRegistration;
|
|
179
|
-
export declare function DefaultVisibility({ visibility, children, className, style, divRef, }: VisibilityRendererProps): React.JSX.Element;
|
|
180
|
-
export declare function DefaultLayout({ errorClass, layout: { controlEnd, controlStart, label, children, errorControl }, }: DefaultLayoutRendererOptions & {
|
|
181
|
-
layout: RenderedLayout;
|
|
182
|
-
}): React.JSX.Element;
|
|
183
|
-
export {};
|
package/lib/types.d.ts
CHANGED
|
@@ -36,6 +36,8 @@ export interface EntityRefField extends SchemaField {
|
|
|
36
36
|
export interface FieldOption {
|
|
37
37
|
name: string;
|
|
38
38
|
value: any;
|
|
39
|
+
description?: string | null;
|
|
40
|
+
disabled?: boolean | null;
|
|
39
41
|
}
|
|
40
42
|
export interface CompoundField extends SchemaField {
|
|
41
43
|
type: FieldType.Compound;
|
|
@@ -155,6 +157,7 @@ export interface RenderOptions {
|
|
|
155
157
|
}
|
|
156
158
|
export declare enum DataRenderType {
|
|
157
159
|
Standard = "Standard",
|
|
160
|
+
Textfield = "Textfield",
|
|
158
161
|
Radio = "Radio",
|
|
159
162
|
HtmlEditor = "HtmlEditor",
|
|
160
163
|
IconList = "IconList",
|
|
@@ -168,6 +171,10 @@ export declare enum DataRenderType {
|
|
|
168
171
|
DisplayOnly = "DisplayOnly",
|
|
169
172
|
Group = "Group"
|
|
170
173
|
}
|
|
174
|
+
export interface TextfieldRenderOptions extends RenderOptions {
|
|
175
|
+
type: DataRenderType.Textfield;
|
|
176
|
+
placeholder?: string | null;
|
|
177
|
+
}
|
|
171
178
|
export interface RadioButtonRenderOptions extends RenderOptions {
|
|
172
179
|
type: DataRenderType.Radio;
|
|
173
180
|
}
|
|
@@ -314,4 +321,5 @@ export declare function visitControlDefinition<A>(x: ControlDefinition, visitor:
|
|
|
314
321
|
export declare function isGridRenderer(options: GroupRenderOptions): options is GridRenderer;
|
|
315
322
|
export declare function isFlexRenderer(options: GroupRenderOptions): options is FlexRenderer;
|
|
316
323
|
export declare function isDisplayOnlyRenderer(options: RenderOptions): options is DisplayOnlyRenderOptions;
|
|
324
|
+
export declare function isTextfieldRenderer(options: RenderOptions): options is TextfieldRenderOptions;
|
|
317
325
|
export declare function isDataGroupRenderer(options: RenderOptions): options is DataGroupRenderOptions;
|