From 5781f4af3d393a7539997601b9f724d1eb83fe00 Mon Sep 17 00:00:00 2001 From: asvarcas <asvarcas@etriek.com.uy> Date: Mon, 21 Dec 2020 14:33:44 -0300 Subject: [PATCH 1/2] Add container prop to SimpleForm --- packages/ra-ui-materialui/src/form/SimpleForm.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/ra-ui-materialui/src/form/SimpleForm.tsx b/packages/ra-ui-materialui/src/form/SimpleForm.tsx index 39b985ca4d2..b2d76f3dbfb 100644 --- a/packages/ra-ui-materialui/src/form/SimpleForm.tsx +++ b/packages/ra-ui-materialui/src/form/SimpleForm.tsx @@ -91,6 +91,7 @@ export interface SimpleFormProps basePath?: string; children: ReactNode; className?: string; + container?: React.ComponentType<any>; initialValues?: any; margin?: 'none' | 'normal' | 'dense'; resource?: string; @@ -104,6 +105,7 @@ const SimpleFormView: FC<SimpleFormViewProps> = ({ basePath, children, className, + container: Container, handleSubmit, handleSubmitWithRedirect, invalid, @@ -123,7 +125,7 @@ const SimpleFormView: FC<SimpleFormViewProps> = ({ className={classnames('simple-form', className)} {...sanitizeRestProps(rest)} > - <CardContentInner> + <Container> {Children.map( children, (input: ReactElement) => @@ -138,7 +140,7 @@ const SimpleFormView: FC<SimpleFormViewProps> = ({ /> ) )} - </CardContentInner> + </Container> {toolbar && React.cloneElement(toolbar, { basePath, @@ -182,6 +184,7 @@ SimpleFormView.propTypes = { export interface SimpleFormViewProps extends FormRenderProps { basePath?: string; className?: string; + container?: React.ComponentType<any>; margin?: 'none' | 'normal' | 'dense'; handleSubmitWithRedirect?: (redirectTo: RedirectionSideEffect) => void; record?: Record; @@ -199,6 +202,7 @@ export interface SimpleFormViewProps extends FormRenderProps { SimpleFormView.defaultProps = { submitOnEnter: true, toolbar: <Toolbar />, + container: CardContentInner, }; const sanitizeRestProps = ({ From 140876b04ac9160cab4733a6e7115bff4490434d Mon Sep 17 00:00:00 2001 From: asvarcas <asvarcas@etriek.com.uy> Date: Tue, 22 Dec 2020 09:09:08 -0300 Subject: [PATCH 2/2] Renamed container prop to component --- packages/ra-ui-materialui/src/form/SimpleForm.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/ra-ui-materialui/src/form/SimpleForm.tsx b/packages/ra-ui-materialui/src/form/SimpleForm.tsx index b2d76f3dbfb..4c216eb099f 100644 --- a/packages/ra-ui-materialui/src/form/SimpleForm.tsx +++ b/packages/ra-ui-materialui/src/form/SimpleForm.tsx @@ -91,7 +91,7 @@ export interface SimpleFormProps basePath?: string; children: ReactNode; className?: string; - container?: React.ComponentType<any>; + component?: React.ComponentType<any>; initialValues?: any; margin?: 'none' | 'normal' | 'dense'; resource?: string; @@ -105,7 +105,7 @@ const SimpleFormView: FC<SimpleFormViewProps> = ({ basePath, children, className, - container: Container, + component: Component, handleSubmit, handleSubmitWithRedirect, invalid, @@ -125,7 +125,7 @@ const SimpleFormView: FC<SimpleFormViewProps> = ({ className={classnames('simple-form', className)} {...sanitizeRestProps(rest)} > - <Container> + <Component> {Children.map( children, (input: ReactElement) => @@ -140,7 +140,7 @@ const SimpleFormView: FC<SimpleFormViewProps> = ({ /> ) )} - </Container> + </Component> {toolbar && React.cloneElement(toolbar, { basePath, @@ -184,7 +184,7 @@ SimpleFormView.propTypes = { export interface SimpleFormViewProps extends FormRenderProps { basePath?: string; className?: string; - container?: React.ComponentType<any>; + component?: React.ComponentType<any>; margin?: 'none' | 'normal' | 'dense'; handleSubmitWithRedirect?: (redirectTo: RedirectionSideEffect) => void; record?: Record; @@ -202,7 +202,7 @@ export interface SimpleFormViewProps extends FormRenderProps { SimpleFormView.defaultProps = { submitOnEnter: true, toolbar: <Toolbar />, - container: CardContentInner, + component: CardContentInner, }; const sanitizeRestProps = ({