import _extends from "@babel/runtime/helpers/extends";
import _Switch from "@alifd/next/es/switch";
import _Rating from "@alifd/next/es/rating";
import _TimePicker from "@alifd/next/es/time-picker2";
import _NumberPicker from "@alifd/next/es/number-picker";
import _DatePicker from "@alifd/next/es/date-picker2";
import _Input from "@alifd/next/es/input";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _Form from "@alifd/next/es/form";
//这是过滤器字段
import React from 'react';
// import BizItem from '../field/biz-item';
var FormItem = _Form.Item;
var FilterField = /*#__PURE__*/function (_React$Component) {
  _inheritsLoose(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.createElement(_Input, {
          placeholder: placeholder
        });
      }
      if (componentType === 'DatePicker') {
        return /*#__PURE__*/React.createElement(_DatePicker, {
          outputFormat: "YYYY-MM-DD",
          placeholder: placeholder
        });
      }
      if (componentType === 'TextArea') {
        return /*#__PURE__*/React.createElement(_Input.TextArea, {
          placeholder: placeholder
        });
      }
      if (componentType === 'NumberPicker') {
        return /*#__PURE__*/React.createElement(_NumberPicker, null);
      }
      if (componentType === 'TimePicker') {
        return /*#__PURE__*/React.createElement(_TimePicker, {
          placeholder: placeholder
        });
      }
      if (componentType === 'Rating') {
        return /*#__PURE__*/React.createElement(_Rating, null);
      }
      if (componentType === 'Switch') {
        return /*#__PURE__*/React.createElement(_Switch, null);
      }
      return /*#__PURE__*/React.createElement(_Input, {
        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.createElement(FormItem, _extends({
      style: style,
      colon: true,
      name: fieldName
    }, formItemLayout, {
      labelAlign: labelAlign,
      label: displayName,
      required: isRequired,
      requiredMessage: "\u8BF7\u8F93\u5165" + displayName
    }), this.renderChild_());
  };
  return FilterField;
}(React.Component);
FilterField.displayName = 'FilterField';
export default FilterField;