Skip to content

feat: add inner div for cell with append node #1285

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Hyperionlucky
Copy link

@Hyperionlucky Hyperionlucky commented May 29, 2025

背景:当想让nest expandable button垂直居中时,当前没有很好的方式在不影响父元素table-cell的同时,实现expandable居中,因此想要在外层加一个div,方便后续基于这个div进行自定义的扩展。
修改方式:通过在外层新增div的方式,增加样式扩展点,方便样式定制。

Summary by CodeRabbit

  • 样式
    • 单元格内容现在被包裹在一个新的内部容器中,便于后续样式和布局调整。

Copy link

vercel bot commented May 29, 2025

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

Name Status Preview Comments Updated (UTC)
table ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 29, 2025 9:16am

Copy link

coderabbitai bot commented May 29, 2025

Walkthrough

本次更改在组件内部增加了一个新的内层 <div> 容器,将 appendNodemergedChildNode 一起包裹。该容器的类名根据条件动态生成,用于更好地组织和控制单元格内容的结构。其他逻辑未发生变化。

Changes

文件/路径 变更摘要
src/Cell/index.tsx 新增内层 <div>,动态组合类名,将内容包裹于该容器中。

Poem

小兔跳进单元格,
新添内层小窝窝。
内容紧紧抱一团,
样式灵活不啰嗦。
结构清晰真不错,
代码世界乐呵呵!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/Cell/index.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "prettier" to extend from. Please check that the name of the config is correct.

The config "prettier" was referenced from the config file in "/.eslintrc.js".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

✨ Finishing Touches
  • 📝 Generate Docstrings

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/Cell/index.tsx (2)

241-241: 检查 inner wrapper 的 className 命名和样式定义

  • innerCellDivClassName 使用了 ${cellPrefixCls}-inner-div,并在 appendNode 存在时额外添加了 ${cellPrefixCls}-with-append,与外层 cell 的同名 class 会导致样式冗余或冲突。
  • 建议:
    1. 为 inner div 增加独立的后缀 class,例如 ${cellPrefixCls}-inner-div-with-append,以便更精确地控制样式。
    2. 确认样式文件中已定义 .${cellPrefixCls}-inner-div 及相关的 with-append 样式规则,否则该容器 div 可能没有任何视觉效果。

291-294: 校验新增的内层 <div> 包裹结构

  • 新增 <div>appendNodemergedChildNode 包裹,以提供样式挂钩点,逻辑合理。
  • 请确认:
    1. HTML 语义上允许在 <td> 中嵌套 <div>,且不会影响表格原有布局(可以在样式文件中为 .${cellPrefixCls}-inner-div 设置 display: flex; align-items: center; height: 100% 等属性来实现垂直居中)。
    2. 是否需要为该 div 添加额外的可访问性属性或自定义事件(如 aria-data- 属性)以满足无障碍需求。
  • 建议:
    • 更新或新增组件快照/单元测试,覆盖 inner-div 的渲染和 className 行为,确保在未来改动时不被意外移除。
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dbf360d and a2e0f07.

📒 Files selected for processing (1)
  • src/Cell/index.tsx (2 hunks)

@@ -287,8 +288,10 @@ function Cell<RecordType>(props: CellProps<RecordType>) {
colSpan={mergedColSpan !== 1 ? mergedColSpan : null}
rowSpan={mergedRowSpan !== 1 ? mergedRowSpan : null}
>
{appendNode}
{mergedChildNode}
<div className={innerCellDivClassName}>
Copy link
Member

Choose a reason for hiding this comment

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

你可以直接自定义 components ,提供出来一个自带 div 的 td 就够了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants