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] Pass generics to the components in the theme augmentation #6269

Merged

Conversation

cherniavskii
Copy link
Member

@cherniavskii cherniavskii commented Sep 23, 2022

@cherniavskii cherniavskii added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! typescript labels Sep 23, 2022
@mui-bot
Copy link

mui-bot commented Sep 23, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 483.9 898.2 731.5 684.12 162.821
Sort 100k rows ms 577.1 1,218 685.6 852.1 225.932
Select 100k rows ms 206.5 283.5 234.3 236.16 28.848
Deselect 100k rows ms 163.3 292.8 212.9 222.44 55.093

Generated by 🚫 dangerJS against 77d081d

@cherniavskii cherniavskii marked this pull request as ready for review September 23, 2022 17:40
@cherniavskii
Copy link
Member Author

cherniavskii commented Sep 23, 2022

Looks like we are missing themeAugmentation module for @mui/x-data-grid-premium package:
https://codesandbox.io/s/muidatagrid-theme-override-forked-23ofno?file=/src/theme.ts

Update: Fixed by #6270

Screenshot 2022-09-23 at 19 56 14

@m4theushw
Copy link
Member

Why did you close?

@cherniavskii
Copy link
Member Author

Github closed it automatically, because in #6270 I referenced a comment from this PR :)

@cherniavskii cherniavskii reopened this Sep 29, 2022
@paulleonartcalvo
Copy link

paulleonartcalvo commented Oct 4, 2022

Hi guys, we're currently paying for a group of devs to use the DataGrid component and we are attempting to use typescript + the theme in the global style overrides callback. I was wondering what the status/priority of this issue is? Thanks!

We would like to get access to the custom type definitions present on our theme object with this usage:

const MuiDataGrid: Components<Theme>['MuiDataGrid'] = {
  styleOverrides: {
    root: ({ theme }) => ({
      padding: '0px 16px 16px'
    })
    menuIconButton: ({ theme }) => ({ color: theme.colors['neutral-100'] })
  }
};

const overrides: Components<Omit<Theme, 'components'>> = {
  MuiDataGrid,
};

const newTheme = createTheme({
  components: overrides,
  ...restOfTheme
});

Here is a sandbox to illustrate the issue.

@cherniavskii
Copy link
Member Author

Hey @paulleonartcalvo
This PR should address theme being unknown.
I've forked the sandbox you provided to use packages built from this PR branch (not released yet):
https://codesandbox.io/s/muidatagrid-theme-override-typescript-forked-uh5h75?file=/src/theme.ts
It seems to work, can you confirm?

@cherniavskii cherniavskii merged commit 184bd96 into mui:next Oct 6, 2022
@cherniavskii cherniavskii deleted the grid-theme-augmentation-generics branch October 6, 2022 12:05
cherniavskii added a commit to cherniavskii/mui-x that referenced this pull request Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataGrid] Theme overrides not working as expected with TypeScript
4 participants