From 057e1d00398496f0ed5cb4bbf15533a1dc7e4641 Mon Sep 17 00:00:00 2001 From: chenos Date: Tue, 12 Jul 2022 20:44:21 +0800 Subject: [PATCH] fix: skip recursive remove on grid component (#621) releated issue: #383 --- .../src/schema-component/antd/grid/Grid.tsx | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) 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 576032f72..ee42b9f5f 100644 --- a/packages/core/client/src/schema-component/antd/grid/Grid.tsx +++ b/packages/core/client/src/schema-component/antd/grid/Grid.tsx @@ -11,6 +11,9 @@ const GridRowContext = createContext(null); const GridColContext = createContext(null); const GridContext = createContext({}); +const breakRemoveOnGrid = (s: Schema) => s['x-component'] === 'Grid'; +const breakRemoveOnRow = (s: Schema) => s['x-component'] === 'Grid.Row'; + const ColDivider = (props) => { const { isOver, setNodeRef } = useDroppable({ id: props.id, @@ -154,7 +157,7 @@ export const useGridContext = () => { export const useGridRowContext = () => { return useContext(GridRowContext); -} +}; export const Grid: any = observer((props: any) => { const field = useField(); @@ -168,7 +171,12 @@ export const Grid: any = observer((props: any) => { {rows.map((schema, index) => { return ( @@ -176,7 +184,12 @@ export const Grid: any = observer((props: any) => { ); @@ -208,7 +221,12 @@ Grid.Row = observer((props) => { > {cols.map((schema, index) => { return ( @@ -216,7 +234,12 @@ Grid.Row = observer((props) => { );