-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
add "expand_all" toggle to datagrid header #8152
Conversation
demo: storybook |
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.
Awesome! Thanks for that.
Would you mind adding a unit test based on the storybook?
thanks @fzaninotto ! I added the tests to cypress. |
For the tests, please write a react-testing-library test rather than an e2e test. You can leverage the Storybook as we did e.g. in https://github.com/marmelab/react-admin/blob/master/packages/ra-ui-materialui/src/field/ReferenceOneField.spec.tsx |
ok, so i added expandAllButton.spec.tsx with best intentions. Hope that works now. |
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.
Otherwise this looks good, thanks! 🙂
packages/ra-ui-materialui/src/list/datagrid/ExpandAllButton.tsx
Outdated
Show resolved
Hide resolved
packages/ra-ui-materialui/src/list/datagrid/ExpandAllButton.tsx
Outdated
Show resolved
Hide resolved
packages/ra-ui-materialui/src/list/datagrid/expandAllButton.spec.tsx
Outdated
Show resolved
Hide resolved
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.
done! Thanks
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.
Thanks!
I'll give some time to @fzaninotto if he wants to re-review it, then we'll be able to merge 🙂
: false; | ||
|
||
const toggleExpanded = useCallback(() => { | ||
const unaffectedIds = expandedIds.filter( |
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.
these are the notDisplayedExpandedIds
, right?
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.
as a compromise, i'd say unaffectedExpandedIds
, since in this context we don't have displayed or hidden ids 👿
packages/ra-ui-materialui/src/list/datagrid/ExpandAllButton.tsx
Outdated
Show resolved
Hide resolved
expanded ? 'ra.action.close' : 'ra.action.expand' | ||
)} | ||
aria-expanded={expanded} | ||
tabIndex={-1} |
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.
Why this tabindex?
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.
dito
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.
since ExpandRowButtons are not tab-selectable, the least i would do here is to stay consistent and keep tabindex = -1.
packages/ra-ui-materialui/src/list/datagrid/expandAllButton.spec.tsx
Outdated
Show resolved
Hide resolved
packages/ra-ui-materialui/src/list/datagrid/expandAllButton.spec.tsx
Outdated
Show resolved
Hide resolved
packages/ra-ui-materialui/src/list/datagrid/expandAllButton.spec.tsx
Outdated
Show resolved
Hide resolved
: false; | ||
|
||
const toggleExpandedAll = useCallback(() => { | ||
const unaffectedExpandedIds = expandedIds.filter( |
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.
I don't understand this "unaffected".
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.
possible synonyms:
- unChanged
- unAltered
- unTouched
Thanks! |
thanks! and keep up the good work! :) |
this adds a "collapse all" Button in the DataGridHeader
Behavior: