Skip to content

chore: add reverse css var #1248

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 2 commits into from
Mar 11, 2025
Merged

chore: add reverse css var #1248

merged 2 commits into from
Mar 11, 2025

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Mar 11, 2025

Summary by CodeRabbit

  • 新增功能
    • 引入了一个可选的反向层级配置,提供更灵活的固定单元格样式设置。
    • 优化了固定列的视觉叠层顺序,使得在定位于开头或结尾的单元格中展现更合适的层叠效果。

Copy link

vercel bot commented Mar 11, 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 Mar 11, 2025 3:16am

Copy link

coderabbitai bot commented Mar 11, 2025

Walkthrough

此次更改在 Cell 组件中新增了可选属性 zIndexReverse,用于实现反向 z-index 调整,同时在辅助计算固定单元格信息的工具函数中加入了 zIndexzIndexReverse 两个可选属性,并调整了相关逻辑计算与返回结果。

Changes

文件路径 修改摘要
src/Cell/index.tsx CellProps 接口中新增 zIndexReverse;在 Cell 函数中解构该属性并设置 CSS 变量 --z-offset-reverse
src/utils/fixUtil.ts FixedInfo 接口中新增 zIndexzIndexReverse 属性;在 getCellFixedInfo 函数中计算并返回这两个属性。

Sequence Diagram(s)

sequenceDiagram
    participant Cell
    participant Calculator as getCellFixedInfo
    participant CSS
    Cell->>Calculator: 请求固定单元格信息
    Calculator-->>Cell: 返回 { zIndex, zIndexReverse }
    Cell->>CSS: 设置 CSS 变量 --z-offset-reverse 等样式属性
Loading

Possibly related PRs

  • fix: stack case #1247: 与本 PR 存在直接联系,均引入了 zIndexReverse 属性,并对 CellPropsFixedInfo 接口进行了相应修改。

Poem

嗨,我是一只小兔子,跳跃在代码间,
zIndexReverse 来让层次变得更奇幻。
固定列的新逻辑,像花儿般盛放,
每个小改动,都闪耀着可爱光芒。
代码世界里的魔法,让我们一起欢畅!
🐇💻✨

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.

src/utils/fixUtil.ts

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.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2480d88 and 51d67ec.

⛔ Files ignored due to path filters (4)
  • tests/__snapshots__/ExpandRow.spec.jsx.snap is excluded by !**/*.snap
  • tests/__snapshots__/FixedColumn.spec.tsx.snap is excluded by !**/*.snap
  • tests/__snapshots__/Summary.spec.tsx.snap is excluded by !**/*.snap
  • tests/__snapshots__/Table.spec.jsx.snap is excluded by !**/*.snap
📒 Files selected for processing (2)
  • src/Cell/index.tsx (3 hunks)
  • src/utils/fixUtil.ts (3 hunks)
🔇 Additional comments (10)
src/Cell/index.tsx (4)

47-47: 新增了 zIndexReverse 属性,增强了 Z 轴层叠控制能力

此处添加了可选的 zIndexReverse 属性,与现有的 zIndex 属性相互补充,为固定列的 z-index 层叠提供了更灵活的控制方式。


116-116: 属性解构中包含了新增的 zIndexReverse 属性

在 Cell 组件属性解构中正确地包含了 zIndexReverse 属性,保持了代码的一致性。


169-169: 为 fixStart 元素设置了 CSS 变量 --z-offset-reverse

正确地将 zIndexReverse 属性值应用于固定在起始位置的单元格,设置 CSS 变量 --z-offset-reverse


174-174: 为 fixEnd 元素设置了 CSS 变量 --z-offset-reverse

正确地将 zIndexReverse 属性值应用于固定在末端位置的单元格,设置 CSS 变量 --z-offset-reverse

src/utils/fixUtil.ts (6)

20-23: 在 FixedInfo 接口中添加了 zIndex 和 zIndexReverse 属性

添加了两个新属性并提供了清晰的注释说明其用途:

  • zIndex: 用于设置第一个固定列的 z-index 大于下一个列
  • zIndexReverse: 用于设置第一个固定列的 z-index 小于下一个列

这种设计使得层叠顺序控制更加灵活。


59-59: 初始化 zIndexReverse 变量

与现有的 zIndex 变量初始化方式保持一致,初始化 zIndexReverse 为 0。


64-64: 计算 fixStart 情况下的 zIndexReverse 值

当列固定在开始位置时,将 zIndexReverse 设置为 colStart,这意味着越靠近表格左侧的固定列 z-index 值越小,与原有的 zIndex 计算逻辑形成互补。


69-69: 计算 fixEnd 情况下的 zIndexReverse 值

当列固定在结束位置时,将 zIndexReverse 设置为 columns.length * 2 - colEnd,这与 zIndex 的计算逻辑相反,提供了更灵活的 z-index 控制方式。注释中清晰说明了计算目的。


100-100: 在返回结果中包含 zIndexReverse 属性

将计算得到的 zIndexReverse 值包含在函数的返回对象中,以便 Cell 组件使用。


1-102: 建议: 考虑添加相关 CSS 样式文件的更新

PR 中添加了 CSS 变量 --z-offset-reverse,但没有看到相应的 CSS 样式使用这个变量。建议确认是否需要在相关的样式文件中添加对此变量的使用,以使 zIndexReverse 功能生效。

✨ 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.
    • 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 generate docstrings to generate docstrings 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

codecov bot commented Mar 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.03%. Comparing base (2480d88) to head (51d67ec).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1248   +/-   ##
=======================================
  Coverage   98.03%   98.03%           
=======================================
  Files          76       76           
  Lines        7412     7419    +7     
  Branches     1145     1145           
=======================================
+ Hits         7266     7273    +7     
  Misses        140      140           
  Partials        6        6           

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zombieJ zombieJ merged commit 61f783c into master Mar 11, 2025
12 checks passed
@zombieJ zombieJ deleted the add-reverse-var branch March 11, 2025 03:22
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.

1 participant