@itwin/unified-selection 0.1.0 → 0.3.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 +129 -0
- package/README.md +104 -6
- package/lib/cjs/unified-selection/CachingHiliteSetProvider.d.ts +33 -0
- package/lib/cjs/unified-selection/CachingHiliteSetProvider.d.ts.map +1 -0
- package/lib/cjs/unified-selection/CachingHiliteSetProvider.js +62 -0
- package/lib/cjs/unified-selection/CachingHiliteSetProvider.js.map +1 -0
- package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts +90 -0
- package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +1 -0
- package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.js +205 -0
- package/lib/cjs/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +1 -0
- package/lib/cjs/unified-selection/HiliteSetProvider.d.ts +37 -0
- package/lib/cjs/unified-selection/HiliteSetProvider.d.ts.map +1 -0
- package/lib/cjs/unified-selection/HiliteSetProvider.js +344 -0
- package/lib/cjs/unified-selection/HiliteSetProvider.js.map +1 -0
- package/lib/cjs/unified-selection/Selectable.d.ts +0 -3
- package/lib/cjs/unified-selection/Selectable.d.ts.map +1 -1
- package/lib/cjs/unified-selection/Selectable.js +2 -2
- package/lib/cjs/unified-selection/Selectable.js.map +1 -1
- package/lib/cjs/unified-selection/SelectionChangeEvent.d.ts +11 -7
- package/lib/cjs/unified-selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/cjs/unified-selection/SelectionChangeEvent.js +1 -1
- package/lib/cjs/unified-selection/SelectionChangeEvent.js.map +1 -1
- package/lib/cjs/unified-selection/SelectionScope.d.ts +44 -0
- package/lib/cjs/unified-selection/SelectionScope.d.ts.map +1 -0
- package/lib/cjs/unified-selection/SelectionScope.js +193 -0
- package/lib/cjs/unified-selection/SelectionScope.js.map +1 -0
- package/lib/cjs/unified-selection/SelectionStorage.d.ts +34 -29
- package/lib/cjs/unified-selection/SelectionStorage.d.ts.map +1 -1
- package/lib/cjs/unified-selection/SelectionStorage.js +32 -18
- package/lib/cjs/unified-selection/SelectionStorage.js.map +1 -1
- package/lib/cjs/unified-selection/Utils.d.ts +7 -0
- package/lib/cjs/unified-selection/Utils.d.ts.map +1 -0
- package/lib/cjs/unified-selection/Utils.js +24 -0
- package/lib/cjs/unified-selection/Utils.js.map +1 -0
- package/lib/cjs/unified-selection/types/IModel.d.ts +84 -0
- package/lib/cjs/unified-selection/types/IModel.d.ts.map +1 -0
- package/lib/cjs/unified-selection/types/IModel.js +24 -0
- package/lib/cjs/unified-selection/types/IModel.js.map +1 -0
- package/lib/cjs/unified-selection.d.ts +5 -7
- package/lib/cjs/unified-selection.d.ts.map +1 -1
- package/lib/cjs/unified-selection.js +11 -7
- package/lib/cjs/unified-selection.js.map +1 -1
- package/lib/esm/unified-selection/CachingHiliteSetProvider.d.ts +33 -0
- package/lib/esm/unified-selection/CachingHiliteSetProvider.d.ts.map +1 -0
- package/lib/esm/unified-selection/CachingHiliteSetProvider.js +58 -0
- package/lib/esm/unified-selection/CachingHiliteSetProvider.js.map +1 -0
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts +90 -0
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.d.ts.map +1 -0
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.js +200 -0
- package/lib/esm/unified-selection/EnableUnifiedSelectionSyncWithIModel.js.map +1 -0
- package/lib/esm/unified-selection/HiliteSetProvider.d.ts +37 -0
- package/lib/esm/unified-selection/HiliteSetProvider.d.ts.map +1 -0
- package/lib/esm/unified-selection/HiliteSetProvider.js +340 -0
- package/lib/esm/unified-selection/HiliteSetProvider.js.map +1 -0
- package/lib/esm/unified-selection/Selectable.d.ts +0 -3
- 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 +11 -7
- package/lib/esm/unified-selection/SelectionChangeEvent.d.ts.map +1 -1
- package/lib/esm/unified-selection/SelectionChangeEvent.js +1 -1
- package/lib/esm/unified-selection/SelectionChangeEvent.js.map +1 -1
- package/lib/esm/unified-selection/SelectionScope.d.ts +44 -0
- package/lib/esm/unified-selection/SelectionScope.d.ts.map +1 -0
- package/lib/esm/unified-selection/SelectionScope.js +189 -0
- package/lib/esm/unified-selection/SelectionScope.js.map +1 -0
- package/lib/esm/unified-selection/SelectionStorage.d.ts +34 -29
- package/lib/esm/unified-selection/SelectionStorage.d.ts.map +1 -1
- package/lib/esm/unified-selection/SelectionStorage.js +31 -17
- package/lib/esm/unified-selection/SelectionStorage.js.map +1 -1
- package/lib/esm/unified-selection/Utils.d.ts +7 -0
- package/lib/esm/unified-selection/Utils.d.ts.map +1 -0
- package/lib/esm/unified-selection/Utils.js +20 -0
- package/lib/esm/unified-selection/Utils.js.map +1 -0
- package/lib/esm/unified-selection/types/IModel.d.ts +84 -0
- package/lib/esm/unified-selection/types/IModel.d.ts.map +1 -0
- package/lib/esm/unified-selection/types/IModel.js +21 -0
- package/lib/esm/unified-selection/types/IModel.js.map +1 -0
- package/lib/esm/unified-selection.d.ts +5 -7
- package/lib/esm/unified-selection.d.ts.map +1 -1
- package/lib/esm/unified-selection.js +5 -7
- package/lib/esm/unified-selection.js.map +1 -1
- package/package.json +28 -15
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module UnifiedSelection
|
|
3
|
-
*/
|
|
4
1
|
import { Selectable, Selectables } from "./Selectable";
|
|
5
2
|
import { SelectionChangeEvent } from "./SelectionChangeEvent";
|
|
3
|
+
type IModelKeyProp = {
|
|
4
|
+
/** Key of the iModel to get selection levels for. */
|
|
5
|
+
imodelKey: string;
|
|
6
|
+
} | {
|
|
7
|
+
/**
|
|
8
|
+
* Key of the iModel to get selection levels for.
|
|
9
|
+
* @deprecated in 0.2. Use `imodelKey` instead.
|
|
10
|
+
*/
|
|
11
|
+
iModelKey: string;
|
|
12
|
+
};
|
|
6
13
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
14
|
+
* Defines return value of `createStorage`.
|
|
15
|
+
*
|
|
16
|
+
* @beta Used in public API as a return value. Not expected to be created / extended by package
|
|
17
|
+
* consumers, may be supplemented with required attributes any time.
|
|
9
18
|
*/
|
|
10
19
|
export interface SelectionStorage {
|
|
11
20
|
/** An event that is raised when selection changes. */
|
|
12
21
|
selectionChangeEvent: SelectionChangeEvent;
|
|
13
22
|
/** Get the selection levels currently stored for the specified iModel. */
|
|
14
|
-
getSelectionLevels(props:
|
|
15
|
-
/** Key of the iModel to get selection levels for. */
|
|
16
|
-
iModelKey: string;
|
|
17
|
-
}): number[];
|
|
23
|
+
getSelectionLevels(props: IModelKeyProp): number[];
|
|
18
24
|
/** Get the selection stored in the storage. */
|
|
19
|
-
getSelection(props: {
|
|
20
|
-
/** Key of the iModel to get selection for. */
|
|
21
|
-
iModelKey: string;
|
|
25
|
+
getSelection(props: IModelKeyProp & {
|
|
22
26
|
/** Level of the selection. Defaults to `0`. */
|
|
23
27
|
level?: number;
|
|
24
28
|
}): Selectables;
|
|
25
29
|
/** Add keys to the selection. */
|
|
26
|
-
addToSelection(props: {
|
|
27
|
-
/** Key of the iModel to change selection for. */
|
|
28
|
-
iModelKey: string;
|
|
30
|
+
addToSelection(props: IModelKeyProp & {
|
|
29
31
|
/** Name of the selection source. Generally, this identifies the component that makes the selection change. */
|
|
30
32
|
source: string;
|
|
31
33
|
/** The selectables to add to selection. */
|
|
@@ -34,9 +36,7 @@ export interface SelectionStorage {
|
|
|
34
36
|
level?: number;
|
|
35
37
|
}): void;
|
|
36
38
|
/** Remove keys from current selection. */
|
|
37
|
-
removeFromSelection(props: {
|
|
38
|
-
/** Key of the iModel to change selection for. */
|
|
39
|
-
iModelKey: string;
|
|
39
|
+
removeFromSelection(props: IModelKeyProp & {
|
|
40
40
|
/** Name of the selection source. Generally, this identifies the component that makes the selection change. */
|
|
41
41
|
source: string;
|
|
42
42
|
/** The selectables to remove from selection. */
|
|
@@ -45,9 +45,7 @@ export interface SelectionStorage {
|
|
|
45
45
|
level?: number;
|
|
46
46
|
}): void;
|
|
47
47
|
/** Replace current selection. */
|
|
48
|
-
replaceSelection(props: {
|
|
49
|
-
/** Key of the iModel to change selection for. */
|
|
50
|
-
iModelKey: string;
|
|
48
|
+
replaceSelection(props: IModelKeyProp & {
|
|
51
49
|
/** Name of the selection source. Generally, this identifies the component that makes the selection change. */
|
|
52
50
|
source: string;
|
|
53
51
|
/** The selectables to add to selection. */
|
|
@@ -56,23 +54,30 @@ export interface SelectionStorage {
|
|
|
56
54
|
level?: number;
|
|
57
55
|
}): void;
|
|
58
56
|
/** Clear current selection. */
|
|
59
|
-
clearSelection(props: {
|
|
60
|
-
/** Key of the iModel to change selection for. */
|
|
61
|
-
iModelKey: string;
|
|
57
|
+
clearSelection(props: IModelKeyProp & {
|
|
62
58
|
/** Name of the selection source. Generally, this identifies the component that makes the selection change. */
|
|
63
59
|
source: string;
|
|
64
60
|
/** Level of the selection. Defaults to `0`. */
|
|
65
61
|
level?: number;
|
|
66
62
|
}): void;
|
|
67
63
|
/** Clear storage for an iModel. This function should be called when iModel is closed. */
|
|
68
|
-
clearStorage(props:
|
|
69
|
-
/** Key of the iModel to change selection for. */
|
|
70
|
-
iModelKey: string;
|
|
71
|
-
}): void;
|
|
64
|
+
clearStorage(props: IModelKeyProp): void;
|
|
72
65
|
}
|
|
73
66
|
/**
|
|
74
|
-
* Creates a selection storage
|
|
67
|
+
* Creates a selection storage which stores and allows managing application-level selection.
|
|
68
|
+
*
|
|
69
|
+
* **Note:** `clearSelection` should be called upon iModel close to free-up memory:
|
|
70
|
+
* ```ts
|
|
71
|
+
* import { IModelConnection } from "@itwin/core-frontend";
|
|
72
|
+
* IModelConnection.onClose.addListener((imodel) => {
|
|
73
|
+
* storage.clearStorage(imodel.key);
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
75
77
|
* @beta
|
|
76
78
|
*/
|
|
77
79
|
export declare function createStorage(): SelectionStorage;
|
|
80
|
+
/** @internal */
|
|
81
|
+
export declare const IMODEL_CLOSE_SELECTION_CLEAR_SOURCE = "Unified selection storage: clear";
|
|
82
|
+
export {};
|
|
78
83
|
//# sourceMappingURL=SelectionStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionStorage.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/SelectionStorage.ts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"SelectionStorage.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/SelectionStorage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAyF,MAAM,wBAAwB,CAAC;AAErJ,KAAK,aAAa,GACd;IACE,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;CACnB,GACD;IACE;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,oBAAoB,EAAE,oBAAoB,CAAC;IAE3C,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;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,IAAI,gBAAgB,CAEhD;AAED,gBAAgB;AAChB,eAAO,MAAM,mCAAmC,qCAAqC,CAAC"}
|
|
@@ -4,32 +4,39 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.createStorage = void 0;
|
|
8
|
-
/** @packageDocumentation
|
|
9
|
-
* @module UnifiedSelection
|
|
10
|
-
*/
|
|
7
|
+
exports.IMODEL_CLOSE_SELECTION_CLEAR_SOURCE = exports.createStorage = void 0;
|
|
11
8
|
const Selectable_1 = require("./Selectable");
|
|
12
9
|
const SelectionChangeEvent_1 = require("./SelectionChangeEvent");
|
|
13
10
|
/**
|
|
14
|
-
* Creates a selection storage
|
|
11
|
+
* Creates a selection storage which stores and allows managing application-level selection.
|
|
12
|
+
*
|
|
13
|
+
* **Note:** `clearSelection` should be called upon iModel close to free-up memory:
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { IModelConnection } from "@itwin/core-frontend";
|
|
16
|
+
* IModelConnection.onClose.addListener((imodel) => {
|
|
17
|
+
* storage.clearStorage(imodel.key);
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
15
21
|
* @beta
|
|
16
22
|
*/
|
|
17
23
|
function createStorage() {
|
|
18
24
|
return new SelectionStorageImpl();
|
|
19
25
|
}
|
|
20
26
|
exports.createStorage = createStorage;
|
|
27
|
+
/** @internal */
|
|
28
|
+
exports.IMODEL_CLOSE_SELECTION_CLEAR_SOURCE = "Unified selection storage: clear";
|
|
21
29
|
class SelectionStorageImpl {
|
|
22
30
|
_storage = new Map();
|
|
23
31
|
selectionChangeEvent;
|
|
24
32
|
constructor() {
|
|
25
33
|
this.selectionChangeEvent = new SelectionChangeEvent_1.SelectionChangeEventImpl();
|
|
26
34
|
}
|
|
27
|
-
getSelectionLevels(
|
|
28
|
-
return this.getContainer(
|
|
35
|
+
getSelectionLevels(props) {
|
|
36
|
+
return this.getContainer(getIModelKey(props)).getSelectionLevels();
|
|
29
37
|
}
|
|
30
38
|
getSelection(props) {
|
|
31
|
-
|
|
32
|
-
return this.getContainer(iModelKey).getSelection(level ?? 0);
|
|
39
|
+
return this.getContainer(getIModelKey(props)).getSelection(props.level ?? 0);
|
|
33
40
|
}
|
|
34
41
|
addToSelection(props) {
|
|
35
42
|
this.handleChange({ ...props, changeType: "add" });
|
|
@@ -43,21 +50,23 @@ class SelectionStorageImpl {
|
|
|
43
50
|
clearSelection(props) {
|
|
44
51
|
this.handleChange({ ...props, changeType: "clear", selectables: [] });
|
|
45
52
|
}
|
|
46
|
-
clearStorage(
|
|
47
|
-
|
|
48
|
-
this.
|
|
53
|
+
clearStorage(props) {
|
|
54
|
+
const imodelKey = getIModelKey(props);
|
|
55
|
+
this.clearSelection({ source: exports.IMODEL_CLOSE_SELECTION_CLEAR_SOURCE, imodelKey });
|
|
56
|
+
this._storage.delete(imodelKey);
|
|
49
57
|
}
|
|
50
|
-
getContainer(
|
|
51
|
-
let selectionContainer = this._storage.get(
|
|
58
|
+
getContainer(imodelKey) {
|
|
59
|
+
let selectionContainer = this._storage.get(imodelKey);
|
|
52
60
|
if (!selectionContainer) {
|
|
53
61
|
selectionContainer = new MultiLevelSelectablesContainer();
|
|
54
|
-
this._storage.set(
|
|
62
|
+
this._storage.set(imodelKey, selectionContainer);
|
|
55
63
|
}
|
|
56
64
|
return selectionContainer;
|
|
57
65
|
}
|
|
58
66
|
handleChange(props) {
|
|
59
|
-
const {
|
|
60
|
-
const
|
|
67
|
+
const { source, level: inLevel, changeType, selectables: change } = props;
|
|
68
|
+
const imodelKey = getIModelKey(props);
|
|
69
|
+
const container = this.getContainer(imodelKey);
|
|
61
70
|
const level = inLevel ?? 0;
|
|
62
71
|
const selectables = container.getSelection(level);
|
|
63
72
|
const selected = Selectable_1.Selectables.create(change);
|
|
@@ -89,7 +98,8 @@ class SelectionStorageImpl {
|
|
|
89
98
|
const event = {
|
|
90
99
|
source,
|
|
91
100
|
level,
|
|
92
|
-
|
|
101
|
+
imodelKey,
|
|
102
|
+
iModelKey: imodelKey,
|
|
93
103
|
changeType,
|
|
94
104
|
selectables: selected,
|
|
95
105
|
timestamp: new Date(),
|
|
@@ -97,6 +107,10 @@ class SelectionStorageImpl {
|
|
|
97
107
|
this.selectionChangeEvent.raiseEvent(event, this);
|
|
98
108
|
}
|
|
99
109
|
}
|
|
110
|
+
function getIModelKey(props) {
|
|
111
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
112
|
+
return "imodelKey" in props ? props.imodelKey : props.iModelKey;
|
|
113
|
+
}
|
|
100
114
|
class MultiLevelSelectablesContainer {
|
|
101
115
|
_selectablesContainers;
|
|
102
116
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionStorage.js","sourceRoot":"","sources":["../../../src/unified-selection/SelectionStorage.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG;;GAEG;AAEH,6CAAuD;AACvD,iEAAqJ;AA6ErJ;;;GAGG;AACH,SAAgB,aAAa;IAC3B,OAAO,IAAI,oBAAoB,EAAE,CAAC;AACpC,CAAC;AAFD,sCAEC;AAED,MAAM,oBAAoB;IAChB,QAAQ,GAAG,IAAI,GAAG,EAA0C,CAAC;IAC9D,oBAAoB,CAA2B;IAEtD;QACE,IAAI,CAAC,oBAAoB,GAAG,IAAI,+CAAwB,EAAE,CAAC;IAC7D,CAAC;IAEM,kBAAkB,CAAC,EAAE,SAAS,EAAyB;QAC5D,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,kBAAkB,EAAE,CAAC;IAC3D,CAAC;IAEM,YAAY,CAAC,KAA4C;QAC9D,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;QACnC,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC;IAC/D,CAAC;IAEM,cAAc,CAAC,KAAuF;QAC3G,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IACrD,CAAC;IAEM,mBAAmB,CAAC,KAAuF;QAChH,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxD,CAAC;IAEM,gBAAgB,CAAC,KAAuF;QAC7G,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;IACzD,CAAC;IAEM,cAAc,CAAC,KAA4D;QAChF,IAAI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QACvB,MAAM,MAAM,GAAG,IAAI,KAAK,EAAU,CAAC;QACnC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,sBAAsB,CAAC,OAAO,EAAE,EAAE;YACzD,IAAI,CAAC,wBAAW,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;gBAClC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aACvB;SACF;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;YACtC,IAAI,WAAW,IAAI,KAAK,EAAE;gBACxB,MAAM,WAAW,GAAG,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,WAAW,CAAE,CAAC;gBAClE,wBAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;aAChC;SACF;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\n/** @packageDocumentation\n * @module UnifiedSelection\n */\n\nimport { Selectable, Selectables } from \"./Selectable\";\nimport { SelectionChangeEvent, SelectionChangeEventImpl, StorageSelectionChangeEventArgs, StorageSelectionChangeType } from \"./SelectionChangeEvent\";\n\n/**\n * Selection storage interface which provides main selection and sub-selection.\n * @beta\n */\nexport interface SelectionStorage {\n /** An event that is raised when selection changes. */\n selectionChangeEvent: SelectionChangeEvent;\n\n /** Get the selection levels currently stored for the specified iModel. */\n getSelectionLevels(props: {\n /** Key of the iModel to get selection levels for. */\n iModelKey: string;\n }): number[];\n\n /** Get the selection stored in the storage. */\n getSelection(props: {\n /** Key of the iModel to get selection for. */\n iModelKey: string;\n /** Level of the selection. Defaults to `0`. */\n level?: number;\n }): Selectables;\n\n /** Add keys to the selection. */\n addToSelection(props: {\n /** Key of the iModel to change selection for. */\n iModelKey: string;\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 }): void;\n\n /** Remove keys from current selection. */\n removeFromSelection(props: {\n /** Key of the iModel to change selection for. */\n iModelKey: string;\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 }): void;\n\n /** Replace current selection. */\n replaceSelection(props: {\n /** Key of the iModel to change selection for. */\n iModelKey: string;\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 }): void;\n\n /** Clear current selection. */\n clearSelection(props: {\n /** Key of the iModel to change selection for. */\n iModelKey: string;\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 }): void;\n\n /** Clear storage for an iModel. This function should be called when iModel is closed. */\n clearStorage(props: {\n /** Key of the iModel to change selection for. */\n iModelKey: string;\n }): void;\n}\n\n/**\n * Creates a selection storage. When an iModel is closed `SelectionStorage.clearSelection` function should be called.\n * @beta\n */\nexport function createStorage(): SelectionStorage {\n return new SelectionStorageImpl();\n}\n\nclass SelectionStorageImpl implements SelectionStorage {\n private _storage = new Map<string, MultiLevelSelectablesContainer>();\n public selectionChangeEvent: SelectionChangeEventImpl;\n\n constructor() {\n this.selectionChangeEvent = new SelectionChangeEventImpl();\n }\n\n public getSelectionLevels({ iModelKey }: { iModelKey: string }): number[] {\n return this.getContainer(iModelKey).getSelectionLevels();\n }\n\n public getSelection(props: { iModelKey: string; level?: number }): Selectables {\n const { iModelKey, level } = props;\n return this.getContainer(iModelKey).getSelection(level ?? 0);\n }\n\n public addToSelection(props: { source: string; iModelKey: string; selectables: Selectable[]; level?: number }): void {\n this.handleChange({ ...props, changeType: \"add\" });\n }\n\n public removeFromSelection(props: { source: string; iModelKey: string; selectables: Selectable[]; level?: number }): void {\n this.handleChange({ ...props, changeType: \"remove\" });\n }\n\n public replaceSelection(props: { source: string; iModelKey: string; selectables: Selectable[]; level?: number }): void {\n this.handleChange({ ...props, changeType: \"replace\" });\n }\n\n public clearSelection(props: { source: string; iModelKey: string; level?: number }): void {\n this.handleChange({ ...props, changeType: \"clear\", selectables: [] });\n }\n\n public clearStorage({ iModelKey }: { iModelKey: string }): void {\n this.clearSelection({ source: \"Clear iModel storage\", 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(props: { source: string; iModelKey: string; level?: number; changeType: StorageSelectionChangeType; selectables: Selectable[] }) {\n const { iModelKey, source, level: inLevel, changeType, selectables: change } = 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 changeType,\n selectables: selected,\n timestamp: new Date(),\n };\n this.selectionChangeEvent.raiseEvent(event, this);\n }\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;;;AAEhG,6CAAuD;AACvD,iEAAqJ;AAsFrJ;;;;;;;;;;;;GAYG;AACH,SAAgB,aAAa;IAC3B,OAAO,IAAI,oBAAoB,EAAE,CAAC;AACpC,CAAC;AAFD,sCAEC;AAED,gBAAgB;AACH,QAAA,mCAAmC,GAAG,kCAAkC,CAAC;AAEtF,MAAM,oBAAoB;IAChB,QAAQ,GAAG,IAAI,GAAG,EAA0C,CAAC;IAC9D,oBAAoB,CAA2B;IAEtD;QACE,IAAI,CAAC,oBAAoB,GAAG,IAAI,+CAAwB,EAAE,CAAC;IAC7D,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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,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,wBAAW,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 { Selectable, Selectables } from \"./Selectable\";\nimport { SelectionChangeEvent, SelectionChangeEventImpl, StorageSelectionChangeEventArgs, StorageSelectionChangeType } from \"./SelectionChangeEvent\";\n\ntype IModelKeyProp =\n | {\n /** Key of the iModel to get selection levels for. */\n imodelKey: string;\n }\n | {\n /**\n * Key of the iModel to get selection levels for.\n * @deprecated in 0.2. Use `imodelKey` instead.\n */\n iModelKey: string;\n };\n\n/**\n * Defines return value of `createStorage`.\n *\n * @beta 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 */\nexport interface SelectionStorage {\n /** An event that is raised when selection changes. */\n selectionChangeEvent: SelectionChangeEvent;\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 * ```ts\n * import { IModelConnection } from \"@itwin/core-frontend\";\n * IModelConnection.onClose.addListener((imodel) => {\n * storage.clearStorage(imodel.key);\n * });\n * ```\n *\n * @beta\n */\nexport function createStorage(): SelectionStorage {\n return new SelectionStorageImpl();\n}\n\n/** @internal */\nexport const IMODEL_CLOSE_SELECTION_CLEAR_SOURCE = \"Unified selection storage: clear\";\n\nclass SelectionStorageImpl implements SelectionStorage {\n private _storage = new Map<string, MultiLevelSelectablesContainer>();\n public selectionChangeEvent: SelectionChangeEventImpl;\n\n constructor() {\n this.selectionChangeEvent = new SelectionChangeEventImpl();\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(props: IModelKeyProp & { source: string; selectables: Selectable[]; level?: number }): 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: IMODEL_CLOSE_SELECTION_CLEAR_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(props: IModelKeyProp & { source: string; level?: number; changeType: StorageSelectionChangeType; selectables: Selectable[] }) {\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 };\n this.selectionChangeEvent.raiseEvent(event, this);\n }\n}\n\nfunction getIModelKey(props: IModelKeyProp): string {\n // eslint-disable-next-line deprecation/deprecation\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"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ECSqlBinding } from "@itwin/presentation-shared";
|
|
2
|
+
/**
|
|
3
|
+
* Forms ECSql bindings from given ID's.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare function formIdBindings(property: string, ids: string[], bindings: ECSqlBinding[]): string;
|
|
7
|
+
//# sourceMappingURL=Utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/Utils.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,CAYhG"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.formIdBindings = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Forms ECSql bindings from given ID's.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
function formIdBindings(property, ids, bindings) {
|
|
13
|
+
if (ids.length > 1000) {
|
|
14
|
+
bindings.push({ type: "idset", value: ids });
|
|
15
|
+
return `InVirtualSet(?, ${property})`;
|
|
16
|
+
}
|
|
17
|
+
if (ids.length === 0) {
|
|
18
|
+
return `FALSE`;
|
|
19
|
+
}
|
|
20
|
+
ids.forEach((id) => bindings.push({ type: "id", value: id }));
|
|
21
|
+
return `${property} IN (${ids.map(() => "?").join(",")})`;
|
|
22
|
+
}
|
|
23
|
+
exports.formIdBindings = formIdBindings;
|
|
24
|
+
//# sourceMappingURL=Utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../src/unified-selection/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAIhG;;;GAGG;AACH,SAAgB,cAAc,CAAC,QAAgB,EAAE,GAAa,EAAE,QAAwB;IACtF,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;QACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;QAC7C,OAAO,mBAAmB,QAAQ,GAAG,CAAC;IACxC,CAAC;IAED,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IAC9D,OAAO,GAAG,QAAQ,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAC5D,CAAC;AAZD,wCAYC","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 { ECSqlBinding } from \"@itwin/presentation-shared\";\n\n/**\n * Forms ECSql bindings from given ID's.\n * @internal\n */\nexport function formIdBindings(property: string, ids: string[], bindings: ECSqlBinding[]): string {\n if (ids.length > 1000) {\n bindings.push({ type: \"idset\", value: ids });\n return `InVirtualSet(?, ${property})`;\n }\n\n if (ids.length === 0) {\n return `FALSE`;\n }\n\n ids.forEach((id) => bindings.push({ type: \"id\", value: id }));\n return `${property} IN (${ids.map(() => \"?\").join(\",\")})`;\n}\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Id64Arg } from "@itwin/core-bentley";
|
|
2
|
+
import { Event } from "@itwin/presentation-shared";
|
|
3
|
+
/**
|
|
4
|
+
* Identifies the type of changes made to the `CoreIModelSelectionSet` to produce a `CoreSelectionSetEvent`.
|
|
5
|
+
* @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare enum CoreSelectionSetEventType {
|
|
9
|
+
/** Elements have been added to the set. */
|
|
10
|
+
Add = 0,
|
|
11
|
+
/** Elements have been removed from the set. */
|
|
12
|
+
Remove = 1,
|
|
13
|
+
/** Some elements have been added to the set and others have been removed. */
|
|
14
|
+
Replace = 2,
|
|
15
|
+
/** All elements are about to be removed from the set. */
|
|
16
|
+
Clear = 3
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Payload sent to `CoreIModelSelectionSet.onChanged` event listeners to describe how the contents of the set have changed.
|
|
20
|
+
* @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionsetevent/
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
export interface CoreSelectionSetEventUnsafe {
|
|
24
|
+
/**
|
|
25
|
+
* The type of operation that produced this event.
|
|
26
|
+
*
|
|
27
|
+
* Actually, this should be `CoreSelectionSetEventType`, however we can't use it here because in TS two identical enums with
|
|
28
|
+
* different names aren't equal, so [`SelectionSetEventType `](https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/)
|
|
29
|
+
* doesn't map to `CoreSelectionSetEventType` as far as TS is concerned. Due to this reason, this interface is marked as `unsafe`.
|
|
30
|
+
*/
|
|
31
|
+
type: number;
|
|
32
|
+
/** The element Ids added to the set. */
|
|
33
|
+
added?: Id64Arg;
|
|
34
|
+
/** The element Ids removed from the set. */
|
|
35
|
+
removed?: Id64Arg;
|
|
36
|
+
/** The affected `CoreIModelSelectionSet`. */
|
|
37
|
+
set: CoreIModelSelectionSet;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A set of *currently selected* elements in an iModel.
|
|
41
|
+
* @see https://www.itwinjs.org/reference/core-frontend/selectionset/
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export interface CoreIModelSelectionSet {
|
|
45
|
+
/** Event called whenever elements are added or removed from this SelectionSet. */
|
|
46
|
+
onChanged: Event<(ev: CoreSelectionSetEventUnsafe) => void>;
|
|
47
|
+
/** The IDs of the selected elements. */
|
|
48
|
+
readonly elements: Set<string>;
|
|
49
|
+
/** Clear current selection set. */
|
|
50
|
+
emptyAll(): void;
|
|
51
|
+
/** Add one or more Ids to the current selection set. */
|
|
52
|
+
add(elem: Id64Arg): boolean;
|
|
53
|
+
/** Remove one or more Ids from the current selection set. */
|
|
54
|
+
remove(elem: Id64Arg): boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A set if ID's optimized for performance-critical code which represents large sets of ID's as pairs of 32-bit integers.
|
|
58
|
+
* @see https://www.itwinjs.org/reference/core-bentley/ids/id64/id64.uint32set/
|
|
59
|
+
*/
|
|
60
|
+
interface Uint32Set {
|
|
61
|
+
/** Add any number of Ids to the set. */
|
|
62
|
+
addIds(ids: Id64Arg): void;
|
|
63
|
+
/** Remove any number of Ids from the set. */
|
|
64
|
+
deleteIds(ids: Id64Arg): void;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A set of *hilited* elements in an iModel, by element id.
|
|
68
|
+
* @see https://www.itwinjs.org/reference/core-frontend/selectionset/hiliteset/
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
export interface CoreIModelHiliteSet {
|
|
72
|
+
/** Control whether the hilited elements should be synchronized with the contents of `CoreIModelSelectionSet`.*/
|
|
73
|
+
wantSyncWithSelectionSet: boolean;
|
|
74
|
+
/** The set of hilited elements. */
|
|
75
|
+
readonly elements: Uint32Set;
|
|
76
|
+
/** The set of hilited subcategories. */
|
|
77
|
+
readonly subcategories: Uint32Set;
|
|
78
|
+
/** The set of hilited models. */
|
|
79
|
+
readonly models: Uint32Set;
|
|
80
|
+
/** Remove all elements from the hilited set. */
|
|
81
|
+
clear(): void;
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
84
|
+
//# sourceMappingURL=IModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModel.d.ts","sourceRoot":"","sources":["../../../../src/unified-selection/types/IModel.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEnD;;;;GAIG;AACH,oBAAY,yBAAyB;IACnC,2CAA2C;IAC3C,GAAG,IAAA;IACH,+CAA+C;IAC/C,MAAM,IAAA;IACN,6EAA6E;IAC7E,OAAO,IAAA;IACP,yDAAyD;IACzD,KAAK,IAAA;CACN;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6CAA6C;IAC7C,GAAG,EAAE,sBAAsB,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,kFAAkF;IAClF,SAAS,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,2BAA2B,KAAK,IAAI,CAAC,CAAC;IAC5D,wCAAwC;IACxC,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,mCAAmC;IACnC,QAAQ,IAAI,IAAI,CAAC;IACjB,wDAAwD;IACxD,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IAC5B,6DAA6D;IAC7D,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;CAChC;AAED;;;GAGG;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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.CoreSelectionSetEventType = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Identifies the type of changes made to the `CoreIModelSelectionSet` to produce a `CoreSelectionSetEvent`.
|
|
10
|
+
* @see https://www.itwinjs.org/reference/core-frontend/selectionset/selectionseteventtype/
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
var CoreSelectionSetEventType;
|
|
14
|
+
(function (CoreSelectionSetEventType) {
|
|
15
|
+
/** Elements have been added to the set. */
|
|
16
|
+
CoreSelectionSetEventType[CoreSelectionSetEventType["Add"] = 0] = "Add";
|
|
17
|
+
/** Elements have been removed from the set. */
|
|
18
|
+
CoreSelectionSetEventType[CoreSelectionSetEventType["Remove"] = 1] = "Remove";
|
|
19
|
+
/** Some elements have been added to the set and others have been removed. */
|
|
20
|
+
CoreSelectionSetEventType[CoreSelectionSetEventType["Replace"] = 2] = "Replace";
|
|
21
|
+
/** All elements are about to be removed from the set. */
|
|
22
|
+
CoreSelectionSetEventType[CoreSelectionSetEventType["Clear"] = 3] = "Clear";
|
|
23
|
+
})(CoreSelectionSetEventType || (exports.CoreSelectionSetEventType = CoreSelectionSetEventType = {}));
|
|
24
|
+
//# sourceMappingURL=IModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IModel.js","sourceRoot":"","sources":["../../../../src/unified-selection/types/IModel.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAKhG;;;;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 } from \"@itwin/core-bentley\";\nimport { Event } from \"@itwin/presentation-shared\";\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 * @internal\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 /** The element Ids removed from the set. */\n removed?: Id64Arg;\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 * @internal\n */\nexport interface 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 /** 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 * 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 */\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 * @internal\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,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module UnifiedSelection
|
|
3
|
-
*
|
|
4
|
-
* @docs-group-description UnifiedSelection
|
|
5
|
-
* API for working with unified selection.
|
|
6
|
-
*/
|
|
7
1
|
export * from "./unified-selection/Selectable";
|
|
8
|
-
export
|
|
2
|
+
export { SelectionStorage, createStorage } from "./unified-selection/SelectionStorage";
|
|
3
|
+
export { createHiliteSetProvider, HiliteSet, HiliteSetProvider } from "./unified-selection/HiliteSetProvider";
|
|
4
|
+
export { createCachingHiliteSetProvider, CachingHiliteSetProvider } from "./unified-selection/CachingHiliteSetProvider";
|
|
5
|
+
export { computeSelection } from "./unified-selection/SelectionScope";
|
|
6
|
+
export { enableUnifiedSelectionSyncWithIModel } from "./unified-selection/EnableUnifiedSelectionSyncWithIModel";
|
|
9
7
|
export { StorageSelectionChangeType, StorageSelectionChangeEventArgs, StorageSelectionChangesListener, SelectionChangeEvent, } from "./unified-selection/SelectionChangeEvent";
|
|
10
8
|
//# 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,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC9G,OAAO,EAAE,8BAA8B,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AACxH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,oCAAoC,EAAE,MAAM,0DAA0D,CAAC;AAChH,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,EAC/B,+BAA+B,EAC/B,oBAAoB,GACrB,MAAM,0CAA0C,CAAC"}
|
|
@@ -18,12 +18,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
18
18
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
19
|
};
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
|
|
22
|
-
* @module UnifiedSelection
|
|
23
|
-
*
|
|
24
|
-
* @docs-group-description UnifiedSelection
|
|
25
|
-
* API for working with unified selection.
|
|
26
|
-
*/
|
|
21
|
+
exports.enableUnifiedSelectionSyncWithIModel = exports.computeSelection = exports.createCachingHiliteSetProvider = exports.createHiliteSetProvider = exports.createStorage = void 0;
|
|
27
22
|
__exportStar(require("./unified-selection/Selectable"), exports);
|
|
28
|
-
|
|
23
|
+
var SelectionStorage_1 = require("./unified-selection/SelectionStorage");
|
|
24
|
+
Object.defineProperty(exports, "createStorage", { enumerable: true, get: function () { return SelectionStorage_1.createStorage; } });
|
|
25
|
+
var HiliteSetProvider_1 = require("./unified-selection/HiliteSetProvider");
|
|
26
|
+
Object.defineProperty(exports, "createHiliteSetProvider", { enumerable: true, get: function () { return HiliteSetProvider_1.createHiliteSetProvider; } });
|
|
27
|
+
var CachingHiliteSetProvider_1 = require("./unified-selection/CachingHiliteSetProvider");
|
|
28
|
+
Object.defineProperty(exports, "createCachingHiliteSetProvider", { enumerable: true, get: function () { return CachingHiliteSetProvider_1.createCachingHiliteSetProvider; } });
|
|
29
|
+
var SelectionScope_1 = require("./unified-selection/SelectionScope");
|
|
30
|
+
Object.defineProperty(exports, "computeSelection", { enumerable: true, get: function () { return SelectionScope_1.computeSelection; } });
|
|
31
|
+
var EnableUnifiedSelectionSyncWithIModel_1 = require("./unified-selection/EnableUnifiedSelectionSyncWithIModel");
|
|
32
|
+
Object.defineProperty(exports, "enableUnifiedSelectionSyncWithIModel", { enumerable: true, get: function () { return EnableUnifiedSelectionSyncWithIModel_1.enableUnifiedSelectionSyncWithIModel; } });
|
|
29
33
|
//# sourceMappingURL=unified-selection.js.map
|
|
@@ -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;;;;;;;;;;;;;;;;;AAEhG,iEAA+C;AAC/C,yEAAuF;AAA5D,iHAAA,aAAa,OAAA;AACxC,2EAA8G;AAArG,4HAAA,uBAAuB,OAAA;AAChC,yFAAwH;AAA/G,0IAAA,8BAA8B,OAAA;AACvC,qEAAsE;AAA7D,kHAAA,gBAAgB,OAAA;AACzB,iHAAgH;AAAvG,4JAAA,oCAAoC,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 * from \"./unified-selection/Selectable\";\nexport { SelectionStorage, createStorage } from \"./unified-selection/SelectionStorage\";\nexport { createHiliteSetProvider, HiliteSet, HiliteSetProvider } from \"./unified-selection/HiliteSetProvider\";\nexport { createCachingHiliteSetProvider, CachingHiliteSetProvider } from \"./unified-selection/CachingHiliteSetProvider\";\nexport { computeSelection } from \"./unified-selection/SelectionScope\";\nexport { enableUnifiedSelectionSyncWithIModel } from \"./unified-selection/EnableUnifiedSelectionSyncWithIModel\";\nexport {\n StorageSelectionChangeType,\n StorageSelectionChangeEventArgs,\n StorageSelectionChangesListener,\n SelectionChangeEvent,\n} from \"./unified-selection/SelectionChangeEvent\";\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ECSchemaProvider, ECSqlQueryExecutor } from "@itwin/presentation-shared";
|
|
2
|
+
import { HiliteSet } from "./HiliteSetProvider";
|
|
3
|
+
import { SelectionStorage } from "./SelectionStorage";
|
|
4
|
+
/**
|
|
5
|
+
* Props for creating a `CachingHiliteSetProvider` instance.
|
|
6
|
+
* @internal Not exported through barrel, but used in public API as an argument. May be supplemented with optional attributes any time.
|
|
7
|
+
*/
|
|
8
|
+
export interface CachingHiliteSetProviderProps {
|
|
9
|
+
selectionStorage: SelectionStorage;
|
|
10
|
+
imodelProvider: (imodelKey: string) => ECSchemaProvider & ECSqlQueryExecutor;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Defines return value of `createCachingHiliteSetProvider`.
|
|
14
|
+
*
|
|
15
|
+
* @beta Used in public API as a return value. Not expected to be created / extended by package
|
|
16
|
+
* consumers, may be supplemented with required attributes any time.
|
|
17
|
+
*/
|
|
18
|
+
export interface CachingHiliteSetProvider {
|
|
19
|
+
/** Get the current hilite set iterator for the specified imodel */
|
|
20
|
+
getHiliteSet(props: {
|
|
21
|
+
/** iModel to get hilite set for */
|
|
22
|
+
imodelKey: string;
|
|
23
|
+
}): AsyncIterableIterator<HiliteSet>;
|
|
24
|
+
/** Disposes the cache. */
|
|
25
|
+
dispose(): void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates a hilite set provider that caches hilite set for current selection for given iModel so any subsequent
|
|
29
|
+
* hilite set requests for the same iModel don't cost until selection in given selection storage changes.
|
|
30
|
+
* @beta
|
|
31
|
+
*/
|
|
32
|
+
export declare function createCachingHiliteSetProvider(props: CachingHiliteSetProviderProps): CachingHiliteSetProvider;
|
|
33
|
+
//# sourceMappingURL=CachingHiliteSetProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CachingHiliteSetProvider.d.ts","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,EAA2B,SAAS,EAAqB,MAAM,qBAAqB,CAAC;AAE5F,OAAO,EAAuC,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3F;;;GAGG;AACH,MAAM,WAAW,6BAA6B;IAC5C,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,cAAc,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,gBAAgB,GAAG,kBAAkB,CAAC;CAC9E;AAED;;;;;GAKG;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,0BAA0B;IAC1B,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,6BAA6B,GAAG,wBAAwB,CAE7G"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { from, shareReplay } from "rxjs";
|
|
6
|
+
import { eachValueFrom } from "rxjs-for-await";
|
|
7
|
+
import { createHiliteSetProvider } from "./HiliteSetProvider";
|
|
8
|
+
import { IMODEL_CLOSE_SELECTION_CLEAR_SOURCE } from "./SelectionStorage";
|
|
9
|
+
/**
|
|
10
|
+
* Creates a hilite set provider that caches hilite set for current selection for given iModel so any subsequent
|
|
11
|
+
* hilite set requests for the same iModel don't cost until selection in given selection storage changes.
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export function createCachingHiliteSetProvider(props) {
|
|
15
|
+
return new CachingHiliteSetProviderImpl(props);
|
|
16
|
+
}
|
|
17
|
+
class CachingHiliteSetProviderImpl {
|
|
18
|
+
_selectionStorage;
|
|
19
|
+
_hiliteSetProviders = new Map();
|
|
20
|
+
_cache = new Map();
|
|
21
|
+
_removeListener;
|
|
22
|
+
_imodelProvider;
|
|
23
|
+
constructor(props) {
|
|
24
|
+
this._selectionStorage = props.selectionStorage;
|
|
25
|
+
this._imodelProvider = props.imodelProvider;
|
|
26
|
+
this._removeListener = this._selectionStorage.selectionChangeEvent.addListener((args) => {
|
|
27
|
+
this._cache.delete(args.imodelKey);
|
|
28
|
+
if (args.changeType === "clear" && args.source === IMODEL_CLOSE_SELECTION_CLEAR_SOURCE) {
|
|
29
|
+
this._hiliteSetProviders.delete(args.imodelKey);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
getHiliteSet({ imodelKey }) {
|
|
34
|
+
const imodelAccess = this._imodelProvider(imodelKey);
|
|
35
|
+
const provider = this.getHiliteSetProvider(imodelKey, imodelAccess);
|
|
36
|
+
let hiliteSet = this._cache.get(imodelKey);
|
|
37
|
+
if (!hiliteSet) {
|
|
38
|
+
const selectables = this._selectionStorage.getSelection({ imodelKey });
|
|
39
|
+
hiliteSet = from(provider.getHiliteSet({ selectables })).pipe(shareReplay({ refCount: true }));
|
|
40
|
+
this._cache.set(imodelKey, hiliteSet);
|
|
41
|
+
}
|
|
42
|
+
return eachValueFrom(hiliteSet);
|
|
43
|
+
}
|
|
44
|
+
dispose() {
|
|
45
|
+
this._removeListener();
|
|
46
|
+
this._hiliteSetProviders = new Map();
|
|
47
|
+
this._cache = new Map();
|
|
48
|
+
}
|
|
49
|
+
getHiliteSetProvider(imodelKey, imodelAccess) {
|
|
50
|
+
let provider = this._hiliteSetProviders.get(imodelKey);
|
|
51
|
+
if (!provider) {
|
|
52
|
+
provider = createHiliteSetProvider({ imodelAccess });
|
|
53
|
+
this._hiliteSetProviders.set(imodelKey, provider);
|
|
54
|
+
}
|
|
55
|
+
return provider;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=CachingHiliteSetProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CachingHiliteSetProvider.js","sourceRoot":"","sources":["../../../src/unified-selection/CachingHiliteSetProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,IAAI,EAAc,WAAW,EAAE,MAAM,MAAM,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,uBAAuB,EAAgC,MAAM,qBAAqB,CAAC;AAE5F,OAAO,EAAE,mCAAmC,EAAoB,MAAM,oBAAoB,CAAC;AA4B3F;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAAC,KAAoC;IACjF,OAAO,IAAI,4BAA4B,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,4BAA4B;IACxB,iBAAiB,CAAmB;IACpC,mBAAmB,GAAG,IAAI,GAAG,EAA6B,CAAC;IAC3D,MAAM,GAAG,IAAI,GAAG,EAAiC,CAAC;IAClD,eAAe,C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,CAAC;IAClC,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,mBAAmB,GAAG,IAAI,GAAG,EAAE,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,IAAI,GAAG,EAAE,CAAC;IAC1B,CAAC;IAEO,oBAAoB,CAAC,SAAiB,EAAE,YAAmD;QACjG,IAAI,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAAQ,GAAG,uBAAuB,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;YACrD,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,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 { from, Observable, shareReplay } from \"rxjs\";\nimport { eachValueFrom } from \"rxjs-for-await\";\nimport { ECSchemaProvider, ECSqlQueryExecutor } from \"@itwin/presentation-shared\";\nimport { createHiliteSetProvider, HiliteSet, HiliteSetProvider } from \"./HiliteSetProvider\";\nimport { StorageSelectionChangeEventArgs } from \"./SelectionChangeEvent\";\nimport { IMODEL_CLOSE_SELECTION_CLEAR_SOURCE, SelectionStorage } from \"./SelectionStorage\";\n\n/**\n * Props for creating a `CachingHiliteSetProvider` instance.\n * @internal Not exported through barrel, but used in public API as an argument. May be supplemented with optional attributes any time.\n */\nexport interface CachingHiliteSetProviderProps {\n selectionStorage: SelectionStorage;\n imodelProvider: (imodelKey: string) => ECSchemaProvider & ECSqlQueryExecutor;\n}\n\n/**\n * Defines return value of `createCachingHiliteSetProvider`.\n *\n * @beta 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 */\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 /** Disposes the cache. */\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 * @beta\n */\nexport function createCachingHiliteSetProvider(props: CachingHiliteSetProviderProps): CachingHiliteSetProvider {\n return new CachingHiliteSetProviderImpl(props);\n}\n\nclass CachingHiliteSetProviderImpl implements CachingHiliteSetProvider {\n private _selectionStorage: SelectionStorage;\n private _hiliteSetProviders = new Map<string, HiliteSetProvider>();\n private _cache = new Map<string, Observable<HiliteSet>>();\n private _removeListener: () => void;\n private _imodelProvider: (imodelKey: string) => ECSchemaProvider & ECSqlQueryExecutor;\n\n constructor(props: CachingHiliteSetProviderProps) {\n this._selectionStorage = props.selectionStorage;\n this._imodelProvider = props.imodelProvider;\n this._removeListener = this._selectionStorage.selectionChangeEvent.addListener((args: StorageSelectionChangeEventArgs) => {\n this._cache.delete(args.imodelKey);\n if (args.changeType === \"clear\" && args.source === IMODEL_CLOSE_SELECTION_CLEAR_SOURCE) {\n this._hiliteSetProviders.delete(args.imodelKey);\n }\n });\n }\n\n public getHiliteSet({ imodelKey }: { imodelKey: string }): AsyncIterableIterator<HiliteSet> {\n const imodelAccess = this._imodelProvider(imodelKey);\n const provider = this.getHiliteSetProvider(imodelKey, imodelAccess);\n let hiliteSet = this._cache.get(imodelKey);\n\n if (!hiliteSet) {\n const selectables = this._selectionStorage.getSelection({ imodelKey });\n hiliteSet = from(provider.getHiliteSet({ selectables })).pipe(shareReplay({ refCount: true }));\n this._cache.set(imodelKey, hiliteSet);\n }\n\n return eachValueFrom(hiliteSet);\n }\n\n public dispose(): void {\n this._removeListener();\n this._hiliteSetProviders = new Map();\n this._cache = new Map();\n }\n\n private getHiliteSetProvider(imodelKey: string, imodelAccess: ECSchemaProvider & ECSqlQueryExecutor) {\n let provider = this._hiliteSetProviders.get(imodelKey);\n if (!provider) {\n provider = createHiliteSetProvider({ imodelAccess });\n this._hiliteSetProviders.set(imodelKey, provider);\n }\n return provider;\n }\n}\n"]}
|