UNPKG

1.21 kBTypeScriptView Raw
1import React, { ReactNode } from 'react';
2export declare const TABLE_CLASS = "jp-sortable-table";
3/**
4 * A namespace for Table.
5 */
6export declare namespace Table {
7 /**
8 * The state which will be restored from layout tracker.
9 */
10 interface ISortState {
11 sortKey?: string | null;
12 sortDirection: -1 | 1;
13 }
14 /**
15 * The initialization options for the table.
16 */
17 interface IOptions<T> extends Partial<ISortState> {
18 rows: IRow<T>[];
19 columns: IColumn<T>[];
20 onRowClick?: React.MouseEventHandler<HTMLTableRowElement>;
21 blankIndicator: () => ReactNode;
22 }
23 /**
24 * Table row with data to display.
25 */
26 interface IRow<T> {
27 data: T;
28 key: string;
29 }
30 /**
31 * Column definition.
32 */
33 interface IColumn<T> {
34 id: string;
35 label: string;
36 renderCell(data: T): ReactNode;
37 sort(a: T, b: T): number | undefined;
38 isAvailable?(): boolean;
39 isHidden?: boolean;
40 }
41}
42/**
43 * Sortable table component for small datasets.
44 *
45 * For large datasets use `DataGrid` from `@lumino/datagrid`.
46 */
47export declare function Table<T>(props: Table.IOptions<T>): JSX.Element;