diff --git a/packages/core/client/src/schema-component/antd/filter/Filter.Action.Designer.tsx b/packages/core/client/src/schema-component/antd/filter/Filter.Action.Designer.tsx index db2cf9af4..049d6c78d 100644 --- a/packages/core/client/src/schema-component/antd/filter/Filter.Action.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/filter/Filter.Action.Designer.tsx @@ -1,8 +1,10 @@ import { ISchema, useField, useFieldSchema } from '@formily/react'; import React from 'react'; +import { useTranslation } from 'react-i18next'; import { useDesignable } from '../..'; import { useCollection, useCollectionManager } from '../../../collection-manager'; import { GeneralSchemaDesigner, SchemaSettings } from '../../../schema-settings'; +import { useCompile } from '../../hooks'; export const useFilterableFields = (collectionName: string) => { const { getCollectionFields, getInterface } = useCollectionManager(); @@ -25,16 +27,18 @@ export const FilterActionDesigner = (props) => { const { dn } = useDesignable(); const { name } = useCollection(); const fields = useFilterableFields(name); + const compile = useCompile(); + const { t } = useTranslation(); const nonfilterable = fieldSchema?.['x-component-props']?.nonfilterable || []; return ( - + {fields.map((field) => { const checked = !nonfilterable.includes(field.name); return ( { fieldSchema['x-component-props'] = fieldSchema?.['x-component-props'] || {}; const nonfilterable = fieldSchema?.['x-component-props']?.nonfilterable || []; diff --git a/packages/core/client/src/schema-component/antd/filter/useFilterActionProps.ts b/packages/core/client/src/schema-component/antd/filter/useFilterActionProps.ts index 128a3cef2..e3bc604fd 100644 --- a/packages/core/client/src/schema-component/antd/filter/useFilterActionProps.ts +++ b/packages/core/client/src/schema-component/antd/filter/useFilterActionProps.ts @@ -11,7 +11,7 @@ export const useFilterOptions = (collectionName: string) => { const { getCollectionFields, getInterface } = useCollectionManager(); const fields = getCollectionFields(collectionName); const field2option = (field, depth) => { - if (nonfilterable.length && depth !== 1 && nonfilterable.includes(field.name)) { + if (nonfilterable.length && depth === 1 && nonfilterable.includes(field.name)) { return; } if (!field.interface) {