Skip to content

Commit

Permalink
[DataGrid Pro]: export GridRowReorderCell (#14079)
Browse files Browse the repository at this point in the history
Signed-off-by: Michel Engelen <[email protected]>
Signed-off-by: Gene Arch <[email protected]>
Co-authored-by: Michel Engelen <[email protected]>
Co-authored-by: Olivier Tassinari <[email protected]>
Co-authored-by: Rom Grk <[email protected]>
Co-authored-by: Gene Arch <[email protected]>
  • Loading branch information
5 people authored Aug 25, 2024
1 parent b321b40 commit 3f90e76
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export interface GridAggregationFunction<V = any, AV = V> {
getCellValue?: (params: GridAggregationGetCellValueParams) => V;
}

interface GridAggregationParams<V = any> {
export interface GridAggregationParams<V = any> {
values: (V | undefined)[];
groupId: GridRowId;
field: GridColDef['field'];
Expand Down
70 changes: 70 additions & 0 deletions packages/x-data-grid-pro/src/components/GridRowReorderCell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import composeClasses from '@mui/utils/composeClasses';
import {
GridRenderCellParams,
Expand Down Expand Up @@ -96,6 +97,75 @@ function GridRowReorderCell(params: GridRenderCellParams) {
);
}

GridRowReorderCell.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the TypeScript types and run "pnpm proptypes" |
// ----------------------------------------------------------------------
/**
* GridApi that let you manipulate the grid.
*/
api: PropTypes.object.isRequired,
/**
* The mode of the cell.
*/
cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
/**
* The column of the row that the current cell belongs to.
*/
colDef: PropTypes.object.isRequired,
/**
* The column field of the cell that triggered the event.
*/
field: PropTypes.string.isRequired,
/**
* A ref allowing to set imperative focus.
* It can be passed to the element that should receive focus.
* @ignore - do not document.
*/
focusElementRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
current: PropTypes.shape({
focus: PropTypes.func.isRequired,
}),
}),
]),
/**
* The cell value formatted with the column valueFormatter.
*/
formattedValue: PropTypes.any,
/**
* If true, the cell is the active element.
*/
hasFocus: PropTypes.bool.isRequired,
/**
* The grid row id.
*/
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
/**
* If true, the cell is editable.
*/
isEditable: PropTypes.bool,
/**
* The row model of the row that the current cell belongs to.
*/
row: PropTypes.any.isRequired,
/**
* The node of the row that the current cell belongs to.
*/
rowNode: PropTypes.object.isRequired,
/**
* the tabIndex value.
*/
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
/**
* The cell value.
* If the column has `valueGetter`, use `params.row` to directly access the fields.
*/
value: PropTypes.any,
} as any;

export { GridRowReorderCell };

export const renderRowReorderCell = (params: GridRenderCellParams) => {
Expand Down
1 change: 1 addition & 0 deletions packages/x-data-grid-pro/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
export * from './GridTreeDataGroupingCell';
export * from './GridColumnMenuPinningItem';
export * from './GridDetailPanelToggleCell';
export * from './GridRowReorderCell';
export * from '../material/icons';
export * from './headerFiltering';
3 changes: 3 additions & 0 deletions scripts/x-data-grid-premium.exports.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
{ "name": "gridAggregationLookupSelector", "kind": "Variable" },
{ "name": "GridAggregationModel", "kind": "TypeAlias" },
{ "name": "gridAggregationModelSelector", "kind": "Variable" },
{ "name": "GridAggregationParams", "kind": "Interface" },
{ "name": "GridAggregationPosition", "kind": "TypeAlias" },
{ "name": "GridAggregationRule", "kind": "Interface" },
{ "name": "GridAggregationRules", "kind": "TypeAlias" },
Expand Down Expand Up @@ -528,6 +529,7 @@
{ "name": "GridRowProApi", "kind": "Interface" },
{ "name": "GridRowProPrivateApi", "kind": "Interface" },
{ "name": "GridRowProps", "kind": "Interface" },
{ "name": "GridRowReorderCell", "kind": "Function" },
{ "name": "GridRowScrollEndParams", "kind": "Interface" },
{ "name": "gridRowsDataRowIdToIdLookupSelector", "kind": "Variable" },
{ "name": "GridRowSelectionApi", "kind": "Interface" },
Expand Down Expand Up @@ -648,6 +650,7 @@
{ "name": "renderEditDateCell", "kind": "Variable" },
{ "name": "renderEditInputCell", "kind": "Variable" },
{ "name": "renderEditSingleSelectCell", "kind": "Variable" },
{ "name": "renderRowReorderCell", "kind": "Variable" },
{ "name": "RowPropsOverrides", "kind": "Interface" },
{ "name": "selectedGridRowsCountSelector", "kind": "Variable" },
{ "name": "selectedGridRowsSelector", "kind": "Variable" },
Expand Down
2 changes: 2 additions & 0 deletions scripts/x-data-grid-pro.exports.json
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@
{ "name": "GridRowProApi", "kind": "Interface" },
{ "name": "GridRowProPrivateApi", "kind": "Interface" },
{ "name": "GridRowProps", "kind": "Interface" },
{ "name": "GridRowReorderCell", "kind": "Function" },
{ "name": "GridRowScrollEndParams", "kind": "Interface" },
{ "name": "gridRowsDataRowIdToIdLookupSelector", "kind": "Variable" },
{ "name": "GridRowSelectionApi", "kind": "Interface" },
Expand Down Expand Up @@ -600,6 +601,7 @@
{ "name": "renderEditDateCell", "kind": "Variable" },
{ "name": "renderEditInputCell", "kind": "Variable" },
{ "name": "renderEditSingleSelectCell", "kind": "Variable" },
{ "name": "renderRowReorderCell", "kind": "Variable" },
{ "name": "RowPropsOverrides", "kind": "Interface" },
{ "name": "selectedGridRowsCountSelector", "kind": "Variable" },
{ "name": "selectedGridRowsSelector", "kind": "Variable" },
Expand Down

0 comments on commit 3f90e76

Please sign in to comment.