Skip to content

fix(Cell): 按 value 是否为空区分 flex,空 value 不占位、有内容时撑满#1006

Merged
Pilotager merged 3 commits intomallfoundry:mainfrom
Duo-Huang:fix/cell-value-flex-by-empty
Mar 10, 2026
Merged

fix(Cell): 按 value 是否为空区分 flex,空 value 不占位、有内容时撑满#1006
Pilotager merged 3 commits intomallfoundry:mainfrom
Duo-Huang:fix/cell-value-flex-by-empty

Conversation

@Duo-Huang
Copy link
Copy Markdown
Contributor

关联

问题

#968taroify-cell__value 改为 flex: 0 0 auto 后,导致「仅 value、无 title」的 Cell(如表单输入)无法撑满宽度。#1004 通过仅在 --alone 上设 flex: 1 缓解,但依赖「是否有 title」而非「value 是否有内容」,Field 等有 label 的场景仍可能不撑满。

方案

value 是否为空 区分:

  • 有内容flex: 1,撑满剩余空间(无论是否 alone)。
  • :增加 --empty class,flex: 0 0 auto,不占位,brief 可撑满。

改动

  1. cell.scss:默认 &__value { flex: 1; },新增 &__value--empty { flex: 0 0 auto; }
  2. cell-value.tsx:根据 React.Children.count(children) === 0 为 value 节点添加 cell__value--empty;并修正渲染时把 children 传入 View(此前从 props 解构后未传入)。

@Pilotager Pilotager merged commit bcd4696 into mallfoundry:main Mar 10, 2026
3 checks passed
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@5448f82). Learn more about missing BASE report.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1006   +/-   ##
=======================================
  Coverage        ?   56.78%           
=======================================
  Files           ?       57           
  Lines           ?      965           
  Branches        ?      285           
=======================================
  Hits            ?      548           
  Misses          ?      410           
  Partials        ?        7           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

3 participants