chore: merge from 2.0
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import React from 'react';
|
||||
import { RowLabelComponent } from '../../../../src/admin/components/forms/RowLabel/types';
|
||||
import React from 'react'
|
||||
|
||||
import type { RowLabelComponent } from '../../../../packages/payload/src/admin/components/forms/RowLabel/types'
|
||||
|
||||
export const ArrayRowLabel: RowLabelComponent = ({ data }) => {
|
||||
return <div style={{ textTransform: 'uppercase', color: 'coral' }}>{data.title || 'Untitled'}</div>;
|
||||
};
|
||||
return (
|
||||
<div style={{ color: 'coral', textTransform: 'uppercase' }}>{data.title || 'Untitled'}</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -41,4 +41,3 @@
|
||||
background: var(--theme-text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +1,44 @@
|
||||
import * as React from 'react';
|
||||
import { useForm } from '../../../../../../src/admin/components/forms/Form/context';
|
||||
import useField from '../../../../../../src/admin/components/forms/useField';
|
||||
import * as React from 'react'
|
||||
|
||||
import './index.scss';
|
||||
import { useForm } from '../../../../../../packages/payload/src/admin/components/forms/Form/context'
|
||||
import useField from '../../../../../../packages/payload/src/admin/components/forms/useField'
|
||||
import './index.scss'
|
||||
|
||||
const baseClass = 'custom-blocks-field-management';
|
||||
const baseClass = 'custom-blocks-field-management'
|
||||
|
||||
export const AddCustomBlocks: React.FC = () => {
|
||||
const { addFieldRow, replaceFieldRow } = useForm();
|
||||
const { value } = useField({ path: 'customBlocks' });
|
||||
const { addFieldRow, replaceFieldRow } = useForm()
|
||||
const { value } = useField({ path: 'customBlocks' })
|
||||
|
||||
const nextIndex = typeof value === 'number' ? value + 1 : 0;
|
||||
const nextIndex = typeof value === 'number' ? value + 1 : 0
|
||||
|
||||
return (
|
||||
<div className={baseClass}>
|
||||
<div className={`${baseClass}__blocks-grid`}>
|
||||
<button
|
||||
className={`${baseClass}__block-button`}
|
||||
onClick={() =>
|
||||
addFieldRow({
|
||||
data: { block1Title: 'Block 1: Prefilled Title', blockType: 'block-1' },
|
||||
path: 'customBlocks',
|
||||
rowIndex: nextIndex,
|
||||
})
|
||||
}
|
||||
type="button"
|
||||
onClick={() => addFieldRow({ path: 'customBlocks', data: { block1Title: 'Block 1: Prefilled Title', blockType: 'block-1' }, rowIndex: nextIndex })}
|
||||
>
|
||||
Add Block 1
|
||||
</button>
|
||||
|
||||
<button
|
||||
className={`${baseClass}__block-button`}
|
||||
onClick={() =>
|
||||
addFieldRow({
|
||||
data: { block2Title: 'Block 2: Prefilled Title', blockType: 'block-2' },
|
||||
path: 'customBlocks',
|
||||
rowIndex: nextIndex,
|
||||
})
|
||||
}
|
||||
type="button"
|
||||
onClick={() => addFieldRow({ path: 'customBlocks', data: { block2Title: 'Block 2: Prefilled Title', blockType: 'block-2' }, rowIndex: nextIndex })}
|
||||
>
|
||||
Add Block 2
|
||||
</button>
|
||||
@@ -35,14 +47,18 @@ export const AddCustomBlocks: React.FC = () => {
|
||||
<div>
|
||||
<button
|
||||
className={`${baseClass}__block-button ${baseClass}__replace-block-button`}
|
||||
onClick={() =>
|
||||
replaceFieldRow({
|
||||
data: { block1Title: 'REPLACED BLOCK', blockType: 'block-1' },
|
||||
path: 'customBlocks',
|
||||
rowIndex: nextIndex - 1,
|
||||
})
|
||||
}
|
||||
type="button"
|
||||
onClick={() => replaceFieldRow({ path: 'customBlocks', data: { block1Title: 'REPLACED BLOCK', blockType: 'block-1' }, rowIndex: nextIndex - 1 })}
|
||||
>
|
||||
Replace Block
|
||||
{' '}
|
||||
{nextIndex - 1}
|
||||
Replace Block {nextIndex - 1}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import { ArrayRowLabel } from './LabelComponent';
|
||||
import { AddCustomBlocks } from './components/AddCustomBlocks';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
export const arrayDefaultValue = [
|
||||
{ text: 'row one' },
|
||||
{ text: 'row two' },
|
||||
];
|
||||
import { ArrayRowLabel } from './LabelComponent'
|
||||
import { AddCustomBlocks } from './components/AddCustomBlocks'
|
||||
|
||||
export const arrayFieldsSlug = 'array-fields';
|
||||
export const arrayDefaultValue = [{ text: 'row one' }, { text: 'row two' }]
|
||||
|
||||
export const arrayFieldsSlug = 'array-fields'
|
||||
|
||||
const ArrayFields: CollectionConfig = {
|
||||
slug: arrayFieldsSlug,
|
||||
@@ -153,7 +151,7 @@ const ArrayFields: CollectionConfig = {
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const arrayDoc = {
|
||||
items: [
|
||||
@@ -181,6 +179,6 @@ export const arrayDoc = {
|
||||
text: 'initialize collapsed',
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export default ArrayFields;
|
||||
export default ArrayFields
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import { Field } from '../../../../src/fields/config/types';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
import type { Field } from '../../../../packages/payload/src/fields/config/types'
|
||||
|
||||
export const blocksFieldSeedData = [
|
||||
{
|
||||
blockName: 'First block',
|
||||
blockType: 'text',
|
||||
text: 'first block',
|
||||
richText: [{
|
||||
children: [{ text: '' }],
|
||||
}],
|
||||
richText: [
|
||||
{
|
||||
children: [{ text: '' }],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
blockName: 'Second block',
|
||||
@@ -36,7 +38,7 @@ export const blocksFieldSeedData = [
|
||||
blockType: 'i18n-text',
|
||||
text: 'first block',
|
||||
},
|
||||
] as const;
|
||||
] as const
|
||||
|
||||
export const blocksField: Field = {
|
||||
name: 'blocks',
|
||||
@@ -142,7 +144,7 @@ export const blocksField: Field = {
|
||||
},
|
||||
],
|
||||
defaultValue: blocksFieldSeedData,
|
||||
};
|
||||
}
|
||||
|
||||
const BlockFields: CollectionConfig = {
|
||||
slug: 'block-fields',
|
||||
@@ -206,45 +208,47 @@ const BlockFields: CollectionConfig = {
|
||||
{
|
||||
type: 'blocks',
|
||||
name: 'blocksWithSimilarConfigs',
|
||||
blocks: [{
|
||||
slug: 'block-1',
|
||||
fields: [
|
||||
{
|
||||
type: 'array',
|
||||
name: 'items',
|
||||
fields: [
|
||||
{
|
||||
type: 'text',
|
||||
name: 'title',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
slug: 'block-2',
|
||||
fields: [
|
||||
{
|
||||
type: 'array',
|
||||
name: 'items',
|
||||
fields: [
|
||||
{
|
||||
type: 'text',
|
||||
name: 'title2',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}],
|
||||
blocks: [
|
||||
{
|
||||
slug: 'block-1',
|
||||
fields: [
|
||||
{
|
||||
type: 'array',
|
||||
name: 'items',
|
||||
fields: [
|
||||
{
|
||||
type: 'text',
|
||||
name: 'title',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
slug: 'block-2',
|
||||
fields: [
|
||||
{
|
||||
type: 'array',
|
||||
name: 'items',
|
||||
fields: [
|
||||
{
|
||||
type: 'text',
|
||||
name: 'title2',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const blocksDoc = {
|
||||
blocks: blocksFieldSeedData,
|
||||
localizedBlocks: blocksFieldSeedData,
|
||||
};
|
||||
}
|
||||
|
||||
export default BlockFields;
|
||||
export default BlockFields
|
||||
|
||||
@@ -1,83 +1,48 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import { CodeField } from '../../payload-types';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
import type { CodeField } from '../../payload-types'
|
||||
|
||||
const Code: CollectionConfig = {
|
||||
slug: 'code-fields',
|
||||
fields: [
|
||||
{
|
||||
name: 'javascript',
|
||||
type: 'code',
|
||||
admin: {
|
||||
language: 'javascript',
|
||||
},
|
||||
name: 'javascript',
|
||||
type: 'code',
|
||||
},
|
||||
{
|
||||
name: 'typescript',
|
||||
type: 'code',
|
||||
admin: {
|
||||
language: 'typescript',
|
||||
},
|
||||
name: 'typescript',
|
||||
type: 'code',
|
||||
},
|
||||
{
|
||||
name: 'json',
|
||||
type: 'code',
|
||||
admin: {
|
||||
language: 'json',
|
||||
},
|
||||
name: 'json',
|
||||
type: 'code',
|
||||
},
|
||||
{
|
||||
name: 'html',
|
||||
type: 'code',
|
||||
admin: {
|
||||
language: 'html',
|
||||
},
|
||||
name: 'html',
|
||||
type: 'code',
|
||||
},
|
||||
{
|
||||
name: 'css',
|
||||
type: 'code',
|
||||
admin: {
|
||||
language: 'css',
|
||||
},
|
||||
name: 'css',
|
||||
type: 'code',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export const codeDoc: Partial<CodeField> = {
|
||||
javascript: "console.log('Hello');",
|
||||
typescript: `class Greeter {
|
||||
greeting: string;
|
||||
|
||||
constructor(message: string) {
|
||||
this.greeting = message;
|
||||
}
|
||||
|
||||
greet() {
|
||||
return "Hello, " + this.greeting;
|
||||
}
|
||||
slug: 'code-fields',
|
||||
}
|
||||
|
||||
let greeter = new Greeter("world");`,
|
||||
|
||||
html: `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<script>
|
||||
// Just a lil’ script to show off that inline JS gets highlighted
|
||||
window.console && console.log('foo');
|
||||
</script>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="assets/favicon.png" />
|
||||
<title>Prism</title>
|
||||
<link rel="stylesheet" href="assets/style.css" />
|
||||
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
|
||||
<script src="assets/vendor/prefixfree.min.js"></script>
|
||||
|
||||
<script>var _gaq = [['_setAccount', 'UA-11111111-1'], ['_trackPageview']];</script>
|
||||
<script src="https://www.google-analytics.com/ga.js" async></script>
|
||||
</head>
|
||||
<body>`,
|
||||
|
||||
export const codeDoc: Partial<CodeField> = {
|
||||
css: `@import url(https://fonts.googleapis.com/css?family=Questrial);
|
||||
@import url(https://fonts.googleapis.com/css?family=Arvo);
|
||||
|
||||
@@ -119,8 +84,43 @@ a {
|
||||
section h1 {
|
||||
font-size: 250%;
|
||||
}`,
|
||||
html: `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
json: JSON.stringify({ property: 'value', arr: ['val1', 'val2', 'val3'] }, null, 2),
|
||||
};
|
||||
<script>
|
||||
// Just a lil’ script to show off that inline JS gets highlighted
|
||||
window.console && console.log('foo');
|
||||
</script>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="assets/favicon.png" />
|
||||
<title>Prism</title>
|
||||
<link rel="stylesheet" href="assets/style.css" />
|
||||
<link rel="stylesheet" href="themes/prism.css" data-noprefix />
|
||||
<script src="assets/vendor/prefixfree.min.js"></script>
|
||||
|
||||
export default Code;
|
||||
<script>var _gaq = [['_setAccount', 'UA-11111111-1'], ['_trackPageview']];</script>
|
||||
<script src="https://www.google-analytics.com/ga.js" async></script>
|
||||
</head>
|
||||
<body>`,
|
||||
|
||||
javascript: "console.log('Hello');",
|
||||
|
||||
json: JSON.stringify({ arr: ['val1', 'val2', 'val3'], property: 'value' }, null, 2),
|
||||
|
||||
typescript: `class Greeter {
|
||||
greeting: string;
|
||||
|
||||
constructor(message: string) {
|
||||
this.greeting = message;
|
||||
}
|
||||
|
||||
greet() {
|
||||
return "Hello, " + this.greeting;
|
||||
}
|
||||
}
|
||||
|
||||
let greeter = new Greeter("world");`,
|
||||
}
|
||||
|
||||
export default Code
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import React from 'react';
|
||||
import { RowLabelComponent } from '../../../../src/admin/components/forms/RowLabel/types';
|
||||
import React from 'react'
|
||||
|
||||
import type { RowLabelComponent } from '../../../../packages/payload/src/admin/components/forms/RowLabel/types'
|
||||
|
||||
export const CollapsibleLabelComponent: RowLabelComponent = ({ data }) => {
|
||||
return <div style={{ textTransform: 'uppercase', color: 'hotpink' }}>{data.innerCollapsible || 'Untitled'}</div>;
|
||||
};
|
||||
return (
|
||||
<div style={{ color: 'hotpink', textTransform: 'uppercase' }}>
|
||||
{data.innerCollapsible || 'Untitled'}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import { CollapsibleLabelComponent } from './LabelComponent';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
export const collapsibleFieldsSlug = 'collapsible-fields';
|
||||
import { CollapsibleLabelComponent } from './LabelComponent'
|
||||
|
||||
export const collapsibleFieldsSlug = 'collapsible-fields'
|
||||
|
||||
const CollapsibleFields: CollectionConfig = {
|
||||
slug: collapsibleFieldsSlug,
|
||||
@@ -131,7 +132,7 @@ const CollapsibleFields: CollectionConfig = {
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const collapsibleDoc = {
|
||||
text: 'Seeded collapsible doc',
|
||||
@@ -146,6 +147,6 @@ export const collapsibleDoc = {
|
||||
innerCollapsible: '',
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export default CollapsibleFields;
|
||||
export default CollapsibleFields
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
const ConditionalLogic: CollectionConfig = {
|
||||
slug: 'conditional-logic',
|
||||
@@ -28,7 +28,7 @@ const ConditionalLogic: CollectionConfig = {
|
||||
type: 'text',
|
||||
admin: {
|
||||
condition: (_data, _siblingData, { user }) => {
|
||||
return Boolean(user?.canViewConditionalField);
|
||||
return Boolean(user?.canViewConditionalField)
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -62,10 +62,7 @@ const ConditionalLogic: CollectionConfig = {
|
||||
{
|
||||
name: 'groupSelection',
|
||||
type: 'select',
|
||||
options: [
|
||||
'group1',
|
||||
'group2',
|
||||
],
|
||||
options: ['group1', 'group2'],
|
||||
},
|
||||
{
|
||||
name: 'group1',
|
||||
@@ -94,12 +91,12 @@ const ConditionalLogic: CollectionConfig = {
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const conditionalLogicDoc = {
|
||||
text: 'Seeded conditional logic document',
|
||||
toggleField: true,
|
||||
fieldToToggle: 'spiderman',
|
||||
};
|
||||
}
|
||||
|
||||
export default ConditionalLogic;
|
||||
export default ConditionalLogic
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
export const defaultText = 'default-text';
|
||||
export const defaultText = 'default-text'
|
||||
|
||||
const DateFields: CollectionConfig = {
|
||||
slug: 'date-fields',
|
||||
@@ -60,7 +60,7 @@ const DateFields: CollectionConfig = {
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const dateDoc = {
|
||||
default: '2022-08-12T10:00:00.000+00:00',
|
||||
@@ -69,6 +69,6 @@ export const dateDoc = {
|
||||
dayOnly: '2022-08-11T22:00:00.000+00:00',
|
||||
dayAndTime: '2022-08-12T10:00:00.052+00:00',
|
||||
monthOnly: '2022-07-31T22:00:00.000+00:00',
|
||||
};
|
||||
}
|
||||
|
||||
export default DateFields;
|
||||
export default DateFields
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
export const groupDefaultValue = 'set from parent';
|
||||
export const groupDefaultChild = 'child takes priority';
|
||||
export const groupFieldsSlug = 'group-fields';
|
||||
export const groupDefaultValue = 'set from parent'
|
||||
export const groupDefaultChild = 'child takes priority'
|
||||
export const groupFieldsSlug = 'group-fields'
|
||||
|
||||
const GroupFields: CollectionConfig = {
|
||||
slug: groupFieldsSlug,
|
||||
@@ -166,18 +166,20 @@ const GroupFields: CollectionConfig = {
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const groupDoc = {
|
||||
group: {
|
||||
text: 'some text within a group',
|
||||
subGroup: {
|
||||
textWithinGroup: 'please',
|
||||
arrayWithinGroup: [{
|
||||
textWithinArray: 'text in a group and array',
|
||||
}],
|
||||
arrayWithinGroup: [
|
||||
{
|
||||
textWithinArray: 'text in a group and array',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default GroupFields;
|
||||
export default GroupFields
|
||||
|
||||
@@ -1,20 +1,25 @@
|
||||
import type { BeforeDuplicate, CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import { IndexedField } from '../../payload-types';
|
||||
import type {
|
||||
BeforeDuplicate,
|
||||
CollectionConfig,
|
||||
} from '../../../../packages/payload/src/collections/config/types'
|
||||
import type { IndexedField } from '../../payload-types'
|
||||
|
||||
const beforeDuplicate: BeforeDuplicate<IndexedField> = ({ data }) => {
|
||||
return {
|
||||
...data,
|
||||
uniqueText: data.uniqueText ? `${data.uniqueText}-copy` : '',
|
||||
group: {
|
||||
...data.group || {},
|
||||
...(data.group || {}),
|
||||
localizedUnique: data.group?.localizedUnique ? `${data.group?.localizedUnique}-copy` : '',
|
||||
},
|
||||
collapsibleTextUnique: data.collapsibleTextUnique ? `${data.collapsibleTextUnique}-copy` : '',
|
||||
collapsibleLocalizedUnique: data.collapsibleLocalizedUnique ? `${data.collapsibleLocalizedUnique}-copy` : '',
|
||||
collapsibleLocalizedUnique: data.collapsibleLocalizedUnique
|
||||
? `${data.collapsibleLocalizedUnique}-copy`
|
||||
: '',
|
||||
partOne: data.partOne ? `${data.partOne}-copy` : '',
|
||||
partTwo: data.partTwo ? `${data.partTwo}-copy` : '',
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const IndexedFields: CollectionConfig = {
|
||||
slug: 'indexed-fields',
|
||||
@@ -90,6 +95,6 @@ const IndexedFields: CollectionConfig = {
|
||||
options: { unique: true, name: 'compound-index', sparse: true },
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export default IndexedFields;
|
||||
export default IndexedFields
|
||||
|
||||
@@ -1,38 +1,33 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
type JSONField = {
|
||||
id: string;
|
||||
json?: any;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
createdAt: string
|
||||
id: string
|
||||
json?: any
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
const JSON: CollectionConfig = {
|
||||
slug: 'json-fields',
|
||||
versions: {
|
||||
maxPerDoc: 1,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'json',
|
||||
type: 'json',
|
||||
},
|
||||
],
|
||||
};
|
||||
slug: 'json-fields',
|
||||
versions: {
|
||||
maxPerDoc: 1,
|
||||
},
|
||||
}
|
||||
|
||||
export const jsonDoc: Partial<JSONField> = {
|
||||
json: {
|
||||
property: 'value',
|
||||
arr: [
|
||||
'val1',
|
||||
'val2',
|
||||
'val3',
|
||||
],
|
||||
arr: ['val1', 'val2', 'val3'],
|
||||
nested: {
|
||||
value: 'nested value',
|
||||
},
|
||||
property: 'value',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default JSON;
|
||||
export default JSON
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
export const defaultNumber = 5;
|
||||
export const defaultNumber = 5
|
||||
|
||||
const NumberFields: CollectionConfig = {
|
||||
slug: 'number-fields',
|
||||
@@ -60,9 +60,9 @@ const NumberFields: CollectionConfig = {
|
||||
hasMany: true,
|
||||
validate: (value: number[]) => {
|
||||
if (value && !Array.isArray(value)) {
|
||||
return 'value should be an array';
|
||||
return 'value should be an array'
|
||||
}
|
||||
return true;
|
||||
return true
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -72,7 +72,7 @@ const NumberFields: CollectionConfig = {
|
||||
localized: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const numberDoc = {
|
||||
number: 5,
|
||||
@@ -85,6 +85,6 @@ export const numberDoc = {
|
||||
hasMany: [5, 10, 15],
|
||||
validatesHasMany: [5],
|
||||
localizedHasMany: [10],
|
||||
};
|
||||
}
|
||||
|
||||
export default NumberFields;
|
||||
export default NumberFields
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
export const pointFieldsSlug = 'point-fields';
|
||||
export const pointFieldsSlug = 'point-fields'
|
||||
|
||||
const PointFields: CollectionConfig = {
|
||||
slug: pointFieldsSlug,
|
||||
@@ -33,12 +33,12 @@ const PointFields: CollectionConfig = {
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const pointDoc = {
|
||||
point: [7, -7],
|
||||
localized: [15, -12],
|
||||
group: { point: [1, 9] },
|
||||
};
|
||||
}
|
||||
|
||||
export default PointFields;
|
||||
export default PointFields
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
const RadioFields: CollectionConfig = {
|
||||
slug: 'radio-fields',
|
||||
@@ -6,7 +6,8 @@ const RadioFields: CollectionConfig = {
|
||||
{
|
||||
name: 'radio',
|
||||
label: {
|
||||
en: 'Radio en', es: 'Radio es',
|
||||
en: 'Radio en',
|
||||
es: 'Radio es',
|
||||
},
|
||||
type: 'radio',
|
||||
options: [
|
||||
@@ -25,10 +26,10 @@ const RadioFields: CollectionConfig = {
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const radiosDoc = {
|
||||
radio: 'one',
|
||||
};
|
||||
}
|
||||
|
||||
export default RadioFields;
|
||||
export default RadioFields
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
export const relationshipFieldsSlug = 'relationship-fields';
|
||||
export const relationshipFieldsSlug = 'relationship-fields'
|
||||
|
||||
const RelationshipFields: CollectionConfig = {
|
||||
slug: relationshipFieldsSlug,
|
||||
@@ -60,6 +60,6 @@ const RelationshipFields: CollectionConfig = {
|
||||
hasMany: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export default RelationshipFields;
|
||||
export default RelationshipFields
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import { loremIpsum } from './loremIpsum';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
import { loremIpsum } from './loremIpsum'
|
||||
|
||||
const RichTextFields: CollectionConfig = {
|
||||
slug: 'rich-text-fields',
|
||||
@@ -17,7 +18,8 @@ const RichTextFields: CollectionConfig = {
|
||||
hasMany: true,
|
||||
type: 'select',
|
||||
admin: {
|
||||
description: 'This select field is rendered here to ensure its options dropdown renders above the rich text toolbar.',
|
||||
description:
|
||||
'This select field is rendered here to ensure its options dropdown renders above the rich text toolbar.',
|
||||
},
|
||||
options: [
|
||||
{
|
||||
@@ -73,11 +75,10 @@ const RichTextFields: CollectionConfig = {
|
||||
label: 'Rel Attribute',
|
||||
type: 'select',
|
||||
hasMany: true,
|
||||
options: [
|
||||
'noopener', 'noreferrer', 'nofollow',
|
||||
],
|
||||
options: ['noopener', 'noreferrer', 'nofollow'],
|
||||
admin: {
|
||||
description: 'The rel attribute defines the relationship between a linked resource and the current document. This is a custom link field.',
|
||||
description:
|
||||
'The rel attribute defines the relationship between a linked resource and the current document. This is a custom link field.',
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -123,7 +124,7 @@ const RichTextFields: CollectionConfig = {
|
||||
name: 'customLinkField',
|
||||
type: 'text',
|
||||
},
|
||||
];
|
||||
]
|
||||
},
|
||||
},
|
||||
upload: {
|
||||
@@ -166,11 +167,10 @@ const RichTextFields: CollectionConfig = {
|
||||
label: 'Rel Attribute',
|
||||
type: 'select',
|
||||
hasMany: true,
|
||||
options: [
|
||||
'noopener', 'noreferrer', 'nofollow',
|
||||
],
|
||||
options: ['noopener', 'noreferrer', 'nofollow'],
|
||||
admin: {
|
||||
description: 'The rel attribute defines the relationship between a linked resource and the current document. This is a custom link field.',
|
||||
description:
|
||||
'The rel attribute defines the relationship between a linked resource and the current document. This is a custom link field.',
|
||||
},
|
||||
},
|
||||
],
|
||||
@@ -214,7 +214,7 @@ const RichTextFields: CollectionConfig = {
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
function generateRichText() {
|
||||
return [
|
||||
@@ -339,7 +339,7 @@ function generateRichText() {
|
||||
text: loremIpsum,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
}),
|
||||
],
|
||||
},
|
||||
@@ -358,9 +358,9 @@ function generateRichText() {
|
||||
text: loremIpsum,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
}),
|
||||
];
|
||||
]
|
||||
}
|
||||
|
||||
export const richTextBulletsDoc = {
|
||||
@@ -464,7 +464,7 @@ export const richTextBulletsDoc = {
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const richTextBlocks = [
|
||||
{
|
||||
@@ -484,7 +484,7 @@ export const richTextBlocks = [
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
]
|
||||
export const richTextDoc = {
|
||||
title: 'Rich Text',
|
||||
selectHasMany: ['one', 'five'],
|
||||
@@ -492,6 +492,6 @@ export const richTextDoc = {
|
||||
richTextReadOnly: generateRichText(),
|
||||
richTextCustomFields: generateRichText(),
|
||||
blocks: richTextBlocks,
|
||||
};
|
||||
}
|
||||
|
||||
export default RichTextFields;
|
||||
export default RichTextFields
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
export const loremIpsum = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam hendrerit nisi sed sollicitudin pellentesque. Nunc posuere purus rhoncus pulvinar aliquam. Ut aliquet tristique nisl vitae volutpat. Nulla aliquet porttitor venenatis. Donec a dui et dui fringilla consectetur id nec massa. Aliquam erat volutpat. Sed ut dui ut lacus dictum fermentum vel tincidunt neque. Sed sed lacinia lectus. Duis sit amet sodales felis. Duis nunc eros, mattis at dui ac, convallis semper risus. In adipiscing ultrices tellus, in suscipit massa vehicula eu.'
|
||||
export const loremIpsum =
|
||||
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam hendrerit nisi sed sollicitudin pellentesque. Nunc posuere purus rhoncus pulvinar aliquam. Ut aliquet tristique nisl vitae volutpat. Nulla aliquet porttitor venenatis. Donec a dui et dui fringilla consectetur id nec massa. Aliquam erat volutpat. Sed ut dui ut lacus dictum fermentum vel tincidunt neque. Sed sed lacinia lectus. Duis sit amet sodales felis. Duis nunc eros, mattis at dui ac, convallis semper risus. In adipiscing ultrices tellus, in suscipit massa vehicula eu.'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
export const rowFieldsSlug = 'row-fields';
|
||||
export const rowFieldsSlug = 'row-fields'
|
||||
|
||||
const RowFields: CollectionConfig = {
|
||||
slug: rowFieldsSlug,
|
||||
@@ -27,6 +27,6 @@ const RowFields: CollectionConfig = {
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export default RowFields;
|
||||
export default RowFields
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
const SelectFields: CollectionConfig = {
|
||||
slug: 'select-fields',
|
||||
@@ -123,11 +123,11 @@ const SelectFields: CollectionConfig = {
|
||||
options: ['One', 'Two', 'Three'],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const selectsDoc = {
|
||||
select: 'one',
|
||||
selectHasMany: ['two', 'four'],
|
||||
};
|
||||
}
|
||||
|
||||
export default SelectFields;
|
||||
export default SelectFields
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import React from 'react';
|
||||
import React from 'react'
|
||||
|
||||
export const UIField: React.FC = () => {
|
||||
return (
|
||||
<p>This is a UI field within a tab component.</p>
|
||||
);
|
||||
};
|
||||
return <p>This is a UI field within a tab component.</p>
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import { blocksField, blocksFieldSeedData } from '../Blocks';
|
||||
import { UIField } from './UIField';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
export const tabsSlug = 'tabs-fields';
|
||||
import { blocksField, blocksFieldSeedData } from '../Blocks'
|
||||
import { UIField } from './UIField'
|
||||
|
||||
export const namedTabText = 'Some text in a named tab';
|
||||
export const namedTabDefaultValue = 'default text inside of a named tab';
|
||||
export const localizedTextValue = 'localized text';
|
||||
export const tabsSlug = 'tabs-fields'
|
||||
|
||||
export const namedTabText = 'Some text in a named tab'
|
||||
export const namedTabDefaultValue = 'default text inside of a named tab'
|
||||
export const localizedTextValue = 'localized text'
|
||||
|
||||
const TabsFields: CollectionConfig = {
|
||||
slug: tabsSlug,
|
||||
@@ -175,29 +176,29 @@ const TabsFields: CollectionConfig = {
|
||||
hooks: {
|
||||
beforeValidate: [
|
||||
({ data = {} }) => {
|
||||
if (!data.hooksTab) data.hooksTab = {};
|
||||
data.hooksTab.beforeValidate = true;
|
||||
return data.hooksTab;
|
||||
if (!data.hooksTab) data.hooksTab = {}
|
||||
data.hooksTab.beforeValidate = true
|
||||
return data.hooksTab
|
||||
},
|
||||
],
|
||||
beforeChange: [
|
||||
({ data = {} }) => {
|
||||
if (!data.hooksTab) data.hooksTab = {};
|
||||
data.hooksTab.beforeChange = true;
|
||||
return data.hooksTab;
|
||||
if (!data.hooksTab) data.hooksTab = {}
|
||||
data.hooksTab.beforeChange = true
|
||||
return data.hooksTab
|
||||
},
|
||||
],
|
||||
afterChange: [
|
||||
({ originalDoc }) => {
|
||||
originalDoc.hooksTab.afterChange = true;
|
||||
return originalDoc.hooksTab;
|
||||
originalDoc.hooksTab.afterChange = true
|
||||
return originalDoc.hooksTab
|
||||
},
|
||||
],
|
||||
afterRead: [
|
||||
({ data = {} }) => {
|
||||
if (!data.hooksTab) data.hooksTab = {};
|
||||
data.hooksTab.afterRead = true;
|
||||
return data.hooksTab;
|
||||
if (!data.hooksTab) data.hooksTab = {}
|
||||
data.hooksTab.afterRead = true
|
||||
return data.hooksTab
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -267,7 +268,7 @@ const TabsFields: CollectionConfig = {
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const tabsDoc = {
|
||||
array: [
|
||||
@@ -319,6 +320,6 @@ export const tabsDoc = {
|
||||
anotherText: 'Super tired of writing this text',
|
||||
textInRow: 'hello',
|
||||
numberInRow: 235,
|
||||
};
|
||||
}
|
||||
|
||||
export default TabsFields;
|
||||
export default TabsFields
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
export const defaultText = 'default-text';
|
||||
export const textFieldsSlug = 'text-fields';
|
||||
export const defaultText = 'default-text'
|
||||
export const textFieldsSlug = 'text-fields'
|
||||
|
||||
const TextFields: CollectionConfig = {
|
||||
slug: textFieldsSlug,
|
||||
@@ -40,15 +40,17 @@ const TextFields: CollectionConfig = {
|
||||
{
|
||||
name: 'defaultFunction',
|
||||
type: 'text',
|
||||
defaultValue: () => (defaultText),
|
||||
defaultValue: () => defaultText,
|
||||
},
|
||||
{
|
||||
name: 'defaultAsync',
|
||||
type: 'text',
|
||||
defaultValue: async (): Promise<string> => {
|
||||
return new Promise((resolve) => setTimeout(() => {
|
||||
resolve(defaultText);
|
||||
}, 1));
|
||||
return new Promise((resolve) =>
|
||||
setTimeout(() => {
|
||||
resolve(defaultText)
|
||||
}, 1),
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -61,9 +63,9 @@ const TextFields: CollectionConfig = {
|
||||
name: 'fieldWithDefaultValue',
|
||||
type: 'text',
|
||||
defaultValue: async () => {
|
||||
const defaultValue = new Promise((resolve) => setTimeout(() => resolve('some-value'), 1000));
|
||||
const defaultValue = new Promise((resolve) => setTimeout(() => resolve('some-value'), 1000))
|
||||
|
||||
return defaultValue;
|
||||
return defaultValue
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -72,17 +74,17 @@ const TextFields: CollectionConfig = {
|
||||
hooks: {
|
||||
beforeChange: [
|
||||
({ data }) => {
|
||||
return data?.fieldWithDefaultValue || '';
|
||||
return data?.fieldWithDefaultValue || ''
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const textDoc = {
|
||||
text: 'Seeded text document',
|
||||
localizedText: 'Localized text',
|
||||
};
|
||||
}
|
||||
|
||||
export default TextFields;
|
||||
export default TextFields
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import path from 'path';
|
||||
import { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import path from 'path'
|
||||
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
const Uploads: CollectionConfig = {
|
||||
slug: 'uploads',
|
||||
@@ -26,10 +27,10 @@ const Uploads: CollectionConfig = {
|
||||
name: 'richText',
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const uploadsDoc = {
|
||||
text: 'An upload here',
|
||||
};
|
||||
}
|
||||
|
||||
export default Uploads;
|
||||
export default Uploads
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import path from 'path';
|
||||
import { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import path from 'path'
|
||||
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
const Uploads2: CollectionConfig = {
|
||||
slug: 'uploads2',
|
||||
@@ -21,10 +22,10 @@ const Uploads2: CollectionConfig = {
|
||||
relationTo: 'uploads2',
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const uploadsDoc = {
|
||||
text: 'An upload here',
|
||||
};
|
||||
}
|
||||
|
||||
export default Uploads2;
|
||||
export default Uploads2
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import path from 'path';
|
||||
import { CollectionConfig } from '../../../../src/collections/config/types';
|
||||
import path from 'path'
|
||||
|
||||
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types'
|
||||
|
||||
const Uploads3: CollectionConfig = {
|
||||
slug: 'uploads3',
|
||||
@@ -24,10 +25,10 @@ const Uploads3: CollectionConfig = {
|
||||
name: 'richText',
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export const uploadsDoc = {
|
||||
text: 'An upload here',
|
||||
};
|
||||
}
|
||||
|
||||
export default Uploads3;
|
||||
export default Uploads3
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { buildConfigWithDefaults } from '../buildConfigWithDefaults';
|
||||
import { devUser } from '../credentials';
|
||||
import ArrayFields, { arrayDoc } from './collections/Array';
|
||||
import BlockFields, { blocksDoc } from './collections/Blocks';
|
||||
import CollapsibleFields, { collapsibleDoc } from './collections/Collapsible';
|
||||
import ConditionalLogic, { conditionalLogicDoc } from './collections/ConditionalLogic';
|
||||
import DateFields, { dateDoc } from './collections/Date';
|
||||
import RichTextFields, { richTextBulletsDoc, richTextDoc } from './collections/RichText';
|
||||
import SelectFields, { selectsDoc } from './collections/Select';
|
||||
import TabsFields, { tabsDoc } from './collections/Tabs';
|
||||
import TextFields, { textDoc, textFieldsSlug } from './collections/Text';
|
||||
import PointFields, { pointDoc } from './collections/Point';
|
||||
import GroupFields, { groupDoc } from './collections/Group';
|
||||
import getFileByPath from '../../src/uploads/getFileByPath';
|
||||
import Uploads, { uploadsDoc } from './collections/Upload';
|
||||
import IndexedFields from './collections/Indexed';
|
||||
import NumberFields, { numberDoc } from './collections/Number';
|
||||
import CodeFields, { codeDoc } from './collections/Code';
|
||||
import JSONFields, { jsonDoc } from './collections/JSON';
|
||||
import RelationshipFields from './collections/Relationship';
|
||||
import RadioFields, { radiosDoc } from './collections/Radio';
|
||||
import Uploads2 from './collections/Upload2';
|
||||
import Uploads3 from './collections/Uploads3';
|
||||
import RowFields from './collections/Row';
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
import getFileByPath from '../../packages/payload/src/uploads/getFileByPath'
|
||||
import { buildConfigWithDefaults } from '../buildConfigWithDefaults'
|
||||
import { devUser } from '../credentials'
|
||||
import ArrayFields, { arrayDoc } from './collections/Array'
|
||||
import BlockFields, { blocksDoc } from './collections/Blocks'
|
||||
import CodeFields, { codeDoc } from './collections/Code'
|
||||
import CollapsibleFields, { collapsibleDoc } from './collections/Collapsible'
|
||||
import ConditionalLogic, { conditionalLogicDoc } from './collections/ConditionalLogic'
|
||||
import DateFields, { dateDoc } from './collections/Date'
|
||||
import GroupFields, { groupDoc } from './collections/Group'
|
||||
import IndexedFields from './collections/Indexed'
|
||||
import JSONFields, { jsonDoc } from './collections/JSON'
|
||||
import NumberFields, { numberDoc } from './collections/Number'
|
||||
import PointFields, { pointDoc } from './collections/Point'
|
||||
import RadioFields, { radiosDoc } from './collections/Radio'
|
||||
import RelationshipFields from './collections/Relationship'
|
||||
import RichTextFields, { richTextBulletsDoc, richTextDoc } from './collections/RichText'
|
||||
import RowFields from './collections/Row'
|
||||
import SelectFields, { selectsDoc } from './collections/Select'
|
||||
import TabsFields, { tabsDoc } from './collections/Tabs'
|
||||
import TextFields, { textDoc, textFieldsSlug } from './collections/Text'
|
||||
import Uploads, { uploadsDoc } from './collections/Upload'
|
||||
import Uploads2 from './collections/Upload2'
|
||||
import Uploads3 from './collections/Uploads3'
|
||||
|
||||
export default buildConfigWithDefaults({
|
||||
admin: {
|
||||
@@ -88,32 +89,33 @@ export default buildConfigWithDefaults({
|
||||
email: devUser.email,
|
||||
password: devUser.password,
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
const createdArrayDoc = await payload.create({ collection: 'array-fields', data: arrayDoc });
|
||||
await payload.create({ collection: 'collapsible-fields', data: collapsibleDoc });
|
||||
await payload.create({ collection: 'conditional-logic', data: conditionalLogicDoc });
|
||||
await payload.create({ collection: 'group-fields', data: groupDoc });
|
||||
await payload.create({ collection: 'select-fields', data: selectsDoc });
|
||||
await payload.create({ collection: 'radio-fields', data: radiosDoc });
|
||||
await payload.create({ collection: 'tabs-fields', data: tabsDoc });
|
||||
await payload.create({ collection: 'point-fields', data: pointDoc });
|
||||
await payload.create({ collection: 'date-fields', data: dateDoc });
|
||||
await payload.create({ collection: 'code-fields', data: codeDoc });
|
||||
await payload.create({ collection: 'json-fields', data: jsonDoc });
|
||||
const createdArrayDoc = await payload.create({ collection: 'array-fields', data: arrayDoc })
|
||||
await payload.create({ collection: 'collapsible-fields', data: collapsibleDoc })
|
||||
await payload.create({ collection: 'conditional-logic', data: conditionalLogicDoc })
|
||||
await payload.create({ collection: 'group-fields', data: groupDoc })
|
||||
await payload.create({ collection: 'select-fields', data: selectsDoc })
|
||||
await payload.create({ collection: 'radio-fields', data: radiosDoc })
|
||||
await payload.create({ collection: 'tabs-fields', data: tabsDoc })
|
||||
await payload.create({ collection: 'point-fields', data: pointDoc })
|
||||
await payload.create({ collection: 'date-fields', data: dateDoc })
|
||||
await payload.create({ collection: 'code-fields', data: codeDoc })
|
||||
await payload.create({ collection: 'json-fields', data: jsonDoc })
|
||||
|
||||
const createdTextDoc = await payload.create({ collection: textFieldsSlug, data: textDoc });
|
||||
const createdTextDoc = await payload.create({ collection: textFieldsSlug, data: textDoc })
|
||||
|
||||
const uploadsDir = path.resolve(__dirname, './collections/Upload/uploads');
|
||||
const uploadsDir = path.resolve(__dirname, './collections/Upload/uploads')
|
||||
|
||||
if (fs.existsSync(uploadsDir)) fs.readdirSync(uploadsDir).forEach((f) => fs.rmSync(`${uploadsDir}/${f}`));
|
||||
if (fs.existsSync(uploadsDir))
|
||||
fs.readdirSync(uploadsDir).forEach((f) => fs.rmSync(`${uploadsDir}/${f}`))
|
||||
|
||||
const pngPath = path.resolve(__dirname, './uploads/payload.png');
|
||||
const pngFile = await getFileByPath(pngPath);
|
||||
const createdPNGDoc = await payload.create({ collection: 'uploads', data: {}, file: pngFile });
|
||||
const pngPath = path.resolve(__dirname, './uploads/payload.png')
|
||||
const pngFile = await getFileByPath(pngPath)
|
||||
const createdPNGDoc = await payload.create({ collection: 'uploads', data: {}, file: pngFile })
|
||||
|
||||
const jpgPath = path.resolve(__dirname, './collections/Upload/payload.jpg');
|
||||
const jpgFile = await getFileByPath(jpgPath);
|
||||
const jpgPath = path.resolve(__dirname, './collections/Upload/payload.jpg')
|
||||
const jpgFile = await getFileByPath(jpgPath)
|
||||
const createdJPGDoc = await payload.create({
|
||||
collection: 'uploads',
|
||||
data: {
|
||||
@@ -121,31 +123,43 @@ export default buildConfigWithDefaults({
|
||||
media: createdPNGDoc.id,
|
||||
},
|
||||
file: jpgFile,
|
||||
});
|
||||
})
|
||||
|
||||
const richTextDocWithRelId = JSON.parse(JSON.stringify(richTextDoc).replace(/{{ARRAY_DOC_ID}}/g, createdArrayDoc.id));
|
||||
const richTextDocWithRelationship = { ...richTextDocWithRelId };
|
||||
const richTextDocWithRelId = JSON.parse(
|
||||
JSON.stringify(richTextDoc).replace(/\{\{ARRAY_DOC_ID\}\}/g, createdArrayDoc.id),
|
||||
)
|
||||
const richTextDocWithRelationship = { ...richTextDocWithRelId }
|
||||
|
||||
const richTextRelationshipIndex = richTextDocWithRelationship.richText.findIndex(({ type }) => type === 'relationship');
|
||||
richTextDocWithRelationship.richText[richTextRelationshipIndex].value = { id: createdTextDoc.id };
|
||||
richTextDocWithRelationship.richTextReadOnly[richTextRelationshipIndex].value = { id: createdTextDoc.id };
|
||||
const richTextRelationshipIndex = richTextDocWithRelationship.richText.findIndex(
|
||||
({ type }) => type === 'relationship',
|
||||
)
|
||||
richTextDocWithRelationship.richText[richTextRelationshipIndex].value = {
|
||||
id: createdTextDoc.id,
|
||||
}
|
||||
richTextDocWithRelationship.richTextReadOnly[richTextRelationshipIndex].value = {
|
||||
id: createdTextDoc.id,
|
||||
}
|
||||
|
||||
const richTextUploadIndex = richTextDocWithRelationship.richText.findIndex(({ type }) => type === 'upload');
|
||||
richTextDocWithRelationship.richText[richTextUploadIndex].value = { id: createdJPGDoc.id };
|
||||
richTextDocWithRelationship.richTextReadOnly[richTextUploadIndex].value = { id: createdJPGDoc.id };
|
||||
const richTextUploadIndex = richTextDocWithRelationship.richText.findIndex(
|
||||
({ type }) => type === 'upload',
|
||||
)
|
||||
richTextDocWithRelationship.richText[richTextUploadIndex].value = { id: createdJPGDoc.id }
|
||||
richTextDocWithRelationship.richTextReadOnly[richTextUploadIndex].value = {
|
||||
id: createdJPGDoc.id,
|
||||
}
|
||||
|
||||
await payload.create({ collection: 'rich-text-fields', data: richTextBulletsDoc });
|
||||
await payload.create({ collection: 'rich-text-fields', data: richTextDocWithRelationship });
|
||||
await payload.create({ collection: 'rich-text-fields', data: richTextBulletsDoc })
|
||||
await payload.create({ collection: 'rich-text-fields', data: richTextDocWithRelationship })
|
||||
|
||||
await payload.create({ collection: 'number-fields', data: numberDoc });
|
||||
await payload.create({ collection: 'number-fields', data: numberDoc })
|
||||
|
||||
const blocksDocWithRichText = { ...blocksDoc };
|
||||
const blocksDocWithRichText = { ...blocksDoc }
|
||||
|
||||
// @ts-ignore
|
||||
blocksDocWithRichText.blocks[0].richText = richTextDocWithRelationship.richText;
|
||||
blocksDocWithRichText.blocks[0].richText = richTextDocWithRelationship.richText
|
||||
// @ts-ignore
|
||||
blocksDocWithRichText.localizedBlocks[0].richText = richTextDocWithRelationship.richText;
|
||||
blocksDocWithRichText.localizedBlocks[0].richText = richTextDocWithRelationship.richText
|
||||
|
||||
await payload.create({ collection: 'block-fields', data: blocksDocWithRichText });
|
||||
await payload.create({ collection: 'block-fields', data: blocksDocWithRichText })
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
export default {};
|
||||
export default {}
|
||||
|
||||
@@ -7,586 +7,586 @@
|
||||
|
||||
export interface Config {
|
||||
collections: {
|
||||
users: User;
|
||||
'array-fields': ArrayField;
|
||||
'block-fields': BlockField;
|
||||
'code-fields': CodeField;
|
||||
'collapsible-fields': CollapsibleField;
|
||||
'conditional-logic': ConditionalLogic;
|
||||
'date-fields': DateField;
|
||||
'radio-fields': RadioField;
|
||||
'group-fields': GroupField;
|
||||
'row-fields': RowField;
|
||||
'indexed-fields': IndexedField;
|
||||
'json-fields': JsonField;
|
||||
'number-fields': NumberField;
|
||||
'point-fields': PointField;
|
||||
'relationship-fields': RelationshipField;
|
||||
'rich-text-fields': RichTextField;
|
||||
'select-fields': SelectField;
|
||||
'tabs-fields': TabsField;
|
||||
'text-fields': TextField;
|
||||
uploads: Upload;
|
||||
uploads2: Uploads2;
|
||||
uploads3: Uploads3;
|
||||
};
|
||||
globals: {};
|
||||
users: User
|
||||
'array-fields': ArrayField
|
||||
'block-fields': BlockField
|
||||
'code-fields': CodeField
|
||||
'collapsible-fields': CollapsibleField
|
||||
'conditional-logic': ConditionalLogic
|
||||
'date-fields': DateField
|
||||
'radio-fields': RadioField
|
||||
'group-fields': GroupField
|
||||
'row-fields': RowField
|
||||
'indexed-fields': IndexedField
|
||||
'json-fields': JsonField
|
||||
'number-fields': NumberField
|
||||
'point-fields': PointField
|
||||
'relationship-fields': RelationshipField
|
||||
'rich-text-fields': RichTextField
|
||||
'select-fields': SelectField
|
||||
'tabs-fields': TabsField
|
||||
'text-fields': TextField
|
||||
uploads: Upload
|
||||
uploads2: Uploads2
|
||||
uploads3: Uploads3
|
||||
}
|
||||
globals: {}
|
||||
}
|
||||
export interface User {
|
||||
id: string;
|
||||
canViewConditionalField?: boolean;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
email: string;
|
||||
resetPasswordToken?: string;
|
||||
resetPasswordExpiration?: string;
|
||||
salt?: string;
|
||||
hash?: string;
|
||||
loginAttempts?: number;
|
||||
lockUntil?: string;
|
||||
password?: string;
|
||||
id: string
|
||||
canViewConditionalField?: boolean
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
email: string
|
||||
resetPasswordToken?: string
|
||||
resetPasswordExpiration?: string
|
||||
salt?: string
|
||||
hash?: string
|
||||
loginAttempts?: number
|
||||
lockUntil?: string
|
||||
password?: string
|
||||
}
|
||||
export interface ArrayField {
|
||||
id: string;
|
||||
id: string
|
||||
items: {
|
||||
text: string;
|
||||
id?: string;
|
||||
}[];
|
||||
text: string
|
||||
id?: string
|
||||
}[]
|
||||
collapsedArray?: {
|
||||
text: string;
|
||||
id?: string;
|
||||
}[];
|
||||
text: string
|
||||
id?: string
|
||||
}[]
|
||||
localized: {
|
||||
text: string;
|
||||
id?: string;
|
||||
}[];
|
||||
text: string
|
||||
id?: string
|
||||
}[]
|
||||
readOnly?: {
|
||||
text?: string;
|
||||
id?: string;
|
||||
}[];
|
||||
text?: string
|
||||
id?: string
|
||||
}[]
|
||||
potentiallyEmptyArray?: {
|
||||
text?: string;
|
||||
id?: string;
|
||||
}[];
|
||||
text?: string
|
||||
id?: string
|
||||
}[]
|
||||
rowLabelAsFunction?: {
|
||||
title?: string;
|
||||
id?: string;
|
||||
}[];
|
||||
title?: string
|
||||
id?: string
|
||||
}[]
|
||||
rowLabelAsComponent?: {
|
||||
title?: string;
|
||||
id?: string;
|
||||
}[];
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
title?: string
|
||||
id?: string
|
||||
}[]
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface BlockField {
|
||||
id: string;
|
||||
id: string
|
||||
blocks: (
|
||||
| {
|
||||
text: string;
|
||||
text: string
|
||||
richText?: {
|
||||
[k: string]: unknown;
|
||||
}[];
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'text';
|
||||
[k: string]: unknown
|
||||
}[]
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'text'
|
||||
}
|
||||
| {
|
||||
number: number;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'number';
|
||||
number: number
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'number'
|
||||
}
|
||||
| {
|
||||
subBlocks?: (
|
||||
| {
|
||||
text: string;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'text';
|
||||
text: string
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'text'
|
||||
}
|
||||
| {
|
||||
number: number;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'number';
|
||||
number: number
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'number'
|
||||
}
|
||||
)[];
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'subBlocks';
|
||||
)[]
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'subBlocks'
|
||||
}
|
||||
| {
|
||||
textInCollapsible?: string;
|
||||
textInRow?: string;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'tabs';
|
||||
textInCollapsible?: string
|
||||
textInRow?: string
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'tabs'
|
||||
}
|
||||
)[];
|
||||
)[]
|
||||
collapsedByDefaultBlocks: (
|
||||
| {
|
||||
text: string;
|
||||
text: string
|
||||
richText?: {
|
||||
[k: string]: unknown;
|
||||
}[];
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'text';
|
||||
[k: string]: unknown
|
||||
}[]
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'text'
|
||||
}
|
||||
| {
|
||||
number: number;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'number';
|
||||
number: number
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'number'
|
||||
}
|
||||
| {
|
||||
subBlocks?: (
|
||||
| {
|
||||
text: string;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'text';
|
||||
text: string
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'text'
|
||||
}
|
||||
| {
|
||||
number: number;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'number';
|
||||
number: number
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'number'
|
||||
}
|
||||
)[];
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'subBlocks';
|
||||
)[]
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'subBlocks'
|
||||
}
|
||||
| {
|
||||
textInCollapsible?: string;
|
||||
textInRow?: string;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'tabs';
|
||||
textInCollapsible?: string
|
||||
textInRow?: string
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'tabs'
|
||||
}
|
||||
)[];
|
||||
)[]
|
||||
localizedBlocks: (
|
||||
| {
|
||||
text: string;
|
||||
text: string
|
||||
richText?: {
|
||||
[k: string]: unknown;
|
||||
}[];
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'text';
|
||||
[k: string]: unknown
|
||||
}[]
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'text'
|
||||
}
|
||||
| {
|
||||
number: number;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'number';
|
||||
number: number
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'number'
|
||||
}
|
||||
| {
|
||||
subBlocks?: (
|
||||
| {
|
||||
text: string;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'text';
|
||||
text: string
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'text'
|
||||
}
|
||||
| {
|
||||
number: number;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'number';
|
||||
number: number
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'number'
|
||||
}
|
||||
)[];
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'subBlocks';
|
||||
)[]
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'subBlocks'
|
||||
}
|
||||
| {
|
||||
textInCollapsible?: string;
|
||||
textInRow?: string;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'tabs';
|
||||
textInCollapsible?: string
|
||||
textInRow?: string
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'tabs'
|
||||
}
|
||||
)[];
|
||||
)[]
|
||||
i18nBlocks?: {
|
||||
text?: string;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'text';
|
||||
}[];
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
text?: string
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'text'
|
||||
}[]
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface CodeField {
|
||||
id: string;
|
||||
javascript?: string;
|
||||
typescript?: string;
|
||||
json?: string;
|
||||
html?: string;
|
||||
css?: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
id: string
|
||||
javascript?: string
|
||||
typescript?: string
|
||||
json?: string
|
||||
html?: string
|
||||
css?: string
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface CollapsibleField {
|
||||
id: string;
|
||||
text: string;
|
||||
id: string
|
||||
text: string
|
||||
group?: {
|
||||
textWithinGroup?: string;
|
||||
textWithinGroup?: string
|
||||
subGroup?: {
|
||||
textWithinSubGroup?: string;
|
||||
};
|
||||
};
|
||||
someText?: string;
|
||||
functionTitleField?: string;
|
||||
componentTitleField?: string;
|
||||
nestedTitle?: string;
|
||||
textWithinSubGroup?: string
|
||||
}
|
||||
}
|
||||
someText?: string
|
||||
functionTitleField?: string
|
||||
componentTitleField?: string
|
||||
nestedTitle?: string
|
||||
arrayWithCollapsibles?: {
|
||||
innerCollapsible?: string;
|
||||
id?: string;
|
||||
}[];
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
innerCollapsible?: string
|
||||
id?: string
|
||||
}[]
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface ConditionalLogic {
|
||||
id: string;
|
||||
text: string;
|
||||
toggleField?: boolean;
|
||||
fieldToToggle: string;
|
||||
userConditional?: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
id: string
|
||||
text: string
|
||||
toggleField?: boolean
|
||||
fieldToToggle: string
|
||||
userConditional?: string
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface DateField {
|
||||
id: string;
|
||||
default: string;
|
||||
timeOnly?: string;
|
||||
dayOnly?: string;
|
||||
dayAndTime?: string;
|
||||
monthOnly?: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
id: string
|
||||
default: string
|
||||
timeOnly?: string
|
||||
dayOnly?: string
|
||||
dayAndTime?: string
|
||||
monthOnly?: string
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface RadioField {
|
||||
id: string;
|
||||
radio?: 'one' | 'two' | 'three';
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
id: string
|
||||
radio?: 'one' | 'two' | 'three'
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface GroupField {
|
||||
id: string;
|
||||
id: string
|
||||
group: {
|
||||
text: string;
|
||||
defaultParent?: string;
|
||||
defaultChild?: string;
|
||||
text: string
|
||||
defaultParent?: string
|
||||
defaultChild?: string
|
||||
subGroup?: {
|
||||
textWithinGroup?: string;
|
||||
textWithinGroup?: string
|
||||
arrayWithinGroup?: {
|
||||
textWithinArray?: string;
|
||||
id?: string;
|
||||
}[];
|
||||
};
|
||||
};
|
||||
textWithinArray?: string
|
||||
id?: string
|
||||
}[]
|
||||
}
|
||||
}
|
||||
potentiallyEmptyGroup?: {
|
||||
text?: string;
|
||||
};
|
||||
text?: string
|
||||
}
|
||||
groupInRow?: {
|
||||
field?: string;
|
||||
secondField?: string;
|
||||
thirdField?: string;
|
||||
};
|
||||
field?: string
|
||||
secondField?: string
|
||||
thirdField?: string
|
||||
}
|
||||
secondGroupInRow?: {
|
||||
field?: string;
|
||||
field?: string
|
||||
nestedGroup?: {
|
||||
nestedField?: string;
|
||||
};
|
||||
};
|
||||
nestedField?: string
|
||||
}
|
||||
}
|
||||
groups: {
|
||||
groupInRow?: {
|
||||
field?: string;
|
||||
secondField?: string;
|
||||
thirdField?: string;
|
||||
};
|
||||
field?: string
|
||||
secondField?: string
|
||||
thirdField?: string
|
||||
}
|
||||
secondGroupInRow?: {
|
||||
field?: string;
|
||||
field?: string
|
||||
nestedGroup?: {
|
||||
nestedField?: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
nestedField?: string
|
||||
}
|
||||
}
|
||||
}
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface RowField {
|
||||
id: string;
|
||||
title: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
id: string
|
||||
title: string
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface IndexedField {
|
||||
id: string;
|
||||
text: string;
|
||||
uniqueText?: string;
|
||||
id: string
|
||||
text: string
|
||||
uniqueText?: string
|
||||
/**
|
||||
* @minItems 2
|
||||
* @maxItems 2
|
||||
*/
|
||||
point?: [number, number];
|
||||
point?: [number, number]
|
||||
group?: {
|
||||
localizedUnique?: string;
|
||||
localizedUnique?: string
|
||||
/**
|
||||
* @minItems 2
|
||||
* @maxItems 2
|
||||
*/
|
||||
point?: [number, number];
|
||||
};
|
||||
collapsibleLocalizedUnique?: string;
|
||||
collapsibleTextUnique?: string;
|
||||
partOne?: string;
|
||||
partTwo?: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
point?: [number, number]
|
||||
}
|
||||
collapsibleLocalizedUnique?: string
|
||||
collapsibleTextUnique?: string
|
||||
partOne?: string
|
||||
partTwo?: string
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface JsonField {
|
||||
id: string;
|
||||
id: string
|
||||
json?:
|
||||
| {
|
||||
[k: string]: unknown;
|
||||
[k: string]: unknown
|
||||
}
|
||||
| unknown[]
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
| null
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface NumberField {
|
||||
id: string;
|
||||
number?: number;
|
||||
min?: number;
|
||||
max?: number;
|
||||
positiveNumber?: number;
|
||||
negativeNumber?: number;
|
||||
decimalMin?: number;
|
||||
decimalMax?: number;
|
||||
defaultNumber?: number;
|
||||
hasMany?: number[];
|
||||
validatesHasMany?: number[];
|
||||
localizedHasMany?: number[];
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
id: string
|
||||
number?: number
|
||||
min?: number
|
||||
max?: number
|
||||
positiveNumber?: number
|
||||
negativeNumber?: number
|
||||
decimalMin?: number
|
||||
decimalMax?: number
|
||||
defaultNumber?: number
|
||||
hasMany?: number[]
|
||||
validatesHasMany?: number[]
|
||||
localizedHasMany?: number[]
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface PointField {
|
||||
id: string;
|
||||
id: string
|
||||
/**
|
||||
* @minItems 2
|
||||
* @maxItems 2
|
||||
*/
|
||||
point: [number, number];
|
||||
point: [number, number]
|
||||
/**
|
||||
* @minItems 2
|
||||
* @maxItems 2
|
||||
*/
|
||||
localized?: [number, number];
|
||||
localized?: [number, number]
|
||||
group?: {
|
||||
/**
|
||||
* @minItems 2
|
||||
* @maxItems 2
|
||||
*/
|
||||
point?: [number, number];
|
||||
};
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
point?: [number, number]
|
||||
}
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface RelationshipField {
|
||||
id: string;
|
||||
id: string
|
||||
relationship:
|
||||
| {
|
||||
value: string | TextField;
|
||||
relationTo: 'text-fields';
|
||||
value: string | TextField
|
||||
relationTo: 'text-fields'
|
||||
}
|
||||
| {
|
||||
value: string | ArrayField;
|
||||
relationTo: 'array-fields';
|
||||
};
|
||||
relationToSelf?: string | RelationshipField;
|
||||
relationToSelfSelectOnly?: string | RelationshipField;
|
||||
relationWithDynamicDefault?: string | User;
|
||||
value: string | ArrayField
|
||||
relationTo: 'array-fields'
|
||||
}
|
||||
relationToSelf?: string | RelationshipField
|
||||
relationToSelfSelectOnly?: string | RelationshipField
|
||||
relationWithDynamicDefault?: string | User
|
||||
relationHasManyWithDynamicDefault?: {
|
||||
value: string | User;
|
||||
relationTo: 'users';
|
||||
};
|
||||
relationshipWithMin?: string[] | TextField[];
|
||||
relationshipWithMax?: string[] | TextField[];
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
value: string | User
|
||||
relationTo: 'users'
|
||||
}
|
||||
relationshipWithMin?: string[] | TextField[]
|
||||
relationshipWithMax?: string[] | TextField[]
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface TextField {
|
||||
id: string;
|
||||
text: string;
|
||||
localizedText?: string;
|
||||
i18nText?: string;
|
||||
defaultFunction?: string;
|
||||
defaultAsync?: string;
|
||||
overrideLength?: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
id: string
|
||||
text: string
|
||||
localizedText?: string
|
||||
i18nText?: string
|
||||
defaultFunction?: string
|
||||
defaultAsync?: string
|
||||
overrideLength?: string
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface RichTextField {
|
||||
id: string;
|
||||
title: string;
|
||||
selectHasMany?: ('one' | 'two' | 'three' | 'four' | 'five' | 'six')[];
|
||||
id: string
|
||||
title: string
|
||||
selectHasMany?: ('one' | 'two' | 'three' | 'four' | 'five' | 'six')[]
|
||||
richText: {
|
||||
[k: string]: unknown;
|
||||
}[];
|
||||
[k: string]: unknown
|
||||
}[]
|
||||
richTextCustomFields?: {
|
||||
[k: string]: unknown;
|
||||
}[];
|
||||
[k: string]: unknown
|
||||
}[]
|
||||
richTextReadOnly?: {
|
||||
[k: string]: unknown;
|
||||
}[];
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
[k: string]: unknown
|
||||
}[]
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface SelectField {
|
||||
id: string;
|
||||
select?: 'one' | 'two' | 'three';
|
||||
selectReadOnly?: 'one' | 'two' | 'three';
|
||||
selectHasMany?: ('one' | 'two' | 'three' | 'four' | 'five' | 'six')[];
|
||||
selectHasManyLocalized?: ('one' | 'two')[];
|
||||
selectI18n?: 'one' | 'two' | 'three';
|
||||
simple?: 'One' | 'Two' | 'Three';
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
id: string
|
||||
select?: 'one' | 'two' | 'three'
|
||||
selectReadOnly?: 'one' | 'two' | 'three'
|
||||
selectHasMany?: ('one' | 'two' | 'three' | 'four' | 'five' | 'six')[]
|
||||
selectHasManyLocalized?: ('one' | 'two')[]
|
||||
selectI18n?: 'one' | 'two' | 'three'
|
||||
simple?: 'One' | 'Two' | 'Three'
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface TabsField {
|
||||
id: string;
|
||||
id: string
|
||||
array: {
|
||||
text: string;
|
||||
id?: string;
|
||||
}[];
|
||||
text: string
|
||||
id?: string
|
||||
}[]
|
||||
blocks: (
|
||||
| {
|
||||
text: string;
|
||||
text: string
|
||||
richText?: {
|
||||
[k: string]: unknown;
|
||||
}[];
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'text';
|
||||
[k: string]: unknown
|
||||
}[]
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'text'
|
||||
}
|
||||
| {
|
||||
number: number;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'number';
|
||||
number: number
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'number'
|
||||
}
|
||||
| {
|
||||
subBlocks?: (
|
||||
| {
|
||||
text: string;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'text';
|
||||
text: string
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'text'
|
||||
}
|
||||
| {
|
||||
number: number;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'number';
|
||||
number: number
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'number'
|
||||
}
|
||||
)[];
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'subBlocks';
|
||||
)[]
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'subBlocks'
|
||||
}
|
||||
| {
|
||||
textInCollapsible?: string;
|
||||
textInRow?: string;
|
||||
id?: string;
|
||||
blockName?: string;
|
||||
blockType: 'tabs';
|
||||
textInCollapsible?: string
|
||||
textInRow?: string
|
||||
id?: string
|
||||
blockName?: string
|
||||
blockType: 'tabs'
|
||||
}
|
||||
)[];
|
||||
)[]
|
||||
group: {
|
||||
number: number;
|
||||
};
|
||||
textInRow: string;
|
||||
numberInRow: number;
|
||||
number: number
|
||||
}
|
||||
textInRow: string
|
||||
numberInRow: number
|
||||
tab: {
|
||||
array: {
|
||||
text: string;
|
||||
id?: string;
|
||||
}[];
|
||||
text?: string;
|
||||
defaultValue?: string;
|
||||
};
|
||||
text: string
|
||||
id?: string
|
||||
}[]
|
||||
text?: string
|
||||
defaultValue?: string
|
||||
}
|
||||
namedTabWithDefaultValue: {
|
||||
defaultValue?: string;
|
||||
};
|
||||
defaultValue?: string
|
||||
}
|
||||
localizedTab: {
|
||||
text?: string;
|
||||
};
|
||||
text?: string
|
||||
}
|
||||
accessControlTab: {
|
||||
text?: string;
|
||||
};
|
||||
text?: string
|
||||
}
|
||||
hooksTab: {
|
||||
beforeValidate?: boolean;
|
||||
beforeChange?: boolean;
|
||||
afterChange?: boolean;
|
||||
afterRead?: boolean;
|
||||
};
|
||||
textarea?: string;
|
||||
anotherText: string;
|
||||
beforeValidate?: boolean
|
||||
beforeChange?: boolean
|
||||
afterChange?: boolean
|
||||
afterRead?: boolean
|
||||
}
|
||||
textarea?: string
|
||||
anotherText: string
|
||||
nestedTab: {
|
||||
text?: string;
|
||||
};
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
text?: string
|
||||
}
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
}
|
||||
export interface Upload {
|
||||
id: string;
|
||||
text?: string;
|
||||
media?: string | Upload;
|
||||
id: string
|
||||
text?: string
|
||||
media?: string | Upload
|
||||
richText?: {
|
||||
[k: string]: unknown;
|
||||
}[];
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
url?: string;
|
||||
filename?: string;
|
||||
mimeType?: string;
|
||||
filesize?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
[k: string]: unknown
|
||||
}[]
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
url?: string
|
||||
filename?: string
|
||||
mimeType?: string
|
||||
filesize?: number
|
||||
width?: number
|
||||
height?: number
|
||||
}
|
||||
export interface Uploads2 {
|
||||
id: string;
|
||||
text?: string;
|
||||
media?: string | Uploads2;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
url?: string;
|
||||
filename?: string;
|
||||
mimeType?: string;
|
||||
filesize?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
id: string
|
||||
text?: string
|
||||
media?: string | Uploads2
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
url?: string
|
||||
filename?: string
|
||||
mimeType?: string
|
||||
filesize?: number
|
||||
width?: number
|
||||
height?: number
|
||||
}
|
||||
export interface Uploads3 {
|
||||
id: string;
|
||||
media?: string | Uploads3;
|
||||
id: string
|
||||
media?: string | Uploads3
|
||||
richText?: {
|
||||
[k: string]: unknown;
|
||||
}[];
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
url?: string;
|
||||
filename?: string;
|
||||
mimeType?: string;
|
||||
filesize?: number;
|
||||
width?: number;
|
||||
height?: number;
|
||||
[k: string]: unknown
|
||||
}[]
|
||||
updatedAt: string
|
||||
createdAt: string
|
||||
url?: string
|
||||
filename?: string
|
||||
mimeType?: string
|
||||
filesize?: number
|
||||
width?: number
|
||||
height?: number
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user