Skip to content
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

feat(layout): 单元格支持渲染多行文本 #2383

Merged
merged 18 commits into from
Nov 22, 2023
Merged

Conversation

lijinke666
Copy link
Member

@lijinke666 lijinke666 commented Oct 24, 2023

👀 PR includes

✨ Feature

  • New feature

📝 Description

  1. 适配 G 5.0多行文本特性, 主题配置增加相关配置, 可自由选择是否换行.
  2. 默认 1 行展示, 通过 maxLines 调整
  3. 移除所有内部的 getEllipsisText 使用, 统一使用 G 5.0 的省略号绘制逻辑 (遵循 CSS 规则, 空间不足直接 clip, 而不是显示 ...)
  4. 单元格最小高度根据实际文字高度自动调整
const cellTheme: DefaultCellTheme = {
  text: {
    wordWrap: true,
    maxLines: 2,
    textOverflow: 'ellipsis',
  },
  bolderText: {
    wordWrap: true,
    maxLines: 2,
    textOverflow: 'ellipsis',
  },
  measureText: {
    wordWrap: true,
    maxLines: 2,
    textOverflow: 'ellipsis',
  },
};

s2.setTheme({
  colCell: cellTheme,
  rowCell: cellTheme,
  cornerCell: cellTheme,
  dataCell: cellTheme,
})
透视表 (平铺/树状) 明细表 (单列头/多列头)
image image image image
自定义行头 自定义列头
image image

🖼️ Screenshot

单元格根据文本高度自适应 (1行 - 6行)

Kapture 2023-11-06 at 16 06 51

🔗 Related issue link

closes #1358 #2382 #2059 #1114 #1564

🔍 Self-Check before the merge

  • Add or update relevant docs.
  • Add or update relevant demos.
  • Add or update test case.
  • Add or update relevant TypeScript definitions.

@vercel
Copy link

vercel bot commented Oct 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
antvis-s2 ❌ Failed (Inspect) Nov 22, 2023 7:31am

@github-actions github-actions bot added the next 2.0-next 版本的问题 label Oct 24, 2023
@lijinke666 lijinke666 changed the title feat(layout): 单元格支持渲染多行文本 [WIP] feat(layout): 单元格支持渲染多行文本 Oct 24, 2023
@github-actions github-actions bot added the pr(feature) new feature label Oct 24, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2023

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

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 31, 2023

Size Change: -10.8 kB (-3%)

Total Size: 311 kB

Filename Size Change
./packages/s2-core/dist/index.min.js 217 kB -10.8 kB (-5%)
./packages/s2-react/dist/index.min.js 67.4 kB +3 B (0%)
ℹ️ View Unchanged
Filename Size
./packages/s2-core/dist/style.min.css 402 B
./packages/s2-react/dist/style.min.css 3.99 kB
./packages/s2-vue/dist/index.min.js 20.2 kB
./packages/s2-vue/dist/style.min.css 1.98 kB

compressed-size-action

Copy link

codecov bot commented Nov 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ecdc9c8) 75.77% compared to head (242a85a) 77.85%.
Report is 210 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #2383      +/-   ##
==========================================
+ Coverage   75.77%   77.85%   +2.08%     
==========================================
  Files         257      270      +13     
  Lines       11994    12038      +44     
  Branches     2464     2442      -22     
==========================================
+ Hits         9088     9372     +284     
+ Misses       1398     1164     -234     
+ Partials     1508     1502       -6     

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

@ayizhi
Copy link

ayizhi commented Nov 22, 2023

大佬们,合一下?

@noootwo
Copy link

noootwo commented Nov 22, 2023

@lijinke666 哈喽你好,请问这个特性计划在什么时候发布呢

@lijinke666
Copy link
Member Author

@lijinke666 哈喽你好,请问这个特性计划在什么时候发布呢

预计年底发布正式版

@github-actions github-actions bot removed the 🚨 test failed 单元测试挂了 label Nov 22, 2023
@lijinke666 lijinke666 merged commit e3b919a into next Nov 22, 2023
9 of 10 checks passed
@lijinke666 lijinke666 deleted the feat-mulit-line-text branch November 22, 2023 07:54
@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-v2.0.0-next.9 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-react-v2.0.0-next.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

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 released on @next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants