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

[DataGridPro] Filtering on Column Header #7760

Merged
merged 80 commits into from
May 18, 2023

Conversation

MBilalShafi
Copy link
Member

@MBilalShafi MBilalShafi commented Jan 30, 2023

Closes #6247

  • Implement Header filtering base functionality
  • Synchronize width change
  • Add support to Pro
  • Add support to Premium
  • Introduce dedicated state for Header Filtering (state.headerFiltering)
  • Fix focus on menu close
  • Scope-out isAnyOf operator for this PR (Will be handled in: [DataGridPro] Filtering on the Header followup actions #9034)
  • Reorganize components
  • Handle cell events
  • Accessibility (ARIA attributes)
  • Keyboard Navigation
  • Prefix public methods with unstable_
  • Localization
  • Add a demo utilizing colDef.renderHeaderFilter and polish documentation
  • Testing

Nice to Haves (recommendations will be appreciated):

  • Reexport from /internals (avoid eslint comment)
  • Move headerFiltering state, keyboard navigation, useColumnResize, and focus logic to the Pro package (too tightly coupled, maybe leave it for another PR?)

Issue: #6247
Designs: https://www.figma.com/proto/W6TItYkiGJZjL5zLnfeSjy/Data-grid?node-id=1024%3A44648&scaling=scale-down-width&page-id=650%3A35241&starting-point-node-id=905%3A40731

Preview

https://deploy-preview-7760--material-ui-x.netlify.app/x/react-data-grid/filtering/#header-filters

Changelog

  • 🎁 Introduce filtering on header feature for DataGridPro:
Screen.Recording.2023-05-18.at.6.35.47.PM.mov
Screen.Recording.2023-05-18.at.7.32.29.PM.mov

See the documentation for more details.

@MBilalShafi MBilalShafi added component: data grid This is the name of the generic UI component, not the React module! new feature New feature or request v6.x feature: Filtering Related to the data grid Filtering feature design: ux labels Jan 30, 2023
@mui-bot
Copy link

mui-bot commented Jan 30, 2023

Localization writing tips ✍️

Seems you are updating localization 🌍 files.

Thank you for contributing to the localization! 🎉 To make your PR perfect, here is a list of elements to check: ✔️

  • Verify if the PR title respects the release format. Here are two examples (depending if you update or add a locale file)

    [l10n] Improve Swedish (sv-SE) locale
    [l10n] Add Danish (da-DK) locale

  • Update the documentation of supported locales by running yarn l10n
  • Clean files with yarn prettier.

Netlify deploy preview

Netlify deploy preview: https://deploy-preview-7760--material-ui-x.netlify.app/

Updated pages

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 610.2 1,068.3 616.9 766.9 167.134
Sort 100k rows ms 633.4 1,000.6 753.4 848.9 135.477
Select 100k rows ms 142.8 328.9 207.5 225.16 67.534
Deselect 100k rows ms 168.7 307.2 205.5 231.2 50.537

Generated by 🚫 dangerJS against 3e2d5f5

@MBilalShafi MBilalShafi changed the title [DataGrid] Filtering on Column Header [DataGridPro] Filtering on Column Header Feb 9, 2023
@MBilalShafi MBilalShafi added the plan: Pro Impact at least one Pro user label Feb 9, 2023
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 10, 2023
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 12, 2023
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 27, 2023
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 8, 2023
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label May 16, 2023
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label May 16, 2023
@DanailH
Copy link
Member

DanailH commented May 18, 2023

@MBilalShafi I checked it one more time - looks solid, and nicely done.
There were a couple of things that were pointed out that can be addressed later - probably the most annoying one is the small jump when you focus and unfocus a header filter cell. I propose we create an issue and list all those things so we don't lose track of them.
Besides that, I'm ok with releasing the first version to see what the feedback will be (should be safe as it's marked as unstable).

Copy link
Member

@cherniavskii cherniavskii left a comment

Choose a reason for hiding this comment

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

Great work, @MBilalShafi! 🎉

@MBilalShafi
Copy link
Member Author

Thanks everyone who contributed for the great review feedback to shape this PR up 🙏

@oliviertassinari
Copy link
Member

oliviertassinari commented May 20, 2023

The primary rationale for blurring the input field on Enter is to make keyboard navigation work as expected

@MBilalShafi From the perspective of an end-user, I think that this is an input inside an header. The notion of header cell sounds more like an implementation detail. As an end user, I would span Enter to make my filter query is executed. A blur would suspire me (how I found this).

onFocus={() => apiRef.current.startHeaderFilterEditMode(colDef.field)}
onBlur={() => apiRef.current.stopHeaderFilterEditMode()}
placeholder={apiRef.current.getLocaleText('columnMenuFilter')}
label={isFilterActive ? capitalize(label) : ' '}
Copy link
Member

@oliviertassinari oliviertassinari May 20, 2023

Choose a reason for hiding this comment

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

I think that we should change this logic, turning the label to an empty string breaks the floating label animation. Instead, it's better to control the shrink state.

Copy link
Member Author

@MBilalShafi MBilalShafi May 22, 2023

Choose a reason for hiding this comment

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

Agreed, one reason it happens is that label also changes on focus (e.g Filter -> Contains), added to the list of follow-up items.

@oliviertassinari oliviertassinari added design This is about UI or UX design, please involve a designer and removed design: ux labels Aug 18, 2023
@MBilalShafi MBilalShafi added the feature: Filtering on header Related to the header filtering (Pro) feature label Aug 1, 2024
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! design This is about UI or UX design, please involve a designer feature: Filtering on header Related to the header filtering (Pro) feature feature: Filtering Related to the data grid Filtering feature new feature New feature or request plan: Pro Impact at least one Pro user v6.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Filtering on column header
7 participants