@itwin/unified-selection 1.6.9-alpha.0 → 1.7.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 -59
- package/README.md +5 -1
- package/lib/cjs/unified-selection/CachingHiliteSetProvider.d.ts.map +1 -1
- package/lib/cjs/unified-selection/CachingHiliteSetProvider.js +2 -2
- package/lib/cjs/unified-selection/CachingHiliteSetProvider.js.map +1 -1
- package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +1 -1
- package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.js +28 -15
- package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +1 -1
- package/lib/cjs/unified-selection/HiliteSetProvider.js +12 -3
- package/lib/cjs/unified-selection/HiliteSetProvider.js.map +1 -1
- package/lib/cjs/unified-selection/IModelHiliteSetProvider.js +2 -1
- package/lib/cjs/unified-selection/IModelHiliteSetProvider.js.map +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 +6 -1
- 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.map +1 -1
- package/lib/cjs/unified-selection/SelectionScope.js +1 -4
- package/lib/cjs/unified-selection/SelectionScope.js.map +1 -1
- package/lib/cjs/unified-selection/SelectionStorage.d.ts +15 -4
- package/lib/cjs/unified-selection/SelectionStorage.d.ts.map +1 -1
- package/lib/cjs/unified-selection/SelectionStorage.js +1 -1
- package/lib/cjs/unified-selection/SelectionStorage.js.map +1 -1
- 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.d.ts +1 -1
- package/lib/cjs/unified-selection.d.ts.map +1 -1
- package/lib/cjs/unified-selection.js.map +1 -1
- package/lib/esm/unified-selection/CachingHiliteSetProvider.d.ts.map +1 -1
- package/lib/esm/unified-selection/CachingHiliteSetProvider.js +2 -2
- package/lib/esm/unified-selection/CachingHiliteSetProvider.js.map +1 -1
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +1 -1
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.js +28 -15
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +1 -1
- package/lib/esm/unified-selection/HiliteSetProvider.js +12 -3
- package/lib/esm/unified-selection/HiliteSetProvider.js.map +1 -1
- package/lib/esm/unified-selection/IModelHiliteSetProvider.js +2 -1
- package/lib/esm/unified-selection/IModelHiliteSetProvider.js.map +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 +6 -1
- 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.map +1 -1
- package/lib/esm/unified-selection/SelectionScope.js +1 -4
- package/lib/esm/unified-selection/SelectionScope.js.map +1 -1
- package/lib/esm/unified-selection/SelectionStorage.d.ts +15 -4
- package/lib/esm/unified-selection/SelectionStorage.d.ts.map +1 -1
- package/lib/esm/unified-selection/SelectionStorage.js +1 -1
- package/lib/esm/unified-selection/SelectionStorage.js.map +1 -1
- package/lib/esm/unified-selection/Utils.d.ts.map +1 -1
- package/lib/esm/unified-selection/Utils.js.map +1 -1
- package/lib/esm/unified-selection.d.ts +1 -1
- package/lib/esm/unified-selection.d.ts.map +1 -1
- package/lib/esm/unified-selection.js.map +1 -1
- package/package.json +13 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
# @itwin/unified-selection
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.7.1-alpha.0
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- [#1250](https://github.com/iTwin/presentation/pull/1250): React to changes in `@itwin/presentation-shared`.
|
|
8
7
|
- Updated dependencies:
|
|
9
|
-
- @itwin/presentation-shared@2.0.0-alpha.
|
|
8
|
+
- @itwin/presentation-shared@2.0.0-alpha.10
|
|
10
9
|
|
|
11
|
-
## 1.
|
|
10
|
+
## 1.7.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- [#1285](https://github.com/iTwin/presentation/pull/1285): Make `imodelKey` prop optional when calling `SelectionStorage` methods.
|
|
15
|
+
|
|
16
|
+
While the package is designed to work with iModels' selection as the first class citizen, it can be used in other contexts as well. In those cases, the `imodelKey` prop is not relevant and should not be required. This change makes it optional and defaults to an empty string when not supplied.
|
|
12
17
|
|
|
13
18
|
### Patch Changes
|
|
14
19
|
|
|
15
|
-
- [#
|
|
20
|
+
- [#1286](https://github.com/iTwin/presentation/pull/1286): Bump dependencies.
|
|
16
21
|
- Updated dependencies:
|
|
17
|
-
- @itwin/presentation-shared@1.2.
|
|
22
|
+
- @itwin/presentation-shared@1.2.11
|
|
18
23
|
|
|
19
|
-
## 1.6.8
|
|
24
|
+
## 1.6.8
|
|
20
25
|
|
|
21
26
|
### Patch Changes
|
|
22
27
|
|
|
23
|
-
- [#
|
|
28
|
+
- [#1242](https://github.com/iTwin/presentation/pull/1242): Bump dependencies.
|
|
24
29
|
- Updated dependencies:
|
|
25
|
-
- @itwin/presentation-shared@2.
|
|
30
|
+
- @itwin/presentation-shared@1.2.10
|
|
26
31
|
|
|
27
32
|
## 1.6.7
|
|
28
33
|
|
|
@@ -40,14 +45,6 @@
|
|
|
40
45
|
- Updated dependencies:
|
|
41
46
|
- @itwin/presentation-shared@1.2.8
|
|
42
47
|
|
|
43
|
-
## 1.6.6-alpha.0
|
|
44
|
-
|
|
45
|
-
### Patch Changes
|
|
46
|
-
|
|
47
|
-
- [#1180](https://github.com/iTwin/presentation/pull/1180): Version bump
|
|
48
|
-
- Updated dependencies:
|
|
49
|
-
- @itwin/presentation-shared@2.0.0-alpha.6
|
|
50
|
-
|
|
51
48
|
## 1.6.5
|
|
52
49
|
|
|
53
50
|
### Patch Changes
|
|
@@ -73,12 +70,6 @@
|
|
|
73
70
|
- Updated dependencies:
|
|
74
71
|
- @itwin/presentation-shared@1.2.5
|
|
75
72
|
|
|
76
|
-
## 1.6.3-alpha.0
|
|
77
|
-
|
|
78
|
-
### Patch Changes
|
|
79
|
-
|
|
80
|
-
- [#1130](https://github.com/iTwin/presentation/pull/1130): Version bump
|
|
81
|
-
|
|
82
73
|
## 1.6.2
|
|
83
74
|
|
|
84
75
|
### Patch Changes
|
|
@@ -87,14 +78,6 @@
|
|
|
87
78
|
- Updated dependencies:
|
|
88
79
|
- @itwin/presentation-shared@1.2.4
|
|
89
80
|
|
|
90
|
-
## 1.6.2-alpha.0
|
|
91
|
-
|
|
92
|
-
### Patch Changes
|
|
93
|
-
|
|
94
|
-
- [#1112](https://github.com/iTwin/presentation/pull/1112): Version bump
|
|
95
|
-
- Updated dependencies:
|
|
96
|
-
- @itwin/presentation-shared@2.0.0-alpha.3
|
|
97
|
-
|
|
98
81
|
## 1.6.1
|
|
99
82
|
|
|
100
83
|
### Patch Changes
|
|
@@ -127,20 +110,6 @@
|
|
|
127
110
|
- Updated dependencies:
|
|
128
111
|
- @itwin/presentation-shared@1.2.3
|
|
129
112
|
|
|
130
|
-
## 1.5.1-alpha.1
|
|
131
|
-
|
|
132
|
-
### Patch Changes
|
|
133
|
-
|
|
134
|
-
- [#1042](https://github.com/iTwin/presentation/pull/1042): Version bump
|
|
135
|
-
- Updated dependencies:
|
|
136
|
-
- @itwin/presentation-shared@2.0.0-alpha.2
|
|
137
|
-
|
|
138
|
-
## 1.5.1-alpha.0
|
|
139
|
-
|
|
140
|
-
### Patch Changes
|
|
141
|
-
|
|
142
|
-
- [#1031](https://github.com/iTwin/presentation/pull/1031): Version bump
|
|
143
|
-
|
|
144
113
|
## 1.5.0
|
|
145
114
|
|
|
146
115
|
### Minor Changes
|
|
@@ -181,13 +150,6 @@
|
|
|
181
150
|
});
|
|
182
151
|
```
|
|
183
152
|
|
|
184
|
-
## 1.4.3-alpha.0
|
|
185
|
-
|
|
186
|
-
### Patch Changes
|
|
187
|
-
|
|
188
|
-
- Updated dependencies:
|
|
189
|
-
- @itwin/presentation-shared@2.0.0-alpha.1
|
|
190
|
-
|
|
191
153
|
## 1.4.2
|
|
192
154
|
|
|
193
155
|
### Patch Changes
|
|
@@ -196,13 +158,6 @@
|
|
|
196
158
|
- Updated dependencies:
|
|
197
159
|
- @itwin/presentation-shared@1.2.2
|
|
198
160
|
|
|
199
|
-
## 1.4.2-alpha.0
|
|
200
|
-
|
|
201
|
-
### Patch Changes
|
|
202
|
-
|
|
203
|
-
- Updated dependencies:
|
|
204
|
-
- @itwin/presentation-shared@2.0.0-alpha.0
|
|
205
|
-
|
|
206
161
|
## 1.4.1
|
|
207
162
|
|
|
208
163
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -63,7 +63,11 @@ unifiedSelection.selectionChangeEvent.addListener(({ imodelKey, source, changeTy
|
|
|
63
63
|
// An interactive component that allows selecting elements, representing something in an iModel, may want to
|
|
64
64
|
// add that something to unified selection. For example:
|
|
65
65
|
const elementKey = { className: "BisCore.PhysicalElement", id: "0x1" };
|
|
66
|
-
unifiedSelection.addToSelection({
|
|
66
|
+
unifiedSelection.addToSelection({
|
|
67
|
+
imodelKey: createIModelKey(imodelConnection),
|
|
68
|
+
source: "MyComponent",
|
|
69
|
+
selectables: [elementKey],
|
|
70
|
+
});
|
|
67
71
|
```
|
|
68
72
|
|
|
69
73
|
<!-- END EXTRACTION -->
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
|
@@ -14,7 +14,7 @@ const IModelHiliteSetProvider_js_1 = require("./IModelHiliteSetProvider.js");
|
|
|
14
14
|
* @public
|
|
15
15
|
* @deprecated in 1.5. Use `createIModelHiliteSetProvider` instead.
|
|
16
16
|
*/
|
|
17
|
-
/*
|
|
17
|
+
/* v8 ignore start */
|
|
18
18
|
function createCachingHiliteSetProvider(props) {
|
|
19
19
|
const provider = (0, IModelHiliteSetProvider_js_1.createIModelHiliteSetProvider)(props);
|
|
20
20
|
return {
|
|
@@ -23,5 +23,5 @@ function createCachingHiliteSetProvider(props) {
|
|
|
23
23
|
dispose: () => provider[Symbol.dispose](),
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
/*
|
|
26
|
+
/* v8 ignore stop */
|
|
27
27
|
//# sourceMappingURL=CachingHiliteSetProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CachingHiliteSetProvider.js","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;;AAiErD,
|
|
1
|
+
{"version":3,"file":"CachingHiliteSetProvider.js","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;;AAiErD,wEASC;AAxED,gCAA8B;AAE9B,6EAA6E;AAsD7E;;;;;GAKG;AACH,qBAAqB;AACrB,SAAgB,8BAA8B,CAC5C,KAAoC;IAEpC,MAAM,QAAQ,GAAG,IAAA,0DAA6B,EAAC,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 +1 @@
|
|
|
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,
|
|
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,mBAAmB,CAAC;AAE3B;;;GAGG;AACH,MAAM,WAAW,yCAAyC;IACxD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,YAAY,EAAE,kB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rC,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"}
|
|
@@ -105,25 +105,25 @@ class IModelSelectionHandler {
|
|
|
105
105
|
if (props.imodelHiliteSetProvider) {
|
|
106
106
|
return [props.imodelHiliteSetProvider, () => { }];
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
109
|
+
/* v8 ignore else -- @preserve */
|
|
109
110
|
if (props.cachingHiliteSetProvider) {
|
|
110
111
|
return [
|
|
111
|
-
createIModelHiliteSetProviderFromCachingProvider(
|
|
112
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
113
|
-
props.cachingHiliteSetProvider, props.hiliteSetProvider ?? (0, HiliteSetProvider_js_1.createHiliteSetProvider)({ imodelAccess: props.imodelAccess })),
|
|
112
|
+
createIModelHiliteSetProviderFromCachingProvider(props.cachingHiliteSetProvider, props.hiliteSetProvider ?? (0, HiliteSetProvider_js_1.createHiliteSetProvider)({ imodelAccess: props.imodelAccess })),
|
|
114
113
|
// don't need to dispose anything, because our wrapper has no dispose logic, and `cachingHiliteSetProvider` should be disposed
|
|
115
114
|
// by whoever owns it
|
|
116
115
|
() => { },
|
|
117
116
|
];
|
|
118
117
|
}
|
|
119
|
-
/*
|
|
118
|
+
/* eslint-enable @typescript-eslint/no-deprecated */
|
|
119
|
+
/* v8 ignore start */
|
|
120
120
|
const internalProvider = (0, IModelHiliteSetProvider_js_1.createIModelHiliteSetProvider)({
|
|
121
121
|
selectionStorage: this._selectionStorage,
|
|
122
122
|
imodelProvider: () => this._imodelAccess,
|
|
123
123
|
createHiliteSetProvider: () => props.hiliteSetProvider ?? (0, HiliteSetProvider_js_1.createHiliteSetProvider)({ imodelAccess: props.imodelAccess }),
|
|
124
124
|
});
|
|
125
125
|
return [internalProvider, () => (0, Utils_js_1.safeDispose)(internalProvider)];
|
|
126
|
-
/*
|
|
126
|
+
/* v8 ignore stop */
|
|
127
127
|
})();
|
|
128
128
|
this._unregisterIModelSelectionSetListener = this._imodelAccess.selectionSet.onChanged.addListener(this.onIModelSelectionChanged);
|
|
129
129
|
this._unregisterUnifiedSelectionListener = this._selectionStorage.selectionChangeEvent.addListener(this.onUnifiedSelectionChanged);
|
|
@@ -166,7 +166,9 @@ class IModelSelectionHandler {
|
|
|
166
166
|
"clearAll",
|
|
167
167
|
});
|
|
168
168
|
case "add":
|
|
169
|
-
return void (0, rxjs_1.from)(this._imodelHiliteSetProvider
|
|
169
|
+
return void (0, rxjs_1.from)(this._imodelHiliteSetProvider
|
|
170
|
+
.getHiliteSetProvider({ imodelKey: this._imodelAccess.key })
|
|
171
|
+
.getHiliteSet({ selectables }))
|
|
170
172
|
.pipe((0, rxjs_1.takeUntil)(this._cancelOngoingChanges))
|
|
171
173
|
.subscribe({
|
|
172
174
|
next: (set) => {
|
|
@@ -174,7 +176,9 @@ class IModelSelectionHandler {
|
|
|
174
176
|
},
|
|
175
177
|
});
|
|
176
178
|
case "remove":
|
|
177
|
-
return void (0, rxjs_1.from)(this._imodelHiliteSetProvider
|
|
179
|
+
return void (0, rxjs_1.from)(this._imodelHiliteSetProvider
|
|
180
|
+
.getHiliteSetProvider({ imodelKey: this._imodelAccess.key })
|
|
181
|
+
.getHiliteSet({ selectables }))
|
|
178
182
|
.pipe((0, rxjs_1.takeUntil)(this._cancelOngoingChanges))
|
|
179
183
|
.subscribe({
|
|
180
184
|
next: (set) => {
|
|
@@ -198,7 +202,7 @@ class IModelSelectionHandler {
|
|
|
198
202
|
}
|
|
199
203
|
this.syncHiliteSet(args);
|
|
200
204
|
};
|
|
201
|
-
applyCurrentHiliteSet({ activeSelectionAction }) {
|
|
205
|
+
applyCurrentHiliteSet({ activeSelectionAction, }) {
|
|
202
206
|
if (activeSelectionAction !== "keep") {
|
|
203
207
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
204
208
|
try {
|
|
@@ -240,12 +244,15 @@ class IModelSelectionHandler {
|
|
|
240
244
|
}
|
|
241
245
|
else {
|
|
242
246
|
// pre-5.0 core requires adding models and subcategories to hilite set separately
|
|
247
|
+
/* v8 ignore else -- @preserve */
|
|
243
248
|
if (set.models.length) {
|
|
244
249
|
this._imodelAccess.hiliteSet.models.addIds(set.models);
|
|
245
250
|
}
|
|
251
|
+
/* v8 ignore else -- @preserve */
|
|
246
252
|
if (set.subCategories.length) {
|
|
247
253
|
this._imodelAccess.hiliteSet.subcategories.addIds(set.subCategories);
|
|
248
254
|
}
|
|
255
|
+
/* v8 ignore else -- @preserve */
|
|
249
256
|
if (set.elements.length) {
|
|
250
257
|
this._imodelAccess.hiliteSet.elements.addIds(set.elements);
|
|
251
258
|
this._imodelAccess.selectionSet.add(set.elements);
|
|
@@ -273,12 +280,15 @@ class IModelSelectionHandler {
|
|
|
273
280
|
});
|
|
274
281
|
}
|
|
275
282
|
else {
|
|
283
|
+
/* v8 ignore else -- @preserve */
|
|
276
284
|
if (set.models.length) {
|
|
277
285
|
this._imodelAccess.hiliteSet.models.deleteIds(set.models);
|
|
278
286
|
}
|
|
287
|
+
/* v8 ignore else -- @preserve */
|
|
279
288
|
if (set.subCategories.length) {
|
|
280
289
|
this._imodelAccess.hiliteSet.subcategories.deleteIds(set.subCategories);
|
|
281
290
|
}
|
|
291
|
+
/* v8 ignore else -- @preserve */
|
|
282
292
|
if (set.elements.length) {
|
|
283
293
|
this._imodelAccess.hiliteSet.elements.deleteIds(set.elements);
|
|
284
294
|
this._imodelAccess.selectionSet.remove(set.elements);
|
|
@@ -309,9 +319,11 @@ class IModelSelectionHandler {
|
|
|
309
319
|
scope: this._activeScopeProvider(),
|
|
310
320
|
componentId: this.#componentId,
|
|
311
321
|
}))
|
|
312
|
-
: /*
|
|
322
|
+
: /* v8 ignore next */ rxjs_1.EMPTY, ids.models
|
|
323
|
+
? (0, rxjs_1.from)(ids.models).pipe((0, rxjs_1.map)((id) => ({ className: "BisCore.Model", id })))
|
|
324
|
+
: /* v8 ignore next */ rxjs_1.EMPTY, ids.subcategories
|
|
313
325
|
? (0, rxjs_1.from)(ids.subcategories).pipe((0, rxjs_1.map)((id) => ({ className: "BisCore.SubCategory", id })))
|
|
314
|
-
: /*
|
|
326
|
+
: /* v8 ignore next */ rxjs_1.EMPTY);
|
|
315
327
|
const selectionStorageVersion = this._selectionStorageChangeTracker;
|
|
316
328
|
const changeSelectionStorageProps = {
|
|
317
329
|
imodelKey: this._imodelAccess.key,
|
|
@@ -345,9 +357,9 @@ exports.IModelSelectionHandler = IModelSelectionHandler;
|
|
|
345
357
|
function getSelectionSetChangeIds(event) {
|
|
346
358
|
switch (event.type) {
|
|
347
359
|
case IModel_js_1.CoreSelectionSetEventType.Add:
|
|
348
|
-
return event.additions ?? (event.added ? { elements: event.added } : /*
|
|
360
|
+
return event.additions ?? (event.added ? { elements: event.added } : /* v8 ignore next */ {});
|
|
349
361
|
case IModel_js_1.CoreSelectionSetEventType.Remove:
|
|
350
|
-
return event.removals ?? (event.removed ? { elements: event.removed } : /*
|
|
362
|
+
return event.removals ?? (event.removed ? { elements: event.removed } : /* v8 ignore next */ {});
|
|
351
363
|
case IModel_js_1.CoreSelectionSetEventType.Replace:
|
|
352
364
|
return "active" in event.set ? event.set.active : { elements: event.set.elements };
|
|
353
365
|
}
|
|
@@ -360,6 +372,7 @@ function getUnifiedSelectionChangeType(coreChangeType) {
|
|
|
360
372
|
return "remove";
|
|
361
373
|
case IModel_js_1.CoreSelectionSetEventType.Replace:
|
|
362
374
|
return "replace";
|
|
375
|
+
/* v8 ignore next -- @preserve */
|
|
363
376
|
case IModel_js_1.CoreSelectionSetEventType.Clear:
|
|
364
377
|
return "clear";
|
|
365
378
|
}
|
|
@@ -367,7 +380,7 @@ function getUnifiedSelectionChangeType(coreChangeType) {
|
|
|
367
380
|
function is5xSelectionSet(selectionSet) {
|
|
368
381
|
return "active" in selectionSet;
|
|
369
382
|
}
|
|
370
|
-
/*
|
|
383
|
+
/* v8 ignore start */
|
|
371
384
|
function createIModelHiliteSetProviderFromCachingProvider(cachingHiliteSetProvider, hiliteSetProvider) {
|
|
372
385
|
return {
|
|
373
386
|
getHiliteSetProvider: () => hiliteSetProvider,
|
|
@@ -375,5 +388,5 @@ function createIModelHiliteSetProviderFromCachingProvider(cachingHiliteSetProvid
|
|
|
375
388
|
[Symbol.dispose]: () => { },
|
|
376
389
|
};
|
|
377
390
|
}
|
|
378
|
-
/*
|
|
391
|
+
/* v8 ignore stop */
|
|
379
392
|
//# sourceMappingURL=EnableUnifiedSelectionSyncWithIModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnableUnifiedSelectionSyncWithIModel.js","sourceRoot":"","sources":["../../../src/unified-selection/EnableUnifiedSelectionSyncWithIModel.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwGhG,oFAGC;AAzGD,gCAA8B;AAE9B,+BAA4F;AAC5F,sDAA2C;AAC3C,iEAAiE;AACjE,6EAA6E;AAC7E,mDAA8C;AAC9C,2DAAuD;AACvD,iDAA8D;AAC9D,yCAAyC;AAwFzC;;;;GAIG;AACH,SAAgB,oCAAoC,CAAC,KAAgD;IACnG,MAAM,gBAAgB,GAAG,IAAI,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC3D,OAAO,GAAG,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAa,sBAAsB;IACzB,oBAAoB,GAAG,MAAM,CAAC;IAE9B,aAAa,CAA4D;IACzE,iBAAiB,CAAmB;IACpC,wBAAwB,CAAoF;IAC5G,oBAAoB,CAAuB;IAE3C,YAAY,CAAU;IACtB,8BAA8B,GAAG,CAAC,CAAC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------------------------------------------------------------------------------------------\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 { EMPTY, firstValueFrom, from, map, merge, Subject, takeUntil, toArray } from \"rxjs\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport { createHiliteSetProvider } from \"./HiliteSetProvider.js\";\nimport { createIModelHiliteSetProvider } from \"./IModelHiliteSetProvider.js\";\nimport { Selectables } from \"./Selectable.js\";\nimport { computeSelection } from \"./SelectionScope.js\";\nimport { CoreSelectionSetEventType } from \"./types/IModel.js\";\nimport { safeDispose } from \"./Utils.js\";\n\nimport type { GuidString, Id64Arg, Id64Set } from \"@itwin/core-bentley\";\nimport type { ECClassHierarchyInspector, ECSqlQueryExecutor } from \"@itwin/presentation-shared\";\nimport type { CachingHiliteSetProvider } from \"./CachingHiliteSetProvider.js\";\nimport type { HiliteSet, HiliteSetProvider } from \"./HiliteSetProvider.js\";\nimport type { IModelHiliteSetProvider } from \"./IModelHiliteSetProvider.js\";\nimport type { SelectableInstanceKey } from \"./Selectable.js\";\nimport type { StorageSelectionChangeEventArgs, StorageSelectionChangeType } from \"./SelectionChangeEvent.js\";\nimport type { SelectionScope } from \"./SelectionScope.js\";\nimport type { SelectionStorage } from \"./SelectionStorage.js\";\nimport type { CoreIModelHiliteSet, CoreIModelSelectionSet, CoreSelectableIds, CoreSelectionSetEventUnsafe } from \"./types/IModel.js\";\n\n/**\n * Props for `enableUnifiedSelectionSyncWithIModel`.\n * @public\n */\nexport interface EnableUnifiedSelectionSyncWithIModelProps {\n /**\n * Provides access to different iModel's features: query executing, class hierarchy, selection and hilite sets.\n *\n * It's recommended to use `@itwin/presentation-core-interop` to create `key`, `ECSqlQueryExecutor` and `ECSchemaProvider` from\n * [IModelConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/imodelconnection/), and map its\n * `hilited` and `selectionSet` attributes like this:\n *\n * ```ts\n * import { createECSqlQueryExecutor, createECSchemaProvider, createIModelKey } from \"@itwin/presentation-core-interop\";\n * import { createCachingECClassHierarchyInspector } from \"@itwin/presentation-shared\";\n * import { IModelConnection } from \"@itwin/core-frontend\";\n *\n * const imodel: IModelConnection = ...\n * const imodelAccess = {\n * ...createECSqlQueryExecutor(imodel),\n * ...createCachingECClassHierarchyInspector({ schemaProvider: createECSchemaProvider(MyAppFrontend.getSchemaContext(imodel)) }),\n * key: createIModelKey(imodel),\n * hiliteSet: imodel.hilited,\n * selectionSet: imodel.selectionSet,\n * };\n * ```\n */\n imodelAccess: ECSqlQueryExecutor &\n ECClassHierarchyInspector & {\n /** Key of the iModel. Generally taken from `IModelConnection.key`. */\n readonly key: string;\n /** The set of currently hilited elements taken from `IModelConnection.hilited`. */\n readonly hiliteSet: CoreIModelHiliteSet;\n /** The set of currently selected elements taken from `IModelConnection.selectionSet`. */\n readonly selectionSet: CoreIModelSelectionSet;\n };\n\n /**\n * Unified selection storage to synchronize IModel's tool selection with. The storage should be shared\n * across all components in the application to ensure unified selection experience.\n */\n selectionStorage: SelectionStorage;\n\n /** Active selection scope provider. */\n activeScopeProvider: () => SelectionScope;\n\n /**\n * An iModel hilite set provider used to retrieve hilite sets for different iModels. If not provided, a new `IModelHiliteSetProvider`\n * will be created for the given iModel using the provided `imodelAccess`.\n * If the consuming application already has a `IModelHiliteSetProvider` defined, it should be provided instead\n * to reuse the cache and avoid creating new providers for each iModel.\n *\n * @see `createIModelHiliteSetProvider`\n */\n imodelHiliteSetProvider?: IModelHiliteSetProvider;\n\n /**\n * A caching hilite set provider used to retrieve hilite sets for an iModel. If not provided, a new `CachingHiliteSetProvider`\n * will be created for the given iModel using the provided `imodelAccess`.\n * If the consuming application already has a `CachingHiliteSetProvider` defined, it should be provided instead\n * to reuse the cache and avoid creating new providers for each iModel.\n *\n * The type is defined in a way that makes it required for provider to have either the deprecated `dispose` or the\n * new `Symbol.dispose` method.\n *\n * **Warning:** When the given `CachingHiliteSetProvider` internally uses a custom `HiliteSetProvider`, the synchronization has\n * no access to it, and thus uses its own, default, `HiliteSetProvider`. As a result, the synchronization may not work as expected.\n * To alleviate this, the `imodelHiliteSetProvider` prop should be used instead.\n *\n * @deprecated in 1.5. Use `imodelHiliteSetProvider` prop instead.\n */\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n cachingHiliteSetProvider?: CachingHiliteSetProvider | (Omit<CachingHiliteSetProvider, \"dispose\"> & { [Symbol.dispose]: () => void });\n}\n\n/**\n * Enables synchronization between iModel selection and unified selection.\n * @returns function for disposing the synchronization.\n * @public\n */\nexport function enableUnifiedSelectionSyncWithIModel(props: EnableUnifiedSelectionSyncWithIModelProps): () => void {\n const selectionHandler = new IModelSelectionHandler(props);\n return () => selectionHandler[Symbol.dispose]();\n}\n\n/**\n * A handler that syncs selection between unified selection storage (`SelectionStorage`) and\n * an iModel (`iModel.selectionSet`, `iModel.hilited`).\n *\n * @internal\n */\nexport class IModelSelectionHandler {\n private _selectionSourceName = \"Tool\";\n\n private _imodelAccess: EnableUnifiedSelectionSyncWithIModelProps[\"imodelAccess\"];\n private _selectionStorage: SelectionStorage;\n private _imodelHiliteSetProvider: NonNullable<EnableUnifiedSelectionSyncWithIModelProps[\"imodelHiliteSetProvider\"]>;\n private _activeScopeProvider: () => SelectionScope;\n\n private _isSuspended: boolean;\n private _selectionStorageChangeTracker = 0;\n private _cancelOngoingChanges = new Subject<void>();\n private _unregisterUnifiedSelectionListener: () => void;\n private _unregisterIModelSelectionSetListener: () => void;\n private _disposeInternalHiliteSetProvider: () => void;\n\n #componentId: GuidString;\n\n public constructor(props: EnableUnifiedSelectionSyncWithIModelProps & { hiliteSetProvider?: HiliteSetProvider }) {\n this.#componentId = Guid.createValue();\n this._imodelAccess = props.imodelAccess;\n this._selectionStorage = props.selectionStorage;\n this._activeScopeProvider = props.activeScopeProvider;\n this._isSuspended = false;\n [this._imodelHiliteSetProvider, this._disposeInternalHiliteSetProvider] = (() => {\n if (props.imodelHiliteSetProvider) {\n return [props.imodelHiliteSetProvider, () => {}];\n }\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n if (props.cachingHiliteSetProvider) {\n return [\n createIModelHiliteSetProviderFromCachingProvider(\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n props.cachingHiliteSetProvider,\n props.hiliteSetProvider ?? createHiliteSetProvider({ imodelAccess: props.imodelAccess }),\n ),\n // don't need to dispose anything, because our wrapper has no dispose logic, and `cachingHiliteSetProvider` should be disposed\n // by whoever owns it\n () => {},\n ];\n }\n /* c8 ignore start */\n const internalProvider = createIModelHiliteSetProvider({\n selectionStorage: this._selectionStorage,\n imodelProvider: () => this._imodelAccess,\n createHiliteSetProvider: () => props.hiliteSetProvider ?? createHiliteSetProvider({ imodelAccess: props.imodelAccess }),\n });\n return [internalProvider, () => safeDispose(internalProvider)];\n /* c8 ignore end */\n })();\n\n this._unregisterIModelSelectionSetListener = this._imodelAccess.selectionSet.onChanged.addListener(this.onIModelSelectionChanged);\n this._unregisterUnifiedSelectionListener = this._selectionStorage.selectionChangeEvent.addListener(this.onUnifiedSelectionChanged);\n\n if (!is5xSelectionSet(this._imodelAccess.selectionSet)) {\n // itwinjs-core@4: stop imodel from syncing tool selection with hilited list - we want to manage that sync ourselves\n this._imodelAccess.hiliteSet.wantSyncWithSelectionSet = false;\n }\n\n this.applyCurrentHiliteSet({ activeSelectionAction: \"clearAll\" });\n }\n\n public [Symbol.dispose]() {\n this._cancelOngoingChanges.next();\n this._unregisterIModelSelectionSetListener();\n this._unregisterUnifiedSelectionListener();\n this._disposeInternalHiliteSetProvider();\n }\n\n /** Temporarily suspends tool selection synchronization until the returned disposable object is disposed. */\n public suspendIModelToolSelectionSync() {\n const wasSuspended = this._isSuspended;\n this._isSuspended = true;\n return {\n [Symbol.dispose]: () => {\n this._isSuspended = wasSuspended;\n },\n };\n }\n\n private syncHiliteSet(props: { changeType: StorageSelectionChangeType; selectables: Selectables; source: string }): void {\n const { changeType, selectables, source } = props;\n switch (changeType) {\n case \"clear\":\n return this.applyCurrentHiliteSet({ activeSelectionAction: \"clearAll\" });\n case \"replace\":\n return this.applyCurrentHiliteSet({\n activeSelectionAction:\n source === this._selectionSourceName\n ? is5xSelectionSet(this._imodelAccess.selectionSet)\n ? // with 5x core we don't need to clear anything when event is triggered by a Tool (hilite and selection sets are in sync already)\n \"keep\"\n : // with 4x core we need to clear hilite set, because it's not synced with selection set\n \"clearHilited\"\n : // when event is triggered not by a Tool, we need to clear everything\n \"clearAll\",\n });\n case \"add\":\n return void from(this._imodelHiliteSetProvider.getHiliteSetProvider({ imodelKey: this._imodelAccess.key }).getHiliteSet({ selectables }))\n .pipe(takeUntil(this._cancelOngoingChanges))\n .subscribe({\n next: (set) => {\n this.addHiliteSet(set);\n },\n });\n case \"remove\":\n return void from(this._imodelHiliteSetProvider.getHiliteSetProvider({ imodelKey: this._imodelAccess.key }).getHiliteSet({ selectables }))\n .pipe(takeUntil(this._cancelOngoingChanges))\n .subscribe({\n next: (set) => {\n this.removeHiliteSet(set);\n },\n complete: () => {\n this.applyCurrentHiliteSet({ activeSelectionAction: \"keep\" });\n },\n });\n }\n }\n\n private onUnifiedSelectionChanged = (args: StorageSelectionChangeEventArgs) => {\n // iModels are only interested in top-level selection changes\n if (args.imodelKey !== this._imodelAccess.key || args.level !== 0) {\n return;\n }\n\n // update the selection storage change tracker so we know the selection storage changed\n this._selectionStorageChangeTracker = (this._selectionStorageChangeTracker + 1) % Number.MAX_SAFE_INTEGER;\n\n if (args.changeType === \"replace\" || args.changeType === \"clear\") {\n this._cancelOngoingChanges.next();\n }\n this.syncHiliteSet(args);\n };\n\n private applyCurrentHiliteSet({ activeSelectionAction }: { activeSelectionAction: \"clearAll\" | \"clearHilited\" | \"keep\" }) {\n if (activeSelectionAction !== \"keep\") {\n using _dispose = this.suspendIModelToolSelectionSync();\n if (!is5xSelectionSet(this._imodelAccess.selectionSet)) {\n this._imodelAccess.hiliteSet.clear();\n }\n if (activeSelectionAction === \"clearAll\") {\n this._imodelAccess.selectionSet.emptyAll();\n }\n }\n\n from(this._imodelHiliteSetProvider.getCurrentHiliteSet({ imodelKey: this._imodelAccess.key }))\n .pipe(takeUntil(this._cancelOngoingChanges))\n .subscribe({\n next: (ids) => {\n this.addHiliteSet(ids);\n },\n });\n }\n\n private addHiliteSet(set: HiliteSet) {\n using _dispose = this.suspendIModelToolSelectionSync();\n if (is5xSelectionSet(this._imodelAccess.selectionSet)) {\n // with 5.x core we can simply add the set as a whole\n this._imodelAccess.selectionSet.add({\n models: set.models,\n subcategories: set.subCategories,\n elements: set.elements,\n });\n } else {\n // pre-5.0 core requires adding models and subcategories to hilite set separately\n if (set.models.length) {\n this._imodelAccess.hiliteSet.models.addIds(set.models);\n }\n if (set.subCategories.length) {\n this._imodelAccess.hiliteSet.subcategories.addIds(set.subCategories);\n }\n if (set.elements.length) {\n this._imodelAccess.hiliteSet.elements.addIds(set.elements);\n this._imodelAccess.selectionSet.add(set.elements);\n }\n }\n }\n\n private removeHiliteSet(set: HiliteSet) {\n using _dispose = this.suspendIModelToolSelectionSync();\n if (is5xSelectionSet(this._imodelAccess.selectionSet)) {\n // with 5.x core we can simply remove the set as a whole\n this._imodelAccess.selectionSet.remove({\n models: set.models,\n subcategories: set.subCategories,\n elements: set.elements,\n });\n } else {\n if (set.models.length) {\n this._imodelAccess.hiliteSet.models.deleteIds(set.models);\n }\n if (set.subCategories.length) {\n this._imodelAccess.hiliteSet.subcategories.deleteIds(set.subCategories);\n }\n if (set.elements.length) {\n this._imodelAccess.hiliteSet.elements.deleteIds(set.elements);\n this._imodelAccess.selectionSet.remove(set.elements);\n }\n }\n }\n\n private onIModelSelectionChanged = async (event: CoreSelectionSetEventUnsafe): Promise<void> => {\n if (this._isSuspended) {\n return;\n }\n\n if (CoreSelectionSetEventType.Clear === event.type) {\n this._selectionStorage.clearSelection({ imodelKey: this._imodelAccess.key, source: this._selectionSourceName });\n return;\n }\n\n const ids = getSelectionSetChangeIds(event);\n const scopedSelection = merge(\n ids.elements\n ? from(\n computeSelection({\n queryExecutor: this._imodelAccess,\n elementIds: ids.elements,\n scope: this._activeScopeProvider(),\n componentId: this.#componentId,\n }),\n )\n : /* c8 ignore next */ EMPTY,\n ids.models ? from(ids.models).pipe(map((id): SelectableInstanceKey => ({ className: \"BisCore.Model\", id }))) : /* c8 ignore next */ EMPTY,\n ids.subcategories\n ? from(ids.subcategories).pipe(map((id): SelectableInstanceKey => ({ className: \"BisCore.SubCategory\", id })))\n : /* c8 ignore next */ EMPTY,\n );\n\n const selectionStorageVersion = this._selectionStorageChangeTracker;\n const changeSelectionStorageProps = {\n imodelKey: this._imodelAccess.key,\n source: this._selectionSourceName,\n selectables: await firstValueFrom(scopedSelection.pipe(toArray())),\n };\n try {\n switch (event.type) {\n case CoreSelectionSetEventType.Add:\n return this._selectionStorage.addToSelection(changeSelectionStorageProps);\n case CoreSelectionSetEventType.Remove:\n return this._selectionStorage.removeFromSelection(changeSelectionStorageProps);\n case CoreSelectionSetEventType.Replace:\n return this._selectionStorage.replaceSelection(changeSelectionStorageProps);\n }\n } finally {\n if (this._selectionStorageChangeTracker === selectionStorageVersion) {\n // if the storage wasn't changed while we were processing the selection change, we have to re-sync the\n // hilite set (otherwise it's done by the selection storage change handler)\n this.syncHiliteSet({\n ...changeSelectionStorageProps,\n selectables: Selectables.create(changeSelectionStorageProps.selectables),\n changeType: getUnifiedSelectionChangeType(event.type),\n });\n }\n }\n };\n}\n\nfunction getSelectionSetChangeIds(\n event: Omit<CoreSelectionSetEventUnsafe, \"type\"> & {\n type: CoreSelectionSetEventType.Add | CoreSelectionSetEventType.Remove | CoreSelectionSetEventType.Replace;\n },\n): CoreSelectableIds {\n switch (event.type) {\n case CoreSelectionSetEventType.Add:\n return event.additions ?? (event.added ? { elements: event.added } : /* c8 ignore next */ {});\n case CoreSelectionSetEventType.Remove:\n return event.removals ?? (event.removed ? { elements: event.removed } : /* c8 ignore next */ {});\n case CoreSelectionSetEventType.Replace:\n return \"active\" in event.set ? event.set.active : { elements: event.set.elements };\n }\n}\n\nfunction getUnifiedSelectionChangeType(coreChangeType: CoreSelectionSetEventType): StorageSelectionChangeType {\n switch (coreChangeType) {\n case CoreSelectionSetEventType.Add:\n return \"add\";\n case CoreSelectionSetEventType.Remove:\n return \"remove\";\n case CoreSelectionSetEventType.Replace:\n return \"replace\";\n case CoreSelectionSetEventType.Clear:\n return \"clear\";\n }\n}\n\nfunction is5xSelectionSet(selectionSet: CoreIModelSelectionSet): selectionSet is Omit<CoreIModelSelectionSet, \"add\" | \"remove\"> & {\n readonly active: { [P in keyof CoreSelectableIds]-?: Id64Set };\n add: (ids: Id64Arg | CoreSelectableIds) => boolean;\n remove: (ids: Id64Arg | CoreSelectableIds) => boolean;\n} {\n return \"active\" in selectionSet;\n}\n\n/* c8 ignore start */\nfunction createIModelHiliteSetProviderFromCachingProvider(\n cachingHiliteSetProvider: NonNullable<EnableUnifiedSelectionSyncWithIModelProps[\"cachingHiliteSetProvider\"]>,\n hiliteSetProvider: HiliteSetProvider,\n): IModelHiliteSetProvider {\n return {\n getHiliteSetProvider: () => hiliteSetProvider,\n getCurrentHiliteSet: (props) => cachingHiliteSetProvider.getHiliteSet(props),\n [Symbol.dispose]: () => {},\n };\n}\n/* c8 ignore end */\n"]}
|
|
1
|
+
{"version":3,"file":"EnableUnifiedSelectionSyncWithIModel.js","sourceRoot":"","sources":["../../../src/unified-selection/EnableUnifiedSelectionSyncWithIModel.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgHhG,oFAGC;AAjHD,gCAA8B;AAE9B,+BAA4F;AAC5F,sDAA2C;AAC3C,iEAAiE;AACjE,6EAA6E;AAC7E,mDAA8C;AAC9C,2DAAuD;AACvD,iDAA8D;AAC9D,yCAAyC;AAgGzC;;;;GAIG;AACH,SAAgB,oCAAoC,CAAC,KAAgD;IACnG,MAAM,gBAAgB,GAAG,I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ClC,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CACvB,YAAoC;IAMpC,OAAO,QAAQ,IAAI,YAAY,CAAC;AAClC,CAAC;AAED,qBAAqB;AACrB,SAAS,gDAAgD,CACvD,wBAA4G,EAC5G,iBAAoC;IAEpC,OAAO;QACL,oBAAoB,EAAE,GAAG,EAAE,CAAC,iBAAiB;QAC7C,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,wBAAwB,CAAC,YAAY,CAAC,KAAK,CAAC;QAC5E,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,GAAE,CAAC;KAC3B,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\nimport \"./DisposePolyfill.js\";\n\nimport { EMPTY, firstValueFrom, from, map, merge, Subject, takeUntil, toArray } from \"rxjs\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport { createHiliteSetProvider } from \"./HiliteSetProvider.js\";\nimport { createIModelHiliteSetProvider } from \"./IModelHiliteSetProvider.js\";\nimport { Selectables } from \"./Selectable.js\";\nimport { computeSelection } from \"./SelectionScope.js\";\nimport { CoreSelectionSetEventType } from \"./types/IModel.js\";\nimport { safeDispose } from \"./Utils.js\";\n\nimport type { GuidString, Id64Arg, Id64Set } from \"@itwin/core-bentley\";\nimport type { ECClassHierarchyInspector, ECSqlQueryExecutor } from \"@itwin/presentation-shared\";\nimport type { CachingHiliteSetProvider } from \"./CachingHiliteSetProvider.js\";\nimport type { HiliteSet, HiliteSetProvider } from \"./HiliteSetProvider.js\";\nimport type { IModelHiliteSetProvider } from \"./IModelHiliteSetProvider.js\";\nimport type { SelectableInstanceKey } from \"./Selectable.js\";\nimport type { StorageSelectionChangeEventArgs, StorageSelectionChangeType } from \"./SelectionChangeEvent.js\";\nimport type { SelectionScope } from \"./SelectionScope.js\";\nimport type { SelectionStorage } from \"./SelectionStorage.js\";\nimport type {\n CoreIModelHiliteSet,\n CoreIModelSelectionSet,\n CoreSelectableIds,\n CoreSelectionSetEventUnsafe,\n} from \"./types/IModel.js\";\n\n/**\n * Props for `enableUnifiedSelectionSyncWithIModel`.\n * @public\n */\nexport interface EnableUnifiedSelectionSyncWithIModelProps {\n /**\n * Provides access to different iModel's features: query executing, class hierarchy, selection and hilite sets.\n *\n * It's recommended to use `@itwin/presentation-core-interop` to create `key`, `ECSqlQueryExecutor` and `ECSchemaProvider` from\n * [IModelConnection](https://www.itwinjs.org/reference/core-frontend/imodelconnection/imodelconnection/), and map its\n * `hilited` and `selectionSet` attributes like this:\n *\n * ```ts\n * import { createECSqlQueryExecutor, createECSchemaProvider, createIModelKey } from \"@itwin/presentation-core-interop\";\n * import { createCachingECClassHierarchyInspector } from \"@itwin/presentation-shared\";\n * import { IModelConnection } from \"@itwin/core-frontend\";\n *\n * const imodel: IModelConnection = ...\n * const imodelAccess = {\n * ...createECSqlQueryExecutor(imodel),\n * ...createCachingECClassHierarchyInspector({ schemaProvider: createECSchemaProvider(MyAppFrontend.getSchemaContext(imodel)) }),\n * key: createIModelKey(imodel),\n * hiliteSet: imodel.hilited,\n * selectionSet: imodel.selectionSet,\n * };\n * ```\n */\n imodelAccess: ECSqlQueryExecutor &\n ECClassHierarchyInspector & {\n /** Key of the iModel. Generally taken from `IModelConnection.key`. */\n readonly key: string;\n /** The set of currently hilited elements taken from `IModelConnection.hilited`. */\n readonly hiliteSet: CoreIModelHiliteSet;\n /** The set of currently selected elements taken from `IModelConnection.selectionSet`. */\n readonly selectionSet: CoreIModelSelectionSet;\n };\n\n /**\n * Unified selection storage to synchronize IModel's tool selection with. The storage should be shared\n * across all components in the application to ensure unified selection experience.\n */\n selectionStorage: SelectionStorage;\n\n /** Active selection scope provider. */\n activeScopeProvider: () => SelectionScope;\n\n /**\n * An iModel hilite set provider used to retrieve hilite sets for different iModels. If not provided, a new `IModelHiliteSetProvider`\n * will be created for the given iModel using the provided `imodelAccess`.\n * If the consuming application already has a `IModelHiliteSetProvider` defined, it should be provided instead\n * to reuse the cache and avoid creating new providers for each iModel.\n *\n * @see `createIModelHiliteSetProvider`\n */\n imodelHiliteSetProvider?: IModelHiliteSetProvider;\n\n /**\n * A caching hilite set provider used to retrieve hilite sets for an iModel. If not provided, a new `CachingHiliteSetProvider`\n * will be created for the given iModel using the provided `imodelAccess`.\n * If the consuming application already has a `CachingHiliteSetProvider` defined, it should be provided instead\n * to reuse the cache and avoid creating new providers for each iModel.\n *\n * The type is defined in a way that makes it required for provider to have either the deprecated `dispose` or the\n * new `Symbol.dispose` method.\n *\n * **Warning:** When the given `CachingHiliteSetProvider` internally uses a custom `HiliteSetProvider`, the synchronization has\n * no access to it, and thus uses its own, default, `HiliteSetProvider`. As a result, the synchronization may not work as expected.\n * To alleviate this, the `imodelHiliteSetProvider` prop should be used instead.\n *\n * @deprecated in 1.5. Use `imodelHiliteSetProvider` prop instead.\n */\n cachingHiliteSetProvider?:\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n | CachingHiliteSetProvider\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n | (Omit<CachingHiliteSetProvider, \"dispose\"> & { [Symbol.dispose]: () => void });\n}\n\n/**\n * Enables synchronization between iModel selection and unified selection.\n * @returns function for disposing the synchronization.\n * @public\n */\nexport function enableUnifiedSelectionSyncWithIModel(props: EnableUnifiedSelectionSyncWithIModelProps): () => void {\n const selectionHandler = new IModelSelectionHandler(props);\n return () => selectionHandler[Symbol.dispose]();\n}\n\n/**\n * A handler that syncs selection between unified selection storage (`SelectionStorage`) and\n * an iModel (`iModel.selectionSet`, `iModel.hilited`).\n *\n * @internal\n */\nexport class IModelSelectionHandler {\n private _selectionSourceName = \"Tool\";\n\n private _imodelAccess: EnableUnifiedSelectionSyncWithIModelProps[\"imodelAccess\"];\n private _selectionStorage: SelectionStorage;\n private _imodelHiliteSetProvider: NonNullable<EnableUnifiedSelectionSyncWithIModelProps[\"imodelHiliteSetProvider\"]>;\n private _activeScopeProvider: () => SelectionScope;\n\n private _isSuspended: boolean;\n private _selectionStorageChangeTracker = 0;\n private _cancelOngoingChanges = new Subject<void>();\n private _unregisterUnifiedSelectionListener: () => void;\n private _unregisterIModelSelectionSetListener: () => void;\n private _disposeInternalHiliteSetProvider: () => void;\n\n #componentId: GuidString;\n\n public constructor(props: EnableUnifiedSelectionSyncWithIModelProps & { hiliteSetProvider?: HiliteSetProvider }) {\n this.#componentId = Guid.createValue();\n this._imodelAccess = props.imodelAccess;\n this._selectionStorage = props.selectionStorage;\n this._activeScopeProvider = props.activeScopeProvider;\n this._isSuspended = false;\n [this._imodelHiliteSetProvider, this._disposeInternalHiliteSetProvider] = (() => {\n if (props.imodelHiliteSetProvider) {\n return [props.imodelHiliteSetProvider, () => {}];\n }\n\n /* eslint-disable @typescript-eslint/no-deprecated */\n /* v8 ignore else -- @preserve */\n if (props.cachingHiliteSetProvider) {\n return [\n createIModelHiliteSetProviderFromCachingProvider(\n props.cachingHiliteSetProvider,\n props.hiliteSetProvider ?? createHiliteSetProvider({ imodelAccess: props.imodelAccess }),\n ),\n // don't need to dispose anything, because our wrapper has no dispose logic, and `cachingHiliteSetProvider` should be disposed\n // by whoever owns it\n () => {},\n ];\n }\n /* eslint-enable @typescript-eslint/no-deprecated */\n\n /* v8 ignore start */\n const internalProvider = createIModelHiliteSetProvider({\n selectionStorage: this._selectionStorage,\n imodelProvider: () => this._imodelAccess,\n createHiliteSetProvider: () =>\n props.hiliteSetProvider ?? createHiliteSetProvider({ imodelAccess: props.imodelAccess }),\n });\n return [internalProvider, () => safeDispose(internalProvider)];\n /* v8 ignore stop */\n })();\n\n this._unregisterIModelSelectionSetListener = this._imodelAccess.selectionSet.onChanged.addListener(\n this.onIModelSelectionChanged,\n );\n this._unregisterUnifiedSelectionListener = this._selectionStorage.selectionChangeEvent.addListener(\n this.onUnifiedSelectionChanged,\n );\n\n if (!is5xSelectionSet(this._imodelAccess.selectionSet)) {\n // itwinjs-core@4: stop imodel from syncing tool selection with hilited list - we want to manage that sync ourselves\n this._imodelAccess.hiliteSet.wantSyncWithSelectionSet = false;\n }\n\n this.applyCurrentHiliteSet({ activeSelectionAction: \"clearAll\" });\n }\n\n public [Symbol.dispose]() {\n this._cancelOngoingChanges.next();\n this._unregisterIModelSelectionSetListener();\n this._unregisterUnifiedSelectionListener();\n this._disposeInternalHiliteSetProvider();\n }\n\n /** Temporarily suspends tool selection synchronization until the returned disposable object is disposed. */\n public suspendIModelToolSelectionSync() {\n const wasSuspended = this._isSuspended;\n this._isSuspended = true;\n return {\n [Symbol.dispose]: () => {\n this._isSuspended = wasSuspended;\n },\n };\n }\n\n private syncHiliteSet(props: {\n changeType: StorageSelectionChangeType;\n selectables: Selectables;\n source: string;\n }): void {\n const { changeType, selectables, source } = props;\n switch (changeType) {\n case \"clear\":\n return this.applyCurrentHiliteSet({ activeSelectionAction: \"clearAll\" });\n case \"replace\":\n return this.applyCurrentHiliteSet({\n activeSelectionAction:\n source === this._selectionSourceName\n ? is5xSelectionSet(this._imodelAccess.selectionSet)\n ? // with 5x core we don't need to clear anything when event is triggered by a Tool (hilite and selection sets are in sync already)\n \"keep\"\n : // with 4x core we need to clear hilite set, because it's not synced with selection set\n \"clearHilited\"\n : // when event is triggered not by a Tool, we need to clear everything\n \"clearAll\",\n });\n case \"add\":\n return void from(\n this._imodelHiliteSetProvider\n .getHiliteSetProvider({ imodelKey: this._imodelAccess.key })\n .getHiliteSet({ selectables }),\n )\n .pipe(takeUntil(this._cancelOngoingChanges))\n .subscribe({\n next: (set) => {\n this.addHiliteSet(set);\n },\n });\n case \"remove\":\n return void from(\n this._imodelHiliteSetProvider\n .getHiliteSetProvider({ imodelKey: this._imodelAccess.key })\n .getHiliteSet({ selectables }),\n )\n .pipe(takeUntil(this._cancelOngoingChanges))\n .subscribe({\n next: (set) => {\n this.removeHiliteSet(set);\n },\n complete: () => {\n this.applyCurrentHiliteSet({ activeSelectionAction: \"keep\" });\n },\n });\n }\n }\n\n private onUnifiedSelectionChanged = (args: StorageSelectionChangeEventArgs) => {\n // iModels are only interested in top-level selection changes\n if (args.imodelKey !== this._imodelAccess.key || args.level !== 0) {\n return;\n }\n\n // update the selection storage change tracker so we know the selection storage changed\n this._selectionStorageChangeTracker = (this._selectionStorageChangeTracker + 1) % Number.MAX_SAFE_INTEGER;\n\n if (args.changeType === \"replace\" || args.changeType === \"clear\") {\n this._cancelOngoingChanges.next();\n }\n this.syncHiliteSet(args);\n };\n\n private applyCurrentHiliteSet({\n activeSelectionAction,\n }: {\n activeSelectionAction: \"clearAll\" | \"clearHilited\" | \"keep\";\n }) {\n if (activeSelectionAction !== \"keep\") {\n using _dispose = this.suspendIModelToolSelectionSync();\n if (!is5xSelectionSet(this._imodelAccess.selectionSet)) {\n this._imodelAccess.hiliteSet.clear();\n }\n if (activeSelectionAction === \"clearAll\") {\n this._imodelAccess.selectionSet.emptyAll();\n }\n }\n\n from(this._imodelHiliteSetProvider.getCurrentHiliteSet({ imodelKey: this._imodelAccess.key }))\n .pipe(takeUntil(this._cancelOngoingChanges))\n .subscribe({\n next: (ids) => {\n this.addHiliteSet(ids);\n },\n });\n }\n\n private addHiliteSet(set: HiliteSet) {\n using _dispose = this.suspendIModelToolSelectionSync();\n if (is5xSelectionSet(this._imodelAccess.selectionSet)) {\n // with 5.x core we can simply add the set as a whole\n this._imodelAccess.selectionSet.add({\n models: set.models,\n subcategories: set.subCategories,\n elements: set.elements,\n });\n } else {\n // pre-5.0 core requires adding models and subcategories to hilite set separately\n /* v8 ignore else -- @preserve */\n if (set.models.length) {\n this._imodelAccess.hiliteSet.models.addIds(set.models);\n }\n /* v8 ignore else -- @preserve */\n if (set.subCategories.length) {\n this._imodelAccess.hiliteSet.subcategories.addIds(set.subCategories);\n }\n /* v8 ignore else -- @preserve */\n if (set.elements.length) {\n this._imodelAccess.hiliteSet.elements.addIds(set.elements);\n this._imodelAccess.selectionSet.add(set.elements);\n }\n }\n }\n\n private removeHiliteSet(set: HiliteSet) {\n using _dispose = this.suspendIModelToolSelectionSync();\n if (is5xSelectionSet(this._imodelAccess.selectionSet)) {\n // with 5.x core we can simply remove the set as a whole\n this._imodelAccess.selectionSet.remove({\n models: set.models,\n subcategories: set.subCategories,\n elements: set.elements,\n });\n } else {\n /* v8 ignore else -- @preserve */\n if (set.models.length) {\n this._imodelAccess.hiliteSet.models.deleteIds(set.models);\n }\n /* v8 ignore else -- @preserve */\n if (set.subCategories.length) {\n this._imodelAccess.hiliteSet.subcategories.deleteIds(set.subCategories);\n }\n /* v8 ignore else -- @preserve */\n if (set.elements.length) {\n this._imodelAccess.hiliteSet.elements.deleteIds(set.elements);\n this._imodelAccess.selectionSet.remove(set.elements);\n }\n }\n }\n\n private onIModelSelectionChanged = async (event: CoreSelectionSetEventUnsafe): Promise<void> => {\n if (this._isSuspended) {\n return;\n }\n\n if (CoreSelectionSetEventType.Clear === event.type) {\n this._selectionStorage.clearSelection({ imodelKey: this._imodelAccess.key, source: this._selectionSourceName });\n return;\n }\n\n const ids = getSelectionSetChangeIds(event);\n const scopedSelection = merge(\n ids.elements\n ? from(\n computeSelection({\n queryExecutor: this._imodelAccess,\n elementIds: ids.elements,\n scope: this._activeScopeProvider(),\n componentId: this.#componentId,\n }),\n )\n : /* v8 ignore next */ EMPTY,\n ids.models\n ? from(ids.models).pipe(map((id): SelectableInstanceKey => ({ className: \"BisCore.Model\", id })))\n : /* v8 ignore next */ EMPTY,\n ids.subcategories\n ? from(ids.subcategories).pipe(map((id): SelectableInstanceKey => ({ className: \"BisCore.SubCategory\", id })))\n : /* v8 ignore next */ EMPTY,\n );\n\n const selectionStorageVersion = this._selectionStorageChangeTracker;\n const changeSelectionStorageProps = {\n imodelKey: this._imodelAccess.key,\n source: this._selectionSourceName,\n selectables: await firstValueFrom(scopedSelection.pipe(toArray())),\n };\n try {\n switch (event.type) {\n case CoreSelectionSetEventType.Add:\n return this._selectionStorage.addToSelection(changeSelectionStorageProps);\n case CoreSelectionSetEventType.Remove:\n return this._selectionStorage.removeFromSelection(changeSelectionStorageProps);\n case CoreSelectionSetEventType.Replace:\n return this._selectionStorage.replaceSelection(changeSelectionStorageProps);\n }\n } finally {\n if (this._selectionStorageChangeTracker === selectionStorageVersion) {\n // if the storage wasn't changed while we were processing the selection change, we have to re-sync the\n // hilite set (otherwise it's done by the selection storage change handler)\n this.syncHiliteSet({\n ...changeSelectionStorageProps,\n selectables: Selectables.create(changeSelectionStorageProps.selectables),\n changeType: getUnifiedSelectionChangeType(event.type),\n });\n }\n }\n };\n}\n\nfunction getSelectionSetChangeIds(\n event: Omit<CoreSelectionSetEventUnsafe, \"type\"> & {\n type: CoreSelectionSetEventType.Add | CoreSelectionSetEventType.Remove | CoreSelectionSetEventType.Replace;\n },\n): CoreSelectableIds {\n switch (event.type) {\n case CoreSelectionSetEventType.Add:\n return event.additions ?? (event.added ? { elements: event.added } : /* v8 ignore next */ {});\n case CoreSelectionSetEventType.Remove:\n return event.removals ?? (event.removed ? { elements: event.removed } : /* v8 ignore next */ {});\n case CoreSelectionSetEventType.Replace:\n return \"active\" in event.set ? event.set.active : { elements: event.set.elements };\n }\n}\n\nfunction getUnifiedSelectionChangeType(coreChangeType: CoreSelectionSetEventType): StorageSelectionChangeType {\n switch (coreChangeType) {\n case CoreSelectionSetEventType.Add:\n return \"add\";\n case CoreSelectionSetEventType.Remove:\n return \"remove\";\n case CoreSelectionSetEventType.Replace:\n return \"replace\";\n /* v8 ignore next -- @preserve */\n case CoreSelectionSetEventType.Clear:\n return \"clear\";\n }\n}\n\nfunction is5xSelectionSet(\n selectionSet: CoreIModelSelectionSet,\n): selectionSet is Omit<CoreIModelSelectionSet, \"add\" | \"remove\"> & {\n readonly active: { [P in keyof CoreSelectableIds]-?: Id64Set };\n add: (ids: Id64Arg | CoreSelectableIds) => boolean;\n remove: (ids: Id64Arg | CoreSelectableIds) => boolean;\n} {\n return \"active\" in selectionSet;\n}\n\n/* v8 ignore start */\nfunction createIModelHiliteSetProviderFromCachingProvider(\n cachingHiliteSetProvider: NonNullable<EnableUnifiedSelectionSyncWithIModelProps[\"cachingHiliteSetProvider\"]>,\n hiliteSetProvider: HiliteSetProvider,\n): IModelHiliteSetProvider {\n return {\n getHiliteSetProvider: () => hiliteSetProvider,\n getCurrentHiliteSet: (props) => cachingHiliteSetProvider.getHiliteSet(props),\n [Symbol.dispose]: () => {},\n };\n}\n/* v8 ignore stop */\n"]}
|
|
@@ -207,7 +207,9 @@ class HiliteSetProviderImpl {
|
|
|
207
207
|
return (0, rxjs_1.from)(executeQuery({
|
|
208
208
|
queryExecutor: this._imodelAccess,
|
|
209
209
|
query: { ctes, ecsql, bindings },
|
|
210
|
-
config: {
|
|
210
|
+
config: {
|
|
211
|
+
restartToken: `${this.#componentName}/${this.#componentId}/sub-categories/${core_bentley_1.Guid.createValue()}`,
|
|
212
|
+
},
|
|
211
213
|
}));
|
|
212
214
|
}));
|
|
213
215
|
}
|
|
@@ -219,7 +221,10 @@ class HiliteSetProviderImpl {
|
|
|
219
221
|
elementKeys: instancesByType.element.pipe((0, rxjs_1.toArray)()),
|
|
220
222
|
}).pipe((0, rxjs_1.mergeMap)(({ groupInformationElementKeys, geometricElementKeys, functionalElements, elementKeys }) => {
|
|
221
223
|
const hasFunctionalElements = !!functionalElements.length;
|
|
222
|
-
if (!groupInformationElementKeys.length &&
|
|
224
|
+
if (!groupInformationElementKeys.length &&
|
|
225
|
+
!geometricElementKeys.length &&
|
|
226
|
+
!elementKeys.length &&
|
|
227
|
+
!hasFunctionalElements) {
|
|
223
228
|
return rxjs_1.EMPTY;
|
|
224
229
|
}
|
|
225
230
|
const bindings = [];
|
|
@@ -265,7 +270,11 @@ class HiliteSetProviderImpl {
|
|
|
265
270
|
`,
|
|
266
271
|
];
|
|
267
272
|
const ecsql = [
|
|
268
|
-
...(hasFunctionalElements
|
|
273
|
+
...(hasFunctionalElements
|
|
274
|
+
? [
|
|
275
|
+
"SELECT ECInstanceId FROM FunctionalElementChildGeometricElements WHERE ECClassId IS (BisCore.GeometricElement)",
|
|
276
|
+
]
|
|
277
|
+
: []),
|
|
269
278
|
"SELECT ECInstanceId FROM GeometricElementGeometricElements WHERE ECClassId IS (BisCore.GeometricElement)",
|
|
270
279
|
"SELECT ECInstanceId FROM GroupGeometricElements WHERE ECClassId IS (BisCore.GeometricElement)",
|
|
271
280
|
"SELECT ECInstanceId FROM ElementGeometricElements WHERE ECClassId IS (BisCore.GeometricElement)",
|