How to use the @bentley/presentation-components.tableWithUnifiedSelection 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 / test-apps / ui-test-app / src / frontend / appui / widgets / UnifiedSelectionTableWidget.tsx View on Github external
import * as React from "react";

import { GlobalContextMenu, ContextMenuItem } from "@bentley/ui-core";
import {
  ConfigurableUiManager,
  ConfigurableCreateInfo,
  WidgetControl,
} from "@bentley/ui-framework";
import { Table, TableCellContextMenuArgs } from "@bentley/ui-components";
import { PresentationTableDataProvider, tableWithUnifiedSelection } from "@bentley/presentation-components";
import { IModelConnection, IModelApp, NotifyMessageDetails, OutputMessagePriority } from "@bentley/imodeljs-frontend";
import { ContextMenuItemInfo } from "./UnifiedSelectionPropertyGridWidget";

// create a HOC property grid component that supports unified selection
// tslint:disable-next-line:variable-name
const UnifiedSelectionTable = tableWithUnifiedSelection(Table);

export class UnifiedSelectionTableWidgetControl extends WidgetControl {
  constructor(info: ConfigurableCreateInfo, options: any) {
    super(info, options);

    if (options && options.iModelConnection && options.rulesetId)
      this.reactElement = ;
  }
}

interface UnifiedSelectionTableWidgetProps {
  iModelConnection?: IModelConnection;
  rulesetId?: string;
}

interface UnifiedSelectionTableWidgetState {
github imodeljs / imodeljs / test-apps / presentation-test-app / src / frontend / components / find-similar-widget / FindSimilarWidget.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 } from "@bentley/imodeljs-frontend";
import { tableWithUnifiedSelection, IPresentationTableDataProvider } from "@bentley/presentation-components";
import { Table, SelectionMode } from "@bentley/ui-components";
import "./FindSimilarWidget.css";

// tslint:disable-next-line:variable-name naming-convention
const SampleTable = tableWithUnifiedSelection(Table);

export interface Props {
  dataProvider: IPresentationTableDataProvider;
  onDismissed?: () => void;
}

export default class FindSimilarWidget extends React.PureComponent {
  constructor(props: Props, context?: any) {
    super(props, context);
    this.state = { prevProps: props };
  }
  public componentWillUnmount() {
    this.props.dataProvider.dispose();
  }
  public componentDidUpdate(prevProps: Props) {
    if (this.props.dataProvider !== prevProps.dataProvider)
github imodeljs / imodeljs / test-apps / presentation-test-app / src / frontend / components / grid-widget / GridWidget.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 { PresentationTableDataProvider, tableWithUnifiedSelection, IPresentationTableDataProvider } from "@bentley/presentation-components";
import { Table } from "@bentley/ui-components";
import "./GridWidget.css";

// tslint:disable-next-line:variable-name naming-convention
const SampleTable = tableWithUnifiedSelection(Table);

export interface Props {
  imodel: IModelConnection;
  rulesetId: string;
}

export interface State {
  dataProvider: IPresentationTableDataProvider;
}

export default class GridWidget extends React.PureComponent {
  constructor(props: Props, context?: any) {
    super(props, context);
    this.state = { dataProvider: createDataProviderFromProps(props) };
  }
  public static getDerivedStateFromProps(props: Props, state: State): State | null {
github imodeljs / simple-viewer-app / src / frontend / components / Table.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 { IModelConnection } from "@bentley/imodeljs-frontend";
import { Table } from "@bentley/ui-components";
import {
  IPresentationTableDataProvider,
  PresentationTableDataProvider,
  tableWithUnifiedSelection,
} from "@bentley/presentation-components";

// create a HOC table component that supports unified selection
// tslint:disable-next-line:variable-name
const SimpleTable = tableWithUnifiedSelection(Table);

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

/** React properties for the table component, that accepts a data provider */
export interface DataProviderProps {
  /** Custom property pane data provider. */
  dataProvider: IPresentationTableDataProvider;
}

/** React properties for the table component */