From e8c2bffe20cb37ebd35c7da25ad290d812306001 Mon Sep 17 00:00:00 2001 From: Katherine Date: Thu, 13 Jun 2024 10:41:27 +0800 Subject: [PATCH] style(client): grid style improve (#4647) * style: grid style improve * refactor: remove min height for block heght * fix: min height --- .../antd/block-item/BlockItem.tsx | 21 +------------------ .../src/schema-component/antd/grid/Grid.tsx | 18 ++++++++++++++-- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/block-item/BlockItem.tsx b/packages/core/client/src/schema-component/antd/block-item/BlockItem.tsx index 2b9a4c0724..1b348571d5 100644 --- a/packages/core/client/src/schema-component/antd/block-item/BlockItem.tsx +++ b/packages/core/client/src/schema-component/antd/block-item/BlockItem.tsx @@ -9,8 +9,6 @@ import { useFieldSchema } from '@formily/react'; import cls from 'classnames'; -import { css } from '@emotion/css'; -import { theme } from 'antd'; import React, { useMemo } from 'react'; import { withDynamicSchemaProps } from '../../../hoc/withDynamicSchemaProps'; import { CustomCreateStylesUtils, createStyles } from '../../../style'; @@ -20,7 +18,6 @@ import { useGetAriaLabelOfBlockItem } from './hooks/useGetAriaLabelOfBlockItem'; import { ErrorBoundary } from 'react-error-boundary'; import { ErrorFallback } from '../error-fallback'; import { useSchemaToolbarRender } from '../../../application'; -import { useDesignable } from '../../'; const useStyles = createStyles(({ css, token }: CustomCreateStylesUtils) => { return css` @@ -87,26 +84,10 @@ export const BlockItem: React.FC = withDynamicSchemaProps( const fieldSchema = useFieldSchema(); const { render } = useSchemaToolbarRender(fieldSchema); const { getAriaLabel } = useGetAriaLabelOfBlockItem(props.name); - const { token } = theme.useToken(); - const { designable } = useDesignable(); const label = useMemo(() => getAriaLabel(), [getAriaLabel]); return ( - + {render()} console.log(err)}> {children} 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 2926cf97b8..45df2e5b5d 100644 --- a/packages/core/client/src/schema-component/antd/grid/Grid.tsx +++ b/packages/core/client/src/schema-component/antd/grid/Grid.tsx @@ -13,6 +13,8 @@ import { ISchema, RecursionField, Schema, observer, useField, useFieldSchema } f import { uid } from '@formily/shared'; import cls from 'classnames'; import _ from 'lodash'; +import { css } from '@emotion/css'; +import { theme } from 'antd'; import React, { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'; import { SchemaComponent, useDesignable, useSchemaInitializerRender } from '../../../'; import { useFormBlockContext, useFormBlockType } from '../../../block-provider/FormBlockProvider'; @@ -333,7 +335,8 @@ export const Grid: any = observer( const rows = useRowProperties(); const { setPrintContent } = useFormBlockContext(); const { styles } = useStyles(); - + const { token } = theme.useToken(); + const { designable } = useDesignable(); const distributedValue = distributed === undefined ? fieldSchema?.parent['x-component'] === 'Page' || fieldSchema?.parent['x-component'] === 'Tabs.TabPane' @@ -356,7 +359,18 @@ export const Grid: any = observer( return ( -
+
{showDivider ? (