import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _Input from "@alifd/next/es/input";
import _CascaderSelect from "@alifd/next/es/cascader-select";
import React, { Component } from "react";
import { DataSourceType } from "../../_utils/formKeyType";
// 后期逐步使用_components 里面的RenderByFormKey
// 可放弃

var RenderByFormKey = function RenderByFormKey(props) {
  var _readerMap;
  var item = props.item,
    index = props.index,
    currentPageData = props.currentPageData,
    onInputChange = props.onInputChange,
    onRelationChange = props.onRelationChange;
  var readerMap = (_readerMap = {}, _readerMap[DataSourceType.currentPageType] = function (item, index) {
    return /*#__PURE__*/React.createElement(_CascaderSelect, {
      multiple: true,
      className: "itemOne_select",
      style: {
        width: 100 + "%",
        minWidth: 0
      },
      dataSource: currentPageData,
      value: item.treeKey,
      onChange: function onChange(v, data) {
        onRelationChange(v, data, index);
      },
      placeholder: "\u8BF7\u9009\u62E9"
    });
  }, _readerMap[DataSourceType.defaultType] = function (item, index) {
    return /*#__PURE__*/React.createElement(_Input, {
      hasClear: true,
      value: item.inputValue,
      style: {
        width: 100 + "%"
      },
      placeholder: "\u8BF7\u8F93\u5165",
      onChange: function onChange(v) {
        onInputChange(v, index, "inputValue");
      }
    });
  }, _readerMap[DataSourceType.locationType] = function (item, index) {
    return /*#__PURE__*/React.createElement(_Input, {
      hasClear: true,
      value: item.inputValue,
      style: {
        width: 100 + "%"
      },
      placeholder: "\u8BF7\u8F93\u5165",
      onChange: function onChange(v) {
        onInputChange(v, index, "inputValue");
      }
    });
  }, _readerMap[DataSourceType.requestType] = function (item, index) {
    return /*#__PURE__*/React.createElement(_Input, {
      hasClear: true,
      value: item.inputValue,
      style: {
        width: 100 + "%"
      },
      placeholder: "\u8BF7\u8F93\u5165",
      onChange: function onChange(v) {
        onInputChange(v, index, "inputValue");
      }
    });
  }, _readerMap);
  if (item.formKey && readerMap[item.formKey]) {
    return readerMap[item.formKey](item, index);
  }
  return null;
};
var _default = /*#__PURE__*/function (_Component) {
  function _default() {
    return _Component.apply(this, arguments) || this;
  }
  _inheritsLoose(_default, _Component);
  var _proto = _default.prototype;
  _proto.render = function render() {
    return /*#__PURE__*/React.createElement(RenderByFormKey, this.props);
  };
  return _default;
}(Component);
export { _default as default };