### What? This PR adds a new `admin.disableRowTypes` config to `'join'` fields which hides the `"Type"` column from the relationship table. ### Why? While the collection type column _can be_ helpful for providing information, it's not always necessary and can sometimes be redundant when the field only has a singular relationTo. Hiding it can be helpful by removing visual noise and providing editors the data directly. ### How? By threading `admin.disableRowTypes` directly to the `getTableState` function of the `RelationshipTable` component. **With row types** (via `admin.disableRowTypes: false | undefined` OR default for polymorphic):  **Without row types** (default for monomorphic): 
27 lines
557 B
TypeScript
27 lines
557 B
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
import path from 'path'
|
|
import { fileURLToPath } from 'url'
|
|
|
|
import { uploadsSlug } from '../shared.js'
|
|
const filename = fileURLToPath(import.meta.url)
|
|
const dirname = path.dirname(filename)
|
|
|
|
export const Uploads: CollectionConfig = {
|
|
slug: uploadsSlug,
|
|
fields: [
|
|
{
|
|
name: 'relatedPosts',
|
|
type: 'join',
|
|
collection: 'posts',
|
|
on: 'upload',
|
|
admin: {
|
|
disableRowTypes: false,
|
|
},
|
|
},
|
|
],
|
|
upload: {
|
|
staticDir: path.resolve(dirname, '../uploads'),
|
|
},
|
|
}
|