mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
Grid
This commit is contained in:
parent
95ad3a6027
commit
18863ede69
@ -511,11 +511,8 @@ addSchemaFilter(function (schema: Schema, renderer: any, props: any) {
|
||||
|
||||
body: column?.controls.map(controlToNormalRenderer)
|
||||
};
|
||||
delete column.type;
|
||||
delete column.controls;
|
||||
if (!column.type) {
|
||||
column.type = 'wrapper';
|
||||
column.size = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
return column;
|
||||
|
@ -2,7 +2,12 @@ import React from 'react';
|
||||
import {Renderer, RendererProps} from '../factory';
|
||||
import {Schema} from '../types';
|
||||
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'];
|
||||
|
||||
@ -106,6 +111,8 @@ export type GridColumnObject = {
|
||||
mode?: string;
|
||||
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 defaultProps = {};
|
||||
|
||||
renderChild(region: string, node: Schema, key: number, length: number) {
|
||||
renderChild(
|
||||
region: string,
|
||||
node: SchemaCollection,
|
||||
key: number,
|
||||
length: number
|
||||
) {
|
||||
const {render, itemRender} = this.props;
|
||||
|
||||
return itemRender
|
||||
@ -206,7 +218,12 @@ export default class Grid<T> extends React.Component<GridProps & T, object> {
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
this.renderChild(`column/${key}`, column, key, length)
|
||||
this.renderChild(
|
||||
`column/${key}`,
|
||||
column.type ? column : (column as any).body!,
|
||||
key,
|
||||
length
|
||||
)
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user