"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TreeList = TreeList;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const InfiniteTable_1 = require("../../InfiniteTable");
const Flex_1 = require("../../Flex");
const clsx_1 = tslib_1.__importDefault(require("clsx"));
const columns = {
    label: {
        field: 'label',
        header: 'Label',
        defaultFlex: 1,
        renderTreeIcon: true,
        renderSelectionCheckBox: true,
        defaultSortable: false,
    },
};
const domProps = {
    className: 'ab-TreeList twa:flex-1 twa:h-full',
};
const DEFAULT_TREE_EXPAND_STATE = {
    expandedPaths: [],
    defaultExpanded: false,
};
function TreeList(props) {
    return (React.createElement(Flex_1.Flex, { flexDirection: 'column', className: "ab-TreeList twa:flex-1", 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, clsx_1.default)(domProps.className, props.domProps?.className),
                    style: { ...domProps.style, ...props.domProps?.style },
                }, columns: props.columns ?? columns, showZebraRows: false }))));
}
