diff --git a/docs/admin/fields.mdx b/docs/admin/fields.mdx index f13eb6c81a..73ac795fcc 100644 --- a/docs/admin/fields.mdx +++ b/docs/admin/fields.mdx @@ -228,7 +228,6 @@ The following additional properties are also provided to the `field` prop: | Property | Description | | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **`_isPresentational`** | A boolean indicating that the field is purely visual and does not directly affect data or change data shape, i.e. the [UI Field](../fields/ui). | | **`_path`** | A string representing the direct, dynamic path to the field at runtime, i.e. `myGroup.myArray[0].myField`. | | **`_schemaPath`** | A string representing the direct, static path to the [Field Config](../fields/overview), i.e. `myGroup.myArray.myField` | diff --git a/packages/payload/src/fields/config/client.ts b/packages/payload/src/fields/config/client.ts index 0195f20a5f..257f4a4b0d 100644 --- a/packages/payload/src/fields/config/client.ts +++ b/packages/payload/src/fields/config/client.ts @@ -75,10 +75,6 @@ export const createClientField = ({ } }) - if (fieldIsPresentationalOnly(incomingField)) { - clientField._isPresentational = true - } - const isHidden = 'hidden' in incomingField && incomingField?.hidden const disabledFromAdmin = incomingField?.admin && 'disabled' in incomingField.admin && incomingField.admin.disabled diff --git a/packages/payload/src/fields/config/types.ts b/packages/payload/src/fields/config/types.ts index a9df0fcd97..cd273a0dc8 100644 --- a/packages/payload/src/fields/config/types.ts +++ b/packages/payload/src/fields/config/types.ts @@ -422,7 +422,6 @@ export interface FieldBase { } export interface FieldBaseClient { - _isPresentational?: undefined admin?: AdminClient hidden?: boolean index?: boolean @@ -779,7 +778,6 @@ export type UIField = { } export type UIFieldClient = { - _isPresentational?: true // still include FieldBaseClient.admin (even if it's undefinable) so that we don't need constant type checks (e.g. if('xy' in field)) admin: DeepUndefinable & @@ -787,7 +785,7 @@ export type UIFieldClient = { UIField['admin'], 'custom' | 'disableBulkEdit' | 'disableListColumn' | 'position' | 'width' > -} & Omit, '_isPresentational' | 'admin'> & // still include FieldBaseClient (even if it's undefinable) so that we don't need constant type checks (e.g. if('xy' in field)) +} & Omit, 'admin'> & // still include FieldBaseClient (even if it's undefinable) so that we don't need constant type checks (e.g. if('xy' in field)) Pick type SharedUploadProperties = { diff --git a/packages/ui/src/elements/Table/DefaultCell/fields/File/index.tsx b/packages/ui/src/elements/Table/DefaultCell/fields/File/index.tsx index e98f8be20c..cad4e99a33 100644 --- a/packages/ui/src/elements/Table/DefaultCell/fields/File/index.tsx +++ b/packages/ui/src/elements/Table/DefaultCell/fields/File/index.tsx @@ -1,5 +1,5 @@ 'use client' -import type { DefaultCellComponentProps, UploadFieldClient } from 'payload' +import type { DefaultCellComponentProps, TextFieldClient } from 'payload' import React from 'react' @@ -8,7 +8,7 @@ import './index.scss' const baseClass = 'file' -export interface FileCellProps extends DefaultCellComponentProps {} +export interface FileCellProps extends DefaultCellComponentProps {} export const FileCell: React.FC = ({ cellData: filename, diff --git a/packages/ui/src/elements/Table/DefaultCell/index.tsx b/packages/ui/src/elements/Table/DefaultCell/index.tsx index 53142816cb..54a8ea4091 100644 --- a/packages/ui/src/elements/Table/DefaultCell/index.tsx +++ b/packages/ui/src/elements/Table/DefaultCell/index.tsx @@ -83,7 +83,16 @@ export const DefaultCell: React.FC = (props) => { if ('name' in field && field.name === 'id') { return ( - + ) } @@ -97,7 +106,12 @@ export const DefaultCell: React.FC = (props) => { CellComponent = } else if (!DefaultCellComponent) { // DefaultCellComponent does not exist for certain field types like `text` - if (collectionConfig?.upload && fieldAffectsData(field) && field.name === 'filename') { + if ( + collectionConfig?.upload && + fieldAffectsData(field) && + field.name === 'filename' && + field.type === 'text' + ) { const FileCellComponent = cellComponents.File CellComponent = ( @@ -105,6 +119,8 @@ export const DefaultCell: React.FC = (props) => { cellData={cellData} rowData={rowData} {...(props as DefaultCellComponentProps)} + collectionConfig={collectionConfig} + field={field} /> ) } else {