feat: adds disableGroupBy to fields admin props (#14017)
### What? Adds a new `disableGroupBy` admin config property for fields to control their visibility in the list view GroupBy dropdown. ### Why Previously, the GroupByBuilder was incorrectly using `disableListFilter` to determine which fields to show in the group-by dropdown. ### How - Added new `disableGroupBy` property to the field admin config types. - Updated `GroupByBuilder` to filter fields based on `disableGroupBy` instead of `disableListFilter` --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1211511898438807
This commit is contained in:
@@ -22,6 +22,14 @@ export const PostsCollection: CollectionConfig = {
|
||||
type: 'relationship',
|
||||
relationTo: categoriesSlug,
|
||||
},
|
||||
{
|
||||
name: 'virtualTitleFromCategory',
|
||||
type: 'text',
|
||||
virtual: 'category.title',
|
||||
admin: {
|
||||
disableGroupBy: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'checkbox',
|
||||
type: 'checkbox',
|
||||
|
||||
@@ -804,6 +804,20 @@ test.describe('Group By', () => {
|
||||
).toBeVisible()
|
||||
})
|
||||
|
||||
test('should hide field from groupBy options when admin.disableGroupBy is true', async () => {
|
||||
await page.goto(url.list)
|
||||
const { groupByContainer } = await openGroupBy(page)
|
||||
|
||||
const field = groupByContainer.locator('#group-by--field-select')
|
||||
await field.click()
|
||||
|
||||
await expect(
|
||||
field.locator('.rs__option', {
|
||||
hasText: exactText('Virtual Title From Category'),
|
||||
}),
|
||||
).toBeHidden()
|
||||
})
|
||||
|
||||
test.describe('Trash', () => {
|
||||
test('should show trashed docs in trash view when group-by is active', async () => {
|
||||
await page.goto(url.list)
|
||||
|
||||
@@ -127,6 +127,7 @@ export interface Post {
|
||||
id: string;
|
||||
title?: string | null;
|
||||
category?: (string | null) | Category;
|
||||
virtualTitleFromCategory?: string | null;
|
||||
checkbox?: boolean | null;
|
||||
date?: string | null;
|
||||
tab1Field?: string | null;
|
||||
@@ -321,6 +322,7 @@ export interface PayloadMigration {
|
||||
export interface PostsSelect<T extends boolean = true> {
|
||||
title?: T;
|
||||
category?: T;
|
||||
virtualTitleFromCategory?: T;
|
||||
checkbox?: T;
|
||||
date?: T;
|
||||
tab1Field?: T;
|
||||
|
||||
Reference in New Issue
Block a user