@itwin/presentation-hierarchies
Version:
A package for creating hierarchies based on data in iTwin.js iModels.
80 lines • 3.23 kB
TypeScript
import "../internal/DisposePolyfill.js";
import { ECClassHierarchyInspector, ECSchemaProvider, Event, IPrimitiveValueFormatter } from "@itwin/presentation-shared";
import { HierarchyFilteringPath } from "../HierarchyFiltering.js";
import { HierarchyProvider } from "../HierarchyProvider.js";
import { HierarchyDefinition } from "./IModelHierarchyDefinition.js";
import { LimitingECSqlQueryExecutor } from "./LimitingECSqlQueryExecutor.js";
/**
* Defines the strings used by hierarchy provider.
* @public
*/
interface IModelHierarchyProviderLocalizedStrings {
/**
* A string for "Unspecified". Used for labels of property grouping nodes
* that group by an empty value.
*/
unspecified: string;
/**
* A string for "Other". Used for label of a range property grouping node that
* groups values which don't fit into any other range.
*/
other: string;
}
/** @public */
type IModelAccess = ECSchemaProvider & LimitingECSqlQueryExecutor & ECClassHierarchyInspector & {
imodelKey: string;
};
/**
* Props for `createIModelHierarchyProvider`.
* @public
*/
interface IModelHierarchyProviderProps {
/**
* An object that provides access to iModel's data and metadata.
*
* @see `ECSchemaProvider`
* @see `LimitingECSqlQueryExecutor`
* @see `ECClassHierarchyInspector`
*/
imodelAccess: IModelAccess;
/** An event that is raised when iModel data, that may affect the hierarchy, changes. */
imodelChanged?: Event<() => void>;
/**
* A function that returns a hierarchy definition, describing how the hierarchy that the provider should be create. The
* function is called once during the provider's construction.
*/
hierarchyDefinition: HierarchyDefinition;
/** Maximum number of queries that the provider attempts to execute in parallel. Defaults to `10`. */
queryConcurrency?: number;
/**
* The amount of queries whose results are stored in-memory for quick retrieval. Defaults to `1`,
* which means only results of the last run query are cached.
*/
queryCacheSize?: number;
/** A set of localized strings to use. Defaults to English strings. */
localizedStrings?: Partial<IModelHierarchyProviderLocalizedStrings>;
/**
* A values formatter for formatting node labels. Defaults to the
* result of `createDefaultValueFormatter` called with default parameters. May be overridden
* by calling `setFormatter` on the provider instance.
*/
formatter?: IPrimitiveValueFormatter;
/** Props for filtering the hierarchy. */
filtering?: {
/** A list of node identifiers from root to target node. */
paths: HierarchyFilteringPath[];
};
}
/**
* Creates an instance of `HierarchyProvider` that creates a hierarchy based on given iModel and
* a hierarchy definition, which defines each hierarchy level through ECSQL queries.
*
* @public
*/
export declare function createIModelHierarchyProvider(props: IModelHierarchyProviderProps): HierarchyProvider & {
/** @deprecated in 1.4. Use `[Symbol.dispose]` instead. */
dispose: () => void;
[Symbol.dispose]: () => void;
};
export {};
//# sourceMappingURL=IModelHierarchyProvider.d.ts.map