-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DataGrid] Header filter design improvements #15991
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
e6c629e
change header filter variant and update styling
KenanYusuf c61dbd1
Merge branch 'master' into header-filter-design
KenanYusuf 73bcdde
small inputs
KenanYusuf 0b704af
Merge branch 'master' into header-filter-design
KenanYusuf ebea8b3
update clear button design
KenanYusuf 7bfafa2
Merge branch 'master' into header-filter-design
KenanYusuf cebcb87
apply styles to header filter class
KenanYusuf e9d3fcd
update styles
KenanYusuf c96bdc9
update demos
KenanYusuf b0621f9
Merge branch 'master' into header-filter-design
KenanYusuf 85c15f6
add test
KenanYusuf 6efe0da
Merge branch 'master' into header-filter-design
KenanYusuf ea0db1d
fix keyboard navigation
KenanYusuf 0502511
updates
KenanYusuf d357d84
Merge branch 'master' into header-filter-design
KenanYusuf 0d13012
update headerFilterHeight test
KenanYusuf 00e0397
clarify doc
KenanYusuf 5969b6d
Merge branch 'master' into header-filter-design
KenanYusuf 248dcfb
update migration guide
KenanYusuf 4f1980e
show clear button with initial filter model
KenanYusuf 760b478
fix disabled state
KenanYusuf 585e71d
Run script
MBilalShafi fb67602
Merge branch 'master' into header-filter-design
KenanYusuf 5f960b1
render label instead of disabled input for no-input filter operators
KenanYusuf d96b3c6
Merge branch 'master' into header-filter-design
KenanYusuf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
docs/data/data-grid/filtering/HeaderFilteringInlineClearDataGridPro.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import * as React from 'react'; | ||
import { DataGridPro } from '@mui/x-data-grid-pro'; | ||
import { useDemoData } from '@mui/x-data-grid-generator'; | ||
|
||
const VISIBLE_FIELDS = ['name', 'rating', 'website']; | ||
|
||
export default function HeaderFilteringInlineClearDataGridPro() { | ||
const { data, loading } = useDemoData({ | ||
dataSet: 'Employee', | ||
rowLength: 100, | ||
visibleFields: VISIBLE_FIELDS, | ||
}); | ||
|
||
const columns = React.useMemo(() => { | ||
return data.columns.map((col) => ({ | ||
...col, | ||
minWidth: 200, | ||
})); | ||
}, [data.columns]); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGridPro | ||
{...data} | ||
columns={columns} | ||
loading={loading} | ||
initialState={{ | ||
...data.initialState, | ||
filter: { | ||
filterModel: { | ||
items: [ | ||
{ field: 'name', operator: 'contains', value: 'a' }, | ||
{ field: 'website', operator: 'contains', value: 'http://' }, | ||
{ field: 'rating', operator: '>', value: 2 }, | ||
], | ||
}, | ||
}, | ||
}} | ||
headerFilters | ||
slotProps={{ | ||
headerFilterCell: { | ||
showClearIcon: true, | ||
}, | ||
}} | ||
/> | ||
</div> | ||
); | ||
} |
48 changes: 48 additions & 0 deletions
48
docs/data/data-grid/filtering/HeaderFilteringInlineClearDataGridPro.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import * as React from 'react'; | ||
import { DataGridPro } from '@mui/x-data-grid-pro'; | ||
import { useDemoData } from '@mui/x-data-grid-generator'; | ||
|
||
const VISIBLE_FIELDS = ['name', 'rating', 'website']; | ||
|
||
export default function HeaderFilteringInlineClearDataGridPro() { | ||
const { data, loading } = useDemoData({ | ||
dataSet: 'Employee', | ||
rowLength: 100, | ||
visibleFields: VISIBLE_FIELDS, | ||
}); | ||
|
||
const columns = React.useMemo(() => { | ||
return data.columns.map((col) => ({ | ||
...col, | ||
minWidth: 200, | ||
})); | ||
}, [data.columns]); | ||
|
||
return ( | ||
<div style={{ height: 400, width: '100%' }}> | ||
<DataGridPro | ||
{...data} | ||
columns={columns} | ||
loading={loading} | ||
initialState={{ | ||
...data.initialState, | ||
filter: { | ||
filterModel: { | ||
items: [ | ||
{ field: 'name', operator: 'contains', value: 'a' }, | ||
{ field: 'website', operator: 'contains', value: 'http://' }, | ||
{ field: 'rating', operator: '>', value: 2 }, | ||
], | ||
}, | ||
}, | ||
}} | ||
headerFilters | ||
slotProps={{ | ||
headerFilterCell: { | ||
showClearIcon: true, | ||
}, | ||
}} | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this make more sense under
Customize header filter
section since it's kind-of a customization?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, but it's also very similar to the "Simple header filters" section above 😅 Could move both?