UNPKG

@itwin/presentation-components

Version:

React components based on iTwin.js Presentation library

69 lines 3.24 kB
/** * @packageDocumentation * @module UnifiedSelection */ import { IModelConnection } from "@itwin/core-frontend"; import { Keys, KeySet } from "@itwin/presentation-common"; /** * Interface for accessing and modifying Unified Selection within React components. * @public * @deprecated in 5.9.0. The `@itwin/unified-selection-react` package should be used instead. */ export interface UnifiedSelectionContext { /** iModel associated with the selection. */ imodel: IModelConnection; /** Default selection level. */ selectionLevel: number; /** * Returns current selection. This is a different function each time selection at `selectionLevel` changes. The * returned `KeySet` object exposes global data and is mutable. If you need to pass information about the current * selection across React components, prefer [[UnifiedSelectionState]] over `KeySet` objects. */ getSelection: UnifiedSelectionState; /** Adds keys to current selection. */ addToSelection(keys: Keys, level?: number): void; /** Removes keys from current selection. */ removeFromSelection(keys: Keys, level?: number): void; /** Removes all keys from current selection and selects only the specified keys. */ replaceSelection(keys: Keys, level?: number): void; /** Removes all keys from current selection. */ clearSelection(level?: number): void; } /** * Describes how to access the current Unified Selection state. The returned `KeySet` object exposes global data and is * mutable. * @public * @deprecated in 5.9.0. The `@itwin/unified-selection-react` package should be used instead. */ export type UnifiedSelectionState = (selectionLevel?: number) => Readonly<KeySet>; /** * Props for Unified Selection context provider. * @public * @deprecated in 5.9.0. The `@itwin/unified-selection-react` package should be used instead. */ export interface UnifiedSelectionContextProviderProps { /** iModel associated with the selection. */ imodel: IModelConnection; /** * Specifies the selection level to watch for selection changes. Changes at deeper levels will not trigger context * updates. This also becomes the default selection level for [[UnifiedSelectionContext]]. Defaults to `0`. */ selectionLevel?: number; /** Child elements. */ children?: React.ReactNode; } /** * Unified Selection context provider. It adapts framework-agnostic * [Unified Selection]($docs/presentation/unified-selection/index.md) API to be better suited for React * applications. The provided context is accessible via [[useUnifiedSelectionContext]] hook. * @public * @deprecated in 5.9.0. Use `UnifiedSelectionContextProvider` from `@itwin/unified-selection-react` package instead. */ export declare function UnifiedSelectionContextProvider(props: UnifiedSelectionContextProviderProps): React.ReactElement; /** * Returns Unified Selection context provided by [[UnifiedSelectionContextProvider]]. * @public * @deprecated in 5.9.0. Use `useUnifiedSelectionContext` from `@itwin/unified-selection-react` package instead. */ export declare function useUnifiedSelectionContext(): UnifiedSelectionContext | undefined; //# sourceMappingURL=UnifiedSelectionContext.d.ts.map