"use strict";
/*---------------------------------------------------------------------------------------------
* 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
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.SpatialContainmentTree = exports.RULESET_SPATIAL_BREAKDOWN_GROUPED_BY_CLASS = exports.RULESET_SPATIAL_BREAKDOWN = void 0;
/* eslint-disable deprecation/deprecation */
require("./SpatialContainmentTree.scss");
const React = require("react");
const presentation_components_1 = require("@itwin/presentation-components");
const components_react_1 = require("@itwin/components-react");
const core_react_1 = require("@itwin/core-react");
const Common_1 = require("../Common");
const PAGING_SIZE = 20;
/** @internal */
exports.RULESET_SPATIAL_BREAKDOWN = require("./SpatialBreakdown.json"); // eslint-disable-line @typescript-eslint/no-var-requires
/** @internal */
exports.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.
 */
function SpatialContainmentTree(props) {
    const { nodeLoader } = (0, presentation_components_1.usePresentationTreeNodeLoader)({
        imodel: props.iModel,
        ruleset: (!props.enableElementsClassGrouping) ? exports.RULESET_SPATIAL_BREAKDOWN : /* istanbul ignore next */ exports.RULESET_SPATIAL_BREAKDOWN_GROUPED_BY_CLASS,
        appendChildrenCountForGroupingNodes: (props.enableElementsClassGrouping === Common_1.ClassGroupingOption.YesWithCounts),
        pagingSize: PAGING_SIZE,
    });
    const eventHandler = (0, core_react_1.useDisposable)(React.useCallback(() => new presentation_components_1.UnifiedSelectionTreeEventHandler({
        nodeLoader,
        collapsedChildrenDisposalEnabled: true,
    }), [nodeLoader]));
    const treeModel = (0, components_react_1.useTreeModel)(nodeLoader.modelSource);
    return (React.createElement("div", { className: "ui-fw-spatial-tree" },
        React.createElement(components_react_1.ControlledTree, { model: treeModel, nodeLoader: nodeLoader, eventsHandler: eventHandler, selectionMode: components_react_1.SelectionMode.Extended, width: props.width, height: props.height })));
}
exports.SpatialContainmentTree = SpatialContainmentTree;
//# sourceMappingURL=SpatialContainmentTree.js.map