From f0a0505695a2eecd71ac69fc03bef628da3759c0 Mon Sep 17 00:00:00 2001 From: wjh Date: Thu, 11 Apr 2024 11:50:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E5=88=AB=E7=9A=84=E5=8C=BA=E5=9D=97=E5=90=8E?= =?UTF-8?q?=E5=87=BA=E9=94=99=20=E4=BF=AE=E5=A4=8D=E5=8D=95=E9=80=89?= =?UTF-8?q?=E6=A1=86=E7=82=B9=E5=87=BB=E5=87=BA=E9=94=99=20(#680)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.daoyoucloud.com/daoyoucloud/tachycode/pulls/680 Co-authored-by: wjh Co-committed-by: wjh --- .../components/field-item/TabSearchFieldItemProps.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSearchFieldItemProps.ts b/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSearchFieldItemProps.ts index d6b9c79e6..9c87c4436 100644 --- a/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSearchFieldItemProps.ts +++ b/packages/plugins/@hera/plugin-mobile/src/client/schma-component/tab-search/components/field-item/TabSearchFieldItemProps.ts @@ -8,11 +8,13 @@ import { canBeOptionalField } from '../../utils'; export const useTabSearchFieldItemProps = () => { const fieldSchema = useFieldSchema(); const collection = useCollection(); + const optionalFieldList = useOptionalFieldList(); const cm = useCollectionManager(); const collectionField = useMemo(() => collection?.getField(fieldSchema.name as any), [collection, fieldSchema.name]); const { onSelected } = useTabSearchCollapsibleInputItem(); const result = { list: null, valueKey: '', labelKey: '', filterKey: '' }; + if (!collection) return; result.valueKey = collectionField?.target ? cm.getCollection(collectionField.target)?.getPrimaryKey() : 'id'; result.labelKey = fieldSchema['x-component-props']?.fieldNames?.label || result.valueKey; const fieldInterface = fieldSchema['x-component-props'].interface; @@ -21,9 +23,10 @@ export const useTabSearchFieldItemProps = () => { const operatorMap = { select: '$in', multipleSelect: '$anyOf', - checkbox: '$in', checkboxGroup: '$anyOf', + radioGroup: '$in', }; + const _list = field?.uiSchema?.enum || []; result.valueKey = 'value'; result.labelKey = 'label';