UNPKG

@itwin/unified-selection

Version:

Package for managing unified selection in iTwin.js applications.

52 lines 2.02 kB
import { Id64Arg } from "@itwin/core-bentley"; import { ECSqlQueryExecutor } from "@itwin/presentation-shared"; import { SelectableInstanceKey } from "./Selectable.js"; /** * Available selection scopes. * @public */ type SelectionScopeIdentifier = "element" | "model" | "category" | "functional"; /** * Props for computing element selection. * @public */ export interface ElementSelectionScopeProps { /** Identifies this as either "element" or "functional" selection scope */ id: "element" | "functional"; /** * Specifies how far "up" we should walk to find the target element. When not specified or `0`, * the target element matches the request element. When set to `1`, the target element matches the direct parent element. * When set to `2`, the target element is parent of the parent element and so on. In all situations when this is `> 0`, * we're not walking further than the last existing element, for example when `ancestorLevel = 1` (direct parent * element is requested), but the request element doesn't have a parent, the request element is returned as the result. * A negative value would result in the top-most element to be returned. */ ancestorLevel?: number; } /** * A union of types that can be used to define a selection scope. * @public * @since 1.4.0 */ export type SelectionScope = ElementSelectionScopeProps | { id: SelectionScopeIdentifier; } | SelectionScopeIdentifier; /** * Props for `computeSelection`. * @public */ export interface ComputeSelectionProps { /** iModel query executor. */ queryExecutor: ECSqlQueryExecutor; /** IDs of elements to compute selection for. */ elementIds: Id64Arg; /** Selection scope to compute selection with. */ scope: SelectionScope; } /** * Computes selection from given element IDs. * @public */ export declare function computeSelection(props: ComputeSelectionProps): AsyncIterableIterator<SelectableInstanceKey>; export {}; //# sourceMappingURL=SelectionScope.d.ts.map