'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 __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var prop_types_1 = __importDefault(require("prop-types"));
var lodash_1 = __importDefault(require("lodash"));
var react_bootstrap_1 = require("react-bootstrap");
var Button_1 = require("./Button");
/** @alias GridRowActions~AlignTypes */
var AlignClassNameMaps = {
    left: 'pull-left',
    right: 'pull-right',
    none: 'grid-row-inline-action-group'
};
/** @name GridRowActions~AlignTypes */
exports.AlignTypes = lodash_1.default.mapValues(AlignClassNameMaps, function (val, key) { return key; });
var GridRowActions = /** @class */ (function (_super) {
    __extends(GridRowActions, _super);
    function GridRowActions() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GridRowActions.prototype.getAlignClassName = function () {
        return AlignClassNameMaps.hasOwnProperty(this.props.align)
            ? AlignClassNameMaps[this.props.align]
            : AlignClassNameMaps.right;
    };
    GridRowActions.prototype.render = function () {
        var legacyActions = this.props.actions.map(function (action, i) {
            return (react_1.default.createElement(Button_1.Button, { bsStyle: "link", "data-test-automation-id": action.testAutomationId, onClick: action.onClick, key: i }, action.text));
        });
        return (react_1.default.createElement(react_bootstrap_1.ButtonGroup, { className: this.getAlignClassName() + " rc-gridRowActions" }, legacyActions.concat(this.props.children || [])));
    };
    GridRowActions.propTypes = {
        actions: prop_types_1.default.array,
        align: prop_types_1.default.oneOf(lodash_1.default.keys(AlignClassNameMaps)),
        children: prop_types_1.default.node
    };
    GridRowActions.defaultProps = {
        actions: [],
        align: exports.AlignTypes.right,
        children: null
    };
    GridRowActions.AlignTypes = exports.AlignTypes;
    return GridRowActions;
}(react_1.default.Component));
exports.GridRowActions = GridRowActions;
//# sourceMappingURL=GridRowActions.js.map