import _Tab from "@alifd/next/es/tab";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import { Component } from 'react';
import style from "./index.module.scss";
var XtFormSetter = /*#__PURE__*/function (_Component) {
  _inheritsLoose(XtFormSetter, _Component);
  function XtFormSetter() {
    return _Component.apply(this, arguments) || this;
  }
  var _proto = XtFormSetter.prototype;
  _proto.render = function render() {
    var _this$props = this.props,
      menuClick = _this$props.menuClick,
      tabChange = _this$props.tabChange,
      formData = _this$props.formData;
    var _ref = formData || {
        tpl: {}
      },
      compTpl = _ref.tpl;
    return /*#__PURE__*/React.createElement("div", {
      className: style.menu
    }, /*#__PURE__*/React.createElement("div", {
      className: style['tip-group']
    }, /*#__PURE__*/React.createElement(_Tab, {
      defaultActiveKey: "-9999",
      onChange: function onChange(ctgId) {
        return tabChange(ctgId);
      }
    }, compTpl.tabList.map(function (item) {
      var _item$tplList;
      return /*#__PURE__*/React.createElement(_Tab.Item, {
        key: item.ctg_id,
        title: item.title
      }, /*#__PURE__*/React.createElement("div", {
        className: style['tab-item'],
        onClick: function onClick() {
          return menuClick({});
        }
      }, /*#__PURE__*/React.createElement("div", {
        className: style['tab-item-empty-tpl']
      }, /*#__PURE__*/React.createElement("span", {
        className: "xiatu-rich xt-tianjia"
      }))), (_item$tplList = item.tplList) === null || _item$tplList === void 0 ? void 0 : _item$tplList.map(function (res) {
        var _ref2;
        return /*#__PURE__*/React.createElement("div", {
          className: style['tab-item'] + " " + (res.active ? style['tab-item-active'] : ''),
          onClick: function onClick() {
            return menuClick(res);
          },
          key: item.ctg_id + "_" + res.ctg_id + "_" + res.tpl_id
        }, /*#__PURE__*/React.createElement("span", {
          "class": "xiatu-rich xt-done"
        }), /*#__PURE__*/React.createElement("div", {
          className: style['tab-item-tip'] + " " + (res['is_bigshrimp'] ? style['expert-recom'] : '')
        }, /*#__PURE__*/React.createElement("span", {
          className: "xiatu-rich xt-diamond"
        }), res['is_bigshrimp'] ? '' : res.ctg_title, /*#__PURE__*/React.createElement("span", {
          className: style['tab-item-class']
        })), /*#__PURE__*/React.createElement("div", {
          className: style['tab-item-title']
        }, "#", res.ctg_title, "\uFF03", res.title), /*#__PURE__*/React.createElement("div", {
          className: style['tab-item-subtitle']
        }, res.sub_title), /*#__PURE__*/React.createElement("div", {
          className: style['tab-item-tips']
        }, (Array.isArray(res === null || res === void 0 ? void 0 : res.tag) ? res.tag : ((_ref2 = (res === null || res === void 0 ? void 0 : res.tag) || '') === null || _ref2 === void 0 ? void 0 : _ref2.match(/[^,]+/g)) || []).map(function (tags, idx) {
          return /*#__PURE__*/React.createElement("div", {
            className: style['tab-item-tips-item'],
            key: idx
          }, tags);
        })));
      }));
    }))));
  };
  return XtFormSetter;
}(Component);
XtFormSetter.displayName = 'XtFormSetter';
export { XtFormSetter as default };