Skip to content

Feature: Add DataGridComponentsProvider component and DataGrid.components prop #2754

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

Merged
merged 51 commits into from
Feb 7, 2022

Conversation

amanmahajan7
Copy link
Contributor

@amanmahajan7 amanmahajan7 commented Dec 2, 2021

  • Add DataGrid.components prop. This replaces rowRenderer and noRowsFallback props.
interface Components<TRow, TSummaryRow> {
  sortIcon?: Maybe<ComponentType<SortIconProps>>;
  checkboxFormatter?: Maybe<
    | ForwardRefExoticComponent<CheckboxFormatterProps & RefAttributes<HTMLInputElement>>
    | ComponentType<CheckboxFormatterProps>
  >;
  rowRenderer?: Maybe<ComponentType<RowRendererProps<TRow, TSummaryRow>>>;
  noRowsFallback?: Maybe<React.ReactNode>;
}
  • Add DataGridComponentsProvider. This would be helpful to replace components globally

@amanmahajan7 amanmahajan7 self-assigned this Dec 2, 2021
@codecov
Copy link

codecov bot commented Dec 2, 2021

Codecov Report

Merging #2754 (9610d9b) into main (f5bfab3) will decrease coverage by 0.11%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2754      +/-   ##
==========================================
- Coverage   96.27%   96.16%   -0.12%     
==========================================
  Files          34       37       +3     
  Lines        1209     1226      +17     
  Branches      379      383       +4     
==========================================
+ Hits         1164     1179      +15     
- Misses         45       47       +2     
Impacted Files Coverage Δ
src/Columns.tsx 100.00% <ø> (ø)
src/DataGrid.tsx 94.26% <100.00%> (+0.09%) ⬆️
src/DataGridDefaultComponentsProvider.ts 100.00% <100.00%> (ø)
src/HeaderCell.tsx 89.85% <100.00%> (-0.69%) ⬇️
src/HeaderRenderer.tsx 100.00% <100.00%> (ø)
src/SortIcon.tsx 100.00% <100.00%> (ø)
src/formatters/CheckboxFormatter.tsx 100.00% <100.00%> (ø)
src/formatters/SelectCellFormatter.tsx 100.00% <100.00%> (ø)
src/utils/domUtils.ts 0.00% <0.00%> (-100.00%) ⬇️

>
{column.name}
</SortableHeaderCell>
<HeaderRenderer column={column} {...props} />
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this new change we do not have to reimplement sorting everytime we override headerRenderer

@amanmahajan7 amanmahajan7 marked this pull request as ready for review December 14, 2021 21:13
@amanmahajan7 amanmahajan7 changed the title [POC] Add DataGridComponentsProvider [POC] Add DataGridComponentsProvider component and DataGrid.components prop Dec 14, 2021
@amanmahajan7 amanmahajan7 changed the title [POC] Add DataGridComponentsProvider component and DataGrid.components prop Feature: Add DataGridComponentsProvider component and DataGrid.components prop Feb 4, 2022
@amanmahajan7 amanmahajan7 requested a review from nstepien February 4, 2022 17:13
@amanmahajan7
Copy link
Contributor Author

I did not add an example for DataGridDefaultComponentsProvider bit I tested and it works

@amanmahajan7 amanmahajan7 requested a review from nstepien February 7, 2022 14:50
README.md Outdated
interface Components<TRow, TSummaryRow> {
sortIcon?: Maybe<ComponentType<SortIconProps>>;
checkboxFormatter?: Maybe<
ForwardRefExoticComponent<CheckboxFormatterProps & RefAttributes<HTMLInputElement>>
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to add | ComponentType

amanmahajan7 and others added 3 commits February 7, 2022 09:19
Co-authored-by: Nicolas Stepien <[email protected]>
Co-authored-by: Nicolas Stepien <[email protected]>
@amanmahajan7 amanmahajan7 merged commit f864291 into main Feb 7, 2022
@amanmahajan7 amanmahajan7 deleted the am-components branch February 7, 2022 15:33
keriat pushed a commit to superform-xyz/react-data-grid that referenced this pull request Jan 10, 2024
## [5.1.0](v5.0.4...5.1.0) (2024-01-10)

### Features

* Add DataGridComponentsProvider component and DataGrid.components prop ([adazzle#2754](https://github.com/superform-xyz/react-data-grid/issues/2754)) ([f864291](f864291))
* Add support for flex column width ([adazzle#2839](https://github.com/superform-xyz/react-data-grid/issues/2839)) ([4a136ad](4a136ad))
* expose scroll event ([adazzle#2011](https://github.com/superform-xyz/react-data-grid/issues/2011)) ([7614c8e](7614c8e))
* RTL ([adazzle#2803](https://github.com/superform-xyz/react-data-grid/issues/2803)) ([c0e4a63](c0e4a63))
* semantic release installed and configured ([e71bfe6](e71bfe6))

### Bug Fixes

* drag jumps to the right due to the failed merge ([adazzle#1564](https://github.com/superform-xyz/react-data-grid/issues/1564)) ([7033a1b](7033a1b))
* isSelectedCellEditable row getter idx ([adazzle#1743](https://github.com/superform-xyz/react-data-grid/issues/1743)) ([018f137](018f137))
* package-lock.json added to version control ([df39113](df39113))

### Reverts

* Revert "Dependabot: set versioning-strategy to increase (adazzle#2479)" (adazzle#2511) ([0bedc81](0bedc81))
keriat pushed a commit to superform-xyz/react-data-grid that referenced this pull request Jan 10, 2024
## [5.1.0](v5.0.4...5.1.0) (2024-01-10)

### Features

* Add DataGridComponentsProvider component and DataGrid.components prop ([adazzle#2754](https://github.com/superform-xyz/react-data-grid/issues/2754)) ([f864291](f864291))
* Add support for flex column width ([adazzle#2839](https://github.com/superform-xyz/react-data-grid/issues/2839)) ([4a136ad](4a136ad))
* expose scroll event ([adazzle#2011](https://github.com/superform-xyz/react-data-grid/issues/2011)) ([7614c8e](7614c8e))
* RTL ([adazzle#2803](https://github.com/superform-xyz/react-data-grid/issues/2803)) ([c0e4a63](c0e4a63))
* semantic release installed and configured ([e71bfe6](e71bfe6))

### Bug Fixes

* drag jumps to the right due to the failed merge ([adazzle#1564](https://github.com/superform-xyz/react-data-grid/issues/1564)) ([7033a1b](7033a1b))
* isSelectedCellEditable row getter idx ([adazzle#1743](https://github.com/superform-xyz/react-data-grid/issues/1743)) ([018f137](018f137))
* package-lock.json added to version control ([df39113](df39113))

### Reverts

* Revert "Dependabot: set versioning-strategy to increase (adazzle#2479)" (adazzle#2511) ([0bedc81](0bedc81))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants