From b995088e5410b5df5772deccfea23ad0370ec43d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Suwi=C5=84ski?= Date: Wed, 6 Mar 2024 11:19:46 +0100 Subject: [PATCH] feat: Show|Create|EditGuesser viewComponent prop (#527) --- src/CreateGuesser.tsx | 3 ++- src/EditGuesser.tsx | 2 ++ src/ShowGuesser.tsx | 3 ++- src/types.ts | 9 ++++++--- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/CreateGuesser.tsx b/src/CreateGuesser.tsx index 77d87543..4faacded 100644 --- a/src/CreateGuesser.tsx +++ b/src/CreateGuesser.tsx @@ -59,6 +59,7 @@ export const IntrospectedCreateGuesser = ({ warnWhenUnsavedChanges, sanitizeEmptyValues = true, formComponent, + viewComponent, children, ...props }: IntrospectedCreateGuesserProps) => { @@ -162,7 +163,7 @@ export const IntrospectedCreateGuesser = ({ const FormType = hasFormTab ? TabbedForm : SimpleForm; return ( - + ) => ({ ...data, extraInformation: { hasFileField }, diff --git a/src/ShowGuesser.tsx b/src/ShowGuesser.tsx index a71cfcbc..bcb99594 100644 --- a/src/ShowGuesser.tsx +++ b/src/ShowGuesser.tsx @@ -44,6 +44,7 @@ export const IntrospectedShowGuesser = ({ writableFields, schema, schemaAnalyzer, + viewComponent, children, ...props }: IntrospectedShowGuesserProps) => { @@ -70,7 +71,7 @@ export const IntrospectedShowGuesser = ({ const ShowLayout = hasTab ? TabbedShowLayout : SimpleShowLayout; return ( - + {fieldChildren} ); diff --git a/src/types.ts b/src/types.ts index 25124da4..3a619a9c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -371,6 +371,7 @@ type CreateFormProps = Omit< CreateProps & SimpleFormProps & TabbedFormProps, 'children' > & + Partial> & Partial< PickRename > & { @@ -389,6 +390,7 @@ type EditFormProps = Omit< EditProps & SimpleFormProps & TabbedFormProps, 'children' > & + Partial> & Partial< PickRename > & { @@ -422,9 +424,10 @@ export type ListGuesserProps = Omit< type ShowFormProps = Omit< ShowProps & SimpleFormProps & TabbedFormProps, 'children' -> & { - children?: ReactNode; -}; +> & + Partial> & { + children?: ReactNode; + }; export type IntrospectedShowGuesserProps = ShowFormProps & IntrospectedGuesserProps;