feat!: fix non-functional custom RSC component handling, separate label and description props, fix non-functional label function handling (#6264)
Breaking Changes: - Globals config: `admin.description` no longer accepts a custom component. You will have to move it to `admin.components.elements.Description` - Collections config: `admin.description` no longer accepts a custom component. You will have to move it to `admin.components.edit.Description` - All Fields: `field.admin.description` no longer accepts a custom component. You will have to move it to `field.admin.components.Description` - Collapsible Field: `field.label` no longer accepts a custom component. You will have to move it to `field.admin.components.RowLabel` - Array Field: `field.admin.components.RowLabel` no longer accepts strings or records - If you are using our exported field components in your own app, their `labelProps` property has been stripped down and no longer contains the `label` and `required` prop. Those can now only be configured at the top-level
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
'use client'
|
||||
import type { FieldPermissions } from 'payload/auth'
|
||||
import type { FieldBase } from 'payload/types'
|
||||
import type { ArrayField as ArrayFieldType } from 'payload/types'
|
||||
|
||||
import { getTranslation } from '@payloadcms/translations'
|
||||
@@ -38,7 +37,6 @@ export type ArrayFieldProps = FormFieldBase & {
|
||||
fieldMap: FieldMap
|
||||
forceRender?: boolean
|
||||
isSortable?: boolean
|
||||
label?: FieldBase['label']
|
||||
labels?: ArrayFieldType['labels']
|
||||
maxRows?: ArrayFieldType['maxRows']
|
||||
minRows?: ArrayFieldType['minRows']
|
||||
@@ -93,9 +91,9 @@ export const _ArrayField: React.FC<ArrayFieldProps> = (props) => {
|
||||
})()
|
||||
|
||||
// Handle labeling for Arrays, Global Arrays, and Blocks
|
||||
const getLabels = (p: ArrayFieldProps) => {
|
||||
const getLabels = (p: ArrayFieldProps): ArrayFieldType['labels'] => {
|
||||
if ('labels' in p && p?.labels) return p.labels
|
||||
if ('label' in p && p?.label) return { plural: undefined, singular: p.label }
|
||||
if ('label' in p && p?.label) return { plural: undefined, singular: p?.label }
|
||||
return { plural: t('general:rows'), singular: t('general:row') }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user