UNPKG

@itwin/presentation-frontend

Version:

Frontend of iModel.js Presentation library

45 lines 1.87 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * 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 */ Object.defineProperty(exports, "__esModule", { value: true }); exports.SelectionHelper = void 0; const presentation_common_1 = require("@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()`. */ 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 (presentation_common_1.Key.isNodeKey(key)) { if (presentation_common_1.NodeKey.isInstancesNodeKey(key)) { result.push(...key.instanceKeys); } else { result.push(key); } } else { result.push(key); } }); return result; } } exports.SelectionHelper = SelectionHelper; //# sourceMappingURL=SelectionHelper.js.map