-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the ability to override form layouts in a simpler way #4116
Conversation
Back to WIP, I'll do the layout of the forms with |
And we're back to RFR |
After a good night's sleep, I think we can do a better work than inviting people to copy a large bunch of code. Back to WIP. |
And Ready For Review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat! 💪
|
||
This custom form layout component uses the `FormWithRedirect` component, which wraps react-final-form's `Form` component to handle redirection logic. It also uses react-admin's `<SaveButton>` and a `<DeleteButton>`. | ||
|
||
**Tip**: When `Input` components have a `resource` prop, they use it to determine the input label. `<SimpleForm>` and `<TabbedForm>` inject this `resource` prop to `Input` components automatically. When you use a custom form layout, pass the `resource` prop manually - unless the `Input` has a `label` prop. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really should use react Context instead :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, v4 ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed ^^
Hi, Just updating to v3.1.0: ./~/ra-core/esm/form/FormWithRedirect.js |
Weird, the transpilation didn't transform Thanks for the report. |
Out of curiosity, how did you get this error (webpack/parce, babel settings, browser)? I can't reproduce it on any browser on the react-admin demo, even IE11. |
I upgraded RA from v2.9, after installing the new packages and run yarn start I get this error |
FYI this is a bug in TypeScript (microsoft/TypeScript#35771) triggered by a useless convention in react-final-form (final-form/react-final-form#704), but we'll have to fix it in the react-admin code... |
Caused by TypeScript bug microsoft/TypeScript#35771 Refs #4116
Caused by TypeScript bug microsoft/TypeScript#35771 Refs marmelab#4116
Caused by TypeScript bug microsoft/TypeScript#35771 Refs #4116
Caused by TypeScript bug microsoft/TypeScript#35771 Refs #4116
Edit
,Create
, andShow
root componenthandleSubmitWithRedirect
optional in ToolbarFormWithRedirect
component inra-core
to refactor common form code and make custom form layouts easierbefore
after