Skip to content

Commit

Permalink
Merge branch 'v7.x' into 7.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MBilalShafi committed Oct 25, 2024
2 parents ea99510 + ec0caee commit 888cafa
Show file tree
Hide file tree
Showing 49 changed files with 1,792 additions and 203 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: Cherry pick next to master
name: Cherry pick master to v7

on:
pull_request_target:
branches:
- next
- master
types: ['closed']

permissions: {}

jobs:
cherry_pick_to_master:
cherry_pick_to_v7:
runs-on: ubuntu-latest
name: Cherry pick into master
name: Cherry pick into v7
permissions:
pull-requests: write
contents: write
Expand All @@ -26,7 +26,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: carloscastrojumo/github-cherry-pick-action@503773289f4a459069c832dc628826685b75b4b3 # v1.0.10
with:
branch: master
branch: v7.x
body: 'Cherry-pick of #{old_pull_request_id}'
cherry-pick-branch: ${{ format('cherry-pick-{0}', github.event.number) }}
title: '{old_title} (@${{ github.event.pull_request.user.login }})'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: Cherry pick master to v6
name: Cherry pick v7 to v6

on:
pull_request_target:
branches:
- master
- v7.x
types: ['closed']

permissions: {}

jobs:
cherry_pick_to_v6:
cherry_pick_v7_to_v6:
runs-on: ubuntu-latest
name: Cherry pick into v6
name: Cherry pick v7 into v6
permissions:
pull-requests: write
contents: write
Expand Down
18 changes: 9 additions & 9 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ coverage:
adapters:
target: 100%
paths:
- 'packages/x-date-pickers/src/AdapterDateFns/AdapterDateFns.ts'
- 'packages/x-date-pickers/src/AdapterDateFnsV3/AdapterDateFnsV3.ts'
- 'packages/x-date-pickers/src/AdapterDateFnsJalali/AdapterDateFnsJalali.ts'
- 'packages/x-date-pickers/src/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.ts'
- 'packages/x-date-pickers/src/AdapterDayjs/AdapterDayjs.ts'
- 'packages/x-date-pickers/src/AdapterLuxon/AdapterLuxon.ts'
- 'packages/x-date-pickers/src/AdapterMoment/AdapterMoment.ts'
- 'packages/x-date-pickers/src/AdapterMomentHijri/AdapterMomentHijri.ts'
- 'packages/x-date-pickers/src/AdapterMomentJalaali/AdapterMomentJalaali.ts'
- packages/x-date-pickers/src/AdapterDateFns/AdapterDateFns.ts
- packages/x-date-pickers/src/AdapterDateFnsV3/AdapterDateFnsV3.ts
- packages/x-date-pickers/src/AdapterDateFnsJalali/AdapterDateFnsJalali.ts
- packages/x-date-pickers/src/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.ts
- packages/x-date-pickers/src/AdapterDayjs/AdapterDayjs.ts
- packages/x-date-pickers/src/AdapterLuxon/AdapterLuxon.ts
- packages/x-date-pickers/src/AdapterMoment/AdapterMoment.ts
- packages/x-date-pickers/src/AdapterMomentHijri/AdapterMomentHijri.ts
- packages/x-date-pickers/src/AdapterMomentJalaali/AdapterMomentJalaali.ts
patch: off

comment: false
16 changes: 12 additions & 4 deletions docs/data/data-grid/row-grouping/row-grouping.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ In the following example, movies are grouped based on their production `company`

{{"demo": "RowGroupingBasicExample.js", "bg": "inline", "defaultCodeOpen": false}}

:::info
If you are looking for row grouping on the server-side, see [server-side row grouping](/x/react-data-grid/server-side-data/row-grouping/).
:::

## Grouping criteria

### Initialize the row grouping
Expand Down Expand Up @@ -252,6 +256,10 @@ Use the `setRowChildrenExpansion` method on `apiRef` to programmatically set the

{{"demo": "RowGroupingSetChildrenExpansion.js", "bg": "inline", "defaultCodeOpen": false}}

:::warning
The `apiRef.current.setRowChildrenExpansion` method is not compatible with the [server-side tree data](/x/react-data-grid/server-side-data/tree-data/) and [server-side row grouping](/x/react-data-grid/server-side-data/row-grouping/). Use `apiRef.current.unstable_dataSource.fetchRows` instead.
:::

### Customize grouping cell indent

To change the default cell indent, you can use the `--DataGrid-cellOffsetMultiplier` CSS variable:
Expand Down Expand Up @@ -280,10 +288,6 @@ If you are rendering leaves with the `leafField` property of `groupingColDef`, t

