fix(ui): disableBulkEdit on ui fields, defaults to true (#8540)

Fixes https://github.com/payloadcms/payload/issues/8534

UI fields are now excluded by default from the bulk edit view fields
options.
If you need to have the UI field there, you can provide:
```ts
admin: {
  disableBulkEdit: false
}
```
This commit is contained in:
Sasha
2024-10-04 04:07:47 +03:00
committed by GitHub
parent 157b1e13ac
commit cf8347f208
5 changed files with 26 additions and 18 deletions

View File

@@ -289,6 +289,10 @@ export const sanitizeFields = async ({
}
}
if (field.type === 'ui' && typeof field.admin.disableBulkEdit === 'undefined') {
field.admin.disableBulkEdit = true
}
if ('_sanitized' in field) {
field._sanitized = true
}

View File

@@ -832,6 +832,10 @@ export type UIField = {
condition?: Condition
/** Extension point to add your custom data. Available in server and client. */
custom?: Record<string, any>
/**
* Set `false` make the UI field appear in the list view column selector. `true` by default for UI fields.
* @default true
*/
disableBulkEdit?: boolean
/**
* Shows / hides fields from appearing in the list view column selector.

View File

@@ -90,9 +90,9 @@ const reduceFields = ({
}
return fields?.reduce((fieldsToUse, field) => {
// escape for a variety of reasons
// escape for a variety of reasons, include ui fields as they have `name`.
if (
fieldAffectsData(field) &&
(fieldAffectsData(field) || field.type === 'ui') &&
(field.admin.disableBulkEdit ||
field.unique ||
field.admin.hidden ||