@itwin/presentation-frontend 5.0.0-dev.90 → 5.0.0-dev.93

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 (114) hide show
  1. package/lib/cjs/package.json +1 -0
  2. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts +12 -3
  3. package/lib/cjs/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
  4. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js +6 -7
  5. package/lib/cjs/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  6. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts +1 -1
  7. package/lib/cjs/presentation-frontend/LocalizationHelper.d.ts.map +1 -1
  8. package/lib/cjs/presentation-frontend/LocalizationHelper.js +6 -6
  9. package/lib/cjs/presentation-frontend/LocalizationHelper.js.map +1 -1
  10. package/lib/cjs/presentation-frontend/Presentation.d.ts +3 -3
  11. package/lib/cjs/presentation-frontend/Presentation.d.ts.map +1 -1
  12. package/lib/cjs/presentation-frontend/Presentation.js +14 -14
  13. package/lib/cjs/presentation-frontend/Presentation.js.map +1 -1
  14. package/lib/cjs/presentation-frontend/PresentationManager.d.ts +5 -4
  15. package/lib/cjs/presentation-frontend/PresentationManager.d.ts.map +1 -1
  16. package/lib/cjs/presentation-frontend/PresentationManager.js +25 -24
  17. package/lib/cjs/presentation-frontend/PresentationManager.js.map +1 -1
  18. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts +1 -1
  19. package/lib/cjs/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
  20. package/lib/cjs/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  21. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.d.ts +1 -1
  22. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.d.ts.map +1 -1
  23. package/lib/cjs/presentation-frontend/StreamedResponseGenerator.js.map +1 -1
  24. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +2 -2
  25. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  26. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +24 -25
  27. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  28. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +2 -2
  29. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
  30. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +7 -11
  31. package/lib/cjs/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  32. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
  33. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js +4 -2
  34. package/lib/cjs/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  35. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts +1 -1
  36. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.d.ts.map +1 -1
  37. package/lib/cjs/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  38. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts +1 -1
  39. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
  40. package/lib/cjs/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  41. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts +3 -3
  42. package/lib/cjs/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
  43. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js +1 -1
  44. package/lib/cjs/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  45. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js +1 -1
  46. package/lib/cjs/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  47. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts +4 -4
  48. package/lib/cjs/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
  49. package/lib/cjs/presentation-frontend/selection/SelectionManager.js +27 -27
  50. package/lib/cjs/presentation-frontend/selection/SelectionManager.js.map +1 -1
  51. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts +2 -1
  52. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
  53. package/lib/cjs/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  54. package/lib/cjs/presentation-frontend.d.ts +15 -15
  55. package/lib/cjs/presentation-frontend.d.ts.map +1 -1
  56. package/lib/cjs/presentation-frontend.js +30 -29
  57. package/lib/cjs/presentation-frontend.js.map +1 -1
  58. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts +12 -3
  59. package/lib/esm/presentation-frontend/IpcRequestsHandler.d.ts.map +1 -1
  60. package/lib/esm/presentation-frontend/IpcRequestsHandler.js +6 -7
  61. package/lib/esm/presentation-frontend/IpcRequestsHandler.js.map +1 -1
  62. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts +1 -1
  63. package/lib/esm/presentation-frontend/LocalizationHelper.d.ts.map +1 -1
  64. package/lib/esm/presentation-frontend/LocalizationHelper.js +2 -2
  65. package/lib/esm/presentation-frontend/LocalizationHelper.js.map +1 -1
  66. package/lib/esm/presentation-frontend/Presentation.d.ts +3 -3
  67. package/lib/esm/presentation-frontend/Presentation.d.ts.map +1 -1
  68. package/lib/esm/presentation-frontend/Presentation.js +7 -7
  69. package/lib/esm/presentation-frontend/Presentation.js.map +1 -1
  70. package/lib/esm/presentation-frontend/PresentationManager.d.ts +5 -4
  71. package/lib/esm/presentation-frontend/PresentationManager.d.ts.map +1 -1
  72. package/lib/esm/presentation-frontend/PresentationManager.js +13 -12
  73. package/lib/esm/presentation-frontend/PresentationManager.js.map +1 -1
  74. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts +1 -1
  75. package/lib/esm/presentation-frontend/RulesetVariablesManager.d.ts.map +1 -1
  76. package/lib/esm/presentation-frontend/RulesetVariablesManager.js.map +1 -1
  77. package/lib/esm/presentation-frontend/StreamedResponseGenerator.d.ts +1 -1
  78. package/lib/esm/presentation-frontend/StreamedResponseGenerator.d.ts.map +1 -1
  79. package/lib/esm/presentation-frontend/StreamedResponseGenerator.js.map +1 -1
  80. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts +2 -2
  81. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.d.ts.map +1 -1
  82. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js +24 -25
  83. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesManager.js.map +1 -1
  84. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts +2 -2
  85. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.d.ts.map +1 -1
  86. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js +6 -10
  87. package/lib/esm/presentation-frontend/favorite-properties/FavoritePropertiesStorage.js.map +1 -1
  88. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.d.ts.map +1 -1
  89. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js +4 -2
  90. package/lib/esm/presentation-frontend/selection/HiliteSetProvider.js.map +1 -1
  91. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts +1 -1
  92. package/lib/esm/presentation-frontend/selection/ISelectionProvider.d.ts.map +1 -1
  93. package/lib/esm/presentation-frontend/selection/ISelectionProvider.js.map +1 -1
  94. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts +1 -1
  95. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.d.ts.map +1 -1
  96. package/lib/esm/presentation-frontend/selection/SelectionChangeEvent.js.map +1 -1
  97. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts +3 -3
  98. package/lib/esm/presentation-frontend/selection/SelectionHandler.d.ts.map +1 -1
  99. package/lib/esm/presentation-frontend/selection/SelectionHandler.js +1 -1
  100. package/lib/esm/presentation-frontend/selection/SelectionHandler.js.map +1 -1
  101. package/lib/esm/presentation-frontend/selection/SelectionHelper.js +1 -1
  102. package/lib/esm/presentation-frontend/selection/SelectionHelper.js.map +1 -1
  103. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts +4 -4
  104. package/lib/esm/presentation-frontend/selection/SelectionManager.d.ts.map +1 -1
  105. package/lib/esm/presentation-frontend/selection/SelectionManager.js +11 -11
  106. package/lib/esm/presentation-frontend/selection/SelectionManager.js.map +1 -1
  107. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts +2 -1
  108. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.d.ts.map +1 -1
  109. package/lib/esm/presentation-frontend/selection/SelectionScopesManager.js.map +1 -1
  110. package/lib/esm/presentation-frontend.d.ts +15 -15
  111. package/lib/esm/presentation-frontend.d.ts.map +1 -1
  112. package/lib/esm/presentation-frontend.js +12 -15
  113. package/lib/esm/presentation-frontend.js.map +1 -1
  114. package/package.json +35 -34
@@ -65,11 +65,12 @@ const rxjs_1 = require("rxjs");
65
65
  const core_bentley_1 = require("@itwin/core-bentley");
66
66
  const core_frontend_1 = require("@itwin/core-frontend");
67
67
  const presentation_common_1 = require("@itwin/presentation-common");
68
+ const internal_1 = require("@itwin/presentation-common/internal");
68
69
  const unified_selection_1 = require("@itwin/unified-selection");
69
- const Presentation_1 = require("../Presentation");
70
- const HiliteSetProvider_1 = require("./HiliteSetProvider");
71
- const SelectionChangeEvent_1 = require("./SelectionChangeEvent");
72
- const SelectionScopesManager_1 = require("./SelectionScopesManager");
70
+ const Presentation_js_1 = require("../Presentation.js");
71
+ const HiliteSetProvider_js_1 = require("./HiliteSetProvider.js");
72
+ const SelectionChangeEvent_js_1 = require("./SelectionChangeEvent.js");
73
+ const SelectionScopesManager_js_1 = require("./SelectionScopesManager.js");
73
74
  /**
74
75
  * The selection manager which stores the overall selection.
75
76
  * @public
@@ -98,7 +99,7 @@ class SelectionManager {
98
99
  * Creates an instance of SelectionManager.
99
100
  */
100
101
  constructor(props) {
101
- this.selectionChange = new SelectionChangeEvent_1.SelectionChangeEvent();
102
+ this.selectionChange = new SelectionChangeEvent_js_1.SelectionChangeEvent();
102
103
  this.scopes = props.scopes;
103
104
  this.selectionStorage = props.selectionStorage ?? (0, unified_selection_1.createStorage)();
104
105
  this._imodelKeyFactory = props.imodelKeyFactory ?? ((imodel) => (imodel.key.length ? imodel.key : imodel.name));
@@ -117,7 +118,7 @@ class SelectionManager {
117
118
  this._listeners.forEach((dispose) => dispose());
118
119
  }
119
120
  /** @deprecated in 5.0. Use [Symbol.dispose] instead. */
120
- // istanbul ignore next
121
+ /* c8 ignore next 3 */
121
122
  dispose() {
122
123
  this[Symbol.dispose]();
123
124
  }
@@ -132,7 +133,7 @@ class SelectionManager {
132
133
  }
133
134
  }
134
135
  /** @internal */
135
- // istanbul ignore next
136
+ /* c8 ignore next 3 */
136
137
  getToolSelectionSyncHandler(imodel) {
137
138
  return this._imodelToolSelectionSyncHandlers.get(imodel)?.handler;
138
139
  }
