import _Button from "@alifd/next/es/button";
import _Icon from "@alifd/next/es/icon";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import * as React from 'react';
import { Component } from 'react';
import "./index.scss";
import DialogForm from "../../components/common/dialog-form";
// import ActivityForm from '../../components/common/activity-form/index';
import ActivityForm from "../../components/common/activity-form2/index";
import { preview } from "../../utils";
var ButtonSetter = /*#__PURE__*/function (_Component) {
  _inheritsLoose(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() {
      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, {
      bodyNode: bodyNode,
      visible: this.state.theDilogVisible,
      onClose: onClose
    }, /*#__PURE__*/React.createElement(ActivityForm, {
      change: theMessage
    }))), /*#__PURE__*/React.createElement(_Button, {
      onClick: onClose
    }, /*#__PURE__*/React.createElement(_Icon, {
      type: icon
    }), btnText));
  };
  return ButtonSetter;
}(Component);
ButtonSetter.displayName = 'ButtonSetter';
export { ButtonSetter as default };