feat: adds collapsible field type

This commit is contained in:
James
2022-07-13 14:45:10 -07:00
parent 8589fdefda
commit 98676bea69
23 changed files with 421 additions and 44 deletions

View File

@@ -1,9 +1,74 @@
import { buildConfig } from '../buildConfig';
import { devUser } from '../../credentials';
import { textDoc } from './shared';
import { arrayDoc, blocksDoc, collapsibleDoc, textDoc } from './shared';
export default buildConfig({
collections: [
{
slug: 'array-fields',
fields: [
{
name: 'array',
type: 'array',
required: true,
fields: [
{
name: 'text',
type: 'text',
required: true,
},
],
},
],
},
{
slug: 'block-fields',
fields: [
{
name: 'blocks',
type: 'blocks',
required: true,
blocks: [
{
slug: 'text',
fields: [
{
name: 'text',
type: 'text',
required: true,
},
],
},
{
slug: 'number',
fields: [
{
name: 'number',
type: 'number',
required: true,
},
],
},
],
},
],
},
{
slug: 'collapsible-fields',
fields: [
{
label: 'Collapsible Field',
type: 'collapsible',
fields: [
{
name: 'text',
type: 'text',
required: true,
},
],
},
],
},
{
slug: 'text-fields',
admin: {
@@ -27,6 +92,21 @@ export default buildConfig({
},
});
await payload.create({
collection: 'array-fields',
data: arrayDoc,
});
await payload.create({
collection: 'block-fields',
data: blocksDoc,
});
await payload.create({
collection: 'collapsible-fields',
data: collapsibleDoc,
});
await payload.create({
collection: 'text-fields',
data: textDoc,

View File

@@ -1,3 +1,45 @@
export const arrayDoc = {
array: [
{
text: 'first row',
},
{
text: 'second row',
},
{
text: 'third row',
},
{
text: 'fourth row',
},
{
text: 'fifth row',
},
{
text: 'sixth row',
},
],
};
export const blocksDoc = {
blocks: [
{
blockName: 'First block',
blockType: 'text',
text: 'first block',
},
{
blockName: 'Second block',
blockType: 'number',
number: 342,
},
],
};
export const textDoc = {
text: 'Seeded text document',
};
export const collapsibleDoc = {
text: 'Seeded collapsible doc',
};