Skip to content

Commit

Permalink
fix: update form-generator
Browse files Browse the repository at this point in the history
  • Loading branch information
adyfk committed Jun 21, 2023
1 parent 4d1eae3 commit 41ffc00
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/v2/components/FormGenerator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,15 @@ export function SchemaComponent({
wrapper={wrapper}
schema={schema}
>
{({ value, container: Container }, indexContainer) => (
{({ value, container: Container, containerProps }, indexContainer) => (
<Fragment key={indexContainer}>
{value?.map((data: any, indexValue: number) => (
<Container
index={indexValue}
schema={schema}
data={data}
key={`${parent}-${identity}-${indexContainer}-${indexValue}-${generatedKey}`}
{...containerProps}
>
<FormGenerator
parent={`${identity}.${indexValue}`}
Expand Down
6 changes: 4 additions & 2 deletions src/v2/components/FormManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,12 @@ export function SchemaComponent({
schema={schema}
schemas={schemas}
>
{({ container: Container }, indexValue) => (
{({ container: Container, containerProps }, indexValue) => (
<Container
schema={schema}
data={{}}
index={indexValue}
{...containerProps}
>
<FormManagement
parent={`${identity}.${generateId()}`}
Expand Down Expand Up @@ -138,12 +139,13 @@ export function SchemaComponent({
schema={schema}
schemas={schemas}
>
{({ value, container: Container }, indexValue) => (
{({ value, container: Container, containerProps }, indexValue) => (
<Container
schema={schema}
data={value}
index={indexValue}
key={`${identity}`}
{...containerProps}
>
<FormManagement
parent={`${identity}`}
Expand Down
4 changes: 3 additions & 1 deletion src/v2/contexts/ComponentContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export type IComponentArrayProps<T> = {
schemas?: any[];
children: FC<{
value: any[],
container: FC<IComponentContainerProps<T>>
container: FC<IComponentContainerProps<T>>;
containerProps?: Record<string, any>
}>
};
export type IComponentObjectProps<T> = {
Expand All @@ -38,6 +39,7 @@ export type IComponentObjectProps<T> = {
children: FC<{
value: Record<string, any>,
container: FC<IComponentContainerProps<T>>
containerProps?: Record<string, any>
}>
};
// Record<IVariant, Record<string, Component<any>>>;
Expand Down

0 comments on commit 41ffc00

Please sign in to comment.