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:
Alessio Gravili
2024-05-09 17:12:01 -04:00
committed by GitHub
parent 821bed0ea6
commit cfeac79b99
59 changed files with 296 additions and 284 deletions

View File

@@ -78,16 +78,18 @@ const CollapsibleFields: CollectionConfig = {
],
},
{
label: () =>
getCustomLabel({
path: 'functionTitleField',
fallback: 'Custom Collapsible Label',
style: {},
}),
type: 'collapsible',
admin: {
description: 'Collapsible label rendered from a function.',
initCollapsed: true,
components: {
RowLabel: () =>
getCustomLabel({
path: 'functionTitleField',
fallback: 'Custom Collapsible Label',
style: {},
}),
},
},
fields: [
{
@@ -97,10 +99,12 @@ const CollapsibleFields: CollectionConfig = {
],
},
{
label: () => getCustomLabel({ path: 'componentTitleField', style: {} }),
type: 'collapsible',
admin: {
description: 'Collapsible label rendered as a react component.',
components: {
RowLabel: () => getCustomLabel({ path: 'componentTitleField', style: {} }),
},
},
fields: [
{
@@ -109,8 +113,12 @@ const CollapsibleFields: CollectionConfig = {
},
{
type: 'collapsible',
label: () =>
getCustomLabel({ path: 'nestedTitle', fallback: 'Nested Collapsible', style: {} }),
admin: {
components: {
RowLabel: () =>
getCustomLabel({ path: 'nestedTitle', fallback: 'Nested Collapsible', style: {} }),
},
},
fields: [
{
type: 'text',
@@ -125,7 +133,11 @@ const CollapsibleFields: CollectionConfig = {
type: 'array',
fields: [
{
label: NestedCustomLabel,
admin: {
components: {
RowLabel: NestedCustomLabel,
},
},
type: 'collapsible',
fields: [
{