UNPKG

@itwin/presentation-frontend

Version:

Frontend of iModel.js Presentation library

43 lines 1.57 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 */ class SelectionHelper { // istanbul 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