diff --git a/packages/grid/x-data-grid/src/components/GridRow.tsx b/packages/grid/x-data-grid/src/components/GridRow.tsx index 613fd62d7e4b1..103a64144ba68 100644 --- a/packages/grid/x-data-grid/src/components/GridRow.tsx +++ b/packages/grid/x-data-grid/src/components/GridRow.tsx @@ -258,6 +258,15 @@ const GridRow = React.forwardRef< [apiRef, onClick, publish, rowId], ); + const { + components, + componentsProps, + classes: rootClasses, + disableColumnReorder, + getCellClassName, + rowReordering, + } = rootProps as any; + const getCell = React.useCallback( ( column: GridStateColDef, @@ -277,8 +286,8 @@ const GridRow = React.forwardRef< }); const disableDragEvents = - (rootProps.disableColumnReorder && column.disableReorder) || - (!(rootProps as any).rowReordering && + (disableColumnReorder && column.disableReorder) || + (!rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0); @@ -300,7 +309,7 @@ const GridRow = React.forwardRef< content = column.renderCell({ ...cellParams, api: apiRef.current }); // TODO move to GridCell classNames.push( - clsx(gridClasses['cell--withRenderer'], rootProps.classes?.['cell--withRenderer']), + clsx(gridClasses['cell--withRenderer'], rootClasses?.['cell--withRenderer']), ); } @@ -318,12 +327,12 @@ const GridRow = React.forwardRef< content = column.renderEditCell(params); // TODO move to GridCell - classNames.push(clsx(gridClasses['cell--editing'], rootProps.classes?.['cell--editing'])); + classNames.push(clsx(gridClasses['cell--editing'], rootClasses?.['cell--editing'])); } - if (rootProps.getCellClassName) { + if (getCellClassName) { // TODO move to GridCell - classNames.push(rootProps.getCellClassName(cellParams)); + classNames.push(getCellClassName(cellParams)); } const hasFocus = focusedCell === column.field; @@ -335,7 +344,7 @@ const GridRow = React.forwardRef< }); return ( - {content} - + ); }, [ apiRef, rowId, - rootProps, + disableColumnReorder, + rowReordering, sortModel.length, treeDepth, editRowsState, + getCellClassName, focusedCell, tabbableCell, + components, rowHeight, + componentsProps?.cell, + rootClasses, ], );