Skip to content

Commit

Permalink
Merge branch 'mui:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurbalduini authored Sep 27, 2024
2 parents 2b17dd2 + c36a8d5 commit 4ecc5e9
Show file tree
Hide file tree
Showing 90 changed files with 1,146 additions and 377 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,8 @@ const rows = [

export default function ColumnMenuGridReferencesNoSnap() {
return (
<div style={{ width: '100%' }}>
<DataGridPremium
columns={columns}
rows={rows}
disableColumnMenu
autoHeight
hideFooter
/>
<div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>
<DataGridPremium columns={columns} rows={rows} disableColumnMenu hideFooter />
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,8 @@ const rows = [

export default function ColumnMenuGridReferencesNoSnap() {
return (
<div style={{ width: '100%' }}>
<DataGridPremium
columns={columns}
rows={rows}
disableColumnMenu
autoHeight
hideFooter
/>
<div style={{ display: 'flex', flexDirection: 'column', width: '100%' }}>
<DataGridPremium columns={columns} rows={rows} disableColumnMenu hideFooter />
</div>
);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
<DataGridPremium
columns={columns}
rows={rows}
disableColumnMenu
autoHeight
hideFooter
/>
<DataGridPremium columns={columns} rows={rows} disableColumnMenu hideFooter />
4 changes: 3 additions & 1 deletion docs/data/data-grid/column-spanning/ColumnSpanningDerived.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ const columns = [
];

const rootStyles = {
display: 'flex',
flexDirection: 'column',
height: 'fit-content',
width: '100%',
'& .Maths': {
backgroundColor: 'rgba(157, 255, 118, 0.49)',
Expand Down Expand Up @@ -172,7 +175,6 @@ export default function ColumnSpanningDerived() {
left: ['day'],
},
}}
autoHeight
disableRowSelectionOnClick
hideFooter
showCellVerticalBorder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ const columns: GridColDef<Row>[] = [
];

const rootStyles = {
display: 'flex',
flexDirection: 'column',
height: 'fit-content',
width: '100%',
'& .Maths': {
backgroundColor: 'rgba(157, 255, 118, 0.49)',
Expand Down Expand Up @@ -183,7 +186,6 @@ export default function ColumnSpanningDerived() {
left: ['day'],
},
}}
autoHeight
disableRowSelectionOnClick
hideFooter
showCellVerticalBorder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
left: ['day'],
},
}}
autoHeight
disableRowSelectionOnClick
hideFooter
showCellVerticalBorder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,15 @@ export default function ColumnSpanningFunction() {
return (
<Box
sx={{
display: 'flex',
flexDirection: 'column',
width: '100%',
'& .bold': {
fontWeight: 600,
},
}}
>
<DataGrid
autoHeight
disableColumnFilter
disableRowSelectionOnClick
hideFooter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,15 @@ export default function ColumnSpanningFunction() {
return (
<Box
sx={{
display: 'flex',
flexDirection: 'column',
width: '100%',
'& .bold': {
fontWeight: 600,
},
}}
>
<DataGrid
autoHeight
disableColumnFilter
disableRowSelectionOnClick
hideFooter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<DataGrid
autoHeight
disableColumnFilter
disableRowSelectionOnClick
hideFooter
Expand Down
10 changes: 8 additions & 2 deletions docs/data/data-grid/column-spanning/ColumnSpanningNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import { DataGrid } from '@mui/x-data-grid';

const other = {
autoHeight: true,
showCellVerticalBorder: true,
showColumnVerticalBorder: true,
};
Expand All @@ -14,7 +13,14 @@ const rows = [

export default function ColumnSpanningNumber() {
return (
<div style={{ width: '100%' }}>
<div
style={{
width: '100%',
display: 'flex',
flexDirection: 'column',
height: 'fit-content',
}}
>
<DataGrid
columns={[
{ field: 'username', colSpan: 2, hideable: false },
Expand Down
10 changes: 8 additions & 2 deletions docs/data/data-grid/column-spanning/ColumnSpanningNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import { DataGrid } from '@mui/x-data-grid';

const other = {
autoHeight: true,
showCellVerticalBorder: true,
showColumnVerticalBorder: true,
};
Expand All @@ -14,7 +13,14 @@ const rows = [

export default function ColumnSpanningNumber() {
return (
<div style={{ width: '100%' }}>
<div
style={{
width: '100%',
display: 'flex',
flexDirection: 'column',
height: 'fit-content',
}}
>
<DataGrid
columns={[
{ field: 'username', colSpan: 2, hideable: false },
Expand Down
3 changes: 2 additions & 1 deletion docs/data/data-grid/demo/PopularFeaturesDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,8 @@ export default function PopularFeaturesDemo() {
return (
<Box
sx={{
display: 'flex',
flexDirection: 'column',
minHeight: 1000,
width: '100%',
border: '1px solid',
Expand All @@ -500,7 +502,6 @@ export default function PopularFeaturesDemo() {
>
<DataGridPremium
apiRef={apiRef}
autoHeight
disableRowSelectionOnClick
onRowClick={onRowClick}
slots={{
Expand Down
3 changes: 2 additions & 1 deletion docs/data/data-grid/demo/PopularFeaturesDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ export default function PopularFeaturesDemo() {
return (
<Box
sx={{
display: 'flex',
flexDirection: 'column',
minHeight: 1000,
width: '100%',
border: '1px solid',
Expand All @@ -521,7 +523,6 @@ export default function PopularFeaturesDemo() {
>
<DataGridPremium
apiRef={apiRef}
autoHeight
disableRowSelectionOnClick
onRowClick={onRowClick}
slots={{
Expand Down
34 changes: 34 additions & 0 deletions docs/data/data-grid/layout/FlexGrid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import * as React from 'react';
import Button from '@mui/material/Button';
import Box from '@mui/material/Box';
import Stack from '@mui/material/Stack';
import { DataGrid } from '@mui/x-data-grid';
import { useDemoData } from '@mui/x-data-grid-generator';

export default function FlexGrid() {
const [nbRows, setNbRows] = React.useState(3);
const removeRow = () => setNbRows((x) => Math.max(0, x - 1));
const addRow = () => setNbRows((x) => Math.min(100, x + 1));

const { data, loading } = useDemoData({
dataSet: 'Commodity',
rowLength: 100,
maxColumns: 6,
});

return (
<Box sx={{ width: '100%' }}>
<Stack direction="row" spacing={1} sx={{ mb: 1 }}>
<Button size="small" onClick={removeRow}>
Remove a row
</Button>
<Button size="small" onClick={addRow}>
Add a row
</Button>
</Stack>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<DataGrid {...data} rows={data.rows.slice(0, nbRows)} loading={loading} />
</div>
</Box>
);
}
34 changes: 34 additions & 0 deletions docs/data/data-grid/layout/FlexGrid.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import * as React from 'react';
import Button from '@mui/material/Button';
import Box from '@mui/material/Box';
import Stack from '@mui/material/Stack';
import { DataGrid } from '@mui/x-data-grid';
import { useDemoData } from '@mui/x-data-grid-generator';

export default function FlexGrid() {
const [nbRows, setNbRows] = React.useState(3);
const removeRow = () => setNbRows((x) => Math.max(0, x - 1));
const addRow = () => setNbRows((x) => Math.min(100, x + 1));

const { data, loading } = useDemoData({
dataSet: 'Commodity',
rowLength: 100,
maxColumns: 6,
});

return (
<Box sx={{ width: '100%' }}>
<Stack direction="row" spacing={1} sx={{ mb: 1 }}>
<Button size="small" onClick={removeRow}>
Remove a row
</Button>
<Button size="small" onClick={addRow}>
Add a row
</Button>
</Stack>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<DataGrid {...data} rows={data.rows.slice(0, nbRows)} loading={loading} />
</div>
</Box>
);
}
11 changes: 11 additions & 0 deletions docs/data/data-grid/layout/FlexGrid.tsx.preview
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Stack direction="row" spacing={1} sx={{ mb: 1 }}>
<Button size="small" onClick={removeRow}>
Remove a row
</Button>
<Button size="small" onClick={addRow}>
Add a row
</Button>
</Stack>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<DataGrid {...data} rows={data.rows.slice(0, nbRows)} loading={loading} />
</div>
Loading

0 comments on commit 4ecc5e9

Please sign in to comment.