Merge branch '1.x-stable' of github.com:ant-design/ant-design into 1.x-stable

This commit is contained in:
afc163 2016-07-29 15:38:49 +08:00
commit 1830ad8208
7 changed files with 13 additions and 5 deletions

View File

@ -2,6 +2,7 @@ import React from 'react';
import classNames from 'classnames';
import PureRenderMixin from 'react-addons-pure-render-mixin';
import omit from 'object.omit';
import warning from 'warning';
export default class Form extends React.Component {
static defaultProps = {
@ -19,6 +20,12 @@ export default class Form extends React.Component {
onSubmit: React.PropTypes.func,
}
constructor(props) {
super(props);
warning(!props.form, 'It is unnessary to pass `form` to `Form` after antd@1.7.0.');
}
shouldComponentUpdate(...args) {
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
}

View File

@ -70,7 +70,7 @@ let Demo = React.createClass({
);
});
return (
<Form horizontal>
<Form horizontal form={this.props.form}>
{formItems}
<Form.Item wrapperCol={{ span: 18, offset: 6 }}>
<Button onClick={this.add} style={{ marginRight: 8 }}>新增好朋友</Button>

View File

@ -39,7 +39,7 @@ let Demo = React.createClass({
<div>
<Button type="primary" onClick={this.showModal}>点击有惊喜</Button>
<Modal title="登录" visible={this.state.visible} onOk={this.handleSubmit} onCancel={this.hideModal}>
<Form horizontal>
<Form horizontal form={this.props.form}>
<FormItem
{...formItemLayout}
label="用户名"

View File

@ -109,7 +109,7 @@ let BasicDemo = React.createClass({
wrapperCol: { span: 12 },
};
return (
<Form horizontal>
<Form horizontal form={this.props.form}>
<FormItem
{...formItemLayout}
label="用户名"

View File

@ -140,7 +140,7 @@ let Demo = React.createClass({
};
return (
<div>
<Form horizontal>
<Form horizontal form={this.props.form}>
<Row>
<Col span="18">
<FormItem

View File

@ -107,7 +107,7 @@ let Demo = React.createClass({
wrapperCol: { span: 12 },
};
return (
<Form horizontal>
<Form horizontal form={this.props.form}>
<FormItem
{...formItemLayout}
label="国籍"

View File

@ -38,6 +38,7 @@ english: Form
| 参数 | 说明 | 类型 | 默认值 |
|-----------|------------------------------------------|------------|-------|
| form | 经 `Form.create()` 包装过的组件会自带 `this.props.form` 属性,直接传给 Form 即可。1.7.0 之后无需设置 | object | 无 |
| horizontal | 水平排列布局 | boolean | false |
| inline | 行内排列布局 | boolean | false |
| onSubmit | 数据验证成功后回调事件 | Function(e:Event) | |