@itwin/presentation-frontend 4.0.0-dev.21 → 4.0.0-dev.23
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/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
- package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +47 -47
- package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/Diagnostics.d.ts +14 -14
- package/lib/cjs/presentation-frontend/Diagnostics.js +61 -61
- package/lib/cjs/presentation-frontend/Diagnostics.js.map +1 -1
- package/lib/cjs/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
- package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js +20 -20
- package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +41 -41
- package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts +10 -10
- package/lib/cjs/presentation-frontend/LocalizationHelper.js +31 -31
- package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/Presentation.d.ts +73 -73
- package/lib/cjs/presentation-frontend/Presentation.js +160 -160
- package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
- package/lib/cjs/presentation-frontend/PresentationManager.d.ts +186 -186
- package/lib/cjs/presentation-frontend/PresentationManager.js +436 -436
- package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetManager.d.ts +63 -63
- package/lib/cjs/presentation-frontend/RulesetManager.js +85 -85
- package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +195 -195
- package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/StateTracker.d.ts +38 -38
- package/lib/cjs/presentation-frontend/StateTracker.js +129 -129
- package/lib/cjs/presentation-frontend/StateTracker.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +525 -525
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +293 -293
- package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/HiliteRules.json +172 -172
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +97 -97
- package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +9 -9
- package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +33 -33
- package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +108 -108
- package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts +17 -17
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +40 -40
- package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +139 -139
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js +414 -414
- package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +91 -91
- package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/cjs/presentation-frontend.d.ts +34 -34
- package/lib/cjs/presentation-frontend.js +50 -50
- package/lib/cjs/presentation-frontend.js.map +1 -1
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +43 -43
- package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/Diagnostics.d.ts +14 -14
- package/lib/esm/presentation-frontend/Diagnostics.js +56 -56
- package/lib/esm/presentation-frontend/Diagnostics.js.map +1 -1
- package/lib/esm/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
- package/lib/esm/presentation-frontend/FrontendLoggerCategory.js +17 -17
- package/lib/esm/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
- package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js +37 -37
- package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/LocalizationHelper.d.ts +10 -10
- package/lib/esm/presentation-frontend/LocalizationHelper.js +27 -27
- package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/Presentation.d.ts +73 -73
- package/lib/esm/presentation-frontend/Presentation.js +156 -156
- package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
- package/lib/esm/presentation-frontend/PresentationManager.d.ts +186 -186
- package/lib/esm/presentation-frontend/PresentationManager.js +431 -431
- package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetManager.d.ts +63 -63
- package/lib/esm/presentation-frontend/RulesetManager.js +81 -81
- package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
- package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
- package/lib/esm/presentation-frontend/RulesetVariablesManager.js +191 -191
- package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/StateTracker.d.ts +38 -38
- package/lib/esm/presentation-frontend/StateTracker.js +125 -125
- package/lib/esm/presentation-frontend/StateTracker.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +519 -519
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +285 -285
- package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/HiliteRules.json +172 -172
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +93 -93
- package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +8 -8
- package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +29 -29
- package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js +104 -104
- package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts +17 -17
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js +36 -36
- package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +139 -139
- package/lib/esm/presentation-frontend/selection/SelectionManager.js +409 -409
- package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +85 -85
- package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
- package/lib/esm/presentation-frontend.d.ts +34 -34
- package/lib/esm/presentation-frontend.js +38 -38
- package/lib/esm/presentation-frontend.js.map +1 -1
- package/package.json +14 -14
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module UnifiedSelection
|
|
3
|
-
*/
|
|
4
|
-
import { IDisposable } from "@itwin/core-bentley";
|
|
5
|
-
import { IModelConnection } from "@itwin/core-frontend";
|
|
6
|
-
import { Keys, KeySet } from "@itwin/presentation-common";
|
|
7
|
-
import { ISelectionProvider } from "./ISelectionProvider";
|
|
8
|
-
import { SelectionChangeEventArgs, SelectionChangesListener } from "./SelectionChangeEvent";
|
|
9
|
-
import { SelectionManager } from "./SelectionManager";
|
|
10
|
-
/**
|
|
11
|
-
* Properties for creating a `SelectionHandler` instance.
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export interface SelectionHandlerProps {
|
|
15
|
-
/** SelectionManager used to store overall selection. */
|
|
16
|
-
manager: SelectionManager;
|
|
17
|
-
/** iModel connection the selection changes will be associated with. */
|
|
18
|
-
imodel: IModelConnection;
|
|
19
|
-
/**
|
|
20
|
-
* Name of the selection handler. This is an identifier of what caused the
|
|
21
|
-
* selection to change, set as `SelectionChangeEventArgs.source` when firing
|
|
22
|
-
* selection change events. `SelectionHandler.shouldHandle` uses `name` to filter
|
|
23
|
-
* events that it doesn't need to handle.
|
|
24
|
-
*/
|
|
25
|
-
name: string;
|
|
26
|
-
/**
|
|
27
|
-
* ID of presentation ruleset used by the component using this handler. The ID is set as
|
|
28
|
-
* `SelectionChangeEventArgs.rulesetId` when making selection changes and event
|
|
29
|
-
* listeners can use or ignore this information.
|
|
30
|
-
*/
|
|
31
|
-
rulesetId?: string;
|
|
32
|
-
/** Callback function called when selection changes. */
|
|
33
|
-
onSelect?: SelectionChangesListener;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* A class that handles selection changes and helps to change
|
|
37
|
-
* internal the selection state.
|
|
38
|
-
*
|
|
39
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
export declare class SelectionHandler implements IDisposable {
|
|
42
|
-
private _inSelect;
|
|
43
|
-
private _disposables;
|
|
44
|
-
/** Selection manager used by this handler to manage selection */
|
|
45
|
-
readonly manager: SelectionManager;
|
|
46
|
-
/** Name that's used as `SelectionChangeEventArgs.source` when making selection changes */
|
|
47
|
-
name: string;
|
|
48
|
-
/** iModel whose selection is being handled */
|
|
49
|
-
imodel: IModelConnection;
|
|
50
|
-
/**
|
|
51
|
-
* Id of a ruleset selection changes will be associated with.
|
|
52
|
-
* @see `SelectionHandlerProps.rulesetId`
|
|
53
|
-
*/
|
|
54
|
-
rulesetId?: string;
|
|
55
|
-
/** Callback function called when selection changes */
|
|
56
|
-
onSelect?: SelectionChangesListener;
|
|
57
|
-
/**
|
|
58
|
-
* Constructor.
|
|
59
|
-
*/
|
|
60
|
-
constructor(props: SelectionHandlerProps);
|
|
61
|
-
/**
|
|
62
|
-
* Destructor. Must be called before disposing this object to make sure it cleans
|
|
63
|
-
* up correctly.
|
|
64
|
-
*/
|
|
65
|
-
dispose(): void;
|
|
66
|
-
/**
|
|
67
|
-
* Called when the selection changes. Handles this callback by first checking whether
|
|
68
|
-
* the event should be handled at all (using the `shouldHandle` method) and then calling `onSelect`
|
|
69
|
-
*/
|
|
70
|
-
protected onSelectionChanged: (evt: SelectionChangeEventArgs, provider: ISelectionProvider) => void;
|
|
71
|
-
/** Called to check whether the event should be handled by this handler */
|
|
72
|
-
protected shouldHandle(evt: SelectionChangeEventArgs): boolean;
|
|
73
|
-
/** Get selection levels for the imodel managed by this handler */
|
|
74
|
-
getSelectionLevels(): number[];
|
|
75
|
-
/**
|
|
76
|
-
* Get selection for the imodel managed by this handler.
|
|
77
|
-
* @param level Level of the selection to get. Defaults to 0.
|
|
78
|
-
*/
|
|
79
|
-
getSelection(level?: number): Readonly<KeySet>;
|
|
80
|
-
/**
|
|
81
|
-
* Add to selection.
|
|
82
|
-
* @param keys The keys to add to selection.
|
|
83
|
-
* @param level Level of the selection.
|
|
84
|
-
*/
|
|
85
|
-
addToSelection(keys: Keys, level?: number): void;
|
|
86
|
-
/**
|
|
87
|
-
* Remove from selection.
|
|
88
|
-
* @param keys The keys to remove from selection.
|
|
89
|
-
* @param level Level of the selection.
|
|
90
|
-
*/
|
|
91
|
-
removeFromSelection(keys: Keys, level?: number): void;
|
|
92
|
-
/**
|
|
93
|
-
* Change selection.
|
|
94
|
-
* @param keys The keys indicating the new selection.
|
|
95
|
-
* @param level Level of the selection.
|
|
96
|
-
*/
|
|
97
|
-
replaceSelection(keys: Keys, level?: number): void;
|
|
98
|
-
/**
|
|
99
|
-
* Clear selection.
|
|
100
|
-
* @param level Level of the selection.
|
|
101
|
-
*/
|
|
102
|
-
clearSelection(level?: number): void;
|
|
103
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module UnifiedSelection
|
|
3
|
+
*/
|
|
4
|
+
import { IDisposable } from "@itwin/core-bentley";
|
|
5
|
+
import { IModelConnection } from "@itwin/core-frontend";
|
|
6
|
+
import { Keys, KeySet } from "@itwin/presentation-common";
|
|
7
|
+
import { ISelectionProvider } from "./ISelectionProvider";
|
|
8
|
+
import { SelectionChangeEventArgs, SelectionChangesListener } from "./SelectionChangeEvent";
|
|
9
|
+
import { SelectionManager } from "./SelectionManager";
|
|
10
|
+
/**
|
|
11
|
+
* Properties for creating a `SelectionHandler` instance.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export interface SelectionHandlerProps {
|
|
15
|
+
/** SelectionManager used to store overall selection. */
|
|
16
|
+
manager: SelectionManager;
|
|
17
|
+
/** iModel connection the selection changes will be associated with. */
|
|
18
|
+
imodel: IModelConnection;
|
|
19
|
+
/**
|
|
20
|
+
* Name of the selection handler. This is an identifier of what caused the
|
|
21
|
+
* selection to change, set as `SelectionChangeEventArgs.source` when firing
|
|
22
|
+
* selection change events. `SelectionHandler.shouldHandle` uses `name` to filter
|
|
23
|
+
* events that it doesn't need to handle.
|
|
24
|
+
*/
|
|
25
|
+
name: string;
|
|
26
|
+
/**
|
|
27
|
+
* ID of presentation ruleset used by the component using this handler. The ID is set as
|
|
28
|
+
* `SelectionChangeEventArgs.rulesetId` when making selection changes and event
|
|
29
|
+
* listeners can use or ignore this information.
|
|
30
|
+
*/
|
|
31
|
+
rulesetId?: string;
|
|
32
|
+
/** Callback function called when selection changes. */
|
|
33
|
+
onSelect?: SelectionChangesListener;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A class that handles selection changes and helps to change
|
|
37
|
+
* internal the selection state.
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
export declare class SelectionHandler implements IDisposable {
|
|
42
|
+
private _inSelect;
|
|
43
|
+
private _disposables;
|
|
44
|
+
/** Selection manager used by this handler to manage selection */
|
|
45
|
+
readonly manager: SelectionManager;
|
|
46
|
+
/** Name that's used as `SelectionChangeEventArgs.source` when making selection changes */
|
|
47
|
+
name: string;
|
|
48
|
+
/** iModel whose selection is being handled */
|
|
49
|
+
imodel: IModelConnection;
|
|
50
|
+
/**
|
|
51
|
+
* Id of a ruleset selection changes will be associated with.
|
|
52
|
+
* @see `SelectionHandlerProps.rulesetId`
|
|
53
|
+
*/
|
|
54
|
+
rulesetId?: string;
|
|
55
|
+
/** Callback function called when selection changes */
|
|
56
|
+
onSelect?: SelectionChangesListener;
|
|
57
|
+
/**
|
|
58
|
+
* Constructor.
|
|
59
|
+
*/
|
|
60
|
+
constructor(props: SelectionHandlerProps);
|
|
61
|
+
/**
|
|
62
|
+
* Destructor. Must be called before disposing this object to make sure it cleans
|
|
63
|
+
* up correctly.
|
|
64
|
+
*/
|
|
65
|
+
dispose(): void;
|
|
66
|
+
/**
|
|
67
|
+
* Called when the selection changes. Handles this callback by first checking whether
|
|
68
|
+
* the event should be handled at all (using the `shouldHandle` method) and then calling `onSelect`
|
|
69
|
+
*/
|
|
70
|
+
protected onSelectionChanged: (evt: SelectionChangeEventArgs, provider: ISelectionProvider) => void;
|
|
71
|
+
/** Called to check whether the event should be handled by this handler */
|
|
72
|
+
protected shouldHandle(evt: SelectionChangeEventArgs): boolean;
|
|
73
|
+
/** Get selection levels for the imodel managed by this handler */
|
|
74
|
+
getSelectionLevels(): number[];
|
|
75
|
+
/**
|
|
76
|
+
* Get selection for the imodel managed by this handler.
|
|
77
|
+
* @param level Level of the selection to get. Defaults to 0.
|
|
78
|
+
*/
|
|
79
|
+
getSelection(level?: number): Readonly<KeySet>;
|
|
80
|
+
/**
|
|
81
|
+
* Add to selection.
|
|
82
|
+
* @param keys The keys to add to selection.
|
|
83
|
+
* @param level Level of the selection.
|
|
84
|
+
*/
|
|
85
|
+
addToSelection(keys: Keys, level?: number): void;
|
|
86
|
+
/**
|
|
87
|
+
* Remove from selection.
|
|
88
|
+
* @param keys The keys to remove from selection.
|
|
89
|
+
* @param level Level of the selection.
|
|
90
|
+
*/
|
|
91
|
+
removeFromSelection(keys: Keys, level?: number): void;
|
|
92
|
+
/**
|
|
93
|
+
* Change selection.
|
|
94
|
+
* @param keys The keys indicating the new selection.
|
|
95
|
+
* @param level Level of the selection.
|
|
96
|
+
*/
|
|
97
|
+
replaceSelection(keys: Keys, level?: number): void;
|
|
98
|
+
/**
|
|
99
|
+
* Clear selection.
|
|
100
|
+
* @param level Level of the selection.
|
|
101
|
+
*/
|
|
102
|
+
clearSelection(level?: number): void;
|
|
103
|
+
}
|
|
104
104
|
//# sourceMappingURL=SelectionHandler.d.ts.map
|
|
@@ -1,109 +1,109 @@
|
|
|
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
|
-
/** @packageDocumentation
|
|
7
|
-
* @module UnifiedSelection
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.SelectionHandler = void 0;
|
|
11
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
-
/**
|
|
13
|
-
* A class that handles selection changes and helps to change
|
|
14
|
-
* internal the selection state.
|
|
15
|
-
*
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
class SelectionHandler {
|
|
19
|
-
/**
|
|
20
|
-
* Constructor.
|
|
21
|
-
*/
|
|
22
|
-
constructor(props) {
|
|
23
|
-
/**
|
|
24
|
-
* Called when the selection changes. Handles this callback by first checking whether
|
|
25
|
-
* the event should be handled at all (using the `shouldHandle` method) and then calling `onSelect`
|
|
26
|
-
*/
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
28
|
-
this.onSelectionChanged = (evt, provider) => {
|
|
29
|
-
if (!this.onSelect || !this.shouldHandle(evt))
|
|
30
|
-
return;
|
|
31
|
-
this._inSelect = true;
|
|
32
|
-
this.onSelect(evt, provider);
|
|
33
|
-
this._inSelect = false;
|
|
34
|
-
};
|
|
35
|
-
this._inSelect = false;
|
|
36
|
-
this.manager = props.manager;
|
|
37
|
-
this._disposables = new core_bentley_1.DisposableList();
|
|
38
|
-
this.name = props.name;
|
|
39
|
-
this.rulesetId = props.rulesetId;
|
|
40
|
-
this.imodel = props.imodel;
|
|
41
|
-
this.onSelect = props.onSelect;
|
|
42
|
-
this._disposables.add(this.manager.selectionChange.addListener(this.onSelectionChanged));
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Destructor. Must be called before disposing this object to make sure it cleans
|
|
46
|
-
* up correctly.
|
|
47
|
-
*/
|
|
48
|
-
dispose() {
|
|
49
|
-
this._disposables.dispose();
|
|
50
|
-
}
|
|
51
|
-
/** Called to check whether the event should be handled by this handler */
|
|
52
|
-
shouldHandle(evt) {
|
|
53
|
-
if (this.name === evt.source)
|
|
54
|
-
return false;
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
/** Get selection levels for the imodel managed by this handler */
|
|
58
|
-
getSelectionLevels() {
|
|
59
|
-
return this.manager.getSelectionLevels(this.imodel);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Get selection for the imodel managed by this handler.
|
|
63
|
-
* @param level Level of the selection to get. Defaults to 0.
|
|
64
|
-
*/
|
|
65
|
-
getSelection(level) {
|
|
66
|
-
return this.manager.getSelection(this.imodel, level);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Add to selection.
|
|
70
|
-
* @param keys The keys to add to selection.
|
|
71
|
-
* @param level Level of the selection.
|
|
72
|
-
*/
|
|
73
|
-
addToSelection(keys, level = 0) {
|
|
74
|
-
if (this._inSelect)
|
|
75
|
-
return;
|
|
76
|
-
return this.manager.addToSelection(this.name, this.imodel, keys, level, this.rulesetId);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Remove from selection.
|
|
80
|
-
* @param keys The keys to remove from selection.
|
|
81
|
-
* @param level Level of the selection.
|
|
82
|
-
*/
|
|
83
|
-
removeFromSelection(keys, level = 0) {
|
|
84
|
-
if (this._inSelect)
|
|
85
|
-
return;
|
|
86
|
-
return this.manager.removeFromSelection(this.name, this.imodel, keys, level, this.rulesetId);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Change selection.
|
|
90
|
-
* @param keys The keys indicating the new selection.
|
|
91
|
-
* @param level Level of the selection.
|
|
92
|
-
*/
|
|
93
|
-
replaceSelection(keys, level = 0) {
|
|
94
|
-
if (this._inSelect)
|
|
95
|
-
return;
|
|
96
|
-
return this.manager.replaceSelection(this.name, this.imodel, keys, level, this.rulesetId);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Clear selection.
|
|
100
|
-
* @param level Level of the selection.
|
|
101
|
-
*/
|
|
102
|
-
clearSelection(level = 0) {
|
|
103
|
-
if (this._inSelect)
|
|
104
|
-
return;
|
|
105
|
-
return this.manager.clearSelection(this.name, this.imodel, level, this.rulesetId);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
exports.SelectionHandler = SelectionHandler;
|
|
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
|
+
/** @packageDocumentation
|
|
7
|
+
* @module UnifiedSelection
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SelectionHandler = void 0;
|
|
11
|
+
const core_bentley_1 = require("@itwin/core-bentley");
|
|
12
|
+
/**
|
|
13
|
+
* A class that handles selection changes and helps to change
|
|
14
|
+
* internal the selection state.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
class SelectionHandler {
|
|
19
|
+
/**
|
|
20
|
+
* Constructor.
|
|
21
|
+
*/
|
|
22
|
+
constructor(props) {
|
|
23
|
+
/**
|
|
24
|
+
* Called when the selection changes. Handles this callback by first checking whether
|
|
25
|
+
* the event should be handled at all (using the `shouldHandle` method) and then calling `onSelect`
|
|
26
|
+
*/
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
28
|
+
this.onSelectionChanged = (evt, provider) => {
|
|
29
|
+
if (!this.onSelect || !this.shouldHandle(evt))
|
|
30
|
+
return;
|
|
31
|
+
this._inSelect = true;
|
|
32
|
+
this.onSelect(evt, provider);
|
|
33
|
+
this._inSelect = false;
|
|
34
|
+
};
|
|
35
|
+
this._inSelect = false;
|
|
36
|
+
this.manager = props.manager;
|
|
37
|
+
this._disposables = new core_bentley_1.DisposableList();
|
|
38
|
+
this.name = props.name;
|
|
39
|
+
this.rulesetId = props.rulesetId;
|
|
40
|
+
this.imodel = props.imodel;
|
|
41
|
+
this.onSelect = props.onSelect;
|
|
42
|
+
this._disposables.add(this.manager.selectionChange.addListener(this.onSelectionChanged));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Destructor. Must be called before disposing this object to make sure it cleans
|
|
46
|
+
* up correctly.
|
|
47
|
+
*/
|
|
48
|
+
dispose() {
|
|
49
|
+
this._disposables.dispose();
|
|
50
|
+
}
|
|
51
|
+
/** Called to check whether the event should be handled by this handler */
|
|
52
|
+
shouldHandle(evt) {
|
|
53
|
+
if (this.name === evt.source)
|
|
54
|
+
return false;
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
/** Get selection levels for the imodel managed by this handler */
|
|
58
|
+
getSelectionLevels() {
|
|
59
|
+
return this.manager.getSelectionLevels(this.imodel);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get selection for the imodel managed by this handler.
|
|
63
|
+
* @param level Level of the selection to get. Defaults to 0.
|
|
64
|
+
*/
|
|
65
|
+
getSelection(level) {
|
|
66
|
+
return this.manager.getSelection(this.imodel, level);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Add to selection.
|
|
70
|
+
* @param keys The keys to add to selection.
|
|
71
|
+
* @param level Level of the selection.
|
|
72
|
+
*/
|
|
73
|
+
addToSelection(keys, level = 0) {
|
|
74
|
+
if (this._inSelect)
|
|
75
|
+
return;
|
|
76
|
+
return this.manager.addToSelection(this.name, this.imodel, keys, level, this.rulesetId);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Remove from selection.
|
|
80
|
+
* @param keys The keys to remove from selection.
|
|
81
|
+
* @param level Level of the selection.
|
|
82
|
+
*/
|
|
83
|
+
removeFromSelection(keys, level = 0) {
|
|
84
|
+
if (this._inSelect)
|
|
85
|
+
return;
|
|
86
|
+
return this.manager.removeFromSelection(this.name, this.imodel, keys, level, this.rulesetId);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Change selection.
|
|
90
|
+
* @param keys The keys indicating the new selection.
|
|
91
|
+
* @param level Level of the selection.
|
|
92
|
+
*/
|
|
93
|
+
replaceSelection(keys, level = 0) {
|
|
94
|
+
if (this._inSelect)
|
|
95
|
+
return;
|
|
96
|
+
return this.manager.replaceSelection(this.name, this.imodel, keys, level, this.rulesetId);
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Clear selection.
|
|
100
|
+
* @param level Level of the selection.
|
|
101
|
+
*/
|
|
102
|
+
clearSelection(level = 0) {
|
|
103
|
+
if (this._inSelect)
|
|
104
|
+
return;
|
|
105
|
+
return this.manager.clearSelection(this.name, this.imodel, level, this.rulesetId);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.SelectionHandler = SelectionHandler;
|
|
109
109
|
//# sourceMappingURL=SelectionHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionHandler.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAkE;AAiClE;;;;;GAKG;AACH,MAAa,gBAAgB;IAkB3B;;OAEG;IACH,YAAY,KAA4B;QAmBxC;;;WAGG;QACH,gEAAgE;Q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KAAc;QAChC,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACvD,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,IAAU,EAAE,QAAgB,CAAC;QACjD,IAAI,IAAI,CAAC,SAAS;YAChB,OAAO;QAET,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1F,CAAC;IAED;;;;OAIG;IACI,mBAAmB,CAAC,IAAU,EAAE,QAAgB,CAAC;QACtD,IAAI,IAAI,CAAC,SAAS;YAChB,OAAO;QAET,OAAO,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/F,CAAC;IAED;;;;OAIG;IACI,gBAAgB,CAAC,IAAU,EAAE,QAAgB,CAAC;QACnD,IAAI,IAAI,CAAC,SAAS;YAChB,OAAO;QAET,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5F,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,QAAgB,CAAC;QACrC,IAAI,IAAI,CAAC,SAAS;YAChB,OAAO;QAET,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACpF,CAAC;CACF;AAxHD,4CAwHC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"SelectionHandler.js","sourceRo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Ac,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACpF,CAAC;CACF;AAxHD,4CAwHC","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/** @packageDocumentation\n * @module UnifiedSelection\n */\n\nimport { DisposableList, IDisposable } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { Keys, KeySet } from \"@itwin/presentation-common\";\nimport { ISelectionProvider } from \"./ISelectionProvider\";\nimport { SelectionChangeEventArgs, SelectionChangesListener } from \"./SelectionChangeEvent\";\nimport { SelectionManager } from \"./SelectionManager\";\n\n/**\n * Properties for creating a `SelectionHandler` instance.\n * @public\n */\nexport interface SelectionHandlerProps {\n /** SelectionManager used to store overall selection. */\n manager: SelectionManager;\n /** iModel connection the selection changes will be associated with. */\n imodel: IModelConnection;\n /**\n * Name of the selection handler. This is an identifier of what caused the\n * selection to change, set as `SelectionChangeEventArgs.source` when firing\n * selection change events. `SelectionHandler.shouldHandle` uses `name` to filter\n * events that it doesn't need to handle.\n */\n name: string;\n /**\n * ID of presentation ruleset used by the component using this handler. The ID is set as\n * `SelectionChangeEventArgs.rulesetId` when making selection changes and event\n * listeners can use or ignore this information.\n */\n rulesetId?: string;\n /** Callback function called when selection changes. */\n onSelect?: SelectionChangesListener;\n}\n\n/**\n * A class that handles selection changes and helps to change\n * internal the selection state.\n *\n * @public\n */\nexport class SelectionHandler implements IDisposable {\n private _inSelect: boolean;\n private _disposables: DisposableList;\n\n /** Selection manager used by this handler to manage selection */\n public readonly manager: SelectionManager;\n /** Name that's used as `SelectionChangeEventArgs.source` when making selection changes */\n public name: string;\n /** iModel whose selection is being handled */\n public imodel: IModelConnection;\n /**\n * Id of a ruleset selection changes will be associated with.\n * @see `SelectionHandlerProps.rulesetId`\n */\n public rulesetId?: string;\n /** Callback function called when selection changes */\n public onSelect?: SelectionChangesListener;\n\n /**\n * Constructor.\n */\n constructor(props: SelectionHandlerProps) {\n this._inSelect = false;\n this.manager = props.manager;\n this._disposables = new DisposableList();\n this.name = props.name;\n this.rulesetId = props.rulesetId;\n this.imodel = props.imodel;\n this.onSelect = props.onSelect;\n this._disposables.add(this.manager.selectionChange.addListener(this.onSelectionChanged));\n }\n\n /**\n * Destructor. Must be called before disposing this object to make sure it cleans\n * up correctly.\n */\n public dispose(): void {\n this._disposables.dispose();\n }\n\n /**\n * Called when the selection changes. Handles this callback by first checking whether\n * the event should be handled at all (using the `shouldHandle` method) and then calling `onSelect`\n */\n // eslint-disable-next-line @typescript-eslint/naming-convention\n protected onSelectionChanged = (evt: SelectionChangeEventArgs, provider: ISelectionProvider): void => {\n if (!this.onSelect || !this.shouldHandle(evt))\n return;\n\n this._inSelect = true;\n this.onSelect(evt, provider);\n this._inSelect = false;\n };\n\n /** Called to check whether the event should be handled by this handler */\n protected shouldHandle(evt: SelectionChangeEventArgs): boolean {\n if (this.name === evt.source)\n return false;\n return true;\n }\n\n /** Get selection levels for the imodel managed by this handler */\n public getSelectionLevels(): number[] {\n return this.manager.getSelectionLevels(this.imodel);\n }\n\n /**\n * Get selection for the imodel managed by this handler.\n * @param level Level of the selection to get. Defaults to 0.\n */\n public getSelection(level?: number): Readonly<KeySet> {\n return this.manager.getSelection(this.imodel, level);\n }\n\n /**\n * Add to selection.\n * @param keys The keys to add to selection.\n * @param level Level of the selection.\n */\n public addToSelection(keys: Keys, level: number = 0): void {\n if (this._inSelect)\n return;\n\n return this.manager.addToSelection(this.name, this.imodel, keys, level, this.rulesetId);\n }\n\n /**\n * Remove from selection.\n * @param keys The keys to remove from selection.\n * @param level Level of the selection.\n */\n public removeFromSelection(keys: Keys, level: number = 0): void {\n if (this._inSelect)\n return;\n\n return this.manager.removeFromSelection(this.name, this.imodel, keys, level, this.rulesetId);\n }\n\n /**\n * Change selection.\n * @param keys The keys indicating the new selection.\n * @param level Level of the selection.\n */\n public replaceSelection(keys: Keys, level: number = 0): void {\n if (this._inSelect)\n return;\n\n return this.manager.replaceSelection(this.name, this.imodel, keys, level, this.rulesetId);\n }\n\n /**\n * Clear selection.\n * @param level Level of the selection.\n */\n public clearSelection(level: number = 0): void {\n if (this._inSelect)\n return;\n\n return this.manager.clearSelection(this.name, this.imodel, level, this.rulesetId);\n }\n}\n"]}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module UnifiedSelection
|
|
3
|
-
*/
|
|
4
|
-
import { Key, Keys } from "@itwin/presentation-common";
|
|
5
|
-
/**
|
|
6
|
-
* Helper class for working with selection.
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
export declare class SelectionHelper {
|
|
10
|
-
private constructor();
|
|
11
|
-
/**
|
|
12
|
-
* Re-map the given keyset for selection. This means all instance node keys get converted
|
|
13
|
-
* to instance keys, because in that case we want to select instances instead of nodes. All
|
|
14
|
-
* other types of keys ar left as is.
|
|
15
|
-
*/
|
|
16
|
-
static getKeysForSelection(keys: Readonly<Keys>): Key[];
|
|
17
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module UnifiedSelection
|
|
3
|
+
*/
|
|
4
|
+
import { Key, Keys } from "@itwin/presentation-common";
|
|
5
|
+
/**
|
|
6
|
+
* Helper class for working with selection.
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare class SelectionHelper {
|
|
10
|
+
private constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Re-map the given keyset for selection. This means all instance node keys get converted
|
|
13
|
+
* to instance keys, because in that case we want to select instances instead of nodes. All
|
|
14
|
+
* other types of keys ar left as is.
|
|
15
|
+
*/
|
|
16
|
+
static getKeysForSelection(keys: Readonly<Keys>): Key[];
|
|
17
|
+
}
|
|
18
18
|
//# sourceMappingURL=SelectionHelper.d.ts.map
|
|
@@ -1,41 +1,41 @@
|
|
|
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
|
-
/** @packageDocumentation
|
|
7
|
-
* @module UnifiedSelection
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.SelectionHelper = void 0;
|
|
11
|
-
const presentation_common_1 = require("@itwin/presentation-common");
|
|
12
|
-
/**
|
|
13
|
-
* Helper class for working with selection.
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
class SelectionHelper {
|
|
17
|
-
// istanbul ignore next
|
|
18
|
-
constructor() { }
|
|
19
|
-
/**
|
|
20
|
-
* Re-map the given keyset for selection. This means all instance node keys get converted
|
|
21
|
-
* to instance keys, because in that case we want to select instances instead of nodes. All
|
|
22
|
-
* other types of keys ar left as is.
|
|
23
|
-
*/
|
|
24
|
-
static getKeysForSelection(keys) {
|
|
25
|
-
const result = new Array();
|
|
26
|
-
keys.forEach((key) => {
|
|
27
|
-
if (presentation_common_1.Key.isNodeKey(key)) {
|
|
28
|
-
if (presentation_common_1.NodeKey.isInstancesNodeKey(key))
|
|
29
|
-
result.push(...key.instanceKeys);
|
|
30
|
-
else
|
|
31
|
-
result.push(key);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
result.push(key);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.SelectionHelper = SelectionHelper;
|
|
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
|
+
/** @packageDocumentation
|
|
7
|
+
* @module UnifiedSelection
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SelectionHelper = void 0;
|
|
11
|
+
const presentation_common_1 = require("@itwin/presentation-common");
|
|
12
|
+
/**
|
|
13
|
+
* Helper class for working with selection.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
class SelectionHelper {
|
|
17
|
+
// istanbul ignore next
|
|
18
|
+
constructor() { }
|
|
19
|
+
/**
|
|
20
|
+
* Re-map the given keyset for selection. This means all instance node keys get converted
|
|
21
|
+
* to instance keys, because in that case we want to select instances instead of nodes. All
|
|
22
|
+
* other types of keys ar left as is.
|
|
23
|
+
*/
|
|
24
|
+
static getKeysForSelection(keys) {
|
|
25
|
+
const result = new Array();
|
|
26
|
+
keys.forEach((key) => {
|
|
27
|
+
if (presentation_common_1.Key.isNodeKey(key)) {
|
|
28
|
+
if (presentation_common_1.NodeKey.isInstancesNodeKey(key))
|
|
29
|
+
result.push(...key.instanceKeys);
|
|
30
|
+
else
|
|
31
|
+
result.push(key);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
result.push(key);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.SelectionHelper = SelectionHelper;
|
|
41
41
|
//# sourceMappingURL=SelectionHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionHelper.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionHelper.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oEAAgE;AAEhE;;;GAGG;AACH,MAAa,eAAe;IAE1B,uBAAuB;IACvB,gBAAwB,CAAC;IAEzB;;;;OAIG;IACI,MAAM,CAAC,mBAAmB,CAAC,IAAoB;QACpD,MAAM,MAAM,GAAG,IAAI,KAAK,EAAO,CAAC;QAChC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAQ,EAAE,EAAE;YACxB,IAAI,yBAAG,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;gBACtB,IAAI,6BAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC;oBACjC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC;;oBAEjC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACpB;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aAClB;QACH,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF;AAzBD,0CAyBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\
|
|
1
|
+
{"version":3,"file":"SelectionHelper.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionHelper.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,oEAAgE;AAEhE;;;GAGG;AACH,MAAa,eAAe;IAE1B,uBAAuB;IACvB,gBAAwB,CAAC;IAEzB;;;;OAIG;IACI,MAAM,CAAC,mBAAmB,CAAC,IAAoB;QACpD,MAAM,MAAM,GAAG,IAAI,KAAK,EAAO,CAAC;QAChC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAQ,EAAE,EAAE;YACxB,IAAI,yBAAG,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;gBACtB,IAAI,6BAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC;oBACjC,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC;;oBAEjC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACpB;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aAClB;QACH,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;CAEF;AAzBD,0CAyBC","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/** @packageDocumentation\n * @module UnifiedSelection\n */\n\nimport { Key, Keys, NodeKey } from \"@itwin/presentation-common\";\n\n/**\n * Helper class for working with selection.\n * @public\n */\nexport class SelectionHelper {\n\n // istanbul ignore next\n private constructor() { }\n\n /**\n * Re-map the given keyset for selection. This means all instance node keys get converted\n * to instance keys, because in that case we want to select instances instead of nodes. All\n * other types of keys ar left as is.\n */\n public static getKeysForSelection(keys: Readonly<Keys>): Key[] {\n const result = new Array<Key>();\n keys.forEach((key: Key) => {\n if (Key.isNodeKey(key)) {\n if (NodeKey.isInstancesNodeKey(key))\n result.push(...key.instanceKeys);\n else\n result.push(key);\n } else {\n result.push(key);\n }\n });\n return result;\n }\n\n}\n"]}
|