feat(DataTable): add align prop to Column#248
Merged
Conversation
7 tasks
8454d3c to
d392787
Compare
commit: |
IzumiSy
reviewed
May 13, 2026
| if (col.align) return col.align; | ||
| if (col.type === "number" || col.type === "money") return "right"; | ||
| return "left"; | ||
| } |
IzumiSy
approved these changes
May 13, 2026
Contributor
IzumiSy
left a comment
There was a problem hiding this comment.
Needs fixing conflict, but LGTM
d392787 to
5dac62f
Compare
Adds `align: "left" | "right"` to `Column<TRow>`. Numeric columns (Amount, Score, Total) need right alignment universally; today callers wrap content in `<span className="text-right">` inside `render`. With this prop, header labels, body cells, and the loading-skeleton bar are right-aligned together so the column doesn't visually shift between loading and loaded states. When `align` is omitted, `type: "number"` and `type: "money"` default to "right" so the common case Just Works without extra config. Other types default to "left". Explicit `align` always wins. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5dac62f to
35284a7
Compare
erickteowarang
pushed a commit
that referenced
this pull request
May 14, 2026
Brings in #247 (type-aware cell renderers), #248 (column align), #251 (oxlint upgrade), #253 (accessor narrowing docs), and #254 (inferColumns no longer carries an accessor). Conflicts: - types.ts: dropped the duplicate `accessor` declaration from `ColumnBase` (it now lives per-branch in `ColumnTypeBranch` per #247) and kept both new fields — `align` (from #248) and `truncate` (from this branch). Updated `truncate`'s JSDoc to describe the Tooltip wiring rather than the `title` attribute. - field-helpers.ts: kept main's spread-based `column()` so the discriminated union survives. - data-table.tsx: combined `align` and `truncate` into the same cell classes; rebuilt `content` via `col.render ?? renderTypedCell(...)` (from #247). - data-table.test.tsx / docs: kept both feature describe blocks and combined doc tables. Per @IzumiSy's review (#249), the truncate tooltip now uses the app-shell `<Tooltip>` component (with a `Tooltip.Provider` mounted at `DataTable.Root`) instead of the browser `title` attribute. The cell is wrapped in `Tooltip.Trigger` only when `accessor` returns a stringifiable primitive — objects / arrays / no accessor still apply the truncate CSS but skip the tooltip wiring. Tests: 1010 passing (was 992 + 8 new truncate tests). Lint, fmt, workspace typecheck all clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
align: "left" | "right"toColumn<TRow>. Numeric columns (Amount, Score, Total) need right alignment everywhere; today callers wrap content in<span className="text-right">insiderender. This pushes the concern down to the column-type level.alignto"right"fortype: "number"andtype: "money"so typed numeric columns are right-aligned without any extra config. Other types default to"left". Explicitalignalways wins.Stacked on PR #247
This branch is rebased on `feat/data-table/type-aware-cells` (#247) — the auto-default needs `Column.type` from that PR. Merge #247 first; the diff here will collapse to just the align changes.
Why this is part of a three-PR series
This is 2 / 3 in a series porting patterns from a downstream consumer's `ReconciliationList` into the platform `DataTable`. PR 1 (#247) adds `type` for built-in cell renderers; PR 3 (#249) adds `truncate`.
Notes for reviewers
Test plan
🤖 Generated with Claude Code