Skip to content

DataForm component #59745

Open
Open

Description

Related:

Problem scope

As we continue expanding our UIs, be it the editor UI or new pages being added to the site editor, we’re finding our selves creating a lot of forms to edit entities and for each one of these, we keep recreating adhoc designs and implement adhoc forms.

Here are some of the existing forms:

Where Screenshot
The inspector panel for post/pages/templates/patterns Screenshot 2024-03-07 at 4 14 51 PM
Forms to create new patterns/pages/templates Screenshot 2024-03-11 at 9 58 55 AM
Details panels Screenshot 2024-03-07 at 4 14 39 PM

Also, as we advance into the admin redesign work, we’ll be creating even more forms:

  • creating and editing media (media quick edit) for the Media Library project
  • creating and updating categories
  • quick edit for the dataviews
  • bulk editing for the dataviews

To avoid creating and designing UIs for these over and over again in an ad-hoc and inconsistent way, we should explore an API to generate these forms consistently.

Proposal

When implementing the DataViews in the site editor, we introduce a “fields” config for each data view component. To render a DataView, we’ve built a generic component with the following API:

<DataViews data={data} fields={ fields } view={ view } />

So this component render a list of items given a “fields” config and a some options (view).

Similarly, we should explore building a generic component that renders a form/panel

<DataForm item={item} fields={ fields } form={ form } />

Such component would render a form or panel for a given item based on a “fields” config and some options (form).

Notes

  • It would be good to share the same “fields” config as the one used in the dataviews project, I think this might force us to formalize the field “types” more.
  • Having a reusable component like that will also allow us to provide a consistent extensibility API ultimately.
  • A library like that could be a good inspiration https://github.com/pmndrs/leva
  • Let’s try to explore this as a prototype, for instance let’s have an initial goal of building a quick edit form for posts (basically recreate the inspector panel for posts) and try to discover what kind of config we need there.

Tasks

Improvements

Fields improvements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    [Feature] DataViewsWork surrounding upgrading and evolving views in the site editor and beyond[Type] ExperimentalExperimental feature or API.[Type] OverviewComprehensive, high level view of an area of focus often with multiple tracking issues

    Type

    No type

    Projects

    • Status

      🏈 Punted to 6.8

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions