### What? Adds a new `formatDocURL` function to collection admin configuration that allows users to control the linkable state and URLs of first column fields in list views. ### Why? To provide a way to disable automatic link creation from the first column or provide custom URLs based on document data, user permissions, view context, and document state. ### How? - Added `formatDocURL` function type to `CollectionAdminOptions` that receives document data, default URL, request context, collection slug, and view type - Modified `renderCell` to call the function when available and handle three return types: - `null`: disables linking entirely - `string`: uses custom URL - other: falls back to no linking for safety - Added function to server-only properties to prevent React Server Components serialization issues - Updated `DefaultCell` component to support custom `linkURL` prop --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1211211792037945
69 lines
2.5 KiB
TypeScript
69 lines
2.5 KiB
TypeScript
export const usersCollectionSlug = 'users'
|
|
export const customViews1CollectionSlug = 'custom-views-one'
|
|
export const customViews2CollectionSlug = 'custom-views-two'
|
|
export const reorderTabsSlug = 'reorder-tabs'
|
|
export const geoCollectionSlug = 'geo'
|
|
export const arrayCollectionSlug = 'array'
|
|
export const postsCollectionSlug = 'posts'
|
|
export const group1Collection1Slug = 'group-one-collection-ones'
|
|
export const group1Collection2Slug = 'group-one-collection-twos'
|
|
export const group2Collection1Slug = 'group-two-collection-ones'
|
|
export const group2Collection2Slug = 'group-two-collection-twos'
|
|
|
|
export const useAsTitleGroupFieldSlug = 'use-as-title-group-field'
|
|
export const hiddenCollectionSlug = 'hidden-collection'
|
|
export const notInViewCollectionSlug = 'not-in-view-collection'
|
|
export const noApiViewCollectionSlug = 'collection-no-api-view'
|
|
export const disableDuplicateSlug = 'disable-duplicate'
|
|
export const disableCopyToLocale = 'disable-copy-to-locale'
|
|
export const uploadCollectionSlug = 'uploads'
|
|
export const placeholderCollectionSlug = 'placeholder'
|
|
|
|
export const uploadTwoCollectionSlug = 'uploads-two'
|
|
export const customFieldsSlug = 'custom-fields'
|
|
|
|
export const listDrawerSlug = 'with-list-drawer'
|
|
export const virtualsSlug = 'virtuals'
|
|
export const formatDocURLCollectionSlug = 'format-doc-url'
|
|
export const collectionSlugs = [
|
|
usersCollectionSlug,
|
|
customViews1CollectionSlug,
|
|
customViews2CollectionSlug,
|
|
geoCollectionSlug,
|
|
arrayCollectionSlug,
|
|
postsCollectionSlug,
|
|
group1Collection1Slug,
|
|
group1Collection2Slug,
|
|
group2Collection1Slug,
|
|
group2Collection2Slug,
|
|
hiddenCollectionSlug,
|
|
noApiViewCollectionSlug,
|
|
customFieldsSlug,
|
|
disableDuplicateSlug,
|
|
listDrawerSlug,
|
|
virtualsSlug,
|
|
formatDocURLCollectionSlug,
|
|
]
|
|
|
|
export const customGlobalViews1GlobalSlug = 'custom-global-views-one'
|
|
export const customGlobalViews2GlobalSlug = 'custom-global-views-two'
|
|
export const globalSlug = 'global'
|
|
export const group1GlobalSlug = 'group-globals-one'
|
|
export const group2GlobalSlug = 'group-globals-two'
|
|
export const hiddenGlobalSlug = 'hidden-global'
|
|
|
|
export const notInViewGlobalSlug = 'not-in-view-global'
|
|
export const settingsGlobalSlug = 'settings'
|
|
export const noApiViewGlobalSlug = 'global-no-api-view'
|
|
export const globalSlugs = [
|
|
customGlobalViews1GlobalSlug,
|
|
customGlobalViews2GlobalSlug,
|
|
globalSlug,
|
|
group1GlobalSlug,
|
|
group2GlobalSlug,
|
|
hiddenGlobalSlug,
|
|
noApiViewGlobalSlug,
|
|
]
|
|
export const with300DocumentsSlug = 'with300documents'
|
|
export const editMenuItemsSlug = 'edit-menu-items'
|