fix: remove grid wrap (#4612)

This commit is contained in:
chenos 2024-06-10 15:31:19 +08:00 committed by GitHub
parent 328b0da846
commit 1d2ac6b85e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 9 deletions

View File

@ -9,15 +9,18 @@
import _ from 'lodash';
import React from 'react';
import { GridRowContext } from '../../../../schema-component/antd/grid/Grid';
import { SchemaToolbar } from '../../../../schema-settings';
export const TableColumnSchemaToolbar = (props) => {
return (
<SchemaToolbar
initializer={props.initializer || false}
showBorder={false}
showBackground
{..._.omit(props, 'initializer')}
/>
<GridRowContext.Provider value={null}>
<SchemaToolbar
initializer={props.initializer || false}
showBorder={false}
showBackground
{..._.omit(props, 'initializer')}
/>
</GridRowContext.Provider>
);
};

View File

@ -21,7 +21,7 @@ import { DndContext, DndContextProps } from '../../common/dnd-context';
import { useToken } from '../__builtins__';
import useStyles from './Grid.style';
const GridRowContext = createContext<any>({});
export const GridRowContext = createContext<any>({});
GridRowContext.displayName = 'GridRowContext';
const GridColContext = createContext<any>({});
GridColContext.displayName = 'GridColContext';

View File

@ -228,11 +228,10 @@ const InternalSchemaToolbar: FC<SchemaToolbarProps> = (props) => {
);
const rowCtx = useGridRowContext();
const gridContext = useGridContext();
const initializerProps: any = useMemo(() => {
return {
insertPosition: 'afterEnd',
wrap: rowCtx?.cols?.length > 1 ? undefined : gridRowColWrap,
wrap: rowCtx?.cols?.length === 1 ? gridRowColWrap : undefined,
Component: (props: any) => (
<PlusOutlined
{...props}