Files
payload/test/bulk-edit/collections/Posts/index.ts
Jacob Fletcher 7532c4ab66 fix(ui): exclude fields lacking permissions from bulk edit (#11776)
Top-level fields that lack read or update permissions still appear as
options in the field selector within the bulk edit drawer.
2025-03-21 14:44:49 -04:00

115 lines
2.0 KiB
TypeScript

import type { CollectionConfig } from 'payload'
import { postsSlug } from '../../shared.js'
export const PostsCollection: CollectionConfig = {
slug: postsSlug,
versions: {
drafts: true,
},
admin: {
useAsTitle: 'title',
defaultColumns: ['id', 'title', 'description', '_status'],
pagination: {
defaultLimit: 5,
limits: [5, 10, 15],
},
},
fields: [
{
name: 'title',
type: 'text',
},
{
name: 'description',
type: 'textarea',
},
{
name: 'defaultValueField',
type: 'text',
defaultValue: 'This is a default value',
},
{
name: 'group',
type: 'group',
fields: [
{
name: 'defaultValueField',
type: 'text',
defaultValue: 'This is a default value',
},
{
name: 'title',
type: 'text',
},
],
},
{
name: 'array',
type: 'array',
admin: {
initCollapsed: true,
},
fields: [
{
name: 'optional',
type: 'text',
},
{
name: 'innerArrayOfFields',
type: 'array',
fields: [
{
name: 'innerOptional',
type: 'text',
},
],
},
{
name: 'noRead',
type: 'text',
access: {
read: () => false,
},
},
{
name: 'noUpdate',
type: 'text',
access: {
update: () => false,
},
},
],
},
{
name: 'blocks',
type: 'blocks',
blocks: [
{
slug: 'textBlock',
fields: [
{
name: 'textFieldForBlock',
type: 'text',
},
],
},
],
},
{
name: 'noRead',
type: 'text',
access: {
read: () => false,
},
},
{
name: 'noUpdate',
type: 'text',
access: {
update: () => false,
},
},
],
}