test: consolidates custom id e2e tests (#10061)
Although we have a dedicated e2e test suite for custom IDs, tests for custom unnamed tab and row IDs were still located within the admin test suite. This consolidates these tests into the appropriate test suite as expected.
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
export const CustomIdRow: CollectionConfig = {
|
||||
slug: 'customIdRow',
|
||||
admin: {
|
||||
defaultColumns: ['id', 'number', 'title'],
|
||||
description: 'Description',
|
||||
group: 'One',
|
||||
listSearchableFields: ['id', 'title', 'description', 'number'],
|
||||
useAsTitle: 'title',
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
type: 'row',
|
||||
fields: [
|
||||
{
|
||||
name: 'title',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'id',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'number',
|
||||
type: 'number',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
labels: {
|
||||
plural: 'Custom Ids Row',
|
||||
singular: 'Custom Id Row',
|
||||
},
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
export const CustomIdTab: CollectionConfig = {
|
||||
slug: 'customIdTab',
|
||||
admin: {
|
||||
defaultColumns: ['id', 'number', 'title'],
|
||||
description: 'Description',
|
||||
group: 'One',
|
||||
listSearchableFields: ['id', 'title', 'description', 'number'],
|
||||
useAsTitle: 'title',
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
type: 'tabs',
|
||||
tabs: [
|
||||
{
|
||||
fields: [
|
||||
{
|
||||
name: 'title',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'id',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'number',
|
||||
type: 'number',
|
||||
},
|
||||
],
|
||||
label: 'Tab 1',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
labels: {
|
||||
plural: 'Custom Ids Tab',
|
||||
singular: 'Custom Id Tab',
|
||||
},
|
||||
}
|
||||
@@ -5,8 +5,6 @@ const dirname = path.dirname(filename)
|
||||
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
|
||||
import { BaseListFilter } from './collections/BaseListFilter.js'
|
||||
import { CustomFields } from './collections/CustomFields/index.js'
|
||||
import { CustomIdRow } from './collections/CustomIdRow.js'
|
||||
import { CustomIdTab } from './collections/CustomIdTab.js'
|
||||
import { CustomViews1 } from './collections/CustomViews1.js'
|
||||
import { CustomViews2 } from './collections/CustomViews2.js'
|
||||
import { DisableDuplicate } from './collections/DisableDuplicate.js'
|
||||
@@ -155,8 +153,6 @@ export default buildConfigWithDefaults({
|
||||
CollectionGroup2A,
|
||||
CollectionGroup2B,
|
||||
Geo,
|
||||
CustomIdTab,
|
||||
CustomIdRow,
|
||||
DisableDuplicate,
|
||||
BaseListFilter,
|
||||
],
|
||||
|
||||
@@ -20,7 +20,6 @@ import { AdminUrlUtil } from '../../../helpers/adminUrlUtil.js'
|
||||
import { initPayloadE2ENoConfig } from '../../../helpers/initPayloadE2ENoConfig.js'
|
||||
import { customAdminRoutes } from '../../shared.js'
|
||||
import {
|
||||
customIdCollectionId,
|
||||
disableDuplicateSlug,
|
||||
geoCollectionSlug,
|
||||
globalSlug,
|
||||
@@ -544,7 +543,7 @@ describe('admin3', () => {
|
||||
defaultValueField: 'not the default value',
|
||||
}
|
||||
const updatedPostTitle = `${post1Title} (Updated)`
|
||||
await Promise.all([createPost(postData)])
|
||||
await createPost(postData)
|
||||
await page.goto(postsUrl.list)
|
||||
await page.locator('input#select-all').check()
|
||||
await page.locator('.edit-many__toggle').click()
|
||||
@@ -652,24 +651,6 @@ describe('admin3', () => {
|
||||
await expect(modalContainer).toHaveClass(/payload__modal-container--exitDone/)
|
||||
})
|
||||
})
|
||||
|
||||
describe('custom IDs', () => {
|
||||
test('unnamed tab — should allow custom ID field', async () => {
|
||||
await page.goto(postsUrl.collection('customIdTab') + '/' + customIdCollectionId)
|
||||
|
||||
const idField = page.locator('#field-id')
|
||||
|
||||
await expect(idField).toHaveValue(customIdCollectionId)
|
||||
})
|
||||
|
||||
test('row — should allow custom ID field', async () => {
|
||||
await page.goto(postsUrl.collection('customIdRow') + '/' + customIdCollectionId)
|
||||
|
||||
const idField = page.locator('#field-id')
|
||||
|
||||
await expect(idField).toHaveValue(customIdCollectionId)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
async function createPost(overrides?: Partial<Post>): Promise<Post> {
|
||||
|
||||
@@ -15,6 +15,7 @@ export interface Config {
|
||||
posts: Post;
|
||||
users: User;
|
||||
'hidden-collection': HiddenCollection;
|
||||
'not-in-view-collection': NotInViewCollection;
|
||||
'collection-no-api-view': CollectionNoApiView;
|
||||
'custom-views-one': CustomViewsOne;
|
||||
'custom-views-two': CustomViewsTwo;
|
||||
@@ -24,8 +25,6 @@ export interface Config {
|
||||
'group-two-collection-ones': GroupTwoCollectionOne;
|
||||
'group-two-collection-twos': GroupTwoCollectionTwo;
|
||||
geo: Geo;
|
||||
customIdTab: CustomIdTab;
|
||||
customIdRow: CustomIdRow;
|
||||
'disable-duplicate': DisableDuplicate;
|
||||
'base-list-filters': BaseListFilter;
|
||||
'payload-locked-documents': PayloadLockedDocument;
|
||||
@@ -38,6 +37,7 @@ export interface Config {
|
||||
posts: PostsSelect<false> | PostsSelect<true>;
|
||||
users: UsersSelect<false> | UsersSelect<true>;
|
||||
'hidden-collection': HiddenCollectionSelect<false> | HiddenCollectionSelect<true>;
|
||||
'not-in-view-collection': NotInViewCollectionSelect<false> | NotInViewCollectionSelect<true>;
|
||||
'collection-no-api-view': CollectionNoApiViewSelect<false> | CollectionNoApiViewSelect<true>;
|
||||
'custom-views-one': CustomViewsOneSelect<false> | CustomViewsOneSelect<true>;
|
||||
'custom-views-two': CustomViewsTwoSelect<false> | CustomViewsTwoSelect<true>;
|
||||
@@ -47,8 +47,6 @@ export interface Config {
|
||||
'group-two-collection-ones': GroupTwoCollectionOnesSelect<false> | GroupTwoCollectionOnesSelect<true>;
|
||||
'group-two-collection-twos': GroupTwoCollectionTwosSelect<false> | GroupTwoCollectionTwosSelect<true>;
|
||||
geo: GeoSelect<false> | GeoSelect<true>;
|
||||
customIdTab: CustomIdTabSelect<false> | CustomIdTabSelect<true>;
|
||||
customIdRow: CustomIdRowSelect<false> | CustomIdRowSelect<true>;
|
||||
'disable-duplicate': DisableDuplicateSelect<false> | DisableDuplicateSelect<true>;
|
||||
'base-list-filters': BaseListFiltersSelect<false> | BaseListFiltersSelect<true>;
|
||||
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
|
||||
@@ -60,6 +58,7 @@ export interface Config {
|
||||
};
|
||||
globals: {
|
||||
'hidden-global': HiddenGlobal;
|
||||
'not-in-view-global': NotInViewGlobal;
|
||||
'global-no-api-view': GlobalNoApiView;
|
||||
global: Global;
|
||||
'custom-global-views-one': CustomGlobalViewsOne;
|
||||
@@ -70,6 +69,7 @@ export interface Config {
|
||||
};
|
||||
globalsSelect: {
|
||||
'hidden-global': HiddenGlobalSelect<false> | HiddenGlobalSelect<true>;
|
||||
'not-in-view-global': NotInViewGlobalSelect<false> | NotInViewGlobalSelect<true>;
|
||||
'global-no-api-view': GlobalNoApiViewSelect<false> | GlobalNoApiViewSelect<true>;
|
||||
global: GlobalSelect<false> | GlobalSelect<true>;
|
||||
'custom-global-views-one': CustomGlobalViewsOneSelect<false> | CustomGlobalViewsOneSelect<true>;
|
||||
@@ -199,6 +199,16 @@ export interface HiddenCollection {
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "not-in-view-collection".
|
||||
*/
|
||||
export interface NotInViewCollection {
|
||||
id: string;
|
||||
title?: string | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "collection-no-api-view".
|
||||
@@ -318,30 +328,6 @@ export interface Geo {
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "customIdTab".
|
||||
*/
|
||||
export interface CustomIdTab {
|
||||
title?: string | null;
|
||||
id: string;
|
||||
description?: string | null;
|
||||
number?: number | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "customIdRow".
|
||||
*/
|
||||
export interface CustomIdRow {
|
||||
title?: string | null;
|
||||
id: string;
|
||||
description?: string | null;
|
||||
number?: number | null;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "disable-duplicate".
|
||||
@@ -385,6 +371,10 @@ export interface PayloadLockedDocument {
|
||||
relationTo: 'hidden-collection';
|
||||
value: string | HiddenCollection;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'not-in-view-collection';
|
||||
value: string | NotInViewCollection;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'collection-no-api-view';
|
||||
value: string | CollectionNoApiView;
|
||||
@@ -421,14 +411,6 @@ export interface PayloadLockedDocument {
|
||||
relationTo: 'geo';
|
||||
value: string | Geo;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'customIdTab';
|
||||
value: string | CustomIdTab;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'customIdRow';
|
||||
value: string | CustomIdRow;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'disable-duplicate';
|
||||
value: string | DisableDuplicate;
|
||||
@@ -569,6 +551,15 @@ export interface HiddenCollectionSelect<T extends boolean = true> {
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "not-in-view-collection_select".
|
||||
*/
|
||||
export interface NotInViewCollectionSelect<T extends boolean = true> {
|
||||
title?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "collection-no-api-view_select".
|
||||
@@ -680,30 +671,6 @@ export interface GeoSelect<T extends boolean = true> {
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "customIdTab_select".
|
||||
*/
|
||||
export interface CustomIdTabSelect<T extends boolean = true> {
|
||||
title?: T;
|
||||
id?: T;
|
||||
description?: T;
|
||||
number?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "customIdRow_select".
|
||||
*/
|
||||
export interface CustomIdRowSelect<T extends boolean = true> {
|
||||
title?: T;
|
||||
id?: T;
|
||||
description?: T;
|
||||
number?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "disable-duplicate_select".
|
||||
@@ -764,6 +731,16 @@ export interface HiddenGlobal {
|
||||
updatedAt?: string | null;
|
||||
createdAt?: string | null;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "not-in-view-global".
|
||||
*/
|
||||
export interface NotInViewGlobal {
|
||||
id: string;
|
||||
title?: string | null;
|
||||
updatedAt?: string | null;
|
||||
createdAt?: string | null;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "global-no-api-view".
|
||||
@@ -845,6 +822,16 @@ export interface HiddenGlobalSelect<T extends boolean = true> {
|
||||
createdAt?: T;
|
||||
globalType?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "not-in-view-global_select".
|
||||
*/
|
||||
export interface NotInViewGlobalSelect<T extends boolean = true> {
|
||||
title?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
globalType?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "global-no-api-view_select".
|
||||
|
||||
@@ -5,7 +5,6 @@ import { executePromises } from '../helpers/executePromises.js'
|
||||
import { seedDB } from '../helpers/seed.js'
|
||||
import {
|
||||
collectionSlugs,
|
||||
customIdCollectionId,
|
||||
customViews1CollectionSlug,
|
||||
customViews2CollectionSlug,
|
||||
geoCollectionSlug,
|
||||
@@ -113,26 +112,6 @@ export const seed = async (_payload) => {
|
||||
depth: 0,
|
||||
overrideAccess: true,
|
||||
}),
|
||||
() =>
|
||||
_payload.create({
|
||||
collection: 'customIdTab',
|
||||
data: {
|
||||
id: customIdCollectionId,
|
||||
title: 'Hello world title',
|
||||
},
|
||||
depth: 0,
|
||||
overrideAccess: true,
|
||||
}),
|
||||
() =>
|
||||
_payload.create({
|
||||
collection: 'customIdRow',
|
||||
data: {
|
||||
id: customIdCollectionId,
|
||||
title: 'Hello world title',
|
||||
},
|
||||
depth: 0,
|
||||
overrideAccess: true,
|
||||
}),
|
||||
],
|
||||
false,
|
||||
)
|
||||
|
||||
@@ -48,6 +48,3 @@ export const globalSlugs = [
|
||||
hiddenGlobalSlug,
|
||||
noApiViewGlobalSlug,
|
||||
]
|
||||
|
||||
export const customIdCollectionSlug = 'customId'
|
||||
export const customIdCollectionId = '111111111111111111111111'
|
||||
|
||||
25
test/fields/collections/CustomID/CustomRowID.ts
Normal file
25
test/fields/collections/CustomID/CustomRowID.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
import { customRowIDSlug } from '../../slugs.js'
|
||||
|
||||
export const CustomRowID: CollectionConfig = {
|
||||
slug: customRowIDSlug,
|
||||
admin: {
|
||||
useAsTitle: 'id',
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
type: 'row',
|
||||
fields: [
|
||||
{
|
||||
name: 'id',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
labels: {
|
||||
plural: 'Custom Row IDs',
|
||||
singular: 'Custom Row ID',
|
||||
},
|
||||
}
|
||||
30
test/fields/collections/CustomID/CustomTabID.ts
Normal file
30
test/fields/collections/CustomID/CustomTabID.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
import { customTabIDSlug } from '../../slugs.js'
|
||||
|
||||
export const CustomTabID: CollectionConfig = {
|
||||
slug: customTabIDSlug,
|
||||
admin: {
|
||||
useAsTitle: 'id',
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
type: 'tabs',
|
||||
tabs: [
|
||||
{
|
||||
fields: [
|
||||
{
|
||||
name: 'id',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
label: 'Tab 1',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
labels: {
|
||||
plural: 'Custom Tab IDs',
|
||||
singular: 'Custom Tab ID',
|
||||
},
|
||||
}
|
||||
@@ -14,7 +14,8 @@ import { initPayloadE2ENoConfig } from '../../../helpers/initPayloadE2ENoConfig.
|
||||
import { reInitializeDB } from '../../../helpers/reInitializeDB.js'
|
||||
import { RESTClient } from '../../../helpers/rest.js'
|
||||
import { TEST_TIMEOUT_LONG } from '../../../playwright.config.js'
|
||||
import { customIdSlug } from '../../slugs.js'
|
||||
import { customIDSlug, customRowIDSlug, customTabIDSlug } from '../../slugs.js'
|
||||
import { customRowID, customTabID, nonStandardID } from './shared.js'
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const currentFolder = path.dirname(filename)
|
||||
@@ -27,8 +28,10 @@ let client: RESTClient
|
||||
let page: Page
|
||||
let serverURL: string
|
||||
let url: AdminUrlUtil
|
||||
let customTabIDURL: AdminUrlUtil
|
||||
let customRowIDURL: AdminUrlUtil
|
||||
|
||||
describe('Radio', () => {
|
||||
describe('Custom IDs', () => {
|
||||
beforeAll(async ({ browser }, testInfo) => {
|
||||
testInfo.setTimeout(TEST_TIMEOUT_LONG)
|
||||
process.env.SEED_IN_CONFIG_ONINIT = 'false' // Makes it so the payload config onInit seed is not run. Otherwise, the seed would be run unnecessarily twice for the initial test run - once for beforeEach and once for onInit
|
||||
@@ -37,7 +40,9 @@ describe('Radio', () => {
|
||||
// prebuild,
|
||||
}))
|
||||
|
||||
url = new AdminUrlUtil(serverURL, customIdSlug)
|
||||
url = new AdminUrlUtil(serverURL, customIDSlug)
|
||||
customTabIDURL = new AdminUrlUtil(serverURL, customTabIDSlug)
|
||||
customRowIDURL = new AdminUrlUtil(serverURL, customRowIDSlug)
|
||||
|
||||
const context = await browser.newContext()
|
||||
page = await context.newPage()
|
||||
@@ -60,23 +65,22 @@ describe('Radio', () => {
|
||||
await ensureCompilationIsDone({ page, serverURL })
|
||||
})
|
||||
|
||||
function createCustomIDDoc(id: string) {
|
||||
return payload.create({
|
||||
collection: customIdSlug,
|
||||
data: {
|
||||
id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
test('allow create of non standard ID', async () => {
|
||||
await createCustomIDDoc('id 1')
|
||||
await page.goto(url.list)
|
||||
|
||||
await navigateToDoc(page, url)
|
||||
await expect(page.locator('#field-id')).toHaveValue(nonStandardID)
|
||||
await expect(page.locator('.id-label')).toContainText(nonStandardID)
|
||||
})
|
||||
|
||||
// Page should load and ID should be correct
|
||||
await expect(page.locator('#field-id')).toHaveValue('id 1')
|
||||
await expect(page.locator('.id-label')).toContainText('id 1')
|
||||
test('should use custom ID field nested within unnamed tab', async () => {
|
||||
await page.goto(customTabIDURL.edit(customTabID))
|
||||
const idField = page.locator('#field-id')
|
||||
await expect(idField).toHaveValue(customTabID)
|
||||
})
|
||||
|
||||
test('should use custom ID field nested within row', async () => {
|
||||
await page.goto(customRowIDURL.edit(customRowID))
|
||||
const idField = page.locator('#field-id')
|
||||
await expect(idField).toHaveValue(customRowID)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
import type { CollectionConfig } from 'payload'
|
||||
|
||||
import { customIdSlug } from '../../slugs.js'
|
||||
import { customIDSlug } from '../../slugs.js'
|
||||
|
||||
export const CustomIdCollection: CollectionConfig = {
|
||||
slug: customIdSlug,
|
||||
export const CustomID: CollectionConfig = {
|
||||
slug: customIDSlug,
|
||||
versions: true,
|
||||
admin: {
|
||||
useAsTitle: 'id',
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'id',
|
||||
type: 'text',
|
||||
},
|
||||
],
|
||||
labels: {
|
||||
plural: 'Custom IDs',
|
||||
singular: 'Custom ID',
|
||||
},
|
||||
}
|
||||
|
||||
3
test/fields/collections/CustomID/shared.ts
Normal file
3
test/fields/collections/CustomID/shared.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export const nonStandardID = 'id 1'
|
||||
export const customRowID = '111111111111111111111111'
|
||||
export const customTabID = '111111111111111111111111'
|
||||
@@ -12,7 +12,9 @@ import CheckboxFields from './collections/Checkbox/index.js'
|
||||
import CodeFields from './collections/Code/index.js'
|
||||
import CollapsibleFields from './collections/Collapsible/index.js'
|
||||
import ConditionalLogic from './collections/ConditionalLogic/index.js'
|
||||
import { CustomIdCollection } from './collections/CustomID/index.js'
|
||||
import { CustomRowID } from './collections/CustomID/CustomRowID.js'
|
||||
import { CustomTabID } from './collections/CustomID/CustomTabID.js'
|
||||
import { CustomID } from './collections/CustomID/index.js'
|
||||
import DateFields from './collections/Date/index.js'
|
||||
import EmailFields from './collections/Email/index.js'
|
||||
import GroupFields from './collections/Group/index.js'
|
||||
@@ -72,7 +74,9 @@ export const collectionSlugs: CollectionConfig[] = [
|
||||
CodeFields,
|
||||
CollapsibleFields,
|
||||
ConditionalLogic,
|
||||
CustomIdCollection,
|
||||
CustomID,
|
||||
CustomTabID,
|
||||
CustomRowID,
|
||||
DateFields,
|
||||
EmailFields,
|
||||
RadioFields,
|
||||
|
||||
@@ -41,6 +41,8 @@ export interface Config {
|
||||
'collapsible-fields': CollapsibleField;
|
||||
'conditional-logic': ConditionalLogic;
|
||||
'custom-id': CustomId;
|
||||
'custom-tab-id': CustomTabId;
|
||||
'custom-row-id': CustomRowId;
|
||||
'date-fields': DateField;
|
||||
'email-fields': EmailField;
|
||||
'radio-fields': RadioField;
|
||||
@@ -84,6 +86,8 @@ export interface Config {
|
||||
'collapsible-fields': CollapsibleFieldsSelect<false> | CollapsibleFieldsSelect<true>;
|
||||
'conditional-logic': ConditionalLogicSelect<false> | ConditionalLogicSelect<true>;
|
||||
'custom-id': CustomIdSelect<false> | CustomIdSelect<true>;
|
||||
'custom-tab-id': CustomTabIdSelect<false> | CustomTabIdSelect<true>;
|
||||
'custom-row-id': CustomRowIdSelect<false> | CustomRowIdSelect<true>;
|
||||
'date-fields': DateFieldsSelect<false> | DateFieldsSelect<true>;
|
||||
'email-fields': EmailFieldsSelect<false> | EmailFieldsSelect<true>;
|
||||
'radio-fields': RadioFieldsSelect<false> | RadioFieldsSelect<true>;
|
||||
@@ -935,6 +939,24 @@ export interface CustomId {
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "custom-tab-id".
|
||||
*/
|
||||
export interface CustomTabId {
|
||||
id: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "custom-row-id".
|
||||
*/
|
||||
export interface CustomRowId {
|
||||
id: string;
|
||||
updatedAt: string;
|
||||
createdAt: string;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "date-fields".
|
||||
@@ -1750,6 +1772,14 @@ export interface PayloadLockedDocument {
|
||||
relationTo: 'custom-id';
|
||||
value: string | CustomId;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'custom-tab-id';
|
||||
value: string | CustomTabId;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'custom-row-id';
|
||||
value: string | CustomRowId;
|
||||
} | null)
|
||||
| ({
|
||||
relationTo: 'date-fields';
|
||||
value: string | DateField;
|
||||
@@ -2083,42 +2113,257 @@ export interface BlockFieldsSelect<T extends boolean = true> {
|
||||
blocks?:
|
||||
| T
|
||||
| {
|
||||
content?: T | ContentBlockSelect<T>;
|
||||
number?: T | NumberBlockSelect<T>;
|
||||
subBlocks?: T | SubBlocksBlockSelect<T>;
|
||||
tabs?: T | TabsBlockSelect<T>;
|
||||
content?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
richText?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
number?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
subBlocks?:
|
||||
| T
|
||||
| {
|
||||
subBlocks?:
|
||||
| T
|
||||
| {
|
||||
text?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
number?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
tabs?:
|
||||
| T
|
||||
| {
|
||||
textInCollapsible?: T;
|
||||
textInRow?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
duplicate?:
|
||||
| T
|
||||
| {
|
||||
content?: T | ContentBlockSelect<T>;
|
||||
number?: T | NumberBlockSelect<T>;
|
||||
subBlocks?: T | SubBlocksBlockSelect<T>;
|
||||
tabs?: T | TabsBlockSelect<T>;
|
||||
content?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
richText?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
number?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
subBlocks?:
|
||||
| T
|
||||
| {
|
||||
subBlocks?:
|
||||
| T
|
||||
| {
|
||||
text?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
number?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
tabs?:
|
||||
| T
|
||||
| {
|
||||
textInCollapsible?: T;
|
||||
textInRow?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
collapsedByDefaultBlocks?:
|
||||
| T
|
||||
| {
|
||||
localizedContent?: T | LocalizedContentBlockSelect<T>;
|
||||
localizedNumber?: T | LocalizedNumberBlockSelect<T>;
|
||||
localizedSubBlocks?: T | LocalizedSubBlocksBlockSelect<T>;
|
||||
localizedTabs?: T | LocalizedTabsBlockSelect<T>;
|
||||
localizedContent?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
richText?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
localizedNumber?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
localizedSubBlocks?:
|
||||
| T
|
||||
| {
|
||||
subBlocks?:
|
||||
| T
|
||||
| {
|
||||
text?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
number?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
localizedTabs?:
|
||||
| T
|
||||
| {
|
||||
textInCollapsible?: T;
|
||||
textInRow?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
disableSort?:
|
||||
| T
|
||||
| {
|
||||
localizedContent?: T | LocalizedContentBlockSelect<T>;
|
||||
localizedNumber?: T | LocalizedNumberBlockSelect<T>;
|
||||
localizedSubBlocks?: T | LocalizedSubBlocksBlockSelect<T>;
|
||||
localizedTabs?: T | LocalizedTabsBlockSelect<T>;
|
||||
localizedContent?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
richText?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
localizedNumber?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
localizedSubBlocks?:
|
||||
| T
|
||||
| {
|
||||
subBlocks?:
|
||||
| T
|
||||
| {
|
||||
text?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
number?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
localizedTabs?:
|
||||
| T
|
||||
| {
|
||||
textInCollapsible?: T;
|
||||
textInRow?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
localizedBlocks?:
|
||||
| T
|
||||
| {
|
||||
localizedContent?: T | LocalizedContentBlockSelect<T>;
|
||||
localizedNumber?: T | LocalizedNumberBlockSelect<T>;
|
||||
localizedSubBlocks?: T | LocalizedSubBlocksBlockSelect<T>;
|
||||
localizedTabs?: T | LocalizedTabsBlockSelect<T>;
|
||||
localizedContent?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
richText?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
localizedNumber?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
localizedSubBlocks?:
|
||||
| T
|
||||
| {
|
||||
subBlocks?:
|
||||
| T
|
||||
| {
|
||||
text?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
number?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
localizedTabs?:
|
||||
| T
|
||||
| {
|
||||
textInCollapsible?: T;
|
||||
textInRow?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
i18nBlocks?:
|
||||
| T
|
||||
@@ -2256,116 +2501,6 @@ export interface BlockFieldsSelect<T extends boolean = true> {
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "ContentBlock_select".
|
||||
*/
|
||||
export interface ContentBlockSelect<T extends boolean = true> {
|
||||
text?: T;
|
||||
richText?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "NumberBlock_select".
|
||||
*/
|
||||
export interface NumberBlockSelect<T extends boolean = true> {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "SubBlocksBlock_select".
|
||||
*/
|
||||
export interface SubBlocksBlockSelect<T extends boolean = true> {
|
||||
subBlocks?:
|
||||
| T
|
||||
| {
|
||||
text?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
number?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "TabsBlock_select".
|
||||
*/
|
||||
export interface TabsBlockSelect<T extends boolean = true> {
|
||||
textInCollapsible?: T;
|
||||
textInRow?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "localizedContentBlock_select".
|
||||
*/
|
||||
export interface LocalizedContentBlockSelect<T extends boolean = true> {
|
||||
text?: T;
|
||||
richText?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "localizedNumberBlock_select".
|
||||
*/
|
||||
export interface LocalizedNumberBlockSelect<T extends boolean = true> {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "localizedSubBlocksBlock_select".
|
||||
*/
|
||||
export interface LocalizedSubBlocksBlockSelect<T extends boolean = true> {
|
||||
subBlocks?:
|
||||
| T
|
||||
| {
|
||||
text?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
number?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "localizedTabsBlock_select".
|
||||
*/
|
||||
export interface LocalizedTabsBlockSelect<T extends boolean = true> {
|
||||
textInCollapsible?: T;
|
||||
textInRow?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "checkbox-fields_select".
|
||||
@@ -2491,6 +2626,24 @@ export interface CustomIdSelect<T extends boolean = true> {
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "custom-tab-id_select".
|
||||
*/
|
||||
export interface CustomTabIdSelect<T extends boolean = true> {
|
||||
id?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "custom-row-id_select".
|
||||
*/
|
||||
export interface CustomRowIdSelect<T extends boolean = true> {
|
||||
id?: T;
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "date-fields_select".
|
||||
@@ -2928,10 +3081,53 @@ export interface TabsFieldsSelect<T extends boolean = true> {
|
||||
blocks?:
|
||||
| T
|
||||
| {
|
||||
content?: T | ContentBlockSelect<T>;
|
||||
number?: T | NumberBlockSelect<T>;
|
||||
subBlocks?: T | SubBlocksBlockSelect<T>;
|
||||
tabs?: T | TabsBlockSelect<T>;
|
||||
content?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
richText?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
number?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
subBlocks?:
|
||||
| T
|
||||
| {
|
||||
subBlocks?:
|
||||
| T
|
||||
| {
|
||||
text?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
number?:
|
||||
| T
|
||||
| {
|
||||
number?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
tabs?:
|
||||
| T
|
||||
| {
|
||||
textInCollapsible?: T;
|
||||
textInRow?: T;
|
||||
id?: T;
|
||||
blockName?: T;
|
||||
};
|
||||
};
|
||||
group?:
|
||||
| T
|
||||
@@ -2941,7 +3137,24 @@ export interface TabsFieldsSelect<T extends boolean = true> {
|
||||
textInRow?: T;
|
||||
numberInRow?: T;
|
||||
json?: T;
|
||||
tab?: T | TabWithNameSelect<T>;
|
||||
tab?:
|
||||
| T
|
||||
| {
|
||||
array?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
id?: T;
|
||||
};
|
||||
text?: T;
|
||||
defaultValue?: T;
|
||||
arrayInRow?:
|
||||
| T
|
||||
| {
|
||||
textInArrayInRow?: T;
|
||||
id?: T;
|
||||
};
|
||||
};
|
||||
namedTabWithDefaultValue?:
|
||||
| T
|
||||
| {
|
||||
@@ -2991,26 +3204,6 @@ export interface TabsFieldsSelect<T extends boolean = true> {
|
||||
updatedAt?: T;
|
||||
createdAt?: T;
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "TabWithName_select".
|
||||
*/
|
||||
export interface TabWithNameSelect<T extends boolean = true> {
|
||||
array?:
|
||||
| T
|
||||
| {
|
||||
text?: T;
|
||||
id?: T;
|
||||
};
|
||||
text?: T;
|
||||
defaultValue?: T;
|
||||
arrayInRow?:
|
||||
| T
|
||||
| {
|
||||
textInArrayInRow?: T;
|
||||
id?: T;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* This interface was referenced by `Config`'s JSON-Schema
|
||||
* via the `definition` "text-fields_select".
|
||||
|
||||
@@ -11,6 +11,7 @@ import { blocksDoc } from './collections/Blocks/shared.js'
|
||||
import { codeDoc } from './collections/Code/shared.js'
|
||||
import { collapsibleDoc } from './collections/Collapsible/shared.js'
|
||||
import { conditionalLogicDoc } from './collections/ConditionalLogic/shared.js'
|
||||
import { customRowID, customTabID, nonStandardID } from './collections/CustomID/shared.js'
|
||||
import { dateDoc } from './collections/Date/shared.js'
|
||||
import { anotherEmailDoc, emailDoc } from './collections/Email/shared.js'
|
||||
import { groupDoc } from './collections/Group/shared.js'
|
||||
@@ -34,6 +35,9 @@ import {
|
||||
collapsibleFieldsSlug,
|
||||
collectionSlugs,
|
||||
conditionalLogicSlug,
|
||||
customIDSlug,
|
||||
customRowIDSlug,
|
||||
customTabIDSlug,
|
||||
dateFieldsSlug,
|
||||
emailFieldsSlug,
|
||||
groupFieldsSlug,
|
||||
@@ -491,6 +495,27 @@ export const seed = async (_payload: Payload) => {
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
await Promise.all([
|
||||
_payload.create({
|
||||
collection: customIDSlug,
|
||||
data: {
|
||||
id: nonStandardID,
|
||||
},
|
||||
}),
|
||||
_payload.create({
|
||||
collection: customTabIDSlug,
|
||||
data: {
|
||||
id: customTabID,
|
||||
},
|
||||
}),
|
||||
_payload.create({
|
||||
collection: customRowIDSlug,
|
||||
data: {
|
||||
id: customRowID,
|
||||
},
|
||||
}),
|
||||
])
|
||||
}
|
||||
|
||||
export async function clearAndSeedEverything(_payload: Payload) {
|
||||
|
||||
@@ -5,7 +5,9 @@ export const checkboxFieldsSlug = 'checkbox-fields'
|
||||
export const codeFieldsSlug = 'code-fields'
|
||||
export const collapsibleFieldsSlug = 'collapsible-fields'
|
||||
export const conditionalLogicSlug = 'conditional-logic'
|
||||
export const customIdSlug = 'custom-id'
|
||||
export const customIDSlug = 'custom-id'
|
||||
export const customRowIDSlug = 'custom-row-id'
|
||||
export const customTabIDSlug = 'custom-tab-id'
|
||||
export const dateFieldsSlug = 'date-fields'
|
||||
export const emailFieldsSlug = 'email-fields'
|
||||
export const groupFieldsSlug = 'group-fields'
|
||||
|
||||
Reference in New Issue
Block a user