How to use the @bentley/presentation-components.treeWithUnifiedSelection function in @bentley/presentation-components

To help you get started, we’ve selected a few @bentley/presentation-components examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github imodeljs / imodeljs / ui / framework / src / ui-framework / imodel-components / visibility-tree / VisibilityTree.tsx View on Github external
import { KeySet, Ruleset, NodeKey, InstanceKey, ContentFlags, DescriptorOverrides, RegisteredRuleset } from "@bentley/presentation-common";
import { Presentation } from "@bentley/presentation-frontend";
import {
  IPresentationTreeDataProvider, PresentationTreeDataProvider,
  treeWithUnifiedSelection, ContentDataProvider,
} from "@bentley/presentation-components";
import {
  CheckBoxInfo, CheckBoxState, isPromiseLike, ImageCheckBox, NodeCheckboxRenderProps,
} from "@bentley/ui-core";
import { Tree as BasicTree, SelectionMode, TreeNodeItem } from "@bentley/ui-components";
import { UiFramework } from "../../UiFramework";
import { connectIModelConnection } from "../../redux/connectIModel";

import "./VisibilityTree.scss";

const Tree = treeWithUnifiedSelection(BasicTree); // tslint:disable-line:variable-name naming-convention
const pageSize = 20;
const RULESET: Ruleset = require("./Hierarchy.json"); // tslint:disable-line: no-var-requires

/** Props for [[VisibilityTree]] component
 * @public
 * @deprecated Use ModelsTree
 */
export interface VisibilityTreeProps {
  /** An IModel to pull data from */
  imodel: IModelConnection;
  /** Active view used to determine and control visibility */
  activeView?: Viewport;
  /** Selection mode in the tree */
  selectionMode?: SelectionMode;
  /**
   * Custom data provider to use for testing
github imodeljs / simple-viewer-app / src / frontend / components / Tree.tsx View on Github external
/*---------------------------------------------------------------------------------------------
* Copyright (c) 2019 Bentley Systems, Incorporated. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license terms.
*--------------------------------------------------------------------------------------------*/
import * as React from "react";
import { IModelApp, IModelConnection } from "@bentley/imodeljs-frontend";
import { Tree } from "@bentley/ui-components";
import {
  IPresentationTreeDataProvider,
  PresentationTreeDataProvider,
  treeWithUnifiedSelection,
} from "@bentley/presentation-components";

// create a HOC tree component that supports unified selection
// tslint:disable-next-line:variable-name
const SimpleTree = treeWithUnifiedSelection(Tree);

/** React properties for the tree component, that accepts an iModel connection with ruleset id */
export interface IModelConnectionProps {
  /** iModel whose contents should be displayed in the tree */
  imodel: IModelConnection;
  /** ID of the presentation rule set to use for creating the hierarchy in the tree */
  rulesetId: string;
}

/** React properties for the tree component, that accepts a data provider */
export interface DataProviderProps {
  /** Custom tree data provider. */
  dataProvider: IPresentationTreeDataProvider;
}

/** React properties for the tree component */