test: convert PrePopulateFieldUI to client component (#5456)
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
'use client'
|
||||||
import { useField } from '@payloadcms/ui/forms/useField'
|
import { useField } from '@payloadcms/ui/forms/useField'
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { CollectionConfig } from 'payload/types'
|
import type { CollectionConfig } from 'payload/types'
|
||||||
import type { FilterOptionsProps } from 'payload/types'
|
import type { FilterOptionsProps } from 'payload/types'
|
||||||
|
|
||||||
|
import { withMergedProps } from '@payloadcms/ui/elements/withMergedProps'
|
||||||
import { mapAsync } from 'payload/utilities'
|
import { mapAsync } from 'payload/utilities'
|
||||||
|
|
||||||
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
||||||
@@ -229,7 +230,13 @@ export default buildConfigWithDefaults({
|
|||||||
name: 'prePopulate',
|
name: 'prePopulate',
|
||||||
admin: {
|
admin: {
|
||||||
components: {
|
components: {
|
||||||
Field: () => PrePopulateFieldUI({ hasMany: false, path: 'relationPrePopulate' }),
|
Field: withMergedProps({
|
||||||
|
Component: PrePopulateFieldUI,
|
||||||
|
toMergeIntoProps: {
|
||||||
|
hasMultipleRelations: false,
|
||||||
|
path: 'relationPrePopulate',
|
||||||
|
},
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
width: '25%',
|
width: '25%',
|
||||||
},
|
},
|
||||||
@@ -253,8 +260,13 @@ export default buildConfigWithDefaults({
|
|||||||
name: 'prePopulateRelationHasMany',
|
name: 'prePopulateRelationHasMany',
|
||||||
admin: {
|
admin: {
|
||||||
components: {
|
components: {
|
||||||
Field: () =>
|
Field: withMergedProps({
|
||||||
PrePopulateFieldUI({ hasMultipleRelations: false, path: 'relationHasMany' }),
|
Component: PrePopulateFieldUI,
|
||||||
|
toMergeIntoProps: {
|
||||||
|
hasMultipleRelations: false,
|
||||||
|
path: 'relationHasMany',
|
||||||
|
},
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
width: '25%',
|
width: '25%',
|
||||||
},
|
},
|
||||||
@@ -278,10 +290,12 @@ export default buildConfigWithDefaults({
|
|||||||
name: 'prePopulateToMany',
|
name: 'prePopulateToMany',
|
||||||
admin: {
|
admin: {
|
||||||
components: {
|
components: {
|
||||||
Field: () =>
|
Field: withMergedProps({
|
||||||
PrePopulateFieldUI({
|
Component: PrePopulateFieldUI,
|
||||||
|
toMergeIntoProps: {
|
||||||
hasMultipleRelations: true,
|
hasMultipleRelations: true,
|
||||||
path: 'relationToManyHasMany',
|
path: 'relationToManyHasMany',
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
width: '25%',
|
width: '25%',
|
||||||
|
|||||||
Reference in New Issue
Block a user