From 362a83804eaee9d172389fb0f0448af3cad25f4f Mon Sep 17 00:00:00 2001 From: Katherine Date: Thu, 20 Jun 2024 14:40:54 +0800 Subject: [PATCH] fix(grid): grid style (#4715) * fix: grid style * fix: bug --- .../antd/action/ActionBar.tsx | 2 +- .../schema-component/antd/form-v2/Form.tsx | 9 +- .../src/schema-component/antd/form-v2/hook.ts | 13 +-- .../src/schema-component/antd/grid/Grid.tsx | 88 +++++++++---------- 4 files changed, 50 insertions(+), 62 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/action/ActionBar.tsx b/packages/core/client/src/schema-component/antd/action/ActionBar.tsx index 62c10bb57a..ac17ee46d8 100644 --- a/packages/core/client/src/schema-component/antd/action/ActionBar.tsx +++ b/packages/core/client/src/schema-component/antd/action/ActionBar.tsx @@ -73,7 +73,7 @@ export const ActionBar = withDynamicSchemaProps(
diff --git a/packages/core/client/src/schema-component/antd/form-v2/Form.tsx b/packages/core/client/src/schema-component/antd/form-v2/Form.tsx index b1e017ca51..33b4171253 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/Form.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/Form.tsx @@ -52,14 +52,11 @@ const FormComponent: React.FC = (props) => {
diff --git a/packages/core/client/src/schema-component/antd/form-v2/hook.ts b/packages/core/client/src/schema-component/antd/form-v2/hook.ts index 4e536910c1..82828ccfa3 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/hook.ts +++ b/packages/core/client/src/schema-component/antd/form-v2/hook.ts @@ -29,23 +29,14 @@ export const useFormBlockHeight = () => { } return buf; }); - const isFilterForm = schema.parent?.['x-decorator'] === 'FilterFormBlockProvider'; - const isDetailForm = schema.parent?.['x-decorator'] === 'DetailsBlockProvider'; const hasFormActions = Object.keys(actionSchema?.properties || {}).length > 0; - const unDesignableActionBar = () => { - return token.marginLG; - }; - const actionBarHeight = - hasFormActions || designable - ? token.controlHeight + - (isFilterForm || !isDetailForm ? (designable ? 2 : 1) * token.marginLG : 2 * token.marginLG) - : unDesignableActionBar(); + const actionBarHeight = hasFormActions || designable ? token.controlHeight + 2 * token.marginLG : 2 * token.marginLG; const blockTitleHeaderHeight = title ? token.fontSizeLG * token.lineHeightLG + token.padding * 2 - 1 : 0; const { data } = useDataBlockRequest() || {}; const { count, pageSize } = (data as any)?.meta || ({} as any); const hasPagination = count > pageSize; - const paginationHeight = hasPagination ? token.controlHeightSM + (designable ? 1 : 0) * token.paddingLG : 0; + const paginationHeight = hasPagination ? token.controlHeightSM + 1 * token.paddingLG : 0; const dataTemplateHeight = display && enabled ? token.controlHeight + 2 * token.padding + token.margin : 0; return height - actionBarHeight - token.paddingLG - blockTitleHeaderHeight - paginationHeight - dataTemplateHeight; }; diff --git a/packages/core/client/src/schema-component/antd/grid/Grid.tsx b/packages/core/client/src/schema-component/antd/grid/Grid.tsx index 45df2e5b5d..9d2d29a475 100644 --- a/packages/core/client/src/schema-component/antd/grid/Grid.tsx +++ b/packages/core/client/src/schema-component/antd/grid/Grid.tsx @@ -361,57 +361,57 @@ export const Grid: any = observer(
-
- - {showDivider ? ( - - ) : null} - {rows.map((schema, index) => { - return ( - - {distributedValue ? ( - - ) : ( - - )} - {showDivider ? ( - - ) : null} - - ); - })} - - {render()} +
+
+ + {showDivider ? ( + + ) : null} + {rows.map((schema, index) => { + return ( + + {distributedValue ? ( + + ) : ( + + )} + {showDivider ? ( + + ) : null} + + ); + })} + + {render()} +