Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGridPro] Export GridRowReorderCell component #14079

Merged
merged 7 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "yarn 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
Loading