"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var _ = require("lodash");
var dva_1 = require("dva");
var antd_1 = require("antd");
var VColContent = /** @class */ (function (_super) {
    __extends(VColContent, _super);
    function VColContent() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    VColContent.prototype.renderTitle = function () {
        var _a = this.props, icon = _a.icon, title = _a.title, actions = _a.actions;
        if (_.isEmpty(icon) && _.isEmpty(title) && _.isEmpty(actions)) {
            return null;
        }
        return React.createElement("div", { className: "vap-col-title" },
            icon && React.createElement(antd_1.Icon, { type: icon, className: "vap-col-title-icon" }),
            React.createElement("span", null, title),
            _.isArray(actions) && actions.length > 0 && React.createElement("div", { className: "vap-col-title-actions" }, actions));
    };
    VColContent.prototype.renderContext = function () {
        if (!_.has(this.props, 'loading_effect')) {
            return this.props.children || [];
        }
        // @ts-ignore
        return this.props._loading.effects[this.props.loading_effect] ? React.createElement(antd_1.Spin, { style: { display: 'block', margin: (this.props.loading_top || 48) + "px auto 0px" } }) : (this.props.children || []);
    };
    VColContent.prototype.render = function () {
        var _a = this.props, xs = _a.xs, sm = _a.sm, md = _a.md, lg = _a.lg, xl = _a.xl, span = _a.span;
        var colStyle = this.props.colStyle || {};
        var ColSpan = _.extend({ xs: 24 }, { xs: xs, sm: sm, md: md, lg: lg, xl: xl, span: span });
        var extraClass = this.props.className ? (' ' + this.props.className) : '';
        if (this.props.bordered === false) {
            return React.createElement(antd_1.Col, __assign({}, ColSpan, { className: "vap-col" + extraClass, style: colStyle }), this.renderContext());
        }
        return React.createElement(antd_1.Col, __assign({}, ColSpan, { className: "vap-col vap-col-fix" + extraClass, style: colStyle }),
            React.createElement(antd_1.Card, { className: "vap-card", title: this.renderTitle(), bordered: false, bodyStyle: this.props.bodyStyle, headStyle: this.props.headStyle, style: this.props.style }, this.renderContext()));
    };
    return VColContent;
}(React.PureComponent));
exports.VColContent = VColContent;
var VCol = dva_1.connect(function (_a) {
    var _loading = _a._loading;
    return ({ _loading: _loading });
})(VColContent);
exports.default = VCol;
