/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module IModelComponents
 */
/* eslint-disable deprecation/deprecation */
import "./SpatialContainmentTree.scss";
import * as React from "react";
import { UnifiedSelectionTreeEventHandler, usePresentationTreeNodeLoader } from "@itwin/presentation-components";
import { ControlledTree, SelectionMode, useTreeModel } from "@itwin/components-react";
import { useDisposable } from "@itwin/core-react";
import { ClassGroupingOption } from "../Common";
const PAGING_SIZE = 20;
/** @internal */
export const RULESET_SPATIAL_BREAKDOWN = require("./SpatialBreakdown.json"); // eslint-disable-line @typescript-eslint/no-var-requires
/** @internal */
export const RULESET_SPATIAL_BREAKDOWN_GROUPED_BY_CLASS = require("./SpatialBreakdown.GroupedByClass.json"); // eslint-disable-line @typescript-eslint/no-var-requires
/**
 * Tree which displays and manages models or categories contained in an iModel.
 * @public
 * @deprecated in 3.6. Use 'SpatialContainmentTree' from `@itwin/breakdown-trees-react` package.
 */
export function SpatialContainmentTree(props) {
    const { nodeLoader } = usePresentationTreeNodeLoader({
        imodel: props.iModel,
        ruleset: (!props.enableElementsClassGrouping) ? RULESET_SPATIAL_BREAKDOWN : /* istanbul ignore next */ RULESET_SPATIAL_BREAKDOWN_GROUPED_BY_CLASS,
        appendChildrenCountForGroupingNodes: (props.enableElementsClassGrouping === ClassGroupingOption.YesWithCounts),
        pagingSize: PAGING_SIZE,
    });
    const eventHandler = useDisposable(React.useCallback(() => new UnifiedSelectionTreeEventHandler({
        nodeLoader,
        collapsedChildrenDisposalEnabled: true,
    }), [nodeLoader]));
    const treeModel = useTreeModel(nodeLoader.modelSource);
    return (React.createElement("div", { className: "ui-fw-spatial-tree" },
        React.createElement(ControlledTree, { model: treeModel, nodeLoader: nodeLoader, eventsHandler: eventHandler, selectionMode: SelectionMode.Extended, width: props.width, height: props.height })));
}
//# sourceMappingURL=SpatialContainmentTree.js.map