@itwin/presentation-frontend 3.6.0-dev.8 → 3.7.0-dev.1

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 (133) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/LICENSE.md +1 -1
  3. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
  4. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js +47 -47
  5. package/lib/cjs/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  6. package/lib/cjs/presentation-frontend/Diagnostics.d.ts +14 -14
  7. package/lib/cjs/presentation-frontend/Diagnostics.js +61 -61
  8. package/lib/cjs/presentation-frontend/Diagnostics.js.map +1 -1
  9. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
  10. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js +20 -20
  11. package/lib/cjs/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  12. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
  13. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
  14. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +41 -42
  15. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  16. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts +10 -10
  17. package/lib/cjs/presentation-frontend/LocalizationHelper.js +31 -31
  18. package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
  19. package/lib/cjs/presentation-frontend/Presentation.d.ts +75 -75
  20. package/lib/cjs/presentation-frontend/Presentation.js +162 -162
  21. package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
  22. package/lib/cjs/presentation-frontend/PresentationManager.d.ts +186 -180
  23. package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
  24. package/lib/cjs/presentation-frontend/PresentationManager.js +436 -419
  25. package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
  26. package/lib/cjs/presentation-frontend/RulesetManager.d.ts +63 -60
  27. package/lib/cjs/presentation-frontend/RulesetManager.d.ts.map +1 -1
  28. package/lib/cjs/presentation-frontend/RulesetManager.js +85 -85
  29. package/lib/cjs/presentation-frontend/RulesetManager.js.map +1 -1
  30. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
  31. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js +195 -195
  32. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  33. package/lib/cjs/presentation-frontend/StateTracker.d.ts +38 -23
  34. package/lib/cjs/presentation-frontend/StateTracker.d.ts.map +1 -1
  35. package/lib/cjs/presentation-frontend/StateTracker.js +129 -74
  36. package/lib/cjs/presentation-frontend/StateTracker.js.map +1 -1
  37. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  38. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +525 -525
  39. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  40. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
  41. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +293 -293
  42. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  43. package/lib/cjs/presentation-frontend/selection/HiliteRules.json +172 -172
  44. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  45. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +97 -97
  46. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  47. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  48. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js +9 -9
  49. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  50. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  51. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js +33 -33
  52. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  53. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  54. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +108 -108
  55. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  56. package/lib/cjs/presentation-frontend/selection/SelectionHelper.d.ts +14 -14
  57. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +37 -37
  58. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  59. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  60. package/lib/cjs/presentation-frontend/selection/SelectionManager.js +414 -414
  61. package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
  62. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  63. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js +91 -91
  64. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  65. package/lib/cjs/presentation-frontend.d.ts +34 -34
  66. package/lib/cjs/presentation-frontend.js +50 -50
  67. package/lib/cjs/presentation-frontend.js.map +1 -1
  68. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.d.ts +29 -29
  69. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js +43 -43
  70. package/lib/esm/presentation-frontend/ConnectivityInformationProvider.js.map +1 -1
  71. package/lib/esm/presentation-frontend/Diagnostics.d.ts +14 -14
  72. package/lib/esm/presentation-frontend/Diagnostics.js +56 -56
  73. package/lib/esm/presentation-frontend/Diagnostics.js.map +1 -1
  74. package/lib/esm/presentation-frontend/FrontendLoggerCategory.d.ts +12 -12
  75. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js +17 -17
  76. package/lib/esm/presentation-frontend/FrontendLoggerCategory.js.map +1 -1
  77. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts +10 -10
  78. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
  79. package/lib/esm/presentation-frontend/IpcRequestsHandler.js +37 -38
  80. package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  81. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts +10 -10
  82. package/lib/esm/presentation-frontend/LocalizationHelper.js +27 -27
  83. package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
  84. package/lib/esm/presentation-frontend/Presentation.d.ts +75 -75
  85. package/lib/esm/presentation-frontend/Presentation.js +158 -158
  86. package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
  87. package/lib/esm/presentation-frontend/PresentationManager.d.ts +186 -180
  88. package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
  89. package/lib/esm/presentation-frontend/PresentationManager.js +431 -414
  90. package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
  91. package/lib/esm/presentation-frontend/RulesetManager.d.ts +63 -60
  92. package/lib/esm/presentation-frontend/RulesetManager.d.ts.map +1 -1
  93. package/lib/esm/presentation-frontend/RulesetManager.js +81 -81
  94. package/lib/esm/presentation-frontend/RulesetManager.js.map +1 -1
  95. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +143 -143
  96. package/lib/esm/presentation-frontend/RulesetVariablesManager.js +191 -191
  97. package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  98. package/lib/esm/presentation-frontend/StateTracker.d.ts +38 -23
  99. package/lib/esm/presentation-frontend/StateTracker.d.ts.map +1 -1
  100. package/lib/esm/presentation-frontend/StateTracker.js +125 -70
  101. package/lib/esm/presentation-frontend/StateTracker.js.map +1 -1
  102. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +132 -132
  103. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +519 -519
  104. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  105. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +111 -111
  106. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +285 -285
  107. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  108. package/lib/esm/presentation-frontend/selection/HiliteRules.json +172 -172
  109. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts +52 -52
  110. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +93 -93
  111. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  112. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +19 -19
  113. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js +8 -8
  114. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  115. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +52 -52
  116. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js +29 -29
  117. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  118. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +103 -103
  119. package/lib/esm/presentation-frontend/selection/SelectionHandler.js +104 -104
  120. package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  121. package/lib/esm/presentation-frontend/selection/SelectionHelper.d.ts +14 -14
  122. package/lib/esm/presentation-frontend/selection/SelectionHelper.js +33 -33
  123. package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  124. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +139 -139
  125. package/lib/esm/presentation-frontend/selection/SelectionManager.js +409 -409
  126. package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
  127. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +59 -59
  128. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js +85 -85
  129. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  130. package/lib/esm/presentation-frontend.d.ts +34 -34
  131. package/lib/esm/presentation-frontend.js +38 -38
  132. package/lib/esm/presentation-frontend.js.map +1 -1
  133. 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,105 +1,105 @@
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
- /** @packageDocumentation
6
- * @module UnifiedSelection
7
- */
8
- import { DisposableList } from "@itwin/core-bentley";
9
- /**
10
- * A class that handles selection changes and helps to change
11
- * internal the selection state.
12
- *
13
- * @public
14
- */
15
- export class SelectionHandler {
16
- /**
17
- * Constructor.
18
- */
19
- constructor(props) {
20
- /**
21
- * Called when the selection changes. Handles this callback by first checking whether
22
- * the event should be handled at all (using the `shouldHandle` method) and then calling `onSelect`
23
- */
24
- // eslint-disable-next-line @typescript-eslint/naming-convention
25
- this.onSelectionChanged = (evt, provider) => {
26
- if (!this.onSelect || !this.shouldHandle(evt))
27
- return;
28
- this._inSelect = true;
29
- this.onSelect(evt, provider);
30
- this._inSelect = false;
31
- };
32
- this._inSelect = false;
33
- this.manager = props.manager;
34
- this._disposables = new DisposableList();
35
- this.name = props.name;
36
- this.rulesetId = props.rulesetId;
37
- this.imodel = props.imodel;
38
- this.onSelect = props.onSelect;
39
- this._disposables.add(this.manager.selectionChange.addListener(this.onSelectionChanged));
40
- }
41
- /**
42
- * Destructor. Must be called before disposing this object to make sure it cleans
43
- * up correctly.
44
- */
45
- dispose() {
46
- this._disposables.dispose();
47
- }
48
- /** Called to check whether the event should be handled by this handler */
49
- shouldHandle(evt) {
50
- if (this.name === evt.source)
51
- return false;
52
- return true;
53
- }
54
- /** Get selection levels for the imodel managed by this handler */
55
- getSelectionLevels() {
56
- return this.manager.getSelectionLevels(this.imodel);
57
- }
58
- /**
59
- * Get selection for the imodel managed by this handler.
60
- * @param level Level of the selection to get. Defaults to 0.
61
- */
62
- getSelection(level) {
63
- return this.manager.getSelection(this.imodel, level);
64
- }
65
- /**
66
- * Add to selection.
67
- * @param keys The keys to add to selection.
68
- * @param level Level of the selection.
69
- */
70
- addToSelection(keys, level = 0) {
71
- if (this._inSelect)
72
- return;
73
- return this.manager.addToSelection(this.name, this.imodel, keys, level, this.rulesetId);
74
- }
75
- /**
76
- * Remove from selection.
77
- * @param keys The keys to remove from selection.
78
- * @param level Level of the selection.
79
- */
80
- removeFromSelection(keys, level = 0) {
81
- if (this._inSelect)
82
- return;
83
- return this.manager.removeFromSelection(this.name, this.imodel, keys, level, this.rulesetId);
84
- }
85
- /**
86
- * Change selection.
87
- * @param keys The keys indicating the new selection.
88
- * @param level Level of the selection.
89
- */
90
- replaceSelection(keys, level = 0) {
91
- if (this._inSelect)
92
- return;
93
- return this.manager.replaceSelection(this.name, this.imodel, keys, level, this.rulesetId);
94
- }
95
- /**
96
- * Clear selection.
97
- * @param level Level of the selection.
98
- */
99
- clearSelection(level = 0) {
100
- if (this._inSelect)
101
- return;
102
- return this.manager.clearSelection(this.name, this.imodel, level, this.rulesetId);
103
- }
104
- }
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
+ /** @packageDocumentation
6
+ * @module UnifiedSelection
7
+ */
8
+ import { DisposableList } from "@itwin/core-bentley";
9
+ /**
10
+ * A class that handles selection changes and helps to change
11
+ * internal the selection state.
12
+ *
13
+ * @public
14
+ */
15
+ export class SelectionHandler {
16
+ /**
17
+ * Constructor.
18
+ */
19
+ constructor(props) {
20
+ /**
21
+ * Called when the selection changes. Handles this callback by first checking whether
22
+ * the event should be handled at all (using the `shouldHandle` method) and then calling `onSelect`
23
+ */
24
+ // eslint-disable-next-line @typescript-eslint/naming-convention
25
+ this.onSelectionChanged = (evt, provider) => {
26
+ if (!this.onSelect || !this.shouldHandle(evt))
27
+ return;
28
+ this._inSelect = true;
29
+ this.onSelect(evt, provider);
30
+ this._inSelect = false;
31
+ };
32
+ this._inSelect = false;
33
+ this.manager = props.manager;
34
+ this._disposables = new DisposableList();
35
+ this.name = props.name;
36
+ this.rulesetId = props.rulesetId;
37
+ this.imodel = props.imodel;
38
+ this.onSelect = props.onSelect;
39
+ this._disposables.add(this.manager.selectionChange.addListener(this.onSelectionChanged));
40
+ }
41
+ /**
42
+ * Destructor. Must be called before disposing this object to make sure it cleans
43
+ * up correctly.
44
+ */
45
+ dispose() {
46
+ this._disposables.dispose();
47
+ }
48
+ /** Called to check whether the event should be handled by this handler */
49
+ shouldHandle(evt) {
50
+ if (this.name === evt.source)
51
+ return false;
52
+ return true;
53
+ }
54
+ /** Get selection levels for the imodel managed by this handler */
55
+ getSelectionLevels() {
56
+ return this.manager.getSelectionLevels(this.imodel);
57
+ }
58
+ /**
59
+ * Get selection for the imodel managed by this handler.
60
+ * @param level Level of the selection to get. Defaults to 0.
61
+ */
62
+ getSelection(level) {
63
+ return this.manager.getSelection(this.imodel, level);
64
+ }
65
+ /**
66
+ * Add to selection.
67
+ * @param keys The keys to add to selection.
68
+ * @param level Level of the selection.
69
+ */
70
+ addToSelection(keys, level = 0) {
71
+ if (this._inSelect)
72
+ return;
73
+ return this.manager.addToSelection(this.name, this.imodel, keys, level, this.rulesetId);
74
+ }
75
+ /**
76
+ * Remove from selection.
77
+ * @param keys The keys to remove from selection.
78
+ * @param level Level of the selection.
79
+ */
80
+ removeFromSelection(keys, level = 0) {
81
+ if (this._inSelect)
82
+ return;
83
+ return this.manager.removeFromSelection(this.name, this.imodel, keys, level, this.rulesetId);
84
+ }
85
+ /**
86
+ * Change selection.
87
+ * @param keys The keys indicating the new selection.
88
+ * @param level Level of the selection.
89
+ */
90
+ replaceSelection(keys, level = 0) {
91
+ if (this._inSelect)
92
+ return;
93
+ return this.manager.replaceSelection(this.name, this.imodel, keys, level, this.rulesetId);
94
+ }
95
+ /**
96
+ * Clear selection.
97
+ * @param level Level of the selection.
98
+ */
99
+ clearSelection(level = 0) {
100
+ if (this._inSelect)
101
+ return;
102
+ return this.manager.clearSelection(this.name, this.imodel, level, this.rulesetId);
103
+ }
104
+ }
105
105
  //# sourceMappingURL=SelectionHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionHandler.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionHandler.ts"],"names":[],"mappings":"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","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 { DisposableList, IDisposable } from \"@itwin/core-bentley\";\r\nimport { IModelConnection } from \"@itwin/core-frontend\";\r\nimport { Keys, KeySet } from \"@itwin/presentation-common\";\r\nimport { ISelectionProvider } from \"./ISelectionProvider\";\r\nimport { SelectionChangeEventArgs, SelectionChangesListener } from \"./SelectionChangeEvent\";\r\nimport { SelectionManager } from \"./SelectionManager\";\r\n\r\n/**\r\n * Properties for creating a `SelectionHandler` instance.\r\n * @public\r\n */\r\nexport interface SelectionHandlerProps {\r\n /** SelectionManager used to store overall selection. */\r\n manager: SelectionManager;\r\n /** iModel connection the selection changes will be associated with. */\r\n imodel: IModelConnection;\r\n /**\r\n * Name of the selection handler. This is an identifier of what caused the\r\n * selection to change, set as `SelectionChangeEventArgs.source` when firing\r\n * selection change events. `SelectionHandler.shouldHandle` uses `name` to filter\r\n * events that it doesn't need to handle.\r\n */\r\n name: string;\r\n /**\r\n * ID of presentation ruleset used by the component using this handler. The ID is set as\r\n * `SelectionChangeEventArgs.rulesetId` when making selection changes and event\r\n * listeners can use or ignore this information.\r\n */\r\n rulesetId?: string;\r\n /** Callback function called when selection changes. */\r\n onSelect?: SelectionChangesListener;\r\n}\r\n\r\n/**\r\n * A class that handles selection changes and helps to change\r\n * internal the selection state.\r\n *\r\n * @public\r\n */\r\nexport class SelectionHandler implements IDisposable {\r\n private _inSelect: boolean;\r\n private _disposables: DisposableList;\r\n\r\n /** Selection manager used by this handler to manage selection */\r\n public readonly manager: SelectionManager;\r\n /** Name that's used as `SelectionChangeEventArgs.source` when making selection changes */\r\n public name: string;\r\n /** iModel whose selection is being handled */\r\n public imodel: IModelConnection;\r\n /**\r\n * Id of a ruleset selection changes will be associated with.\r\n * @see `SelectionHandlerProps.rulesetId`\r\n */\r\n public rulesetId?: string;\r\n /** Callback function called when selection changes */\r\n public onSelect?: SelectionChangesListener;\r\n\r\n /**\r\n * Constructor.\r\n */\r\n constructor(props: SelectionHandlerProps) {\r\n this._inSelect = false;\r\n this.manager = props.manager;\r\n this._disposables = new DisposableList();\r\n this.name = props.name;\r\n this.rulesetId = props.rulesetId;\r\n this.imodel = props.imodel;\r\n this.onSelect = props.onSelect;\r\n this._disposables.add(this.manager.selectionChange.addListener(this.onSelectionChanged));\r\n }\r\n\r\n /**\r\n * Destructor. Must be called before disposing this object to make sure it cleans\r\n * up correctly.\r\n */\r\n public dispose(): void {\r\n this._disposables.dispose();\r\n }\r\n\r\n /**\r\n * Called when the selection changes. Handles this callback by first checking whether\r\n * the event should be handled at all (using the `shouldHandle` method) and then calling `onSelect`\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected onSelectionChanged = (evt: SelectionChangeEventArgs, provider: ISelectionProvider): void => {\r\n if (!this.onSelect || !this.shouldHandle(evt))\r\n return;\r\n\r\n this._inSelect = true;\r\n this.onSelect(evt, provider);\r\n this._inSelect = false;\r\n };\r\n\r\n /** Called to check whether the event should be handled by this handler */\r\n protected shouldHandle(evt: SelectionChangeEventArgs): boolean {\r\n if (this.name === evt.source)\r\n return false;\r\n return true;\r\n }\r\n\r\n /** Get selection levels for the imodel managed by this handler */\r\n public getSelectionLevels(): number[] {\r\n return this.manager.getSelectionLevels(this.imodel);\r\n }\r\n\r\n /**\r\n * Get selection for the imodel managed by this handler.\r\n * @param level Level of the selection to get. Defaults to 0.\r\n */\r\n public getSelection(level?: number): Readonly<KeySet> {\r\n return this.manager.getSelection(this.imodel, level);\r\n }\r\n\r\n /**\r\n * Add to selection.\r\n * @param keys The keys to add to selection.\r\n * @param level Level of the selection.\r\n */\r\n public addToSelection(keys: Keys, level: number = 0): void {\r\n if (this._inSelect)\r\n return;\r\n\r\n return this.manager.addToSelection(this.name, this.imodel, keys, level, this.rulesetId);\r\n }\r\n\r\n /**\r\n * Remove from selection.\r\n * @param keys The keys to remove from selection.\r\n * @param level Level of the selection.\r\n */\r\n public removeFromSelection(keys: Keys, level: number = 0): void {\r\n if (this._inSelect)\r\n return;\r\n\r\n return this.manager.removeFromSelection(this.name, this.imodel, keys, level, this.rulesetId);\r\n }\r\n\r\n /**\r\n * Change selection.\r\n * @param keys The keys indicating the new selection.\r\n * @param level Level of the selection.\r\n */\r\n public replaceSelection(keys: Keys, level: number = 0): void {\r\n if (this._inSelect)\r\n return;\r\n\r\n return this.manager.replaceSelection(this.name, this.imodel, keys, level, this.rulesetId);\r\n }\r\n\r\n /**\r\n * Clear selection.\r\n * @param level Level of the selection.\r\n */\r\n public clearSelection(level: number = 0): void {\r\n if (this._inSelect)\r\n return;\r\n\r\n return this.manager.clearSelection(this.name, this.imodel, level, this.rulesetId);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"SelectionHandler.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionHandler.ts"],"names":[],"mappings":"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","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,15 +1,15 @@
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
+ /** @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
+ }
15
15
  //# sourceMappingURL=SelectionHelper.d.ts.map
@@ -1,34 +1,34 @@
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
- /** @packageDocumentation
6
- * @module UnifiedSelection
7
- */
8
- import { Key, NodeKey } from "@itwin/presentation-common";
9
- /** @internal */
10
- export class SelectionHelper {
11
- // istanbul ignore next
12
- constructor() { }
13
- /**
14
- * Re-map the given keyset for selection. This means all instance node keys get converted
15
- * to instance keys, because in that case we want to select instances instead of nodes. All
16
- * other types of keys ar left as is.
17
- */
18
- static getKeysForSelection(keys) {
19
- const result = new Array();
20
- keys.forEach((key) => {
21
- if (Key.isNodeKey(key)) {
22
- if (NodeKey.isInstancesNodeKey(key))
23
- result.push(...key.instanceKeys);
24
- else
25
- result.push(key);
26
- }
27
- else {
28
- result.push(key);
29
- }
30
- });
31
- return result;
32
- }
33
- }
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
+ /** @packageDocumentation
6
+ * @module UnifiedSelection
7
+ */
8
+ import { Key, NodeKey } from "@itwin/presentation-common";
9
+ /** @internal */
10
+ export class SelectionHelper {
11
+ // istanbul ignore next
12
+ constructor() { }
13
+ /**
14
+ * Re-map the given keyset for selection. This means all instance node keys get converted
15
+ * to instance keys, because in that case we want to select instances instead of nodes. All
16
+ * other types of keys ar left as is.
17
+ */
18
+ static getKeysForSelection(keys) {
19
+ const result = new Array();
20
+ keys.forEach((key) => {
21
+ if (Key.isNodeKey(key)) {
22
+ if (NodeKey.isInstancesNodeKey(key))
23
+ result.push(...key.instanceKeys);
24
+ else
25
+ result.push(key);
26
+ }
27
+ else {
28
+ result.push(key);
29
+ }
30
+ });
31
+ return result;
32
+ }
33
+ }
34
34
  //# 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,OAAO,EAAE,GAAG,EAAQ,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAEhE,gBAAgB;AAChB,MAAM,OAAO,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,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;gBACtB,IAAI,OAAO,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","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,OAAO,EAAE,GAAG,EAAQ,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAEhE,gBAAgB;AAChB,MAAM,OAAO,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,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;gBACtB,IAAI,OAAO,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","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/** @internal */\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"]}