@itwin/unified-selection 1.8.0 → 1.8.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/lib/cjs/unified-selection/CachingHiliteSetProvider.d.ts +3 -3
- package/lib/cjs/unified-selection/CachingHiliteSetProvider.d.ts.map +1 -1
- package/lib/cjs/unified-selection/CachingHiliteSetProvider.js.map +1 -1
- package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts +7 -7
- package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +1 -1
- package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +1 -1
- package/lib/cjs/unified-selection/HiliteSetProvider.d.ts +3 -3
- package/lib/cjs/unified-selection/HiliteSetProvider.d.ts.map +1 -1
- package/lib/cjs/unified-selection/HiliteSetProvider.js.map +1 -1
- package/lib/cjs/unified-selection/IModelHiliteSetProvider.d.ts +4 -3
- package/lib/cjs/unified-selection/IModelHiliteSetProvider.d.ts.map +1 -1
- package/lib/cjs/unified-selection/IModelHiliteSetProvider.js.map +1 -1
- package/lib/cjs/unified-selection/Selectable.d.ts +1 -1
- package/lib/cjs/unified-selection/Selectable.d.ts.map +1 -1
- package/lib/cjs/unified-selection/Selectable.js.map +1 -1
- package/lib/cjs/unified-selection/SelectionChangeEvent.d.ts +2 -2
- package/lib/cjs/unified-selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/cjs/unified-selection/SelectionChangeEvent.js.map +1 -1
- package/lib/cjs/unified-selection/SelectionScope.d.ts +3 -3
- package/lib/cjs/unified-selection/SelectionScope.d.ts.map +1 -1
- package/lib/cjs/unified-selection/SelectionScope.js.map +1 -1
- package/lib/cjs/unified-selection/SelectionStorage.d.ts +4 -3
- package/lib/cjs/unified-selection/SelectionStorage.d.ts.map +1 -1
- package/lib/cjs/unified-selection/SelectionStorage.js.map +1 -1
- package/lib/cjs/unified-selection/Utils.d.ts +3 -3
- package/lib/cjs/unified-selection/Utils.d.ts.map +1 -1
- package/lib/cjs/unified-selection/Utils.js.map +1 -1
- package/lib/cjs/unified-selection/types/IModel.d.ts +2 -2
- package/lib/cjs/unified-selection/types/IModel.d.ts.map +1 -1
- package/lib/cjs/unified-selection/types/IModel.js.map +1 -1
- package/lib/cjs/unified-selection.d.ts +13 -7
- package/lib/cjs/unified-selection.d.ts.map +1 -1
- package/lib/cjs/unified-selection.js +1 -1
- package/lib/cjs/unified-selection.js.map +1 -1
- package/lib/esm/unified-selection/CachingHiliteSetProvider.d.ts +3 -3
- package/lib/esm/unified-selection/CachingHiliteSetProvider.d.ts.map +1 -1
- package/lib/esm/unified-selection/CachingHiliteSetProvider.js.map +1 -1
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts +7 -7
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +1 -1
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.js +1 -1
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +1 -1
- package/lib/esm/unified-selection/HiliteSetProvider.d.ts +3 -3
- package/lib/esm/unified-selection/HiliteSetProvider.d.ts.map +1 -1
- package/lib/esm/unified-selection/HiliteSetProvider.js +2 -2
- package/lib/esm/unified-selection/HiliteSetProvider.js.map +1 -1
- package/lib/esm/unified-selection/IModelHiliteSetProvider.d.ts +4 -3
- package/lib/esm/unified-selection/IModelHiliteSetProvider.d.ts.map +1 -1
- package/lib/esm/unified-selection/IModelHiliteSetProvider.js.map +1 -1
- package/lib/esm/unified-selection/Selectable.d.ts +1 -1
- package/lib/esm/unified-selection/Selectable.d.ts.map +1 -1
- package/lib/esm/unified-selection/Selectable.js.map +1 -1
- package/lib/esm/unified-selection/SelectionChangeEvent.d.ts +2 -2
- package/lib/esm/unified-selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/esm/unified-selection/SelectionChangeEvent.js.map +1 -1
- package/lib/esm/unified-selection/SelectionScope.d.ts +3 -3
- package/lib/esm/unified-selection/SelectionScope.d.ts.map +1 -1
- package/lib/esm/unified-selection/SelectionScope.js.map +1 -1
- package/lib/esm/unified-selection/SelectionStorage.d.ts +4 -3
- package/lib/esm/unified-selection/SelectionStorage.d.ts.map +1 -1
- package/lib/esm/unified-selection/SelectionStorage.js.map +1 -1
- package/lib/esm/unified-selection/Utils.d.ts +3 -3
- package/lib/esm/unified-selection/Utils.d.ts.map +1 -1
- package/lib/esm/unified-selection/Utils.js +1 -1
- package/lib/esm/unified-selection/Utils.js.map +1 -1
- package/lib/esm/unified-selection/types/IModel.d.ts +2 -2
- package/lib/esm/unified-selection/types/IModel.d.ts.map +1 -1
- package/lib/esm/unified-selection/types/IModel.js.map +1 -1
- package/lib/esm/unified-selection.d.ts +13 -7
- package/lib/esm/unified-selection.d.ts.map +1 -1
- package/lib/esm/unified-selection.js +2 -3
- package/lib/esm/unified-selection.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Selectables } from "./Selectable.js";
|
|
2
|
-
import { SelectionStorage } from "./SelectionStorage.js";
|
|
1
|
+
import type { Selectables } from "./Selectable.js";
|
|
2
|
+
import type { SelectionStorage } from "./SelectionStorage.js";
|
|
3
3
|
/**
|
|
4
4
|
* The type of selection change.
|
|
5
5
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionChangeEvent.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/SelectionChangeEvent.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectionChangeEvent.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/SelectionChangeEvent.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;GAGG;AACH,MAAM,MAAM,0BAA0B;AACpC,0BAA0B;AACxB,KAAK;AACP,8BAA8B;GAC5B,QAAQ;AACV,8BAA8B;GAC5B,SAAS;AACX,6BAA6B;GAC3B,OAAO,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,WAAW,+BAA+B;IAC9C,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,iCAAiC;IACjC,UAAU,EAAE,0BAA0B,CAAC;IACvC,2DAA2D;IAC3D,WAAW,EAAE,WAAW,CAAC;IACzB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,SAAS,EAAE,IAAI,CAAC;IAChB,sDAAsD;IACtD,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,MAAM,+BAA+B,GAAG;AAC5C,+CAA+C;AAC/C,IAAI,EAAE,+BAA+B;AACrC,2DAA2D;AAC3D,CAAC,CAAC,EAAE,GAAG,KACJ,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionChangeEvent.js","sourceRoot":"","sources":["../../../src/unified-selection/SelectionChangeEvent.ts"],"names":[],"mappings":";AAAA;;;gGAGgG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Selectables } from \"./Selectable.js\";\nimport { SelectionStorage } from \"./SelectionStorage.js\";\n\n/**\n * The type of selection change.\n * @public\n */\nexport type StorageSelectionChangeType =\n /** Added to selection. */\n | \"add\"\n /** Removed from selection. */\n | \"remove\"\n /** Selection was replaced. */\n | \"replace\"\n /** Selection was cleared. */\n | \"clear\";\n\n/**\n * The event object that is sent when the selection changes.\n *\n * **Warning:** Used in public API as an input to consumer-supplied callback. Not expected to be created / extended\n * by package consumers, may be supplemented with required attributes any time.\n *\n * @see `StorageSelectionChangesListener`\n * @public\n */\nexport interface StorageSelectionChangeEventArgs {\n /** The name of the selection source which caused the selection change. */\n source: string;\n /** Level of the selection. */\n level: number;\n /** The selection change type. */\n changeType: StorageSelectionChangeType;\n /** Selectables affected by this selection change event. */\n selectables: Selectables;\n /**\n * iModel key with which the selection is associated with.\n * Set to an empty string if the selection change is not associated with any iModel.\n */\n imodelKey: string;\n /**\n * iModel key with which the selection is associated with.\n * Set to an empty string if the selection change is not associated with any iModel.\n *\n * @deprecated in 0.2. Use `imodelKey` instead.\n */\n iModelKey: string;\n /** The timestamp of when the selection change happened. */\n timestamp: Date;\n /** The selection storage where the event happened. */\n storage: SelectionStorage;\n}\n\n/**\n * An interface for selection change listeners.\n * @public\n */\nexport type StorageSelectionChangesListener = (\n /** Arguments for the selection change event */\n args: StorageSelectionChangeEventArgs,\n /** Unused. Temporarily left to avoid a breaking change. */\n _?: any,\n) => void;\n"]}
|
|
1
|
+
{"version":3,"file":"SelectionChangeEvent.js","sourceRoot":"","sources":["../../../src/unified-selection/SelectionChangeEvent.ts"],"names":[],"mappings":";AAAA;;;gGAGgG","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { Selectables } from \"./Selectable.js\";\nimport type { SelectionStorage } from \"./SelectionStorage.js\";\n\n/**\n * The type of selection change.\n * @public\n */\nexport type StorageSelectionChangeType =\n /** Added to selection. */\n | \"add\"\n /** Removed from selection. */\n | \"remove\"\n /** Selection was replaced. */\n | \"replace\"\n /** Selection was cleared. */\n | \"clear\";\n\n/**\n * The event object that is sent when the selection changes.\n *\n * **Warning:** Used in public API as an input to consumer-supplied callback. Not expected to be created / extended\n * by package consumers, may be supplemented with required attributes any time.\n *\n * @see `StorageSelectionChangesListener`\n * @public\n */\nexport interface StorageSelectionChangeEventArgs {\n /** The name of the selection source which caused the selection change. */\n source: string;\n /** Level of the selection. */\n level: number;\n /** The selection change type. */\n changeType: StorageSelectionChangeType;\n /** Selectables affected by this selection change event. */\n selectables: Selectables;\n /**\n * iModel key with which the selection is associated with.\n * Set to an empty string if the selection change is not associated with any iModel.\n */\n imodelKey: string;\n /**\n * iModel key with which the selection is associated with.\n * Set to an empty string if the selection change is not associated with any iModel.\n *\n * @deprecated in 0.2. Use `imodelKey` instead.\n */\n iModelKey: string;\n /** The timestamp of when the selection change happened. */\n timestamp: Date;\n /** The selection storage where the event happened. */\n storage: SelectionStorage;\n}\n\n/**\n * An interface for selection change listeners.\n * @public\n */\nexport type StorageSelectionChangesListener = (\n /** Arguments for the selection change event */\n args: StorageSelectionChangeEventArgs,\n /** Unused. Temporarily left to avoid a breaking change. */\n _?: any,\n) => void;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Id64Arg } from "@itwin/core-bentley";
|
|
2
|
-
import { ECSqlQueryExecutor } from "@itwin/presentation-shared";
|
|
3
|
-
import { SelectableInstanceKey } from "./Selectable.js";
|
|
1
|
+
import type { Id64Arg } from "@itwin/core-bentley";
|
|
2
|
+
import type { ECSqlQueryExecutor } from "@itwin/presentation-shared";
|
|
3
|
+
import type { SelectableInstanceKey } from "./Selectable.js";
|
|
4
4
|
/**
|
|
5
5
|
* Available selection scopes.
|
|
6
6
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionScope.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/SelectionScope.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectionScope.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/SelectionScope.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAsB,MAAM,qBAAqB,CAAC;AAC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,aAAa,GAAG,KAAK,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;QAED,IAAI,CAAC,aAAa,IAAI,CAAC,YAAY,EAAE,CAAC;YACpC,MAAM;QACR,CAAC;IACH,CAAC;IAED,mEAAmE;IACnE,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IAC5C,CAAC;SAAM,IAAI,YAAY,EAAE,CAAC;QACxB,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;IAC5C,CAAC;IAED,qEAAqE;IACrE,wBAAwB;IACxB,MAAM,oBAAoB,GAAc,EAAE,CAAC;IAC3C,MAAM,mBAAmB,GAAc,EAAE,CAAC;IAC1C,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,IAAI,mBAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC;YACzB,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;AAC9E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Guid, Id64, Id64Arg, Id64Array, Id64Set } from \"@itwin/core-bentley\";\nimport {\n ECSqlBinding,\n ECSqlQueryDef,\n ECSqlQueryExecutor,\n ECSqlQueryReaderOptions,\n ECSqlQueryRow,\n} from \"@itwin/presentation-shared\";\nimport { SelectableInstanceKey, TRANSIENT_ELEMENT_CLASSNAME } from \"./Selectable.js\";\nimport { formIdBindings, genericExecuteQuery } from \"./Utils.js\";\n\n/**\n * Available selection scopes.\n * @public\n */\ntype SelectionScopeIdentifier = \"element\" | \"model\" | \"category\" | \"functional\";\n\n/**\n * Props for computing element selection.\n * @public\n */\nexport interface ElementSelectionScopeProps {\n /** Identifies this as either \"element\" or \"functional\" selection scope */\n id: \"element\" | \"functional\";\n /**\n * Specifies how far \"up\" we should walk to find the target element. When not specified or `0`,\n * the target element matches the request element. When set to `1`, the target element matches the direct parent element.\n * When set to `2`, the target element is parent of the parent element and so on. In all situations when this is `> 0`,\n * we're not walking further than the last existing element, for example when `ancestorLevel = 1` (direct parent\n * element is requested), but the request element doesn't have a parent, the request element is returned as the result.\n * A negative value would result in the top-most element to be returned.\n */\n ancestorLevel?: number;\n}\n\n/**\n * A union of types that can be used to define a selection scope.\n * @public\n * @since 1.4.0\n */\nexport type SelectionScope = ElementSelectionScopeProps | { id: SelectionScopeIdentifier } | SelectionScopeIdentifier;\n\n/**\n * Props for `computeSelection`.\n * @public\n */\nexport interface ComputeSelectionProps {\n /** iModel query executor. */\n queryExecutor: ECSqlQueryExecutor;\n /** IDs of elements to compute selection for. */\n elementIds: Id64Arg;\n /** Selection scope to compute selection with. */\n scope: SelectionScope;\n /** Optional unique id of the component that consumes this function. It can be any string, as long as it is not shared across different components. */\n componentId?: string;\n}\n\n/**\n * Computes selection from given element IDs.\n * @public\n */\nexport async function* computeSelection(props: ComputeSelectionProps): AsyncIterableIterator<SelectableInstanceKey> {\n const { queryExecutor, elementIds, scope } = props;\n const componentId = props.componentId ?? Guid.createValue();\n const componentName = \"computeSelection\";\n if (typeof scope === \"string\") {\n yield* computeSelection({ queryExecutor, elementIds, scope: { id: scope }, componentId });\n return;\n }\n\n const { persistent: persistentIds, transient: transientIds } = parseElementIds(elementIds);\n\n for (const id of transientIds) {\n yield { id, className: TRANSIENT_ELEMENT_CLASSNAME };\n }\n\n switch (scope.id) {\n case \"element\":\n yield* computeElementSelection(\n queryExecutor,\n persistentIds,\n (scope as ElementSelectionScopeProps).ancestorLevel ?? 0,\n componentId,\n componentName,\n );\n return;\n case \"category\":\n yield* computeCategorySelection(queryExecutor, persistentIds, componentId, componentName);\n return;\n case \"model\":\n yield* computeModelSelection(queryExecutor, persistentIds, componentId, componentName);\n return;\n case \"functional\":\n yield* computeFunctionalElementSelection(\n queryExecutor,\n persistentIds,\n (scope as ElementSelectionScopeProps).ancestorLevel ?? 0,\n componentId,\n componentName,\n );\n return;\n }\n}\n\nasync function* computeElementSelection(\n queryExecutor: ECSqlQueryExecutor,\n ids: Id64Array | Id64Set,\n ancestorLevel: number,\n componentId: string,\n componentName: string,\n): AsyncIterableIterator<SelectableInstanceKey> {\n const bindings: ECSqlBinding[] = [];\n const recurseUntilRoot = ancestorLevel < 0;\n const ctes = [\n `\n AncestorElements(ECInstanceId, ECClassId, Depth, ParentId) AS (\n SELECT ECInstanceId, ECClassId, ${formAncestorLevelBinding(ancestorLevel, bindings)}, Parent.Id\n FROM BisCore.Element\n WHERE ${formIdBindings(\"ECInstanceId\", ids, bindings)}\n UNION ALL\n SELECT pe.ECInstanceId, pe.ECClassId, a.Depth - 1, pe.Parent.Id\n FROM AncestorElements a\n JOIN BisCore.Element pe ON pe.ECInstanceId = a.ParentId\n WHERE ${recurseUntilRoot ? \"\" : \"Depth > 0 AND\"} ParentId IS NOT NULL\n )\n `,\n ];\n const ecsql = `\n SELECT DISTINCT ECInstanceId, ec_classname(ECClassId, 's.c') AS ClassName\n FROM AncestorElements\n WHERE ${recurseUntilRoot ? \"\" : \"Depth = 0 OR\"} ParentId IS NULL\n `;\n yield* executeQuery({\n queryExecutor,\n query: { ctes, ecsql, bindings },\n config: { restartToken: `${componentName}/${componentId}/element/${Guid.createValue()}` },\n });\n}\n\nasync function* computeCategorySelection(\n queryExecutor: ECSqlQueryExecutor,\n ids: Id64Array | Id64Set,\n componentId: string,\n componentName: string,\n): AsyncIterableIterator<SelectableInstanceKey> {\n const bindings: ECSqlBinding[] = [];\n const ecsql = [\n `\n SELECT DISTINCT c.ECInstanceId, ec_classname(c.ECClassId, 's.c') AS ClassName\n FROM BisCore.Category c\n JOIN BisCore.GeometricElement2d ge ON ge.Category.Id = c.ECInstanceId\n WHERE ${formIdBindings(\"ge.ECInstanceId\", ids, bindings)}\n `,\n `\n SELECT DISTINCT c.ECInstanceId, ec_classname(c.ECClassId, 's.c') AS ClassName\n FROM BisCore.Category c\n JOIN BisCore.GeometricElement3d ge ON ge.Category.Id = c.ECInstanceId\n WHERE ${formIdBindings(\"ge.ECInstanceId\", ids, bindings)}\n `,\n ].join(\" UNION ALL \");\n yield* executeQuery({\n queryExecutor,\n query: { ecsql, bindings },\n config: { restartToken: `${componentName}/${componentId}/category/${Guid.createValue()}` },\n });\n}\n\nasync function* computeModelSelection(\n queryExecutor: ECSqlQueryExecutor,\n ids: Id64Array | Id64Set,\n componentId: string,\n componentName: string,\n): AsyncIterableIterator<SelectableInstanceKey> {\n const bindings: ECSqlBinding[] = [];\n const ecsql = `\n SELECT DISTINCT m.ECInstanceId, ec_classname(m.ECClassId, 's.c') AS ClassName\n FROM BisCore.Model m\n JOIN BisCore.Element e ON e.Model.Id = m.ECInstanceId\n WHERE ${formIdBindings(\"e.ECInstanceId\", ids, bindings)}\n `;\n yield* executeQuery({\n queryExecutor,\n query: { ecsql, bindings },\n config: { restartToken: `${componentName}/${componentId}/model/${Guid.createValue()}` },\n });\n}\n\nasync function* computeFunctionalElementSelection(\n queryExecutor: ECSqlQueryExecutor,\n ids: Id64Array | Id64Set,\n ancestorLevel: number,\n componentId: string,\n componentName: string,\n): AsyncIterableIterator<SelectableInstanceKey> {\n const bindings: ECSqlBinding[] = [];\n const recurseUntilRoot = ancestorLevel < 0;\n // cspell:disable\n const ctes = [\n `\n Elements2dOrNearestFunctionalElements(OriginalECInstanceId, OriginalECClassId, ECInstanceId, ECClassId, ParentId) AS (\n SELECT ECInstanceId, ECClassId, ECInstanceId, ECClassId, Parent.Id\n FROM BisCore.Element\n WHERE ${formIdBindings(\"ECInstanceId\", ids, bindings)} AND ECClassId IS NOT (BisCore.GeometricElement3d)\n UNION ALL\n SELECT\n e2onfe.OriginalECInstanceId,\n e2onfe.OriginalECClassId,\n COALESCE(dgrfe.TargetECInstanceId, pe.ECInstanceId),\n COALESCE(dgrfe.TargetECClassId, pe.ECClassId),\n pe.Parent.Id\n FROM Elements2dOrNearestFunctionalElements e2onfe\n LEFT JOIN BisCore.Element pe ON pe.ECInstanceId = e2onfe.ParentId\n LEFT JOIN Functional.DrawingGraphicRepresentsFunctionalElement dgrfe ON dgrfe.SourceECInstanceId = e2onfe.ECInstanceId\n WHERE e2onfe.ECClassId IS NOT (Functional.FunctionalElement) AND (e2onfe.ParentId IS NOT NULL OR dgrfe.TargetECInstanceId IS NOT NULL)\n )\n `,\n `\n Element2dNearestFunctionalElements(OriginalECInstanceId, ECInstanceId, ECClassId) AS (\n SELECT OriginalECInstanceId, ECInstanceId, ECClassId\n FROM Elements2dOrNearestFunctionalElements\n WHERE ECClassId IS (Functional.FunctionalElement)\n )\n `,\n `\n Elements2dWithoutFunctionalElement(ECInstanceId, ECClassId) AS (\n SELECT e2wfe.OriginalECInstanceId, OriginalECClassId\n FROM Elements2dOrNearestFunctionalElements e2wfe\n LEFT JOIN Element2dNearestFunctionalElements e2nfe ON e2nfe.OriginalECInstanceId = e2wfe.OriginalECInstanceId\n WHERE e2wfe.ParentId IS NULL AND e2nfe.ECInstanceId IS NULL\n )\n `,\n `\n Elements2d(ECInstanceId, ECClassId) AS (\n SELECT ECInstanceId, ECClassId FROM Element2dNearestFunctionalElements\n UNION\n SELECT ECInstanceId, ECClassId FROM Elements2dWithoutFunctionalElement\n )\n `,\n `\n Element2dAncestorElements(ECInstanceId, ECClassId, Depth, ParentId) AS (\n SELECT e.ECInstanceId, e.ECClassId, ${formAncestorLevelBinding(ancestorLevel, bindings)}, e.Parent.Id\n FROM BisCore.Element e\n JOIN Elements2d e2d ON e2d.ECInstanceId = e.ECInstanceId\n UNION ALL\n SELECT pe.ECInstanceId, pe.ECClassId, e2ae.Depth - 1, pe.Parent.Id\n FROM Element2dAncestorElements e2ae\n JOIN BisCore.Element pe ON pe.ECInstanceId = e2ae.ParentId\n WHERE ${recurseUntilRoot ? \"\" : \"Depth > 0 AND\"} ParentId IS NOT NULL\n )\n `,\n `\n Element3dAncestorElements(ECInstanceId, ECClassId, Depth, ParentId) AS (\n SELECT ge.ECInstanceId, ge.ECClassId, ${formAncestorLevelBinding(ancestorLevel, bindings)}, ge.Parent.Id\n FROM BisCore.GeometricElement3d ge\n WHERE ${formIdBindings(\"ge.ECInstanceId\", ids, bindings)}\n UNION ALL\n SELECT pe.ECInstanceId, pe.ECClassId, e3ae.Depth - 1, pe.Parent.Id\n FROM Element3dAncestorElements e3ae\n JOIN BisCore.Element pe ON pe.ECInstanceId = e3ae.ParentId\n WHERE ${recurseUntilRoot ? \"\" : \"Depth > 0 AND\"} ParentId IS NOT NULL\n )\n `,\n `\n Element3dAncestorRelatedFunctionalElement(ECInstanceId, ClassName) AS (\n SELECT\n COALESCE(peff.TargetECInstanceId, e3ae.ECInstanceId),\n ec_classname(COALESCE(peff.TargetECClassId, e3ae.ECClassId), 's.c')\n FROM Element3dAncestorElements e3ae\n LEFT JOIN Functional.PhysicalElementFulfillsFunction peff ON peff.SourceECInstanceId = e3ae.ECInstanceId\n WHERE ${recurseUntilRoot ? \"\" : \"e3ae.Depth = 0 OR\"} e3ae.ParentId IS NULL\n )\n `,\n ];\n const ecsql = [\n `\n SELECT DISTINCT ECInstanceId, ec_classname(ECClassId, 's.c') AS ClassName\n FROM Element2dAncestorElements\n WHERE ${recurseUntilRoot ? \"\" : \"Depth = 0 OR\"} ParentId IS NULL\n `,\n `\n SELECT DISTINCT ECInstanceId, ClassName FROM Element3dAncestorRelatedFunctionalElement\n `,\n ].join(\" UNION \");\n // cspell:enable\n yield* executeQuery({\n queryExecutor,\n query: { ctes, ecsql, bindings },\n config: { restartToken: `${componentName}/${componentId}/functional-element/${Guid.createValue()}` },\n });\n}\n\nfunction formAncestorLevelBinding(ancestorLevel: number, bindings: ECSqlBinding[]) {\n bindings.push({ type: \"int\", value: ancestorLevel });\n return \"?\";\n}\n\nasync function* executeQuery(props: {\n queryExecutor: ECSqlQueryExecutor;\n query: ECSqlQueryDef;\n config?: ECSqlQueryReaderOptions;\n}): AsyncIterableIterator<SelectableInstanceKey> {\n yield* genericExecuteQuery({\n ...props,\n parseQueryRow: (row: ECSqlQueryRow) => ({ className: row.ClassName, id: row.ECInstanceId }),\n });\n}\n\nfunction parseElementIds(ids: Id64Arg): { persistent: Id64Set | Id64Array; transient: Id64Set | Id64Array } {\n if (typeof ids === \"string\") {\n ids = [ids];\n }\n\n // detect if all ids are either transient or persistent to avoid unnecessary copying\n let allPersistent = true;\n let allTransient = true;\n for (const id of ids) {\n if (Id64.isTransient(id)) {\n allPersistent = false;\n } else {\n allTransient = false;\n }\n\n if (!allPersistent && !allTransient) {\n break;\n }\n }\n\n // avoid making a copy if ids are only persistent or only transient\n if (allPersistent) {\n return { persistent: ids, transient: [] };\n } else if (allTransient) {\n return { persistent: [], transient: ids };\n }\n\n // if `ids` contain mixed ids, we have to copy.. use Array instead of\n // a Set for performance\n const persistentElementIds: Id64Array = [];\n const transientElementIds: Id64Array = [];\n for (const id of ids) {\n if (Id64.isTransient(id)) {\n transientElementIds.push(id);\n } else {\n persistentElementIds.push(id);\n }\n }\n\n return { persistent: persistentElementIds, transient: transientElementIds };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SelectionScope.js","sourceRoot":"","sources":["../../../src/unified-selection/SelectionScope.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAkEhG,4CAyCC;AAzGD,sDAAiD;AACjD,mDAA8D;AAC9D,yCAAiE;AA0DjE;;;GAGG;AACI,KAAK,SAAS,CAAC,CAAC,gBAAgB,CAAC,KAA4B;IAClE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACnD,MAA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rB,IAAI,mBAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC;YACzB,aAAa,GAAG,KAAK,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;QAED,IAAI,CAAC,aAAa,IAAI,CAAC,YAAY,EAAE,CAAC;YACpC,MAAM;QACR,CAAC;IACH,CAAC;IAED,mEAAmE;IACnE,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IAC5C,CAAC;SAAM,IAAI,YAAY,EAAE,CAAC;QACxB,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC;IAC5C,CAAC;IAED,qEAAqE;IACrE,wBAAwB;IACxB,MAAM,oBAAoB,GAAc,EAAE,CAAC;IAC3C,MAAM,mBAAmB,GAAc,EAAE,CAAC;IAC1C,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,IAAI,mBAAI,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,CAAC;YACzB,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;AAC9E,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Guid, Id64 } from \"@itwin/core-bentley\";\nimport { TRANSIENT_ELEMENT_CLASSNAME } from \"./Selectable.js\";\nimport { formIdBindings, genericExecuteQuery } from \"./Utils.js\";\n\nimport type { Id64Arg, Id64Array, Id64Set } from \"@itwin/core-bentley\";\nimport type {\n ECSqlBinding,\n ECSqlQueryDef,\n ECSqlQueryExecutor,\n ECSqlQueryReaderOptions,\n ECSqlQueryRow,\n} from \"@itwin/presentation-shared\";\nimport type { SelectableInstanceKey } from \"./Selectable.js\";\n\n/**\n * Available selection scopes.\n * @public\n */\ntype SelectionScopeIdentifier = \"element\" | \"model\" | \"category\" | \"functional\";\n\n/**\n * Props for computing element selection.\n * @public\n */\nexport interface ElementSelectionScopeProps {\n /** Identifies this as either \"element\" or \"functional\" selection scope */\n id: \"element\" | \"functional\";\n /**\n * Specifies how far \"up\" we should walk to find the target element. When not specified or `0`,\n * the target element matches the request element. When set to `1`, the target element matches the direct parent element.\n * When set to `2`, the target element is parent of the parent element and so on. In all situations when this is `> 0`,\n * we're not walking further than the last existing element, for example when `ancestorLevel = 1` (direct parent\n * element is requested), but the request element doesn't have a parent, the request element is returned as the result.\n * A negative value would result in the top-most element to be returned.\n */\n ancestorLevel?: number;\n}\n\n/**\n * A union of types that can be used to define a selection scope.\n * @public\n * @since 1.4.0\n */\nexport type SelectionScope = ElementSelectionScopeProps | { id: SelectionScopeIdentifier } | SelectionScopeIdentifier;\n\n/**\n * Props for `computeSelection`.\n * @public\n */\nexport interface ComputeSelectionProps {\n /** iModel query executor. */\n queryExecutor: ECSqlQueryExecutor;\n /** IDs of elements to compute selection for. */\n elementIds: Id64Arg;\n /** Selection scope to compute selection with. */\n scope: SelectionScope;\n /** Optional unique id of the component that consumes this function. It can be any string, as long as it is not shared across different components. */\n componentId?: string;\n}\n\n/**\n * Computes selection from given element IDs.\n * @public\n */\nexport async function* computeSelection(props: ComputeSelectionProps): AsyncIterableIterator<SelectableInstanceKey> {\n const { queryExecutor, elementIds, scope } = props;\n const componentId = props.componentId ?? Guid.createValue();\n const componentName = \"computeSelection\";\n if (typeof scope === \"string\") {\n yield* computeSelection({ queryExecutor, elementIds, scope: { id: scope }, componentId });\n return;\n }\n\n const { persistent: persistentIds, transient: transientIds } = parseElementIds(elementIds);\n\n for (const id of transientIds) {\n yield { id, className: TRANSIENT_ELEMENT_CLASSNAME };\n }\n\n switch (scope.id) {\n case \"element\":\n yield* computeElementSelection(\n queryExecutor,\n persistentIds,\n (scope as ElementSelectionScopeProps).ancestorLevel ?? 0,\n componentId,\n componentName,\n );\n return;\n case \"category\":\n yield* computeCategorySelection(queryExecutor, persistentIds, componentId, componentName);\n return;\n case \"model\":\n yield* computeModelSelection(queryExecutor, persistentIds, componentId, componentName);\n return;\n case \"functional\":\n yield* computeFunctionalElementSelection(\n queryExecutor,\n persistentIds,\n (scope as ElementSelectionScopeProps).ancestorLevel ?? 0,\n componentId,\n componentName,\n );\n return;\n }\n}\n\nasync function* computeElementSelection(\n queryExecutor: ECSqlQueryExecutor,\n ids: Id64Array | Id64Set,\n ancestorLevel: number,\n componentId: string,\n componentName: string,\n): AsyncIterableIterator<SelectableInstanceKey> {\n const bindings: ECSqlBinding[] = [];\n const recurseUntilRoot = ancestorLevel < 0;\n const ctes = [\n `\n AncestorElements(ECInstanceId, ECClassId, Depth, ParentId) AS (\n SELECT ECInstanceId, ECClassId, ${formAncestorLevelBinding(ancestorLevel, bindings)}, Parent.Id\n FROM BisCore.Element\n WHERE ${formIdBindings(\"ECInstanceId\", ids, bindings)}\n UNION ALL\n SELECT pe.ECInstanceId, pe.ECClassId, a.Depth - 1, pe.Parent.Id\n FROM AncestorElements a\n JOIN BisCore.Element pe ON pe.ECInstanceId = a.ParentId\n WHERE ${recurseUntilRoot ? \"\" : \"Depth > 0 AND\"} ParentId IS NOT NULL\n )\n `,\n ];\n const ecsql = `\n SELECT DISTINCT ECInstanceId, ec_classname(ECClassId, 's.c') AS ClassName\n FROM AncestorElements\n WHERE ${recurseUntilRoot ? \"\" : \"Depth = 0 OR\"} ParentId IS NULL\n `;\n yield* executeQuery({\n queryExecutor,\n query: { ctes, ecsql, bindings },\n config: { restartToken: `${componentName}/${componentId}/element/${Guid.createValue()}` },\n });\n}\n\nasync function* computeCategorySelection(\n queryExecutor: ECSqlQueryExecutor,\n ids: Id64Array | Id64Set,\n componentId: string,\n componentName: string,\n): AsyncIterableIterator<SelectableInstanceKey> {\n const bindings: ECSqlBinding[] = [];\n const ecsql = [\n `\n SELECT DISTINCT c.ECInstanceId, ec_classname(c.ECClassId, 's.c') AS ClassName\n FROM BisCore.Category c\n JOIN BisCore.GeometricElement2d ge ON ge.Category.Id = c.ECInstanceId\n WHERE ${formIdBindings(\"ge.ECInstanceId\", ids, bindings)}\n `,\n `\n SELECT DISTINCT c.ECInstanceId, ec_classname(c.ECClassId, 's.c') AS ClassName\n FROM BisCore.Category c\n JOIN BisCore.GeometricElement3d ge ON ge.Category.Id = c.ECInstanceId\n WHERE ${formIdBindings(\"ge.ECInstanceId\", ids, bindings)}\n `,\n ].join(\" UNION ALL \");\n yield* executeQuery({\n queryExecutor,\n query: { ecsql, bindings },\n config: { restartToken: `${componentName}/${componentId}/category/${Guid.createValue()}` },\n });\n}\n\nasync function* computeModelSelection(\n queryExecutor: ECSqlQueryExecutor,\n ids: Id64Array | Id64Set,\n componentId: string,\n componentName: string,\n): AsyncIterableIterator<SelectableInstanceKey> {\n const bindings: ECSqlBinding[] = [];\n const ecsql = `\n SELECT DISTINCT m.ECInstanceId, ec_classname(m.ECClassId, 's.c') AS ClassName\n FROM BisCore.Model m\n JOIN BisCore.Element e ON e.Model.Id = m.ECInstanceId\n WHERE ${formIdBindings(\"e.ECInstanceId\", ids, bindings)}\n `;\n yield* executeQuery({\n queryExecutor,\n query: { ecsql, bindings },\n config: { restartToken: `${componentName}/${componentId}/model/${Guid.createValue()}` },\n });\n}\n\nasync function* computeFunctionalElementSelection(\n queryExecutor: ECSqlQueryExecutor,\n ids: Id64Array | Id64Set,\n ancestorLevel: number,\n componentId: string,\n componentName: string,\n): AsyncIterableIterator<SelectableInstanceKey> {\n const bindings: ECSqlBinding[] = [];\n const recurseUntilRoot = ancestorLevel < 0;\n // cspell:disable\n const ctes = [\n `\n Elements2dOrNearestFunctionalElements(OriginalECInstanceId, OriginalECClassId, ECInstanceId, ECClassId, ParentId) AS (\n SELECT ECInstanceId, ECClassId, ECInstanceId, ECClassId, Parent.Id\n FROM BisCore.Element\n WHERE ${formIdBindings(\"ECInstanceId\", ids, bindings)} AND ECClassId IS NOT (BisCore.GeometricElement3d)\n UNION ALL\n SELECT\n e2onfe.OriginalECInstanceId,\n e2onfe.OriginalECClassId,\n COALESCE(dgrfe.TargetECInstanceId, pe.ECInstanceId),\n COALESCE(dgrfe.TargetECClassId, pe.ECClassId),\n pe.Parent.Id\n FROM Elements2dOrNearestFunctionalElements e2onfe\n LEFT JOIN BisCore.Element pe ON pe.ECInstanceId = e2onfe.ParentId\n LEFT JOIN Functional.DrawingGraphicRepresentsFunctionalElement dgrfe ON dgrfe.SourceECInstanceId = e2onfe.ECInstanceId\n WHERE e2onfe.ECClassId IS NOT (Functional.FunctionalElement) AND (e2onfe.ParentId IS NOT NULL OR dgrfe.TargetECInstanceId IS NOT NULL)\n )\n `,\n `\n Element2dNearestFunctionalElements(OriginalECInstanceId, ECInstanceId, ECClassId) AS (\n SELECT OriginalECInstanceId, ECInstanceId, ECClassId\n FROM Elements2dOrNearestFunctionalElements\n WHERE ECClassId IS (Functional.FunctionalElement)\n )\n `,\n `\n Elements2dWithoutFunctionalElement(ECInstanceId, ECClassId) AS (\n SELECT e2wfe.OriginalECInstanceId, OriginalECClassId\n FROM Elements2dOrNearestFunctionalElements e2wfe\n LEFT JOIN Element2dNearestFunctionalElements e2nfe ON e2nfe.OriginalECInstanceId = e2wfe.OriginalECInstanceId\n WHERE e2wfe.ParentId IS NULL AND e2nfe.ECInstanceId IS NULL\n )\n `,\n `\n Elements2d(ECInstanceId, ECClassId) AS (\n SELECT ECInstanceId, ECClassId FROM Element2dNearestFunctionalElements\n UNION\n SELECT ECInstanceId, ECClassId FROM Elements2dWithoutFunctionalElement\n )\n `,\n `\n Element2dAncestorElements(ECInstanceId, ECClassId, Depth, ParentId) AS (\n SELECT e.ECInstanceId, e.ECClassId, ${formAncestorLevelBinding(ancestorLevel, bindings)}, e.Parent.Id\n FROM BisCore.Element e\n JOIN Elements2d e2d ON e2d.ECInstanceId = e.ECInstanceId\n UNION ALL\n SELECT pe.ECInstanceId, pe.ECClassId, e2ae.Depth - 1, pe.Parent.Id\n FROM Element2dAncestorElements e2ae\n JOIN BisCore.Element pe ON pe.ECInstanceId = e2ae.ParentId\n WHERE ${recurseUntilRoot ? \"\" : \"Depth > 0 AND\"} ParentId IS NOT NULL\n )\n `,\n `\n Element3dAncestorElements(ECInstanceId, ECClassId, Depth, ParentId) AS (\n SELECT ge.ECInstanceId, ge.ECClassId, ${formAncestorLevelBinding(ancestorLevel, bindings)}, ge.Parent.Id\n FROM BisCore.GeometricElement3d ge\n WHERE ${formIdBindings(\"ge.ECInstanceId\", ids, bindings)}\n UNION ALL\n SELECT pe.ECInstanceId, pe.ECClassId, e3ae.Depth - 1, pe.Parent.Id\n FROM Element3dAncestorElements e3ae\n JOIN BisCore.Element pe ON pe.ECInstanceId = e3ae.ParentId\n WHERE ${recurseUntilRoot ? \"\" : \"Depth > 0 AND\"} ParentId IS NOT NULL\n )\n `,\n `\n Element3dAncestorRelatedFunctionalElement(ECInstanceId, ClassName) AS (\n SELECT\n COALESCE(peff.TargetECInstanceId, e3ae.ECInstanceId),\n ec_classname(COALESCE(peff.TargetECClassId, e3ae.ECClassId), 's.c')\n FROM Element3dAncestorElements e3ae\n LEFT JOIN Functional.PhysicalElementFulfillsFunction peff ON peff.SourceECInstanceId = e3ae.ECInstanceId\n WHERE ${recurseUntilRoot ? \"\" : \"e3ae.Depth = 0 OR\"} e3ae.ParentId IS NULL\n )\n `,\n ];\n const ecsql = [\n `\n SELECT DISTINCT ECInstanceId, ec_classname(ECClassId, 's.c') AS ClassName\n FROM Element2dAncestorElements\n WHERE ${recurseUntilRoot ? \"\" : \"Depth = 0 OR\"} ParentId IS NULL\n `,\n `\n SELECT DISTINCT ECInstanceId, ClassName FROM Element3dAncestorRelatedFunctionalElement\n `,\n ].join(\" UNION \");\n // cspell:enable\n yield* executeQuery({\n queryExecutor,\n query: { ctes, ecsql, bindings },\n config: { restartToken: `${componentName}/${componentId}/functional-element/${Guid.createValue()}` },\n });\n}\n\nfunction formAncestorLevelBinding(ancestorLevel: number, bindings: ECSqlBinding[]) {\n bindings.push({ type: \"int\", value: ancestorLevel });\n return \"?\";\n}\n\nasync function* executeQuery(props: {\n queryExecutor: ECSqlQueryExecutor;\n query: ECSqlQueryDef;\n config?: ECSqlQueryReaderOptions;\n}): AsyncIterableIterator<SelectableInstanceKey> {\n yield* genericExecuteQuery({\n ...props,\n parseQueryRow: (row: ECSqlQueryRow) => ({ className: row.ClassName, id: row.ECInstanceId }),\n });\n}\n\nfunction parseElementIds(ids: Id64Arg): { persistent: Id64Set | Id64Array; transient: Id64Set | Id64Array } {\n if (typeof ids === \"string\") {\n ids = [ids];\n }\n\n // detect if all ids are either transient or persistent to avoid unnecessary copying\n let allPersistent = true;\n let allTransient = true;\n for (const id of ids) {\n if (Id64.isTransient(id)) {\n allPersistent = false;\n } else {\n allTransient = false;\n }\n\n if (!allPersistent && !allTransient) {\n break;\n }\n }\n\n // avoid making a copy if ids are only persistent or only transient\n if (allPersistent) {\n return { persistent: ids, transient: [] };\n } else if (allTransient) {\n return { persistent: [], transient: ids };\n }\n\n // if `ids` contain mixed ids, we have to copy.. use Array instead of\n // a Set for performance\n const persistentElementIds: Id64Array = [];\n const transientElementIds: Id64Array = [];\n for (const id of ids) {\n if (Id64.isTransient(id)) {\n transientElementIds.push(id);\n } else {\n persistentElementIds.push(id);\n }\n }\n\n return { persistent: persistentElementIds, transient: transientElementIds };\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Selectables } from "./Selectable.js";
|
|
2
|
+
import type { Event } from "@itwin/presentation-shared";
|
|
3
|
+
import type { Selectable } from "./Selectable.js";
|
|
4
|
+
import type { StorageSelectionChangesListener } from "./SelectionChangeEvent.js";
|
|
4
5
|
/** @public */
|
|
5
6
|
type IModelKeyProp = {
|
|
6
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionStorage.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/SelectionStorage.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectionStorage.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/SelectionStorage.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAEV,+BAA+B,EAEhC,MAAM,2BAA2B,CAAC;AAEnC,cAAc;AACd,KAAK,aAAa,GACd;IACE;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB,GACD;IACE,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEN;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,oBAAoB,EAAE,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAE7D,0EAA0E;IAC1E,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,EAAE,CAAC;IAEnD,+CAA+C;IAC/C,YAAY,CACV,KAAK,EAAE,aAAa,GAAG;QACrB,+CAA+C;QAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GACA,WAAW,CAAC;IAEf,iCAAiC;IACjC,cAAc,CACZ,KAAK,EAAE,aAAa,GAAG;QACrB,8GAA8G;QAC9G,MAAM,EAAE,MAAM,CAAC;QACf,2CAA2C;QAC3C,WAAW,EAAE,UAAU,EAAE,CAAC;QAC1B,+CAA+C;QAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GACA,IAAI,CAAC;IAER,0CAA0C;IAC1C,mBAAmB,CACjB,KAAK,EAAE,aAAa,GAAG;QACrB,8GAA8G;QAC9G,MAAM,EAAE,MAAM,CAAC;QACf,gDAAgD;QAChD,WAAW,EAAE,UAAU,EAAE,CAAC;QAC1B,+CAA+C;QAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GACA,IAAI,CAAC;IAER,iCAAiC;IACjC,gBAAgB,CACd,KAAK,EAAE,aAAa,GAAG;QACrB,8GAA8G;QAC9G,MAAM,EAAE,MAAM,CAAC;QACf,2CAA2C;QAC3C,WAAW,EAAE,UAAU,EAAE,CAAC;QAC1B,+CAA+C;QAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GACA,IAAI,CAAC;IAER,+BAA+B;IAC/B,cAAc,CACZ,KAAK,EAAE,aAAa,GAAG;QACrB,8GAA8G;QAC9G,MAAM,EAAE,MAAM,CAAC;QACf,+CAA+C;QAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GACA,IAAI,CAAC;IAER,yFAAyF;IACzF,YAAY,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,IAAI,gBAAgB,CAEhD;AAED;;;GAGG;AACH,eAAO,MAAM,8BAA8B,qCAAqC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionStorage.js","sourceRoot":"","sources":["../../../src/unified-selection/SelectionStorage.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AA8HhG,sCAEC;AA9HD,sDAA8C;AAE9C,mDAA0D;AA0G1D;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,aAAa;IAC3B,OAAO,IAAI,oBAAoB,EAAE,C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C;YACrC,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACtD,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAEM,kBAAkB;QACvB,MAAM,MAAM,GAAG,IAAI,KAAK,EAAU,CAAC;QACnC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,sBAAsB,CAAC,OAAO,EAAE,EAAE,CAAC;YAC1D,IAAI,CAAC,2BAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,KAAa;QACxB,MAAM,YAAY,GAAG,IAAI,CAAC,sBAAsB,CAAC,IAAI,EAAE,CAAC;QACxD,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;YACvC,IAAI,WAAW,IAAI,KAAK,EAAE,CAAC;gBACzB,MAAM,WAAW,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,WAAW,CAAE,CAAC;gBAClE,2BAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { Event } from \"@itwin/presentation-shared\";\nimport { Selectable, Selectables } from \"./Selectable.js\";\nimport {\n StorageSelectionChangeEventArgs,\n StorageSelectionChangesListener,\n StorageSelectionChangeType,\n} from \"./SelectionChangeEvent.js\";\n\n/** @public */\ntype IModelKeyProp =\n | {\n /**\n * Key of the iModel. It's recommended to use `createIModelKey` function from `@itwin/presentation-core-interop`\n * package to create the key for an iModel.\n *\n * Defaults to an empty string when not supplied.\n */\n imodelKey?: string;\n iModelKey?: never;\n }\n | {\n imodelKey?: never;\n /**\n * Key of the iModel. It's recommended to use `createIModelKey` function from `@itwin/presentation-core-interop`\n * package to create the key for an iModel.\n *\n * Defaults to an empty string when not supplied.\n *\n * @deprecated in 0.2. Use `imodelKey` instead.\n */\n iModelKey?: string;\n };\n\n/**\n * Defines return value of `createStorage`.\n *\n * **Warning:** Used in public API as a return value. Not expected to be created / extended by package\n * consumers, may be supplemented with required attributes any time.\n *\n * @see `createStorage`\n * @public\n */\nexport interface SelectionStorage {\n /** An event that is raised when selection changes. */\n selectionChangeEvent: Event<StorageSelectionChangesListener>;\n\n /** Get the selection levels currently stored for the specified iModel. */\n getSelectionLevels(props: IModelKeyProp): number[];\n\n /** Get the selection stored in the storage. */\n getSelection(\n props: IModelKeyProp & {\n /** Level of the selection. Defaults to `0`. */\n level?: number;\n },\n ): Selectables;\n\n /** Add keys to the selection. */\n addToSelection(\n props: IModelKeyProp & {\n /** Name of the selection source. Generally, this identifies the component that makes the selection change. */\n source: string;\n /** The selectables to add to selection. */\n selectables: Selectable[];\n /** Level of the selection. Defaults to `0`. */\n level?: number;\n },\n ): void;\n\n /** Remove keys from current selection. */\n removeFromSelection(\n props: IModelKeyProp & {\n /** Name of the selection source. Generally, this identifies the component that makes the selection change. */\n source: string;\n /** The selectables to remove from selection. */\n selectables: Selectable[];\n /** Level of the selection. Defaults to `0`. */\n level?: number;\n },\n ): void;\n\n /** Replace current selection. */\n replaceSelection(\n props: IModelKeyProp & {\n /** Name of the selection source. Generally, this identifies the component that makes the selection change. */\n source: string;\n /** The selectables to add to selection. */\n selectables: Selectable[];\n /** Level of the selection. Defaults to `0`. */\n level?: number;\n },\n ): void;\n\n /** Clear current selection. */\n clearSelection(\n props: IModelKeyProp & {\n /** Name of the selection source. Generally, this identifies the component that makes the selection change. */\n source: string;\n /** Level of the selection. Defaults to `0`. */\n level?: number;\n },\n ): void;\n\n /** Clear storage for an iModel. This function should be called when iModel is closed. */\n clearStorage(props: IModelKeyProp): void;\n}\n\n/**\n * Creates a selection storage which stores and allows managing application-level selection.\n *\n * **Note:** `clearSelection` should be called upon iModel close to free-up memory:\n *\n * ```ts\n * import { IModelConnection } from \"@itwin/core-frontend\";\n * import { createIModelKey } from \"@itwin/presentation-core-interop\";\n *\n * IModelConnection.onClose.addListener((imodel) => {\n * storage.clearStorage(createIModelKey(imodel));\n * });\n * ```\n *\n * @public\n */\nexport function createStorage(): SelectionStorage {\n return new SelectionStorageImpl();\n}\n\n/**\n * The source name used when selection change is caused by clearing the selection storage. Used when change is performed by `clearStorage`.\n * @public\n */\nexport const CLEAR_SELECTION_STORAGE_SOURCE = \"Unified selection storage: clear\";\n\nclass SelectionStorageImpl implements SelectionStorage {\n private _storage = new Map<string, MultiLevelSelectablesContainer>();\n public selectionChangeEvent: BeEvent<StorageSelectionChangesListener>;\n\n constructor() {\n this.selectionChangeEvent = new BeEvent();\n }\n\n public getSelectionLevels(props: IModelKeyProp): number[] {\n return this.getContainer(getIModelKey(props)).getSelectionLevels();\n }\n\n public getSelection(props: IModelKeyProp & { level?: number }): Selectables {\n return this.getContainer(getIModelKey(props)).getSelection(props.level ?? 0);\n }\n\n public addToSelection(props: IModelKeyProp & { source: string; selectables: Selectable[]; level?: number }): void {\n this.handleChange({ ...props, changeType: \"add\" });\n }\n\n public removeFromSelection(\n props: IModelKeyProp & { source: string; selectables: Selectable[]; level?: number },\n ): void {\n this.handleChange({ ...props, changeType: \"remove\" });\n }\n\n public replaceSelection(props: IModelKeyProp & { source: string; selectables: Selectable[]; level?: number }): void {\n this.handleChange({ ...props, changeType: \"replace\" });\n }\n\n public clearSelection(props: IModelKeyProp & { source: string; level?: number }): void {\n this.handleChange({ ...props, changeType: \"clear\", selectables: [] });\n }\n\n public clearStorage(props: IModelKeyProp): void {\n const imodelKey = getIModelKey(props);\n this.clearSelection({ source: CLEAR_SELECTION_STORAGE_SOURCE, imodelKey });\n this._storage.delete(imodelKey);\n }\n\n private getContainer(imodelKey: string): MultiLevelSelectablesContainer {\n let selectionContainer = this._storage.get(imodelKey);\n if (!selectionContainer) {\n selectionContainer = new MultiLevelSelectablesContainer();\n this._storage.set(imodelKey, selectionContainer);\n }\n return selectionContainer;\n }\n\n private handleChange(\n props: IModelKeyProp & {\n source: string;\n level?: number;\n changeType: StorageSelectionChangeType;\n selectables: Selectable[];\n },\n ) {\n const { source, level: inLevel, changeType, selectables: change } = props;\n const imodelKey = getIModelKey(props);\n const container = this.getContainer(imodelKey);\n const level = inLevel ?? 0;\n const selectables = container.getSelection(level);\n const selected = Selectables.create(change);\n switch (changeType) {\n case \"add\":\n if (!Selectables.add(selectables, change)) {\n return;\n }\n break;\n case \"remove\":\n if (!Selectables.remove(selectables, change)) {\n return;\n }\n break;\n case \"replace\":\n if (Selectables.size(selectables) === Selectables.size(selected) && Selectables.hasAll(selectables, change)) {\n return;\n }\n Selectables.clear(selectables);\n Selectables.add(selectables, change);\n break;\n case \"clear\":\n if (!Selectables.clear(selectables)) {\n return;\n }\n break;\n }\n container.clear(level + 1);\n const event: StorageSelectionChangeEventArgs = {\n source,\n level,\n imodelKey,\n iModelKey: imodelKey,\n changeType,\n selectables: selected,\n timestamp: new Date(),\n storage: this,\n };\n this.selectionChangeEvent.raiseEvent(event, this);\n }\n}\n\nfunction getIModelKey(props: IModelKeyProp): string {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return (\"imodelKey\" in props ? props.imodelKey : props.iModelKey) ?? \"\";\n}\n\nclass MultiLevelSelectablesContainer {\n private readonly _selectablesContainers: Map<number, Selectables>;\n\n constructor() {\n this._selectablesContainers = new Map<number, Selectables>();\n }\n\n public getSelection(level: number): Selectables {\n let selectables = this._selectablesContainers.get(level);\n if (!selectables) {\n selectables = Selectables.create([]);\n this._selectablesContainers.set(level, selectables);\n }\n return selectables;\n }\n\n public getSelectionLevels(): number[] {\n const levels = new Array<number>();\n for (const entry of this._selectablesContainers.entries()) {\n if (!Selectables.isEmpty(entry[1])) {\n levels.push(entry[0]);\n }\n }\n return levels.sort();\n }\n\n public clear(level: number) {\n const storedLevels = this._selectablesContainers.keys();\n for (const storedLevel of storedLevels) {\n if (storedLevel >= level) {\n const selectables = this._selectablesContainers.get(storedLevel)!;\n Selectables.clear(selectables);\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SelectionStorage.js","sourceRoot":"","sources":["../../../src/unified-selection/SelectionStorage.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAgIhG,sCAEC;AAhID,sDAA8C;AAC9C,mDAA8C;AA6G9C;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,aAAa;IAC3B,OAAO,IAAI,oBAAoB,EAAE,CAAC;AACpC,CAAC;AAED;;;GAGG;AACU,QAAA,8BAA8B,GAAG,kCAAkC,CAAC;AAEjF,MAAM,oBAAoB;IAChB,QAAQ,GAAG,IAAI,GAAG,EAA0C,CAAC;IAC9D,oBAAoB,CAA2C;IAEtE;QACE,IAAI,CAAC,oBAAoB,GAAG,IAAI,sBAAO,EAAE,CAAC;IAC5C,CAAC;IAEM,kBAAkB,CAAC,KAAoB;QAC5C,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACrE,CAAC;IAEM,YAAY,CAAC,KAAyC;QAC3D,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;IAC/E,CAAC;IAEM,cAAc,CAAC,KAAoF;QACxG,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IACrD,CAAC;IAEM,mBAAmB,CACxB,KAAoF;QAEpF,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,UAAU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AAE,CAAC;gBAClE,2BAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YACjC,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { Selectables } from \"./Selectable.js\";\n\nimport type { Event } from \"@itwin/presentation-shared\";\nimport type { Selectable } from \"./Selectable.js\";\nimport type {\n StorageSelectionChangeEventArgs,\n StorageSelectionChangesListener,\n StorageSelectionChangeType,\n} from \"./SelectionChangeEvent.js\";\n\n/** @public */\ntype IModelKeyProp =\n | {\n /**\n * Key of the iModel. It's recommended to use `createIModelKey` function from `@itwin/presentation-core-interop`\n * package to create the key for an iModel.\n *\n * Defaults to an empty string when not supplied.\n */\n imodelKey?: string;\n iModelKey?: never;\n }\n | {\n imodelKey?: never;\n /**\n * Key of the iModel. It's recommended to use `createIModelKey` function from `@itwin/presentation-core-interop`\n * package to create the key for an iModel.\n *\n * Defaults to an empty string when not supplied.\n *\n * @deprecated in 0.2. Use `imodelKey` instead.\n */\n iModelKey?: string;\n };\n\n/**\n * Defines return value of `createStorage`.\n *\n * **Warning:** Used in public API as a return value. Not expected to be created / extended by package\n * consumers, may be supplemented with required attributes any time.\n *\n * @see `createStorage`\n * @public\n */\nexport interface SelectionStorage {\n /** An event that is raised when selection changes. */\n selectionChangeEvent: Event<StorageSelectionChangesListener>;\n\n /** Get the selection levels currently stored for the specified iModel. */\n getSelectionLevels(props: IModelKeyProp): number[];\n\n /** Get the selection stored in the storage. */\n getSelection(\n props: IModelKeyProp & {\n /** Level of the selection. Defaults to `0`. */\n level?: number;\n },\n ): Selectables;\n\n /** Add keys to the selection. */\n addToSelection(\n props: IModelKeyProp & {\n /** Name of the selection source. Generally, this identifies the component that makes the selection change. */\n source: string;\n /** The selectables to add to selection. */\n selectables: Selectable[];\n /** Level of the selection. Defaults to `0`. */\n level?: number;\n },\n ): void;\n\n /** Remove keys from current selection. */\n removeFromSelection(\n props: IModelKeyProp & {\n /** Name of the selection source. Generally, this identifies the component that makes the selection change. */\n source: string;\n /** The selectables to remove from selection. */\n selectables: Selectable[];\n /** Level of the selection. Defaults to `0`. */\n level?: number;\n },\n ): void;\n\n /** Replace current selection. */\n replaceSelection(\n props: IModelKeyProp & {\n /** Name of the selection source. Generally, this identifies the component that makes the selection change. */\n source: string;\n /** The selectables to add to selection. */\n selectables: Selectable[];\n /** Level of the selection. Defaults to `0`. */\n level?: number;\n },\n ): void;\n\n /** Clear current selection. */\n clearSelection(\n props: IModelKeyProp & {\n /** Name of the selection source. Generally, this identifies the component that makes the selection change. */\n source: string;\n /** Level of the selection. Defaults to `0`. */\n level?: number;\n },\n ): void;\n\n /** Clear storage for an iModel. This function should be called when iModel is closed. */\n clearStorage(props: IModelKeyProp): void;\n}\n\n/**\n * Creates a selection storage which stores and allows managing application-level selection.\n *\n * **Note:** `clearSelection` should be called upon iModel close to free-up memory:\n *\n * ```ts\n * import { IModelConnection } from \"@itwin/core-frontend\";\n * import { createIModelKey } from \"@itwin/presentation-core-interop\";\n *\n * IModelConnection.onClose.addListener((imodel) => {\n * storage.clearStorage(createIModelKey(imodel));\n * });\n * ```\n *\n * @public\n */\nexport function createStorage(): SelectionStorage {\n return new SelectionStorageImpl();\n}\n\n/**\n * The source name used when selection change is caused by clearing the selection storage. Used when change is performed by `clearStorage`.\n * @public\n */\nexport const CLEAR_SELECTION_STORAGE_SOURCE = \"Unified selection storage: clear\";\n\nclass SelectionStorageImpl implements SelectionStorage {\n private _storage = new Map<string, MultiLevelSelectablesContainer>();\n public selectionChangeEvent: BeEvent<StorageSelectionChangesListener>;\n\n constructor() {\n this.selectionChangeEvent = new BeEvent();\n }\n\n public getSelectionLevels(props: IModelKeyProp): number[] {\n return this.getContainer(getIModelKey(props)).getSelectionLevels();\n }\n\n public getSelection(props: IModelKeyProp & { level?: number }): Selectables {\n return this.getContainer(getIModelKey(props)).getSelection(props.level ?? 0);\n }\n\n public addToSelection(props: IModelKeyProp & { source: string; selectables: Selectable[]; level?: number }): void {\n this.handleChange({ ...props, changeType: \"add\" });\n }\n\n public removeFromSelection(\n props: IModelKeyProp & { source: string; selectables: Selectable[]; level?: number },\n ): void {\n this.handleChange({ ...props, changeType: \"remove\" });\n }\n\n public replaceSelection(props: IModelKeyProp & { source: string; selectables: Selectable[]; level?: number }): void {\n this.handleChange({ ...props, changeType: \"replace\" });\n }\n\n public clearSelection(props: IModelKeyProp & { source: string; level?: number }): void {\n this.handleChange({ ...props, changeType: \"clear\", selectables: [] });\n }\n\n public clearStorage(props: IModelKeyProp): void {\n const imodelKey = getIModelKey(props);\n this.clearSelection({ source: CLEAR_SELECTION_STORAGE_SOURCE, imodelKey });\n this._storage.delete(imodelKey);\n }\n\n private getContainer(imodelKey: string): MultiLevelSelectablesContainer {\n let selectionContainer = this._storage.get(imodelKey);\n if (!selectionContainer) {\n selectionContainer = new MultiLevelSelectablesContainer();\n this._storage.set(imodelKey, selectionContainer);\n }\n return selectionContainer;\n }\n\n private handleChange(\n props: IModelKeyProp & {\n source: string;\n level?: number;\n changeType: StorageSelectionChangeType;\n selectables: Selectable[];\n },\n ) {\n const { source, level: inLevel, changeType, selectables: change } = props;\n const imodelKey = getIModelKey(props);\n const container = this.getContainer(imodelKey);\n const level = inLevel ?? 0;\n const selectables = container.getSelection(level);\n const selected = Selectables.create(change);\n switch (changeType) {\n case \"add\":\n if (!Selectables.add(selectables, change)) {\n return;\n }\n break;\n case \"remove\":\n if (!Selectables.remove(selectables, change)) {\n return;\n }\n break;\n case \"replace\":\n if (Selectables.size(selectables) === Selectables.size(selected) && Selectables.hasAll(selectables, change)) {\n return;\n }\n Selectables.clear(selectables);\n Selectables.add(selectables, change);\n break;\n case \"clear\":\n if (!Selectables.clear(selectables)) {\n return;\n }\n break;\n }\n container.clear(level + 1);\n const event: StorageSelectionChangeEventArgs = {\n source,\n level,\n imodelKey,\n iModelKey: imodelKey,\n changeType,\n selectables: selected,\n timestamp: new Date(),\n storage: this,\n };\n this.selectionChangeEvent.raiseEvent(event, this);\n }\n}\n\nfunction getIModelKey(props: IModelKeyProp): string {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n return (\"imodelKey\" in props ? props.imodelKey : props.iModelKey) ?? \"\";\n}\n\nclass MultiLevelSelectablesContainer {\n private readonly _selectablesContainers: Map<number, Selectables>;\n\n constructor() {\n this._selectablesContainers = new Map<number, Selectables>();\n }\n\n public getSelection(level: number): Selectables {\n let selectables = this._selectablesContainers.get(level);\n if (!selectables) {\n selectables = Selectables.create([]);\n this._selectablesContainers.set(level, selectables);\n }\n return selectables;\n }\n\n public getSelectionLevels(): number[] {\n const levels = new Array<number>();\n for (const entry of this._selectablesContainers.entries()) {\n if (!Selectables.isEmpty(entry[1])) {\n levels.push(entry[0]);\n }\n }\n return levels.sort();\n }\n\n public clear(level: number) {\n const storedLevels = this._selectablesContainers.keys();\n for (const storedLevel of storedLevels) {\n if (storedLevel >= level) {\n const selectables = this._selectablesContainers.get(storedLevel)!;\n Selectables.clear(selectables);\n }\n }\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./DisposePolyfill.js";
|
|
2
|
-
import { Observable } from "rxjs";
|
|
3
|
-
import { Id64Array, Id64Set } from "@itwin/core-bentley";
|
|
4
|
-
import { ECSqlBinding, ECSqlQueryDef, ECSqlQueryExecutor, ECSqlQueryReaderOptions, ECSqlQueryRow } from "@itwin/presentation-shared";
|
|
2
|
+
import type { Observable } from "rxjs";
|
|
3
|
+
import type { Id64Array, Id64Set } from "@itwin/core-bentley";
|
|
4
|
+
import type { ECSqlBinding, ECSqlQueryDef, ECSqlQueryExecutor, ECSqlQueryReaderOptions, ECSqlQueryRow } from "@itwin/presentation-shared";
|
|
5
5
|
/**
|
|
6
6
|
* Forms ECSql bindings from given ID's.
|
|
7
7
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/Utils.ts"],"names":[],"mappings":"AAKA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/Utils.ts"],"names":[],"mappings":"AAKA,OAAO,sBAAsB,CAAC;AAM9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,CAoB3G;AAED;;;GAGG;AACH,wBAAuB,mBAAmB,CAAC,CAAC,EAAE,EAC5C,aAAa,EACb,aAAa,EACb,KAAK,EACL,MAAM,GACP,EAAE;IACD,aAAa,EAAE,kBAAkB,CAAC;IAClC,KAAK,EAAE,aAAa,CAAC;IACrB,aAAa,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,uBAAuB,CAAC;CAClC,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAO3B;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,IAC3D,KAAK,UAAU,CAAC,CAAC,CAAC,KAAG,UAAU,CAAC,CAAC,CAAC,CAa3C;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,EAAE,GAAG;IAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,QAMtG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/unified-selection/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/unified-selection/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAsBhG,wCAoBC;AAMD,kDAiBC;AAMD,sEAcC;AAWD,kCAMC;AApGD,gCAA8B;AAE9B,+BAAoE;AACpE,sDAA2C;AAC3C,oEAAwF;AAYxF;;;GAGG;AACH,SAAgB,cAAc,CAAC,QAAgB,EAAE,GAAwB,EAAE,QAAwB;IACjG,MAAM,KAAK,GAAG,mBAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,KAAK,GAAG,IAAI,EAAE,CAAC;QACjB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;QAC7E,OAAO,mBAAmB,QAAQ,GAAG,CAAC;IACxC,CAAC;IAED,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QAChB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,cAAc,GAAG,EAAE,CAAC;IACxB,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;QACjB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;QACzC,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9B,cAAc,IAAI,GAAG,CAAC;QACxB,CAAC;QACD,cAAc,IAAI,GAAG,CAAC;IACxB,CAAC,CAAC,CAAC;IACH,OAAO,GAA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O,CAAC,EAAE,CAAC;IAC/B,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"./DisposePolyfill.js\";\n\nimport { bufferCount, concatAll, concatMap, delay, of } from \"rxjs\";\nimport { Id64 } from \"@itwin/core-bentley\";\nimport { createMainThreadReleaseOnTimePassedHandler } from \"@itwin/presentation-shared\";\n\nimport type { Observable } from \"rxjs\";\nimport type { Id64Array, Id64Set } from \"@itwin/core-bentley\";\nimport type {\n ECSqlBinding,\n ECSqlQueryDef,\n ECSqlQueryExecutor,\n ECSqlQueryReaderOptions,\n ECSqlQueryRow,\n} from \"@itwin/presentation-shared\";\n\n/**\n * Forms ECSql bindings from given ID's.\n * @internal\n */\nexport function formIdBindings(property: string, ids: Id64Array | Id64Set, bindings: ECSqlBinding[]): string {\n const count = Id64.sizeOf(ids);\n if (count > 1000) {\n bindings.push({ type: \"idset\", value: ids instanceof Set ? [...ids] : ids });\n return `InVirtualSet(?, ${property})`;\n }\n\n if (count === 0) {\n return `FALSE`;\n }\n\n let bindingsClause = \"\";\n ids.forEach((id) => {\n bindings.push({ type: \"id\", value: id });\n if (bindingsClause.length > 0) {\n bindingsClause += \",\";\n }\n bindingsClause += \"?\";\n });\n return `${property} IN (${bindingsClause})`;\n}\n\n/**\n * Executes given ECSql query and extracts data from rows. Additionally handles main thread releasing.\n * @internal\n */\nexport async function* genericExecuteQuery<T>({\n queryExecutor,\n parseQueryRow,\n query,\n config,\n}: {\n queryExecutor: ECSqlQueryExecutor;\n query: ECSqlQueryDef;\n parseQueryRow: (row: ECSqlQueryRow) => T;\n config?: ECSqlQueryReaderOptions;\n}): AsyncIterableIterator<T> {\n const releaseMainThread = createMainThreadReleaseOnTimePassedHandler();\n const reader = queryExecutor.createQueryReader(query, config);\n for await (const row of reader) {\n yield parseQueryRow(row);\n await releaseMainThread();\n }\n}\n\n/**\n * Emits a certain amount of values, then releases the main thread for other timers to use.\n * @internal\n */\nexport function releaseMainThreadOnItemsCount<T>(elementCount: number) {\n return (obs: Observable<T>): Observable<T> => {\n return obs.pipe(\n bufferCount(elementCount),\n concatMap((buff, i) => {\n const out = of(buff);\n if (i === 0 && buff.length < elementCount) {\n return out;\n }\n return out.pipe(delay(0));\n }),\n concatAll(),\n );\n };\n}\n\n/**\n * A helper that disposes the given object, if it's disposable.\n *\n * The first option is to dispose using the deprecated `dispose` method if it exists on the object.\n * If not, we use the new `Symbol.dispose` method. If that doesn't exist either, the object is\n * considered as non-disposable and nothing is done with it.\n *\n * @internal\n */\nexport function safeDispose(disposable: {} | { [Symbol.dispose]: () => void } | { dispose: () => void }) {\n if (\"dispose\" in disposable) {\n disposable.dispose();\n } else if (Symbol.dispose in disposable) {\n disposable[Symbol.dispose]();\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Id64Arg, Id64Set } from "@itwin/core-bentley";
|
|
2
|
-
import { Event } from "@itwin/presentation-shared";
|
|
1
|
+
import type { Id64Arg, Id64Set } from "@itwin/core-bentley";
|
|
2
|
+
import type { Event } from "@itwin/presentation-shared";
|
|
3
3
|
/**
|
|
4
4
|
* A collection of geometric element, model and subcategory ids that can be added to
|
|
5
5
|
* a [[SelectionSet]] or [[HiliteSet]].
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModel.d.ts","sourceRoot":"","sources":["../../../../src/unified-selection/types/IModel.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"IModel.d.ts","sourceRoot":"","sources":["../../../../src/unified-selection/types/IModel.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAA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KAAE,CAAC;IAE/D;;;;;OAKG;IACH,GAAG,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,iBAAiB,KAAK,OAAO,CAAC;IAEnD;;;;;OAKG;IACH,MAAM,EAAE,CAAC,GAAG,EAAE,OAAO,GAAG,iBAAiB,KAAK,OAAO,CAAC;CACvD,CACJ,CAAC;AAEF;;;;GAIG;AACH,UAAU,SAAS;IACjB,wCAAwC;IACxC,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,6CAA6C;IAC7C,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,gHAAgH;IAChH,wBAAwB,EAAE,OAAO,CAAC;IAClC,mCAAmC;IACnC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,wCAAwC;IACxC,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAClC,iCAAiC;IACjC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,gDAAgD;IAChD,KAAK,IAAI,IAAI,CAAC;CACf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModel.js","sourceRoot":"","sources":["../../../../src/unified-selection/types/IModel.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAoBhG;;;;GAIG;AACH,IAAY,yBASX;AATD,WAAY,yBAAyB;IACnC,2CAA2C;IAC3C,uEAAG,CAAA;IACH,+CAA+C;IAC/C,6EAAM,CAAA;IACN,6EAA6E;IAC7E,+EAAO,CAAA;IACP,yDAAyD;IACzD,2EAAK,CAAA;AACP,CAAC,EATW,yBAAyB,yCAAzB,yBAAyB,QASpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Id64Arg, Id64Set } from \"@itwin/core-bentley\";\nimport { Event } from \"@itwin/presentation-shared\";\n\n/**\n * A collection of geometric element, model and subcategory ids that can be added to\n * a [[SelectionSet]] or [[HiliteSet]].\n *\n * **Warning:** This type was added to `@itwin/core-frontend` in 5.0.\n *\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectableids/\n * @public\n */\nexport interface CoreSelectableIds {\n elements?: Id64Arg;\n models?: Id64Arg;\n subcategories?: Id64Arg;\n}\n\n/**\n * Identifies the type of changes made to the `CoreIModelSelectionSet` to produce a `CoreSelectionSetEvent`.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/\n * @internal\n */\nexport enum CoreSelectionSetEventType {\n /** Elements have been added to the set. */\n Add,\n /** Elements have been removed from the set. */\n Remove,\n /** Some elements have been added to the set and others have been removed. */\n Replace,\n /** All elements are about to be removed from the set. */\n Clear,\n}\n\n/**\n * Payload sent to `CoreIModelSelectionSet.onChanged` event listeners to describe how the contents of the set have changed.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionsetevent/\n * @public\n */\nexport interface CoreSelectionSetEventUnsafe {\n /**\n * The type of operation that produced this event.\n *\n * Actually, this should be `CoreSelectionSetEventType`, however we can't use it here because in TS two identical enums with\n * different names aren't equal, so [`SelectionSetEventType `](https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/)\n * doesn't map to `CoreSelectionSetEventType` as far as TS is concerned. Due to this reason, this interface is marked as `unsafe`.\n */\n type: number;\n /** The element Ids added to the set. */\n added?: Id64Arg;\n /**\n * A collection of geometric element, model and subcategory ids that have been removed from selection set.\n *\n * **Warning:** This property was added to `@itwin/core-frontend` in 5.0.\n */\n additions?: CoreSelectableIds;\n /** The element Ids removed from the set. */\n removed?: Id64Arg;\n /**\n * A collection of geometric element, model and subcategory ids that have been added to selection set.\n *\n * **Warning:** This property was added to `@itwin/core-frontend` in 5.0.\n */\n removals?: CoreSelectableIds;\n /** The affected `CoreIModelSelectionSet`. */\n set: CoreIModelSelectionSet;\n}\n\n/**\n * A set of *currently selected* elements in an iModel.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/\n * @public\n */\nexport type CoreIModelSelectionSet = {\n /** Event called whenever elements are added or removed from this SelectionSet. */\n onChanged: Event<(ev: CoreSelectionSetEventUnsafe) => void>;\n /** The IDs of the selected elements. */\n readonly elements: Set<string>;\n /** Clear current selection set. */\n emptyAll(): void;\n} & (\n | {\n /** Add one or more Ids to the current selection set. */\n add(elem: Id64Arg): boolean;\n /** Remove one or more Ids from the current selection set. */\n remove(elem: Id64Arg): boolean;\n }\n | {\n /**\n * Get the active selection as a collection of geometric element, model and subcategory ids.\n */\n readonly active: { [P in keyof CoreSelectableIds]-?: Id64Set };\n\n /**\n * Adds a collection of geometric element, model and subcategory ids to this selection set.\n *\n * The overload was added only in 5.0 `@itwin/core-frontend`. The `active` property can be used\n * to check if this `overload` is available.\n */\n add: (ids: Id64Arg | CoreSelectableIds) => boolean;\n\n /**\n * Adds a collection of geometric element, model and subcategory ids to this selection set.\n *\n * The overload was added only in 5.0 `@itwin/core-frontend`. The `active` property can be used\n * to check if this `overload` is available.\n */\n remove: (ids: Id64Arg | CoreSelectableIds) => boolean;\n }\n);\n\n/**\n * A set if ID's optimized for performance-critical code which represents large sets of ID's as pairs of 32-bit integers.\n * @see https://www.itwinjs.org/reference/core-bentley/ids/id64/id64.uint32set/\n * @public\n */\ninterface Uint32Set {\n /** Add any number of Ids to the set. */\n addIds(ids: Id64Arg): void;\n /** Remove any number of Ids from the set. */\n deleteIds(ids: Id64Arg): void;\n}\n\n/**\n * A set of *hilited* elements in an iModel, by element id.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/hiliteset/\n * @public\n */\nexport interface CoreIModelHiliteSet {\n /** Control whether the hilited elements should be synchronized with the contents of `CoreIModelSelectionSet`.*/\n wantSyncWithSelectionSet: boolean;\n /** The set of hilited elements. */\n readonly elements: Uint32Set;\n /** The set of hilited subcategories. */\n readonly subcategories: Uint32Set;\n /** The set of hilited models. */\n readonly models: Uint32Set;\n /** Remove all elements from the hilited set. */\n clear(): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IModel.js","sourceRoot":"","sources":["../../../../src/unified-selection/types/IModel.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAoBhG;;;;GAIG;AACH,IAAY,yBASX;AATD,WAAY,yBAAyB;IACnC,2CAA2C;IAC3C,uEAAG,CAAA;IACH,+CAA+C;IAC/C,6EAAM,CAAA;IACN,6EAA6E;IAC7E,+EAAO,CAAA;IACP,yDAAyD;IACzD,2EAAK,CAAA;AACP,CAAC,EATW,yBAAyB,yCAAzB,yBAAyB,QASpC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { Id64Arg, Id64Set } from \"@itwin/core-bentley\";\nimport type { Event } from \"@itwin/presentation-shared\";\n\n/**\n * A collection of geometric element, model and subcategory ids that can be added to\n * a [[SelectionSet]] or [[HiliteSet]].\n *\n * **Warning:** This type was added to `@itwin/core-frontend` in 5.0.\n *\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectableids/\n * @public\n */\nexport interface CoreSelectableIds {\n elements?: Id64Arg;\n models?: Id64Arg;\n subcategories?: Id64Arg;\n}\n\n/**\n * Identifies the type of changes made to the `CoreIModelSelectionSet` to produce a `CoreSelectionSetEvent`.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/\n * @internal\n */\nexport enum CoreSelectionSetEventType {\n /** Elements have been added to the set. */\n Add,\n /** Elements have been removed from the set. */\n Remove,\n /** Some elements have been added to the set and others have been removed. */\n Replace,\n /** All elements are about to be removed from the set. */\n Clear,\n}\n\n/**\n * Payload sent to `CoreIModelSelectionSet.onChanged` event listeners to describe how the contents of the set have changed.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionsetevent/\n * @public\n */\nexport interface CoreSelectionSetEventUnsafe {\n /**\n * The type of operation that produced this event.\n *\n * Actually, this should be `CoreSelectionSetEventType`, however we can't use it here because in TS two identical enums with\n * different names aren't equal, so [`SelectionSetEventType `](https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/)\n * doesn't map to `CoreSelectionSetEventType` as far as TS is concerned. Due to this reason, this interface is marked as `unsafe`.\n */\n type: number;\n /** The element Ids added to the set. */\n added?: Id64Arg;\n /**\n * A collection of geometric element, model and subcategory ids that have been removed from selection set.\n *\n * **Warning:** This property was added to `@itwin/core-frontend` in 5.0.\n */\n additions?: CoreSelectableIds;\n /** The element Ids removed from the set. */\n removed?: Id64Arg;\n /**\n * A collection of geometric element, model and subcategory ids that have been added to selection set.\n *\n * **Warning:** This property was added to `@itwin/core-frontend` in 5.0.\n */\n removals?: CoreSelectableIds;\n /** The affected `CoreIModelSelectionSet`. */\n set: CoreIModelSelectionSet;\n}\n\n/**\n * A set of *currently selected* elements in an iModel.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/\n * @public\n */\nexport type CoreIModelSelectionSet = {\n /** Event called whenever elements are added or removed from this SelectionSet. */\n onChanged: Event<(ev: CoreSelectionSetEventUnsafe) => void>;\n /** The IDs of the selected elements. */\n readonly elements: Set<string>;\n /** Clear current selection set. */\n emptyAll(): void;\n} & (\n | {\n /** Add one or more Ids to the current selection set. */\n add(elem: Id64Arg): boolean;\n /** Remove one or more Ids from the current selection set. */\n remove(elem: Id64Arg): boolean;\n }\n | {\n /**\n * Get the active selection as a collection of geometric element, model and subcategory ids.\n */\n readonly active: { [P in keyof CoreSelectableIds]-?: Id64Set };\n\n /**\n * Adds a collection of geometric element, model and subcategory ids to this selection set.\n *\n * The overload was added only in 5.0 `@itwin/core-frontend`. The `active` property can be used\n * to check if this `overload` is available.\n */\n add: (ids: Id64Arg | CoreSelectableIds) => boolean;\n\n /**\n * Adds a collection of geometric element, model and subcategory ids to this selection set.\n *\n * The overload was added only in 5.0 `@itwin/core-frontend`. The `active` property can be used\n * to check if this `overload` is available.\n */\n remove: (ids: Id64Arg | CoreSelectableIds) => boolean;\n }\n);\n\n/**\n * A set if ID's optimized for performance-critical code which represents large sets of ID's as pairs of 32-bit integers.\n * @see https://www.itwinjs.org/reference/core-bentley/ids/id64/id64.uint32set/\n * @public\n */\ninterface Uint32Set {\n /** Add any number of Ids to the set. */\n addIds(ids: Id64Arg): void;\n /** Remove any number of Ids from the set. */\n deleteIds(ids: Id64Arg): void;\n}\n\n/**\n * A set of *hilited* elements in an iModel, by element id.\n * @see https://www.itwinjs.org/reference/core-frontend/selectionset/hiliteset/\n * @public\n */\nexport interface CoreIModelHiliteSet {\n /** Control whether the hilited elements should be synchronized with the contents of `CoreIModelSelectionSet`.*/\n wantSyncWithSelectionSet: boolean;\n /** The set of hilited elements. */\n readonly elements: Uint32Set;\n /** The set of hilited subcategories. */\n readonly subcategories: Uint32Set;\n /** The set of hilited models. */\n readonly models: Uint32Set;\n /** Remove all elements from the hilited set. */\n clear(): void;\n}\n"]}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
1
|
+
export type { CustomSelectable, SelectableIdentifier, SelectableInstanceKey } from "./unified-selection/Selectable.js";
|
|
2
|
+
export { TRANSIENT_ELEMENT_CLASSNAME, Selectable, Selectables } from "./unified-selection/Selectable.js";
|
|
3
|
+
export type { SelectionStorage } from "./unified-selection/SelectionStorage.js";
|
|
4
|
+
export { createStorage } from "./unified-selection/SelectionStorage.js";
|
|
5
|
+
export type { HiliteSet, HiliteSetProvider } from "./unified-selection/HiliteSetProvider.js";
|
|
6
|
+
export { createHiliteSetProvider } from "./unified-selection/HiliteSetProvider.js";
|
|
7
|
+
export type { CachingHiliteSetProvider } from "./unified-selection/CachingHiliteSetProvider.js";
|
|
8
|
+
export { createCachingHiliteSetProvider } from "./unified-selection/CachingHiliteSetProvider.js";
|
|
9
|
+
export type { IModelHiliteSetProvider } from "./unified-selection/IModelHiliteSetProvider.js";
|
|
10
|
+
export { createIModelHiliteSetProvider } from "./unified-selection/IModelHiliteSetProvider.js";
|
|
11
|
+
export type { SelectionScope } from "./unified-selection/SelectionScope.js";
|
|
12
|
+
export { computeSelection } from "./unified-selection/SelectionScope.js";
|
|
7
13
|
export { enableUnifiedSelectionSyncWithIModel } from "./unified-selection/EnableUnifiedSelectionSyncWithIModel.js";
|
|
8
|
-
export { StorageSelectionChangeType, StorageSelectionChangeEventArgs, StorageSelectionChangesListener, } from "./unified-selection/SelectionChangeEvent.js";
|
|
14
|
+
export type { StorageSelectionChangeType, StorageSelectionChangeEventArgs, StorageSelectionChangesListener, } from "./unified-selection/SelectionChangeEvent.js";
|
|
9
15
|
export { CLEAR_SELECTION_STORAGE_SOURCE } from "./unified-selection/SelectionStorage.js";
|
|
10
16
|
//# sourceMappingURL=unified-selection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified-selection.d.ts","sourceRoot":"","sources":["../../src/unified-selection.ts"],"names":[],"mappings":"AAKA,
|
|
1
|
+
{"version":3,"file":"unified-selection.d.ts","sourceRoot":"","sources":["../../src/unified-selection.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AACvH,OAAO,EAAE,2BAA2B,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AACzG,YAAY,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AACxE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAEnF,YAAY,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAEhG,OAAO,EAAE,8BAA8B,EAAE,MAAM,iDAAiD,CAAC;AACjG,YAAY,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAC9F,OAAO,EAAE,6BAA6B,EAAE,MAAM,gDAAgD,CAAC;AAC/F,YAAY,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,EAAE,oCAAoC,EAAE,MAAM,6DAA6D,CAAC;AACnH,YAAY,EACV,0BAA0B,EAC1B,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -13,8 +13,8 @@ var SelectionStorage_js_1 = require("./unified-selection/SelectionStorage.js");
|
|
|
13
13
|
Object.defineProperty(exports, "createStorage", { enumerable: true, get: function () { return SelectionStorage_js_1.createStorage; } });
|
|
14
14
|
var HiliteSetProvider_js_1 = require("./unified-selection/HiliteSetProvider.js");
|
|
15
15
|
Object.defineProperty(exports, "createHiliteSetProvider", { enumerable: true, get: function () { return HiliteSetProvider_js_1.createHiliteSetProvider; } });
|
|
16
|
-
var CachingHiliteSetProvider_js_1 = require("./unified-selection/CachingHiliteSetProvider.js");
|
|
17
16
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
17
|
+
var CachingHiliteSetProvider_js_1 = require("./unified-selection/CachingHiliteSetProvider.js");
|
|
18
18
|
Object.defineProperty(exports, "createCachingHiliteSetProvider", { enumerable: true, get: function () { return CachingHiliteSetProvider_js_1.createCachingHiliteSetProvider; } });
|
|
19
19
|
var IModelHiliteSetProvider_js_1 = require("./unified-selection/IModelHiliteSetProvider.js");
|
|
20
20
|
Object.defineProperty(exports, "createIModelHiliteSetProvider", { enumerable: true, get: function () { return IModelHiliteSetProvider_js_1.createIModelHiliteSetProvider; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unified-selection.js","sourceRoot":"","sources":["../../src/unified-selection.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;
|
|
1
|
+
{"version":3,"file":"unified-selection.js","sourceRoot":"","sources":["../../src/unified-selection.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAGhG,mEAAyG;AAAhG,4HAAA,2BAA2B,OAAA;AAAE,2GAAA,UAAU,OAAA;AAAE,4GAAA,WAAW,OAAA;AAE7D,+EAAwE;AAA/D,oHAAA,aAAa,OAAA;AAEtB,iFAAmF;AAA1E,+HAAA,uBAAuB,OAAA;AAGhC,4DAA4D;AAC5D,+FAAiG;AAAxF,6IAAA,8BAA8B,OAAA;AAEvC,6FAA+F;AAAtF,2IAAA,6BAA6B,OAAA;AAEtC,2EAAyE;AAAhE,qHAAA,gBAAgB,OAAA;AACzB,uHAAmH;AAA1G,+JAAA,oCAAoC,OAAA;AAM7C,+EAAyF;AAAhF,qIAAA,8BAA8B,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nexport type { CustomSelectable, SelectableIdentifier, SelectableInstanceKey } from \"./unified-selection/Selectable.js\";\nexport { TRANSIENT_ELEMENT_CLASSNAME, Selectable, Selectables } from \"./unified-selection/Selectable.js\";\nexport type { SelectionStorage } from \"./unified-selection/SelectionStorage.js\";\nexport { createStorage } from \"./unified-selection/SelectionStorage.js\";\nexport type { HiliteSet, HiliteSetProvider } from \"./unified-selection/HiliteSetProvider.js\";\nexport { createHiliteSetProvider } from \"./unified-selection/HiliteSetProvider.js\";\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport type { CachingHiliteSetProvider } from \"./unified-selection/CachingHiliteSetProvider.js\";\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport { createCachingHiliteSetProvider } from \"./unified-selection/CachingHiliteSetProvider.js\";\nexport type { IModelHiliteSetProvider } from \"./unified-selection/IModelHiliteSetProvider.js\";\nexport { createIModelHiliteSetProvider } from \"./unified-selection/IModelHiliteSetProvider.js\";\nexport type { SelectionScope } from \"./unified-selection/SelectionScope.js\";\nexport { computeSelection } from \"./unified-selection/SelectionScope.js\";\nexport { enableUnifiedSelectionSyncWithIModel } from \"./unified-selection/EnableUnifiedSelectionSyncWithIModel.js\";\nexport type {\n StorageSelectionChangeType,\n StorageSelectionChangeEventArgs,\n StorageSelectionChangesListener,\n} from \"./unified-selection/SelectionChangeEvent.js\";\nexport { CLEAR_SELECTION_STORAGE_SOURCE } from \"./unified-selection/SelectionStorage.js\";\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./DisposePolyfill.js";
|
|
2
|
-
import { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";
|
|
3
|
-
import { createHiliteSetProvider, HiliteSet } from "./HiliteSetProvider.js";
|
|
4
|
-
import { SelectionStorage } from "./SelectionStorage.js";
|
|
2
|
+
import type { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";
|
|
3
|
+
import type { createHiliteSetProvider, HiliteSet } from "./HiliteSetProvider.js";
|
|
4
|
+
import type { SelectionStorage } from "./SelectionStorage.js";
|
|
5
5
|
/**
|
|
6
6
|
* Props for creating a `CachingHiliteSetProvider` instance.
|
|
7
7
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CachingHiliteSetProvider.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":"AAMA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"CachingHiliteSetProvider.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":"AAMA,OAAO,sBAAsB,CAAC;AAI9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,KAAK,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,8DAA8D;IAC9D,gBAAgB,EAAE,gBAAgB,CAAC;IAEnC,iEAAiE;IACjE,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,yBAAyB,GAAG,kBAAkB,CAAC;IAEtF,yHAAyH;IACzH,uBAAuB,CAAC,EAAE,OAAO,uBAAuB,CAAC;CAC1D;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,wBAAwB;IACvC,mEAAmE;IACnE,YAAY,CAAC,KAAK,EAAE;QAClB,mCAAmC;QACnC,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAErC;;;;;OAKG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC;IAE9B;;;OAGG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;GAKG;AAEH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,6BAA6B,GACnC,wBAAwB,GAAG;IAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAO7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CachingHiliteSetProvider.js","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,qDAAqD;AAErD,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"CachingHiliteSetProvider.js","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,qDAAqD;AAErD,OAAO,sBAAsB,CAAC;AAE9B,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAsD7E;;;;;GAKG;AACH,qBAAqB;AACrB,MAAM,UAAU,8BAA8B,CAC5C,KAAoC;IAEpC,MAAM,QAAQ,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAAC;IACtD,OAAO;QACL,YAAY,EAAE,CAAC,cAAqC,EAAE,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,cAAc,CAAC;QACrG,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;QAClD,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;KAC1C,CAAC;AACJ,CAAC;AACD,oBAAoB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nimport \"./DisposePolyfill.js\";\n\nimport { createIModelHiliteSetProvider } from \"./IModelHiliteSetProvider.js\";\n\nimport type { ECClassHierarchyInspector, ECSqlQueryExecutor } from \"@itwin/presentation-shared\";\nimport type { createHiliteSetProvider, HiliteSet } from \"./HiliteSetProvider.js\";\nimport type { SelectionStorage } from \"./SelectionStorage.js\";\n\n/**\n * Props for creating a `CachingHiliteSetProvider` instance.\n * @public\n * @deprecated in 1.5. Use `IModelHiliteSetProviderProps` instead.\n */\nexport interface CachingHiliteSetProviderProps {\n /** Selection storage to use for retrieving the hilite set. */\n selectionStorage: SelectionStorage;\n\n /** A callback that should return iModel access by iModel key. */\n imodelProvider: (imodelKey: string) => ECClassHierarchyInspector & ECSqlQueryExecutor;\n\n /** An optional hilite set provider factory. If not provided, defaults to `createHiliteSetProvider` from this package. */\n createHiliteSetProvider?: typeof createHiliteSetProvider;\n}\n\n/**\n * Defines return value of `createCachingHiliteSetProvider`.\n *\n * **Warning:** Used in public API as a return value. Not expected to be created / extended by package\n * consumers, may be supplemented with required attributes any time.\n *\n * @see `createCachingHiliteSetProvider`\n * @public\n * @deprecated in 1.5. Use `IModelHiliteSetProvider` instead.\n */\nexport interface CachingHiliteSetProvider {\n /** Get the current hilite set iterator for the specified imodel */\n getHiliteSet(props: {\n /** iModel to get hilite set for */\n imodelKey: string;\n }): AsyncIterableIterator<HiliteSet>;\n\n /**\n * Disposes the cache.\n *\n * Optional to avoid breaking the API. Will be made required when the deprecated\n * `dispose` is removed.\n */\n [Symbol.dispose]?: () => void;\n\n /**\n * Disposes the cache.\n * @deprecated in 1.2. Use `[Symbol.dispose]` instead.\n */\n dispose(): void;\n}\n\n/**\n * Creates a hilite set provider that caches hilite set for current selection for given iModel so any subsequent\n * hilite set requests for the same iModel don't cost until selection in given selection storage changes.\n * @public\n * @deprecated in 1.5. Use `createIModelHiliteSetProvider` instead.\n */\n/* v8 ignore start */\nexport function createCachingHiliteSetProvider(\n props: CachingHiliteSetProviderProps,\n): CachingHiliteSetProvider & { [Symbol.dispose]: () => void } {\n const provider = createIModelHiliteSetProvider(props);\n return {\n getHiliteSet: (hiliteSetProps: { imodelKey: string }) => provider.getCurrentHiliteSet(hiliteSetProps),\n [Symbol.dispose]: () => provider[Symbol.dispose](),\n dispose: () => provider[Symbol.dispose](),\n };\n}\n/* v8 ignore stop */\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "./DisposePolyfill.js";
|
|
2
|
-
import { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";
|
|
3
|
-
import { CachingHiliteSetProvider } from "./CachingHiliteSetProvider.js";
|
|
4
|
-
import { HiliteSetProvider } from "./HiliteSetProvider.js";
|
|
5
|
-
import { IModelHiliteSetProvider } from "./IModelHiliteSetProvider.js";
|
|
6
|
-
import { SelectionScope } from "./SelectionScope.js";
|
|
7
|
-
import { SelectionStorage } from "./SelectionStorage.js";
|
|
8
|
-
import { CoreIModelHiliteSet, CoreIModelSelectionSet } from "./types/IModel.js";
|
|
2
|
+
import type { ECClassHierarchyInspector, ECSqlQueryExecutor } from "@itwin/presentation-shared";
|
|
3
|
+
import type { CachingHiliteSetProvider } from "./CachingHiliteSetProvider.js";
|
|
4
|
+
import type { HiliteSetProvider } from "./HiliteSetProvider.js";
|
|
5
|
+
import type { IModelHiliteSetProvider } from "./IModelHiliteSetProvider.js";
|
|
6
|
+
import type { SelectionScope } from "./SelectionScope.js";
|
|
7
|
+
import type { SelectionStorage } from "./SelectionStorage.js";
|
|
8
|
+
import type { CoreIModelHiliteSet, CoreIModelSelectionSet } from "./types/IModel.js";
|
|
9
9
|
/**
|
|
10
10
|
* Props for `enableUnifiedSelectionSyncWithIModel`.
|
|
11
11
|
* @public
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnableUnifiedSelectionSyncWithIModel.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/EnableUnifiedSelectionSyncWithIModel.ts"],"names":[],"mappings":"AAKA,OAAO,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"EnableUnifiedSelectionSyncWithIModel.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/EnableUnifiedSelectionSyncWithIModel.ts"],"names":[],"mappings":"AAKA,OAAO,sBAAsB,CAAC;AAY9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,EAAa,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EAGvB,MAAM,m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iB,CAAC,EAAE,iBAAiB,CAAA;KAAE;IAoDxG,CAAC,MAAM,CAAC,OAAO,CAAC;IAOvB,4GAA4G;IACrG,8BAA8B;;;IAUrC,OAAO,CAAC,aAAa;IAmDrB,OAAO,CAAC,yBAAyB,CAa/B;IAEF,OAAO,CAAC,qBAAqB;IAwB7B,OAAO,CAAC,YAAY;IA2BpB,OAAO,CAAC,eAAe;IA0BvB,OAAO,CAAC,wBAAwB,CAwD9B;CACH"}
|
|
@@ -61,7 +61,7 @@ import { createHiliteSetProvider } from "./HiliteSetProvider.js";
|
|
|
61
61
|
import { createIModelHiliteSetProvider } from "./IModelHiliteSetProvider.js";
|
|
62
62
|
import { Selectables } from "./Selectable.js";
|
|
63
63
|
import { computeSelection } from "./SelectionScope.js";
|
|
64
|
-
import { CoreSelectionSetEventType
|
|
64
|
+
import { CoreSelectionSetEventType } from "./types/IModel.js";
|
|
65
65
|
import { safeDispose } from "./Utils.js";
|
|
66
66
|
/**
|
|
67
67
|
* Enables synchronization between iModel selection and unified selection.
|