mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 04:30:06 +08:00
Allow FormItem.help to be boolean
This commit is contained in:
parent
0f72c80e79
commit
8cd0a08946
@ -109,6 +109,7 @@ class FormItem extends React.Component {
|
|||||||
[`${prefixCls}-item`]: true,
|
[`${prefixCls}-item`]: true,
|
||||||
[`${prefixCls}-item-compact`]: this._isCompact(props.children),
|
[`${prefixCls}-item-compact`]: this._isCompact(props.children),
|
||||||
[`${prefixCls}-item-with-help`]: !!props.help,
|
[`${prefixCls}-item-with-help`]: !!props.help,
|
||||||
|
[`${props.className}`]: !!props.className,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -128,7 +129,7 @@ FormItem.propTypes = {
|
|||||||
prefixCls: React.PropTypes.string,
|
prefixCls: React.PropTypes.string,
|
||||||
label: React.PropTypes.node,
|
label: React.PropTypes.node,
|
||||||
labelCol: React.PropTypes.object,
|
labelCol: React.PropTypes.object,
|
||||||
help: React.PropTypes.node,
|
help: React.PropTypes.oneOfType([React.PropTypes.node, React.PropTypes.bool]),
|
||||||
validateStatus: React.PropTypes.oneOf(['', 'success', 'warning', 'error', 'validating']),
|
validateStatus: React.PropTypes.oneOf(['', 'success', 'warning', 'error', 'validating']),
|
||||||
hasFeedback: React.PropTypes.bool,
|
hasFeedback: React.PropTypes.bool,
|
||||||
wrapperCol: React.PropTypes.object,
|
wrapperCol: React.PropTypes.object,
|
||||||
|
@ -73,6 +73,25 @@ ReactDOM.render(
|
|||||||
<Input defaultValue="无效选择" id="error" />
|
<Input defaultValue="无效选择" id="error" />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
|
<FormItem
|
||||||
|
label="Datepicker:"
|
||||||
|
labelCol={{span: 5}}
|
||||||
|
help>
|
||||||
|
<Col span="6">
|
||||||
|
<FormItem validateStatus="error" help="请选择正确日期">
|
||||||
|
<DatePicker />
|
||||||
|
</FormItem>
|
||||||
|
</Col>
|
||||||
|
<Col span="1">
|
||||||
|
<p className="ant-form-split">-</p>
|
||||||
|
</Col>
|
||||||
|
<Col span="6">
|
||||||
|
<FormItem>
|
||||||
|
<DatePicker />
|
||||||
|
</FormItem>
|
||||||
|
</Col>
|
||||||
|
</FormItem>
|
||||||
|
|
||||||
<FormItem
|
<FormItem
|
||||||
label="Datepicker:"
|
label="Datepicker:"
|
||||||
labelCol={{span: 5}}
|
labelCol={{span: 5}}
|
||||||
@ -88,26 +107,7 @@ ReactDOM.render(
|
|||||||
<DatePicker />
|
<DatePicker />
|
||||||
</Col>
|
</Col>
|
||||||
<Col span="19" offset="5">
|
<Col span="19" offset="5">
|
||||||
<p className="ant-form-explain">请输入正确选项</p>
|
<p className="ant-form-explain">请选择正确日期</p>
|
||||||
</Col>
|
|
||||||
</FormItem>
|
|
||||||
|
|
||||||
<FormItem
|
|
||||||
label="Datepicker:"
|
|
||||||
labelCol={{span: 5}}>
|
|
||||||
<Col span="6">
|
|
||||||
<FormItem validateStatus="error">
|
|
||||||
<DatePicker />
|
|
||||||
<p className="ant-form-explain">请输入正确选项</p>
|
|
||||||
</FormItem>
|
|
||||||
</Col>
|
|
||||||
<Col span="1">
|
|
||||||
<p className="ant-form-split">-</p>
|
|
||||||
</Col>
|
|
||||||
<Col span="6">
|
|
||||||
<FormItem>
|
|
||||||
<DatePicker />
|
|
||||||
</FormItem>
|
|
||||||
</Col>
|
</Col>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
|
Loading…
Reference in New Issue
Block a user