carbon-design-system / ibm-products

A Carbon-powered React component library for IBM Products
https://carbon-for-ibm-products.netlify.app/
Apache License 2.0
84 stars 118 forks source link

feat(Datagrid): add `onVirtualScroll` property to send back data around currently visible rows in virtualized Datagrids #5255

Closed matthewgallo closed 1 week ago

matthewgallo commented 2 weeks ago

Closes #4685

This PR adds a onVirtualScroll property that returns data around what rows are currently visible within the virtualized datagrid (where only the rows that need to be visible are rendered to the DOM).

The structure sent in the callback looks like the following and comes from the VariableSizeList component's onItemsRendered prop. We are just simply providing a way for consumers to receive this data now.

{
  overscanStartIndex: 0,
  overscanStopIndex: 12,
  visibleStartIndex: 1,
  visibleStopIndex: 10
}

What did you change?

cspell.json
packages/ibm-products/src/components/Datagrid/Datagrid.docs-page.js
packages/ibm-products/src/components/Datagrid/Datagrid.stories.jsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridVirtualBody.js

How did you test and verify your work?

Storybook

netlify[bot] commented 2 weeks ago

Deploy Preview for carbon-for-ibm-products ready!

Name Link
Latest commit 37ae1dde358652c6dcd88ab7d044f9abd9715868
Latest deploy log https://app.netlify.com/sites/carbon-for-ibm-products/deploys/664cb8eb0f84220008bd7c82
Deploy Preview https://deploy-preview-5255--carbon-for-ibm-products.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.