@@ -197,7 +198,7 @@ class SelectionManager {
197
198
  const imodelKey = this._imodelKeyFactory(evt.imodel);
198
199
  this._knownIModels.add(evt.imodel);
199
200
  switch (evt.changeType) {
200
- case SelectionChangeEvent_1.SelectionChangeType.Add:
201
+ case SelectionChangeEvent_js_1.SelectionChangeType.Add:
201
202
  this.selectionStorage.addToSelection({
202
203
  imodelKey,
203
204
  source: evt.source,
@@ -205,7 +206,7 @@ class SelectionManager {
205
206
  selectables: keysToSelectable(evt.imodel, evt.keys),
206
207
  });
207
208
  break;
208
- case SelectionChangeEvent_1.SelectionChangeType.Remove:
209
+ case SelectionChangeEvent_js_1.SelectionChangeType.Remove:
209
210
  this.selectionStorage.removeFromSelection({
210
211
  imodelKey,
211
212
  source: evt.source,
@@ -213,7 +214,7 @@ class SelectionManager {
213
214
  selectables: keysToSelectable(evt.imodel, evt.keys),
214
215
  });
215
216
  break;
216
- case SelectionChangeEvent_1.SelectionChangeType.Replace:
217
+ case SelectionChangeEvent_js_1.SelectionChangeType.Replace:
217
218
  this.selectionStorage.replaceSelection({
218
219
  imodelKey,
219
220
  source: evt.source,
@@ -221,7 +222,7 @@ class SelectionManager {
221
222
  selectables: keysToSelectable(evt.imodel, evt.keys),
222
223
  });
223
224
  break;
224
- case SelectionChangeEvent_1.SelectionChangeType.Clear:
225
+ case SelectionChangeEvent_js_1.SelectionChangeType.Clear:
225
226
  this.selectionStorage.clearSelection({ imodelKey, source: evt.source, level: evt.level });
226
227
  break;
227
228
  }
@@ -239,7 +240,7 @@ class SelectionManager {
239
240
  source,
240
241
  level,
241
242
  imodel,
242
- changeType: SelectionChangeEvent_1.SelectionChangeType.Add,
243
+ changeType: SelectionChangeEvent_js_1.SelectionChangeType.Add,
243
244
  keys: new presentation_common_1.KeySet(keys),
244
245
  timestamp: new Date(),
245
246
  rulesetId,
@@ -259,7 +260,7 @@ class SelectionManager {
259
260
  source,
260
261
  level,
261
262
  imodel,
262
- changeType: SelectionChangeEvent_1.SelectionChangeType.Remove,
263
+ changeType: SelectionChangeEvent_js_1.SelectionChangeType.Remove,
263
264
  keys: new presentation_common_1.KeySet(keys),
264
265
  timestamp: new Date(),
265
266
  rulesetId,
@@ -279,7 +280,7 @@ class SelectionManager {
279
280
  source,
280
281
  level,
281
282
  imodel,
282
- changeType: SelectionChangeEvent_1.SelectionChangeType.Replace,
283
+ changeType: SelectionChangeEvent_js_1.SelectionChangeType.Replace,
283
284
  keys: new presentation_common_1.KeySet(keys),
284
285
  timestamp: new Date(),
285
286
  rulesetId,
@@ -298,7 +299,7 @@ class SelectionManager {
298
299
  source,
299
300
  level,
300
301
  imodel,
301
- changeType: SelectionChangeEvent_1.SelectionChangeType.Clear,
302
+ changeType: SelectionChangeEvent_js_1.SelectionChangeType.Clear,
302
303
  keys: new presentation_common_1.KeySet(),
303
304
  timestamp: new Date(),
304
305
  rulesetId,
@@ -361,7 +362,7 @@ class SelectionManager {
361
362
  getHiliteSetProvider(imodel) {
362
363
  let provider = this._hiliteSetProviders.get(imodel);
363
364
  if (!provider) {
364
- provider = HiliteSetProvider_1.HiliteSetProvider.create({ imodel });
365
+ provider = HiliteSetProvider_js_1.HiliteSetProvider.create({ imodel });
365
366
  this._hiliteSetProviders.set(imodel, provider);
366
367
  }
367
368
  return provider;
@@ -372,7 +373,7 @@ class SelectionManager {
372
373
  const currentSelectables = this.selectionStorage.getSelection({ imodelKey: args.imodelKey, level: args.level });
373
374
  return this._currentSelection.computeSelection(args.imodelKey, args.level, currentSelectables, args.selectables).pipe((0, rxjs_1.mergeMap)(({ level, changedSelection }) => {
374
375
  const imodel = findIModel(this._knownIModels, this._imodelKeyFactory, args.imodelKey);
375
- // istanbul ignore if
376
+ /* c8 ignore next 3 */
376
377
  if (!imodel) {
377
378
  return rxjs_1.EMPTY;
378
379
  }
@@ -408,7 +409,7 @@ class ToolSelectionSyncHandler {
408
409
  _logicalSelection;
409
410
  _imodel;
410
411
  _imodelToolSelectionListenerDisposeFunc;
411
- _asyncsTracker = new presentation_common_1.AsyncTasksTracker();
412
+ _asyncsTracker = new internal_1.AsyncTasksTracker();
412
413
  isSuspended;
413
414
  constructor(imodel, logicalSelection) {
414
415
  this._imodel = imodel;
@@ -453,7 +454,7 @@ class ToolSelectionSyncHandler {
453
454
  // makes sure we're adding to selection keys with concrete classes and not "BisCore:Element", which
454
455
  // we can't because otherwise our keys compare fails (presentation components load data with
455
456
  // concrete classes)
456
- const changer = new ScopedSelectionChanger(this._selectionSourceName, this._imodel, this._logicalSelection, (0, SelectionScopesManager_1.createSelectionScopeProps)(this._logicalSelection.scopes.activeScope));
457
+ const changer = new ScopedSelectionChanger(this._selectionSourceName, this._imodel, this._logicalSelection, (0, SelectionScopesManager_js_1.createSelectionScopeProps)(this._logicalSelection.scopes.activeScope));
457
458
  const _r = __addDisposableResource(env_1, this._asyncsTracker.trackAsyncTask(), false);
458
459
  switch (ev.type) {
459
460
  case core_frontend_1.SelectionSetEventType.Add:
@@ -606,7 +607,7 @@ class IModelSelectionStorage {
606
607
  }
607
608
  clearedLevels.forEach((storedLevel) => {
608
609
  const entry = this._currentSelection.get(storedLevel);
609
- // istanbul ignore if
610
+ /* c8 ignore next 3 */
610
611
  if (!entry) {
611
612
  return;
612
613
  }
@@ -626,13 +627,12 @@ class IModelSelectionStorage {
626
627
  }
627
628
  setSelection(level, keys, disposer) {
628
629
  const currEntry = this._currentSelection.get(level);
629
- // istanbul ignore else
630
630
  if (currEntry) {
631
631
  currEntry.ongoingComputationDisposers.delete(disposer);
632
632
  }
633
633
  this._currentSelection.set(level, {
634
634
  value: keys,
635
- ongoingComputationDisposers: currEntry?.ongoingComputationDisposers ?? /* istanbul ignore next */ new Set(),
635
+ ongoingComputationDisposers: currEntry?.ongoingComputationDisposers ?? /* c8 ignore next */ new Set(),
636
636
  });
637
637
  }
638
638
  computeSelection(level, currSelectables, changedSelectables) {
@@ -711,7 +711,7 @@ async function* createInstanceKeysIterator(imodel, nodeKey) {
711
711
  }
712
712
  return;
713
713
  }
714
- const content = await Presentation_1.Presentation.presentation.getContentInstanceKeys({
714
+ const content = await Presentation_js_1.Presentation.presentation.getContentInstanceKeys({
715
715
  imodel,
716
716
  keys: new presentation_common_1.KeySet([nodeKey]),
717
717
  rulesetOrId: {
@@ -739,13 +739,13 @@ function isNodeKey(data) {
739
739
  function getChangeType(type) {
740
740
  switch (type) {
741
741
  case "add":
742
- return SelectionChangeEvent_1.SelectionChangeType.Add;
742
+ return SelectionChangeEvent_js_1.SelectionChangeType.Add;
743
743
  case "remove":
744
- return SelectionChangeEvent_1.SelectionChangeType.Remove;
744
+ return SelectionChangeEvent_js_1.SelectionChangeType.Remove;
745
745
  case "replace":
746
- return SelectionChangeEvent_1.SelectionChangeType.Replace;
746
+ return SelectionChangeEvent_js_1.SelectionChangeType.Replace;
747
747
  case "clear":
748
- return SelectionChangeEvent_1.SelectionChangeType.Clear;
748
+ return SelectionChangeEvent_js_1.SelectionChangeType.Clear;
749
749
  }
750
750
  }
751
751
  //# sourceMappingURL=SelectionManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+BAAqG;AACrG,sDAA+D;AAC/D,wDAAiH;AACjH,oEAA0J;AAC1J,gEASkC;AAClC,kDAA+C;AAC/C,2DAAmE;AAEnE,iEAA6G;AAC7G,qEAA6F;AA2B7F;;;;GAIG;AACH,MAAa,gBAAgB;IACnB,iBAAiB,CAAuC;IACxD,gCAAgC,GAAG,IAAI,GAAG,EAAoF,CAAC;IAC/H,mBAAmB,GAAG,IAAI,GAAG,EAAuC,CAAC;IACrE,YAAY,CAAU;IAEtB,aAAa,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC5C,iBAAiB,GAAG,IAAI,uBAAuB,EAAE,CAAC;IAClD,iBAAiB,GAAG,IAAI,cAAO,EAAmC,CAAC;IACnE,4BAA4B,CAAe;IAC3C,UAAU,GAAsB,EAAE,CAAC;IAE3C;;;OAGG;IACa,gBAAgB,CAAmB;IAEnD,2DAA2D;IAC3C,eAAe,CAAuB;IAEtD,kGAAkG;IAClF,MAAM,CAAyB;IAE/C;;OAEG;IACH,YAAY,KAA4B;QACtC,IAAI,CAAC,eAAe,GAAG,IAAI,2CAAoB,EAAE,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC3B,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,IAAI,IAAA,iCAAa,GAAE,CAAC;QAClE,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,gBAAgB,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,GA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CAAC,KAAK,EAAE,EAAE,CAAC;QACxC,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAa;IAC9B,MAAM,GAAG,GAAG,IAAmB,CAAC;IAChC,OAAO,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC;AAClE,CAAC;AAED,SAAS,aAAa,CAAC,IAAgC;IACrD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,KAAK;YACR,OAAO,0CAAmB,CAAC,GAAG,CAAC;QACjC,KAAK,QAAQ;YACX,OAAO,0CAAmB,CAAC,MAAM,CAAC;QACpC,KAAK,SAAS;YACZ,OAAO,0CAAmB,CAAC,OAAO,CAAC;QACrC,KAAK,OAAO;YACV,OAAO,0CAAmB,CAAC,KAAK,CAAC;IACrC,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/* eslint-disable @typescript-eslint/no-deprecated */\n/** @packageDocumentation\n * @module UnifiedSelection\n */\n\nimport { defer, EMPTY, mergeMap, Observable, of, Subject, Subscription, takeUntil, tap } from \"rxjs\";\nimport { Id64, Id64Arg, Id64Array } from \"@itwin/core-bentley\";\nimport { IModelConnection, SelectableIds, SelectionSetEvent, SelectionSetEventType } from \"@itwin/core-frontend\";\nimport { AsyncTasksTracker, BaseNodeKey, InstanceKey, Key, Keys, KeySet, NodeKey, SelectionScope, SelectionScopeProps } from \"@itwin/presentation-common\";\nimport {\n createStorage,\n CustomSelectable,\n Selectable,\n Selectables,\n SelectionStorage,\n StorageSelectionChangeEventArgs,\n StorageSelectionChangeType,\n TRANSIENT_ELEMENT_CLASSNAME,\n} from \"@itwin/unified-selection\";\nimport { Presentation } from \"../Presentation\";\nimport { HiliteSet, HiliteSetProvider } from \"./HiliteSetProvider\";\nimport { ISelectionProvider } from \"./ISelectionProvider\";\nimport { SelectionChangeEvent, SelectionChangeEventArgs, SelectionChangeType } from \"./SelectionChangeEvent\";\nimport { createSelectionScopeProps, SelectionScopesManager } from \"./SelectionScopesManager\";\n\n/**\n * Properties for creating [[SelectionManager]].\n * @public\n * @deprecated in 5.0. Use `SelectionStorage` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md) package instead.\n */\nexport interface SelectionManagerProps {\n /** A manager for [selection scopes]($docs/presentation/unified-selection/index#selection-scopes) */\n scopes: SelectionScopesManager;\n\n /**\n * Custom unified selection storage to be used by [[SelectionManager]]. If not provided [[SelectionManager]] creates\n * and maintains storage.\n */\n selectionStorage?: SelectionStorage;\n\n /**\n * An optional function that returns a key for the given iModel. The key is what \"glues\" iModel selection\n * changes made in `selectionStorage`, where iModels are identified by key, and `SelectionManager`, where\n * iModels are specified as `IModelConnection`.\n *\n * If not provided, [IModelConnection.key]($core-frontend) or [IModelConnection.name]($core-frontend) is used.\n */\n imodelKeyFactory?: (imodel: IModelConnection) => string;\n}\n\n/**\n * The selection manager which stores the overall selection.\n * @public\n * @deprecated in 5.0. Use `SelectionStorage` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md) package instead.\n */\nexport class SelectionManager implements ISelectionProvider, Disposable {\n private _imodelKeyFactory: (imodel: IModelConnection) => string;\n private _imodelToolSelectionSyncHandlers = new Map<IModelConnection, { requestorsCount: number; handler: ToolSelectionSyncHandler }>();\n private _hiliteSetProviders = new Map<IModelConnection, HiliteSetProvider>();\n private _ownsStorage: boolean;\n\n private _knownIModels = new Set<IModelConnection>();\n private _currentSelection = new CurrentSelectionStorage();\n private _selectionChanges = new Subject<StorageSelectionChangeEventArgs>();\n private _selectionEventsSubscription: Subscription;\n private _listeners: Array<() => void> = [];\n\n /**\n * Underlying selection storage used by this selection manager. Ideally, consumers should use\n * the storage directly instead of using this manager to manipulate selection.\n */\n public readonly selectionStorage: SelectionStorage;\n\n /** An event which gets broadcasted on selection changes */\n public readonly selectionChange: SelectionChangeEvent;\n\n /** Manager for [selection scopes]($docs/presentation/unified-selection/index#selection-scopes) */\n public readonly scopes: SelectionScopesManager;\n\n /**\n * Creates an instance of SelectionManager.\n */\n constructor(props: SelectionManagerProps) {\n this.selectionChange = new SelectionChangeEvent();\n this.scopes = props.scopes;\n this.selectionStorage = props.selectionStorage ?? createStorage();\n this._imodelKeyFactory = props.imodelKeyFactory ?? ((imodel) => (imodel.key.length ? imodel.key : imodel.name));\n this._ownsStorage = props.selectionStorage === undefined;\n this.selectionStorage.selectionChangeEvent.addListener((args) => this._selectionChanges.next(args));\n this._selectionEventsSubscription = this.streamSelectionEvents();\n this._listeners.push(\n IModelConnection.onOpen.addListener((imodel) => {\n this._knownIModels.add(imodel);\n }),\n );\n this._listeners.push(\n IModelConnection.onClose.addListener((imodel: IModelConnection) => {\n this.onConnectionClose(imodel);\n }),\n );\n }\n\n public [Symbol.dispose]() {\n this._selectionEventsSubscription.unsubscribe();\n this._listeners.forEach((dispose) => dispose());\n }\n\n /** @deprecated in 5.0. Use [Symbol.dispose] instead. */\n // istanbul ignore next\n public dispose() {\n this[Symbol.dispose]();\n }\n\n private onConnectionClose(imodel: IModelConnection): void {\n const imodelKey = this._imodelKeyFactory(imodel);\n this._hiliteSetProviders.delete(imodel);\n this._knownIModels.delete(imodel);\n this._currentSelection.clear(imodelKey);\n if (this._ownsStorage) {\n this.clearSelection(\"Connection Close Event\", imodel);\n this.selectionStorage.clearStorage({ imodelKey });\n }\n }\n\n /** @internal */\n // istanbul ignore next\n public getToolSelectionSyncHandler(imodel: IModelConnection) {\n return this._imodelToolSelectionSyncHandlers.get(imodel)?.handler;\n }\n\n /**\n * Request the manager to sync with imodel's tool selection (see `IModelConnection.selectionSet`).\n */\n public setSyncWithIModelToolSelection(imodel: IModelConnection, sync = true) {\n const registration = this._imodelToolSelectionSyncHandlers.get(imodel);\n if (sync) {\n if (!registration || registration.requestorsCount === 0) {\n this._imodelToolSelectionSyncHandlers.set(imodel, { requestorsCount: 1, handler: new ToolSelectionSyncHandler(imodel, this) });\n } else {\n this._imodelToolSelectionSyncHandlers.set(imodel, { ...registration, requestorsCount: registration.requestorsCount + 1 });\n }\n } else {\n if (registration && registration.requestorsCount > 0) {\n const requestorsCount = registration.requestorsCount - 1;\n if (requestorsCount > 0) {\n this._imodelToolSelectionSyncHandlers.set(imodel, { ...registration, requestorsCount });\n } else {\n this._imodelToolSelectionSyncHandlers.delete(imodel);\n registration.handler[Symbol.dispose]();\n }\n }\n }\n }\n\n /**\n * Temporarily suspends tool selection synchronization until the returned `Disposable`\n * is disposed.\n */\n public suspendIModelToolSelectionSync(imodel: IModelConnection) {\n const registration = this._imodelToolSelectionSyncHandlers.get(imodel);\n if (!registration) {\n const noop = () => {};\n return { [Symbol.dispose]: noop, dispose: noop };\n }\n\n const wasSuspended = registration.handler.isSuspended;\n registration.handler.isSuspended = true;\n const doDispose = () => (registration.handler.isSuspended = wasSuspended);\n return { [Symbol.dispose]: doDispose, dispose: doDispose };\n }\n\n /** Get the selection levels currently stored in this manager for the specified imodel */\n public getSelectionLevels(imodel: IModelConnection): number[] {\n const imodelKey = this._imodelKeyFactory(imodel);\n return this.selectionStorage.getSelectionLevels({ imodelKey });\n }\n\n /**\n * Get the selection currently stored in this manager\n *\n * @note Calling immediately after `add*`|`replace*`|`remove*`|`clear*` method call does not guarantee\n * that returned `KeySet` will include latest changes. Listen for `selectionChange` event to get the\n * latest selection after changes.\n */\n public getSelection(imodel: IModelConnection, level: number = 0): Readonly<KeySet> {\n const imodelKey = this._imodelKeyFactory(imodel);\n return this._currentSelection.getSelection(imodelKey, level);\n }\n\n private handleEvent(evt: SelectionChangeEventArgs): void {\n const imodelKey = this._imodelKeyFactory(evt.imodel);\n this._knownIModels.add(evt.imodel);\n switch (evt.changeType) {\n case SelectionChangeType.Add:\n this.selectionStorage.addToSelection({\n imodelKey,\n source: evt.source,\n level: evt.level,\n selectables: keysToSelectable(evt.imodel, evt.keys),\n });\n break;\n case SelectionChangeType.Remove:\n this.selectionStorage.removeFromSelection({\n imodelKey,\n source: evt.source,\n level: evt.level,\n selectables: keysToSelectable(evt.imodel, evt.keys),\n });\n break;\n case SelectionChangeType.Replace:\n this.selectionStorage.replaceSelection({\n imodelKey,\n source: evt.source,\n level: evt.level,\n selectables: keysToSelectable(evt.imodel, evt.keys),\n });\n break;\n case SelectionChangeType.Clear:\n this.selectionStorage.clearSelection({ imodelKey, source: evt.source, level: evt.level });\n break;\n }\n }\n\n /**\n * Add keys to the selection\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param keys Keys to add\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public addToSelection(source: string, imodel: IModelConnection, keys: Keys, level: number = 0, rulesetId?: string): void {\n const evt: SelectionChangeEventArgs = {\n source,\n level,\n imodel,\n changeType: SelectionChangeType.Add,\n keys: new KeySet(keys),\n timestamp: new Date(),\n rulesetId,\n };\n this.handleEvent(evt);\n }\n\n /**\n * Remove keys from current selection\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param keys Keys to remove\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public removeFromSelection(source: string, imodel: IModelConnection, keys: Keys, level: number = 0, rulesetId?: string): void {\n const evt: SelectionChangeEventArgs = {\n source,\n level,\n imodel,\n changeType: SelectionChangeType.Remove,\n keys: new KeySet(keys),\n timestamp: new Date(),\n rulesetId,\n };\n this.handleEvent(evt);\n }\n\n /**\n * Replace current selection\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param keys Keys to add\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public replaceSelection(source: string, imodel: IModelConnection, keys: Keys, level: number = 0, rulesetId?: string): void {\n const evt: SelectionChangeEventArgs = {\n source,\n level,\n imodel,\n changeType: SelectionChangeType.Replace,\n keys: new KeySet(keys),\n timestamp: new Date(),\n rulesetId,\n };\n this.handleEvent(evt);\n }\n\n /**\n * Clear current selection\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public clearSelection(source: string, imodel: IModelConnection, level: number = 0, rulesetId?: string): void {\n const evt: SelectionChangeEventArgs = {\n source,\n level,\n imodel,\n changeType: SelectionChangeType.Clear,\n keys: new KeySet(),\n timestamp: new Date(),\n rulesetId,\n };\n this.handleEvent(evt);\n }\n\n /**\n * Add keys to selection after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param ids Element IDs to add\n * @param scope Selection scope to apply\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public async addToSelectionWithScope(\n source: string,\n imodel: IModelConnection,\n ids: Id64Arg,\n scope: SelectionScopeProps | SelectionScope | string,\n level: number = 0,\n rulesetId?: string,\n ): Promise<void> {\n const scopedKeys = await this.scopes.computeSelection(imodel, ids, scope);\n this.addToSelection(source, imodel, scopedKeys, level, rulesetId);\n }\n\n /**\n * Remove keys from current selection after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param ids Element IDs to remove\n * @param scope Selection scope to apply\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public async removeFromSelectionWithScope(\n source: string,\n imodel: IModelConnection,\n ids: Id64Arg,\n scope: SelectionScopeProps | SelectionScope | string,\n level: number = 0,\n rulesetId?: string,\n ): Promise<void> {\n const scopedKeys = await this.scopes.computeSelection(imodel, ids, scope);\n this.removeFromSelection(source, imodel, scopedKeys, level, rulesetId);\n }\n\n /**\n * Replace current selection with keys after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param ids Element IDs to replace with\n * @param scope Selection scope to apply\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public async replaceSelectionWithScope(\n source: string,\n imodel: IModelConnection,\n ids: Id64Arg,\n scope: SelectionScopeProps | SelectionScope | string,\n level: number = 0,\n rulesetId?: string,\n ): Promise<void> {\n const scopedKeys = await this.scopes.computeSelection(imodel, ids, scope);\n this.replaceSelection(source, imodel, scopedKeys, level, rulesetId);\n }\n\n /**\n * Get the current hilite set for the specified imodel\n * @public\n */\n public async getHiliteSet(imodel: IModelConnection): Promise<HiliteSet> {\n return this.getHiliteSetProvider(imodel).getHiliteSet(this.getSelection(imodel));\n }\n\n /**\n * Get the current hilite set iterator for the specified imodel.\n * @public\n */\n public getHiliteSetIterator(imodel: IModelConnection) {\n return this.getHiliteSetProvider(imodel).getHiliteSetIterator(this.getSelection(imodel));\n }\n\n private getHiliteSetProvider(imodel: IModelConnection) {\n let provider = this._hiliteSetProviders.get(imodel);\n if (!provider) {\n provider = HiliteSetProvider.create({ imodel });\n this._hiliteSetProviders.set(imodel, provider);\n }\n return provider;\n }\n\n private streamSelectionEvents() {\n return this._selectionChanges\n .pipe(\n mergeMap((args) => {\n const currentSelectables = this.selectionStorage.getSelection({ imodelKey: args.imodelKey, level: args.level });\n return this._currentSelection.computeSelection(args.imodelKey, args.level, currentSelectables, args.selectables).pipe(\n mergeMap(({ level, changedSelection }): Observable<SelectionChangeEventArgs> => {\n const imodel = findIModel(this._knownIModels, this._imodelKeyFactory, args.imodelKey);\n // istanbul ignore if\n if (!imodel) {\n return EMPTY;\n }\n return of({\n imodel,\n keys: changedSelection,\n level,\n source: args.source,\n timestamp: args.timestamp,\n changeType: getChangeType(args.changeType),\n });\n }),\n );\n }),\n )\n .subscribe({\n next: (args) => {\n this.selectionChange.raiseEvent(args, this);\n },\n });\n }\n}\n\nfunction findIModel(set: Set<IModelConnection>, imodelKeyFactory: (imodel: IModelConnection) => string, key: string) {\n for (const imodel of set) {\n if (imodelKeyFactory(imodel) === key) {\n return imodel;\n }\n }\n return undefined;\n}\n\n/** @internal */\nexport class ToolSelectionSyncHandler implements Disposable {\n private _selectionSourceName = \"Tool\";\n private _logicalSelection: SelectionManager;\n private _imodel: IModelConnection;\n private _imodelToolSelectionListenerDisposeFunc: () => void;\n private _asyncsTracker = new AsyncTasksTracker();\n public isSuspended?: boolean;\n\n public constructor(imodel: IModelConnection, logicalSelection: SelectionManager) {\n this._imodel = imodel;\n this._logicalSelection = logicalSelection;\n this._imodelToolSelectionListenerDisposeFunc = imodel.selectionSet.onChanged.addListener(this.onToolSelectionChanged);\n }\n\n public [Symbol.dispose]() {\n this._imodelToolSelectionListenerDisposeFunc();\n }\n\n /** note: used only it tests */\n public get pendingAsyncs() {\n return this._asyncsTracker.pendingAsyncs;\n }\n\n private onToolSelectionChanged = async (ev: SelectionSetEvent): Promise<void> => {\n // ignore selection change event if the handler is suspended\n if (this.isSuspended) {\n return;\n }\n\n // this component only cares about its own imodel\n const imodel = ev.set.iModel;\n if (imodel !== this._imodel) {\n return;\n }\n\n // determine the level of selection changes\n // wip: may want to allow selecting at different levels?\n const selectionLevel = 0;\n\n let ids: SelectableIds;\n switch (ev.type) {\n case SelectionSetEventType.Add:\n ids = ev.additions;\n break;\n case SelectionSetEventType.Replace:\n ids = ev.set.active;\n break;\n default:\n ids = ev.removals;\n break;\n }\n\n // we're always using scoped selection changer even if the scope is set to \"element\" - that\n // makes sure we're adding to selection keys with concrete classes and not \"BisCore:Element\", which\n // we can't because otherwise our keys compare fails (presentation components load data with\n // concrete classes)\n const changer = new ScopedSelectionChanger(\n this._selectionSourceName,\n this._imodel,\n this._logicalSelection,\n createSelectionScopeProps(this._logicalSelection.scopes.activeScope),\n );\n\n using _r = this._asyncsTracker.trackAsyncTask();\n switch (ev.type) {\n case SelectionSetEventType.Add:\n await changer.add(ids, selectionLevel);\n break;\n case SelectionSetEventType.Replace:\n await changer.replace(ids, selectionLevel);\n break;\n case SelectionSetEventType.Remove:\n await changer.remove(ids, selectionLevel);\n break;\n case SelectionSetEventType.Clear:\n await changer.clear(selectionLevel);\n break;\n }\n };\n}\n\nconst parseElementIds = (ids: Id64Arg): { persistent: Id64Arg; transient: Id64Arg } => {\n let allPersistent = true;\n let allTransient = true;\n for (const id of Id64.iterable(ids)) {\n if (Id64.isTransient(id)) {\n allPersistent = false;\n } else {\n allTransient = false;\n }\n\n if (!allPersistent && !allTransient) {\n break;\n }\n }\n\n // avoid making a copy if ids are only persistent or only transient\n if (allPersistent) {\n return { persistent: ids, transient: [] };\n } else if (allTransient) {\n return { persistent: [], transient: ids };\n }\n\n // if `ids` contain mixed ids, we have to copy.. use Array instead of\n // a Set for performance\n const persistentElementIds: Id64Array = [];\n const transientElementIds: Id64Array = [];\n for (const id of Id64.iterable(ids)) {\n if (Id64.isTransient(id)) {\n transientElementIds.push(id);\n } else {\n persistentElementIds.push(id);\n }\n }\n\n return { persistent: persistentElementIds, transient: transientElementIds };\n};\n\nfunction addKeys(target: KeySet, className: string, ids: Id64Arg) {\n for (const id of Id64.iterable(ids)) {\n target.add({ className, id });\n }\n}\n\nclass ScopedSelectionChanger {\n public readonly name: string;\n public readonly imodel: IModelConnection;\n public readonly manager: SelectionManager;\n public readonly scope: SelectionScopeProps | SelectionScope | string;\n public constructor(name: string, imodel: IModelConnection, manager: SelectionManager, scope: SelectionScopeProps | SelectionScope | string) {\n this.name = name;\n this.imodel = imodel;\n this.manager = manager;\n this.scope = scope;\n }\n public async clear(level: number): Promise<void> {\n this.manager.clearSelection(this.name, this.imodel, level);\n }\n public async add(ids: SelectableIds, level: number): Promise<void> {\n const keys = await this.#computeSelection(ids);\n this.manager.addToSelection(this.name, this.imodel, keys, level);\n }\n public async remove(ids: SelectableIds, level: number): Promise<void> {\n const keys = await this.#computeSelection(ids);\n this.manager.removeFromSelection(this.name, this.imodel, keys, level);\n }\n public async replace(ids: SelectableIds, level: number): Promise<void> {\n const keys = await this.#computeSelection(ids);\n this.manager.replaceSelection(this.name, this.imodel, keys, level);\n }\n async #computeSelection(ids: SelectableIds) {\n let keys = new KeySet();\n if (ids.elements) {\n const { persistent, transient } = parseElementIds(ids.elements);\n keys = await this.manager.scopes.computeSelection(this.imodel, persistent, this.scope);\n addKeys(keys, TRANSIENT_ELEMENT_CLASSNAME, transient);\n }\n if (ids.models) {\n addKeys(keys, \"BisCore.Model\", ids.models);\n }\n if (ids.subcategories) {\n addKeys(keys, \"BisCore.SubCategory\", ids.subcategories);\n }\n return keys;\n }\n}\n\n/** Stores current selection in `KeySet` format per iModel. */\nclass CurrentSelectionStorage {\n private _currentSelection = new Map<string, IModelSelectionStorage>();\n\n private getCurrentSelectionStorage(imodelKey: string) {\n let storage = this._currentSelection.get(imodelKey);\n if (!storage) {\n storage = new IModelSelectionStorage();\n this._currentSelection.set(imodelKey, storage);\n }\n return storage;\n }\n\n public getSelection(imodelKey: string, level: number) {\n return this.getCurrentSelectionStorage(imodelKey).getSelection(level);\n }\n\n public clear(imodelKey: string) {\n this._currentSelection.delete(imodelKey);\n }\n\n public computeSelection(imodelKey: string, level: number, currSelectables: Selectables, changedSelectables: Selectables) {\n return this.getCurrentSelectionStorage(imodelKey).computeSelection(level, currSelectables, changedSelectables);\n }\n}\n\ninterface StorageEntry {\n value: KeySet;\n ongoingComputationDisposers: Set<Subject<void>>;\n}\n\n/**\n * Computes and stores current selection in `KeySet` format.\n * It always stores result of latest resolved call to `computeSelection`.\n */\nclass IModelSelectionStorage {\n private _currentSelection = new Map<number, StorageEntry>();\n\n public getSelection(level: number): KeySet {\n let entry = this._currentSelection.get(level);\n if (!entry) {\n entry = { value: new KeySet(), ongoingComputationDisposers: new Set() };\n this._currentSelection.set(level, entry);\n }\n return entry.value;\n }\n\n private clearSelections(level: number) {\n const clearedLevels = [];\n for (const [storedLevel] of this._currentSelection.entries()) {\n if (storedLevel > level) {\n clearedLevels.push(storedLevel);\n }\n }\n clearedLevels.forEach((storedLevel) => {\n const entry = this._currentSelection.get(storedLevel);\n // istanbul ignore if\n if (!entry) {\n return;\n }\n\n for (const disposer of entry.ongoingComputationDisposers) {\n disposer.next();\n }\n this._currentSelection.delete(storedLevel);\n });\n }\n\n private addDisposer(level: number, disposer: Subject<void>) {\n const entry = this._currentSelection.get(level);\n if (!entry) {\n this._currentSelection.set(level, { value: new KeySet(), ongoingComputationDisposers: new Set([disposer]) });\n return;\n }\n entry.ongoingComputationDisposers.add(disposer);\n }\n\n private setSelection(level: number, keys: KeySet, disposer: Subject<void>) {\n const currEntry = this._currentSelection.get(level);\n // istanbul ignore else\n if (currEntry) {\n currEntry.ongoingComputationDisposers.delete(disposer);\n }\n this._currentSelection.set(level, {\n value: keys,\n ongoingComputationDisposers: currEntry?.ongoingComputationDisposers ?? /* istanbul ignore next */ new Set(),\n });\n }\n\n public computeSelection(level: number, currSelectables: Selectables, changedSelectables: Selectables) {\n this.clearSelections(level);\n\n const prevComputationsDisposers = [...(this._currentSelection.get(level)?.ongoingComputationDisposers ?? [])];\n const currDisposer = new Subject<void>();\n this.addDisposer(level, currDisposer);\n\n return defer(async () => {\n const convertedSelectables: SelectableKeys[] = [];\n const [current, changed] = await Promise.all([\n selectablesToKeys(currSelectables, convertedSelectables),\n selectablesToKeys(changedSelectables, convertedSelectables),\n ]);\n\n const currentSelection = new KeySet([...current.keys, ...current.selectableKeys.flatMap((selectable) => selectable.keys)]);\n const changedSelection = new KeySet([...changed.keys, ...changed.selectableKeys.flatMap((selectable) => selectable.keys)]);\n\n return {\n level,\n currentSelection,\n changedSelection,\n };\n }).pipe(\n takeUntil(currDisposer),\n tap({\n next: (val) => {\n prevComputationsDisposers.forEach((disposer) => disposer.next());\n this.setSelection(val.level, val.currentSelection, currDisposer);\n },\n }),\n );\n }\n}\n\nfunction keysToSelectable(imodel: IModelConnection, keys: Readonly<KeySet>) {\n const selectables: Selectable[] = [];\n keys.forEach((key) => {\n if (\"id\" in key) {\n selectables.push(key);\n return;\n }\n\n const customSelectable: CustomSelectable = {\n identifier: key.pathFromRoot.join(\"/\"),\n data: key,\n loadInstanceKeys: () => createInstanceKeysIterator(imodel, key),\n };\n selectables.push(customSelectable);\n });\n return selectables;\n}\n\ninterface SelectableKeys {\n identifier: string;\n keys: Key[];\n}\n\nasync function selectablesToKeys(selectables: Selectables, convertedList: SelectableKeys[]) {\n const keys: Key[] = [];\n const selectableKeys: SelectableKeys[] = [];\n\n for (const [className, ids] of selectables.instanceKeys) {\n for (const id of ids) {\n keys.push({ id, className });\n }\n }\n\n for (const [_, selectable] of selectables.custom) {\n if (isNodeKey(selectable.data)) {\n selectableKeys.push({ identifier: selectable.identifier, keys: [selectable.data] });\n continue;\n }\n const converted = convertedList.find((con) => con.identifier === selectable.identifier);\n if (converted) {\n selectableKeys.push(converted);\n continue;\n }\n\n const newConverted: SelectableKeys = { identifier: selectable.identifier, keys: [] };\n convertedList.push(newConverted);\n for await (const instanceKey of selectable.loadInstanceKeys()) {\n newConverted.keys.push(instanceKey);\n }\n selectableKeys.push(newConverted);\n }\n\n return { keys, selectableKeys };\n}\n\nasync function* createInstanceKeysIterator(imodel: IModelConnection, nodeKey: NodeKey): AsyncIterableIterator<InstanceKey> {\n if (NodeKey.isInstancesNodeKey(nodeKey)) {\n for (const key of nodeKey.instanceKeys) {\n yield key;\n }\n return;\n }\n\n const content = await Presentation.presentation.getContentInstanceKeys({\n imodel,\n keys: new KeySet([nodeKey]),\n rulesetOrId: {\n id: \"grouped-instances\",\n rules: [\n {\n ruleType: \"Content\",\n specifications: [\n {\n specType: \"SelectedNodeInstances\",\n },\n ],\n },\n ],\n },\n });\n\n for await (const key of content.items()) {\n yield key;\n }\n}\n\nfunction isNodeKey(data: unknown): data is NodeKey {\n const key = data as BaseNodeKey;\n return key.pathFromRoot !== undefined && key.type !== undefined;\n}\n\nfunction getChangeType(type: StorageSelectionChangeType): SelectionChangeType {\n switch (type) {\n case \"add\":\n return SelectionChangeType.Add;\n case \"remove\":\n return SelectionChangeType.Remove;\n case \"replace\":\n return SelectionChangeType.Replace;\n case \"clear\":\n return SelectionChangeType.Clear;\n }\n}\n"]}
1
+ {"version":3,"file":"SelectionManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+BAAqG;AACrG,sDAA+D;AAC/D,wDAAiH;AACjH,oEAAuI;AACvI,kEAAwE;AACxE,gEASkC;AAClC,wDAAkD;AAClD,iEAAsE;AAEtE,uEAAgH;AAChH,2EAAgG;AA2BhG;;;;GAIG;AACH,MAAa,gBAAgB;IACnB,iBAAiB,CAAuC;IACxD,gCAAgC,GAAG,IAAI,GAAG,EAAoF,CAAC;IAC/H,mBAAmB,GAAG,IAAI,GAAG,EAAuC,CAAC;IACrE,YAAY,CAAU;IAEtB,aAAa,GAAG,IAAI,GAAG,EAAoB,CAAC;IAC5C,iBAAiB,GAAG,IAAI,uBAAuB,EAAE,CAAC;IAClD,iBAAiB,GAAG,IAAI,cAAO,EAAmC,CAAC;IACnE,4BAA4B,CAAe;IAC3C,UAAU,GAAsB,EAAE,CAAC;IAE3C;;;OAGG;IACa,gBAAgB,CAAmB;IAEnD,2DAA2D;IAC3C,eAAe,CAAuB;IAEtD,kGAAkG;IAClF,MAAM,CAAyB;IAE/C;;OAEG;IACH,YAAY,KAA4B;QACtC,IAAI,CAAC,eAAe,GAAG,IAAI,8CAAoB,EAAE,CAAC;QACl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WAAW,EAAE;YACX,EAAE,EAAE,mBAAmB;YACvB,KAAK,EAAE;gBACL;oBACE,QAAQ,EAAE,SAAS;oBACnB,cAAc,EAAE;wBACd;4BACE,QAAQ,EAAE,uBAAuB;yBAClC;qBACF;iBACF;aACF;SACF;KACF,CAAC,CAAC;IAEH,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;QACxC,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAa;IAC9B,MAAM,GAAG,GAAG,IAAmB,CAAC;IAChC,OAAO,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC;AAClE,CAAC;AAED,SAAS,aAAa,CAAC,IAAgC;IACrD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,KAAK;YACR,OAAO,6CAAmB,CAAC,GAAG,CAAC;QACjC,KAAK,QAAQ;YACX,OAAO,6CAAmB,CAAC,MAAM,CAAC;QACpC,KAAK,SAAS;YACZ,OAAO,6CAAmB,CAAC,OAAO,CAAC;QACrC,KAAK,OAAO;YACV,OAAO,6CAAmB,CAAC,KAAK,CAAC;IACrC,CAAC;AACH,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/* eslint-disable @typescript-eslint/no-deprecated */\n/** @packageDocumentation\n * @module UnifiedSelection\n */\n\nimport { defer, EMPTY, mergeMap, Observable, of, Subject, Subscription, takeUntil, tap } from \"rxjs\";\nimport { Id64, Id64Arg, Id64Array } from \"@itwin/core-bentley\";\nimport { IModelConnection, SelectableIds, SelectionSetEvent, SelectionSetEventType } from \"@itwin/core-frontend\";\nimport { BaseNodeKey, InstanceKey, Key, Keys, KeySet, NodeKey, SelectionScope, SelectionScopeProps } from \"@itwin/presentation-common\";\nimport { AsyncTasksTracker } from \"@itwin/presentation-common/internal\";\nimport {\n createStorage,\n CustomSelectable,\n Selectable,\n Selectables,\n SelectionStorage,\n StorageSelectionChangeEventArgs,\n StorageSelectionChangeType,\n TRANSIENT_ELEMENT_CLASSNAME,\n} from \"@itwin/unified-selection\";\nimport { Presentation } from \"../Presentation.js\";\nimport { HiliteSet, HiliteSetProvider } from \"./HiliteSetProvider.js\";\nimport { ISelectionProvider } from \"./ISelectionProvider.js\";\nimport { SelectionChangeEvent, SelectionChangeEventArgs, SelectionChangeType } from \"./SelectionChangeEvent.js\";\nimport { createSelectionScopeProps, SelectionScopesManager } from \"./SelectionScopesManager.js\";\n\n/**\n * Properties for creating [[SelectionManager]].\n * @public\n * @deprecated in 5.0. Use `SelectionStorage` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md) package instead.\n */\nexport interface SelectionManagerProps {\n /** A manager for [selection scopes]($docs/presentation/unified-selection/index#selection-scopes) */\n scopes: SelectionScopesManager;\n\n /**\n * Custom unified selection storage to be used by [[SelectionManager]]. If not provided [[SelectionManager]] creates\n * and maintains storage.\n */\n selectionStorage?: SelectionStorage;\n\n /**\n * An optional function that returns a key for the given iModel. The key is what \"glues\" iModel selection\n * changes made in `selectionStorage`, where iModels are identified by key, and `SelectionManager`, where\n * iModels are specified as `IModelConnection`.\n *\n * If not provided, [IModelConnection.key]($core-frontend) or [IModelConnection.name]($core-frontend) is used.\n */\n imodelKeyFactory?: (imodel: IModelConnection) => string;\n}\n\n/**\n * The selection manager which stores the overall selection.\n * @public\n * @deprecated in 5.0. Use `SelectionStorage` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md) package instead.\n */\nexport class SelectionManager implements ISelectionProvider, Disposable {\n private _imodelKeyFactory: (imodel: IModelConnection) => string;\n private _imodelToolSelectionSyncHandlers = new Map<IModelConnection, { requestorsCount: number; handler: ToolSelectionSyncHandler }>();\n private _hiliteSetProviders = new Map<IModelConnection, HiliteSetProvider>();\n private _ownsStorage: boolean;\n\n private _knownIModels = new Set<IModelConnection>();\n private _currentSelection = new CurrentSelectionStorage();\n private _selectionChanges = new Subject<StorageSelectionChangeEventArgs>();\n private _selectionEventsSubscription: Subscription;\n private _listeners: Array<() => void> = [];\n\n /**\n * Underlying selection storage used by this selection manager. Ideally, consumers should use\n * the storage directly instead of using this manager to manipulate selection.\n */\n public readonly selectionStorage: SelectionStorage;\n\n /** An event which gets broadcasted on selection changes */\n public readonly selectionChange: SelectionChangeEvent;\n\n /** Manager for [selection scopes]($docs/presentation/unified-selection/index#selection-scopes) */\n public readonly scopes: SelectionScopesManager;\n\n /**\n * Creates an instance of SelectionManager.\n */\n constructor(props: SelectionManagerProps) {\n this.selectionChange = new SelectionChangeEvent();\n this.scopes = props.scopes;\n this.selectionStorage = props.selectionStorage ?? createStorage();\n this._imodelKeyFactory = props.imodelKeyFactory ?? ((imodel) => (imodel.key.length ? imodel.key : imodel.name));\n this._ownsStorage = props.selectionStorage === undefined;\n this.selectionStorage.selectionChangeEvent.addListener((args) => this._selectionChanges.next(args));\n this._selectionEventsSubscription = this.streamSelectionEvents();\n this._listeners.push(\n IModelConnection.onOpen.addListener((imodel) => {\n this._knownIModels.add(imodel);\n }),\n );\n this._listeners.push(\n IModelConnection.onClose.addListener((imodel: IModelConnection) => {\n this.onConnectionClose(imodel);\n }),\n );\n }\n\n public [Symbol.dispose]() {\n this._selectionEventsSubscription.unsubscribe();\n this._listeners.forEach((dispose) => dispose());\n }\n\n /** @deprecated in 5.0. Use [Symbol.dispose] instead. */\n /* c8 ignore next 3 */\n public dispose() {\n this[Symbol.dispose]();\n }\n\n private onConnectionClose(imodel: IModelConnection): void {\n const imodelKey = this._imodelKeyFactory(imodel);\n this._hiliteSetProviders.delete(imodel);\n this._knownIModels.delete(imodel);\n this._currentSelection.clear(imodelKey);\n if (this._ownsStorage) {\n this.clearSelection(\"Connection Close Event\", imodel);\n this.selectionStorage.clearStorage({ imodelKey });\n }\n }\n\n /** @internal */\n /* c8 ignore next 3 */\n public getToolSelectionSyncHandler(imodel: IModelConnection) {\n return this._imodelToolSelectionSyncHandlers.get(imodel)?.handler;\n }\n\n /**\n * Request the manager to sync with imodel's tool selection (see `IModelConnection.selectionSet`).\n */\n public setSyncWithIModelToolSelection(imodel: IModelConnection, sync = true) {\n const registration = this._imodelToolSelectionSyncHandlers.get(imodel);\n if (sync) {\n if (!registration || registration.requestorsCount === 0) {\n this._imodelToolSelectionSyncHandlers.set(imodel, { requestorsCount: 1, handler: new ToolSelectionSyncHandler(imodel, this) });\n } else {\n this._imodelToolSelectionSyncHandlers.set(imodel, { ...registration, requestorsCount: registration.requestorsCount + 1 });\n }\n } else {\n if (registration && registration.requestorsCount > 0) {\n const requestorsCount = registration.requestorsCount - 1;\n if (requestorsCount > 0) {\n this._imodelToolSelectionSyncHandlers.set(imodel, { ...registration, requestorsCount });\n } else {\n this._imodelToolSelectionSyncHandlers.delete(imodel);\n registration.handler[Symbol.dispose]();\n }\n }\n }\n }\n\n /**\n * Temporarily suspends tool selection synchronization until the returned `Disposable`\n * is disposed.\n */\n public suspendIModelToolSelectionSync(imodel: IModelConnection) {\n const registration = this._imodelToolSelectionSyncHandlers.get(imodel);\n if (!registration) {\n const noop = () => {};\n return { [Symbol.dispose]: noop, dispose: noop };\n }\n\n const wasSuspended = registration.handler.isSuspended;\n registration.handler.isSuspended = true;\n const doDispose = () => (registration.handler.isSuspended = wasSuspended);\n return { [Symbol.dispose]: doDispose, dispose: doDispose };\n }\n\n /** Get the selection levels currently stored in this manager for the specified imodel */\n public getSelectionLevels(imodel: IModelConnection): number[] {\n const imodelKey = this._imodelKeyFactory(imodel);\n return this.selectionStorage.getSelectionLevels({ imodelKey });\n }\n\n /**\n * Get the selection currently stored in this manager\n *\n * @note Calling immediately after `add*`|`replace*`|`remove*`|`clear*` method call does not guarantee\n * that returned `KeySet` will include latest changes. Listen for `selectionChange` event to get the\n * latest selection after changes.\n */\n public getSelection(imodel: IModelConnection, level: number = 0): Readonly<KeySet> {\n const imodelKey = this._imodelKeyFactory(imodel);\n return this._currentSelection.getSelection(imodelKey, level);\n }\n\n private handleEvent(evt: SelectionChangeEventArgs): void {\n const imodelKey = this._imodelKeyFactory(evt.imodel);\n this._knownIModels.add(evt.imodel);\n switch (evt.changeType) {\n case SelectionChangeType.Add:\n this.selectionStorage.addToSelection({\n imodelKey,\n source: evt.source,\n level: evt.level,\n selectables: keysToSelectable(evt.imodel, evt.keys),\n });\n break;\n case SelectionChangeType.Remove:\n this.selectionStorage.removeFromSelection({\n imodelKey,\n source: evt.source,\n level: evt.level,\n selectables: keysToSelectable(evt.imodel, evt.keys),\n });\n break;\n case SelectionChangeType.Replace:\n this.selectionStorage.replaceSelection({\n imodelKey,\n source: evt.source,\n level: evt.level,\n selectables: keysToSelectable(evt.imodel, evt.keys),\n });\n break;\n case SelectionChangeType.Clear:\n this.selectionStorage.clearSelection({ imodelKey, source: evt.source, level: evt.level });\n break;\n }\n }\n\n /**\n * Add keys to the selection\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param keys Keys to add\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public addToSelection(source: string, imodel: IModelConnection, keys: Keys, level: number = 0, rulesetId?: string): void {\n const evt: SelectionChangeEventArgs = {\n source,\n level,\n imodel,\n changeType: SelectionChangeType.Add,\n keys: new KeySet(keys),\n timestamp: new Date(),\n rulesetId,\n };\n this.handleEvent(evt);\n }\n\n /**\n * Remove keys from current selection\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param keys Keys to remove\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public removeFromSelection(source: string, imodel: IModelConnection, keys: Keys, level: number = 0, rulesetId?: string): void {\n const evt: SelectionChangeEventArgs = {\n source,\n level,\n imodel,\n changeType: SelectionChangeType.Remove,\n keys: new KeySet(keys),\n timestamp: new Date(),\n rulesetId,\n };\n this.handleEvent(evt);\n }\n\n /**\n * Replace current selection\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param keys Keys to add\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public replaceSelection(source: string, imodel: IModelConnection, keys: Keys, level: number = 0, rulesetId?: string): void {\n const evt: SelectionChangeEventArgs = {\n source,\n level,\n imodel,\n changeType: SelectionChangeType.Replace,\n keys: new KeySet(keys),\n timestamp: new Date(),\n rulesetId,\n };\n this.handleEvent(evt);\n }\n\n /**\n * Clear current selection\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public clearSelection(source: string, imodel: IModelConnection, level: number = 0, rulesetId?: string): void {\n const evt: SelectionChangeEventArgs = {\n source,\n level,\n imodel,\n changeType: SelectionChangeType.Clear,\n keys: new KeySet(),\n timestamp: new Date(),\n rulesetId,\n };\n this.handleEvent(evt);\n }\n\n /**\n * Add keys to selection after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param ids Element IDs to add\n * @param scope Selection scope to apply\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public async addToSelectionWithScope(\n source: string,\n imodel: IModelConnection,\n ids: Id64Arg,\n scope: SelectionScopeProps | SelectionScope | string,\n level: number = 0,\n rulesetId?: string,\n ): Promise<void> {\n const scopedKeys = await this.scopes.computeSelection(imodel, ids, scope);\n this.addToSelection(source, imodel, scopedKeys, level, rulesetId);\n }\n\n /**\n * Remove keys from current selection after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param ids Element IDs to remove\n * @param scope Selection scope to apply\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public async removeFromSelectionWithScope(\n source: string,\n imodel: IModelConnection,\n ids: Id64Arg,\n scope: SelectionScopeProps | SelectionScope | string,\n level: number = 0,\n rulesetId?: string,\n ): Promise<void> {\n const scopedKeys = await this.scopes.computeSelection(imodel, ids, scope);\n this.removeFromSelection(source, imodel, scopedKeys, level, rulesetId);\n }\n\n /**\n * Replace current selection with keys after applying [selection scope]($docs/presentation/unified-selection/index#selection-scopes) on them.\n * @param source Name of the selection source\n * @param imodel iModel associated with the selection\n * @param ids Element IDs to replace with\n * @param scope Selection scope to apply\n * @param level Selection level (see [selection levels documentation section]($docs/presentation/unified-selection/index#selection-levels))\n * @param rulesetId ID of the ruleset in case the selection was changed from a rules-driven control\n */\n public async replaceSelectionWithScope(\n source: string,\n imodel: IModelConnection,\n ids: Id64Arg,\n scope: SelectionScopeProps | SelectionScope | string,\n level: number = 0,\n rulesetId?: string,\n ): Promise<void> {\n const scopedKeys = await this.scopes.computeSelection(imodel, ids, scope);\n this.replaceSelection(source, imodel, scopedKeys, level, rulesetId);\n }\n\n /**\n * Get the current hilite set for the specified imodel\n * @public\n */\n public async getHiliteSet(imodel: IModelConnection): Promise<HiliteSet> {\n return this.getHiliteSetProvider(imodel).getHiliteSet(this.getSelection(imodel));\n }\n\n /**\n * Get the current hilite set iterator for the specified imodel.\n * @public\n */\n public getHiliteSetIterator(imodel: IModelConnection) {\n return this.getHiliteSetProvider(imodel).getHiliteSetIterator(this.getSelection(imodel));\n }\n\n private getHiliteSetProvider(imodel: IModelConnection) {\n let provider = this._hiliteSetProviders.get(imodel);\n if (!provider) {\n provider = HiliteSetProvider.create({ imodel });\n this._hiliteSetProviders.set(imodel, provider);\n }\n return provider;\n }\n\n private streamSelectionEvents() {\n return this._selectionChanges\n .pipe(\n mergeMap((args) => {\n const currentSelectables = this.selectionStorage.getSelection({ imodelKey: args.imodelKey, level: args.level });\n return this._currentSelection.computeSelection(args.imodelKey, args.level, currentSelectables, args.selectables).pipe(\n mergeMap(({ level, changedSelection }): Observable<SelectionChangeEventArgs> => {\n const imodel = findIModel(this._knownIModels, this._imodelKeyFactory, args.imodelKey);\n /* c8 ignore next 3 */\n if (!imodel) {\n return EMPTY;\n }\n return of({\n imodel,\n keys: changedSelection,\n level,\n source: args.source,\n timestamp: args.timestamp,\n changeType: getChangeType(args.changeType),\n });\n }),\n );\n }),\n )\n .subscribe({\n next: (args) => {\n this.selectionChange.raiseEvent(args, this);\n },\n });\n }\n}\n\nfunction findIModel(set: Set<IModelConnection>, imodelKeyFactory: (imodel: IModelConnection) => string, key: string) {\n for (const imodel of set) {\n if (imodelKeyFactory(imodel) === key) {\n return imodel;\n }\n }\n return undefined;\n}\n\n/** @internal */\nexport class ToolSelectionSyncHandler implements Disposable {\n private _selectionSourceName = \"Tool\";\n private _logicalSelection: SelectionManager;\n private _imodel: IModelConnection;\n private _imodelToolSelectionListenerDisposeFunc: () => void;\n private _asyncsTracker = new AsyncTasksTracker();\n public isSuspended?: boolean;\n\n public constructor(imodel: IModelConnection, logicalSelection: SelectionManager) {\n this._imodel = imodel;\n this._logicalSelection = logicalSelection;\n this._imodelToolSelectionListenerDisposeFunc = imodel.selectionSet.onChanged.addListener(this.onToolSelectionChanged);\n }\n\n public [Symbol.dispose]() {\n this._imodelToolSelectionListenerDisposeFunc();\n }\n\n /** note: used only it tests */\n public get pendingAsyncs() {\n return this._asyncsTracker.pendingAsyncs;\n }\n\n private onToolSelectionChanged = async (ev: SelectionSetEvent): Promise<void> => {\n // ignore selection change event if the handler is suspended\n if (this.isSuspended) {\n return;\n }\n\n // this component only cares about its own imodel\n const imodel = ev.set.iModel;\n if (imodel !== this._imodel) {\n return;\n }\n\n // determine the level of selection changes\n // wip: may want to allow selecting at different levels?\n const selectionLevel = 0;\n\n let ids: SelectableIds;\n switch (ev.type) {\n case SelectionSetEventType.Add:\n ids = ev.additions;\n break;\n case SelectionSetEventType.Replace:\n ids = ev.set.active;\n break;\n default:\n ids = ev.removals;\n break;\n }\n\n // we're always using scoped selection changer even if the scope is set to \"element\" - that\n // makes sure we're adding to selection keys with concrete classes and not \"BisCore:Element\", which\n // we can't because otherwise our keys compare fails (presentation components load data with\n // concrete classes)\n const changer = new ScopedSelectionChanger(\n this._selectionSourceName,\n this._imodel,\n this._logicalSelection,\n createSelectionScopeProps(this._logicalSelection.scopes.activeScope),\n );\n\n using _r = this._asyncsTracker.trackAsyncTask();\n switch (ev.type) {\n case SelectionSetEventType.Add:\n await changer.add(ids, selectionLevel);\n break;\n case SelectionSetEventType.Replace:\n await changer.replace(ids, selectionLevel);\n break;\n case SelectionSetEventType.Remove:\n await changer.remove(ids, selectionLevel);\n break;\n case SelectionSetEventType.Clear:\n await changer.clear(selectionLevel);\n break;\n }\n };\n}\n\nconst parseElementIds = (ids: Id64Arg): { persistent: Id64Arg; transient: Id64Arg } => {\n let allPersistent = true;\n let allTransient = true;\n for (const id of Id64.iterable(ids)) {\n if (Id64.isTransient(id)) {\n allPersistent = false;\n } else {\n allTransient = false;\n }\n\n if (!allPersistent && !allTransient) {\n break;\n }\n }\n\n // avoid making a copy if ids are only persistent or only transient\n if (allPersistent) {\n return { persistent: ids, transient: [] };\n } else if (allTransient) {\n return { persistent: [], transient: ids };\n }\n\n // if `ids` contain mixed ids, we have to copy.. use Array instead of\n // a Set for performance\n const persistentElementIds: Id64Array = [];\n const transientElementIds: Id64Array = [];\n for (const id of Id64.iterable(ids)) {\n if (Id64.isTransient(id)) {\n transientElementIds.push(id);\n } else {\n persistentElementIds.push(id);\n }\n }\n\n return { persistent: persistentElementIds, transient: transientElementIds };\n};\n\nfunction addKeys(target: KeySet, className: string, ids: Id64Arg) {\n for (const id of Id64.iterable(ids)) {\n target.add({ className, id });\n }\n}\n\nclass ScopedSelectionChanger {\n public readonly name: string;\n public readonly imodel: IModelConnection;\n public readonly manager: SelectionManager;\n public readonly scope: SelectionScopeProps | SelectionScope | string;\n public constructor(name: string, imodel: IModelConnection, manager: SelectionManager, scope: SelectionScopeProps | SelectionScope | string) {\n this.name = name;\n this.imodel = imodel;\n this.manager = manager;\n this.scope = scope;\n }\n public async clear(level: number): Promise<void> {\n this.manager.clearSelection(this.name, this.imodel, level);\n }\n public async add(ids: SelectableIds, level: number): Promise<void> {\n const keys = await this.#computeSelection(ids);\n this.manager.addToSelection(this.name, this.imodel, keys, level);\n }\n public async remove(ids: SelectableIds, level: number): Promise<void> {\n const keys = await this.#computeSelection(ids);\n this.manager.removeFromSelection(this.name, this.imodel, keys, level);\n }\n public async replace(ids: SelectableIds, level: number): Promise<void> {\n const keys = await this.#computeSelection(ids);\n this.manager.replaceSelection(this.name, this.imodel, keys, level);\n }\n async #computeSelection(ids: SelectableIds) {\n let keys = new KeySet();\n if (ids.elements) {\n const { persistent, transient } = parseElementIds(ids.elements);\n keys = await this.manager.scopes.computeSelection(this.imodel, persistent, this.scope);\n addKeys(keys, TRANSIENT_ELEMENT_CLASSNAME, transient);\n }\n if (ids.models) {\n addKeys(keys, \"BisCore.Model\", ids.models);\n }\n if (ids.subcategories) {\n addKeys(keys, \"BisCore.SubCategory\", ids.subcategories);\n }\n return keys;\n }\n}\n\n/** Stores current selection in `KeySet` format per iModel. */\nclass CurrentSelectionStorage {\n private _currentSelection = new Map<string, IModelSelectionStorage>();\n\n private getCurrentSelectionStorage(imodelKey: string) {\n let storage = this._currentSelection.get(imodelKey);\n if (!storage) {\n storage = new IModelSelectionStorage();\n this._currentSelection.set(imodelKey, storage);\n }\n return storage;\n }\n\n public getSelection(imodelKey: string, level: number) {\n return this.getCurrentSelectionStorage(imodelKey).getSelection(level);\n }\n\n public clear(imodelKey: string) {\n this._currentSelection.delete(imodelKey);\n }\n\n public computeSelection(imodelKey: string, level: number, currSelectables: Selectables, changedSelectables: Selectables) {\n return this.getCurrentSelectionStorage(imodelKey).computeSelection(level, currSelectables, changedSelectables);\n }\n}\n\ninterface StorageEntry {\n value: KeySet;\n ongoingComputationDisposers: Set<Subject<void>>;\n}\n\n/**\n * Computes and stores current selection in `KeySet` format.\n * It always stores result of latest resolved call to `computeSelection`.\n */\nclass IModelSelectionStorage {\n private _currentSelection = new Map<number, StorageEntry>();\n\n public getSelection(level: number): KeySet {\n let entry = this._currentSelection.get(level);\n if (!entry) {\n entry = { value: new KeySet(), ongoingComputationDisposers: new Set() };\n this._currentSelection.set(level, entry);\n }\n return entry.value;\n }\n\n private clearSelections(level: number) {\n const clearedLevels = [];\n for (const [storedLevel] of this._currentSelection.entries()) {\n if (storedLevel > level) {\n clearedLevels.push(storedLevel);\n }\n }\n clearedLevels.forEach((storedLevel) => {\n const entry = this._currentSelection.get(storedLevel);\n /* c8 ignore next 3 */\n if (!entry) {\n return;\n }\n\n for (const disposer of entry.ongoingComputationDisposers) {\n disposer.next();\n }\n this._currentSelection.delete(storedLevel);\n });\n }\n\n private addDisposer(level: number, disposer: Subject<void>) {\n const entry = this._currentSelection.get(level);\n if (!entry) {\n this._currentSelection.set(level, { value: new KeySet(), ongoingComputationDisposers: new Set([disposer]) });\n return;\n }\n entry.ongoingComputationDisposers.add(disposer);\n }\n\n private setSelection(level: number, keys: KeySet, disposer: Subject<void>) {\n const currEntry = this._currentSelection.get(level);\n if (currEntry) {\n currEntry.ongoingComputationDisposers.delete(disposer);\n }\n this._currentSelection.set(level, {\n value: keys,\n ongoingComputationDisposers: currEntry?.ongoingComputationDisposers ?? /* c8 ignore next */ new Set(),\n });\n }\n\n public computeSelection(level: number, currSelectables: Selectables, changedSelectables: Selectables) {\n this.clearSelections(level);\n\n const prevComputationsDisposers = [...(this._currentSelection.get(level)?.ongoingComputationDisposers ?? [])];\n const currDisposer = new Subject<void>();\n this.addDisposer(level, currDisposer);\n\n return defer(async () => {\n const convertedSelectables: SelectableKeys[] = [];\n const [current, changed] = await Promise.all([\n selectablesToKeys(currSelectables, convertedSelectables),\n selectablesToKeys(changedSelectables, convertedSelectables),\n ]);\n\n const currentSelection = new KeySet([...current.keys, ...current.selectableKeys.flatMap((selectable) => selectable.keys)]);\n const changedSelection = new KeySet([...changed.keys, ...changed.selectableKeys.flatMap((selectable) => selectable.keys)]);\n\n return {\n level,\n currentSelection,\n changedSelection,\n };\n }).pipe(\n takeUntil(currDisposer),\n tap({\n next: (val) => {\n prevComputationsDisposers.forEach((disposer) => disposer.next());\n this.setSelection(val.level, val.currentSelection, currDisposer);\n },\n }),\n );\n }\n}\n\nfunction keysToSelectable(imodel: IModelConnection, keys: Readonly<KeySet>) {\n const selectables: Selectable[] = [];\n keys.forEach((key) => {\n if (\"id\" in key) {\n selectables.push(key);\n return;\n }\n\n const customSelectable: CustomSelectable = {\n identifier: key.pathFromRoot.join(\"/\"),\n data: key,\n loadInstanceKeys: () => createInstanceKeysIterator(imodel, key),\n };\n selectables.push(customSelectable);\n });\n return selectables;\n}\n\ninterface SelectableKeys {\n identifier: string;\n keys: Key[];\n}\n\nasync function selectablesToKeys(selectables: Selectables, convertedList: SelectableKeys[]) {\n const keys: Key[] = [];\n const selectableKeys: SelectableKeys[] = [];\n\n for (const [className, ids] of selectables.instanceKeys) {\n for (const id of ids) {\n keys.push({ id, className });\n }\n }\n\n for (const [_, selectable] of selectables.custom) {\n if (isNodeKey(selectable.data)) {\n selectableKeys.push({ identifier: selectable.identifier, keys: [selectable.data] });\n continue;\n }\n const converted = convertedList.find((con) => con.identifier === selectable.identifier);\n if (converted) {\n selectableKeys.push(converted);\n continue;\n }\n\n const newConverted: SelectableKeys = { identifier: selectable.identifier, keys: [] };\n convertedList.push(newConverted);\n for await (const instanceKey of selectable.loadInstanceKeys()) {\n newConverted.keys.push(instanceKey);\n }\n selectableKeys.push(newConverted);\n }\n\n return { keys, selectableKeys };\n}\n\nasync function* createInstanceKeysIterator(imodel: IModelConnection, nodeKey: NodeKey): AsyncIterableIterator<InstanceKey> {\n if (NodeKey.isInstancesNodeKey(nodeKey)) {\n for (const key of nodeKey.instanceKeys) {\n yield key;\n }\n return;\n }\n\n const content = await Presentation.presentation.getContentInstanceKeys({\n imodel,\n keys: new KeySet([nodeKey]),\n rulesetOrId: {\n id: \"grouped-instances\",\n rules: [\n {\n ruleType: \"Content\",\n specifications: [\n {\n specType: \"SelectedNodeInstances\",\n },\n ],\n },\n ],\n },\n });\n\n for await (const key of content.items()) {\n yield key;\n }\n}\n\nfunction isNodeKey(data: unknown): data is NodeKey {\n const key = data as BaseNodeKey;\n return key.pathFromRoot !== undefined && key.type !== undefined;\n}\n\nfunction getChangeType(type: StorageSelectionChangeType): SelectionChangeType {\n switch (type) {\n case \"add\":\n return SelectionChangeType.Add;\n case \"remove\":\n return SelectionChangeType.Remove;\n case \"replace\":\n return SelectionChangeType.Replace;\n case \"clear\":\n return SelectionChangeType.Clear;\n }\n}\n"]}
@@ -3,7 +3,8 @@
3
3
  */
4
4
  import { Id64Arg } from "@itwin/core-bentley";
5
5
  import { IModelConnection } from "@itwin/core-frontend";
6
- import { KeySet, RpcRequestsHandler, SelectionScope, SelectionScopeProps } from "@itwin/presentation-common";
6
+ import { KeySet, SelectionScope, SelectionScopeProps } from "@itwin/presentation-common";
7
+ import { RpcRequestsHandler } from "@itwin/presentation-common/internal";
7
8
  /**
8
9
  * Properties for creating [[SelectionScopesManager]].
9
10
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionScopesManager.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAA2B,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtI;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,yDAAyD;IACzD,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CAC3C;AAED;;;;;;GAMG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,YAAY,CAA4D;gBAE7D,KAAK,EAAE,2BAA2B;IAKrD,wBAAwB;IACxB,IAAW,YAAY,uBAEtB;IAED,2CAA2C;IAC3C,IAAW,WAAW,IAGQ,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,CADtF;IACD,IAAW,WAAW,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,EAEtF;IAED;;;;OAIG;IACU,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAOrG;;;;OAIG;IACU,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAyB7I;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,mBAAmB,CAQ/H"}
1
+ {"version":3,"file":"SelectionScopesManager.d.ts","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":"AAKA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAA2B,MAAM,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAClH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,yDAAyD;IACzD,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;CAC3C;AAED;;;;;;GAMG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,YAAY,CAA4D;gBAE7D,KAAK,EAAE,2BAA2B;IAKrD,wBAAwB;IACxB,IAAW,YAAY,uBAEtB;IAED,2CAA2C;IAC3C,IAAW,WAAW,IAGQ,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,CADtF;IACD,IAAW,WAAW,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,EAEtF;IAED;;;;OAIG;IACU,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAOrG;;;;OAIG;IACU,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAyB7I;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,mBAAmB,CAQ/H"}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectionScopesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;;;AAoGH,8DAQC;AAxG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AC;CACF;AAjED,wDAiEC;AAED;;;;;;GAMG;AACH,SAAgB,yBAAyB,CAAC,KAAgE;IACxG,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IAC3B,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/* eslint-disable @typescript-eslint/no-deprecated */\n/** @packageDocumentation\n * @module UnifiedSelection\n */\n\nimport { Id64Arg } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { DEFAULT_KEYS_BATCH_SIZE, KeySet, RpcRequestsHandler, SelectionScope, SelectionScopeProps } from \"@itwin/presentation-common\";\n\n/**\n * Properties for creating [[SelectionScopesManager]].\n * @public\n * @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\nexport interface SelectionScopesManagerProps {\n /** RPC handler to use for requesting selection scopes */\n rpcRequestsHandler: RpcRequestsHandler;\n\n /** Provider of active locale to use for localizing scopes */\n localeProvider?: () => string | undefined;\n}\n\n/**\n * A manager that knows available [selection scopes]($docs/presentation/unified-selection/index#selection-scopes)\n * and can compute logical selection based on element IDs and selection scope.\n *\n * @public\n * @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\nexport class SelectionScopesManager {\n private _rpcRequestsHandler: RpcRequestsHandler;\n private _getLocale: () => string | undefined;\n private _activeScope: SelectionScopeProps | SelectionScope | string | undefined;\n\n public constructor(props: SelectionScopesManagerProps) {\n this._rpcRequestsHandler = props.rpcRequestsHandler;\n this._getLocale = props.localeProvider ? props.localeProvider : () => undefined;\n }\n\n /** Get active locale */\n public get activeLocale() {\n return this._getLocale();\n }\n\n /** The active selection scope or its id */\n public get activeScope() {\n return this._activeScope;\n }\n public set activeScope(scope: SelectionScopeProps | SelectionScope | string | undefined) {\n this._activeScope = scope;\n }\n\n /**\n * Get available selection scopes.\n * @param imodel The iModel to get selection scopes for\n * @param locale Optional locale to use when localizing scopes' label and description\n */\n public async getSelectionScopes(imodel: IModelConnection, locale?: string): Promise<SelectionScope[]> {\n if (!locale) {\n locale = this._getLocale();\n }\n return this._rpcRequestsHandler.getSelectionScopes({ imodel: imodel.getRpcProps(), locale });\n }\n\n /**\n * Computes keys that need to be added to logical selection based on provided selection scope.\n * @param ids Element IDs to compute selection for\n * @param scope Selection scope to apply\n */\n public async computeSelection(imodel: IModelConnection, ids: Id64Arg, scope: SelectionScopeProps | SelectionScope | string): Promise<KeySet> {\n const scopeProps = createSelectionScopeProps(scope);\n\n // convert ids input to array\n if (typeof ids === \"string\") {\n ids = [ids];\n } else if (ids instanceof Set) {\n ids = [...ids];\n }\n\n // compute selection in batches to avoid HTTP 413\n const keys = new KeySet();\n const batchSize = DEFAULT_KEYS_BATCH_SIZE;\n const batchesCount = Math.ceil(ids.length / batchSize);\n const batchKeyPromises = [];\n for (let batchIndex = 0; batchIndex < batchesCount; ++batchIndex) {\n const batchStart = batchSize * batchIndex;\n const batchEnd = batchStart + batchSize > ids.length ? ids.length : batchStart + batchSize;\n const batchIds = 0 === batchIndex && ids.length <= batchEnd ? ids : ids.slice(batchStart, batchEnd);\n batchKeyPromises.push(this._rpcRequestsHandler.computeSelection({ imodel: imodel.getRpcProps(), elementIds: batchIds, scope: scopeProps }));\n }\n const batchKeys = (await Promise.all(batchKeyPromises)).map((json) => KeySet.fromJSON(json));\n batchKeys.forEach((bk) => keys.add(bk));\n return keys;\n }\n}\n\n/**\n * Normalizes given scope options and returns [[SelectionScopeProps]] that can be used for\n * calculating selection with scope.\n *\n * @public\n * @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\nexport function createSelectionScopeProps(scope: SelectionScopeProps | SelectionScope | string | undefined): SelectionScopeProps {\n if (!scope) {\n return { id: \"element\" };\n }\n if (typeof scope === \"string\") {\n return { id: scope };\n }\n return scope;\n}\n"]}
1
+ {"version":3,"file":"SelectionScopesManager.js","sourceRoot":"","sources":["../../../../src/presentation-frontend/selection/SelectionScopesManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,qDAAqD;AACrD;;GAEG;;;AAqGH,8DAQC;AAzGD,oEAAkH;AAgBlH;;;;;;GAMG;AACH,MAAa,sBAAsB;IACzB,mBAAmB,CAAqB;IACxC,UAAU,CAA2B;IACrC,YAAY,CAA4D;IAEhF,YAAmB,KAAkC;QACnD,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC,kBAAkB,CAAC;QACpD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;IAClF,CAAC;IAED,wBAAwB;IACxB,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IAED,2CAA2C;IAC3C,IAAW,WAAW;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IACD,IAAW,WAAW,CAAC,KAAgE;QACrF,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,kBAAkB,CAAC,MAAwB,EAAE,MAAe;QACvE,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAC7B,CAAC;QACD,OAAO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AmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;QAC9I,CAAC;QACD,MAAM,SAAS,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,4BAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7F,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAjED,wDAiEC;AAED;;;;;;GAMG;AACH,SAAgB,yBAAyB,CAAC,KAAgE;IACxG,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC;IAC3B,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IACvB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/* eslint-disable @typescript-eslint/no-deprecated */\n/** @packageDocumentation\n * @module UnifiedSelection\n */\n\nimport { Id64Arg } from \"@itwin/core-bentley\";\nimport { IModelConnection } from \"@itwin/core-frontend\";\nimport { DEFAULT_KEYS_BATCH_SIZE, KeySet, SelectionScope, SelectionScopeProps } from \"@itwin/presentation-common\";\nimport { RpcRequestsHandler } from \"@itwin/presentation-common/internal\";\n\n/**\n * Properties for creating [[SelectionScopesManager]].\n * @public\n * @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\nexport interface SelectionScopesManagerProps {\n /** RPC handler to use for requesting selection scopes */\n rpcRequestsHandler: RpcRequestsHandler;\n\n /** Provider of active locale to use for localizing scopes */\n localeProvider?: () => string | undefined;\n}\n\n/**\n * A manager that knows available [selection scopes]($docs/presentation/unified-selection/index#selection-scopes)\n * and can compute logical selection based on element IDs and selection scope.\n *\n * @public\n * @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\nexport class SelectionScopesManager {\n private _rpcRequestsHandler: RpcRequestsHandler;\n private _getLocale: () => string | undefined;\n private _activeScope: SelectionScopeProps | SelectionScope | string | undefined;\n\n public constructor(props: SelectionScopesManagerProps) {\n this._rpcRequestsHandler = props.rpcRequestsHandler;\n this._getLocale = props.localeProvider ? props.localeProvider : () => undefined;\n }\n\n /** Get active locale */\n public get activeLocale() {\n return this._getLocale();\n }\n\n /** The active selection scope or its id */\n public get activeScope() {\n return this._activeScope;\n }\n public set activeScope(scope: SelectionScopeProps | SelectionScope | string | undefined) {\n this._activeScope = scope;\n }\n\n /**\n * Get available selection scopes.\n * @param imodel The iModel to get selection scopes for\n * @param locale Optional locale to use when localizing scopes' label and description\n */\n public async getSelectionScopes(imodel: IModelConnection, locale?: string): Promise<SelectionScope[]> {\n if (!locale) {\n locale = this._getLocale();\n }\n return this._rpcRequestsHandler.getSelectionScopes({ imodel: imodel.getRpcProps(), locale });\n }\n\n /**\n * Computes keys that need to be added to logical selection based on provided selection scope.\n * @param ids Element IDs to compute selection for\n * @param scope Selection scope to apply\n */\n public async computeSelection(imodel: IModelConnection, ids: Id64Arg, scope: SelectionScopeProps | SelectionScope | string): Promise<KeySet> {\n const scopeProps = createSelectionScopeProps(scope);\n\n // convert ids input to array\n if (typeof ids === \"string\") {\n ids = [ids];\n } else if (ids instanceof Set) {\n ids = [...ids];\n }\n\n // compute selection in batches to avoid HTTP 413\n const keys = new KeySet();\n const batchSize = DEFAULT_KEYS_BATCH_SIZE;\n const batchesCount = Math.ceil(ids.length / batchSize);\n const batchKeyPromises = [];\n for (let batchIndex = 0; batchIndex < batchesCount; ++batchIndex) {\n const batchStart = batchSize * batchIndex;\n const batchEnd = batchStart + batchSize > ids.length ? ids.length : batchStart + batchSize;\n const batchIds = 0 === batchIndex && ids.length <= batchEnd ? ids : ids.slice(batchStart, batchEnd);\n batchKeyPromises.push(this._rpcRequestsHandler.computeSelection({ imodel: imodel.getRpcProps(), elementIds: batchIds, scope: scopeProps }));\n }\n const batchKeys = (await Promise.all(batchKeyPromises)).map((json) => KeySet.fromJSON(json));\n batchKeys.forEach((bk) => keys.add(bk));\n return keys;\n }\n}\n\n/**\n * Normalizes given scope options and returns [[SelectionScopeProps]] that can be used for\n * calculating selection with scope.\n *\n * @public\n * @deprecated in 5.0. Use `computeSelection` from [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md#selection-scopes) package instead.\n */\nexport function createSelectionScopeProps(scope: SelectionScopeProps | SelectionScope | string | undefined): SelectionScopeProps {\n if (!scope) {\n return { id: \"element\" };\n }\n if (typeof scope === \"string\") {\n return { id: scope };\n }\n return scope;\n}\n"]}
@@ -4,31 +4,31 @@
4
4
  * @docs-group-description Core
5
5
  * Common types used for retrieving presentation data from iModels.
6
6
  */
7
- export * from "./presentation-frontend/Presentation";
8
- export * from "./presentation-frontend/PresentationManager";
9
- export * from "./presentation-frontend/RulesetManager";
10
- export * from "./presentation-frontend/RulesetVariablesManager";
11
- export * from "./presentation-frontend/favorite-properties/FavoritePropertiesManager";
12
- export * from "./presentation-frontend/favorite-properties/FavoritePropertiesStorage";
13
- export * from "./presentation-frontend/Diagnostics";
7
+ export { PresentationProps, Presentation } from "./presentation-frontend/Presentation.js";
8
+ export { IModelHierarchyChangeEventArgs, IModelContentChangeEventArgs, MultipleValuesRequestOptions, GetNodesRequestOptions, GetContentRequestOptions, GetDistinctValuesRequestOptions, PresentationManagerProps, PresentationManager, } from "./presentation-frontend/PresentationManager.js";
9
+ export { RulesetManager } from "./presentation-frontend/RulesetManager.js";
10
+ export { RulesetVariablesManager } from "./presentation-frontend/RulesetVariablesManager.js";
11
+ export { FavoritePropertiesScope, PropertyFullName, FavoritePropertiesOrderInfo, FavoritePropertiesManagerProps, FavoritePropertiesManager, } from "./presentation-frontend/favorite-properties/FavoritePropertiesManager.js";
12
+ export { IFavoritePropertiesStorage, DefaultFavoritePropertiesStorageTypes, createFavoritePropertiesStorage, } from "./presentation-frontend/favorite-properties/FavoritePropertiesStorage.js";
13
+ export { consoleDiagnosticsHandler, createCombinedDiagnosticsHandler } from "./presentation-frontend/Diagnostics.js";
14
14
  /**
15
15
  * @module Logging
16
16
  *
17
17
  * @docs-group-description Logging
18
18
  * Types related to logging in this package.
19
19
  */
20
- export * from "./presentation-frontend/FrontendLoggerCategory";
20
+ export { PresentationFrontendLoggerCategory } from "./presentation-frontend/FrontendLoggerCategory.js";
21
21
  /**
22
22
  * @module UnifiedSelection
23
23
  *
24
24
  * @docs-group-description UnifiedSelection
25
25
  * Types related to [unified selection]($docs/presentation/unified-selection/index.md).
26
26
  */
27
- export * from "./presentation-frontend/selection/SelectionChangeEvent";
28
- export * from "./presentation-frontend/selection/ISelectionProvider";
29
- export * from "./presentation-frontend/selection/SelectionManager";
30
- export * from "./presentation-frontend/selection/SelectionScopesManager";
31
- export * from "./presentation-frontend/selection/SelectionHandler";
32
- export * from "./presentation-frontend/selection/HiliteSetProvider";
33
- export * from "./presentation-frontend/selection/SelectionHelper";
27
+ export { SelectionChangesListener, SelectionChangeEvent, SelectionChangeType, SelectionChangeEventArgs, } from "./presentation-frontend/selection/SelectionChangeEvent.js";
28
+ export { ISelectionProvider } from "./presentation-frontend/selection/ISelectionProvider.js";
29
+ export { SelectionManagerProps, SelectionManager } from "./presentation-frontend/selection/SelectionManager.js";
30
+ export { SelectionScopesManagerProps, SelectionScopesManager, createSelectionScopeProps } from "./presentation-frontend/selection/SelectionScopesManager.js";
31
+ export { SelectionHandlerProps, SelectionHandler } from "./presentation-frontend/selection/SelectionHandler.js";
32
+ export { HiliteSet, HiliteSetProviderProps, HiliteSetProvider } from "./presentation-frontend/selection/HiliteSetProvider.js";
33
+ export { SelectionHelper } from "./presentation-frontend/selection/SelectionHelper.js";
34
34
  //# sourceMappingURL=presentation-frontend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"presentation-frontend.d.ts","sourceRoot":"","sources":["../../src/presentation-frontend.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,iDAAiD,CAAC;AAChE,cAAc,uEAAuE,CAAC;AACtF,cAAc,uEAAuE,CAAC;AACtF,cAAc,qCAAqC,CAAC;AAEpD;;;;;GAKG;AACH,cAAc,gDAAgD,CAAC;AAE/D;;;;;GAKG;AACH,cAAc,wDAAwD,CAAC;AACvE,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AACnE,cAAc,0DAA0D,CAAC;AACzE,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AACpE,cAAc,mDAAmD,CAAC"}
1
+ {"version":3,"file":"presentation-frontend.d.ts","sourceRoot":"","sources":["../../src/presentation-frontend.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,4BAA4B,EAC5B,sBAAsB,EACtB,wBAAwB,EACxB,+BAA+B,EAC/B,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM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