fix(ui): properly handles ID field component type based on payload.db.defaultIDType (#7416)
## Description Fixes #7354 Since the `defaultIDType` for IDs in `postgres` are of type `number` - the `contains` operator should be available in the filter options. This PR checks the `defaultIDType` of ID and properly outputs the correct component type for IDs I.e if ID is of type `number` - the filter operators for ID should correspond to the the operators of type number as well The `contains` operator only belongs on fields of type string, aka of component type `text` - [x] I have read and understand the [CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md) document in this repository. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [x] Existing test suite passes locally with my changes
This commit is contained in:
@@ -12,7 +12,7 @@ import { defaultLeaves as leafTypes } from './field/leaves/index.js'
|
||||
|
||||
export const getGenerateComponentMap =
|
||||
(args: AdapterArguments): RichTextAdapter['generateComponentMap'] =>
|
||||
({ WithServerSideProps, config, i18n }) => {
|
||||
({ WithServerSideProps, config, i18n, payload }) => {
|
||||
const componentMap = new Map()
|
||||
|
||||
;(args?.admin?.leaves || Object.values(leafTypes)).forEach((leaf) => {
|
||||
@@ -67,6 +67,7 @@ export const getGenerateComponentMap =
|
||||
config,
|
||||
fieldSchema: args.admin?.link?.fields as Field[],
|
||||
i18n,
|
||||
payload,
|
||||
readOnly: false,
|
||||
})
|
||||
|
||||
@@ -93,6 +94,7 @@ export const getGenerateComponentMap =
|
||||
config,
|
||||
fieldSchema: args?.admin?.upload?.collections[collection.slug]?.fields,
|
||||
i18n,
|
||||
payload,
|
||||
readOnly: false,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user