Repository navigation
feat(data-table): add sticky column footers #633
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
Merged
+996
−153
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6d486eb
feat(data-table): add sticky column footers
IzumiSy 70e1a5d
feat(examples): show editable column footer totals
IzumiSy 246e147
refactor(data-table): extract FooterRenderContext
IzumiSy 0a7e41e
chore(changeset): consolidate column footer changes
IzumiSy 4023a06
docs(data-table): distinguish column and table footers
IzumiSy 35d12cf
fix(data-table): preserve column footer while loading
IzumiSy 1d8593c
feat(data-table): support static column footer labels
IzumiSy 92db71b
Merge remote-tracking branch 'origin/main' into feat/data-table-colum…
Copilot 1d13391
test(data-table): strengthen width measurement coverage
IzumiSy 0e0f316
Merge branch 'main' into feat/data-table-column-footer
IzumiSy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| "@tailor-platform/app-shell": minor | ||
| --- | ||
|
|
||
| Add `Column.footer` for static labels and rendered summaries in a sticky row that follows column layout without adding synthetic data rows. | ||
| Footer renderers receive the current page's read-only rows through the exported `FooterRenderContext<TRow>`, mirroring the named `HeaderRenderContext` API. | ||
| During loading and page changes, the footer row stays mounted with skeletons instead of displaying stale totals or evaluating footer renderers. | ||
| The existing `DataTable.Footer` pagination and bulk-action container is unchanged. | ||
|
|
||
| ```tsx | ||
| import type { Column } from "@tailor-platform/app-shell"; | ||
|
|
||
| const columns: Column<{ quantity: number | null }>[] = [ | ||
| { | ||
| id: "quantity", | ||
| label: "Quantity", | ||
| type: "number", | ||
| footer: ({ rows }) => rows.reduce((sum, row) => sum + (row.quantity ?? 0), 0), | ||
| }, | ||
| ]; | ||
| ``` |
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
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
40 changes: 40 additions & 0 deletions
40
packages/core/__snapshots__/src__components__data-table__data-table-footer.test.tsx.snap
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
|
||
| exports[`DataTable column footer > renders typed and render-only footers after the body, leaving missing and null content blank 1`] = ` | ||
| <tfoot | ||
| class="astw:border-border astw:text-label-md astw:[&>tr]:last:border-b-0 astw:sticky astw:bottom-0 astw:z-10 astw:bg-card astw:border-t-0 astw:shadow-[inset_0_1px_0_0_var(--border)]" | ||
| data-slot="data-table-column-footer" | ||
| > | ||
| <tr | ||
| class="astw:data-[state=selected]:bg-muted astw:border-b astw:border-border astw:transition-colors astw:hover:bg-transparent" | ||
| data-slot="table-row" | ||
| > | ||
| <td | ||
| class="astw:px-2 astw:py-2 astw:first:pl-6 astw:last:pr-6 astw:align-middle astw:whitespace-nowrap astw:[&:has([role=checkbox])]:pr-0 astw:text-left" | ||
| data-col-key="name" | ||
| data-slot="data-table-column-footer-cell" | ||
| > | ||
| Total | ||
| </td> | ||
| <td | ||
| class="astw:px-2 astw:py-2 astw:first:pl-6 astw:last:pr-6 astw:align-middle astw:whitespace-nowrap astw:[&:has([role=checkbox])]:pr-0 astw:text-right" | ||
| data-col-key="quantity" | ||
| data-slot="data-table-column-footer-cell" | ||
| > | ||
| <strong> | ||
| 5 | ||
| </strong> | ||
| </td> | ||
| <td | ||
| class="astw:px-2 astw:py-2 astw:first:pl-6 astw:last:pr-6 astw:align-middle astw:whitespace-nowrap astw:[&:has([role=checkbox])]:pr-0 astw:text-left" | ||
| data-col-key="note" | ||
| data-slot="data-table-column-footer-cell" | ||
| /> | ||
| <td | ||
| class="astw:px-2 astw:py-2 astw:first:pl-6 astw:last:pr-6 astw:align-middle astw:whitespace-nowrap astw:[&:has([role=checkbox])]:pr-0 astw:text-left" | ||
| data-col-key="id" | ||
| data-slot="data-table-column-footer-cell" | ||
| /> | ||
| </tr> | ||
| </tfoot> | ||
| `; |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.