* feat(richtext-lexical): 'bottom' position value for plugins * feat: TestRecorderFeature * chore: restructuring to seed and clear db before each test * chore: make sure all tests pass * chore: make sure indexes are created in seed.ts - this fixes one erroring test * chore: speed up test runs through db snapshots * chore: support drizzle when resetting db * chore: simplify seeding process, by moving boilerplate db reset / snapshot logic into a wrapper function * chore: add new seeding process to admin test suite * chore(deps): upgrade jest and playwright * chore: make sure mongoose-specific tests are not skipped * chore: fix point test, which was depending on another test (that's bad!) * chore: fix incorrect import * chore: remove unnecessary comments * chore: clearly label lexicalE2E test file as todo * chore: simplify seed logic * chore: move versions test suite to new seed system
160 lines
2.8 KiB
TypeScript
160 lines
2.8 KiB
TypeScript
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
|
|
|
import { arrayFieldsSlug } from '../../slugs'
|
|
import { ArrayRowLabel } from './LabelComponent'
|
|
|
|
export const arrayDefaultValue = [{ text: 'row one' }, { text: 'row two' }]
|
|
|
|
const ArrayFields: CollectionConfig = {
|
|
slug: arrayFieldsSlug,
|
|
admin: {
|
|
enableRichTextLink: false,
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'items',
|
|
type: 'array',
|
|
required: true,
|
|
defaultValue: arrayDefaultValue,
|
|
fields: [
|
|
{
|
|
name: 'text',
|
|
type: 'text',
|
|
required: true,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'collapsedArray',
|
|
type: 'array',
|
|
fields: [
|
|
{
|
|
name: 'text',
|
|
type: 'text',
|
|
required: true,
|
|
},
|
|
],
|
|
admin: {
|
|
initCollapsed: true,
|
|
},
|
|
},
|
|
{
|
|
name: 'localized',
|
|
type: 'array',
|
|
required: true,
|
|
localized: true,
|
|
defaultValue: arrayDefaultValue,
|
|
fields: [
|
|
{
|
|
name: 'text',
|
|
type: 'text',
|
|
required: true,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
type: 'array',
|
|
name: 'readOnly',
|
|
admin: {
|
|
readOnly: true,
|
|
},
|
|
defaultValue: [
|
|
{
|
|
text: 'defaultValue',
|
|
},
|
|
{
|
|
text: 'defaultValue2',
|
|
},
|
|
],
|
|
fields: [
|
|
{
|
|
type: 'text',
|
|
name: 'text',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
type: 'array',
|
|
name: 'potentiallyEmptyArray',
|
|
fields: [
|
|
{
|
|
type: 'text',
|
|
name: 'text',
|
|
},
|
|
{
|
|
type: 'group',
|
|
name: 'groupInRow',
|
|
fields: [
|
|
{
|
|
type: 'text',
|
|
name: 'textInGroupInRow',
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
type: 'array',
|
|
name: 'rowLabelAsFunction',
|
|
fields: [
|
|
{
|
|
name: 'title',
|
|
type: 'text',
|
|
},
|
|
],
|
|
admin: {
|
|
description: 'Row labels rendered from a function.',
|
|
components: {
|
|
RowLabel: ({ data }) => data.title,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
type: 'array',
|
|
name: 'rowLabelAsComponent',
|
|
fields: [
|
|
{
|
|
name: 'title',
|
|
type: 'text',
|
|
},
|
|
],
|
|
admin: {
|
|
description: 'Row labels rendered as react components.',
|
|
components: {
|
|
RowLabel: ArrayRowLabel,
|
|
},
|
|
},
|
|
},
|
|
],
|
|
}
|
|
|
|
export const arrayDoc = {
|
|
items: [
|
|
{
|
|
text: 'first row',
|
|
},
|
|
{
|
|
text: 'second row',
|
|
},
|
|
{
|
|
text: 'third row',
|
|
},
|
|
{
|
|
text: 'fourth row',
|
|
},
|
|
{
|
|
text: 'fifth row',
|
|
},
|
|
{
|
|
text: 'sixth row',
|
|
},
|
|
],
|
|
collapsedArray: [
|
|
{
|
|
text: 'initialize collapsed',
|
|
},
|
|
],
|
|
}
|
|
|
|
export default ArrayFields
|