Skip to content

Commit

Permalink
feat: update @mui/x-data-grid to 7
Browse files Browse the repository at this point in the history
  • Loading branch information
alicanerdurmaz committed Nov 15, 2024
1 parent a8bbc70 commit 1f65aa8
Show file tree
Hide file tree
Showing 135 changed files with 548 additions and 558 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export const PostList: React.FC = () => {

return (
<List>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down
11 changes: 5 additions & 6 deletions documentation/blog/2022-08-23-mui-usedatagrid.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ const EmployeeList: React.FC = () => {
headerName: "Full Name",
minWidth: 150,
flex: 1,
valueGetter: (params) =>
`${params.row.first_name || ""} ${params.row.last_name || ""}`,
valueGetter: (_, row) => `${first_name || ""} ${last_name || ""}`,
},
{
field: "email",
Expand Down Expand Up @@ -482,8 +481,8 @@ const EmployeeList: React.FC = () => {
headerName: "Full Name",
minWidth: 150,
flex: 1,
valueGetter: (params) =>
`${params.row.first_name || ""} ${params.row.last_name || ""}`,
valueGetter: (_, row) =>
`${row.first_name || ""} ${row.last_name || ""}`,
},
{
field: "email",
Expand Down Expand Up @@ -653,8 +652,8 @@ const EmployeeList: React.FC = () => {
headerName: "Full Name",
minWidth: 150,
flex: 1,
valueGetter: (params) =>
`${params.row.first_name || ""} ${params.row.last_name || ""}`,
valueGetter: (_, row) =>
`${row.first_name || ""} ${row.last_name || ""}`,
},
{
field: "email",
Expand Down
2 changes: 1 addition & 1 deletion documentation/blog/2022-12-23-dynamic-hook-form.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ Finally, declare the `<DataGrid>` component within the `List` component and add

return (
<List>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
```
Expand Down
8 changes: 6 additions & 2 deletions documentation/docs/getting-started/example/sandpack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,7 @@ export const ProductList = () => {
const value = row?.category;
return value;
},
display: "flex",
renderCell: function render({ value }) {
return categoryLoading ? (
<>{translate("loading")}</>
Expand All @@ -888,6 +889,7 @@ export const ProductList = () => {
headerName: translate("products.fields.price"),
minWidth: 100,
maxWidth: 150,
display: "flex",
renderCell: ({ value }) => {
return (
<NumberField
Expand All @@ -902,6 +904,7 @@ export const ProductList = () => {
field: "actions",
headerName: translate("table.actions"),
sortable: false,
display: "flex",
renderCell: function render({ row }) {
return (
<>
Expand All @@ -921,7 +924,7 @@ export const ProductList = () => {
return (
<List>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down Expand Up @@ -1171,6 +1174,7 @@ export const CategoryList: React.FC = () => {
field: "actions",
headerName: translate("table.actions"),
sortable: false,
display: "flex",
renderCell: function render({ row }) {
return (
<>
Expand All @@ -1190,7 +1194,7 @@ export const CategoryList: React.FC = () => {
return (
<List>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function MaterialUIAuth() {
"@mui/lab": "^6.0.0-beta.14",
"@mui/material": "^6.1.6",
"@mui/system": "latest",
"@mui/x-data-grid": "^6.6.0",
"@mui/x-data-grid": "^7.22.2",
}}
startRoute="/login"
files={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function ServerSideValidationMui() {
"@mui/lab": "^6.0.0-beta.14",
"@mui/material": "^6.1.6",
"@mui/system": "latest",
"@mui/x-data-grid": "^6.6.0",
"@mui/x-data-grid": "^7.22.2",
"react-router-dom": "latest",
"react-router": "latest",
"react-hook-form": "^7.43.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function MaterialUIAuth() {
"@mui/lab": "^6.0.0-beta.14",
"@mui/material": "^6.1.6",
"@mui/system": "latest",
"@mui/x-data-grid": "^6.6.0",
"@mui/x-data-grid": "^7.22.2",
}}
startRoute="/login"
files={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function MaterialUILayout() {
"@mui/lab": "^6.0.0-beta.14",
"@mui/material": "^6.1.6",
"@mui/system": "latest",
"@mui/x-data-grid": "^6.6.0",
"@mui/x-data-grid": "^7.22.2",
}}
startRoute="/my-products"
files={{
Expand Down Expand Up @@ -133,6 +133,7 @@ export const ProductList = () => {
field: "actions",
headerName: "Actions",
sortable: false,
display: "flex",
renderCell: function render({ row }) {
return (
<>
Expand All @@ -150,7 +151,7 @@ export const ProductList = () => {
return (
<List>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ const SampleList = () => {
return value;
},
minWidth: 300,
display: "flex",
renderCell: function render({ value }) {
return categoryIsLoading ? (
<>Loading...</>
Expand All @@ -876,6 +877,7 @@ const SampleList = () => {
field: "createdAt",
headerName: "Created At",
minWidth: 250,
display: "flex",
renderCell: function render({ value }) {
return <RefineMui.DateField value={value} />;
},
Expand All @@ -886,7 +888,7 @@ const SampleList = () => {

return (
<RefineMui.List>
<MuiXDataGrid.DataGrid {...dataGridProps} columns={columns} autoHeight />
<MuiXDataGrid.DataGrid {...dataGridProps} columns={columns} />
</RefineMui.List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,7 @@ const SampleList = () => {
return value;
},
minWidth: 300,
display: "flex",
renderCell: function render({ value }) {
return categoryIsLoading ? (
<>Loading...</>
Expand All @@ -1395,13 +1396,15 @@ const SampleList = () => {
field: "createdAt",
headerName: "Created At",
minWidth: 250,
display: "flex",
renderCell: function render({ value }) {
return <RefineMui.DateField value={value} />;
},
},
{
field: "actions",
headerName: "Actions",
display: "flex",
renderCell: function render({ row }) {
return (
<>
Expand All @@ -1419,7 +1422,7 @@ const SampleList = () => {

return (
<RefineMui.List>
<MuiXDataGrid.DataGrid {...dataGridProps} columns={columns} autoHeight />
<MuiXDataGrid.DataGrid {...dataGridProps} columns={columns} />
</RefineMui.List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const SampleList = () => {
return value;
},
minWidth: 300,
display: "flex",
renderCell: function render({ value }) {
return categoryIsLoading ? (
<>Loading...</>
Expand All @@ -59,6 +60,7 @@ const SampleList = () => {
field: "createdAt",
headerName: "Created At",
minWidth: 250,
display: "flex",
renderCell: function render({ value }) {
return <DateField value={value} />;
},
Expand All @@ -69,7 +71,7 @@ const SampleList = () => {

return (
<List>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,7 @@ const SampleList = () => {
return value;
},
minWidth: 300,
display: "flex",
renderCell: function render({ value }) {
return categoryIsLoading ? (
<>Loading...</>
Expand All @@ -1010,13 +1011,15 @@ const SampleList = () => {
field: "createdAt",
headerName: "Created At",
minWidth: 250,
display: "flex",
renderCell: function render({ value }) {
return <RefineMui.DateField value={value} />;
},
},
{
field: "actions",
headerName: "Actions",
display: "flex",
renderCell: function render({ row }) {
return (
<>
Expand All @@ -1034,7 +1037,7 @@ const SampleList = () => {

return (
<RefineMui.List>
<MuiXDataGrid.DataGrid {...dataGridProps} columns={columns} autoHeight />
<MuiXDataGrid.DataGrid {...dataGridProps} columns={columns} />
</RefineMui.List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const columns: GridColDef[] = [
{
field: "actions",
headerName: "Actions",
display: "flex",
renderCell: function render({ row }) {
// highlight-next-line
return <CloneButton size="small" recordItemId={row.id} />;
Expand All @@ -46,7 +47,7 @@ const PostsList: React.FC = () => {

return (
<List>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const PostsList: React.FC = () => {
return (
// highlight-next-line
<List headerButtons={<CreateButton />}>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const columns: GridColDef[] = [
{
field: "actions",
headerName: "Actions",
display: "flex",
renderCell: function render({ row }) {
// highlight-next-line
return <DeleteButton size="small" recordItemId={row.id} />;
Expand All @@ -48,7 +49,7 @@ const PostsList: React.FC = () => {

return (
<List>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const columns: GridColDef[] = [
{
field: "actions",
headerName: "Actions",
display: "flex",
renderCell: function render({ row }) {
// highlight-next-line
return <EditButton size="small" recordItemId={row.id} />;
Expand All @@ -44,7 +45,7 @@ const PostsList: React.FC = () => {

return (
<List>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const PostsList: React.FC = () => {
}
// highlight-end
>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const PostsList: React.FC = () => {
}
// highlight-end
>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const columns: GridColDef[] = [
{
field: "actions",
headerName: "Actions",
display: "flex",
renderCell: function render({ row }) {
// highlight-next-line
return <ShowButton size="small" recordItemId={row.id} />;
Expand All @@ -44,7 +45,7 @@ const PostsList: React.FC = () => {

return (
<List>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const columns: GridColDef[] = [
{
field: "status",
headerName: "Published",
display: "flex",
renderCell: function render({ row }) {
// highlight-start
return (
Expand All @@ -57,7 +58,7 @@ const PostsList: React.FC = () => {

return (
<List>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const columns: GridColDef[] = [
{
field: "createdAt",
headerName: "Created At",
display: "flex",
renderCell: function render({ row }) {
// highlight-start
return <DateField format="LLL" value={row.createdAt} />;
Expand All @@ -46,7 +47,7 @@ const PostsList: React.FC = () => {

return (
<List>
<DataGrid {...dataGridProps} columns={columns} autoHeight />
<DataGrid {...dataGridProps} columns={columns} />
</List>
);
};
Expand Down
Loading

0 comments on commit 1f65aa8

Please sign in to comment.