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

Adds fieldPosition to ui.itemView allowing fields to be moved to the sidebar #8075

Merged
merged 14 commits into from
Nov 10, 2022
5 changes: 5 additions & 0 deletions .changeset/five-owls-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-6/core': minor
---

Adds `fieldPosition` to field `ui.itemView`, for moving a field to the sidebar
4 changes: 4 additions & 0 deletions docs/pages/docs/fields/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ Options:
Can be one of `['edit', 'read', 'hidden']`, or an async function with an argument `{ session, context, item }` that returns one of `['edit', 'read', 'hidden']`.
Defaults to the list's `ui.itemView.defaultFieldMode` config if defined.
See the [Lists API](../config/lists#ui) for details.
{% if $nextRelease %}
- `itemView.fieldPosition` (default: `form`): Controls which side of the page the field is placed in the Admin UI.
Can be either `form` or `sidebar`. `form` or blank places the field on the left hand side of the item view. `sidebar` places the field on the right hand side under the ID field
{% /if %}
- `listView.fieldMode` (default: `'read'`): Controls the list view page of the Admin UI.
Can be one of `['read', 'hidden']`, or an async function with an argument `{ session, context }` that returns one of `['read', 'hidden']`.
Defaults to the list's `ui.listView.defaultFieldMode` config if defined.
Expand Down
6 changes: 6 additions & 0 deletions examples/assets-local/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -340,6 +341,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/assets-s3/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -340,6 +341,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/auth/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -224,6 +225,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/basic/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -494,6 +495,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
5 changes: 4 additions & 1 deletion examples/basic/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ const User: Lists.User = list({
/** The user's first and last name. */
name: text({ validation: { isRequired: true } }),
/** Email is used to log into the system. */
email: text({ isIndexed: 'unique', validation: { isRequired: true } }),
email: text({
isIndexed: 'unique',
validation: { isRequired: true },
}),
/** Avatar upload for the users profile, stored locally */
avatar: image({ storage: 'my_images' }),
attachment: file({ storage: 'my_files' }),
Expand Down
6 changes: 6 additions & 0 deletions examples/blog/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -301,6 +302,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/custom-admin-ui-logo/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -301,6 +302,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/custom-admin-ui-navigation/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -301,6 +302,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/custom-admin-ui-pages/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -301,6 +302,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/custom-field-view/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -304,6 +305,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/custom-field/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -156,6 +157,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/custom-session-validation/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -342,6 +343,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/default-values/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -319,6 +320,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -292,6 +293,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/document-field/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -316,6 +317,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/e2e-boilerplate/keystone-server/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -292,6 +293,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/ecommerce/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -907,6 +908,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/embedded-nextjs/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -183,6 +184,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
6 changes: 6 additions & 0 deletions examples/extend-graphql-schema-graphql-tools/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ enum KeystoneAdminUIFieldMetaListViewFieldMode {

type KeystoneAdminUIFieldMetaItemView {
fieldMode: KeystoneAdminUIFieldMetaItemViewFieldMode
fieldPosition: KeystoneAdminUIFieldMetaItemViewFieldPosition
}

enum KeystoneAdminUIFieldMetaItemViewFieldMode {
Expand All @@ -313,6 +314,11 @@ enum KeystoneAdminUIFieldMetaItemViewFieldMode {
hidden
}

enum KeystoneAdminUIFieldMetaItemViewFieldPosition {
form
sidebar
}

enum QueryMode {
default
insensitive
Expand Down
Loading