@toolpad/core
Version:
Dashboard framework powered by Material UI.
77 lines • 2.32 kB
TypeScript
import * as React from 'react';
import { DataGridProps } from '@mui/x-data-grid';
import type { DataGridProProps } from '@mui/x-data-grid-pro';
import type { DataGridPremiumProps } from '@mui/x-data-grid-premium';
import { DataSourceCache } from "./cache.js";
import type { DataModel, DataModelId, DataSource } from './types';
import { type CRUDLocaleText } from "./localeText.js";
export interface ListSlotProps {
dataGrid?: Partial<DataGridProps | DataGridProProps | DataGridPremiumProps>;
}
export interface ListSlots {
/**
* The DataGrid component used to list the items.
* @default DataGrid
*/
dataGrid?: React.JSXElementConstructor<DataGridProps> | React.JSXElementConstructor<DataGridProProps> | React.JSXElementConstructor<DataGridPremiumProps>;
}
export interface ListProps<D extends DataModel> {
/**
* Server-side [data source](https://mui.com/toolpad/core/react-crud/#data-sources).
*/
dataSource?: DataSource<D> & Required<Pick<DataSource<D>, 'getMany'>>;
/**
* Initial number of rows to show per page.
* @default 100
*/
initialPageSize?: number;
/**
* Callback fired when a row is clicked. Not called if the target clicked is an interactive element added by the built-in columns.
*/
onRowClick?: (id: DataModelId) => void;
/**
* Callback fired when the "Create" button is clicked.
*/
onCreateClick?: () => void;
/**
* Callback fired when the "Edit" button is clicked.
*/
onEditClick?: (id: DataModelId) => void;
/**
* Callback fired when the item is successfully deleted.
*/
onDelete?: (id: DataModelId) => void;
/**
* [Cache](https://mui.com/toolpad/core/react-crud/#data-caching) for the data source.
*/
dataSourceCache?: DataSourceCache | null;
/**
* The components used for each slot inside.
* @default {}
*/
slots?: ListSlots;
/**
* The props used for each slot inside.
* @default {}
*/
slotProps?: ListSlotProps;
/**
* Locale text for the component.
*/
localeText?: CRUDLocaleText;
}
/**
*
* Demos:
*
* - [CRUD](https://mui.com/toolpad/core/react-crud/)
*
* API:
*
* - [List API](https://mui.com/toolpad/core/api/list)
*/
declare function List<D extends DataModel>(props: ListProps<D>): React.JSX.Element;
declare namespace List {
var propTypes: any;
}
export { List };