@itwin/presentation-frontend 4.0.0-dev.7 → 4.0.0-dev.72

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +45 -1
  2. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
  3. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +47 -47
  4. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  5. package/lib/cjs/presentation-frontend/Diagnostics.d.ts +14 -14
  6. package/lib/cjs/presentation-frontend/Diagnostics.js +61 -61
  7. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
  8. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js +20 -20
  9. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
  10. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +41 -41
  11. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts +10 -10
  12. package/lib/cjs/presentation-frontend/LocalizationHelper.js +31 -31
  13. package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
  14. package/lib/cjs/presentation-frontend/Presentation.d.ts +73 -75
  15. package/lib/cjs/presentation-frontend/Presentation.d.ts.map +1 -1
  16. package/lib/cjs/presentation-frontend/Presentation.js +159 -162
  17. package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
  18. package/lib/cjs/presentation-frontend/PresentationManager.d.ts +205 -186
  19. package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
  20. package/lib/cjs/presentation-frontend/PresentationManager.js +438 -436
  21. package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
  22. package/lib/cjs/presentation-frontend/RulesetManager.d.ts +63 -63
  23. package/lib/cjs/presentation-frontend/RulesetManager.js +85 -85
  24. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
  25. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +195 -195
  26. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  27. package/lib/cjs/presentation-frontend/StateTracker.d.ts +38 -38
  28. package/lib/cjs/presentation-frontend/StateTracker.js +128 -129
  29. package/lib/cjs/presentation-frontend/StateTracker.js.map +1 -1
  30. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  31. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  32. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +519 -518
  33. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  34. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
  35. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +290 -293
  36. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  37. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  38. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +97 -97
  39. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  40. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +9 -9
  41. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  42. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +33 -33
  43. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  44. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +108 -108
  45. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts +17 -14
  46. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
  47. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +40 -37
  48. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  49. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  50. package/lib/cjs/presentation-frontend/selection/SelectionManager.js +414 -414
  51. package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
  52. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  53. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +91 -91
  54. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  55. package/lib/cjs/presentation-frontend.d.ts +34 -34
  56. package/lib/cjs/presentation-frontend.js +54 -50
  57. package/lib/cjs/presentation-frontend.js.map +1 -1
  58. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
  59. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +43 -43
  60. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  61. package/lib/esm/presentation-frontend/Diagnostics.d.ts +14 -14
  62. package/lib/esm/presentation-frontend/Diagnostics.js +56 -56
  63. package/lib/esm/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
  64. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js +17 -17
  65. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
  66. package/lib/esm/presentation-frontend/IpcRequestsHandler.js +37 -37
  67. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts +10 -10
  68. package/lib/esm/presentation-frontend/LocalizationHelper.js +27 -27
  69. package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
  70. package/lib/esm/presentation-frontend/Presentation.d.ts +73 -75
  71. package/lib/esm/presentation-frontend/Presentation.d.ts.map +1 -1
  72. package/lib/esm/presentation-frontend/Presentation.js +155 -158
  73. package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
  74. package/lib/esm/presentation-frontend/PresentationManager.d.ts +205 -186
  75. package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
  76. package/lib/esm/presentation-frontend/PresentationManager.js +433 -431
  77. package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
  78. package/lib/esm/presentation-frontend/RulesetManager.d.ts +63 -63
  79. package/lib/esm/presentation-frontend/RulesetManager.js +81 -81
  80. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
  81. package/lib/esm/presentation-frontend/RulesetVariablesManager.js +191 -191
  82. package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  83. package/lib/esm/presentation-frontend/StateTracker.d.ts +38 -38
  84. package/lib/esm/presentation-frontend/StateTracker.js +124 -125
  85. package/lib/esm/presentation-frontend/StateTracker.js.map +1 -1
  86. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  87. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  88. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +514 -512
  89. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  90. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
  91. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +282 -285
  92. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  93. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  94. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +93 -93
  95. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  96. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +8 -8
  97. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  98. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +29 -29
  99. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  100. package/lib/esm/presentation-frontend/selection/SelectionHandler.js +104 -104
  101. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts +17 -14
  102. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts.map +1 -1
  103. package/lib/esm/presentation-frontend/selection/SelectionHelper.js +36 -33
  104. package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  105. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  106. package/lib/esm/presentation-frontend/selection/SelectionManager.js +409 -409
  107. package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
  108. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  109. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +85 -85
  110. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  111. package/lib/esm/presentation-frontend.d.ts +34 -34
  112. package/lib/esm/presentation-frontend.js +38 -38
  113. package/package.json +20 -20
