Skip to content

Commit

Permalink
[core] Add runtine warning for deprecated autoHeight prop
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Dec 28, 2024
1 parent 7bc37b2 commit 92626e4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/public/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/r/x-pro-svg-link https://mui.com/x/introduction/licensing/#pro-plan 302
/r/x-premium-svg https://mui.com/static/x/premium.svg 302
/r/x-premium-svg-link https://mui.com/x/introduction/licensing/#premium-plan 302
/r/x-grid-deprecate-auto-height https://mui.com/x/react-data-grid/layout/#flex-parent-container 302

# Legacy redirection
# Added in chronological order (the last line is the most recent one)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { useLicenseVerifier, Watermark } from '@mui/x-license';
import deprecatedPropType from '@mui/utils/deprecatedPropType';
import {
GridBody,
GridFooterPlaceholder,
Expand Down Expand Up @@ -111,13 +112,13 @@ DataGridPremiumRaw.propTypes = {
/**
* If `true`, the Data Grid height is dynamic and follows the number of rows in the Data Grid.
* @default false
* @deprecated Use flex parent container instead: https://mui.com/x/react-data-grid/layout/#flex-parent-container
* @deprecated Use flex parent container instead: https://mui.com/r/x-grid-deprecate-auto-height.
* @example
* <div style={{ display: 'flex', flexDirection: 'column' }}>
* <DataGrid />
* </div>
*/
autoHeight: PropTypes.bool,
autoHeight: deprecatedPropType(PropTypes.bool, 'Use flex parent container instead: https://mui.com/r/x-grid-deprecate-auto-height.'),
/**
* 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
Expand Down
5 changes: 3 additions & 2 deletions packages/x-data-grid-pro/src/DataGridPro/DataGridPro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from '@mui/x-data-grid';
import { validateProps } from '@mui/x-data-grid/internals';
import { forwardRef } from '@mui/x-internals/forwardRef';
import deprecatedPropType from '@mui/utils/deprecatedPropType';
import { useDataGridProComponent } from './useDataGridProComponent';
import { DataGridProProps } from '../models/dataGridProProps';
import { useDataGridProProps } from './useDataGridProProps';
Expand Down Expand Up @@ -98,13 +99,13 @@ DataGridProRaw.propTypes = {
/**
* If `true`, the Data Grid height is dynamic and follows the number of rows in the Data Grid.
* @default false
* @deprecated Use flex parent container instead: https://mui.com/x/react-data-grid/layout/#flex-parent-container
* @deprecated Use flex parent container instead: https://mui.com/r/x-grid-deprecate-auto-height.
* @example
* <div style={{ display: 'flex', flexDirection: 'column' }}>
* <DataGrid />
* </div>
*/
autoHeight: PropTypes.bool,
autoHeight: deprecatedPropType(PropTypes.bool, 'Use flex parent container instead: https://mui.com/r/x-grid-deprecate-auto-height.'),
/**
* 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
Expand Down
5 changes: 3 additions & 2 deletions packages/x-data-grid/src/DataGrid/DataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { forwardRef } from '@mui/x-internals/forwardRef';
import deprecatedPropType from '@mui/utils/deprecatedPropType';
import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot } from '../components';
import { useGridAriaAttributes } from '../hooks/utils/useGridAriaAttributes';
import { useGridRowAriaAttributes } from '../hooks/features/rows/useGridRowAriaAttributes';
Expand Down Expand Up @@ -108,13 +109,13 @@ DataGridRaw.propTypes = {
/**
* If `true`, the Data Grid height is dynamic and follows the number of rows in the Data Grid.
* @default false
* @deprecated Use flex parent container instead: https://mui.com/x/react-data-grid/layout/#flex-parent-container
* @deprecated Use flex parent container instead: https://mui.com/r/x-grid-deprecate-auto-height.
* @example
* <div style={{ display: 'flex', flexDirection: 'column' }}>
* <DataGrid />
* </div>
*/
autoHeight: PropTypes.bool,
autoHeight: deprecatedPropType(PropTypes.bool, 'Use flex parent container instead: https://mui.com/r/x-grid-deprecate-auto-height.'),
/**
* 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
Expand Down
2 changes: 1 addition & 1 deletion packages/x-data-grid/src/models/props/DataGridProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export interface DataGridPropsWithDefaultValues<R extends GridValidRowModel = an
/**
* If `true`, the Data Grid height is dynamic and follows the number of rows in the Data Grid.
* @default false
* @deprecated Use flex parent container instead: https://mui.com/x/react-data-grid/layout/#flex-parent-container
* @deprecated Use flex parent container instead: https://mui.com/r/x-grid-deprecate-auto-height.
* @example
* <div style={{ display: 'flex', flexDirection: 'column' }}>
* <DataGrid />
Expand Down

0 comments on commit 92626e4

Please sign in to comment.