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] Implement header filter height #12666

Merged
merged 9 commits into from Apr 16, 2024

Conversation

romgrk
Copy link
Contributor

@romgrk romgrk commented Apr 3, 2024

Closes #12643

Add headerFilterHeight to control the header filters height.

@romgrk romgrk added the component: data grid This is the name of the generic UI component, not the React module! label Apr 3, 2024
@romgrk romgrk added feature: Filtering on header Related to the header filtering (Pro) feature customization: css Design CSS customizability labels Apr 3, 2024
@mui-bot
Copy link

mui-bot commented Apr 3, 2024

Copy link
Member

@MBilalShafi MBilalShafi left a comment

Choose a reason for hiding this comment

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

Thank you for the quick response 🚀

packages/x-data-grid/src/models/props/DataGridProps.ts Outdated Show resolved Hide resolved
packages/x-data-grid/src/models/props/DataGridProps.ts Outdated Show resolved Hide resolved
/**
* Override the height/width of the header filters.
*/
filterHeaderHeight?: number;
Copy link
Member

Choose a reason for hiding this comment

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

Also, shouldn't this prop belong to dataGridProProps.ts like headerFilters boolean flag?

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 need it in community for the dimensions logic.

Copy link
Member

Choose a reason for hiding this comment

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

Alright, bdw, I just merged #12365
Maybe headerFilterHeight could be placed in DataGridProcessedPropsWithShared just like the headerFilters boolean.
That way we won't be exposing it to MIT users yet make it accessible in the @mui/x-data-grid scope.
Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What was the reason for splitting DataGridProcessedProps and DataGridProcessedPropsWithShared? Having some trouble fixing the types because DataGridProcessedProps is used in many places where DataGridProcessedPropsWithShared should be used. AFAIK, DataGridProcessedProps is not used by external users so we should be able to place final typings there.

Copy link
Member

Choose a reason for hiding this comment

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

What was the reason for splitting DataGridProcessedProps and DataGridProcessedPropsWithShared?

The main reason for keeping a line between DataGridProcessedProps and DataGridProcessedPropsWithShared in my mind was to reflect a better understanding of the specific scenario.

For example hook A and B.

A uses some shared props from higher packages, it could be easily guessed by the reader of the code by the import name DataGridProcessedPropsWithShared

export const useA = (
  apiRef: React.MutableRefObject<GridPrivateApiCommunity>,
  props: Pick<
    DataGridProcessedPropsWithShared,
    | 'regularProp'
    | 'sharedProp'
  >,
): void => {

Wheras B doesn't use a shared prop.

export const useB = (
  apiRef: React.MutableRefObject<GridPrivateApiCommunity>,
  props: Pick<DataGridProcessedProps, 'regularProp' | 'regularProp2'>,
): void => {

It's obvious just by looking at the first few lines of the file which hook uses shared props and which don't. It might be helpful on the understanding side for new maintainers.

But I agree that making them part of DataGridProcessedProps along with wrapping them in Partial<> may also do the job + simplify the maintaining the types. I do not have a hard preference on either of them. Feel free to go with the suggested refactoring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did the refactor. Feels better this way because the typings reflect what's really present.

Copy link
Member

@MBilalShafi MBilalShafi left a comment

Choose a reason for hiding this comment

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

Dropped a couple of minor comments, apart from that, it LGTM 👌

romgrk and others added 2 commits April 5, 2024 08:39
Co-authored-by: Bilal Shafi <bilalshafidev@gmail.com>
Signed-off-by: Rom Grk <romgrk@users.noreply.github.com>
@romgrk romgrk enabled auto-merge (squash) April 5, 2024 12:41
@romgrk romgrk merged commit 9c27168 into mui:master Apr 16, 2024
15 checks passed
@romgrk romgrk deleted the feat-grid-header-filter-height branch April 16, 2024 03:56
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! customization: css Design CSS customizability feature: Filtering on header Related to the header filtering (Pro) feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Support the custom header filter height that is independent from the column header height
3 participants