Skip to content
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

feat(form-builder): add field groups #3006

Merged
merged 34 commits into from
Jan 7, 2022

Conversation

vicmeow
Copy link
Contributor

@vicmeow vicmeow commented Dec 13, 2021

Description

This PR adds the concept of Field Groups to schemas, along with a way to filter fields in document view based on said field groups.

Field Groups is presentational only, and should replace any uses of existing tab plugins like sanity-plugin-tabs.

A field can belong to multiple field groups.

Example schema:

{
  name: 'article',
  title: 'Article',
  type: 'document',
  groups: [
    {
      name: 'seo',
      title: 'SEO',
    },
  ],
  fields: [
    {name: 'title', title: 'Title', type: 'string'},
    {name: 'icon', title: 'Icon', type: 'image'},
    {
      name: 'related',
      title: 'Related',
      type: 'array',
      of: [{type: 'reference', to: [{type: 'article'}]}],
    },
    {name: 'seoTitle', title: 'SEO title', type: 'string', group: 'seo'},
    {name: 'seoKeywords', title: 'Keywords', type: 'string', group: 'seo'},
    {name: 'seoSlug', title: 'Slug', type: 'slug', group: 'seo'},
    {name: 'seoImage', title: 'Image', type: 'image', group: 'seo'},
  ],
}
Screenshots
image image

What to review

You can test field groups in this deployed test studio

  • Performance when typing in simple and more complex schemas
  • That field groups works with validation markers and presence
  • That the hidden property on groups work both with booleans and callbacks
  • That the document view switches the All fields group when Review Changes is open
  • That the field groups tab is hidden if the only group remaining is "All fields" - like when you have one group named "SEO" and you set hidden: true
  • That nested field groups works
  • That the first field group with default: true is selected by default

Notes for release

  • Added Field Groups to schemas and document view

@vercel
Copy link

vercel bot commented Dec 13, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

studio-workshop – ./dev/workshop

🔍 Inspect: https://vercel.com/sanity-io/studio-workshop/FHEumDfMHuwNRRKy3ZuogY837wZi
✅ Preview: https://studio-workshop-git-feature-sc-12720implement-fieldgroups.sanity.build

test-studio – ./

🔍 Inspect: https://vercel.com/sanity-io/test-studio/5gwCUmPbhxRoCEqZCXcJtcWCuBNd
✅ Preview: https://test-studio-git-feature-sc-12720implement-fieldgroups.sanity.build

perf-studio – ./

🔍 Inspect: https://vercel.com/sanity-io/perf-studio/4uXiXfSiWYzfc37hfrmbuQycAj7U
✅ Preview: https://perf-studio-git-feature-sc-12720implement-fieldgroups.sanity.build

@vicmeow vicmeow force-pushed the feature/sc-12720/implement-fieldgroups branch from 2c6921f to ce4469f Compare December 13, 2021 13:35
@vicmeow vicmeow force-pushed the feature/sc-12720/implement-fieldgroups branch from ce4469f to 49d358e Compare December 13, 2021 14:12
@vicmeow vicmeow force-pushed the feature/sc-12720/implement-fieldgroups branch from 5a70b1e to 37c1ac7 Compare December 15, 2021 13:05
@vicmeow vicmeow force-pushed the feature/sc-12720/implement-fieldgroups branch from 37c1ac7 to 02ed51e Compare December 16, 2021 14:09
@sjelfull sjelfull force-pushed the feature/sc-12720/implement-fieldgroups branch from 4aae818 to 8fb41b0 Compare December 16, 2021 17:20
@sjelfull sjelfull force-pushed the feature/sc-12720/implement-fieldgroups branch from 8fb41b0 to a860327 Compare December 21, 2021 18:36
vicmeow and others added 23 commits January 7, 2022 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants