@itwin/presentation-frontend
Version:
Frontend of iModel.js Presentation library
41 lines • 1.67 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module UnifiedSelection
*/
import { Key, NodeKey } from "@itwin/presentation-common";
/**
* Helper class for working with selection.
* @public
* @deprecated in 5.0 - will not be removed until after 2026-06-13. This is unnecessary after switching to [@itwin/unified-selection](https://github.com/iTwin/presentation/blob/master/packages/unified-selection/README.md)
* package. A similar method to this in the new system is `Selectables.load()`.
*/
export class SelectionHelper {
/* c8 ignore next */
constructor() { }
/**
* Re-map the given keyset for selection. This means all instance node keys get converted
* to instance keys, because in that case we want to select instances instead of nodes. All
* other types of keys ar left as is.
*/
static getKeysForSelection(keys) {
const result = new Array();
keys.forEach((key) => {
if (Key.isNodeKey(key)) {
if (NodeKey.isInstancesNodeKey(key)) {
result.push(...key.instanceKeys);
}
else {
result.push(key);
}
}
else {
result.push(key);
}
});
return result;
}
}
//# sourceMappingURL=SelectionHelper.js.map