Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@itwin/unified-selection

Package Overview
Dependencies
Maintainers
5
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@itwin/unified-selection - npm Package Compare versions

Comparing version 0.4.4 to 0.4.5

9

CHANGELOG.md
# @itwin/unified-selection
## 0.4.5
### Patch Changes
- [#657](https://github.com/iTwin/presentation/pull/657): Updated `enableUnifiedSelectionSyncWithIModel` to batch iModel selection changes before synchronizing with `SelectionStorage`.
- [#655](https://github.com/iTwin/presentation/pull/655): Remove exposed internal APIs.
- Updated dependencies:
- @itwin/presentation-shared@0.3.2
## 0.4.4

@@ -4,0 +13,0 @@

7

lib/cjs/unified-selection/CachingHiliteSetProvider.d.ts

@@ -6,6 +6,8 @@ import { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";

* Props for creating a `CachingHiliteSetProvider` instance.
* @internal Not exported through barrel, but used in public API as an argument. May be supplemented with optional attributes any time.
* @beta
*/
export interface CachingHiliteSetProviderProps {
/** Selection storage to use for retrieving the hilite set. */
selectionStorage: SelectionStorage;
/** A callback that should return iModel access by iModel key. */
imodelProvider: (imodelKey: string) => ECClassHierarchyInspector & ECSqlQueryExecutor;

@@ -16,4 +18,3 @@ }

*
* @beta Used in public API as a return value. Not expected to be created / extended by package
* consumers, may be supplemented with required attributes any time.
* @beta
*/

@@ -20,0 +21,0 @@ export interface CachingHiliteSetProvider {

@@ -8,3 +8,3 @@ import { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";

* Props for `enableUnifiedSelectionSyncWithIModel`.
* @internal Not exported through barrel, but used in public API as an argument. May be supplemented with optional attributes any time.
* @beta
*/

@@ -11,0 +11,0 @@ export interface EnableUnifiedSelectionSyncWithIModelProps {

@@ -170,14 +170,19 @@ "use strict";

async handleIModelSelectionChange(type, iterator) {
if (type === IModel_1.CoreSelectionSetEventType.Remove) {
for await (const selectable of iterator) {
this._selectionStorage.removeFromSelection({ imodelKey: this._imodelAccess.key, source: this._selectionSourceName, selectables: [selectable] });
}
return;
const selectables = [];
for await (const selectable of iterator) {
selectables.push(selectable);
}
if (type === IModel_1.CoreSelectionSetEventType.Replace) {
this._selectionStorage.clearSelection({ imodelKey: this._imodelAccess.key, source: this._selectionSourceName });
const props = {
imodelKey: this._imodelAccess.key,
source: this._selectionSourceName,
selectables,
};
switch (type) {
case IModel_1.CoreSelectionSetEventType.Add:
return this._selectionStorage.addToSelection(props);
case IModel_1.CoreSelectionSetEventType.Remove:
return this._selectionStorage.removeFromSelection(props);
case IModel_1.CoreSelectionSetEventType.Replace:
return this._selectionStorage.replaceSelection(props);
}
for await (const selectable of iterator) {
this._selectionStorage.addToSelection({ imodelKey: this._imodelAccess.key, source: this._selectionSourceName, selectables: [selectable] });
}
}

@@ -184,0 +189,0 @@ getSelectionSetChangeIds(event) {

@@ -15,5 +15,6 @@ import { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";

* Props for creating a `HiliteSetProvider` instance.
* @internal Not exported through barrel, but used in public API as an argument. May be supplemented with optional attributes any time.
* @beta
*/
export interface HiliteSetProviderProps {
/** An object that provides access to iModel's metadata and allows running ECSQL queries on it. */
imodelAccess: ECClassHierarchyInspector & ECSqlQueryExecutor;

@@ -20,0 +21,0 @@ }

@@ -5,3 +5,3 @@ import { ECSqlQueryExecutor } from "@itwin/presentation-shared";

* Available selection scopes.
* @internal Not exported through barrel, but used in public API as an argument. May be supplemented with additional items in the union at any time.
* @beta
*/

@@ -11,3 +11,3 @@ export type SelectionScope = "element" | "model" | "category" | "functional";

* Props for computing element selection.
* @internal Not exported through barrel, but used in public API as an argument. May be supplemented with optional attributes any time.
* @beta
*/

@@ -29,7 +29,10 @@ export interface ElementSelectionScopeProps {

* Props for `computeSelection`.
* @internal Not exported through barrel, but used in public API as an argument. May be supplemented with optional attributes any time.
* @beta
*/
export interface ComputeSelectionProps {
/** iModel query executor. */
queryExecutor: ECSqlQueryExecutor;
/** IDs of elements to compute selection for. */
elementIds: string[];
/** Selection scope to compute selection with. */
scope: ElementSelectionScopeProps | {

@@ -40,6 +43,3 @@ id: SelectionScope;

/**
* Computes selection from given element ID's.
* @param queryExecutor iModel query executor.
* @param elementIds ID's of elements to compute selection for.
* @param scope Selection scope to compute selection with.
* Computes selection from given element IDs.
* @beta

@@ -46,0 +46,0 @@ */

@@ -11,6 +11,3 @@ "use strict";

/**
* Computes selection from given element ID's.
* @param queryExecutor iModel query executor.
* @param elementIds ID's of elements to compute selection for.
* @param scope Selection scope to compute selection with.
* Computes selection from given element IDs.
* @beta

@@ -17,0 +14,0 @@ */

import { Selectable, Selectables } from "./Selectable";
import { SelectionChangeEvent } from "./SelectionChangeEvent";
/** @beta */
type IModelKeyProp = {

@@ -4,0 +5,0 @@ /** Key of the iModel to get selection levels for. */

@@ -21,3 +21,3 @@ import { Id64Arg } from "@itwin/core-bentley";

* @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionsetevent/
* @internal
* @beta
*/

@@ -43,3 +43,3 @@ export interface CoreSelectionSetEventUnsafe {

* @see https://www.itwinjs.org/reference/core-frontend/selectionset/
* @internal
* @beta
*/

@@ -61,2 +61,3 @@ export interface CoreIModelSelectionSet {

* @see https://www.itwinjs.org/reference/core-bentley/ids/id64/id64.uint32set/
* @beta
*/

@@ -72,3 +73,3 @@ interface Uint32Set {

* @see https://www.itwinjs.org/reference/core-frontend/selectionset/hiliteset/
* @internal
* @beta
*/

@@ -75,0 +76,0 @@ export interface CoreIModelHiliteSet {

@@ -6,6 +6,8 @@ import { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";

* Props for creating a `CachingHiliteSetProvider` instance.
* @internal Not exported through barrel, but used in public API as an argument. May be supplemented with optional attributes any time.
* @beta
*/
export interface CachingHiliteSetProviderProps {
/** Selection storage to use for retrieving the hilite set. */
selectionStorage: SelectionStorage;
/** A callback that should return iModel access by iModel key. */
imodelProvider: (imodelKey: string) => ECClassHierarchyInspector & ECSqlQueryExecutor;

@@ -16,4 +18,3 @@ }

*
* @beta Used in public API as a return value. Not expected to be created / extended by package
* consumers, may be supplemented with required attributes any time.
* @beta
*/

@@ -20,0 +21,0 @@ export interface CachingHiliteSetProvider {

@@ -8,3 +8,3 @@ import { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";

* Props for `enableUnifiedSelectionSyncWithIModel`.
* @internal Not exported through barrel, but used in public API as an argument. May be supplemented with optional attributes any time.
* @beta
*/

@@ -11,0 +11,0 @@ export interface EnableUnifiedSelectionSyncWithIModelProps {

@@ -166,14 +166,19 @@ /*---------------------------------------------------------------------------------------------

async handleIModelSelectionChange(type, iterator) {
if (type === CoreSelectionSetEventType.Remove) {
for await (const selectable of iterator) {
this._selectionStorage.removeFromSelection({ imodelKey: this._imodelAccess.key, source: this._selectionSourceName, selectables: [selectable] });
}
return;
const selectables = [];
for await (const selectable of iterator) {
selectables.push(selectable);
}
if (type === CoreSelectionSetEventType.Replace) {
this._selectionStorage.clearSelection({ imodelKey: this._imodelAccess.key, source: this._selectionSourceName });
const props = {
imodelKey: this._imodelAccess.key,
source: this._selectionSourceName,
selectables,
};
switch (type) {
case CoreSelectionSetEventType.Add:
return this._selectionStorage.addToSelection(props);
case CoreSelectionSetEventType.Remove:
return this._selectionStorage.removeFromSelection(props);
case CoreSelectionSetEventType.Replace:
return this._selectionStorage.replaceSelection(props);
}
for await (const selectable of iterator) {
this._selectionStorage.addToSelection({ imodelKey: this._imodelAccess.key, source: this._selectionSourceName, selectables: [selectable] });
}
}

@@ -180,0 +185,0 @@ getSelectionSetChangeIds(event) {

@@ -15,5 +15,6 @@ import { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";

* Props for creating a `HiliteSetProvider` instance.
* @internal Not exported through barrel, but used in public API as an argument. May be supplemented with optional attributes any time.
* @beta
*/
export interface HiliteSetProviderProps {
/** An object that provides access to iModel's metadata and allows running ECSQL queries on it. */
imodelAccess: ECClassHierarchyInspector & ECSqlQueryExecutor;

@@ -20,0 +21,0 @@ }

@@ -5,3 +5,3 @@ import { ECSqlQueryExecutor } from "@itwin/presentation-shared";

* Available selection scopes.
* @internal Not exported through barrel, but used in public API as an argument. May be supplemented with additional items in the union at any time.
* @beta
*/

@@ -11,3 +11,3 @@ export type SelectionScope = "element" | "model" | "category" | "functional";

* Props for computing element selection.
* @internal Not exported through barrel, but used in public API as an argument. May be supplemented with optional attributes any time.
* @beta
*/

@@ -29,7 +29,10 @@ export interface ElementSelectionScopeProps {

* Props for `computeSelection`.
* @internal Not exported through barrel, but used in public API as an argument. May be supplemented with optional attributes any time.
* @beta
*/
export interface ComputeSelectionProps {
/** iModel query executor. */
queryExecutor: ECSqlQueryExecutor;
/** IDs of elements to compute selection for. */
elementIds: string[];
/** Selection scope to compute selection with. */
scope: ElementSelectionScopeProps | {

@@ -40,6 +43,3 @@ id: SelectionScope;

/**
* Computes selection from given element ID's.
* @param queryExecutor iModel query executor.
* @param elementIds ID's of elements to compute selection for.
* @param scope Selection scope to compute selection with.
* Computes selection from given element IDs.
* @beta

@@ -46,0 +46,0 @@ */

@@ -8,6 +8,3 @@ /*---------------------------------------------------------------------------------------------

/**
* Computes selection from given element ID's.
* @param queryExecutor iModel query executor.
* @param elementIds ID's of elements to compute selection for.
* @param scope Selection scope to compute selection with.
* Computes selection from given element IDs.
* @beta

@@ -14,0 +11,0 @@ */

import { Selectable, Selectables } from "./Selectable";
import { SelectionChangeEvent } from "./SelectionChangeEvent";
/** @beta */
type IModelKeyProp = {

@@ -4,0 +5,0 @@ /** Key of the iModel to get selection levels for. */

@@ -21,3 +21,3 @@ import { Id64Arg } from "@itwin/core-bentley";

* @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionsetevent/
* @internal
* @beta
*/

@@ -43,3 +43,3 @@ export interface CoreSelectionSetEventUnsafe {

* @see https://www.itwinjs.org/reference/core-frontend/selectionset/
* @internal
* @beta
*/

@@ -61,2 +61,3 @@ export interface CoreIModelSelectionSet {

* @see https://www.itwinjs.org/reference/core-bentley/ids/id64/id64.uint32set/
* @beta
*/

@@ -72,3 +73,3 @@ interface Uint32Set {

* @see https://www.itwinjs.org/reference/core-frontend/selectionset/hiliteset/
* @internal
* @beta
*/

@@ -75,0 +76,0 @@ export interface CoreIModelHiliteSet {

{
"name": "@itwin/unified-selection",
"version": "0.4.4",
"version": "0.4.5",
"description": "Package for managing unified selection in iTwin.js applications.",

@@ -34,6 +34,6 @@ "license": "MIT",

"rxjs-for-await": "^1.0.0",
"@itwin/presentation-shared": "^0.3.1"
"@itwin/presentation-shared": "^0.3.2"
},
"devDependencies": {
"@itwin/build-tools": "^4.6.0",
"@itwin/build-tools": "^4.7.1",
"@itwin/eslint-plugin": "^4.0.0",

@@ -56,2 +56,3 @@ "@types/chai": "^4.3.14",

"typescript": "~5.4.5",
"presentation-build-tools": "^0.0.0",
"presentation-test-utilities": "^0.0.0"

@@ -69,5 +70,5 @@ },

"test:watch": "npm -s test -- --reporter min --watch-extensions ts --watch",
"extract-api": "betools extract-api --entry=unified-selection --apiReportFolder=./api --apiReportTempFolder=./api/temp --apiSummaryFolder=./api",
"extract-api": "extract-api --entry=unified-selection --apiReportFolder=./api --apiReportTempFolder=./api/temp --apiSummaryFolder=./api",
"check-internal": "node ../../scripts/checkInternal.js --apiSummary ./api/unified-selection.api.md"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc