feat(ui): add support for disabling join field row types (#12738)
### 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): 
This commit is contained in:
@@ -1628,6 +1628,7 @@ export type JoinField = {
|
||||
} & Admin['components']
|
||||
defaultColumns?: string[]
|
||||
disableBulkEdit?: never
|
||||
disableRowTypes?: boolean
|
||||
readOnly?: never
|
||||
} & Admin
|
||||
/**
|
||||
@@ -1679,8 +1680,11 @@ export type JoinField = {
|
||||
|
||||
export type JoinFieldClient = {
|
||||
admin?: AdminClient &
|
||||
// @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
|
||||
Pick<JoinField['admin'], 'allowCreate' | 'defaultColumns' | 'disableBulkEdit' | 'readOnly'>
|
||||
Pick<
|
||||
JoinField['admin'],
|
||||
// @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve
|
||||
'allowCreate' | 'defaultColumns' | 'disableBulkEdit' | 'disableRowTypes' | 'readOnly'
|
||||
>
|
||||
} & { targetField: Pick<RelationshipFieldClient, 'relationTo'> } & FieldBaseClient &
|
||||
Pick<
|
||||
JoinField,
|
||||
|
||||
Reference in New Issue
Block a user