feat: retire deprecated api
- ref https://github.com/ant-design/ant-design/issues/52115
Summary by CodeRabbit
发布说明
-
新功能
- 菜单组件现在支持通过
items属性更灵活地定义菜单结构 - 为菜单项添加了可选的
title、role和key属性 - 增加了菜单项的
disabled属性以支持禁用状态
- 菜单组件现在支持通过
-
改进
- 移除了已弃用的
children属性 - 简化了菜单项的定义方式
- 增加了对菜单项的可访问性支持
- 移除了已弃用的
-
重大变更
- 测试用例已更新以适应新的菜单项定义方式
- 移除了一些旧的属性,如
openTransitionName和openAnimation - 更新了文档示例以反映新的菜单结构和使用方式
- 删除了一些不再使用的文档文件和示例代码
[!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.
tests/SubMenu.spec.tsx
Oops! Something went wrong! :(
ESLint: 8.57.1
Error: Cannot read config file: /.eslintrc.js Error: Cannot find module '@umijs/fabric/dist/eslint' Require stack:
- /.eslintrc.js
- /node_modules/.pnpm/@[email protected]/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
- /node_modules/.pnpm/[email protected]/node_modules/eslint/lib/cli-engine/cli-engine.js
- /node_modules/.pnpm/[email protected]/node_modules/eslint/lib/eslint/eslint.js
- /node_modules/.pnpm/[email protected]/node_modules/eslint/lib/eslint/index.js
- /node_modules/.pnpm/[email protected]/node_modules/eslint/lib/cli.js
- /node_modules/.pnpm/[email protected]/node_modules/eslint/bin/eslint.js at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15) at Function.resolve (node:internal/modules/helpers:145:19) at Object.
(/.eslintrc.js:2:21) at Module._compile (node:internal/modules/cjs/loader:1546:14) at Module._extensions..js (node:internal/modules/cjs/loader:1691:10) at Module.load (node:internal/modules/cjs/loader:1317:32) at Module._load (node:internal/modules/cjs/loader:1127:12) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at Module.require (node:internal/modules/cjs/loader:1339:12)
概述
演练
这组更改主要重构了菜单组件的实现方式,从使用嵌套的 JSX 组件转变为使用 items 属性定义菜单结构。移除了 children 属性,新增了 disabled 和 title 等属性。测试文件也相应地更新,使用新的基于对象的菜单项定义方式。这些变更简化了菜单组件的 API,提高了其灵活性和可读性。
变更
| 文件 | 主要变更 |
|---|---|
src/Menu.tsx |
移除 children 属性,新增 disabled 属性;移除过时的过渡和布局管理属性 |
src/MenuItem.tsx |
移除废弃的 attribute 属性 |
src/interface.ts |
为 MenuItemType 和 MenuItemGroupType 新增属性 |
src/utils/nodeUtil.tsx |
更新 parseItems 函数,移除 children 参数 |
| 测试文件 | 全面更新测试用例,使用 items 属性定义菜单结构 |
docs/demo/fragment.md |
删除文档文件 |
docs/examples/*.tsx |
更新所有示例文件以使用 items 属性,移除不再使用的组件 |
诗歌
🐰 菜单重生,代码飞扬
属性精简,结构明朗
items属性,魔法绽放
兔子微笑,重构畅想
代码如诗,优雅飞翔 🍃
Finishing Touches
- [ ] 📝 Generate Docstrings
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?
🪧 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
@coderabbitaiin 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
@coderabbitaiin 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 pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. (Beta) -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile 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.