Skip to content

feat(style): 支持紧凑模式下设置额外宽度和最小宽度#3309

Merged
Alexzjt merged 4 commits intonextfrom
copilot/fix-issue-3305
Feb 4, 2026
Merged

feat(style): 支持紧凑模式下设置额外宽度和最小宽度#3309
Alexzjt merged 4 commits intonextfrom
copilot/fix-issue-3305

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 30, 2026

Solve the issue and close #3305

layoutWidthType: 'compact' 模式下缺少对额外宽度和最小宽度的配置支持,导致紧凑布局时单元格可能过窄影响可读性。

改动

  • 新增配置项 (S2Style):

    • compactExtraWidth: 紧凑模式下在计算宽度基础上增加的额外宽度
    • compactMinWidth: 紧凑模式下的最小单元格宽度
  • 应用新配置:

    • pivot-facet.ts: getCompactGridColNodeWidth, getCompactGridRowNodeWidth
    • table-facet.ts: getCompactColNodeWidth
    • pivot-chart-facet.ts: getCompactGridColNodeWidth

使用示例

const s2Options = {
  style: {
    layoutWidthType: 'compact',
    compactExtraWidth: 12,  // 每个单元格额外增加 12px
    compactMinWidth: 60,    // 最小宽度 60px
  },
};
iShot_2026-01-31_22.27.34.mp4

Copilot AI changed the title [WIP] 修复仓库中的代码bug feat(style): 支持紧凑模式下设置额外宽度和最小宽度 Jan 30, 2026
Copilot AI requested a review from Alexzjt January 30, 2026 09:24
@Alexzjt Alexzjt marked this pull request as ready for review January 30, 2026 14:53
@github-actions github-actions bot added next 2.0-next 版本的问题 pr(feature) new feature labels Jan 30, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 78.78%. Comparing base (ecdc9c8) to head (270d5ee).
⚠️ Report is 776 commits behind head on next.

Files with missing lines Patch % Lines
...src/extends/pivot-chart/facet/pivot-chart-facet.ts 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3309      +/-   ##
==========================================
+ Coverage   75.77%   78.78%   +3.01%     
==========================================
  Files         257      224      -33     
  Lines       11994    12442     +448     
  Branches     2464     2815     +351     
==========================================
+ Hits         9088     9802     +714     
+ Misses       1398      946     -452     
- Partials     1508     1694     +186     

☔ 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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 30, 2026

Size Change: +183 B (+0.02%)

Total Size: 740 kB

Filename Size Change
./packages/s2-core/dist/s2-extends.min.js 207 kB +45 B (+0.02%)
./packages/s2-core/dist/s2.min.css 583 B +2 B (+0.34%)
./packages/s2-core/dist/s2.min.js 308 kB +136 B (+0.04%)
ℹ️ View Unchanged
Filename Size
./packages/s2-react-components/dist/s2-react-components.min.css 2.55 kB
./packages/s2-react-components/dist/s2-react-components.min.js 123 kB
./packages/s2-react/dist/s2-react.min.css 1.3 kB
./packages/s2-react/dist/s2-react.min.js 38.5 kB
./packages/s2-vue/dist/s2-vue.min.css 3.8 kB
./packages/s2-vue/dist/s2-vue.min.js 54.2 kB

compressed-size-action

@github-actions
Copy link
Copy Markdown
Contributor

你好, @Copilot CI 执行失败, 请点击 [Details] 按钮查看, 并根据日志修复。

Hello, @Copilot CI run failed, please click the [Details] button for detailed log information and fix it.

@github-actions github-actions bot added the 🚨 test failed 单元测试挂了 label Jan 30, 2026
@github-actions github-actions bot removed the 🚨 test failed 单元测试挂了 label Jan 31, 2026
@Alexzjt
Copy link
Copy Markdown
Contributor

Alexzjt commented Feb 4, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

这次的 Pull Request 做得很棒!通过引入 compactExtraWidthcompactMinWidth 两个新的样式配置,有效地解决了紧凑布局模式下单元格可能过窄的问题,提升了表格的可读性和美观性。

主要改动点都考虑得很周全:

  • 核心逻辑: 在 pivot-facettable-facetpivot-chart-facet 中都正确地应用了新的宽度计算逻辑。
  • 测试覆盖: 为新功能添加了全面的单元测试,覆盖了 compactExtraWidthcompactMinWidth 相互作用的各种场景。
  • 文档更新: 及时更新了中英文文档,并增加了一个新的 Playground 示例,方便用户理解和使用新功能。

代码整体质量很高,这是一个非常有价值的功能增强。

@Alexzjt Alexzjt merged commit c6cdec7 into next Feb 4, 2026
11 checks passed
@Alexzjt Alexzjt deleted the copilot/fix-issue-3305 branch February 4, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

next 2.0-next 版本的问题 pr(feature) new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🙏希望layoutWidthType配置项的紧凑模式(compact)支持设置紧凑后的额外宽度,或者设置最小宽度

3 participants