You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
991 B
45 lines
991 B
import React from 'react';
|
|
import classNames from 'classnames';
|
|
|
|
export default class Form extends React.Component {
|
|
static defaultProps = {
|
|
prefixCls: 'ant-form',
|
|
onSubmit(e) {
|
|
e.preventDefault();
|
|
},
|
|
}
|
|
|
|
static propTypes = {
|
|
prefixCls: React.PropTypes.string,
|
|
horizontal: React.PropTypes.bool,
|
|
inline: React.PropTypes.bool,
|
|
form: React.PropTypes.object,
|
|
children: React.PropTypes.any,
|
|
onSubmit: React.PropTypes.func,
|
|
}
|
|
|
|
static childContextTypes = {
|
|
form: React.PropTypes.object,
|
|
}
|
|
|
|
getChildContext() {
|
|
return {
|
|
form: this.props.form,
|
|
};
|
|
}
|
|
|
|
render() {
|
|
const { prefixCls, className } = this.props;
|
|
const formClassName = classNames({
|
|
[className]: !!className,
|
|
[`${prefixCls}-horizontal`]: this.props.horizontal,
|
|
[`${prefixCls}-inline`]: this.props.inline,
|
|
});
|
|
|
|
return (
|
|
<form {...this.props} className={formClassName}>
|
|
{this.props.children}
|
|
</form>
|
|
);
|
|
}
|
|
}
|
|
|