"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _button = _interopRequireDefault(require("@alifd/next/lib/button"));
var _icon = _interopRequireDefault(require("@alifd/next/lib/icon"));
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
var React = _interopRequireWildcard(require("react"));
require("./index.scss");
var _dialogForm = _interopRequireDefault(require("../../components/common/dialog-form"));
var _index2 = _interopRequireDefault(require("../../components/common/activity-form2/index"));
var _utils = require("../../utils");
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; }
// import ActivityForm from '../../components/common/activity-form/index';
var ButtonSetter = /*#__PURE__*/function (_Component) {
  (0, _inheritsLoose2["default"])(ButtonSetter, _Component);
  function ButtonSetter(props, context) {
    var _this;
    _this = _Component.call(this, props, context) || this;
    _this.state = {
      // theSendData: {},
      theDilogVisible: false
    };
    return _this;
  }
  var _proto = ButtonSetter.prototype;
  _proto.render = function render() {
    var _this2 = this;
    var _this$props = this.props,
      btnText = _this$props.btnText,
      icon = _this$props.icon,
      onChange = _this$props.onChange,
      bodyNode = _this$props.bodyNode;
    // console.log(value);
    var onClose = function onClose() {
      (0, _utils.preview)();
      // const Obj = {};
      // Obj.visible = !value.visible;
      // onChange(Obj);
      _this2.setState(function (prev) {
        return {
          theDilogVisible: !prev.theDilogVisible
        };
      });
    };
    var theMessage = function theMessage(msg) {
      // this.setState(
      //   {
      //     theSendData: msg,
      //   }
      // );
      var Obj = {};
      // Obj.visible = !value.visible;
      Obj.prizeMessage = msg;
      onChange(Obj);
      _this2.setState(function (prev) {
        return {
          theDilogVisible: !prev.theDilogVisible
        };
      });
      // console.log("传递的数据", this.state.theSendData)
    };

    return /*#__PURE__*/React.createElement("div", {
      className: "button-setter"
    }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_dialogForm["default"], {
      bodyNode: bodyNode,
      visible: this.state.theDilogVisible,
      onClose: onClose
    }, /*#__PURE__*/React.createElement(_index2["default"], {
      change: theMessage
    }))), /*#__PURE__*/React.createElement(_button["default"], {
      onClick: onClose
    }, /*#__PURE__*/React.createElement(_icon["default"], {
      type: icon
    }), btnText));
  };
  return ButtonSetter;
}(React.Component);
exports["default"] = ButtonSetter;
ButtonSetter.displayName = 'ButtonSetter';