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: The fixed attribute does not take effect #1193

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

yezhonghu0503
Copy link

@yezhonghu0503 yezhonghu0503 commented Sep 21, 2024

修复表格expandable中设置fixed:right不生效,issues:ant-design/ant-design#50846

  • 问题原因

对于fixed的处理不正确,一个是判断逻辑有问题,fixed不应该和expandIconColumnIndex一起判断,一个是插入扩展列的时候没有按照fixed的值来处理

  • 如何修复
  1. 插入时增加判断,当设置fixed为left或者,fixed没设置时,默认插入到列数据数组第一个,如果fixed为right则插入到最后一个
  2. 修改fixedColumn变量表达传入位置到逻辑

Summary by CodeRabbit

  • 新功能
    • 增强了列管理的灵活性,允许更动态地处理展开列的位置和列的固定状态。

Copy link

vercel bot commented Sep 21, 2024

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 Sep 30, 2024 9:36am

Copy link

coderabbitai bot commented Sep 21, 2024

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • tests/__snapshots__/ExpandRow.spec.jsx.snap is excluded by !**/*.snap

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory.

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

Walkthrough

此次更改涉及useColumns函数的逻辑修改,主要集中在插入展开列和确定列的固定位置的逻辑。更新后的条件允许在更多场景下插入展开列,并简化了确定固定列的逻辑,以提高列管理的灵活性。

Changes

文件路径 更改摘要
src/hooks/useColumns/index.tsx 修改了插入展开列的逻辑和固定列的确定方式,增强了列管理的灵活性。

Possibly related PRs

  • fix: dynamic sticky #1184: useSticky钩子的更改可能与整体列管理和布局行为相关,因为这两个PR都涉及组件如何处理其定位和渲染逻辑的调整。

Poem

在列中跳跃的小兔子,
展开新列乐无比。
固定位置随心变,
灵活管理乐无边。
代码更新如春风,
兔子欢跳乐融融! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

@afc163
Copy link
Member

afc163 commented Sep 21, 2024

搞个测试用例 cover 一下

@yezhonghu0503
Copy link
Author

搞个测试用例 cover 一下

ok,稍等

@yezhonghu0503
Copy link
Author

看了下测试用例,没考虑到expandIconColumnIndex小于0时是不渲染的,修改了一下判断条件

Copy link

codecov bot commented Sep 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.73%. Comparing base (c74c46d) to head (3030cbb).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1193      +/-   ##
==========================================
+ Coverage   97.70%   97.73%   +0.02%     
==========================================
  Files          75       75              
  Lines        7420     7422       +2     
  Branches     1112     1114       +2     
==========================================
+ Hits         7250     7254       +4     
+ Misses        164      162       -2     
  Partials        6        6              

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

@yezhonghu0503
Copy link
Author

搞个测试用例 cover 一下

佬,这个pr为啥还不给合并捏

@@ -176,9 +176,13 @@ function useColumns<RecordType>(
// >>> Insert expand column if not exist
if (!cloneColumns.includes(EXPAND_COLUMN)) {
const expandColIndex = expandIconColumnIndex || 0;
if (expandColIndex >= 0) {
console.log(expandColIndex);
Copy link
Member

Choose a reason for hiding this comment

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

删除调试语句

Copy link
Author

Choose a reason for hiding this comment

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

ok

@afc163
Copy link
Member

afc163 commented Sep 30, 2024

最好还是单独给个用例,单看 snap 的改变不容易看出是不是符合预期。

@yezhonghu0503
Copy link
Author

最好还是单独给个用例,单看 snap 的改变不容易看出是不是符合预期。

哦哦,明白鸟

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.

3 participants