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: 修复默认配置对 ChartSheet 不生效 #3075

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

lijinke666
Copy link
Member

👀 PR includes

🐛 Bugfix

  • Solve the issue and close #0

📝 Description

🖼️ Screenshot

Before After

🔗 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
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 pr(fix) bug fix label Jan 10, 2025
Copy link

Walkthrough

此PR修复了默认配置对ChartSheet不生效的问题。通过重构代码,确保自定义选项与默认选项和主题配置合并,解决了配置不生效的问题。

Changes

文件 概要
packages/s2-react/playground/components/ChartSheet.tsx 移除了空的style对象。
packages/s2-react/src/components/sheets/chart-sheet/index.tsx 重构了选项和主题配置的合并逻辑,确保自定义配置生效。
s2-site/docs/manual/advanced/chart-with-g2.zh.md 修正了文档中的格式问题。
s2-site/examples/custom/custom-shape-and-chart/demo/custom-g2-chart.ts 添加了注释以解释配置项的用途。
s2-site/examples/react-component/sheet/demo/chart.tsx 添加了tooltip配置以禁用数据单元格的工具提示。

@github-actions github-actions bot added the next 2.0-next 版本的问题 label Jan 10, 2025
@github-actions github-actions bot requested a review from wjgogogo January 10, 2025 03:55
customOptions,
options,
);
}, [customOptions]);

Choose a reason for hiding this comment

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

The merging logic for options now includes defaultOptions, customOptions, and options. Ensure that the order of merging is correct to avoid unintended overwrites.

@@ -39,11 +27,27 @@ export const ChartSheet: React.FC<SheetComponentProps> = React.memo((props) => {
},
};

return customMerge<SheetComponentOptions>(defaultOptions, options);
}, [defaultOptions]);
const options: SheetComponentOptions = {
Copy link
Member Author

Choose a reason for hiding this comment

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

调整 merge 顺序, 确保自定义的 style 可以被覆盖

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.77%. Comparing base (ecdc9c8) to head (2e030c8).
Report is 597 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3075      +/-   ##
==========================================
  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

Size Change: +22 B (0%)

Total Size: 619 kB

Filename Size Change
./packages/s2-react/dist/s2-react.min.js 38.3 kB +22 B (+0.06%)
ℹ️ 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-core/dist/s2.min.js 257 kB
./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-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 09a1f06 into next Jan 10, 2025
13 of 14 checks passed
@lijinke666 lijinke666 deleted the fix-chart-sheet-config branch January 10, 2025 04: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(fix) bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants