@itwin/presentation-frontend
Version:
Frontend of iModel.js Presentation library
62 lines • 3.59 kB
TypeScript
/** @packageDocumentation
* @module UnifiedSelection
*/
import { Id64Arg } from "@itwin/core-bentley";
import { IModelRpcProps } from "@itwin/core-common";
import { IModelConnection } from "@itwin/core-frontend";
import { ClientDiagnosticsAttribute, ComputeSelectionRequestOptions, KeySet, KeySetJSON, SelectionScope, SelectionScopeProps, SelectionScopeRequestOptions } from "@itwin/presentation-common";
/**
* Properties for creating [[SelectionScopesManager]].
* @public
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
*/
export interface SelectionScopesManagerProps {
/** RPC handler to use for requesting selection scopes */
rpcRequestsHandler: {
/** Requests available selection scopes */
getSelectionScopes: (args: SelectionScopeRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute) => Promise<SelectionScope[]>;
/** Requests keys to be added to logical selection based on provided element IDs and selection scope */
computeSelection: (args: ComputeSelectionRequestOptions<IModelRpcProps> & ClientDiagnosticsAttribute) => Promise<KeySetJSON>;
};
/** Provider of active locale to use for localizing scopes */
localeProvider?: () => string | undefined;
}
/**
* A manager that knows available [selection scopes]($docs/presentation/unified-selection/index#selection-scopes)
* and can compute logical selection based on element IDs and selection scope.
*
* @public
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
*/
export declare class SelectionScopesManager {
private _rpcRequestsHandler;
private _getLocale;
private _activeScope;
constructor(props: SelectionScopesManagerProps);
/** Get active locale */
get activeLocale(): string | undefined;
/** The active selection scope or its id */
get activeScope(): SelectionScopeProps | SelectionScope | string | undefined;
set activeScope(scope: SelectionScopeProps | SelectionScope | string | undefined);
/**
* Get available selection scopes.
* @param imodel The iModel to get selection scopes for
* @param locale Optional locale to use when localizing scopes' label and description
*/
getSelectionScopes(imodel: IModelConnection, locale?: string): Promise<SelectionScope[]>;
/**
* Computes keys that need to be added to logical selection based on provided selection scope.
* @param ids Element IDs to compute selection for
* @param scope Selection scope to apply
*/
computeSelection(imodel: IModelConnection, ids: Id64Arg, scope: SelectionScopeProps | SelectionScope | string): Promise<KeySet>;
}
/**
* Normalizes given scope options and returns [[SelectionScopeProps]] that can be used for
* calculating selection with scope.
*
* @public
* @deprecated in 5.0 - will not be removed until after 2026-06-13. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.
*/
export declare function createSelectionScopeProps(scope: SelectionScopeProps | SelectionScope | string | undefined): SelectionScopeProps;
//# sourceMappingURL=SelectionScopesManager.d.ts.map