import { __assign, __extends, __rest } from "tslib";
/*
 提示框
 */
import React, { Component } from 'react';
import classnames from 'classnames';
import { Dialog, Icon } from '@alicloud/console-components';
var IotAlert = /** @class */ (function (_super) {
    __extends(IotAlert, _super);
    function IotAlert(props) {
        var _this = _super.call(this, props) || this;
        _this.handleOnClose = function (trigger, event) {
            if (_this.props.isQuick) {
                _this.setState({ visible: false });
                _this.props.onClose && _this.props.onClose(trigger, event);
            }
            else {
                _this.props.onClose && _this.props.onClose(trigger, event);
            }
        };
        _this.handleOnOK = function (event) {
            if (_this.props.isQuick) {
                _this.setState({ visible: false });
                _this.props.onOk && _this.props.onOk(event);
            }
            else {
                _this.props.onOk && _this.props.onOk(event);
            }
        };
        _this.state = {
            visible: true
        };
        return _this;
    }
    IotAlert.prototype.render = function () {
        var _a = this.props, isQuick = _a.isQuick, visible = _a.visible, noIcon = _a.noIcon, onClose = _a.onClose, onOk = _a.onOk, iconColor = _a.iconColor, iconType = _a.iconType, iconSize = _a.iconSize, title = _a.title, content = _a.content, children = _a.children, className = _a.className, options = __rest(_a, ["isQuick", "visible", "noIcon", "onClose", "onOk", "iconColor", "iconType", "iconSize", "title", "content", "children", "className"]);
        var contentResult = content || children;
        var classname = classnames('theme-variable-value', className);
        var resultVisible = isQuick ? this.state.visible : visible;
        return (React.createElement(Dialog, __assign({}, options, { visible: resultVisible, onClose: this.handleOnClose, onOk: this.handleOnOK, className: classname, footerActions: ["ok"] }),
            React.createElement("div", { className: "alert-warp" },
                !noIcon ? (React.createElement("div", { className: "icon-warp" },
                    React.createElement(Icon, { type: iconType, size: iconSize, style: iconColor ? { color: iconColor } : {} }))) : null,
                React.createElement("div", { className: "alert-bd" },
                    title ? React.createElement("div", { className: "alert-title" }, title) : null,
                    contentResult ? React.createElement("div", { className: "alert-content" }, contentResult) : null))));
    };
    return IotAlert;
}(Component));
IotAlert.defaultProps = {
    visible: false,
    iconType: 'warning',
    iconSize: 'large',
    noIcon: false,
    iconColor: undefined,
    locale: {
        ok: '确定'
    },
};
export default IotAlert;
