@material-ui/x-grid
Version:
The commercial edition of the data grid component (Material-UI X).
1,462 lines (1,412 loc) • 161 kB
TypeScript
export { LicenseInfo } from '@material-ui/x-license';
import * as React$1 from 'react';
import { InputBaseProps } from '@material-ui/core/InputBase';
import { SelectProps } from '@material-ui/core/Select';
import { ComponentsPropsList, StyledComponentProps } from '@material-ui/core/styles';
import * as _material_ui_core_OverridableComponent from '@material-ui/core/OverridableComponent';
import * as _material_ui_core from '@material-ui/core';
import { PopperProps } from '@material-ui/core/Popper';
import { TextFieldProps } from '@material-ui/core/TextField';
import * as _material_ui_core_Button from '@material-ui/core/Button';
import { ButtonProps } from '@material-ui/core/Button';
import { TooltipProps } from '@material-ui/core/Tooltip';
import * as reselect from 'reselect';
interface GridBodyProps {
children?: React$1.ReactNode;
}
declare function GridBody(props: GridBodyProps): JSX.Element;
declare function GridErrorHandler(props: any): JSX.Element;
declare function GridFooterPlaceholder(): JSX.Element | null;
declare function GridHeaderPlaceholder(): JSX.Element;
declare function GridOverlays(): JSX.Element | null;
/**
* The mode of the cell.
*/
declare type GridCellMode = 'edit' | 'view';
/**
* The cell value type.
*/
declare type GridCellValue = string | number | boolean | Date | null | undefined | object;
/**
* The coordinates of cell represented by their row and column indexes.
*/
interface GridCellIndexCoordinates {
colIndex: number;
rowIndex: number;
}
/**
* The coordinates of column header represented by their row and column indexes.
*/
interface GridColumnHeaderIndexCoordinates {
colIndex: number;
}
declare type GridRowsProp = Readonly<GridRowData[]>;
declare type GridRowData = {
[key: string]: any;
};
/**
* The key value object representing the data of a row.
*/
declare type GridRowModel = GridRowData;
declare type GridUpdateAction = 'delete';
interface GridRowModelUpdate extends GridRowData {
_action?: GridUpdateAction;
}
/**
* The type of Id supported by the grid.
*/
declare type GridRowId = string | number;
/**
* The function to retrieve the id of a [[GridRowData]].
*/
declare type GridRowIdGetter = (row: GridRowData) => GridRowId;
/**
* An helper function to check if the id provided is valid.
*
* @param id Id as [[GridRowId]].
* @param row Row as [[GridRowData]].
* @returns a boolean
*/
declare function checkGridRowIdIsValid(id: GridRowId, row: GridRowModel | Partial<GridRowModel>, detailErrorMessage?: string): boolean;
/**
* Object passed as parameter in the column [[GridColDef]] cell renderer.
*/
interface GridCellParams {
/**
* The grid row id.
*/
id: GridRowId;
/**
* The column field of the cell that triggered the event
*/
field: string;
/**
* The cell value, but if the column has valueGetter, use getValue.
*/
value: GridCellValue;
/**
* The cell value formatted with the column valueFormatter.
*/
formattedValue: GridCellValue;
/**
* The row model of the row that the current cell belongs to.
*/
row: GridRowModel;
/**
* The column of the row that the current cell belongs to.
*/
colDef: GridStateColDef;
/**
* GridApi that let you manipulate the grid.
*/
api: any;
/**
* If true, the cell is editable.
*/
isEditable?: boolean;
/**
* The mode of the cell.
*/
cellMode: GridCellMode;
/**
* If true, the cell is the active element.
*/
hasFocus: boolean;
/**
* the tabIndex value.
*/
tabIndex: 0 | -1;
/**
* Get the cell value of a row and field.
* @param id
* @param field
*/
getValue: (id: GridRowId, field: string) => GridCellValue;
}
/**
* Alias of GridCellParams.
*/
declare type GridValueGetterParams = Omit<GridCellParams, 'formattedValue' | 'isEditable'>;
/**
* Alias of GridCellParams.
*/
declare type GridValueFormatterParams = Omit<GridCellParams, 'formattedValue' | 'isEditable'>;
/**
* A function used to process cellClassName params.
*/
declare type GridCellClassFn = (params: GridCellParams) => string;
/**
* The union type representing the [[GridColDef]] cell class type.
*/
declare type GridCellClassNamePropType = string | GridCellClassFn;
/**
* Object passed as parameter in the column [[GridColDef]] header renderer.
*/
interface GridColumnHeaderParams {
/**
* The column field of the column that triggered the event
*/
field: string;
/**
* The column of the current header component.
*/
colDef: GridStateColDef;
/**
* API ref that let you manipulate the grid.
*/
api: any;
}
/**
* A function used to process headerClassName params.
*/
declare type GridColumnHeaderClassFn = (params: GridColumnHeaderParams) => string;
/**
* The union type representing the [[GridColDef]] column header class type.
*/
declare type GridColumnHeaderClassNamePropType = string | GridColumnHeaderClassFn;
interface GridFilterItem {
id?: number | string;
columnField?: string;
value?: any;
operatorValue?: string;
}
declare enum GridLinkOperator {
And = "and",
Or = "or"
}
interface GridFilterInputValueProps {
item: GridFilterItem;
applyValue: (value: GridFilterItem) => void;
apiRef: any;
}
interface GridFilterOperator {
label?: string;
value: string;
getApplyFilterFn: (filterItem: GridFilterItem, column: GridStateColDef) => null | ((params: GridCellParams) => boolean);
InputComponent?: React$1.JSXElementConstructor<GridFilterInputValueProps>;
InputComponentProps?: Record<string, any>;
}
declare type GridSortDirection = 'asc' | 'desc' | null | undefined;
declare type GridFieldComparatorList = {
field: string;
comparator: GridComparatorFn;
}[];
interface GridSortCellParams {
id: GridRowId;
field: string;
value: GridCellValue;
api: any;
}
/**
* The type of the sort comparison function.
*/
declare type GridComparatorFn = (v1: GridCellValue, v2: GridCellValue, cellParams1: GridSortCellParams, cellParams2: GridSortCellParams) => number;
/**
* Object that represents the column sorted data, part of the [[GridSortModel]].
*/
interface GridSortItem {
/**
* The column field identifier.
*/
field: string;
/**
* The direction of the column that the grid should sort.
*/
sort: GridSortDirection;
}
/**
* The model used for sorting the grid.
*/
declare type GridSortModel = GridSortItem[];
declare const GRID_STRING_COLUMN_TYPE = "string";
declare const GRID_NUMBER_COLUMN_TYPE = "number";
declare const GRID_DATE_COLUMN_TYPE = "date";
declare const GRID_DATETIME_COLUMN_TYPE = "dateTime";
declare const GRID_BOOLEAN_COLUMN_TYPE = "boolean";
declare type GridNativeColTypes = 'string' | 'number' | 'date' | 'dateTime' | 'boolean' | 'singleSelect';
declare type GridColType = GridNativeColTypes | string;
/**
* Alignment used in position elements in Cells.
*/
declare type GridAlignment = 'left' | 'right' | 'center';
/**
* Column Definition interface.
*/
interface GridColDef {
/**
* The column identifier. It's used to map with [[GridRowData]] values.
*/
field: string;
/**
* The title of the column rendered in the column header cell.
*/
headerName?: string;
/**
* The description of the column rendered as tooltip if the column header name is not fully displayed.
*/
description?: string;
/**
* Set the width of the column.
* @default 100
*/
width?: number;
/**
* If set, it indicates that a column has fluid width. Range [0, ∞).
*/
flex?: number;
/**
* Sets the minimum width of a column.
* @default 50
*/
minWidth?: number;
/**
* If `true`, hide the column.
* @default false
*/
hide?: boolean;
/**
* If `true`, the column is sortable.
* @default true
*/
sortable?: boolean;
/**
* If `true`, the column is resizable.
* @default true
*/
resizable?: boolean;
/**
* If `true`, the cells of the column are editable.
* @default false
*/
editable?: boolean;
/**
* A comparator function used to sort rows.
*/
sortComparator?: GridComparatorFn;
/**
* Type allows to merge this object with a default definition [[GridColDef]].
* @default 'string'
*/
type?: GridColType;
/**
* To be used in combination with `type: 'singleSelect'`. This is an array of the possible cell values and labels.
*/
valueOptions?: Array<string | number | {
value: any;
label: string;
}>;
/**
* Allows to align the column values in cells.
*/
align?: GridAlignment;
/**
* Function that allows to get a specific data instead of field to render in the cell.
* @param params
*/
valueGetter?: (params: GridValueGetterParams) => GridCellValue;
/**
* Function that allows to apply a formatter before rendering its value.
* @param {GridValueFormatterParams} params Object containing parameters for the formatter.
* @returns {GridCellValue} The formatted value.
*/
valueFormatter?: (params: GridValueFormatterParams) => GridCellValue;
/**
* Function that takes the user-entered value and converts it to a value used internally.
* @param {GridCellValue} value The user-entered value.
* @param {GridCellParams} params The params when called before saving the value.
* @returns {GridCellValue} The converted value to use internally.
*/
valueParser?: (value: GridCellValue, params?: GridCellParams) => GridCellValue;
/**
* Class name that will be added in cells for that column.
*/
cellClassName?: GridCellClassNamePropType;
/**
* Allows to override the component rendered as cell for this column.
* @param params
*/
renderCell?: (params: GridCellParams) => React$1.ReactNode;
/**
* Allows to override the component rendered in edit cell mode for this column.
* @param params
*/
renderEditCell?: (params: GridCellParams) => React$1.ReactNode;
/**
* Class name that will be added in the column header cell.
*/
headerClassName?: GridColumnHeaderClassNamePropType;
/**
* Allows to render a component in the column header cell.
* @param params
*/
renderHeader?: (params: GridColumnHeaderParams) => React$1.ReactNode;
/**
* Header cell element alignment.
*/
headerAlign?: GridAlignment;
/**
* Toggle the visibility of the sort icons.
* @default false
*/
hideSortIcons?: boolean;
/**
* If `true`, the column menu is disabled for this column.
* @default false
*/
disableColumnMenu?: boolean;
/**
* If `true`, the column is filterable.
* @default true
*/
filterable?: boolean;
/**
* Allows setting the filter operators for this column.
*/
filterOperators?: GridFilterOperator[];
/**
* If `true`, this column cannot be reordered.
* @default false
*/
disableReorder?: boolean;
/**
* If `true`, this column will not be included in exports.
* @default false
*/
disableExport?: boolean;
}
declare type GridColumns = GridColDef[];
declare type GridColTypeDef = Omit<GridColDef, 'field'> & {
extendType?: GridNativeColTypes;
};
interface GridStateColDef extends GridColDef {
computedWidth: number;
}
/**
* Meta Info about columns.
*/
interface GridColumnsMeta {
totalWidth: number;
positions: number[];
}
declare type GridColumnLookup = {
[field: string]: GridStateColDef;
};
interface GridColumnsState {
all: string[];
lookup: GridColumnLookup;
}
declare const getInitialGridColumnsState: () => GridColumnsState;
declare const gridCheckboxSelectionColDef: GridColDef;
declare const getGridColDef: (columnTypes: any, type: GridColType | undefined) => any;
declare function gridDateFormatter({ value }: {
value: GridCellValue;
}): string | number | boolean | object | null | undefined;
declare function gridDateTimeFormatter({ value }: {
value: GridCellValue;
}): string | number | boolean | object | null | undefined;
declare const GRID_DATE_COL_DEF: GridColTypeDef;
declare const GRID_DATETIME_COL_DEF: GridColTypeDef;
declare const getGridDateOperators: (showTime?: boolean | undefined) => GridFilterOperator[];
declare const GRID_NUMERIC_COL_DEF: GridColTypeDef;
declare const getGridNumericColumnOperators: () => GridFilterOperator[];
declare const GRID_STRING_COL_DEF: GridColTypeDef;
declare type GridColumnTypesRecord = Record<GridColType, GridColTypeDef>;
declare const DEFAULT_GRID_COL_TYPE_KEY = "__default__";
declare const getGridDefaultColumnTypes: () => GridColumnTypesRecord;
declare const getGridStringOperators: () => GridFilterOperator[];
interface CursorCoordinates {
x: number;
y: number;
}
/**
* The size of a container.
*/
interface ElementSize {
/**
* The height of a container or HTMLElement.
*/
height: number;
/**
* The width of a container or HTMLElement.
*/
width: number;
}
interface GridScrollBarState {
/**
* Indicates if a vertical scrollbar is visible.
*/
hasScrollY: boolean;
/**
* Indicates if an horizontal scrollbar is visible.
*/
hasScrollX: boolean;
/**
* The scrollbar size.
*/
scrollBarSize: {
x: number;
y: number;
};
}
/**
* the size of the container holding the set of rows visible to the user.
*/
declare type GridViewportSizeState = ElementSize;
/**
* The set of container properties calculated on resize of the grid.
*/
interface GridContainerProps {
/**
* If `true`, the grid is virtualizing the rendering of rows.
*/
isVirtualized: boolean;
/**
* The number of rows that fit in the rendering zone.
*/
renderingZonePageSize: number;
/**
* The number of rows that fit in the viewport.
*/
viewportPageSize: number;
/**
* The total number of rows that are scrollable in the viewport. If pagination then it would be page size. If not, it would be the full set of rows.
*/
virtualRowsCount: number;
/**
* The last page number.
*/
lastPage: number;
/**
* The total element size required to render the set of rows, including scrollbars.
*/
totalSizes: ElementSize;
/**
* The viewport size including scrollbars.
*/
windowSizes: ElementSize;
/**
* The size of the container containing all the rendered rows.
*/
renderingZone: ElementSize;
/**
* The size of the available scroll height in the rendering zone container.
*/
renderingZoneScrollHeight: number;
/**
* The total element size required to render the full set of rows and columns, minus the scrollbars.
*/
dataContainerSizes: ElementSize;
}
interface GridEditCellProps {
value: GridCellValue;
[prop: string]: any;
}
declare type GridEditRowProps = {
[field: string]: GridEditCellProps;
};
declare type GridEditRowsModel = {
[rowId: string]: GridEditRowProps;
};
declare const GridFeatureModeConstant: {
client: "client";
server: "server";
};
declare type GridFeatureMode = 'client' | 'server';
interface GridFilterModel {
items: GridFilterItem[];
linkOperator?: GridLinkOperator;
}
/**
* Set the types of the texts in the grid.
*/
interface GridLocaleText {
noRowsLabel: string;
noResultsOverlayLabel: string;
errorOverlayDefaultLabel: string;
toolbarDensity: React.ReactNode;
toolbarDensityLabel: string;
toolbarDensityCompact: string;
toolbarDensityStandard: string;
toolbarDensityComfortable: string;
toolbarColumns: React.ReactNode;
toolbarColumnsLabel: string;
toolbarFilters: React.ReactNode;
toolbarFiltersLabel: string;
toolbarFiltersTooltipHide: React.ReactNode;
toolbarFiltersTooltipShow: React.ReactNode;
toolbarFiltersTooltipActive: (count: number) => React.ReactNode;
toolbarExport: React.ReactNode;
toolbarExportLabel: string;
toolbarExportCSV: React.ReactNode;
columnsPanelTextFieldLabel: string;
columnsPanelTextFieldPlaceholder: string;
columnsPanelDragIconLabel: string;
columnsPanelShowAllButton: React.ReactNode;
columnsPanelHideAllButton: React.ReactNode;
filterPanelAddFilter: React.ReactNode;
filterPanelDeleteIconLabel: string;
filterPanelOperators: React.ReactNode;
filterPanelOperatorAnd: React.ReactNode;
filterPanelOperatorOr: React.ReactNode;
filterPanelColumns: React.ReactNode;
filterPanelInputLabel: string;
filterPanelInputPlaceholder: string;
filterOperatorContains: string;
filterOperatorEquals: string;
filterOperatorStartsWith: string;
filterOperatorEndsWith: string;
filterOperatorIs: string;
filterOperatorNot: string;
filterOperatorAfter: string;
filterOperatorOnOrAfter: string;
filterOperatorBefore: string;
filterOperatorOnOrBefore: string;
filterOperatorIsEmpty: string;
filterOperatorIsNotEmpty: string;
filterValueAny: string;
filterValueTrue: string;
filterValueFalse: string;
columnMenuLabel: string;
columnMenuShowColumns: React.ReactNode;
columnMenuFilter: React.ReactNode;
columnMenuHideColumn: React.ReactNode;
columnMenuUnsort: React.ReactNode;
columnMenuSortAsc: React.ReactNode;
columnMenuSortDesc: React.ReactNode;
columnHeaderFiltersTooltipActive: (count: number) => React.ReactNode;
columnHeaderFiltersLabel: string;
columnHeaderSortIconLabel: string;
footerRowSelected: (count: number) => React.ReactNode;
footerTotalRows: React.ReactNode;
footerTotalVisibleRows: (visibleCount: number, totalCount: number) => React.ReactNode;
checkboxSelectionHeaderName: string;
booleanCellTrueLabel: string;
booleanCellFalseLabel: string;
MuiTablePagination: Omit<ComponentsPropsList['MuiTablePagination'], 'page' | 'count' | 'onChangePage' | 'rowsPerPage' | 'onPageChange'>;
}
declare type GridTranslationKeys = keyof GridLocaleText;
/**
* The grid locale text API [[apiRef]].
*/
interface GridLocaleTextApi {
/**
* Returns the translation for the `key`.
* @param {T} key One of the keys in [[GridLocaleText]].
* @returns {GridLocaleText[T]} The translated value.
*/
getLocaleText: <T extends GridTranslationKeys>(key: T) => GridLocaleText[T];
}
/**
* Available densities.
*/
declare type GridDensity = 'compact' | 'standard' | 'comfortable';
/**
* Density enum.
*/
declare enum GridDensityTypes {
Compact = "compact",
Standard = "standard",
Comfortable = "comfortable"
}
interface Logger {
debug: (...args: any[]) => void;
info: (...args: any[]) => void;
warn: (...args: any[]) => void;
error: (...args: any[]) => void;
}
/**
* Object passed as parameter in the column [[GridColDef]] cell renderer.
*/
interface GridRowParams {
/**
* The grid row id.
*/
id: GridRowId;
/**
* The row model of the row that the current cell belongs to.
*/
row: GridRowModel;
/**
* All grid columns.
*/
columns: GridColumns;
/**
* GridApiRef that let you manipulate the grid.
*/
api: any;
/**
* Get the cell value of a row and field.
* @param id
* @param field
*/
getValue: (id: GridRowId, field: string) => GridCellValue;
}
declare type GridInputSelectionModel = GridRowId[] | GridRowId;
declare type GridSelectionModel = GridRowId[];
interface GridEditCellPropsParams {
id: GridRowId;
field: string;
props: GridEditCellProps;
}
interface GridEditCellValueParams {
id: GridRowId;
field: string;
value: GridCellValue;
}
interface GridCommitCellChangeParams {
id: GridRowId;
field: string;
}
interface GridCellEditCommitParams {
id: GridRowId;
field: string;
value: GridCellValue;
}
/**
* Object passed as parameter in the onRowsScrollEnd callback.
*/
interface GridRowScrollEndParams {
/**
* The number of rows that fit in the viewport.
*/
viewportPageSize: number;
/**
* The number of rows allocated for the rendered zone.
*/
virtualRowsCount: number;
/**
* The grid visible columns.
*/
visibleColumns: GridColumns;
/**
* API ref that let you manipulate the grid.
*/
api: any;
}
/**
* Object passed as parameter of the column order change event.
*/
interface GridColumnOrderChangeParams {
/**
* The HTMLElement column header element.
*/
element?: HTMLElement | null;
/**
* The column field of the column that triggered the event.
*/
field: string;
/**
* The column of the current header component.
*/
colDef: GridStateColDef;
/**
* The target column index.
*/
targetIndex: number;
/**
* The old column index.
*/
oldIndex: number;
/**
* API ref that let you manipulate the grid.
*/
api: any;
}
/**
* Object passed as parameter onto the resize event handler.
*/
interface GridResizeParams {
/**
* The container size.
*/
containerSize: ElementSize;
}
/**
* Object passed as parameter of the column resize event.
*/
interface GridColumnResizeParams {
/**
* The HTMLElement column header element.
*/
element?: HTMLElement | null;
/**
* The column of the current header component.
*/
colDef: GridStateColDef;
/**
* API ref that let you manipulate the grid.
*/
api: any;
/**
* The width of the column.
*/
width: number;
}
/**
* Object passed as parameter of the column visibility change event.
*/
interface GridColumnVisibilityChangeParams {
/**
* The field of the column which visibility changed.
*/
field: string;
/**
* The column of the current header component.
*/
colDef: GridStateColDef;
/**
* API ref that let you manipulate the grid.
*/
api: any;
/**
* The visibility state of the column.
*/
isVisible: boolean;
}
interface GridClasses {
/**
* Styles applied to the root element.
*/
root?: string;
/**
* Styles applied to the columnHeader element.
*/
columnHeader?: string;
/**
* Styles applied to the row element.
*/
row?: string;
/**
* Styles applied to the cell element.
*/
cell?: string;
}
/**
* Object passed as parameter of the virtual rows change event.
*/
interface GridViewportRowsChangeParams {
/**
* The index of the first row in the viewport.
*/
firstRowIndex: number;
/**
* The index of the last row in the viewport.
*/
lastRowIndex: number;
}
declare type MuiEvent<E> = E & {
defaultMuiPrevented?: boolean;
};
/**
* Grid options react prop, containing all the setting for the grid.
*/
interface GridOptions {
/**
* If `true`, the grid height is dynamic and follow the number of rows in the grid.
* @default false
*/
autoHeight?: boolean;
/**
* If `true`, the pageSize is calculated according to the container size and the max number of rows to avoid rendering a vertical scroll bar.
* @default false
*/
autoPageSize?: boolean;
/**
* If `true`, the grid get a first column with a checkbox that allows to select rows.
* @default false
*/
checkboxSelection?: boolean;
/**
* If `true`, the "Select All" header checkbox selects only the rows on the current page. To be used in combination with `checkboxSelection`.
* @default false
*/
checkboxSelectionVisibleOnly?: boolean;
/**
* Number of columns rendered outside the grid viewport.
* @default 2
*/
columnBuffer: number;
/**
* Extend native column types with your new column types.
*/
columnTypes?: GridColumnTypesRecord;
/**
* Override or extend the styles applied to the component.
*/
classes?: GridClasses;
/**
* Set the density of the grid.
*/
density: GridDensity;
/**
* If `true`, rows will not be extended to fill the full width of the grid container.
* @default false
*/
disableExtendRowFullWidth?: boolean;
/**
* If `true`, column filters are disabled.
* @default false
*/
disableColumnFilter?: boolean;
/**
* If `true`, the column menu is disabled.
* @default false
*/
disableColumnMenu?: boolean;
/**
* If `true`, reordering columns is disabled.
* @default false
*/
disableColumnReorder?: boolean;
/**
* If `true`, resizing columns is disabled.
* @default false
*/
disableColumnResize?: boolean;
/**
* If `true`, hiding/showing columns is disabled.
* @default false
*/
disableColumnSelector?: boolean;
/**
* If `true`, the density selector is disabled.
* @default false
*/
disableDensitySelector?: boolean;
/**
* If `true`, filtering with multiple columns is disabled.
* @default false
*/
disableMultipleColumnsFiltering?: boolean;
/**
* If `true`, multiple selection using the CTRL or CMD key is disabled.
* @default false
*/
disableMultipleSelection?: boolean;
/**
* If `true`, sorting with multiple columns is disabled.
* @default false
*/
disableMultipleColumnsSorting?: boolean;
/**
* If `true`, the selection on click on a row or cell is disabled.
* @default false
*/
disableSelectionOnClick?: boolean;
/**
* Set the edit rows model of the grid.
*/
editRowsModel?: GridEditRowsModel;
/**
* Callback fired when the EditRowModel changes.
* @param {GridEditRowsModel} editRowsModel With all properties from [[GridEditRowsModel]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onEditRowsModelChange?: (editRowsModel: GridEditRowsModel, details?: any) => void;
/**
* Filtering can be processed on the server or client-side.
* Set it to 'server' if you would like to handle filtering on the server-side.
* @default "client"
*/
filterMode?: GridFeatureMode;
/**
* Set the filter model of the grid.
*/
filterModel?: GridFilterModel;
/**
* Function that applies CSS classes dynamically on cells.
* @param {GridCellParams} params With all properties from [[GridCellParams]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
getCellClassName?: (params: GridCellParams, details?: any) => string;
/**
* Function that applies CSS classes dynamically on rows.
* @param {GridRowParams} params With all properties from [[GridRowParams]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
getRowClassName?: (params: GridRowParams, details?: any) => string;
/**
* Set the height in pixel of the column headers in the grid.
* @default 56
*/
headerHeight: number;
/**
* If `true`, the footer component is hidden.
* @default false
*/
hideFooter?: boolean;
/**
* If `true`, the pagination component in the footer is hidden.
* @default false
*/
hideFooterPagination?: boolean;
/**
* If `true`, the row count in the footer is hidden.
* @default false
*/
hideFooterRowCount?: boolean;
/**
* If `true`, the selected row count in the footer is hidden.
* @default false
*/
hideFooterSelectedRowCount?: boolean;
/**
* Callback fired when a cell is rendered, returns true if the cell is editable.
* @param {GridCellParams} params With all properties from [[GridCellParams]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
isCellEditable?: (params: GridCellParams, details?: any) => boolean;
/**
* Determines if a row can be selected.
* @param {GridRowParams} params With all properties from [[GridRowParams]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
isRowSelectable?: (params: GridRowParams, details?: any) => boolean;
/**
* Set the locale text of the grid.
* You can find all the translation keys supported in [the source](https://github.com/mui-org/material-ui-x/blob/HEAD/packages/grid/_modules_/grid/constants/localeTextConstants.ts) in the GitHub repository.
*/
localeText: Partial<GridLocaleText>;
/**
* Pass a custom logger in the components that implements the [[Logger]] interface.
* @default null
*/
logger: Logger;
/**
* Allows to pass the logging level or false to turn off logging.
* @default debug
*/
logLevel?: string | false;
/**
* Callback fired when the edit cell value changes.
* @param {GridEditCellPropsParams} params With all properties from [[GridEditCellPropsParams]].
* @param {MuiEvent} event The event that caused this prop to be called.
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onEditCellPropsChange?: (params: GridEditCellPropsParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when the cell changes are committed.
* @param {GridCellEditCommitParams} params With all properties from [[GridCellEditCommitParams]].
* @param {MuiEvent<React.SyntheticEvent>} event The event that caused this prop to be called.
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onCellEditCommit?: (params: GridCellEditCommitParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when the cell turns to edit mode.
* @param {GridCellParams} params With all properties from [[GridCellParams]].
* @param {React.SyntheticEvent} event The event that caused this prop to be called.
*/
onCellEditStart?: (params: GridCellParams, event?: React$1.SyntheticEvent) => void;
/**
* Callback fired when the cell turns to view mode.
* @param {GridCellParams} params With all properties from [[GridCellParams]].
* @param {React.SyntheticEvent} event The event that caused this prop to be called.
*/
onCellEditStop?: (params: GridCellParams, event?: React$1.SyntheticEvent) => void;
/**
* Callback fired when an exception is thrown in the grid, or when the `showError` API method is called.
* @param args
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onError?: (args: any, details?: any) => void;
/**
* Callback fired when the active element leaves a cell.
* @param params With all properties from [[GridCellParams]].
* @param event [[MuiEvent<React.SyntheticEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onCellBlur?: (params: GridCellParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when a click event comes from a cell element.
* @param params With all properties from [[GridCellParams]].
* @param event [[MuiEvent<React.MouseEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onCellClick?: (params: GridCellParams, event: MuiEvent<React$1.MouseEvent>, details?: any) => void;
/**
* Callback fired when a double click event comes from a cell element.
* @param params With all properties from [[CellParams]].
* @param event [[MuiEvent<React.MouseEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onCellDoubleClick?: (params: GridCellParams, event: MuiEvent<React$1.MouseEvent>, details?: any) => void;
/**
* Callback fired when a cell loses focus.
* @param params With all properties from [[GridCellParams]].
* @param event [[MuiEvent<React.SyntheticEvent | DocumentEventMap['click']>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onCellFocusOut?: (params: GridCellParams, event: MuiEvent<React$1.SyntheticEvent | DocumentEventMap['click']>, details?: any) => void;
/**
* Callback fired when a keydown event comes from a cell element.
* @param params With all properties from [[GridCellParams]].
* @param event [[MuiEvent<React.KeyboardEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onCellKeyDown?: (params: GridCellParams, event: MuiEvent<React$1.KeyboardEvent>, details?: any) => void;
/**
* Callback fired when a mouseover event comes from a cell element.
* @param params With all properties from [[GridCellParams]].
* @param event [[MuiEvent<React.MouseEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onCellOver?: (params: GridCellParams, event: MuiEvent<React$1.MouseEvent>, details?: any) => void;
/**
* Callback fired when a mouseout event comes from a cell element.
* @param params With all properties from [[GridCellParams]].
* @param event [[MuiEvent<React.MouseEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onCellOut?: (params: GridCellParams, event: MuiEvent<React$1.MouseEvent>, details?: any) => void;
/**
* Callback fired when a mouse enter event comes from a cell element.
* @param params With all properties from [[GridCellParams]].
* @param event [[MuiEvent<React.MouseEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onCellEnter?: (params: GridCellParams, event: MuiEvent<React$1.MouseEvent>, details?: any) => void;
/**
* Callback fired when a mouse leave event comes from a cell element.
* @param params With all properties from [[GridCellParams]].
* @param event [[MuiEvent<React.MouseEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onCellLeave?: (params: GridCellParams, event: MuiEvent<React$1.MouseEvent>, details?: any) => void;
/**
* Callback fired when the cell value changed.
* @param params With all properties from [[GridEditCellValueParams]].
* @param event [[MuiEvent<{}>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onCellValueChange?: (params: GridEditCellValueParams, event: MuiEvent<{}>, details?: any) => void;
/**
* Callback fired when a click event comes from a column header element.
* @param params With all properties from [[GridColumnHeaderParams]].
* @param event [[MuiEvent<React.SyntheticEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onColumnHeaderClick?: (params: GridColumnHeaderParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when a double click event comes from a column header element.
* @param params With all properties from [[GridColumnHeaderParams]].
* @param event [[MuiEvent<React.SyntheticEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onColumnHeaderDoubleClick?: (params: GridColumnHeaderParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when a mouseover event comes from a column header element.
* @param params With all properties from [[GridColumnHeaderParams]].
* @param event [[MuiEvent<React.SyntheticEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onColumnHeaderOver?: (params: GridColumnHeaderParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when a mouseout event comes from a column header element.
* @param params With all properties from [[GridColumnHeaderParams]].
* @param event [[MuiEvent<React.SyntheticEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onColumnHeaderOut?: (params: GridColumnHeaderParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when a mouse enter event comes from a column header element.
* @param params With all properties from [[GridColumnHeaderParams]].
* @param event [[MuiEvent<React.SyntheticEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onColumnHeaderEnter?: (params: GridColumnHeaderParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when a mouse leave event comes from a column header element.
* @param params With all properties from [[GridColumnHeaderParams]].
* @param event [[MuiEvent<React.SyntheticEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onColumnHeaderLeave?: (params: GridColumnHeaderParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when a column is reordered.
* @param params With all properties from [[GridColumnHeaderParams]].
* @param event [[MuiEvent<{}>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onColumnOrderChange?: (params: GridColumnOrderChangeParams, event: MuiEvent<{}>, details?: any) => void;
/**
* Callback fired while a column is being resized.
* @param params With all properties from [[GridColumnResizeParams]].
* @param event [[MuiEvent<{}>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onColumnResize?: (params: GridColumnResizeParams, event: MuiEvent<{}>, details?: any) => void;
/**
* Callback fired when the width of a column is changed.
* @param params With all properties from [[GridColumnResizeParams]].
* @param event [[MuiEvent<{}>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onColumnWidthChange?: (params: GridColumnResizeParams, event: MuiEvent<{}>, details?: any) => void;
/**
* Callback fired when a column visibility changes.
* @param params With all properties from [[GridColumnVisibilityChangeParams]].
* @param event [[MuiEvent<{}>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onColumnVisibilityChange?: (params: GridColumnVisibilityChangeParams, event: MuiEvent<{}>, details?: any) => void;
/**
* Callback fired when the Filter model changes before the filters are applied.
* @param model With all properties from [[GridFilterModel]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onFilterModelChange?: (model: GridFilterModel, details?: any) => void;
/**
* Callback fired when the current page has changed.
* @param page Index of the page displayed on the Grid.
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onPageChange?: (page: number, details?: any) => void;
/**
* Callback fired when the page size has changed.
* @param pageSize Size of the page displayed on the Grid.
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onPageSizeChange?: (pageSize: number, details?: any) => void;
/**
* Callback fired when a click event comes from a row container element.
* @param params With all properties from [[GridRowParams]].
* @param event [[MuiEvent<React.SyntheticEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onRowClick?: (params: GridRowParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when scrolling to the bottom of the grid viewport.
* @param params With all properties from [[GridRowScrollEndParams]].
* @param event [[MuiEvent<{}>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onRowsScrollEnd?: (params: GridRowScrollEndParams, event: MuiEvent<{}>, details?: any) => void;
/**
* Callback fired when a double click event comes from a row container element.
* @param params With all properties from [[RowParams]].
* @param event [[MuiEvent<React.SyntheticEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onRowDoubleClick?: (params: GridRowParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when a mouseover event comes from a row container element.
* @param params With all properties from [[GridRowParams]].
* @param event [[MuiEvent<React.SyntheticEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onRowOver?: (params: GridRowParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when a mouseout event comes from a row container element.
* @param params With all properties from [[GridRowParams]].
* @param event [[MuiEvent<React.SyntheticEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onRowOut?: (params: GridRowParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when a mouse enter event comes from a row container element.
* @param params With all properties from [[GridRowParams]].
* @param event [[MuiEvent<React.SyntheticEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onRowEnter?: (params: GridRowParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when a mouse leave event comes from a row container element.
* @param params With all properties from [[GridRowParams]].
* @param event [[MuiEvent<React.SyntheticEvent>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onRowLeave?: (params: GridRowParams, event: MuiEvent<React$1.SyntheticEvent>, details?: any) => void;
/**
* Callback fired when the grid is resized.
* @param params With all properties from [[GridResizeParams]].
* @param event [[MuiEvent<{}>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onResize?: (params: GridResizeParams, event: MuiEvent<{}>, details?: any) => void;
/**
* Callback fired when the selection state of one or multiple rows changes.
* @param selectionModel With all the row ids [[GridSelectionModel]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onSelectionModelChange?: (selectionModel: GridSelectionModel, details?: any) => void;
/**
* Callback fired when the sort model changes before a column is sorted.
* @param model With all properties from [[GridSortModel]].
* @param {MuiCallbackDetails} details Additional details for this callback.
*/
onSortModelChange?: (model: GridSortModel, details?: any) => void;
/**
* Callback fired when the state of the grid is updated.
* @param params
* @param event [[MuiEvent<{}>]].
* @param {MuiCallbackDetails} details Additional details for this callback.
* @internal
*/
onStateChange?: (params: any, event: MuiEvent<{}>, details?: any) => void;
/**
* Callback fired when the rows in the viewport change.
*/
onViewportRowsChange?: (params: GridViewportRowsChangeParams, event: MuiEvent<{}>, details?: any) => void;
/**
* Set the current page.
* @default 1
*/
page?: number;
/**
* Set the number of rows in one page.
* @default 100
*/
pageSize?: number;
/**
* If `true`, pagination is enabled.
* @default false
*/
pagination?: boolean;
/**
* Pagination can be processed on the server or client-side.
* Set it to 'client' if you would like to handle the pagination on the client-side.
* Set it to 'server' if you would like to handle the pagination on the server-side.
*/
paginationMode?: GridFeatureMode;
/**
* Set the height in pixel of a row in the grid.
* @default 52
*/
rowHeight: number;
/**
* Select the pageSize dynamically using the component UI.
* @default [25, 50, 100]
*/
rowsPerPageOptions?: number[];
/**
* Set the total number of rows, if it is different than the length of the value `rows` prop.
*/
rowCount?: number;
/**
* Override the height/width of the grid inner scrollbar.
*/
scrollbarSize?: number;
/**
* Set the area at the bottom of the grid viewport where onRowsScrollEnd is called.
*/
scrollEndThreshold: number;
/**
* Set the selection model of the grid.
*/
selectionModel?: GridInputSelectionModel;
/**
* @internal enum
*/
signature?: string;
/**
* If `true`, the right border of the cells are displayed.
* @default false
*/
showCellRightBorder?: boolean;
/**
* If `true`, the right border of the column headers are displayed.
* @default false
*/
showColumnRightBorder?: boolean;
/**
* The order of the sorting sequence.
* @default ['asc', 'desc', null]
*/
sortingOrder: GridSortDirection[];
/**
* Sorting can be processed on the server or client-side.
* Set it to 'client' if you would like to handle sorting on the client-side.
* Set it to 'server' if you would like to handle sorting on the server-side.
*/
sortingMode?: GridFeatureMode;
/**
* Set the sort model of the grid.
*/
sortModel?: GridSortModel;
}
/**
* The default options to inject in the props of DataGrid or XGrid.
*/
declare const DEFAULT_GRID_PROPS_FROM_OPTIONS: {
columnBuffer: number;
density: GridDensityTypes;
filterMode: "client";
headerHeight: number;
paginationMode: "client";
rowHeight: number;
rowsPerPageOptions: number[];
scrollEndThreshold: number;
sortingMode: "client";
sortingOrder: ("asc" | "desc" | null)[];
logger: Console;
logLevel: string;
};
/**
* The default [[GridOptions]] object that will be used to merge with the 'options' passed in the react component prop.
*/
declare const DEFAULT_GRID_OPTIONS: {
localeText: GridLocaleText;
columnBuffer: number;
density: GridDensityTypes;
filterMode: "client";
headerHeight: number;
paginationMode: "client";
rowHeight: number;
rowsPerPageOptions: number[];
scrollEndThreshold: number;
sortingMode: "client";
sortingOrder: ("asc" | "desc" | null)[];
logger: Console;
logLevel: string;
};
/**
* The ref type of the inner grid root container.
*/
declare type GridRootContainerRef = React$1.RefObject<HTMLDivElement>;
/**
* The object containing the column properties of the rendering state.
*/
interface GridRenderColumnsProps {
/**
* The index of the first rendered column.
*/
firstColIdx: number;
/**
* The index of the last rendered column.
*/
lastColIdx: number;
/**
* The left offset required to position the viewport at the beginning of the first rendered column.
*/
leftEmptyWidth: number;
/**
* The right offset required to position the viewport to the end of the last rendered column.
*/
rightEmptyWidth: number;
}
/**
* The object containing the row properties of the rendering state.
*/
interface GridRenderRowProps {
/**
* The rendering zone page calculated from the scroll position.
*/
page: number;
/**
* The index of the first rendered row.
*/
firstRowIdx: number;
/**
* The index of the last rendered row.
*/
lastRowIdx: number;
}
/**
* The object containing the pagination properties of the rendering state.
*/
interface GridRenderPaginationProps {
/**
* The current page if pagination is enabled.
*/
paginationCurrentPage?: number;
/**