feat(core): Table tree expand-all header control (#4142)#4172
Draft
humbertovirtudes wants to merge 1 commit into
Draft
feat(core): Table tree expand-all header control (#4142)#4172humbertovirtudes wants to merge 1 commit into
humbertovirtudes wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
July 22, 2026 07:45
humbertovirtudes
force-pushed
the
navi/feat/tree-expand-all
branch
from
July 22, 2026 07:52
1d2c26e to
9421670
Compare
Contributor
PR Analysis ReportModified ComponentsTable
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 serious. Table - 1 issue(s)
Generated by PR Enrichment workflow | View full report |
humbertovirtudes
force-pushed
the
navi/feat/tree-expand-all
branch
from
July 23, 2026 09:22
9421670 to
e4cafd0
Compare
…ook#4142) useTableTreeState now returns an aggregate isAllExpanded state (true / false / 'indeterminate') and threads expandAll / collapseAll into treeConfig. useTableTreeData gains a hasExpandAllControl prop: when set, it renders an expand-all/collapse-all toggle in the tree column header, wired to that state, so consumers no longer hand-roll external buttons. Flat data stays a full no-op. Also adds a docsite example block (TableTreeTable) wired to useTableTreeState so /components/useTableTreeState renders a live example, matching the other Table plugin pages. This is the first affordance folded in from useTableRowExpansion as part of converging the two tree plugins (facebook#4142). Tests: 13 new (7 state-layer, 6 render-layer, all RED-verified before implementation); full core Table suite 447/447 green; tsc + eslint clean; changeset validated. Docsite block registers under exampleFor: useTableTreeState. This diff was generated with AI assistance (Navi). The implementation and tests were produced by an AI agent following test-driven development. The human author reviewed and approved the changes. Tags: ai-generated
humbertovirtudes
force-pushed
the
navi/feat/tree-expand-all
branch
from
July 23, 2026 09:31
e4cafd0 to
698d19c
Compare
This file contains hidden or 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
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.
Summary
First step of the tree-plugin convergence tracked in #4142: fold
useTableRowExpansion's header expand-all affordance intouseTableTreeData/useTableTreeState.useTableTreeStatealready ownedexpandAll/collapseAllbut exposed no aggregate state and no header UI, so consumers had to hand-roll external buttons (see the oldExpandAndCollapseAllstory). This adds the built-in control.What changed
useTableTreeState: returns a newisAllExpanded: boolean | 'indeterminate'(true when every expandable row is expanded, false when none are,'indeterminate'when some are), and threadsisAllExpanded+onExpandAll/onCollapseAllintotreeConfig. Only expandable ids count toward the tally, so expanded ids matching a leaf or no row never skew it. Reportsfalsefor flat data.useTableTreeData: newhasExpandAllControl?: booleanprop. When set (and the data is hierarchical and the state supplies the aggregate + handlers),transformHeaderCellrenders an expand-all/collapse-all toggle in the tree column header, reusing the row expander's chevron affordance. The toggle points down (aria-expanded=true) only when everything is expanded, matching the row expander;'indeterminate'reads as collapsed. AtreeKeyRefwritten intransformColumns(pipeline step 1) tellstransformHeaderCell(step 4) which column is the tree column.@astryx.tableTree.expandAllRows/collapseAllRows.Config mapping (vs
useTableRowExpansion)useTableRowExpansionisAllExpanded: boolean | 'indeterminate'isAllExpanded(now computed byuseTableTreeState)onToggleExpandAll(expand)onExpandAll/onCollapseAll__expansioncolumntransformHeaderCellTest plan
TDD, RED verified before implementation:
useTableTreeState.test.tsx: +7 tests (aggregate state true/false/indeterminate, flat-data false, leaf/ghost ids ignored,treeConfigwiring).useTableTreeData.test.tsx: +6 tests (control renders only when enabled + hierarchical, expand/collapse on click, relabel, indeterminatearia-expanded=false, flat-data no control).pnpm exec vitest run src/Table(full core Table suite): 447 pass / 0 fail.tsc --project packages/core/tsconfig.json --noEmit: clean.eslinton changed files: clean.check:changesets: valid (pre-1.0 patch).Notes
ExpandAndCollapseAllstory is left intact; a newHeaderExpandAllControlstory demonstrates the built-in control.Docsite example
Adds
TableTreeTable(a file-tree example wired touseTableTreeStatewithhasExpandAllControl) underpackages/cli/templates/blocks/components/Table/, withexampleFor: 'useTableTreeState'. The docsite block registry picks it up automatically, so/components/useTableTreeStatenow renders a live example, matching the other Table plugin pages (that page previously had none).This diff was generated with AI assistance (Navi). The implementation and tests were produced by an AI agent following test-driven development. The human author reviewed and approved the changes.