You can force the filtering to be applied on another grouping criteria with the `mainGroupingCriteria` property of `groupingColDef`

:::warning
This feature is not yet compatible with `sortingMode = "server"` and `filteringMode = "server"`.
:::

{{"demo": "RowGroupingFilteringSingleGroupingColDef.js", "bg": "inline", "defaultCodeOpen": false}}

### Multiple grouping columns
Expand Down Expand Up @@ -376,6 +380,10 @@ const rows = apiRef.current.getRowGroupChildren({

{{"demo": "RowGroupingGetRowGroupChildren.js", "bg": "inline", "defaultCodeOpen": false}}

:::warning
The `apiRef.current.getRowGroupChildren` method is not compatible with the [server-side row grouping](/x/react-data-grid/server-side-data/row-grouping/) since all the rows might not be available to get at a given instance.
:::

## Row group panel 🚧

:::warning
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import * as React from 'react';
import {
DataGridPremium,
useGridApiRef,
useKeepGroupedColumnsHidden,
} from '@mui/x-data-grid-premium';
import { useMockServer } from '@mui/x-data-grid-generator';
import Button from '@mui/material/Button';

export default function ServerSideRowGroupingDataGrid() {
const apiRef = useGridApiRef();

const { fetchRows, columns } = useMockServer({
rowGrouping: true,
});

const dataSource = React.useMemo(() => {
return {
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
groupKeys: JSON.stringify(params.groupKeys),
groupFields: JSON.stringify(params.groupFields),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
);
return {
rows: getRowsResponse.rows,
rowCount: getRowsResponse.rowCount,
};
},
getGroupKey: (row) => row.group,
getChildrenCount: (row) => row.descendantCount,
};
}, [fetchRows]);

const initialState = useKeepGroupedColumnsHidden({
apiRef,
initialState: {
rowGrouping: {
model: ['company', 'director'],
},
},
});

return (
<div style={{ width: '100%' }}>
<Button
onClick={() => {
apiRef.current.unstable_dataSource.cache.clear();
}}
>
Clear cache
</Button>

<div style={{ height: 400, position: 'relative' }}>
<DataGridPremium
columns={columns}
unstable_dataSource={dataSource}
apiRef={apiRef}
initialState={initialState}
/>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import * as React from 'react';
import {
DataGridPremium,
GridDataSource,
useGridApiRef,
useKeepGroupedColumnsHidden,
} from '@mui/x-data-grid-premium';
import { useMockServer } from '@mui/x-data-grid-generator';
import Button from '@mui/material/Button';

export default function ServerSideRowGroupingDataGrid() {
const apiRef = useGridApiRef();

const { fetchRows, columns } = useMockServer({
rowGrouping: true,
});

const dataSource: GridDataSource = React.useMemo(() => {
return {
getRows: async (params) => {
const urlParams = new URLSearchParams({
paginationModel: JSON.stringify(params.paginationModel),
filterModel: JSON.stringify(params.filterModel),
sortModel: JSON.stringify(params.sortModel),
groupKeys: JSON.stringify(params.groupKeys),
groupFields: JSON.stringify(params.groupFields),
});
const getRowsResponse = await fetchRows(
`https://mui.com/x/api/data-grid?${urlParams.toString()}`,
);
return {
rows: getRowsResponse.rows,
rowCount: getRowsResponse.rowCount,
};
},
getGroupKey: (row) => row.group,
getChildrenCount: (row) => row.descendantCount,
};
}, [fetchRows]);

const initialState = useKeepGroupedColumnsHidden({
apiRef,
initialState: {
rowGrouping: {
model: ['company', 'director'],
},
},
});

return (
<div style={{ width: '100%' }}>
<Button
onClick={() => {
apiRef.current.unstable_dataSource.cache.clear();
}}
>
Clear cache
</Button>

<div style={{ height: 400, position: 'relative' }}>
<DataGridPremium
columns={columns}
unstable_dataSource={dataSource}
apiRef={apiRef}
initialState={initialState}
/>
</div>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Button
onClick={() => {
apiRef.current.unstable_dataSource.cache.clear();
}}
>
Clear cache
</Button>

<div style={{ height: 400, position: 'relative' }}>
<DataGridPremium
columns={columns}
unstable_dataSource={dataSource}
apiRef={apiRef}
initialState={initialState}
/>
</div>
Loading

0 comments on commit 888cafa

Please sign in to comment.