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 52dbd71e0d..bcc4050822 100644
--- a/packages/core/client/src/schema-component/antd/grid/Grid.tsx
+++ b/packages/core/client/src/schema-component/antd/grid/Grid.tsx
@@ -152,6 +152,10 @@ export const useGridContext = () => {
return useContext(GridContext);
};
+export const useGridRowContext = () => {
+ return useContext(GridRowContext);
+}
+
export const Grid: any = observer((props: any) => {
const field = useField();
const fieldSchema = useFieldSchema();
diff --git a/packages/core/client/src/schema-settings/GeneralSchemaDesigner.tsx b/packages/core/client/src/schema-settings/GeneralSchemaDesigner.tsx
index 8c01d4ac20..125a37fb07 100644
--- a/packages/core/client/src/schema-settings/GeneralSchemaDesigner.tsx
+++ b/packages/core/client/src/schema-settings/GeneralSchemaDesigner.tsx
@@ -5,7 +5,8 @@ import { Space } from 'antd';
import classNames from 'classnames';
import React from 'react';
import { useTranslation } from 'react-i18next';
-import { DragHandler, useCompile, useDesignable, useGridContext } from '../schema-component';
+import { DragHandler, useCompile, useDesignable, useGridContext, useGridRowContext } from '../schema-component';
+import { gridRowColWrap } from '../schema-initializer/utils';
import { SchemaSettings } from './SchemaSettings';
const titleCss = css`
@@ -45,6 +46,7 @@ export const GeneralSchemaDesigner = (props: any) => {
if (!designable) {
return null;
}
+ const rowCtx = useGridRowContext();
const ctx = useGridContext();
const templateName = ['FormItem', 'ReadPrettyFormItem'].includes(template?.componentName)
? `${template?.name} ${t('(Fields only)')}`
@@ -70,10 +72,12 @@ export const GeneralSchemaDesigner = (props: any) => {
)}
- {!disableInitializer && ctx?.renderSchemaInitializer?.({
- insertPosition: 'afterEnd',
- component: ,
- })}
+ {!disableInitializer &&
+ ctx?.renderSchemaInitializer?.({
+ insertPosition: 'afterEnd',
+ wrap: rowCtx?.cols?.length > 1 ? undefined : gridRowColWrap,
+ component: ,
+ })}
} {...schemaSettingsProps}>
{props.children}