"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 __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
    result["default"] = mod;
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importStar(require("react"));
var prop_types_1 = __importDefault(require("prop-types"));
var classnames_1 = __importDefault(require("classnames"));
var Column_1 = require("./Column");
var ColumnTreeView = /** @class */ (function (_super) {
    __extends(ColumnTreeView, _super);
    function ColumnTreeView() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.renderColumn = function (_a, index) {
            var parentId = _a.parentId, isActive = _a.isActive, selectedId = _a.selectedId, items = _a.items;
            var _b = _this.props, onSelect = _b.onSelect, countChildren = _b.countChildren;
            return (react_1.default.createElement(Column_1.Column, { key: parentId, isActive: isActive, selectedId: selectedId, items: items, onSelect: onSelect, countChildren: countChildren, index: index }));
        };
        _this.renderChildren = function () {
            var children = _this.props.children;
            var wrappedChildren = null;
            if (children) {
                wrappedChildren = react_1.default.createElement("div", { className: "rc-column-tree-view-content" }, children);
            }
            return wrappedChildren;
        };
        return _this;
    }
    ColumnTreeView.prototype.render = function () {
        var _a = this.props, columns = _a.columns, testAutomationId = _a.testAutomationId, fixedHeight = _a.fixedHeight;
        var classNames = classnames_1.default('rc-column-tree-view', {
            'rc-column-tree-view-fixed-height': fixedHeight
        });
        return (react_1.default.createElement("div", { className: classNames, "data-test-automation-id": testAutomationId },
            columns.map(this.renderColumn),
            this.renderChildren()));
    };
    ColumnTreeView.propTypes = {
        children: prop_types_1.default.node,
        columns: prop_types_1.default.arrayOf(prop_types_1.default.shape({
            parentId: prop_types_1.default.oneOfType([prop_types_1.default.number, prop_types_1.default.string]),
            isActive: prop_types_1.default.bool,
            selectedId: prop_types_1.default.oneOfType([prop_types_1.default.number, prop_types_1.default.string]),
            items: prop_types_1.default.arrayOf(Column_1.ItemType)
        })),
        onSelect: prop_types_1.default.func,
        countChildren: prop_types_1.default.func,
        testAutomationId: prop_types_1.default.string,
        fixedHeight: prop_types_1.default.bool
    };
    ColumnTreeView.defaultProps = {
        children: null,
        columns: [],
        onSelect: function (id) { },
        countChildren: function (id) { return 0; },
        testAutomationId: 'columnTreeView',
        fixedHeight: false
    };
    return ColumnTreeView;
}(react_1.Component));
exports.ColumnTreeView = ColumnTreeView;
//# sourceMappingURL=ColumnTreeView.js.map