@@ -1,34 +1,34 @@
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.SelectionChangeType = exports.SelectionChangeEvent = void 0;
11
- const core_bentley_1 = require("@itwin/core-bentley");
12
- /**
13
- * An event broadcasted on selection changes
14
- * @public
15
- */
16
- class SelectionChangeEvent extends core_bentley_1.BeEvent {
17
- }
18
- exports.SelectionChangeEvent = SelectionChangeEvent;
19
- /**
20
- * The type of selection change
21
- * @public
22
- */
23
- var SelectionChangeType;
24
- (function (SelectionChangeType) {
25
- /** Added to selection. */
26
- SelectionChangeType[SelectionChangeType["Add"] = 0] = "Add";
27
- /** Removed from selection. */
28
- SelectionChangeType[SelectionChangeType["Remove"] = 1] = "Remove";
29
- /** Selection was replaced. */
30
- SelectionChangeType[SelectionChangeType["Replace"] = 2] = "Replace";
31
- /** Selection was cleared. */
32
- SelectionChangeType[SelectionChangeType["Clear"] = 3] = "Clear";
33
- })(SelectionChangeType = exports.SelectionChangeType || (exports.SelectionChangeType = {}));
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.SelectionChangeType = exports.SelectionChangeEvent = void 0;
11
+ const core_bentley_1 = require("@itwin/core-bentley");
12
+ /**
13
+ * An event broadcasted on selection changes
14
+ * @public
15
+ */
16
+ class SelectionChangeEvent extends core_bentley_1.BeEvent {
17
+ }
18
+ exports.SelectionChangeEvent = SelectionChangeEvent;
19
+ /**
20
+ * The type of selection change
21
+ * @public
22
+ */
23
+ var SelectionChangeType;
24
+ (function (SelectionChangeType) {
25
+ /** Added to selection. */
26
+ SelectionChangeType[SelectionChangeType["Add"] = 0] = "Add";
27
+ /** Removed from selection. */
28
+ SelectionChangeType[SelectionChangeType["Remove"] = 1] = "Remove";
29
+ /** Selection was replaced. */
30
+ SelectionChangeType[SelectionChangeType["Replace"] = 2] = "Replace";
31
+ /** Selection was cleared. */
32
+ SelectionChangeType[SelectionChangeType["Clear"] = 3] = "Clear";
33
+ })(SelectionChangeType = exports.SelectionChangeType || (exports.SelectionChangeType = {}));
34
34
  //# sourceMappingURL=SelectionChangeEvent.js.map
@@ -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,15 +1,18 @@
1
- /** @packageDocumentation
2
- * @module UnifiedSelection
3
- */
4
- import { Key, Keys } from "@itwin/presentation-common";
5
- /** @internal */
6
- export declare class SelectionHelper {
7
- private constructor();
8
- /**
9
- * Re-map the given keyset for selection. This means all instance node keys get converted
10
- * to instance keys, because in that case we want to select instances instead of nodes. All
11
- * other types of keys ar left as is.
12
- */
13
- static getKeysForSelection(keys: Readonly<Keys>): Key[];
14
- }
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
+ }
15
18
  //# sourceMappingURL=SelectionHelper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionHelper.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionHelper.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAW,MAAM,4BAA4B,CAAC;AAEhE,gBAAgB;AAChB,qBAAa,eAAe;IAG1B,OAAO;IAEP;;;;OAIG;WACW,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE;CAe/D"}
1
+ {"version":3,"file":"SelectionHelper.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionHelper.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAW,MAAM,4BAA4B,CAAC;AAEhE;;;GAGG;AACH,qBAAa,eAAe;IAG1B,OAAO;IAEP;;;;OAIG;WACW,mBAAmB,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE;CAe/D"}
@@ -1,38 +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
- /** @internal */
13
- class SelectionHelper {
14
- // istanbul ignore next
15
- constructor() { }
16
- /**
17
- * Re-map the given keyset for selection. This means all instance node keys get converted
18
- * to instance keys, because in that case we want to select instances instead of nodes. All
19
- * other types of keys ar left as is.
20
- */
21
- static getKeysForSelection(keys) {
22
- const result = new Array();
23
- keys.forEach((key) => {
24
- if (presentation_common_1.Key.isNodeKey(key)) {
25
- if (presentation_common_1.NodeKey.isInstancesNodeKey(key))
26
- result.push(...key.instanceKeys);
27
- else
28
- result.push(key);
29
- }
30
- else {
31
- result.push(key);
32
- }
33
- });
34
- return result;
35
- }
36
- }
37
- 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;
38
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,gBAAgB;AAChB,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":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module UnifiedSelection\r\n */\r\n\r\nimport { Key, Keys, NodeKey } from \"@itwin/presentation-common\";\r\n\r\n/** @internal */\r\nexport class SelectionHelper {\r\n\r\n // istanbul ignore next\r\n private constructor() { }\r\n\r\n /**\r\n * Re-map the given keyset for selection. This means all instance node keys get converted\r\n * to instance keys, because in that case we want to select instances instead of nodes. All\r\n * other types of keys ar left as is.\r\n */\r\n public static getKeysForSelection(keys: Readonly<Keys>): Key[] {\r\n const result = new Array<Key>();\r\n keys.forEach((key: Key) => {\r\n if (Key.isNodeKey(key)) {\r\n if (NodeKey.isInstancesNodeKey(key))\r\n result.push(...key.instanceKeys);\r\n else\r\n result.push(key);\r\n } else {\r\n result.push(key);\r\n }\r\n });\r\n return result;\r\n }\r\n\r\n}\r\n"]}
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":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module UnifiedSelection\r\n */\r\n\r\nimport { Key, Keys, NodeKey } from \"@itwin/presentation-common\";\r\n\r\n/**\r\n * Helper class for working with selection.\r\n * @public\r\n */\r\nexport class SelectionHelper {\r\n\r\n // istanbul ignore next\r\n private constructor() { }\r\n\r\n /**\r\n * Re-map the given keyset for selection. This means all instance node keys get converted\r\n * to instance keys, because in that case we want to select instances instead of nodes. All\r\n * other types of keys ar left as is.\r\n */\r\n public static getKeysForSelection(keys: Readonly<Keys>): Key[] {\r\n const result = new Array<Key>();\r\n keys.forEach((key: Key) => {\r\n if (Key.isNodeKey(key)) {\r\n if (NodeKey.isInstancesNodeKey(key))\r\n result.push(...key.instanceKeys);\r\n else\r\n result.push(key);\r\n } else {\r\n result.push(key);\r\n }\r\n });\r\n return result;\r\n }\r\n\r\n}\r\n"]}