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, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { Column, ItemType } from './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.createElement(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.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('rc-column-tree-view', {
            'rc-column-tree-view-fixed-height': fixedHeight
        });
        return (React.createElement("div", { className: classNames, "data-test-automation-id": testAutomationId },
            columns.map(this.renderColumn),
            this.renderChildren()));
    };
    ColumnTreeView.propTypes = {
        children: PropTypes.node,
        columns: PropTypes.arrayOf(PropTypes.shape({
            parentId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
            isActive: PropTypes.bool,
            selectedId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
            items: PropTypes.arrayOf(ItemType)
        })),
        onSelect: PropTypes.func,
        countChildren: PropTypes.func,
        testAutomationId: PropTypes.string,
        fixedHeight: PropTypes.bool
    };
    ColumnTreeView.defaultProps = {
        children: null,
        columns: [],
        onSelect: function (id) { },
        countChildren: function (id) { return 0; },
        testAutomationId: 'columnTreeView',
        fixedHeight: false
    };
    return ColumnTreeView;
}(Component));
export { ColumnTreeView };
//# sourceMappingURL=ColumnTreeView.js.map