"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends2=require("babel-runtime/helpers/extends"),_extends3=_interopRequireDefault(_extends2),_defineProperty2=require("babel-runtime/helpers/defineProperty"),_defineProperty3=_interopRequireDefault(_defineProperty2),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=require("babel-runtime/helpers/createClass"),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=require("babel-runtime/helpers/possibleConstructorReturn"),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=require("babel-runtime/helpers/inherits"),_inherits3=_interopRequireDefault(_inherits2),_react=require("react"),React=_interopRequireWildcard(_react),_propTypes=require("prop-types"),PropTypes=_interopRequireWildcard(_propTypes),_classnames=require("classnames"),_classnames2=_interopRequireDefault(_classnames),_createDOMForm=require("rc-form/lib/createDOMForm"),_createDOMForm2=_interopRequireDefault(_createDOMForm),_createFormField=require("rc-form/lib/createFormField"),_createFormField2=_interopRequireDefault(_createFormField),_PureRenderMixin=require("rc-util/lib/PureRenderMixin"),_PureRenderMixin2=_interopRequireDefault(_PureRenderMixin),_omit=require("omit.js"),_omit2=_interopRequireDefault(_omit),_warning=require("../_util/warning"),_warning2=_interopRequireDefault(_warning),_FormItem=require("./FormItem"),_FormItem2=_interopRequireDefault(_FormItem),_constants=require("./constants");function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);return r.default=e,r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var Form=function(e){function t(e){(0,_classCallCheck3.default)(this,t);var r=(0,_possibleConstructorReturn3.default)(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return(0,_warning2.default)(!e.form,"It is unnecessary to pass `form` to `Form` after dtd@1.7.0."),r}return(0,_inherits3.default)(t,e),(0,_createClass3.default)(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return _PureRenderMixin2.default.shouldComponentUpdate.apply(this,r)}},{key:"getChildContext",value:function(){return{vertical:"vertical"===this.props.layout}}},{key:"render",value:function(){var e,r=this.props,t=r.prefixCls,i=r.hideRequiredMark,o=r.className,a=void 0===o?"":o,n=r.layout,l=(0,_classnames2.default)(t,(e={},(0,_defineProperty3.default)(e,t+"-horizontal","horizontal"===n),(0,_defineProperty3.default)(e,t+"-vertical","vertical"===n),(0,_defineProperty3.default)(e,t+"-inline","inline"===n),(0,_defineProperty3.default)(e,t+"-hide-required-mark",i),e),a),u=(0,_omit2.default)(this.props,["prefixCls","className","layout","form","hideRequiredMark"]);return React.createElement("form",(0,_extends3.default)({},u,{className:l}))}}]),t}(React.Component);(exports.default=Form).defaultProps={prefixCls:"dt-form",layout:"horizontal",hideRequiredMark:!1,onSubmit:function(e){e.preventDefault()}},Form.propTypes={prefixCls:PropTypes.string,layout:PropTypes.oneOf(["horizontal","inline","vertical"]),children:PropTypes.any,onSubmit:PropTypes.func,hideRequiredMark:PropTypes.bool},Form.childContextTypes={vertical:PropTypes.bool},Form.Item=_FormItem2.default,Form.createFormField=_createFormField2.default,Form.create=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return(0,_createDOMForm2.default)((0,_extends3.default)({fieldNameProp:"id"},e,{fieldMetaProp:_constants.FIELD_META_PROP,fieldDataProp:_constants.FIELD_DATA_PROP}))},module.exports=exports.default;