This commit is contained in:
liaoxuezhi 2021-06-18 01:13:31 +08:00
parent 95ad3a6027
commit 18863ede69
2 changed files with 21 additions and 7 deletions

View File

@ -511,11 +511,8 @@ addSchemaFilter(function (schema: Schema, renderer: any, props: any) {
body: column?.controls.map(controlToNormalRenderer) body: column?.controls.map(controlToNormalRenderer)
}; };
delete column.type;
delete column.controls; delete column.controls;
if (!column.type) {
column.type = 'wrapper';
column.size = 'none';
}
} }
return column; return column;

View File

@ -2,7 +2,12 @@ import React from 'react';
import {Renderer, RendererProps} from '../factory'; import {Renderer, RendererProps} from '../factory';
import {Schema} from '../types'; import {Schema} from '../types';
import pick from 'lodash/pick'; import pick from 'lodash/pick';
import {BaseSchema, SchemaClassName, SchemaObject} from '../Schema'; import {
BaseSchema,
SchemaClassName,
SchemaCollection,
SchemaObject
} from '../Schema';
export const ColProps = ['lg', 'md', 'sm', 'xs']; export const ColProps = ['lg', 'md', 'sm', 'xs'];
@ -106,6 +111,8 @@ export type GridColumnObject = {
mode?: string; mode?: string;
horizontal?: any; horizontal?: any;
body?: SchemaCollection;
/** /**
* *
*/ */
@ -168,7 +175,12 @@ export default class Grid<T> extends React.Component<GridProps & T, object> {
static propsList: Array<string> = ['columns']; static propsList: Array<string> = ['columns'];
static defaultProps = {}; static defaultProps = {};
renderChild(region: string, node: Schema, key: number, length: number) { renderChild(
region: string,
node: SchemaCollection,
key: number,
length: number
) {
const {render, itemRender} = this.props; const {render, itemRender} = this.props;
return itemRender return itemRender
@ -206,7 +218,12 @@ export default class Grid<T> extends React.Component<GridProps & T, object> {
)} )}
</div> </div>
) : ( ) : (
this.renderChild(`column/${key}`, column, key, length) this.renderChild(
`column/${key}`,
column.type ? column : (column as any).body!,
key,
length
)
)} )}
</div> </div>
); );