Skip to content

feat: ConfigProvider support classNames and styles for table #53659

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

Merged
merged 10 commits into from
May 21, 2025
Merged

Conversation

thinkasany
Copy link
Member

@thinkasany thinkasany commented Apr 26, 2025

🤔 This is a ...

  • 🆕 New feature

💡 Background and Solution

wait for react-component/table#1261

📝 Change Log

Language Changelog
🇺🇸 English feat: ConfigProvider support classNames and styles for table
🇨🇳 Chinese feat: ConfigProvider support classNames and styles for table

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Contributor

coderabbitai bot commented Apr 26, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch cp-table
  • Post Copyable Unit Tests in Comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

github-actions bot commented Apr 26, 2025

👁 Visual Regression Report for PR #53659 Failed ❌

🎯 Target branch: next (ff61411)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎
📊 Summary: 🔄 15 changed

Expected (Branch next) Actual (Current PR) Diff
table-fixed-columns-header.compact.png table-fixed-columns-header.compact.png table-fixed-columns-header.compact.png table-fixed-columns-header.compact.png
table-fixed-columns-header.dark.png table-fixed-columns-header.dark.png table-fixed-columns-header.dark.png table-fixed-columns-header.dark.png
table-fixed-columns-header.default.png table-fixed-columns-header.default.png table-fixed-columns-header.default.png table-fixed-columns-header.default.png
table-fixed-header.compact.png table-fixed-header.compact.png table-fixed-header.compact.png table-fixed-header.compact.png
table-fixed-header.dark.png table-fixed-header.dark.png table-fixed-header.dark.png table-fixed-header.dark.png
table-fixed-header.default.png table-fixed-header.default.png table-fixed-header.default.png table-fixed-header.default.png
table-grouping-columns.compact.png table-grouping-columns.compact.png table-grouping-columns.compact.png table-grouping-columns.compact.png
table-grouping-columns.dark.png table-grouping-columns.dark.png table-grouping-columns.dark.png table-grouping-columns.dark.png

Warning

There are more diffs not shown in the table. Please check the Full Report for details.


Important

There are 15 diffs found in this PR: 🔄 15 changed.
Please check all items:

  • Checked all diffs in the full report
  • Visual diff is acceptable

Copy link

Walkthrough

This pull request introduces a new feature to the ConfigProvider, allowing support for classNames and styles for tables. This enhancement aims to provide more flexibility in styling tables by integrating semantic class names and styles. The changes include updates to documentation and the addition of new types and hooks to manage these styles effectively.

Changes

Files Summary
components/config-provider/index.en-US.md, components/config-provider/index.zh-CN.md Updated documentation to include classNames and styles for tables.
components/pagination/Pagination.tsx Exported SemanticName type for broader usage.
components/table/InternalTable.tsx Major refactor to support classNames and styles, including new hooks and context usage.
components/table/demo/_semantic.tsx Added a new demo file showcasing semantic DOM usage.
components/table/index.en-US.md, components/table/index.zh-CN.md Updated documentation to include a section on Semantic DOM.
🪧 Tips For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me.

Copy link
Contributor

github-actions bot commented Apr 26, 2025

Preview is ready

Copy link
Contributor

github-actions bot commented Apr 26, 2025

size-limit report 📦

Path Size
dist/antd.min.js 499.2 KB (+345 B 🔺)
dist/antd-with-locales.min.js 590.55 KB (+317 B 🔺)

Copy link

cloudflare-workers-and-pages bot commented Apr 26, 2025

Deploying ant-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6ec7a2d
Status: ✅  Deploy successful!
Preview URL: https://1930d835.ant-design.pages.dev
Branch Preview URL: https://cp-table.ant-design.pages.dev

View logs

Copy link

codecov bot commented Apr 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (ff61411) to head (6ec7a2d).
Report is 9 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff            @@
##              next    #53659   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          788       788           
  Lines        14305     14307    +2     
  Branches      3784      3784           
=========================================
+ Hits         14305     14307    +2     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thinkasany thinkasany force-pushed the cp-table branch 2 times, most recently from 0771410 to 90e3f6a Compare May 1, 2025 02:06
@thinkasany thinkasany force-pushed the cp-table branch 2 times, most recently from ecd0b75 to ac05a5e Compare May 13, 2025 13:27
Copy link

socket-security bot commented May 20, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​rc-component/​table@​1.2.7 ⏵ 1.3.077 +310010093 +1100

View full report

Copy link

pkg-pr-new bot commented May 20, 2025

Copy link

codecov bot commented May 20, 2025

Bundle Report

Changes will increase total bundle size by 7.76MB (207.01%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
antd.min-array-push 11.51MB 7.76MB (207.01%) ⬆️⚠️

Affected Assets, Files, and Routes:

view changes for bundle: antd.min-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
antd-with-locales.js (New) 6.06MB 6.06MB 100.0% 🚀
antd.js (New) 5.46MB 5.46MB 100.0% 🚀
antd-with-locales.min.js (Deleted) -2.06MB 0 bytes -100.0% 🗑️
antd.min.js (Deleted) -1.69MB 0 bytes -100.0% 🗑️


const locales = {
cn: {
root: '根元素',
Copy link
Member

Choose a reason for hiding this comment

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

Table 太小了,这个应该是顶格左右的:

截屏2025-05-21 11 06 03

Copy link
Member

Choose a reason for hiding this comment

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

header 的 wrapper 和 row 区分不出来,最好 header 里搞两行:

截屏2025-05-21 11 06 43

'body.cell': '主体单元格元素',
footer: '底部元素',
content: '内容元素',
'pagination.root': '分页根元素',
Copy link
Member

Choose a reason for hiding this comment

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

pagination 好评~~

@@ -75,6 +77,8 @@ interface ChangeEventInfo<RecordType = AnyObject> {
resetPagination: (current?: number, pageSize?: number) => void;
}

export type SemanticName = 'root' | 'section' | 'title' | 'footer' | 'content';
Copy link
Member

Choose a reason for hiding this comment

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

这部分可以从 rc-table 里来出来,下面的 ComponentsSemantic 也是一样的~不用重复定义:

type ClassNames = RcTableProps['classNames'] & {
  pagination?: ...
};

_default: 'root',
},
header: {
_default: 'wrapper',
Copy link
Member

Choose a reason for hiding this comment

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

到 wrapper上?优雅~

address: 'Sydney No. 1 Lake Park',
},
];
const testClassNames = {
Copy link
Member

Choose a reason for hiding this comment

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

Table 比较复杂,还要做一个数量对比,每个 classNames 都要数量正确。

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 21, 2025
@thinkasany thinkasany merged commit cc1bcb6 into next May 21, 2025
44 checks passed
@thinkasany thinkasany deleted the cp-table branch May 21, 2025 07:42
const [locale] = useLocale(locales);

return (
<>
Copy link
Member

Choose a reason for hiding this comment

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

这个 Fragment 是多余的

@dosubot dosubot bot mentioned this pull request Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants