import _extends from"babel-runtime/helpers/extends";import _defineProperty from"babel-runtime/helpers/defineProperty";import _classCallCheck from"babel-runtime/helpers/classCallCheck";import _createClass from"babel-runtime/helpers/createClass";import _possibleConstructorReturn from"babel-runtime/helpers/possibleConstructorReturn";import _inherits from"babel-runtime/helpers/inherits";import*as React from"react";import*as PropTypes from"prop-types";import classNames from"classnames";import createDOMForm from"rc-form/es/createDOMForm";import createFormField from"rc-form/es/createFormField";import PureRenderMixin from"rc-util/es/PureRenderMixin";import omit from"omit.js";import warning from"../_util/warning";import FormItem from"./FormItem";import{FIELD_META_PROP,FIELD_DATA_PROP}from"./constants";var Form=function(e){function r(e){_classCallCheck(this,r);var t=_possibleConstructorReturn(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e));return warning(!e.form,"It is unnecessary to pass `form` to `Form` after dtd@1.7.0."),t}return _inherits(r,e),_createClass(r,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return PureRenderMixin.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,o=r.hideRequiredMark,i=r.className,a=void 0===i?"":i,n=r.layout,s=classNames(t,(_defineProperty(e={},t+"-horizontal","horizontal"===n),_defineProperty(e,t+"-vertical","vertical"===n),_defineProperty(e,t+"-inline","inline"===n),_defineProperty(e,t+"-hide-required-mark",o),e),a),m=omit(this.props,["prefixCls","className","layout","form","hideRequiredMark"]);return React.createElement("form",_extends({},m,{className:s}))}}]),r}(React.Component);export default Form;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=FormItem,Form.createFormField=createFormField,Form.create=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return createDOMForm(_extends({fieldNameProp:"id"},e,{fieldMetaProp:FIELD_META_PROP,fieldDataProp:FIELD_DATA_PROP}))};