"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _switch = _interopRequireDefault(require("@alifd/next/lib/switch"));
var _rating = _interopRequireDefault(require("@alifd/next/lib/rating"));
var _timePicker = _interopRequireDefault(require("@alifd/next/lib/time-picker2"));
var _numberPicker = _interopRequireDefault(require("@alifd/next/lib/number-picker"));
var _datePicker = _interopRequireDefault(require("@alifd/next/lib/date-picker2"));
var _input = _interopRequireDefault(require("@alifd/next/lib/input"));
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
var _form = _interopRequireDefault(require("@alifd/next/lib/form"));
var _react = _interopRequireDefault(require("react"));
//这是过滤器字段

// import BizItem from '../field/biz-item';
var FormItem = _form["default"].Item;
var FilterField = /*#__PURE__*/function (_React$Component) {
  (0, _inheritsLoose2["default"])(FilterField, _React$Component);
  function FilterField(props) {
    var _this;
    _this = _React$Component.call(this, props) || this;
    //渲染不同的控件
    _this.renderChild_ = function () {
      var _this$props = _this.props,
        componentType = _this$props.componentType,
        placeholder = _this$props.placeholder;
      if (componentType === 'Input') {
        return /*#__PURE__*/_react["default"].createElement(_input["default"], {
          placeholder: placeholder
        });
      }
      if (componentType === 'DatePicker') {
        return /*#__PURE__*/_react["default"].createElement(_datePicker["default"], {
          outputFormat: "YYYY-MM-DD",
          placeholder: placeholder
        });
      }
      if (componentType === 'TextArea') {
        return /*#__PURE__*/_react["default"].createElement(_input["default"].TextArea, {
          placeholder: placeholder
        });
      }
      if (componentType === 'NumberPicker') {
        return /*#__PURE__*/_react["default"].createElement(_numberPicker["default"], null);
      }
      if (componentType === 'TimePicker') {
        return /*#__PURE__*/_react["default"].createElement(_timePicker["default"], {
          placeholder: placeholder
        });
      }
      if (componentType === 'Rating') {
        return /*#__PURE__*/_react["default"].createElement(_rating["default"], null);
      }
      if (componentType === 'Switch') {
        return /*#__PURE__*/_react["default"].createElement(_switch["default"], null);
      }
      return /*#__PURE__*/_react["default"].createElement(_input["default"], {
        placeholder: placeholder
      });
    };
    return _this;
  }
  var _proto = FilterField.prototype;
  _proto.render = function render() {
    var _this$props2 = this.props,
      displayName = _this$props2.displayName,
      isRequired = _this$props2.isRequired,
      fieldName = _this$props2.fieldName,
      style = _this$props2.style;
    var formItemLayout = {
      labelCol: {
        span: 8
      },
      wrapperCol: {
        span: 14
      }
    };
    var labelAlign = 'left';
    return /*#__PURE__*/_react["default"].createElement(FormItem, (0, _extends2["default"])({
      style: style,
      colon: true,
      name: fieldName
    }, formItemLayout, {
      labelAlign: labelAlign,
      label: displayName,
      required: isRequired,
      requiredMessage: "\u8BF7\u8F93\u5165" + displayName
    }), this.renderChild_());
  };
  return FilterField;
}(_react["default"].Component);
FilterField.displayName = 'FilterField';
var _default = FilterField;
exports["default"] = _default;