|
@ -17,6 +17,7 @@ export default class Row extends React.Component<RowProps, any> { |
|
|
static defaultProps = { |
|
|
static defaultProps = { |
|
|
gutter: 0, |
|
|
gutter: 0, |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
static propTypes = { |
|
|
static propTypes = { |
|
|
type: React.PropTypes.string, |
|
|
type: React.PropTypes.string, |
|
|
align: React.PropTypes.string, |
|
|
align: React.PropTypes.string, |
|
@ -27,16 +28,17 @@ export default class Row extends React.Component<RowProps, any> { |
|
|
prefixCls: React.PropTypes.string, |
|
|
prefixCls: React.PropTypes.string, |
|
|
}; |
|
|
}; |
|
|
render() { |
|
|
render() { |
|
|
const { type, justify, align, className, gutter, style, children, prefixCls = 'ant-row', ...others } = this.props; |
|
|
const { type, justify, align, className, gutter, style, children, |
|
|
|
|
|
prefixCls = 'ant-row', ...others } = this.props; |
|
|
const classes = classNames({ |
|
|
const classes = classNames({ |
|
|
[prefixCls]: !type, |
|
|
[prefixCls]: !type, |
|
|
[`${prefixCls}-${type}`]: type, |
|
|
[`${prefixCls}-${type}`]: type, |
|
|
[`${prefixCls}-${type}-${justify}`]: type && justify, |
|
|
[`${prefixCls}-${type}-${justify}`]: type && justify, |
|
|
[`${prefixCls}-${type}-${align}`]: type && align, |
|
|
[`${prefixCls}-${type}-${align}`]: type && align, |
|
|
}, className); |
|
|
}, className); |
|
|
const rowStyle = gutter > 0 ? assign({}, { |
|
|
const rowStyle = (gutter as number) > 0 ? assign({}, { |
|
|
marginLeft: gutter / -2, |
|
|
marginLeft: (gutter as number) / -2, |
|
|
marginRight: gutter / -2, |
|
|
marginRight: (gutter as number) / -2, |
|
|
}, style) : style; |
|
|
}, style) : style; |
|
|
const cols = Children.map(children, (col: React.ReactElement<any>) => { |
|
|
const cols = Children.map(children, (col: React.ReactElement<any>) => { |
|
|
if (!col) { |
|
|
if (!col) { |
|
@ -44,9 +46,9 @@ export default class Row extends React.Component<RowProps, any> { |
|
|
} |
|
|
} |
|
|
if (col.props) { |
|
|
if (col.props) { |
|
|
return cloneElement(col, { |
|
|
return cloneElement(col, { |
|
|
style: gutter > 0 ? assign({}, { |
|
|
style: (gutter as number) > 0 ? assign({}, { |
|
|
paddingLeft: gutter / 2, |
|
|
paddingLeft: (gutter as number) / 2, |
|
|
paddingRight: gutter / 2, |
|
|
paddingRight: (gutter as number) / 2, |
|
|
}, col.props.style) : col.props.style, |
|
|
}, col.props.style) : col.props.style, |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|