Skip to content

(DNM) Add TableView expandable rows docs#4758

Closed
reidbarber wants to merge 82 commits intomainfrom
expandable-rows-docs
Closed

(DNM) Add TableView expandable rows docs#4758
reidbarber wants to merge 82 commits intomainfrom
expandable-rows-docs

Conversation

@reidbarber
Copy link
Member

@reidbarber reidbarber commented Jul 11, 2023

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

https://reactspectrum.blob.core.windows.net/reactspectrum/9bd8f9fba7c90ace28faa4fd98d682b8bf3f5467/docs/react-spectrum/TableView.html#expandable-rows

🧢 Your Project:

LFDanLu added 30 commits May 30, 2023 17:29
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
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
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...
LFDanLu added 8 commits July 20, 2023 11:31
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
@rspbot
Copy link

rspbot commented Jul 21, 2023

your TableView.

```tsx example
import {enableTableNestedRows} from '@react-stately/flags';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Base automatically changed from expandable_rows_collection_update to main July 21, 2023 22:55
@LFDanLu LFDanLu dismissed stale reviews from yihuiliao and themself July 21, 2023 22:55

The base branch was changed.

@rspbot
Copy link

rspbot commented Aug 4, 2023

@rspbot
Copy link

rspbot commented Aug 28, 2023

@rspbot
Copy link

rspbot commented Nov 15, 2023

@rspbot
Copy link

rspbot commented Nov 16, 2023

@rspbot
Copy link

rspbot commented Nov 16, 2023

## API Changes

unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }

@react-spectrum/table

Column

 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/table

RowProps

 RowProps<T> {
+  UNSTABLE_childItems?: Iterable<T>
   children: CellElement | Array<CellElement> | CellRenderer
   textValue?: string
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants