"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
var _react = _interopRequireWildcard(require("react"));
var _indexModule = _interopRequireDefault(require("./index.module.scss"));
var _FormPlaceholder = _interopRequireDefault(require("./FormPlaceholder"));
var _FormView = _interopRequireDefault(require("./FormView"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var TabForm = /*#__PURE__*/function (_Component) {
  (0, _inheritsLoose2["default"])(TabForm, _Component);
  function TabForm() {
    var _this;
    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }
    _this = _Component.call.apply(_Component, [this].concat(args)) || this;
    _this.state = {
      formData: []
    };
    return _this;
  }
  var _proto = TabForm.prototype;
  _proto.render = function render() {
    var _this$props = this.props,
      xtForm = _this$props.xtForm,
      triggerWXLogin = _this$props.triggerWXLogin,
      submitSuccess = _this$props.submitSuccess,
      _this$props$formBtnTe = _this$props.formBtnText,
      formBtnText = _this$props$formBtnTe === void 0 ? null : _this$props$formBtnTe;
    var _ref = xtForm || this.state,
      formData = _ref.formData;
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: _indexModule["default"]['xt-form']
    }, Array.isArray(formData) && formData.length > 0 ? /*#__PURE__*/_react["default"].createElement(_FormView["default"], {
      formData: formData,
      triggerWXLogin: triggerWXLogin,
      submitSuccess: submitSuccess,
      formBtnText: formBtnText
    }) : /*#__PURE__*/_react["default"].createElement(_FormPlaceholder["default"], null));
  };
  return TabForm;
}(_react.Component);
exports["default"] = TabForm;