@material-ui/x-grid
Version:
The commercial edition of the data grid component (Material-UI X).
1,629 lines (1,562 loc) • 160 kB
TypeScript
export { LicenseInfo } from '@material-ui/x-license';
import * as React$1 from 'react';
import { InputBaseProps } from '@material-ui/core/InputBase';
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 * as styles from '@material-ui/core/styles';
import * as reselect from 'reselect';
import { OutputSelector } from 'reselect';
/**
* 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: any;
/**
* 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: any;
/**
* 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;
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: any) => 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';
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;
/**
* 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 true
*/
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;
/**
* 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 contaning 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;
/**
* Allows to disable the click event in cells.
* @default false
*/
disableClickEventBubbling?: 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[];
}
interface GridColumnProp extends Omit<GridColDef, 'filterOperators'> {
filterOperators?: GridFilterOperator[] | string;
}
declare type GridColumns = GridColDef[];
declare type GridColTypeDef = Omit<GridColDef, 'field'> & {
extendType?: GridNativeColTypes;
};
/**
* Meta Info about columns.
*/
interface GridColumnsMeta {
totalWidth: number;
positions: number[];
}
declare type GridColumnLookup = {
[field: string]: GridColDef;
};
interface GridInternalColumns {
all: string[];
lookup: GridColumnLookup;
}
declare const getInitialGridColumnsState: () => GridInternalColumns;
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) => 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 GridFilterModelState {
items: GridFilterItem[];
linkOperator?: GridLinkOperator;
}
declare type GridFilterModel = GridFilterModelState;
declare const getInitialGridFilterState: () => GridFilterModelState;
/**
* 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;
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;
}
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 of the filter changed event.
*/
interface GridFilterModelParams {
/**
* The filter model.
*/
filterModel: GridFilterModel;
/**
* The full set of columns.
*/
columns: GridColumns;
/**
* The full set of rows.
*/
rows: Map<GridRowId, GridRowModel>;
/**
* The set of currently visible rows.
*/
visibleRows: Map<GridRowId, GridRowModel>;
/**
* Api that let you manipulate the grid.
*/
api: any;
}
/**
* Object passed as parameter of the page change event handler.
*/
interface GridPageChangeParams {
/**
* The new page.
*/
page: number;
/**
* The total number of pages.
*/
pageCount: number;
/**
* The number of rows in a page.
*/
pageSize: number;
/**
* The total number of rows.
*/
rowCount: number;
/**
* The pagination mode set in options.
* 'client' means that the pagination is handled on the client-side.
* 'server' means that the pagination is handled on the server-side.
*/
paginationMode: GridFeatureMode;
}
/**
* 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: any;
/**
* 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;
}
/**
* Object passed as parameter as the row selected event handler.
*/
interface GridRowSelectedParams {
/**
* The row data of the row that triggers the event.
*/
data: GridRowModel;
/**
* The selected state of the row that triggers the event.
*/
isSelected: boolean;
/**
* GridApiRef that let you manipulate the grid.
*/
api: any;
}
/**
* Object passed as parameter as the selection change event handler.
*/
interface GridSelectionModelChangeParams {
/**
* The set of rows that had their selection state change.
*/
selectionModel: GridRowId[];
}
/**
* Object passed as parameter of the column sorted event.
*/
interface GridSortModelParams {
/**
* The sort model used to sort the grid.
*/
sortModel: GridSortModel;
/**
* The full set of columns.
*/
columns: GridColumns;
/**
* Api that let you manipulate the grid.
*/
api: any;
}
declare type GridSelectionModel = GridRowId[];
interface GridEditCellPropsParams {
id: GridRowId;
field: string;
props: GridEditCellProps;
}
interface GridEditCellValueParams {
id: GridRowId;
field: string;
value: GridCellValue;
}
interface GridCellModeChangeParams {
id: GridRowId;
field: string;
api: any;
mode: GridCellMode;
}
interface GridEditRowModelParams {
model: GridEditRowsModel;
api: any;
}
/**
* 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: any;
/**
* 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: any;
/**
* 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: any;
/**
* 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;
}
/**
* 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;
/**
* 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`, 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;
/**
* Edit cell or rows can be processed on the server or client-side.
* Set it to 'client' if you would like to handle editing on the client-side.
* Set it to 'server' if you would like to handle editing on the server-side.
*/
editMode?: GridFeatureMode;
/**
* Set the edit rows model of the grid.
*/
editRowsModel?: GridEditRowsModel;
/**
* Filtering can be processed on the server or client-side.
* Set it to 'client' if you would like to handle filtering on the client-side.
* Set it to 'server' if you would like to handle filtering on the server-side.
*/
filterMode?: GridFeatureMode;
/**
* Set the filter model of the grid.
*/
filterModel?: GridFilterModel;
/**
* Function that applies CSS classes dynamically on cells.
*/
getCellClassName?: (params: GridCellParams) => string;
/**
* Function that applies CSS classes dynamically on rows.
*/
getRowClassName?: (params: GridRowParams) => 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.
*/
isCellEditable?: (params: GridCellParams) => boolean;
/**
* Determines if a row can be selected.
*/
isRowSelectable?: (params: GridRowParams) => 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 changed.
* @param handler
*/
onEditCellChange?: (params: GridEditCellPropsParams, event?: React$1.SyntheticEvent) => void;
/**
* Callback fired when the cell changes are committed.
* @param handler
*/
onEditCellChangeCommitted?: (params: GridEditCellPropsParams, event?: React$1.SyntheticEvent) => void;
/**
* Callback fired when the EditRowModel changed.
* @param handler
*/
onEditRowModelChange?: (params: GridEditRowModelParams) => void;
/**
* Callback fired when an exception is thrown in the grid, or when the `showError` API method is called.
*/
onError?: (args: any) => void;
/**
* Callback fired when the active element leaves a cell.
* @param param With all properties from [[GridCellParams]].
* @param event [[React.MouseEvent]].
*/
onCellBlur?: (params: GridCellParams, event: React$1.SyntheticEvent) => void;
/**
* Callback fired when a click event comes from a cell element.
* @param param With all properties from [[GridCellParams]].
* @param event [[React.MouseEvent]].
*/
onCellClick?: (params: GridCellParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a double click event comes from a cell element.
* @param param With all properties from [[CellParams]].
* @param event [[React.MouseEvent]].
*/
onCellDoubleClick?: (params: GridCellParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a keydown event comes from a cell element.
* @param param With all properties from [[GridCellParams]].
* @param event [[React.KeyboardEvent]].
*/
onCellKeyDown?: (params: GridCellParams, event: React$1.KeyboardEvent) => void;
/**
* Callback fired when a mouseover event comes from a cell element.
* @param param With all properties from [[GridCellParams]].
* @param event [[React.MouseEvent]].
*/
onCellOver?: (params: GridCellParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a mouseout event comes from a cell element.
* @param param With all properties from [[GridCellParams]].
* @param event [[React.MouseEvent]].
*/
onCellOut?: (params: GridCellParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a mouse enter event comes from a cell element.
* @param param With all properties from [[GridCellParams]].
* @param event [[React.MouseEvent]].
*/
onCellEnter?: (params: GridCellParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a mouse leave event comes from a cell element.
* @param param With all properties from [[GridCellParams]].
* @param event [[React.MouseEvent]].
*/
onCellLeave?: (params: GridCellParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when the cell mode changed.
* @param handler
*/
onCellModeChange?: (params: GridCellModeChangeParams) => void;
/**
* Callback fired when the cell value changed.
* @param handler
*/
onCellValueChange?: (params: GridEditCellValueParams) => void;
/**
* Callback fired when a click event comes from a column header element.
* @param param With all properties from [[GridColumnHeaderParams]].
* @param event [[React.MouseEvent]].
*/
onColumnHeaderClick?: (param: GridColumnHeaderParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a double click event comes from a column header element.
* @param param With all properties from [[GridColumnHeaderParams]].
* @param event [[React.MouseEvent]].
*/
onColumnHeaderDoubleClick?: (param: GridColumnHeaderParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a mouseover event comes from a column header element.
* @param param With all properties from [[GridColumnHeaderParams]].
* @param event [[React.MouseEvent]].
*/
onColumnHeaderOver?: (param: GridColumnHeaderParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a mouseout event comes from a column header element.
* @param param With all properties from [[GridColumnHeaderParams]].
* @param event [[React.MouseEvent]].
*/
onColumnHeaderOut?: (param: GridColumnHeaderParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a mouse enter event comes from a column header element.
* @param param With all properties from [[GridColumnHeaderParams]].
* @param event [[React.MouseEvent]].
*/
onColumnHeaderEnter?: (param: GridColumnHeaderParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a mouse leave event comes from a column header element.
* @param param With all properties from [[GridColumnHeaderParams]].
* @param event [[React.MouseEvent]].
*/
onColumnHeaderLeave?: (param: GridColumnHeaderParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a column is reordered.
* @param param With all properties from [[GridColumnHeaderParams]].
*/
onColumnOrderChange?: (param: GridColumnOrderChangeParams) => void;
/**
* Callback fired when a column is resizing.
* @param param With all properties from [[GridColumnResizeParams]].
*/
onColumnResize?: (param: GridColumnResizeParams) => void;
/**
* Callback fired when a column is resized.
* @param param With all properties from [[GridColumnResizeParams]].
*/
onColumnResizeCommitted?: (param: GridColumnResizeParams) => void;
/**
* Callback fired when a column visibility changes.
* @param param With all properties from [[GridColumnVisibilityChangeParams]].
*/
onColumnVisibilityChange?: (param: GridColumnVisibilityChangeParams) => void;
/**
* Callback fired when the Filter model changes before the filters are applied.
* @param param With all properties from [[GridFilterModelParams]].
*/
onFilterModelChange?: (params: GridFilterModelParams) => void;
/**
* Callback fired when the current page has changed.
* @param param With all properties from [[GridPageChangeParams]].
*/
onPageChange?: (param: GridPageChangeParams) => void;
/**
* Callback fired when the page size has changed.
* @param param With all properties from [[GridPageChangeParams]].
*/
onPageSizeChange?: (param: GridPageChangeParams) => void;
/**
* Callback fired when a click event comes from a row container element.
* @param param With all properties from [[GridRowParams]].
* @param event [[React.MouseEvent]].
*/
onRowClick?: (param: GridRowParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when scrolling to the bottom of the grid viewport.
* @param param
*/
onRowsScrollEnd?: (params: GridRowScrollEndParams) => void;
/**
* Callback fired when a double click event comes from a row container element.
* @param param With all properties from [[RowParams]].
* @param event [[React.MouseEvent]].
*/
onRowDoubleClick?: (param: GridRowParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a mouseover event comes from a row container element.
* @param param With all properties from [[GridRowParams]].
* @param event [[React.MouseEvent]].
*/
onRowOver?: (param: GridRowParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a mouseout event comes from a row container element.
* @param param With all properties from [[GridRowParams]].
* @param event [[React.MouseEvent]].
*/
onRowOut?: (param: GridRowParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a mouse enter event comes from a row container element.
* @param param With all properties from [[GridRowParams]].
* @param event [[React.MouseEvent]].
*/
onRowEnter?: (param: GridRowParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when a mouse leave event comes from a row container element.
* @param param With all properties from [[GridRowParams]].
* @param event [[React.MouseEvent]].
*/
onRowLeave?: (param: GridRowParams, event: React$1.MouseEvent) => void;
/**
* Callback fired when one row is selected.
* @param param With all properties from [[GridRowSelectedParams]].
*/
onRowSelected?: (param: GridRowSelectedParams) => void;
/**
* Callback fired when the grid is resized.
* @param param With all properties from [[GridResizeParams]].
*/
onResize?: (param: GridResizeParams) => void;
/**
* Callback fired when the selection state of one or multiple rows changes.
* @param param With all properties from [[SelectionChangeParams]].
*/
onSelectionModelChange?: (param: GridSelectionModelChangeParams) => void;
/**
* Callback fired when the sort model changes before a column is sorted.
* @param param With all properties from [[GridSortModelParams]].
*/
onSortModelChange?: (params: GridSortModelParams) => void;
/**
* Callback fired when the state of the grid is updated.
*/
onStateChange?: (params: 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?: GridSelectionModel;
/**
* 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 [[GridOptions]] object that will be used to merge with the 'options' passed in the react component prop.
*/
declare const DEFAULT_GRID_OPTIONS: GridOptions;
/**
* 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;
/**
* The page size if pagination is enabled.
*/
pageSize?: number;
}
/**
* The full rendering state.
*/
declare type GridRenderContextProps = GridRenderColumnsProps & GridRenderRowProps & GridRenderPaginationProps;
interface GridColumnMenuState {
open: boolean;
field?: string;
}
interface GridColumnReorderState {
dragCol: string;
}
declare function getInitialGridColumnReorderState(): GridColumnReorderState;
interface GridColumnResizeState {
resizingColumnField: string;
}
declare function getInitialGridColumnResizeState(): GridColumnResizeState;
interface GridGridDensity {
value: GridDensity;
rowHeight: number;
headerHeight: number;
}
interface VisibleGridRowsState {
visibleRowsLookup: Record<GridRowId, boolean>;
visibleRows?: GridRowId[];
}
declare const getInitialVisibleGridRowsState: () => VisibleGridRowsState;
declare type GridCellIdentifier = {
id: GridRowId;
field: string;
};
declare type GridColumnIdentifier = {
field: string;
};
interface GridFocusState {
cell: GridCellIdentifier | null;
columnHeader: GridColumnIdentifier | null;
}
interface GridTabIndexState {
cell: GridCellIdentifier | null;
columnHeader: GridColumnIdentifier | null;
}
interface GridPaginationState {
page: number;
pageCount: number;
pageSize: number;
rowCount: number;
paginationMode: GridFeatureMode;
}
declare enum GridPreferencePanelsValue {
filters = "filters",
columns = "columns"
}
interface GridPreferencePanelState {
open: boolean;
openedPanelValue?: GridPreferencePanelsValue;
}
interface InternalGridRowsState {
idRowsLookup: Record<GridRowId, GridRowModel>;
allRows: GridRowId[];
totalRowCount: number;
}
declare const getInitialGridRowState: () => InternalGridRowsState;
declare type GridSelectionState = Record<string, GridRowId>;
interface GridSortingState {
sortedRows: GridRowId[];
sortModel: GridSortModel;
}
declare function getInitialGridSortingState(): GridSortingState;
interface GridScrollParams {
left: number;
top: number;
}
declare type GridScrollFn = (v: GridScrollParams) => void;
interface InternalRenderingState {
virtualPage: number;
virtualRowsCount: number;
renderContext: Partial<GridRenderContextProps> | null;
realScroll: GridScrollParams;
renderingZoneScroll: GridScrollParams;
renderedSizes: GridContainerProps | null;
}
declare const getInitialGridRenderingState: () => InternalRenderingState;
interface GridState {
rows: InternalGridRowsState;
editRows: GridEditRowsModel;
pagination: GridPaginationState;
options: GridOptions;
isScrolling: boolean;
columns: GridInternalColumns;
columnReorder: GridColumnReorderState;
columnResize: GridColumnResizeState;
columnMenu: GridColumnMenuState;
rendering: InternalRenderingState;
containerSizes: GridContainerProps | null;
viewportSizes: GridViewportSizeState;
scrollBar: GridScrollBarState;
sorting: GridSortingState;
focus: GridFocusState;
tabIndex: GridTabIndexState;
selection: GridSelectionState;
filter: GridFilterModelState;
visibleRows: VisibleGridRowsState;
preferencePanel: GridPreferencePanelState;
density: GridGridDensity;
error?: any;
}
declare const getInitialGridState: () => GridState;
/**
* The column menu API interface that is available in the grid [[apiRef]].
*/
interface GridColumnMenuApi {
/**
* Display the column menu under the `field` column.
* @param {string} field The column to display the menu.
*/
showColumnMenu: (field: string) => void;
/**
* Hides the column menu that is open.
*/
hideColumnMenu: () => void;
/**
* Toggles the column menu under the `field` column.
* @param {string} field The field name to toggle the column menu.
*/
toggleColumnMenu: (field: string) => void;
}
interface GridFocusApi {
/**
* Sets the focus to the cell at the given `id` and `field`.
* @param {GridRowId} id The row id.
* @param {string} field The column field.
*/
setCellFocus: (id: GridRowId, field: string) => void;
/**
* Sets the focus to the column header at the given `field`.
* @param {string} field The column field.
*/
setColumnHeaderFocus: (field: string) => void;
}
interface GridParamsApi {
/**
* Gets the value of a cell at the given `id` and `field`.
* @param {GridRowId} id The id of the row.
* @param {string} field The column field.
* @returns {GridCellValue} The cell value.
*/
getCellValue: (id: GridRowId, field: string) => GridCellValue;
/**
* Gets the underlying DOM element for a cell at the given `id` and `field`.
* @param {GridRowId} id The id of the row.
* @param {string} field The column field.
* @returns {HTMLDivElement | null} The DOM element or `null`.
*/
getCellElement: (id: GridRowId, field: string) => HTMLDivElement | null;
/**
* Gets the [[GridCellParams]] object that is passed as argument in events.
* @param {GridRowId} id The id of the row.
* @param {string} field The column field.
* @returns {GridCellParams} The cell params.
*/
getCellParams: (id: GridRowId, field: string) => GridCellParams;
/**
* Gets the [[GridRowParams]] object that is passed as argument in events.
* @param {GridRowId} id The id of the row.
* @param {string} field The column field.
* @returns {GridRowParams} The row params.
*/
getRowParams: (id: GridRowId) => GridRowParams;
/**
* Gets the underlying DOM element for a row at the given `id`.
* @param {GridRowId} id The id of the row.
* @returns {HTMLDivElement | null} The DOM element or `null`.
*/
getRowElement: (id: GridRowId) => HTMLDivElement | null;
/**
* Gets the underlying DOM element for the column header with the given `field`.
* @param {string} field The column field.
* @returns {HTMLDivElement | null} The DOM element or `null`.
*/
getColumnHeaderElement: (field: string) => HTMLDivElement | null;
/**
* Gets the [[GridColumnHeaderParams]] object that is passed as argument in events.
* @param {string} field The column field.
* @returns {GridColumnHeaderParams} The cell params.
*/
getColumnHeaderParams: (field: string) => GridColumnHeaderParams;
}
/**
* Set of icons used in the grid component UI.
*/
interface GridIconSlotsComponent {
/**
* Icon displayed on the boolean cell to represent the true value.
*/
BooleanCellTrueIcon?: React$1.JSXElementConstructor<any>;
/**
* Icon displayed on the boolean cell to represent the false value.
*/
BooleanCellFalseIcon?: Rea