Add CRUD component #4146
Labels
linked in docs
The issue is linked in the docs, so completely skew the upvotes
new feature
New feature or request
scope: toolpad-core
Abbreviated to "core"
waiting for 👍
Waiting for upvotes
Milestone
High level proposal
Some Additional Use Cases
Possible implementation
Separate
List
/Show
/Create
andEdit
components to generate a page from same model definition.The
Crud
component sets predefined routes for each of those 4 components, but still allows for overriding those routes with slots.What about overriding the default paths if
slots
are the way to override these primary components?To be figured out in v2, but after internal discussion we decided to start with a
slots
prop.Possibly, the paths could be set/overriden with a new separate prop.
Fields Definition
We will start by extending the column definition from the MUI X DataGrid as much as possible, such as:
List component
Generates a page with a
DataGrid
showing the fetched items and column types derived from thefields
definition.By default, the rightmost cell includes an options button that opens a popover menu with "Edit" (redirects to the
/edit
page) and "Delete" (with a confirmation dialog) options.If someone wants to customize the behavior of the underlying data grid (e.g.: use the Pro data grid and its features), they can use the
dataGrid
slot and slot props:Possible inline/quick edit implementation:
(uses the default inline editing features of the
DataGrid
and shows an inline edit button along with the options menu)Adding a
createOne
method will render a "Create New"/"Add new" button in the List view above the table, which is overridable through aslot
:Show component
This component corresponds to the details of an individual list item, usually accessible when you click on an individual row in from the
List
Customization:
Create & Edit components
These will be separate components with similar functionality but slightly different default content (submit button text, for example).
(Auto-renders a form with the fields based on the
fields
definition)The form abstractions should be agnostic so that any form library can be used with the generated forms.
This means that a
form
implementation has to be passed in to fully configure these components. The full definition of this prop should be finalized while testing actual integrations, but an initial idea could be:We can provide out-of-the-box integrations with libraries such as
react-hook-form
.Customization:
This offers complete customizability, allows for using MUI components directly, and we can create blocks/components (paid or free) for different preset form content
Benchmark:
Refine
https://refine.dev/docs/#use-cases
Shows a full featured CRUD component with separate views for edit, create, show and a dashboard layout with sign
in/sign out.
https://refine.dev/docs/guides-concepts/forms/#edit
Exposes a
useForm
hook which is a wrapper overreact-hook-form
and integrates with Refine'sdataProvider
Exposes
props
such assaveButtonProps
and the individual field props when you useuseForm
with aresource
parameter, you define all the form fields individually yourselfReact-Admin
https://marmelab.com/react-admin/Edit.html -> You specify form UIs yourself with their custom components, such as
TextField
fromreact-admin
etc.Out of the box UI for CRUD forms does not use visual space efficiently - easy area to improve on
Has a paid
EditInDialog
/CreateInDialog
component that allows quick editsTremor
Edit
componentEdit
component to be as customisable as possible, then it leaves space for blocks to be built on top as wellMinimals CRUD (Visual benchmark)
To Clarify
Data providers for server-side data seem to only be available in the data grid pro plan for now.
This means that probably for now we will not use that feature in our underlying implementation of CRUD.
In the future perhaps we could do it in a sort of "pro" version of the CRUD?
In any case, all server-side methods implemented in the CRUD will stick to the MUI X data provider implementation as closely as possible, as long as it makes sense to.
The text was updated successfully, but these errors were encountered: