Skip to content

DataViews: Unify layout behavior. #67391

@youknowriad

Description

@youknowriad

Current the list, grid and table layouts work very differently when it comes to "fields". This is the result of multiple requests to achieve some designs. So we have:

  • combined fields support in table layouts
  • columns fields support in grid layouts
  • primary field in all of them
  • media field in some of them
  • badge fields in some of them

These differences created some friction and downsides:

  • Reordering fields is not consistent between layouts.
  • Not easy to toggle the visibility some fields when they're combined.
  • Designing a consistent ViewConfig dropdown is challenging.

I think it's time to take a look at the designs we achieved using these features and see whether we can do the same by altering our approach a little bit.

The main idea is to unify how all the layouts work with the following config:

{
   primaryField: "something"
   mediaField: "something"
   descriptionField: "something",
   otherFields: [ ]
}
  • The concept of "combined fields" is gone entirely. (at least not needed for our current use-cases, so we might as well remove it and see if we restore it later)
  • Table block renders a special column (the first one), with an opinionated design of primary + media + description fields combined.
  • The grid block columns config is not needed and replaced by the "description" field.
  • The list view is basically just the first column of the table layout (additional fields can be rendered after it)
  • The rest of the fields are an ordered list of simple fields.
  • The special fields (primary, media, description) are togglable: you can hide/show them but you can't reorder them. Some layouts might make some of these mandatory.
  • There's still a need of some kind of "formats" support for fields to support token fields or having the ability to show/hide field labels.

Related #57596 #58012

Todo

  • Implement the proposal.
  • Consider edge cases: throw an error when "title field" is not defined in grid and list layouts.
  • Reconsider enableHiding config.
  • Fix moving fields in list/grid views.

Metadata

Metadata

Assignees

Labels

[Feature] DataViewsWork surrounding upgrading and evolving views in the site editor and beyond[Status] In ProgressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions