From fdc5418b4a12775819a0caafad580236afa7a607 Mon Sep 17 00:00:00 2001 From: xliez Date: Mon, 11 Mar 2024 12:29:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(QueryFilter):=20=E4=BF=AE=E5=A4=8D=20ProFor?= =?UTF-8?q?mDependency=20=E5=9C=A8=20QueryFilter=20=E4=B8=AD=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98=20(#8212)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/form/src/layouts/QueryFilter/index.tsx | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/packages/form/src/layouts/QueryFilter/index.tsx b/packages/form/src/layouts/QueryFilter/index.tsx index e68309d31eb6..cd86577b6310 100644 --- a/packages/form/src/layouts/QueryFilter/index.tsx +++ b/packages/form/src/layouts/QueryFilter/index.tsx @@ -200,21 +200,12 @@ export type BaseQueryFilterProps = Omit< const flatMapItems = ( items: React.ReactNode[], ignoreRules?: boolean, - form?: FormInstance, ): React.ReactNode[] => { return items?.flatMap((item: any) => { if (item?.type.displayName === 'ProForm-Group' && !item.props?.title) { return item.props.children; } - if (item?.type.displayName === 'ProFormDependency' && !item.props?.title) { - const values = item.props.name.reduce((current: any, next: any) => { - return { - ...current, - [next]: form?.getFieldValue(next), - }; - }, {}); - return item.props.children(values); - } + if (ignoreRules && React.isValidElement(item)) { return React.cloneElement(item, { ...(item.props as any), @@ -290,7 +281,6 @@ const QueryFilterContent: React.FC<{ showLength, searchGutter, showHiddenNum, - form, } = props; const submitter = useMemo(() => { @@ -330,7 +320,7 @@ const QueryFilterContent: React.FC<{ let currentSpan = 0; // 处理过,包含是否需要隐藏的 数组 - const processedList = flatMapItems(items, props.ignoreRules, form).map( + const processedList = flatMapItems(items, props.ignoreRules).map( ( item, index,