UNPKG

@itwin/presentation-testing

Version:

Testing utilities for iTwin.js Presentation library

82 lines 3.56 kB
/** @packageDocumentation * @module Hierarchies */ import { TreeNodeItem } from "@itwin/components-react"; import { IModelConnection } from "@itwin/core-frontend"; import { Omit, Ruleset } from "@itwin/presentation-common"; /** * Structure that describes a Node with any indexed properties * except `children`. * * @public * @deprecated in 5.2. All tree-related APIs have been deprecated in favor of the new generation hierarchy * building APIs (see https://github.com/iTwin/presentation/blob/33e79ee8d77f30580a9bab81a72884bda008db25/README.md#the-packages). */ export interface MappedNode { /** Indexer for all properties in this data structure */ [index: string]: any; /** Prohibited property */ children?: never; } /** * Node in a hierarchy. * @public * @deprecated in 5.2. All tree-related APIs have been deprecated in favor of the new generation hierarchy * building APIs (see https://github.com/iTwin/presentation/blob/33e79ee8d77f30580a9bab81a72884bda008db25/README.md#the-packages). */ export interface HierarchyNode extends Omit<MappedNode, "children"> { /** Children of this node */ children?: HierarchyNode[]; } /** * A function that converts `TreeNodeItem` into a new custom object. * @public * @deprecated in 5.2. All tree-related APIs have been deprecated in favor of the new generation hierarchy * building APIs (see https://github.com/iTwin/presentation/blob/33e79ee8d77f30580a9bab81a72884bda008db25/README.md#the-packages). */ export type NodeMappingFunc = (node: TreeNodeItem) => MappedNode; /** * Default [[NodeMappingFunc]] implementation that outputs the whole `TreeNodeItem` object. * @public * @deprecated in 5.2. All tree-related APIs have been deprecated in favor of the new generation hierarchy * building APIs (see https://github.com/iTwin/presentation/blob/33e79ee8d77f30580a9bab81a72884bda008db25/README.md#the-packages). */ export declare const defaultNodeMappingFunc: NodeMappingFunc; /** * Properties for creating a `HierarchyBuilder` instance. * @public * @deprecated in 5.2. All tree-related APIs have been deprecated in favor of the new generation hierarchy * building APIs (see https://github.com/iTwin/presentation/blob/33e79ee8d77f30580a9bab81a72884bda008db25/README.md#the-packages). */ export interface HierarchyBuilderProps { /** The iModel to pull data from */ imodel: IModelConnection; /** * A function that maps node to something that the user of * this API is interested in. E.g. custom implementation may skip some unimportant * node properties to make resulting object smaller and easier to read. */ nodeMappingFunc?: NodeMappingFunc; } /** * A class that constructs simple node hierarchy from specified * imodel and ruleset. * * @public * @deprecated in 5.2. All tree-related APIs have been deprecated in favor of the new generation hierarchy * building APIs (see https://github.com/iTwin/presentation/blob/33e79ee8d77f30580a9bab81a72884bda008db25/README.md#the-packages). */ export declare class HierarchyBuilder { private readonly _iModel; private readonly _nodeMappingFunc; /** Constructor */ constructor(props: HierarchyBuilderProps); private createSubHierarchy; private doCreateHierarchy; /** * Create a hierarchy using the supplied presentation ruleset. * @param rulesetOrId Either a [Ruleset]($presentation-common) object or a ruleset id. */ createHierarchy(rulesetOrId: Ruleset | string): Promise<HierarchyNode[]>; } //# sourceMappingURL=HierarchyBuilder.d.ts.map