Skip to content
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] Add Filter Panel delete icon slot #4069

Merged
merged 8 commits into from
Mar 2, 2022

Conversation

Hameezr
Copy link
Contributor

@Hameezr Hameezr commented Mar 2, 2022

Fix #4063

@mui-bot
Copy link

mui-bot commented Mar 2, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 232.2 421.4 376.5 333.44 79.967
Sort 100k rows ms 409.4 927.1 763.1 741.36 183.125
Select 100k rows ms 168.7 267.1 198.8 208.2 33.247
Deselect 100k rows ms 133.9 300.4 211.3 204.32 56.861

Generated by 🚫 dangerJS against 958ee5b

@alexfauquette alexfauquette self-assigned this Mar 2, 2022
@alexfauquette
Copy link
Member

Thanks for the contribution, I updated your message such that when merging this PR it closes the related issue. Here is the list of keywords to link PR to issue

@@ -287,7 +286,7 @@ function GridFilterForm(props: GridFilterFormProps) {
onClick={handleDeleteFilter}
size="small"
>
<GridCloseIcon fontSize="small" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the fontSize="small" prop modify the default appearance of the icon

New icon

image

Previouse icon

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a conditional logic to fix this issue but I believe that's not the best approach, since icons are used directly from svg's and there could be a component to render the icons, used globally with props such as size and etc.

Copy link
Contributor Author

@Hameezr Hameezr Mar 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a suggested approach for using the icons more efficiently in my mind, but that'll require some time since they're being used in a lot of places. I'll create a separate PR for that once I'm able to figure out the best approach

@alexfauquette alexfauquette force-pushed the delete-icon-slot-filterPanel branch from 82f176a to 6477e96 Compare March 2, 2022 10:45
@DanailH DanailH added component: data grid This is the name of the generic UI component, not the React module! new feature New feature or request feature: Filtering Related to the data grid Filtering feature labels Mar 2, 2022
@DanailH DanailH changed the title Added slot for delete Icon in Filter Panel [DataGrid] Add slot for Filter Panel delete icon Mar 2, 2022
@DanailH DanailH changed the title [DataGrid] Add slot for Filter Panel delete icon [DataGrid] Add Filter Panel delete icon slot Mar 2, 2022
Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged master such that we can check the icon is still the same (I added a test to catch this regression)

Comment on lines 290 to 292
{rootProps.components.FilterPanelDeleteIcon?.name ?
<rootProps.components.FilterPanelDeleteIcon />
: <GridCloseIcon fontSize="small" />}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why using rootProps.components.FilterPanelDeleteIcon?.name as a criterion? Any icon created by createSvgIcon() will have a name.

A simpler solution would be to set <rootProps.components.FilterPanelDeleteIcon fontSize="small" />

The drawback is that all the icons will receive the prop fontSize="small" with no way to change it.

If developers want to use big icons, they can ignore the prop as follow:

const MyBigIcon = () => <CloseIcon fontSize="large" />

<DataGrid components={{ FilterPanelDeleteIcon: MyBigIcon }} />

@Hameezr Does that sound good to you?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this will solve the problem and add some customizability as well! Thanks for the suggestion, will make this change

Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution, this feature will be available in next release :)

@alexfauquette alexfauquette merged commit ea260ca into mui:master Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Filtering Related to the data grid Filtering feature new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataGrid] Add a slot to modify delete icon of filter panel
4 participants