Fixes #10234. Some fields, such as focal point fields for upload enabled collections, were rendering in the condition selector despite being hidden from the column selector. This was because the logic for the column selector was filtering fields without labels, but the same was not being done for the filter conditions. This, however, is not a good way to filter these fields as it requires this specific logic to be written in multiple places. Instead, they need to explicitly check for `hidden` and `disabled` in addition to `disableListFilter` and `disableListColumn`. The actual filtering logic has been improved across the two instances as well, removing multiple duplicative loops. This change has also exposed a underlying issue with the way columns were handled within the table columns provider. When row selections were enabled, the selector columns were present in column state. This caused problems when interacting with column indices, such as when reordering columns. Instead of needing to manually filter these out every time we need to work with column state, they no longer appear there in the first place. Instead, we inject the row selectors directly into the table itself, completely isolating these row selectors from the column state.
130 lines
3.0 KiB
TypeScript
130 lines
3.0 KiB
TypeScript
import type { Payload } from 'payload'
|
|
|
|
import { devUser } from '../credentials.js'
|
|
import { executePromises } from '../helpers/executePromises.js'
|
|
import { seedDB } from '../helpers/seed.js'
|
|
import {
|
|
collectionSlugs,
|
|
customViews1CollectionSlug,
|
|
customViews2CollectionSlug,
|
|
geoCollectionSlug,
|
|
noApiViewCollectionSlug,
|
|
postsCollectionSlug,
|
|
usersCollectionSlug,
|
|
} from './slugs.js'
|
|
|
|
export const seed = async (_payload) => {
|
|
await executePromises(
|
|
[
|
|
() =>
|
|
_payload.create({
|
|
collection: usersCollectionSlug,
|
|
data: {
|
|
email: devUser.email,
|
|
password: devUser.password,
|
|
},
|
|
depth: 0,
|
|
overrideAccess: true,
|
|
}),
|
|
() =>
|
|
_payload.create({
|
|
collection: 'base-list-filters',
|
|
data: {
|
|
title: 'show me',
|
|
},
|
|
depth: 0,
|
|
overrideAccess: true,
|
|
}),
|
|
() =>
|
|
_payload.create({
|
|
collection: 'base-list-filters',
|
|
data: {
|
|
title: 'hide me',
|
|
},
|
|
depth: 0,
|
|
overrideAccess: true,
|
|
}),
|
|
...[...Array(11)].map((_, i) => async () => {
|
|
const postDoc = await _payload.create({
|
|
collection: postsCollectionSlug,
|
|
data: {
|
|
description: 'Description',
|
|
title: `Post ${i + 1}`,
|
|
disableListColumnText: 'Disable List Column Text',
|
|
disableListFilterText: 'Disable List Filter Text',
|
|
},
|
|
depth: 0,
|
|
overrideAccess: true,
|
|
})
|
|
|
|
return await _payload.update({
|
|
collection: postsCollectionSlug,
|
|
where: {
|
|
id: {
|
|
equals: postDoc.id,
|
|
},
|
|
},
|
|
data: {
|
|
relationship: postDoc.id,
|
|
},
|
|
depth: 0,
|
|
overrideAccess: true,
|
|
})
|
|
}),
|
|
() =>
|
|
_payload.create({
|
|
collection: customViews1CollectionSlug,
|
|
data: {
|
|
title: 'Custom View',
|
|
},
|
|
depth: 0,
|
|
overrideAccess: true,
|
|
}),
|
|
() =>
|
|
_payload.create({
|
|
collection: customViews2CollectionSlug,
|
|
data: {
|
|
title: 'Custom View',
|
|
},
|
|
depth: 0,
|
|
overrideAccess: true,
|
|
}),
|
|
() =>
|
|
_payload.create({
|
|
collection: geoCollectionSlug,
|
|
data: {
|
|
point: [7, -7],
|
|
},
|
|
depth: 0,
|
|
overrideAccess: true,
|
|
}),
|
|
() =>
|
|
_payload.create({
|
|
collection: geoCollectionSlug,
|
|
data: {
|
|
point: [5, -5],
|
|
},
|
|
depth: 0,
|
|
overrideAccess: true,
|
|
}),
|
|
() =>
|
|
_payload.create({
|
|
collection: noApiViewCollectionSlug,
|
|
data: {},
|
|
depth: 0,
|
|
overrideAccess: true,
|
|
}),
|
|
],
|
|
false,
|
|
)
|
|
}
|
|
|
|
export async function clearAndSeedEverything(_payload: Payload) {
|
|
return await seedDB({
|
|
_payload,
|
|
collectionSlugs,
|
|
seedFunction: seed,
|
|
snapshotKey: 'adminTests',
|
|
})
|
|
}
|