carbon-design-system / carbon-addons-iot-react

A collection of React components shared between IBM Maximo Asset Monitor (Watson IoT), IBM Maximo Visual Inspection, and Graphite products.
https://carbon-design-system.github.io/carbon-addons-iot-react/
Apache License 2.0
96 stars 78 forks source link

fix(table): add column for DnD in the filter/manage columns headers #3782

Closed gillibrand closed 1 year ago

gillibrand commented 1 year ago

Closes #3781

Summary

When drag and drop is enabled for the table and extra column is injected into the tbody to house the "drag handle". In the normal table header and extra, empty cell/column is added to line up and match the number of columns in the body. This is the same technique used for the "checkbox" select columns.

The issues was that not all headers were updated. There is are "filter" and "select columns" headers that can be added to the table. They were not updated with the extra column, so were not aligned right.

The fix is just to pass the "hasDragAndDrop" prop into those components and add the extra cell there when enabled.

Change List (commits, features, bugs, etc)

ColumnHeaderRow.jsx and FilterHeaderRow.jsx were updated with that change. Other changes are just to the test snapshots that needed updating to account for the new header cell when enabled.

Acceptance Test (how to verify the PR)

View a table with DnD enabled and hasFilter prop on. Open the filter header row. If all the columns line up right, it's good. It's most obvious in Firefox, where a big white space was left on the right if the table was wide. The storybook Table > With drag and drop rows was updated to enable the filter row and test this.

Regression Test (how to make sure this PR doesn't break old functionality)

Existing unit tests pass.

Things to look for during review

netlify[bot] commented 1 year ago

Deploy Preview for carbon-addons-iot-react ready!

Name Link
Latest commit e7215488c2bdfde64b6f2331c2d5e12a6335944f
Latest deploy log https://app.netlify.com/sites/carbon-addons-iot-react/deploys/6464fd65f56b2f00081b6181
Deploy Preview https://deploy-preview-3782--carbon-addons-iot-react.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 settings.