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: 修复明细表自定义列头时, 隐藏列头后出现空白区域 close #3044 #3046

Merged
merged 2 commits into from
Dec 20, 2024

Conversation

lijinke666
Copy link
Member

👀 PR includes

🐛 Bugfix

📝 Description

🖼️ 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.

Copy link

vercel bot commented Dec 19, 2024

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

Name Status Preview Comments Updated (UTC)
antvis-s2 ❌ Failed (Inspect) Dec 19, 2024 6:24am

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 next 2.0-next 版本的问题 pr(fix) bug fix labels Dec 19, 2024
@github-actions github-actions bot requested a review from wjgogogo December 19, 2024 06:14
Copy link

Walkthrough

此PR修复了在明细表自定义列头时,隐藏列头后出现空白区域的问题。通过重新计算父级节点的宽度和x坐标,确保隐藏列头后布局正确。添加了相关的单元测试和文档说明。

Changes

文件 概要
jest.config.base.js 移除了forceExit: true配置。
packages/s2-core/tests/data/custom-table-col-fields.ts 添加了新的自定义列头数据结构。
packages/s2-core/tests/spreadsheet/custom-table-col-spec.ts 添加了测试用例以验证隐藏列头后的布局。
packages/s2-core/scripts/test-live.mjs 增加了--detectOpenHandles选项以检测未关闭的句柄。
packages/s2-core/src/facet/base-facet.ts 新增了计算父级节点宽度和x坐标的方法。
packages/s2-core/src/facet/pivot-facet.ts 替换为新的父级节点宽度和x坐标计算方法。
packages/s2-core/src/facet/table-facet.ts 替换为新的父级节点宽度和x坐标计算方法。
s2-site/docs/common/interaction.zh.md 更新了隐藏列头的文档说明。
s2-site/docs/manual/advanced/interaction/hide-columns.zh.md 更新了隐藏列头的文档说明并添加了获取列头ID的示例。
s2-site/examples/interaction/advanced/demo/pivot-hide-columns.ts 修正了注释中的拼写错误。
s2-site/examples/interaction/advanced/demo/table-hide-columns.ts 添加了关于自定义列头的注释。

@@ -8,7 +8,7 @@ import ora from 'ora';
inquirer.registerPrompt('autocomplete', autoCompletePrompt);

function run(path) {
const command = `cross-env DEBUG_MODE=1 npx jest ${path} --passWithNoTests`;
const command = `cross-env DEBUG_MODE=1 npx jest ${path} --passWithNoTests --detectOpenHandless`;

Choose a reason for hiding this comment

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

There seems to be a typo in the option --detectOpenHandless. It should be --detectOpenHandles.

(childNode) => childNode.width,
);
// 父节点 x 坐标 = 第一个未隐藏的子节点的 x 坐标
const parentNodeX = firstVisibleChildNode?.x || 0;
Copy link
Member Author

Choose a reason for hiding this comment

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

没有任何改动, 移动到 base-facet, 给明细表复用, 多列头下隐藏透视表之前修复过, 现在保持两边逻辑统一

@codecov-commenter
Copy link

codecov-commenter commented Dec 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.77%. Comparing base (ecdc9c8) to head (1bcfba0).
Report is 566 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3046      +/-   ##
==========================================
  Coverage   75.77%   75.77%              
==========================================
  Files         257       51     -206     
  Lines       11994     1490   -10504     
  Branches     2464      284    -2180     
==========================================
- Hits         9088     1129    -7959     
+ Misses       1398      210    -1188     
+ Partials     1508      151    -1357     

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

Copy link
Contributor

github-actions bot commented Dec 19, 2024

Size Change: -59 B (-0.01%)

Total Size: 618 kB

Filename Size Change
./packages/s2-core/dist/s2.min.js 257 kB -59 B (-0.02%)
ℹ️ View Unchanged
Filename Size
./packages/s2-core/dist/s2-extends.min.js 154 kB
./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

@lijinke666 lijinke666 merged commit 7e30008 into next Dec 20, 2024
9 of 11 checks passed
@lijinke666 lijinke666 deleted the fix-3044 branch December 20, 2024 03:54
@lijinke666
Copy link
Member Author

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

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member Author

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

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