@wandelbots/wandelbots-js-react-components
Version:
React UI toolkit for building applications on top of the Wandelbots platform
66 lines • 2.07 kB
TypeScript
import { Box } from "@mui/material";
import { type DataGridProps, type GridColDef, type GridRowParams } from "@mui/x-data-grid";
export interface WandelbotsDataGridProps<T = Record<string, unknown>> {
/**
* Array of data items to display in the grid
*/
data: T[];
/**
* Column definitions for the DataGrid
*/
columns: GridColDef[];
/**
* Function to transform data items into DataGrid rows
* Should return an object with an 'id' field and other fields matching column definitions
*/
getRowData: (item: T) => Record<string, unknown> & {
id: string | number;
};
/**
* Callback when a row is clicked
*/
onRowClick?: (item: T, params: GridRowParams) => void;
/**
* Currently selected item (for highlighting)
*/
selectedItem?: T | null;
/**
* Function to get the ID of an item (used for selection highlighting)
*/
getItemId?: (item: T) => string | number;
/**
* Title displayed in the toolbar
*/
title?: string;
/**
* Show item count in title
* @default true
*/
showCount?: boolean;
/**
* Placeholder text for the search input
* @default "Search programs"
*/
searchPlaceholder?: string;
/**
* Additional DataGrid props to pass through
*/
dataGridProps?: Partial<DataGridProps>;
/**
* Custom toolbar component to replace the default one
*/
CustomToolbar?: React.ComponentType;
/**
* Select the first item by default
* @default false
*/
selectFirstByDefault?: boolean;
/**
* Custom sx styles for the root container
*/
sx?: React.ComponentProps<typeof Box>["sx"];
}
export declare const WandelbotsDataGrid: (<T>({ data, columns, getRowData, onRowClick, selectedItem, getItemId, title, showCount, searchPlaceholder, dataGridProps, CustomToolbar, selectFirstByDefault, sx, }: WandelbotsDataGridProps<T>) => import("react/jsx-runtime").JSX.Element) & {
displayName: string;
};
//# sourceMappingURL=DataGrid.d.ts.map