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

fix: 修复维值包含 '\t' 制表符时导致复制到 Excel 中数据错列的问题 #3085

Merged
merged 2 commits into from
Jan 24, 2025

Conversation

lijinke666
Copy link
Member

@lijinke666 lijinke666 commented Jan 24, 2025

👀 PR includes

🐛 Bugfix

  • Solve the issue and close #0

📝 Description

复制/导出时会在文本的两侧中增加制表符,用于在 Excel 中展示, 兼容极端情况,防止维值中本身就存在制表符的情况,如:“成都市\t” => "成都市\t\t" 导致错列

🖼️ Screenshot

Before After
image image

🔗 Related issue link

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

@github-actions github-actions bot added the pr(fix) bug fix label Jan 24, 2025
Copy link
Contributor

你好 @lijinke666,非常感谢你的贡献.
为了让代码更健壮, 请根据 贡献指南 补充相应单元测试 (文档改动或其他特殊场景除外), 如果有 API 改动, 请修改 相应的文档.
同时请检查 linttest 相关 CI 是否通过, 如果失败, 请点击 [Details] 按钮查看, 并根据日志修复.

Hello, @lijinke666, Thanks for your contribution. In order to make the code more robust, please add the corresponding unit tests, and update the docs if there are API changes.
At the same time, please check whether the CI related to lint and test passes. If the CI fails, please click [Details] button to check and repair according to the log.

@github-actions github-actions bot added the next 2.0-next 版本的问题 label Jan 24, 2025
@github-actions github-actions bot requested a review from wjgogogo January 24, 2025 06:08
Copy link

Walkthrough

此PR修复了在复制或导出数据到Excel时,维值中包含制表符(\t)导致数据错列的问题。通过在文本两侧增加制表符,确保在Excel中正确展示,即使维值中本身存在制表符也能兼容。

Changes

文件 概要
packages/s2-core/__tests__/unit/utils/export/export-pivot-spec.ts 添加了测试用例以验证在不同格式选项下,维值中包含制表符的处理。
packages/s2-core/__tests__/unit/utils/export/method-spec.ts 添加了针对trimTabSeparatorconvertStringkeyEqualTo方法的单元测试。
packages/s2-core/src/extends/pivot-chart/cell/pivot-chart-data-cell.ts 修正了类型断言以确保兼容性。
packages/s2-core/src/utils/export/copy/common.ts 在获取节点格式化标签时,移除了值中的制表符。
packages/s2-core/src/utils/export/method.ts 添加了trimTabSeparator方法,用于移除文本中的制表符。

@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.

Project coverage is 79.80%. Comparing base (ecdc9c8) to head (c8f7b82).
Report is 606 commits behind head on next.

Files with missing lines Patch % Lines
packages/s2-core/src/utils/export/method.ts 84.61% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3085      +/-   ##
==========================================
+ Coverage   75.77%   79.80%   +4.03%     
==========================================
  Files         257      211      -46     
  Lines       11994    11628     -366     
  Branches     2464     2618     +154     
==========================================
+ Hits         9088     9280     +192     
+ Misses       1398      781     -617     
- Partials     1508     1567      +59     

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

Copy link
Contributor

github-actions bot commented Jan 24, 2025

Size Change: +119 B (+0.02%)

Total Size: 619 kB

Filename Size Change
./packages/s2-core/dist/s2-extends.min.js 154 kB +88 B (+0.06%)
./packages/s2-core/dist/s2.min.js 257 kB +31 B (+0.01%)
ℹ️ View Unchanged
Filename Size
./packages/s2-core/dist/s2.min.css 581 B
./packages/s2-react-components/dist/s2-react-components.min.css 2.55 kB
./packages/s2-react-components/dist/s2-react-components.min.js 124 kB
./packages/s2-react/dist/s2-react.min.css 1.74 kB
./packages/s2-react/dist/s2-react.min.js 38.3 kB
./packages/s2-vue/dist/s2-vue.min.css 2.05 kB
./packages/s2-vue/dist/s2-vue.min.js 38.3 kB

compressed-size-action

@wjgogogo wjgogogo merged commit 339e532 into next Jan 24, 2025
9 checks passed
@wjgogogo wjgogogo deleted the fix-tab-export branch January 24, 2025 07:05
@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-v2.1.10 🎉

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(fix) bug fix released on @latest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants