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:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 ||
|
||||
|
||||
Reference in New Issue
Block a user