This repository has been archived by the owner on May 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathTable.tsx
32 lines (28 loc) · 1.54 KB
/
Table.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/* eslint-disable no-duplicate-imports */
import * as React from "react";
import { useCallback } from "react";
import { IModelConnection } from "@bentley/imodeljs-frontend";
import { PresentationTableDataProvider, tableWithUnifiedSelection } from "@bentley/presentation-components";
import { useDisposable } from "@bentley/ui-core";
import { Table } from "@bentley/ui-components";
// eslint-disable-next-line @typescript-eslint/no-var-requires
const RULESET_TABLE = require("./Table.ruleset.json");
// create a HOC table component that supports unified selection
// eslint-disable-next-line @typescript-eslint/naming-convention
const SimpleTable = tableWithUnifiedSelection(Table);
/** React properties for the table component */
export interface Props {
/** iModel whose contents should be displayed in the table */
imodel: IModelConnection;
}
/** Table component for the viewer app */
export default function SimpleTableComponent(props: Props) { // eslint-disable-line @typescript-eslint/naming-convention
const dataProvider = useDisposable(useCallback(() => new PresentationTableDataProvider({ imodel: props.imodel, ruleset: RULESET_TABLE }), [props.imodel]));
return (
<SimpleTable dataProvider={dataProvider} />
);
}