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 ee42b9f5fc..928ce5057e 100644 --- a/packages/core/client/src/schema-component/antd/grid/Grid.tsx +++ b/packages/core/client/src/schema-component/antd/grid/Grid.tsx @@ -1,4 +1,4 @@ -import { useDndMonitor, useDroppable } from '@dnd-kit/core'; +import { useDndContext, useDndMonitor, useDroppable } from '@dnd-kit/core'; import { css } from '@emotion/css'; import { observer, RecursionField, Schema, useField, useFieldSchema } from '@formily/react'; import { uid } from '@formily/shared'; @@ -24,9 +24,25 @@ const ColDivider = (props) => { backgroundColor: isOver ? 'rgba(241, 139, 98, .1)' : undefined, }; + const dndContext = useDndContext() + const activeSchema: Schema | undefined = dndContext.active?.data.current?.schema?.parent + const blocksLength: number = activeSchema ? Object.keys(activeSchema.properties).length : 0; + + + let visible = true + if (blocksLength === 1) { + if (props.first) { + visible = activeSchema !== props.cols[0] + } else { + const currentSchema = props.cols[props.index] + const downSchema = props.cols[props.index + 1] + visible = activeSchema !== currentSchema && downSchema !== activeSchema + } + } + return (