"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _form = _interopRequireDefault(require("@alifd/next/lib/form"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
var _react = _interopRequireDefault(require("react"));
require("./index.scss");
var _renderChild = _interopRequireDefault(require("../common-table/components/render-child"));
var _excluded = ["componentType", "mode"]; //这是表单项组件
// import { data } from './data'
// import { getChildList } from './api'
var FormItem = /*#__PURE__*/function (_React$Component) {
  (0, _inheritsLoose2["default"])(FormItem, _React$Component);
  function FormItem(props) {
    var _this;
    _this = _React$Component.call(this, props) || this;
    _this._renderChildren = function () {
      var _this$props = _this.props,
        componentType = _this$props.componentType,
        mode = _this$props.mode,
        otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
      var isPreview = mode === 'browse' ? true : false;
      return /*#__PURE__*/_react["default"].createElement(_renderChild["default"], (0, _extends2["default"])({
        isPreview: isPreview,
        componentType: componentType
      }, otherProps));
    };
    _this.state = {
      childList: []
    };
    return _this;
  }
  var _proto = FormItem.prototype;
  _proto.componentDidMount = /*#__PURE__*/function () {
    var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
      return _regenerator["default"].wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
          case "end":
            return _context.stop();
        }
      }, _callee);
    }));
    function componentDidMount() {
      return _componentDidMount.apply(this, arguments);
    }
    return componentDidMount;
  }();
  _proto.componentWillUnmount = function componentWillUnmount() {
    // events.off('getData', () => this.getData);
  };
  _proto.render = function render() {
    var _this$props2 = this.props,
      displayName = _this$props2.displayName,
      fieldName = _this$props2.fieldName,
      isDisabled = _this$props2.isDisabled,
      isRequired = _this$props2.isRequired;
    // 表单项
    var formItemLayoutItem = {
      labelCol: {
        span: 8
      },
      wrapperCol: {
        span: 14
      }
    };

    // isShow = isShow === undefined ? true : isShow
    return /*#__PURE__*/_react["default"].createElement(_form["default"].Item, (0, _extends2["default"])({
      colon: true,
      name: fieldName
    }, formItemLayoutItem, {
      requiredMessage: "\u8BF7\u8F93\u5165" + displayName,
      required: isRequired,
      disabled: isDisabled,
      labelAlign: "left",
      label: displayName
    }), this._renderChildren());
  };
  return FormItem;
}(_react["default"].Component);
FormItem.displayName = void 0;
FormItem.displayName = 'FormItem';
var _default = FormItem;
exports["default"] = _default;