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: 修复导出 CSV 时分隔符错误导致的展示格式错误 close #2701 #2703

Merged
merged 5 commits into from
May 9, 2024

Conversation

lijinke666
Copy link
Member

@lijinke666 lijinke666 commented May 8, 2024

👀 PR includes

🐛 Bugfix

📝 Description

  1. BREAKING CHANGE: Export 组件 和 asyncGetAllPlainData, copyToClipboard 的是否异步导出参数统一为 async
  2. 修复普通表格导出 CSV 分隔符错误.
  3. 修复趋势分析表未接受自定义分隔符导致的导出错误.

🖼️ Screenshot

Before After
image image
image image

🔗 Related issue link

close #2701

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

BREAKING CHANGE: Export 组件 和 asyncGetAllPlainData, copyToClipboard
的是否异步导出参数统一为 async
Copy link

vercel bot commented May 8, 2024

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

Name Status Preview Comments Updated (UTC)
antvis-s2 ❌ Failed (Inspect) May 8, 2024 9:46am

@github-actions github-actions bot added next 2.0-next 版本的问题 pr(fix) bug fix labels May 8, 2024
@github-actions github-actions bot requested review from wjgogogo and wuhaiyang May 8, 2024 08:06
const pivotDataCellCopy = new PivotDataCellCopy({
spreadsheet: sheetInstance,
isExport: true,
config: {
separator: split,
formatOptions,
customTransformer,
isAsyncExport: true,
Copy link
Member Author

Choose a reason for hiding this comment

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

透视表没有接受 async 这个参数, 所以同步复制时不生效的

const tableDataCellCopy = new TableDataCellCopy({
spreadsheet: sheetInstance,
config: {
selectedCells: [],
separator: split,
formatOptions,
customTransformer,
isAsyncExport: true ?? isAsyncExport,
async: async ?? true,
Copy link
Member Author

Choose a reason for hiding this comment

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

这个感觉是之前写反了

*/
export const copyToClipboard = (
data: Copyable | string,
sync = false,
async = true,
Copy link
Member Author

Choose a reason for hiding this comment

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

现在有三种 sync syncCopy, isAsyncExport, 有点混乱, 所有参数统一为 async

@@ -82,8 +84,10 @@ export const Export: React.FC<ExportProps> = React.memo((props) => {
const downloadData = async (isFormat: boolean) => {
const data = await asyncGetAllPlainData({
sheetInstance: sheet,
split: NewTab,
// 导出的是 csv 格式, 复制时需要以逗号分割 https://github.com/antvis/S2/issues/2701
split: CSV_SEPARATOR,
Copy link
Member Author

Choose a reason for hiding this comment

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

主要是这个导致的, csv 分隔符应该是 ","

@lijinke666 lijinke666 linked an issue May 8, 2024 that may be closed by this pull request
5 tasks
Copy link
Contributor

github-actions bot commented May 8, 2024

Size Change: +46 B (0%)

Total Size: 320 kB

Filename Size Change
./packages/s2-core/dist/index.min.js 223 kB +31 B (0%)
./packages/s2-react/dist/index.min.js 69.5 kB +15 B (0%)
ℹ️ View Unchanged
Filename Size
./packages/s2-core/dist/style.min.css 402 B
./packages/s2-react/dist/style.min.css 4 kB
./packages/s2-vue/dist/index.min.js 21 kB
./packages/s2-vue/dist/style.min.css 1.97 kB

compressed-size-action

Copy link
Contributor

github-actions bot commented May 8, 2024

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

Hello, @lijinke666 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 May 8, 2024
@lijinke666 lijinke666 merged commit 98c051a into next May 9, 2024
8 of 9 checks passed
@lijinke666 lijinke666 deleted the fix-export branch May 9, 2024 06:07
@lijinke666
Copy link
Member Author

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

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.19 🎉

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

Successfully merging this pull request may close these issues.

🐛导出格式化数据格式错乱
2 participants