'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 __());
    };
})();
import React from 'react';
import PropTypes from 'prop-types';
import _ from 'lodash';
import { ButtonGroup } from 'react-bootstrap';
import { Button } from './Button';
/** @alias GridRowActions~AlignTypes */
var AlignClassNameMaps = {
    left: 'pull-left',
    right: 'pull-right',
    none: 'grid-row-inline-action-group'
};
/** @name GridRowActions~AlignTypes */
export var AlignTypes = _.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.createElement(Button, { bsStyle: "link", "data-test-automation-id": action.testAutomationId, onClick: action.onClick, key: i }, action.text));
        });
        return (React.createElement(ButtonGroup, { className: this.getAlignClassName() + " rc-gridRowActions" }, legacyActions.concat(this.props.children || [])));
    };
    GridRowActions.propTypes = {
        actions: PropTypes.array,
        align: PropTypes.oneOf(_.keys(AlignClassNameMaps)),
        children: PropTypes.node
    };
    GridRowActions.defaultProps = {
        actions: [],
        align: AlignTypes.right,
        children: null
    };
    GridRowActions.AlignTypes = AlignTypes;
    return GridRowActions;
}(React.Component));
export { GridRowActions };
//# sourceMappingURL=GridRowActions.js.map