@itwin/presentation-hierarchies-react
Version:
React components based on `@itwin/presentation-hierarchies`
57 lines • 2.65 kB
TypeScript
import { createIModelHierarchyProvider, HierarchyDefinition, HierarchyFilteringPath } from "@itwin/presentation-hierarchies";
import { Props } from "@itwin/presentation-shared";
import { UseUnifiedTreeSelectionProps } from "./internal/UseUnifiedSelection.js";
import { UseTreeProps, UseTreeResult } from "./UseTree.js";
/** @public */
type IModelHierarchyProviderProps = Props<typeof createIModelHierarchyProvider>;
/** @public */
type IModelAccess = IModelHierarchyProviderProps["imodelAccess"];
/**
* Props for `useIModelTree` and `useIModelUnifiedSelectionTree` hooks.
* @public
*/
type UseIModelTreeProps = Omit<UseTreeProps, "getHierarchyProvider" | "getFilteredPaths"> & Pick<IModelHierarchyProviderProps, "localizedStrings" | "imodelAccess" | "imodelChanged"> & {
/** Provides the hierarchy definition for the tree. */
getHierarchyDefinition: (props: {
imodelAccess: IModelAccess;
}) => HierarchyDefinition;
/** Provides paths to filtered nodes. */
getFilteredPaths?: (props: {
/** Object that provides access to the iModel schema and can run queries against the iModel. */
imodelAccess: IModelAccess;
/** Signal indicating that that the request was canceled */
abortSignal: AbortSignal;
}) => Promise<HierarchyFilteringPath[] | undefined>;
};
/**
* A React hook that creates state for a tree component whose displayed hierarchy is based on
* iModel data.
*
* The hook uses `@itwin/presentation-hierarchies` package to load the hierarchy data and returns a
* component-agnostic result which may be used to render the hierarchy using any UI framework.
*
* See `README.md` for an example
*
* @see `useTree`
* @see `useIModelUnifiedSelectionTree`
* @public
*/
export declare function useIModelTree(props: UseIModelTreeProps): UseTreeResult;
/**
* A React hook that creates state for a tree component whose displayed hierarchy is based on
* iModel data and that is integrated with unified selection through the given selection
* storage (previously the storage was provided through the, now deprecated, `UnifiedSelectionProvider`).
*
* The hook uses `@itwin/presentation-hierarchies` package to load the hierarchy data and returns a
* component-agnostic result which may be used to render the hierarchy using any UI framework.
*
* See `README.md` for an example
*
* @see `useIModelTree`
* @see `useUnifiedSelectionTree`
* @see `UnifiedSelectionProvider`
* @public
*/
export declare function useIModelUnifiedSelectionTree(props: UseIModelTreeProps & UseUnifiedTreeSelectionProps): UseTreeResult;
export {};
//# sourceMappingURL=UseIModelTree.d.ts.map