/** @packageDocumentation * @module Core */ import { BeEvent, IDisposable } from "@bentley/bentleyjs-core"; import { IModelConnection } from "@bentley/imodeljs-frontend"; import { Content, ContentDescriptorRequestOptions, ContentRequestOptions, ContentUpdateInfo, Descriptor, DescriptorOverrides, DisplayLabelRequestOptions, DisplayLabelsRequestOptions, DisplayValueGroup, DistinctValuesRequestOptions, ElementProperties, ElementPropertiesRequestOptions, ExtendedContentRequestOptions, ExtendedHierarchyRequestOptions, HierarchyCompareOptions, HierarchyRequestOptions, HierarchyUpdateInfo, InstanceKey, KeySet, LabelDefinition, LabelRequestOptions, Node, NodeKey, NodePathElement, Paged, PagedResponse, PageOptions, PartialHierarchyModification, PresentationUnitSystem, RpcRequestsHandler, RulesetVariable, SelectionInfo } from "@bentley/presentation-common"; import { IpcRequestsHandler } from "./IpcRequestsHandler"; import { RulesetManager } from "./RulesetManager"; import { RulesetVariablesManager } from "./RulesetVariablesManager"; import { StateTracker } from "./StateTracker"; /** * Data structure that describes IModel hierarchy change event arguments. * @alpha */ export interface IModelHierarchyChangeEventArgs { /** Id of ruleset that was used to create hierarchy. */ rulesetId: string; /** Hierarchy changes info. */ updateInfo: HierarchyUpdateInfo; /** Key of iModel that was used to create hierarchy. It matches [[IModelConnection.key]] property. */ imodelKey: string; } /** * Data structure that describes iModel content change event arguments. * @alpha */ export interface IModelContentChangeEventArgs { /** Id of ruleset that was used to create content. */ rulesetId: string; /** Content changes info. */ updateInfo: ContentUpdateInfo; /** Key of iModel that was used to create content. It matches [[IModelConnection.key]] property. */ imodelKey: string; } /** * Properties used to configure [[PresentationManager]] * @public */ export interface PresentationManagerProps { /** * Sets the active locale to use when localizing presentation-related * strings. It can later be changed through [[PresentationManager]]. */ activeLocale?: string; /** * Sets the active unit system to use for formatting property values with * units. Default presentation units are used if this is not specified. The active unit * system can later be changed through [[PresentationManager]] or overriden for each request * * @alpha */ activeUnitSystem?: PresentationUnitSystem; /** * ID used to identify client that requests data. Generally, clients should * store this ID in their local storage so the ID can be reused across * sessions - this allows reusing some caches. * * Defaults to a unique GUID as a client id. */ clientId?: string; /** @internal */ rpcRequestsHandler?: RpcRequestsHandler; /** @internal */ ipcRequestsHandler?: IpcRequestsHandler; /** @internal */ stateTracker?: StateTracker; } /** * Frontend Presentation manager which basically just forwards all calls to * the backend implementation. * * @public */ export declare class PresentationManager implements IDisposable { private _requestsHandler; private _rulesets; private _localizationHelper; private _rulesetVars; private _clearEventListener?; private _connections; private _ipcRequestsHandler?; private _stateTracker?; /** * An event raised when hierarchies created using specific ruleset change * @alpha */ onIModelHierarchyChanged: BeEvent<(args: IModelHierarchyChangeEventArgs) => void>; /** * An event raised when content created using specific ruleset changes * @alpha */ onIModelContentChanged: BeEvent<(args: IModelContentChangeEventArgs) => void>; /** Get / set active locale used for localizing presentation data */ activeLocale: string | undefined; /** Get / set active unit system used to format property values with units */ activeUnitSystem: PresentationUnitSystem | undefined; private constructor(); dispose(): void; private onConnection; private initializeIModel; private onUpdate; /** @note This is only called in native apps after changes in iModels */ private handleUpdateAsync; /** * Compare two hierarchies. * @public */ compareHierarchies(props: HierarchyCompareOptions): Promise; /** Function that is called when a new IModelConnection is used to retrieve data. * @internal */ onNewiModelConnection(_: IModelConnection): Promise; /** * Create a new PresentationManager instance * @param props Optional properties used to configure the manager */ static create(props?: PresentationManagerProps): PresentationManager; /** @internal */ get rpcRequestsHandler(): RpcRequestsHandler; /** @internal */ get ipcRequestsHandler(): IpcRequestsHandler | undefined; /** @internal */ get stateTracker(): StateTracker | undefined; /** * Get rulesets manager */ rulesets(): RulesetManager; /** * Get ruleset variables manager for specific ruleset * @param rulesetId Id of the ruleset to get the vars manager for */ vars(rulesetId: string): RulesetVariablesManager; private toRpcTokenOptions; private addRulesetAndVariablesToOptions; /** * Retrieves nodes * @deprecated Use an overload with [[ExtendedHierarchyRequestOptions]] */ getNodes(requestOptions: Paged>, parentKey: NodeKey | undefined): Promise; /** Retrieves nodes */ getNodes(requestOptions: Paged>): Promise; /** * Retrieves nodes count. * @deprecated Use an overload with [[ExtendedHierarchyRequestOptions]] */ getNodesCount(requestOptions: HierarchyRequestOptions, parentKey: NodeKey | undefined): Promise; /** Retrieves nodes count. */ getNodesCount(requestOptions: ExtendedHierarchyRequestOptions): Promise; /** * Retrieves total nodes count and a single page of nodes. * @deprecated Use an overload with [[ExtendedHierarchyRequestOptions]] */ getNodesAndCount(requestOptions: Paged>, parentKey: NodeKey | undefined): Promise<{ count: number; nodes: Node[]; }>; /** Retrieves total nodes count and a single page of nodes. */ getNodesAndCount(requestOptions: Paged>): Promise<{ count: number; nodes: Node[]; }>; /** * Retrieves paths from root nodes to children nodes according to specified keys. Intersecting paths will be merged. * @param requestOptions options for the request * @param paths Paths from root node to some child node. * @param markedIndex Index of the path in `paths` that will be marked. * @return A promise object that returns either an array of paths on success or an error string on error. */ getNodePaths(requestOptions: ExtendedHierarchyRequestOptions, paths: InstanceKey[][], markedIndex: number): Promise; /** * Retrieves paths from root nodes to nodes containing filter text in their label. * @param requestOptions options for the request * @param filterText Text to filter nodes against. * @return A promise object that returns either an array of paths on success or an error string on error. */ getFilteredNodePaths(requestOptions: ExtendedHierarchyRequestOptions, filterText: string): Promise; /** * A no-op that used to request the whole hierarchy to be loaded on the backend. * @alpha @deprecated Will be removed in 3.0. */ loadHierarchy(_requestOptions: HierarchyRequestOptions): Promise; /** * Retrieves the content descriptor which describes the content and can be used to customize it. * @deprecated Use an overload with [[ContentDescriptorRequestOptions]] */ getContentDescriptor(requestOptions: ContentRequestOptions, displayType: string, keys: KeySet, selection: SelectionInfo | undefined): Promise; getContentDescriptor(requestOptions: ContentDescriptorRequestOptions): Promise; /** * Retrieves content set size based on the supplied content descriptor override. * @deprecated Use an overload with [[ExtendedContentRequestOptions]] */ getContentSetSize(requestOptions: ContentRequestOptions, descriptorOrOverrides: Descriptor | DescriptorOverrides, keys: KeySet): Promise; getContentSetSize(requestOptions: ExtendedContentRequestOptions): Promise; /** * Retrieves the content based on the supplied content descriptor override. * @deprecated Use an overload with [[ExtendedContentRequestOptions]] */ getContent(requestOptions: Paged>, descriptorOrOverrides: Descriptor | DescriptorOverrides, keys: KeySet): Promise; getContent(requestOptions: Paged>): Promise; /** * Retrieves the content and content set size based on the supplied content descriptor override. * @deprecated Use an overload with [[ExtendedContentRequestOptions]] */ getContentAndSize(requestOptions: Paged>, descriptorOrOverrides: Descriptor | DescriptorOverrides, keys: KeySet): Promise<{ content: Content; size: number; } | undefined>; getContentAndSize(requestOptions: Paged>): Promise<{ content: Content; size: number; } | undefined>; /** * Retrieves distinct values of specific field from the content based on the supplied content descriptor override. * @param requestOptions options for the request * @param descriptorOrOverrides Content descriptor which specifies how the content should be returned. * @param keys Keys of ECInstances to get the content for. * @param fieldName Name of the field from which to take values. * @param maximumValueCount Maximum numbers of values that can be returned. Unlimited if 0. * @return A promise object that returns either distinct values on success or an error string on error. * @deprecated Use [[getPagedDistinctValues]] */ getDistinctValues(requestOptions: ContentRequestOptions, descriptorOrOverrides: Descriptor | DescriptorOverrides, keys: KeySet, fieldName: string, maximumValueCount?: number): Promise; /** * Retrieves distinct values of specific field from the content based on the supplied content descriptor override. * @param requestOptions Options for the request * @public */ getPagedDistinctValues(requestOptions: DistinctValuesRequestOptions): Promise>; /** * Retrieves property data in a simplified format for a single element specified by ID. * @beta */ getElementProperties(requestOptions: ElementPropertiesRequestOptions): Promise; /** * Retrieves display label definition of specific item * @deprecated Use an overload with [[DisplayLabelRequestOptions]] */ getDisplayLabelDefinition(requestOptions: LabelRequestOptions, key: InstanceKey): Promise; getDisplayLabelDefinition(requestOptions: DisplayLabelRequestOptions): Promise; /** * Retrieves display label definition of specific items * @deprecated Use an overload with [[DisplayLabelsRequestOptions]] */ getDisplayLabelDefinitions(requestOptions: LabelRequestOptions, keys: InstanceKey[]): Promise; getDisplayLabelDefinitions(requestOptions: DisplayLabelsRequestOptions): Promise; } /** @internal */ export declare const buildPagedResponse: (requestedPage: PageOptions | undefined, getter: (page: Required, requestIndex: number) => Promise>) => Promise>; //# sourceMappingURL=PresentationManager.d.ts.map