Skip to content

[WIP] Add column align property to Table component - #36

Merged
zhaifanhua merged 4 commits into
mainfrom
copilot/add-column-align-feature
Oct 1, 2026
Merged

zhaifanhua merged 4 commits into
mainfrom
copilot/add-column-align-feature

Conversation

Copilot AI commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor
  • 在 TableColumnDef 中添加 align?: 'start' | 'center' | 'end' 属性
  • 在 table.connect.ts 的 getColumnHeaderProps 和 getCellProps 中输出 data-align 属性
  • 在 table.css 中添加 [data-align] 相关样式规则
  • 更新 table.doc.md 文档描述
  • 更新 docs/guide/versioning.md 中的计数
  • 添加 changeset
  • 运行 gate 验证(content gates 全部通过)

Copilot AI and others added 3 commits October 1, 2026 04:42
Co-authored-by: zhaifanhua <106963561+zhaifanhua@users.noreply.github.com>
Co-authored-by: zhaifanhua <106963561+zhaifanhua@users.noreply.github.com>
Agent-Logs-Url: https://github.com/XiHanFun/XiHan.UI/sessions/92e776df-9cda-4082-a7b3-4b55c670644b

Co-authored-by: zhaifanhua <106963561+zhaifanhua@users.noreply.github.com>
Copilot stopped work on behalf of zhaifanhua due to an error October 1, 2026 04:52
Copilot AI requested a review from zhaifanhua October 1, 2026 04:52
@zhaifanhua
zhaifanhua marked this pull request as ready for review October 1, 2026 10:07
Copilot AI balanced review requested due to automatic review settings October 1, 2026 10:07
@zhaifanhua
zhaifanhua merged commit cf0da15 into main Oct 1, 2026
15 of 17 checks passed
@zhaifanhua
zhaifanhua deleted the copilot/add-column-align-feature branch October 1, 2026 10:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The new align→data-align behavior ships without any headless or conformance-suite test coverage, unlike sibling column attributes, and the PR is still marked [WIP].

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

This PR implements the feature requested in issue #35: a per-column align property on the Table component so authors can align column content to start, center, or end. It follows the repo's layered architecture — the Headless connect layer projects the column-def value onto a data-align attribute for both the column header and data cells, and the shared CSS skin consumes that attribute to set text-align/justify-content. No adapter changes are needed because align is a field inside the existing columns prop, so all three adapters pass it through unchanged.

Changes:

  • Add align?: 'start' | 'center' | 'end' to TableColumnDef and emit data-align from getColumnHeaderProps/getCellProps.
  • Add [data-align] rules (start/center/end) to table.css, plus doc and changeset updates.
  • Bump the gate-verified data-* pair counts in docs/guide/versioning.md (component×attr 1977→1978, skin×attr 1122→1123).
File Description
ui/​packages/​engine/​headless/​src/​table/​table.types.ts Adds the optional align field to the column definition contract.
ui/​packages/​engine/​headless/​src/​table/​table.connect.ts Projects def?.align onto data-align for column headers and cells.
ui/​packages/​design/​styles/​css/​table.css Adds start/center/end alignment rules keyed on data-align.
ui/​packages/​engine/​headless/​src/​table/​table.doc.md Documents the new align behavior and data-align hook.
ui/​.changeset/​table-column-align.md Minor changeset for @xihan-ui/headless and @xihan-ui/styles.
docs/​guide/​versioning.md Updates the data-* pairing counts consumed by the docs gate.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

// 两个属性都不带位移——被拖的列原地不动,冻结列的吸附才不会被祖先 transform 打死
'data-dragging': dataAttr(draggingColumn === column.value),
'data-drop': dropSide(column.value),
'data-align': def?.align,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 表格 Table 的 Column 有加上 align 属性,可以设置居左、中、右,这个功能我觉得比较常见且实用

3 participants