"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TreeList = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const InfiniteTable_1 = require("../../InfiniteTable");
const rebass_1 = require("rebass");
const join_1 = tslib_1.__importDefault(require("../../utils/join"));
const columns = {
    label: {
        field: 'label',
        header: 'Label',
        defaultFlex: 1,
        renderTreeIcon: true,
        renderSelectionCheckBox: true,
        defaultSortable: false,
    },
};
const domProps = {
    style: {
        height: '100%',
        flex: 1,
    },
    className: 'ab-TreeList',
};
const DEFAULT_TREE_EXPAND_STATE = {
    expandedPaths: [],
    defaultExpanded: false,
};
function TreeList(props) {
    return (React.createElement(rebass_1.Flex, { flex: 1, flexDirection: 'column', className: "ab-TreeList", style: props.style },
        React.createElement(InfiniteTable_1.TreeDataSource, { data: props.options, primaryKey: props.primaryKey ?? 'id', defaultTreeSelection: props.defaultTreeSelection, treeSelection: props.treeSelection, onTreeSelectionChange: props.onTreeSelectionChange, treeFilterFunction: props.treeFilterFunction, onTreeExpandStateChange: props.onTreeExpandStateChange, defaultTreeExpandState: props.defaultTreeExpandState ?? DEFAULT_TREE_EXPAND_STATE },
            React.createElement(InfiniteTable_1.TreeGrid, { defaultActiveRowIndex: 0, onReady: props.onReady, debugId: props.debugId, keyboardSelection: true, rowHeight: props.rowHeight ?? '--ab-grid-row-height', keyboardNavigation: "row", columnHeaderHeight: props.columnHeaderHeight, domProps: {
                    ...domProps,
                    ...props.domProps,
                    className: (0, join_1.default)(domProps.className, props.domProps?.className),
                    style: { ...domProps.style, ...props.domProps?.style },
                }, columns: props.columns ?? columns, showZebraRows: false }))));
}
exports.TreeList = TreeList;
