Skip to content

Commit

Permalink
Add field groups (#8088)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Cousens <413395+dcousens@users.noreply.github.com>
  • Loading branch information
emmatown and dcousens committed Nov 16, 2022
1 parent 2a03de4 commit c1a69e2
Show file tree
Hide file tree
Showing 58 changed files with 699 additions and 106 deletions.
5 changes: 5 additions & 0 deletions .changeset/warm-gifts-change.md
@@ -0,0 +1,5 @@
---
'@keystone-6/core': minor
---

Adds a new `group` function for grouping fields in the Admin UI
33 changes: 33 additions & 0 deletions docs/pages/docs/fields/overview.md
Expand Up @@ -142,6 +142,39 @@ export default config({
});
```

{% if $nextRelease %}

## Groups

Fields can be grouped together in the Admin UI using the `group` function, with a customisable `label` and `description`.

```typescript
import { config, list, group } from '@keystone-6/core';
import { text } from '@keystone-6/core/fields';

export default config({
lists: {
SomeListName: list({
fields: {
...group({
label: 'Group label',
description: 'Group description',
fields: {
someFieldName: text({ /* ... */ }),
/* ... */
},
}),
/* ... */
},
}),
/* ... */
},
/* ... */
});
```

{% /if %}

## Scalar types

- [BigInt](./bigint)
Expand Down
9 changes: 8 additions & 1 deletion examples/assets-local/schema.graphql
Expand Up @@ -292,9 +292,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -351,6 +352,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down
9 changes: 8 additions & 1 deletion examples/assets-s3/schema.graphql
Expand Up @@ -292,9 +292,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -351,6 +352,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down
9 changes: 8 additions & 1 deletion examples/auth/schema.graphql
Expand Up @@ -176,9 +176,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -235,6 +236,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down
9 changes: 8 additions & 1 deletion examples/basic/schema.graphql
Expand Up @@ -446,9 +446,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -505,6 +506,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down
9 changes: 8 additions & 1 deletion examples/blog/schema.graphql
Expand Up @@ -253,9 +253,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -312,6 +313,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down
9 changes: 8 additions & 1 deletion examples/custom-admin-ui-logo/schema.graphql
Expand Up @@ -253,9 +253,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -312,6 +313,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down
9 changes: 8 additions & 1 deletion examples/custom-admin-ui-navigation/schema.graphql
Expand Up @@ -253,9 +253,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -312,6 +313,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down
9 changes: 8 additions & 1 deletion examples/custom-admin-ui-pages/schema.graphql
Expand Up @@ -253,9 +253,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -312,6 +313,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down
9 changes: 8 additions & 1 deletion examples/custom-field-view/schema.graphql
Expand Up @@ -256,9 +256,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -315,6 +316,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down
9 changes: 8 additions & 1 deletion examples/custom-field/schema.graphql
Expand Up @@ -108,9 +108,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -167,6 +168,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down
9 changes: 8 additions & 1 deletion examples/custom-session-validation/schema.graphql
Expand Up @@ -294,9 +294,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -353,6 +354,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down
9 changes: 8 additions & 1 deletion examples/default-values/schema.graphql
Expand Up @@ -271,9 +271,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -330,6 +331,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down
Expand Up @@ -244,9 +244,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -303,6 +304,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down
9 changes: 8 additions & 1 deletion examples/document-field/schema.graphql
Expand Up @@ -268,9 +268,10 @@ type KeystoneAdminUIListMeta {
pageSize: Int!
labelField: String!
fields: [KeystoneAdminUIFieldMeta!]!
groups: [KeystoneAdminUIFieldGroupMeta!]!
initialSort: KeystoneAdminUISort
isHidden: Boolean!
isSingleton: Boolean
isSingleton: Boolean!
}

type KeystoneAdminUIFieldMeta {
Expand Down Expand Up @@ -327,6 +328,12 @@ enum QueryMode {
insensitive
}

type KeystoneAdminUIFieldGroupMeta {
label: String!
description: String
fields: [KeystoneAdminUIFieldMeta!]!
}

type KeystoneAdminUISort {
field: String!
direction: KeystoneAdminUISortDirection!
Expand Down

1 comment on commit c1a69e2

@vercel
Copy link

@vercel vercel bot commented on c1a69e2 Nov 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.