@react-typed-forms/schemas 7.3.2 → 8.1.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.
@@ -14,3 +14,9 @@ export declare function compoundControl(field: string, title: string | undefined
14
14
  export declare function createAction(actionId: string, onClick: () => void, actionText?: string): ActionRendererProps;
15
15
  export declare const emptyGroupDefinition: GroupedControlsDefinition;
16
16
  export declare function useControlDefinitionForSchema(sf: SchemaField[], definition?: GroupedControlsDefinition): GroupedControlsDefinition;
17
+ export interface CustomRenderOptions {
18
+ value: string;
19
+ name: string;
20
+ fields: SchemaField[];
21
+ }
22
+ export declare function addCustomDataRenderOptions(controlFields: SchemaField[], customRenderOptions: CustomRenderOptions[]): SchemaField[];
@@ -31,7 +31,7 @@ export interface ArrayRendererProps {
31
31
  elementCount: number;
32
32
  renderElement: (elemIndex: number) => ReactNode;
33
33
  elementKey: (elemIndex: number) => Key;
34
- arrayControl?: Control<any[] | undefined | null>;
34
+ arrayControl: Control<any[] | undefined | null>;
35
35
  className?: string;
36
36
  style?: React.CSSProperties;
37
37
  }
@@ -78,6 +78,7 @@ export interface LabelRendererProps {
78
78
  label: ReactNode;
79
79
  required?: boolean | null;
80
80
  forId?: string;
81
+ className?: string;
81
82
  }
82
83
  export interface DisplayRendererProps {
83
84
  data: DisplayData;
@@ -86,14 +87,13 @@ export interface DisplayRendererProps {
86
87
  style?: React.CSSProperties;
87
88
  }
88
89
  export interface GroupRendererProps {
90
+ children: ControlDefinition[];
89
91
  renderOptions: GroupRenderOptions;
90
- childCount: number;
91
- renderChild: (child: number) => ReactNode;
92
+ renderChild: ChildRenderer;
92
93
  className?: string;
93
94
  style?: React.CSSProperties;
94
95
  }
95
96
  export interface DataRendererProps {
96
- definition: DataControlDefinition;
97
97
  renderOptions: RenderOptions;
98
98
  field: SchemaField;
99
99
  id: string;
@@ -105,7 +105,7 @@ export interface DataRendererProps {
105
105
  className?: string;
106
106
  style?: React.CSSProperties;
107
107
  dataContext: ControlDataContext;
108
- childCount: number;
108
+ children: ControlDefinition[];
109
109
  renderChild: ChildRenderer;
110
110
  toArrayProps?: () => ArrayRendererProps;
111
111
  }
@@ -132,7 +132,6 @@ export interface DataControlProps {
132
132
  control: Control<any>;
133
133
  options: FormContextOptions;
134
134
  style: React.CSSProperties | undefined;
135
- childCount: number;
136
135
  renderChild: ChildRenderer;
137
136
  allowedOptions?: Control<any[] | undefined>;
138
137
  elementRenderer?: (elemIndex: number) => ReactNode;
@@ -152,24 +151,32 @@ export interface ControlRenderOptions extends FormContextOptions {
152
151
  export declare function useControlRenderer(definition: ControlDefinition, fields: SchemaField[], renderer: FormRenderer, options?: ControlRenderOptions): FC<ControlRenderProps>;
153
152
  export declare function lookupSchemaField(c: ControlDefinition, fields: SchemaField[]): SchemaField | undefined;
154
153
  export declare function getControlData(schemaField: SchemaField | undefined, parentContext: ControlDataContext): [Control<any> | undefined, Control<any> | undefined, ControlDataContext];
154
+ export declare function ControlRenderer({ definition, fields, renderer, options, control, parentPath, }: {
155
+ definition: ControlDefinition;
156
+ fields: SchemaField[];
157
+ renderer: FormRenderer;
158
+ options?: ControlRenderOptions;
159
+ control: Control<any>;
160
+ parentPath?: JsonPath[];
161
+ }): React.JSX.Element;
155
162
  export declare function defaultDataProps({ definition, field, control, options, elementRenderer, style, allowedOptions, ...props }: DataControlProps): DataRendererProps;
156
163
  export declare function defaultArrayProps(arrayControl: Control<any[] | undefined | null>, field: SchemaField, required: boolean, style: CSSProperties | undefined, className: string | undefined, renderElement: (elemIndex: number) => ReactNode): ArrayRendererProps;
157
- export type ChildRenderer = (k: Key, childIndex: number, props: ControlRenderProps) => ReactNode;
164
+ export type ChildRenderer = (k: Key, child: number | number[], parentPath?: JsonPath[]) => ReactNode;
158
165
  export interface RenderControlProps {
159
166
  definition: ControlDefinition;
160
167
  renderer: FormRenderer;
161
- childCount: number;
162
168
  renderChild: ChildRenderer;
163
169
  createDataProps: CreateDataProps;
164
170
  formOptions: FormContextOptions;
165
171
  dataContext: ControlDataContext;
166
172
  control?: Control<any>;
173
+ labelText?: Control<string | null | undefined>;
167
174
  schemaField?: SchemaField;
168
175
  displayControl?: Control<string | undefined>;
169
176
  style?: React.CSSProperties;
170
177
  allowedOptions?: Control<any[] | undefined>;
171
178
  }
172
- export declare function renderControlLayout({ definition: c, renderer, childCount, renderChild: childRenderer, control: childControl, schemaField, dataContext, formOptions: dataOptions, createDataProps: dataProps, displayControl, style, allowedOptions, }: RenderControlProps): ControlLayoutProps;
179
+ export declare function renderControlLayout({ definition: c, renderer, renderChild: childRenderer, control: childControl, schemaField, dataContext, formOptions: dataOptions, createDataProps: dataProps, displayControl, style, labelText, allowedOptions, }: RenderControlProps): ControlLayoutProps;
173
180
  export declare function appendMarkup(k: keyof Omit<RenderedLayout, "errorControl" | "style" | "className">, markup: ReactNode): (layout: RenderedLayout) => void;
174
181
  export declare function wrapMarkup(k: keyof Omit<RenderedLayout, "errorControl" | "style" | "className">, wrap: (ex: ReactNode) => ReactNode): (layout: RenderedLayout) => void;
175
182
  export declare function layoutKeyForPlacement(pos: AdornmentPlacement): keyof Omit<RenderedLayout, "errorControl" | "style" | "className">;
package/lib/hooks.d.ts CHANGED
@@ -19,3 +19,4 @@ export declare function useEvalDynamicHook(definition: ControlDefinition, type:
19
19
  export declare function matchesType(context: ControlDataContext, types?: string[] | null): boolean | undefined;
20
20
  export declare function hideDisplayOnly(context: ControlDataContext, field: SchemaField, definition: ControlDefinition, schemaInterface: SchemaInterface): boolean | undefined;
21
21
  export declare function useJsonataExpression(jExpr: string, dataContext: DataContext, bindings?: () => Record<string, any>): Control<any>;
22
+ export declare function useEvalLabelText(useExpr: UseEvalExpressionHook, definition: ControlDefinition): EvalExpressionHook<string | null>;