-
Notifications
You must be signed in to change notification settings - Fork 137
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
refactor(DataGrid): implement types for DataGrid component #5257
Merged
makafsal
merged 123 commits into
carbon-design-system:main
from
makafsal:type-datagrid-50175
Jun 6, 2024
Merged
refactor(DataGrid): implement types for DataGrid component #5257
makafsal
merged 123 commits into
carbon-design-system:main
from
makafsal:type-datagrid-50175
Jun 6, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for carbon-for-ibm-products ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
makafsal
requested review from
emyarod and
sangeethababu9223
and removed request for
a team
May 20, 2024 10:54
emyarod
previously approved these changes
May 21, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me!
…s into type-datagrid-50175
chore: remove unwanted line refactor: change react-table types version refactor: change react-table types version chore: remove unwanted line refactor: change react-table types version refactor: change react-table types version chore: dummy commit to rerun jobs chore: remove unwanted line refactor: change react-table types version refactor: change react-table types version chore: remove unwanted line refactor: change react-table types version refactor: change react-table types version
…s into type-datagrid-50175
- @carbon/[email protected] - @carbon/[email protected] - @carbon/[email protected]
…ign-system#5391) * fix(Coachmark): ssr issues with htmlelement * chore: remove unnecessary export
Co-authored-by: ibm-mend-app[bot] <142626574+ibm-mend-app[bot]@users.noreply.github.com> Co-authored-by: Jeff Chew <[email protected]>
…rbon/feature-flags` (carbon-design-system#5204) * feat(FeatureFlags): add feature flag support using carbon package * chore: import feature flags and update lock * chore: remove console log * feat: use new feature flag system and add mdx docs * chore: add annotation component to example story * fix: remove utility hook from portal target hook * chore: rename feature-flags file * chore: remove console log * chore: add feature flag component to editable cell stories * fix: import feature flags file * fix: import feature flags in jest setup * fix: update tests * chore: remove old generated feature flags * chore: import feature flags * fix: add feature flags file as side effect * chore: add test file * chore(feature-flags): rename to match carbon naming patterns chore: dummy commit to rerun jobs chore: remove unwanted line refactor: change react-table types version refactor: change react-table types version chore: remove unwanted line refactor: change react-table types version refactor: change react-table types version chore: dummy commit to rerun jobs chore: remove unwanted line refactor: change react-table types version refactor: change react-table types version chore: remove unwanted line refactor: change react-table types version refactor: change react-table types version chore: dummy commit to rerun jobs chore: remove unwanted line refactor: change react-table types version refactor: change react-table types version chore: remove unwanted line refactor: change react-table types version refactor: change react-table types version chore: dummy commit to rerun jobs chore: remove unwanted line refactor: change react-table types version refactor: change react-table types version chore: remove unwanted line refactor: change react-table types version refactor: change react-table types version
…s into type-datagrid-50175
amal-k-joy
approved these changes
Jun 5, 2024
matthewgallo
approved these changes
Jun 6, 2024
Merged
via the queue into
carbon-design-system:main
with commit Jun 6, 2024
de9c862
17 checks passed
wkeese
added a commit
to wkeese/carbon-ibm-products
that referenced
this pull request
Sep 25, 2024
This fixes some (but not all) of the Typescript issues with Datagrid. Specifically: 1. Export DataGridState type. Maybe other types should be exported too. Note that in other places the G is not capitalized, but it is for the type. 2. onAllRowSelect() is (and should be) optional. 3. Presumably you aren't required to have a button on your empty state screens, so "emptyStateAction" should be optional. 4. "allRowsLabel" should be optional because you only need it if your table has a "Select all" checkbox. And also because it's optional in PropTypes. 5. Properties like "page" are only necessary if your table has pagination, so make UsePaginationInstanceProps props optional. 6. UseFiltersInstanceProps defines a bunch of weird and required properties like "preFilteredRows", "preFilteredFlatRows", "preFilteredRowsById". AFAICT none of those are valid for DataGridState except for setFilter() and setAllFilters(), and even those should be optional. 7. The original DataGridState class extended both UseRowSelectInstanceProps and Pick<UseRowSelectInstanceProps<T>, 'toggleAllRowsSelected'>. Obviously that doesn't make sense because of the redundancy. But I'm not sure what does make sense. AFAIK users don't directly defined functions like toggleRowSelected() or toggleAllRowsSelected()... but there is code that calls them. This PR doesn't address the main issues with the types, where useDatagrid() returns a TableInstance but Datagrid.datagridState is a DataGridState. Further, I think maybe DataGridState needs to be split into two types. Consider that: 1. The object passed to Datagrid.datagridState does not contain "row". 2. DataGridRow's props DO include "row". 3. Both Datagrid.datagridState and DataGridRow's props are defined as DataGridState. Refs carbon-design-system#5257, carbon-design-system#6115.
github-merge-queue bot
pushed a commit
that referenced
this pull request
Oct 16, 2024
This fixes some (but not all) of the Typescript issues with Datagrid. Specifically: 1. Export DataGridState type. Maybe other types should be exported too. Note that in other places the G is not capitalized, but it is for the type. 2. onAllRowSelect() is (and should be) optional. 3. Presumably you aren't required to have a button on your empty state screens, so "emptyStateAction" should be optional. 4. "allRowsLabel" should be optional because you only need it if your table has a "Select all" checkbox. And also because it's optional in PropTypes. 5. Properties like "page" are only necessary if your table has pagination, so make UsePaginationInstanceProps props optional. 6. UseFiltersInstanceProps defines a bunch of weird and required properties like "preFilteredRows", "preFilteredFlatRows", "preFilteredRowsById". AFAICT none of those are valid for DataGridState except for setFilter() and setAllFilters(), and even those should be optional. 7. The original DataGridState class extended both UseRowSelectInstanceProps and Pick<UseRowSelectInstanceProps<T>, 'toggleAllRowsSelected'>. Obviously that doesn't make sense because of the redundancy. But I'm not sure what does make sense. AFAIK users don't directly defined functions like toggleRowSelected() or toggleAllRowsSelected()... but there is code that calls them. This PR doesn't address the main issues with the types, where useDatagrid() returns a TableInstance but Datagrid.datagridState is a DataGridState. Further, I think maybe DataGridState needs to be split into two types. Consider that: 1. The object passed to Datagrid.datagridState does not contain "row". 2. DataGridRow's props DO include "row". 3. Both Datagrid.datagridState and DataGridRow's props are defined as DataGridState. Refs #5257, #6115.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #5175
What did you change?
packages/ibm-products/src/components/Datagrid/Datagrid/Datagrid.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridContent.tsx
packages/ibm-products/src/components/FilterSummary/FilterSummary.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridBody.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridHead.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridEmptyBody.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridVirtualBody.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridRefBody.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridSimpleBody.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridExpandedRow.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridHeaderRow.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridRow.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridSelectAll.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DatagridToolbar.tsx
packages/ibm-products/src/components/Datagrid/Datagrid/DraggableElement.tsx
How did you test and verify your work?
Storybook
yarn test
Manual test