"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _tslib = require("tslib");

var _consoleComponents = require("@alicloud/console-components");

var _react = _interopRequireDefault(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var BalloonConfirm =
/** @class */
function (_super) {
  (0, _tslib.__extends)(BalloonConfirm, _super);

  function BalloonConfirm(props) {
    var _this = _super.call(this, props) || this;

    _this.clickTrigger = function () {
      _this.setState({
        visible: true
      });
    };

    _this.onOK = function () {
      _this.setState({
        visible: false
      });

      _this.props.onOK && _this.props.onOK();
    };

    _this.onCancel = function () {
      _this.setState({
        visible: false
      });

      _this.props.onCancel && _this.props.onCancel();
    };

    _this.onClose = function () {
      _this.setState({
        visible: false
      });

      _this.props.onClose && _this.props.onClose();
    };

    _this.state = {
      visible: false
    };
    return _this;
  }

  BalloonConfirm.prototype.render = function () {
    var _this = this;

    var _a = this.props,
        title = _a.title,
        description = _a.description,
        iconType = _a.iconType,
        iconSize = _a.iconSize,
        iconColor = _a.iconColor,
        local = _a.local,
        className = _a.className,
        onOK = _a.onOK,
        onCancel = _a.onCancel,
        _b = _a.okProps,
        okProps = _b === void 0 ? {} : _b,
        _c = _a.cancelProps,
        cancelProps = _c === void 0 ? {} : _c,
        rest = (0, _tslib.__rest)(_a, ["title", "description", "iconType", "iconSize", "iconColor", "local", "className", "onOK", "onCancel", "okProps", "cancelProps"]);
    return /*#__PURE__*/_react["default"].createElement(_consoleComponents.Balloon, (0, _tslib.__assign)({
      autoFocus: false,
      className: (0, _classnames["default"])("lp-balloon-confirm", className),
      visible: this.state.visible,
      onVisibleChange: function onVisibleChange(visible) {
        _this.setState({
          visible: visible
        });
      }
    }, rest), /*#__PURE__*/_react["default"].createElement("div", {
      className: "lp-balloon-confirm-content"
    }, /*#__PURE__*/_react["default"].createElement("p", {
      className: "title"
    }, /*#__PURE__*/_react["default"].createElement(_consoleComponents.Icon, {
      type: iconType,
      size: iconSize,
      className: "icon",
      style: {
        color: iconColor
      }
    }), /*#__PURE__*/_react["default"].createElement("span", {
      className: "text"
    }, title)), /*#__PURE__*/_react["default"].createElement("div", {
      className: "desc"
    }, description), /*#__PURE__*/_react["default"].createElement("div", {
      className: "footer"
    }, /*#__PURE__*/_react["default"].createElement(_consoleComponents.Button, (0, _tslib.__assign)({
      type: "primary",
      onClick: this.onOK
    }, okProps), local.ok), "\xA0\xA0", /*#__PURE__*/_react["default"].createElement(_consoleComponents.Button, (0, _tslib.__assign)({
      type: "normal",
      onClick: this.onCancel
    }, cancelProps), local.cancel))));
  };

  return BalloonConfirm;
}(_react["default"].Component);

BalloonConfirm.defaultProps = {
  align: 'tl',
  style: {
    maxWidth: '404px',
    padding: '20px'
  },
  triggerType: 'click',
  iconType: 'warning',
  iconSize: 'small',
  iconColor: '#FF8A00',
  local: {
    ok: "确认",
    cancel: "取消"
  }
};
var _default = BalloonConfirm;
exports["default"] = _default;