Skip to content

Commit

Permalink
[DataGridPro] Make Header filters feature stable (#11243)
Browse files Browse the repository at this point in the history
  • Loading branch information
MBilalShafi authored Dec 5, 2023
1 parent d02cc33 commit b06480f
Show file tree
Hide file tree
Showing 36 changed files with 127 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default function CustomHeaderFilterDataGridPro() {
slots={{
headerFilterCell: CustomHeaderFilter,
}}
unstable_headerFilters
headerFilters
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export default function CustomHeaderFilterDataGridPro() {
slots={{
headerFilterCell: CustomHeaderFilter,
}}
unstable_headerFilters
headerFilters
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
slots={{
headerFilterCell: CustomHeaderFilter,
}}
unstable_headerFilters
headerFilters
/>
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default function CustomHeaderFilterOperatorDataGridPro() {

return (
<div style={{ height: 400, width: '100%' }}>
<DataGridPro {...data} columns={columns} unstable_headerFilters />
<DataGridPro {...data} columns={columns} headerFilters />
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default function CustomHeaderFilterOperatorDataGridPro() {

return (
<div style={{ height: 400, width: '100%' }}>
<DataGridPro {...data} columns={columns} unstable_headerFilters />
<DataGridPro {...data} columns={columns} headerFilters />
</div>
);
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<DataGridPro {...data} columns={columns} unstable_headerFilters />
<DataGridPro {...data} columns={columns} headerFilters />
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,7 @@ export default function CustomHeaderFilterSingleDataGridPro() {

return (
<div style={{ height: 400, width: '100%' }}>
<DataGridPro
{...data}
columns={columns}
disableColumnFilter
unstable_headerFilters
/>
<DataGridPro {...data} columns={columns} disableColumnFilter headerFilters />
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,7 @@ export default function CustomHeaderFilterSingleDataGridPro() {

return (
<div style={{ height: 400, width: '100%' }}>
<DataGridPro
{...data}
columns={columns}
disableColumnFilter
unstable_headerFilters
/>
<DataGridPro {...data} columns={columns} disableColumnFilter headerFilters />
</div>
);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
<DataGridPro
{...data}
columns={columns}
disableColumnFilter
unstable_headerFilters
/>
<DataGridPro {...data} columns={columns} disableColumnFilter headerFilters />
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function HeaderFilteringDataGridPro() {
},
},
}}
unstable_headerFilters
headerFilters
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function HeaderFilteringDataGridPro() {
},
},
}}
unstable_headerFilters
headerFilters
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
},
},
}}
unstable_headerFilters
headerFilters
/>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function SimpleHeaderFilteringDataGridPro() {
},
}}
disableColumnFilter
unstable_headerFilters
headerFilters
slots={{
headerFilterMenu: null,
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function SimpleHeaderFilteringDataGridPro() {
},
}}
disableColumnFilter
unstable_headerFilters
headerFilters
slots={{
headerFilterMenu: null,
}}
Expand Down
5 changes: 0 additions & 5 deletions docs/data/data-grid/filtering/header-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ title: Data Grid - Header filters
<p class="description">Quickly accessible per-column filters on grid header.</p>

:::warning
This feature is unstable, it needs to be explicitly activated using the `unstable_headerFilters` prop.

```tsx
<DataGridPro unstable_headerFilters {...otherProps} />
```

To use header filters, you need to upgrade to the [Pro plan](/x/introduction/licensing/#pro-plan) or above.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ Below are described the steps you need to make to migrate from v6 to v7.
- The Quick Filter now ignores hidden columns by default.
See [Including hidden columns](/x/react-data-grid/filtering/quick-filter/#including-hidden-columns) section for more details.

- The header filters feature is now stable. `unstable_` prefix is removed from prop `headerFilters` and the following exports.

| Old name | New name |
| :------------------------------------------------ | :--------------------------------------- |
| `unstable_gridFocusColumnHeaderFilterSelector` | `gridFocusColumnHeaderFilterSelector` |
| `unstable_gridHeaderFilteringEditFieldSelector` | `gridHeaderFilteringEditFieldSelector` |
| `unstable_gridHeaderFilteringMenuSelector` | `gridHeaderFilteringMenuSelector` |
| `unstable_gridHeaderFilteringStateSelector` | `gridHeaderFilteringStateSelector` |
| `unstable_gridTabIndexColumnHeaderFilterSelector` | `gridTabIndexColumnHeaderFilterSelector` |

<!-- ### Editing
- -->
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/x/api/data-grid/data-grid-premium.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
}
},
"groupingColDef": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;object" } },
"headerFilters": { "type": { "name": "bool" } },
"hideFooter": { "type": { "name": "bool" } },
"hideFooterPagination": { "type": { "name": "bool" } },
"hideFooterRowCount": {
Expand Down Expand Up @@ -611,8 +612,7 @@
"additionalInfo": { "sx": true }
},
"throttleRowsMs": { "type": { "name": "number" }, "default": "0" },
"treeData": { "type": { "name": "bool" } },
"unstable_headerFilters": { "type": { "name": "bool" } }
"treeData": { "type": { "name": "bool" } }
},
"slots": [
{
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/x/api/data-grid/data-grid-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
}
},
"groupingColDef": { "type": { "name": "union", "description": "func<br>&#124;&nbsp;object" } },
"headerFilters": { "type": { "name": "bool" } },
"hideFooter": { "type": { "name": "bool" } },
"hideFooterPagination": { "type": { "name": "bool" } },
"hideFooterRowCount": {
Expand Down Expand Up @@ -549,8 +550,7 @@
"additionalInfo": { "sx": true }
},
"throttleRowsMs": { "type": { "name": "number" }, "default": "0" },
"treeData": { "type": { "name": "bool" } },
"unstable_headerFilters": { "type": { "name": "bool" } }
"treeData": { "type": { "name": "bool" } }
},
"slots": [
{
Expand Down
60 changes: 30 additions & 30 deletions docs/pages/x/api/data-grid/selectors.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@
"description": "",
"supportsApiRef": true
},
{
"name": "gridFocusColumnHeaderFilterSelector",
"returnType": "GridColumnIdentifier | null",
"description": "",
"supportsApiRef": true
},
{
"name": "gridFocusColumnHeaderSelector",
"returnType": "GridColumnIdentifier | null",
Expand All @@ -233,6 +239,24 @@
"description": "",
"supportsApiRef": false
},
{
"name": "gridHeaderFilteringEditFieldSelector",
"returnType": "string | null",
"description": "",
"supportsApiRef": true
},
{
"name": "gridHeaderFilteringMenuSelector",
"returnType": "string | null",
"description": "",
"supportsApiRef": true
},
{
"name": "gridHeaderFilteringStateSelector",
"returnType": "GridHeaderFilteringState",
"description": "",
"supportsApiRef": false
},
{
"name": "gridPageCountSelector",
"returnType": "number",
Expand Down Expand Up @@ -406,6 +430,12 @@
"description": "",
"supportsApiRef": true
},
{
"name": "gridTabIndexColumnHeaderFilterSelector",
"returnType": "GridColumnIdentifier | null",
"description": "",
"supportsApiRef": true
},
{
"name": "gridTabIndexColumnHeaderSelector",
"returnType": "GridColumnIdentifier | null",
Expand Down Expand Up @@ -483,40 +513,10 @@
"description": "",
"supportsApiRef": true
},
{
"name": "unstable_gridFocusColumnHeaderFilterSelector",
"returnType": "GridColumnIdentifier | null",
"description": "",
"supportsApiRef": true
},
{
"name": "unstable_gridHeaderFilteringEditFieldSelector",
"returnType": "string | null",
"description": "",
"supportsApiRef": true
},
{
"name": "unstable_gridHeaderFilteringMenuSelector",
"returnType": "string | null",
"description": "",
"supportsApiRef": true
},
{
"name": "unstable_gridHeaderFilteringStateSelector",
"returnType": "GridHeaderFilteringState",
"description": "",
"supportsApiRef": false
},
{
"name": "unstable_gridTabIndexColumnGroupHeaderSelector",
"returnType": "GridColumnGroupIdentifier | null",
"description": "",
"supportsApiRef": true
},
{
"name": "unstable_gridTabIndexColumnHeaderFilterSelector",
"returnType": "GridColumnIdentifier | null",
"description": "",
"supportsApiRef": true
}
]
10 changes: 5 additions & 5 deletions docs/translations/api-docs/data-grid/data-grid-premium.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,11 @@
"deprecated": "",
"typeDescriptions": {}
},
"headerFilters": {
"description": "If <code>true</code>, enables the data grid filtering on header feature.",
"deprecated": "",
"typeDescriptions": {}
},
"hideFooter": {
"description": "If <code>true</code>, the footer component is hidden.",
"deprecated": "",
Expand Down Expand Up @@ -945,11 +950,6 @@
"description": "If <code>true</code>, the rows will be gathered in a tree structure according to the <code>getTreeDataPath</code> prop.",
"deprecated": "",
"typeDescriptions": {}
},
"unstable_headerFilters": {
"description": "If <code>true</code>, enables the data grid filtering on header feature.",
"deprecated": "",
"typeDescriptions": {}
}
},
"classDescriptions": {
Expand Down
10 changes: 5 additions & 5 deletions docs/translations/api-docs/data-grid/data-grid-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@
"deprecated": "",
"typeDescriptions": {}
},
"headerFilters": {
"description": "If <code>true</code>, enables the data grid filtering on header feature.",
"deprecated": "",
"typeDescriptions": {}
},
"hideFooter": {
"description": "If <code>true</code>, the footer component is hidden.",
"deprecated": "",
Expand Down Expand Up @@ -843,11 +848,6 @@
"description": "If <code>true</code>, the rows will be gathered in a tree structure according to the <code>getTreeDataPath</code> prop.",
"deprecated": "",
"typeDescriptions": {}
},
"unstable_headerFilters": {
"description": "If <code>true</code>, enables the data grid filtering on header feature.",
"deprecated": "",
"typeDescriptions": {}
}
},
"classDescriptions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@ DataGridPremiumRaw.propTypes = {
* The grouping column used by the tree data.
*/
groupingColDef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
/**
* If `true`, enables the data grid filtering on header feature.
* @default false
*/
headerFilters: PropTypes.bool,
/**
* If `true`, the footer component is hidden.
* @default false
Expand Down Expand Up @@ -1034,9 +1039,4 @@ DataGridPremiumRaw.propTypes = {
* @default false
*/
treeData: PropTypes.bool,
/**
* If `true`, enables the data grid filtering on header feature.
* @default false
*/
unstable_headerFilters: PropTypes.bool,
} as any;
10 changes: 5 additions & 5 deletions packages/grid/x-data-grid-pro/src/DataGridPro/DataGridPro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,11 @@ DataGridProRaw.propTypes = {
* The grouping column used by the tree data.
*/
groupingColDef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
/**
* If `true`, enables the data grid filtering on header feature.
* @default false
*/
headerFilters: PropTypes.bool,
/**
* If `true`, the footer component is hidden.
* @default false
Expand Down Expand Up @@ -938,9 +943,4 @@ DataGridProRaw.propTypes = {
* @default false
*/
treeData: PropTypes.bool,
/**
* If `true`, enables the data grid filtering on header feature.
* @default false
*/
unstable_headerFilters: PropTypes.bool,
} as any;
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const DATA_GRID_PRO_PROPS_DEFAULT_VALUES: DataGridProPropsWithDefaultValu
rowReordering: false,
rowsLoadingMode: 'client',
getDetailPanelHeight: () => 500,
unstable_headerFilters: false,
headerFilters: false,
};

const defaultSlots = DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS;
Expand Down
Loading

0 comments on commit b06480f

Please sign in to comment.