"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 ColumnItem_1 = require("./ColumnItem");
exports.ItemType = prop_types_1.default.shape({
    id: prop_types_1.default.oneOfType([prop_types_1.default.number, prop_types_1.default.string]),
    name: prop_types_1.default.oneOfType([prop_types_1.default.number, prop_types_1.default.string]),
    parentId: prop_types_1.default.oneOfType([prop_types_1.default.number, prop_types_1.default.string]),
    raw: prop_types_1.default.any
});
var Column = /** @class */ (function (_super) {
    __extends(Column, _super);
    function Column() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.renderItem = function (_a, index) {
            var id = _a.id, name = _a.name;
            var _b = _this.props, selectedId = _b.selectedId, isActive = _b.isActive, countChildren = _b.countChildren, onSelect = _b.onSelect;
            return (react_1.default.createElement(ColumnItem_1.ColumnItem, { key: id, id: id, name: name, isSelected: id === selectedId, isPrimary: id === selectedId && isActive, numChildren: countChildren(id), onSelect: onSelect, index: index }));
        };
        return _this;
    }
    Column.prototype.render = function () {
        var _a = this.props, items = _a.items, index = _a.index;
        return (react_1.default.createElement("div", { className: "rc-column-tree-view-col", "data-test-automation-id": "columnTreeViewColumn" + index },
            react_1.default.createElement("div", { className: "rc-column-tree-view-col-content" }, items.map(this.renderItem))));
    };
    Column.propTypes = {
        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(exports.ItemType),
        onSelect: prop_types_1.default.func,
        countChildren: prop_types_1.default.func,
        index: prop_types_1.default.number.isRequired
    };
    Column.defaultProps = {
        isActive: false,
        selectedId: null,
        items: [],
        onSelect: function (id) { },
        countChildren: function (id) { return 0; }
    };
    return Column;
}(react_1.Component));
exports.Column = Column;
//# sourceMappingURL=Column.js.map