(DNM) Add TableView expandable rows docs#4758
Conversation
still need to double check node info like index, level, prev/next key and fix keyboard nav
for some reason it is trying to render a child row of a non-expanded row
…e_rows_collection_update
for now made changes to getNext/PrevKey in the collection, see comments about why
still need to debug why I cant make the rows in the body 0 indexed
…g indexOfType to track posinset
we dont actually set indexOfType in TableCollection so use index as fallback
for now not including aria row index, will need to test announcement differences
it is possible for the collection to be up to date but the removed items still go through a render cycle before being removed
experiemented with adding aria-rowindex as per wai-aria docs but decided to omit it since it made for a confusing announcement in NVDA where there was two row position announcements
not sure why the feature flag isnt being set to true...
…e_rows_collection_update
as per review, already done in TableCollection, nor do I really use it
the type change broadens the table children type so Collection builder doesnt complain. I also moved the feature flag test into TableView so I dont need the .onlys. Making a separate file to contain the tableTests function works as well and allows us to run those tests in TreeGridTable instead but this felt more appropriate
…react-spectrum into expandable-rows-docs
…react-spectrum into expandable-rows-docs
|
Build successful! 🎉 |
| your TableView. | ||
|
|
||
| ```tsx example | ||
| import {enableTableNestedRows} from '@react-stately/flags'; |
There was a problem hiding this comment.
can we add where in your app this should go? eg the root vs the file that expandable rows is used? or anywhere? does it matter?
There was a problem hiding this comment.
I'll update this section with some clarification. Here is the entire explanation:
This approach is the easiest because the flags can be accessed from anywhere. However, one downside is that flags are enabled for all instances of a component across the whole app, not for one specific table for example. We could do that with context, but then the flags would need to be wired to more places that aren't allowed to access classes (e.g. classes, non-hook functions, etc.). The flags also need to be set before anything is rendered in the app or things may break unexpectedly, so libraries like quarry should not be enabling flags, they should be enabled in apps. Like any other package, there must be only one copy installed or things will also not work.
From #4617
There was a problem hiding this comment.
So you'll want to do this once, likely at the root of your app since it will affect all instances and should be done before rendering the table.
The base branch was changed.
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
Build successful! 🎉 |
|
## API Changes
unknown top level export { type: 'any' } @react-spectrum/tableColumn TableView<T extends {}> {
+ UNSTABLE_allowsExpandableRows?: boolean
+ UNSTABLE_defaultExpandedKeys?: 'all' | Iterable<Key>
+ UNSTABLE_expandedKeys?: 'all' | Iterable<Key>
+ UNSTABLE_onExpandedChange?: (Set<Key>) => any
density?: 'compact' | 'regular' | 'spacious' = 'regular'
dragAndDropHooks?: DragAndDropHooks['dragAndDropHooks']
isQuiet?: boolean
onAction?: (Key) => void
onResizeEnd?: (Map<Key, ColumnSize>) => void
onResizeStart?: (Map<Key, ColumnSize>) => void
overflowMode?: 'wrap' | 'truncate' = 'truncate'
renderEmptyState?: () => React.JSX.Element
}
TableBodyProps RowProps<T> {
+ UNSTABLE_childItems?: Iterable<T>
children: CellElement | Array<CellElement> | CellRenderer
textValue?: string
}CellProps SpectrumTableProps<T> {
+ UNSTABLE_allowsExpandableRows?: boolean
+ UNSTABLE_defaultExpandedKeys?: 'all' | Iterable<Key>
+ UNSTABLE_expandedKeys?: 'all' | Iterable<Key>
+ UNSTABLE_onExpandedChange?: (Set<Key>) => any
density?: 'compact' | 'regular' | 'spacious' = 'regular'
dragAndDropHooks?: DragAndDropHooks['dragAndDropHooks']
isQuiet?: boolean
onAction?: (Key) => void
onResizeEnd?: (Map<Key, ColumnSize>) => void
onResizeStart?: (Map<Key, ColumnSize>) => void
overflowMode?: 'wrap' | 'truncate' = 'truncate'
renderEmptyState?: () => React.JSX.Element
}
@react-stately/tableRowProps RowProps<T> {
+ UNSTABLE_childItems?: Iterable<T>
children: CellElement | Array<CellElement> | CellRenderer
textValue?: string
} |
8cb1a5d to
3013156
Compare
a79adcf to
3013156
Compare
✅ Pull Request Checklist:
📝 Test Instructions:
https://reactspectrum.blob.core.windows.net/reactspectrum/9bd8f9fba7c90ace28faa4fd98d682b8bf3f5467/docs/react-spectrum/TableView.html#expandable-rows
🧢 Your Project: