feat: custom view and document-level metadata (#7716)

This commit is contained in:
Jacob Fletcher
2024-08-18 23:22:38 -04:00
committed by GitHub
parent 2835e1d709
commit a526c7becd
25 changed files with 645 additions and 281 deletions

View File

@@ -206,6 +206,7 @@ export type { RowLabel, RowLabelComponent } from './forms/RowLabel.js'
export type {
AdminViewComponent,
AdminViewConfig,
AdminViewProps,
EditViewProps,
InitPageResult,

View File

@@ -4,7 +4,7 @@ import type { Permissions } from '../../auth/index.js'
import type { ImportMap } from '../../bin/generateImportMap/index.js'
import type { SanitizedCollectionConfig } from '../../collections/config/types.js'
import type { ClientConfig } from '../../config/client.js'
import type { Locale, PayloadComponent } from '../../config/types.js'
import type { Locale, MetaConfig, PayloadComponent } from '../../config/types.js'
import type { SanitizedGlobalConfig } from '../../globals/config/types.js'
import type { PayloadRequest } from '../../types/index.js'
import type { LanguageOptions } from '../LanguageOptions.js'
@@ -14,6 +14,7 @@ export type AdminViewConfig = {
Component: AdminViewComponent
/** Whether the path should be matched exactly or as a prefix */
exact?: boolean
meta?: MetaConfig
path?: string
sensitive?: boolean
strict?: boolean

View File

@@ -24,6 +24,7 @@ import type {
GeneratePreviewURL,
LabelFunction,
LivePreviewConfig,
MetaConfig,
OpenGraphConfig,
PayloadComponent,
StaticLabel,
@@ -329,10 +330,7 @@ export type CollectionAdminOptions = {
* Live preview options
*/
livePreview?: LivePreviewConfig
meta?: {
description?: string
openGraph?: OpenGraphConfig
}
meta?: MetaConfig
pagination?: {
defaultLimit?: number
limits?: number[]

View File

@@ -375,7 +375,9 @@ export type Endpoint = {
export type EditViewComponent = PayloadComponent<ServerSideEditViewProps>
export type EditViewConfig =
export type EditViewConfig = {
meta?: MetaConfig
} & (
| {
Component: EditViewComponent
path?: string
@@ -393,6 +395,7 @@ export type EditViewConfig =
*/
tab?: DocumentTabConfig
}
)
export type ServerProps = {
[key: string]: unknown

View File

@@ -15,6 +15,7 @@ import type {
EntityDescriptionComponent,
GeneratePreviewURL,
LivePreviewConfig,
MetaConfig,
OpenGraphConfig,
} from '../../config/types.js'
import type { DBIdentifierName } from '../../database/types.js'
@@ -128,10 +129,7 @@ export type GlobalAdminOptions = {
* Live preview options
*/
livePreview?: LivePreviewConfig
meta?: {
description?: string
openGraph?: OpenGraphConfig
}
meta?: MetaConfig
/**
* Function to generate custom preview URL
*/