Conversation
- 修复 readApi.mjs 中重复/错误的 vitest 导入 - ProTable: 添加版本列,按字母顺序排列,规范默认值格式 - ProLayout: 添加版本列,修复 SettingDrawer 表格错位 - menu/ListToolBar/Setting: 统一 API 表格格式 - 字符串默认值使用反引号,布尔/数字类型规范书写 Co-authored-by: 陈帅 <wasd2144@hotmail.com>
|
Cursor Agent can help with this pull request. Just |
|
Caution Review failedThe pull request is closed. 📝 Walkthrough总体概述本次变更涉及导入语句重组和文档表格更新。在 readApi.mjs 中将连接的导入语句拆分为单独的行,并在 layout.md 和 table.md 中为多个 API 文档表格新增"版本"列,保持现有功能不变。 变更明细
预估代码审查工作量🎯 2 (Simple) | ⏱️ ~12 分钟 诗歌
✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
Summary of ChangesHello @chenshuai2144, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求主要致力于优化项目的 API 文档,使其符合 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR optimizes API documentation to conform to the AGENTS.md specification and fixes import errors in the scripts/readApi.mjs file. The documentation changes add a "版本" (Version) column to API tables and reorganize properties in alphabetical order as required by the project's documentation standards.
Changes:
- Fixed corrupted import statements in
scripts/readApi.mjsthat had test framework imports incorrectly appended to each line - Added "版本" (Version) column to all API documentation tables
- Reorganized API properties in alphabetical order across documentation files
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
| scripts/readApi.mjs | Fixed import statements by removing duplicated vitest test imports that were incorrectly appended to each line |
| site/components/table.md | Added Version column, sorted properties alphabetically, improved type formatting consistency |
| site/components/layout.md | Added Version column, sorted properties alphabetically for ProLayout, menu, and SettingDrawer sections |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| | collapseRender | 收起按钮的 render | `(collapsed: boolean, showCollapseButton?: boolean) => ReactNode \| false` | - | - | | ||
| | collapsed | 是否收起 | `boolean` | - | - | | ||
| | defaultCollapsed | 默认是否收起 | `boolean` | true | - | | ||
| | filterType | 过滤表单类型 | `'query' \| 'light'` | `'query'` | - | |
There was a problem hiding this comment.
Default value formatting is inconsistent with the AGENTS.md specification. According to the spec (line 185), string type default values should be wrapped in backticks. The value 'query' should be formatted as `'query'` to follow the standard convention.
| | cardBordered | Table 和 Search 外围 Card 组件的边框 | `boolean \| {search?: boolean, table?: boolean}` | false | - | | ||
| | cardProps | table 外面卡片的设置 | `ProCardProps \| false` | - | - | | ||
| | columns | 列配置能力,支持一个数组 | `ProColumns<T, ValueType>[]` | - | - | | ||
| | columnEmptyText | 空值时的显示,不设置时显示 `-`,false 可以关闭此功能 | `ProFieldEmptyText` | `'-'` | - | |
There was a problem hiding this comment.
The default value format is inconsistent with the AGENTS.md specification. According to the spec (line 185), string type default values should be wrapped in backticks. The value '-' should be formatted as `'-'` or `-` to follow the standard convention for string defaults.
| | columnEmptyText | 空值时的显示,不设置时显示 `-`,false 可以关闭此功能 | `ProFieldEmptyText` | `'-'` | - | | |
| | columnEmptyText | 空值时的显示,不设置时显示 `-`,false 可以关闭此功能 | `ProFieldEmptyText` | `-` | - | |
| | filterType | 过滤表单类型 | `'query' \| 'light'` | `'query'` | - | | ||
| | labelWidth | 标签的宽度 | `'number' \| 'auto'` | 80 | - | | ||
| | onCollapse | 收起按钮的事件 | `(collapsed: boolean) => void` | - | - | | ||
| | optionRender | 自定义操作栏 | `(searchConfig, formProps, dom) => ReactNode[] \| false` | - | - | |
There was a problem hiding this comment.
Default value formatting is inconsistent. String type default values should be wrapped in backticks according to AGENTS.md line 185. Change '重置' to `'重置'` or `重置` for consistency.
| | optionRender | 自定义操作栏 | `(searchConfig, formProps, dom) => ReactNode[] \| false` | - | - | | |
| | optionRender | 自定义操作栏 | `(searchConfig, formProps, dom) => ReactNode[] \| false` | - | - | |
| | searchText | 查询按钮的文本 | `string` | `'查询'` | - | | ||
| | showHiddenNum | 是否显示收起之后显示隐藏个数 | `boolean` | false | - | | ||
| | span | 配置查询表单的列数 | `number` \| [ColConfig](#ColConfig) | defaultColConfig | - | | ||
| | submitText | 提交按钮的文本 | `string` | `'提交'` | - | |
There was a problem hiding this comment.
Default value formatting is inconsistent. String type default values should be wrapped in backticks according to AGENTS.md line 185. Change '提交' to `'提交'` or `提交` for consistency.
| | columnEmptyText | 空值时的显示,不设置时显示 `-`,false 可以关闭此功能 | `ProFieldEmptyText` | `'-'` | - | | ||
| | columnsState | 受控的列状态,可以操作显示隐藏 | `ColumnStateType` | - | - | | ||
| | dataSource | Table 的数据,ProTable 推荐使用 `request` 来加载 | `T[]` | - | - | | ||
| | dateFormatter | 转化 dayjs 格式数据为特定类型,false 不做转化 | `'string' \| 'number' \| ((value: dayjs.Dayjs, valueType: string) => string \| number) \| false` | `'string'` | - | |
There was a problem hiding this comment.
Default value formatting is inconsistent with the AGENTS.md specification. According to the spec (line 185), string type default values should be wrapped in backticks. The value 'string' should be formatted as `'string'` to follow the standard convention.
| | 参数 | 说明 | 类型 | 默认值 | 版本 | | ||
| | --------- | -------------- | ------------------------------------- | --------- | ---- | | ||
| | activeKey | 当前值 | `string` | - | - | | ||
| | items | 菜单项 | `{ key: string; label: ReactNode }[]` | - | - | | ||
| | onChange | 切换菜单的回调 | `(activeKey: string) => void` | - | - | |
There was a problem hiding this comment.
Default value formatting is inconsistent with the AGENTS.md specification. According to the spec (line 185), string type default values should be wrapped in backticks. The value 'inline' should be formatted as `'inline'` to follow the standard convention.
| | 参数 | 说明 | 类型 | 默认值 | 版本 | | |
| | --------- | -------------- | ------------------------------------- | --------- | ---- | | |
| | activeKey | 当前值 | `string` | - | - | | |
| | items | 菜单项 | `{ key: string; label: ReactNode }[]` | - | - | | |
| | onChange | 切换菜单的回调 | `(activeKey: string) => void` | - | - | | |
| | 参数 | 说明 | 类型 | 默认值 | 版本 | | |
| | --------- | -------------- | ------------------------------------- | ---------- | ---- | | |
| | activeKey | 当前值 | `string` | - | - | | |
| | items | 菜单项 | `{ key: string; label: ReactNode }[]` | - | - | | |
| | onChange | 切换菜单的回调 | `(activeKey: string) => void` | - | - | |
| | locale | menu 是否使用国际化,还需要 formatMessage 的配合 | `boolean` | true | - | | ||
| | onLoadingChange | 菜单的加载状态变更 | `(loading: boolean) => void` | - | - | | ||
| | request | 远程加载菜单的方法,会自动修改 loading 状态 | `(params, defaultMenuData) => Promise<MenuDataItem[]>` | - | - | | ||
| | type | 菜单的类型 | `'sub' \| 'group'` | `'group'` | - | |
There was a problem hiding this comment.
Default value formatting is inconsistent with the AGENTS.md specification. According to the spec (line 185), string type default values should be wrapped in backticks. The value 'group' should be formatted as `'group'` to follow the standard convention.
| | 参数 | 说明 | 类型 | 默认值 | 版本 | | ||
| | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ---- | | ||
| | title | layout 的左上角的 title | `ReactNode` | `'Ant Design Pro'` | - | | ||
| | logo | layout 的左上角 logo 的配置,可以配置url,React 组件 和 false | `ReactNode` \| `JSX.Element` \| `WithFalse<() => ReactNode \| JSX.Element>` | - | - | - | |
There was a problem hiding this comment.
There is a duplicate "版本" (Version) column separator. The table header has 5 columns (参数, 说明, 类型, 默认值, 版本) but the separator line shows 6 columns with an extra "| ---- |" at the end. This will cause the table to render incorrectly.
| | logo | layout 的左上角 logo 的配置,可以配置url,React 组件 和 false | `ReactNode` \| `JSX.Element` \| `WithFalse<() => ReactNode \| JSX.Element>` | - | - | - | | |
| | logo | layout 的左上角 logo 的配置,可以配置url,React 组件 和 false | `ReactNode` \| `JSX.Element` \| `WithFalse<() => ReactNode \| JSX.Element>` | - | - | |
| | 属性 | 描述 | 类型 | 默认值 | 版本 | | ||
| | ---------------- | ------------------------------------------------------------------- | ----------------- | --------- | ---- | | ||
| | (...buttonProps) | antd 的 [ButtonProps](https://ant.design/components/button-cn/#API) | ButtonProps | - | - | | ||
| | position | 行增加在哪里,开始或者末尾 | `'top' \| 'bottom'` | `'bottom'` | - | | ||
| | record | 需要新增的行数据,一般来说包含唯一 key | `T` | `{}` | - | |
There was a problem hiding this comment.
Default value formatting is inconsistent with the AGENTS.md specification. String literals should be wrapped in backticks. Change 'bottom' to `'bottom'` or `bottom` following the convention shown at line 185 of AGENTS.md.
| | 属性 | 描述 | 类型 | 默认值 | 版本 | | |
| | ---------------- | ------------------------------------------------------------------- | ----------------- | --------- | ---- | | |
| | (...buttonProps) | antd 的 [ButtonProps](https://ant.design/components/button-cn/#API) | ButtonProps | - | - | | |
| | position | 行增加在哪里,开始或者末尾 | `'top' \| 'bottom'` | `'bottom'` | - | | |
| | record | 需要新增的行数据,一般来说包含唯一 key | `T` | `{}` | - | | |
| | 属性 | 描述 | 类型 | 默认值 | 版本 | | |
| | ---------------- | ------------------------------------------------------------------- | ------------------- | ----------- | ---- | | |
| | (...buttonProps) | antd 的 [ButtonProps](https://ant.design/components/button-cn/#API) | ButtonProps | - | - | | |
| | position | 行增加在哪里,开始或者末尾 | `'top' \| 'bottom'` | `'bottom'` | - | | |
| | record | 需要新增的行数据,一般来说包含唯一 key | `T` | `{}` | - | |
| | onCollapse | 收起按钮的事件 | `(collapsed: boolean) => void` | - | - | | ||
| | optionRender | 自定义操作栏 | `(searchConfig, formProps, dom) => ReactNode[] \| false` | - | - | | ||
| | resetText | 重置按钮的文本 | `string` | `'重置'` | - | | ||
| | searchText | 查询按钮的文本 | `string` | `'查询'` | - | |
There was a problem hiding this comment.
Default value formatting is inconsistent. String type default values should be wrapped in backticks according to AGENTS.md line 185. Change '查询' to `'查询'` or `查询` for consistency.
| | 参数 | 说明 | 类型 | 默认值 | 版本 | | ||
| | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ---- | | ||
| | title | layout 的左上角的 title | `ReactNode` | `'Ant Design Pro'` | - | | ||
| | logo | layout 的左上角 logo 的配置,可以配置url,React 组件 和 false | `ReactNode` \| `JSX.Element` \| `WithFalse<() => ReactNode \| JSX.Element>` | - | - | - | |
There was a problem hiding this comment.
这一行的表格列数不正确。表头定义了 5 列(参数、说明、类型、默认值、版本),但这一行由于未转义的 | 以及末尾多余的单元格,导致列数过多,这会破坏 Markdown 表格的渲染。建议将类型定义合并到同一个代码块中(并转义其中的 |),同时删除末尾多余的单元格。
| | logo | layout 的左上角 logo 的配置,可以配置url,React 组件 和 false | `ReactNode` \| `JSX.Element` \| `WithFalse<() => ReactNode \| JSX.Element>` | - | - | - | | |
| | logo | layout 的左上角 logo 的配置,可以配置 url,React 组件和 false | `ReactNode \| JSX.Element \| WithFalse<() => ReactNode \| JSX.Element>` | - | - | |
| | 参数 | 说明 | 类型 | 默认值 | 版本 | | ||
| | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ---- | | ||
| | title | layout 的左上角的 title | `ReactNode` | `'Ant Design Pro'` | - | | ||
| | logo | layout 的左上角 logo 的配置,可以配置url,React 组件 和 false | `ReactNode` \| `JSX.Element` \| `WithFalse<() => ReactNode \| JSX.Element>` | - | - | - | | ||
| | pure | 简约模式,设置了之后不渲染的任何 layout 的东西,但是会有 context,可以获取到当前菜单 | `boolean` | - | - | | ||
| | loading | layout 的加载态,设置完成之后只展示一个 loading | `boolean` | - | - | | ||
| | location | 当前应用会话的位置信息。如果你的应用创建了自定义的 history,则需要显示指定 location 属性,详见 [issue](https://github.com/ant-design/pro-components/issues/327) | `RouterTypes['location']` | isBrowser ? window\.location : undefined | - | | ||
| | appList | 跨站点导航列表 | `AppListProps` | - | - | | ||
| | appListRender | 自定义跨站点导航列表的 render 方法 | `(props: AppListProps, defaultDom: React.ReactNode) => ReactNode` | - | - | | ||
| | menuHeaderRender | 渲染 logo 和 title, 优先级比 `headerTitleRender` 更高 | `WithFalse<(logo: ReactNode, title: ReactNode, props?: SiderMenuProps) => ReactNode>` | - | - | | ||
| | menuFooterRender | 在 layout 底部渲染一个块 | `WithFalse<(props?: SiderMenuProps) => ReactNode>` | - | - | | ||
| | onMenuHeaderClick | menu 菜单的头部点击事件 | `(e: React.MouseEvent<HTMLDivElement>) => void` | - | - | | ||
| | menuExtraRender | 在菜单标题的下面渲染一个区域 | `WithFalse<(props: SiderMenuProps) => ReactNode>` | - | - | | ||
| | onTopMixMenuHeaderClick | mix 模式下顶部栏的头部点击事件 | `(e: React.MouseEvent<HTMLDivElement>) => void` | - | - | | ||
| | contentStyle | layout 的内容区 style | `CSSProperties` | - | - | | ||
| | layout | layout 的菜单模式,side:右侧导航,top:顶部导航 | `'side'` \| `'top'` \| `'mix'` | `'side'` | - | | ||
| | contentWidth | layout 的内容模式,Fluid:自适应,Fixed:定宽 1200px | `'Fluid'` \| `'Fixed'` | `'Fluid'` | - | | ||
| | actionRef | layout 的常见操作,比如刷新菜单 | `React.MutableRefObject<{reload: () => void} \| undefined>` | - | - | | ||
| | fixedHeader | 是否固定 header 到顶部 | `boolean` | `false` | - | | ||
| | fixSiderbar | 是否固定导航 | `boolean` | `false` | - | | ||
| | breakpoint | 触发响应式布局的[断点](https://ant.design/components/grid-cn/#Col) | `Enum { 'xs', 'sm', 'md', 'lg', 'xl', 'xxl' }` | `lg` | - | | ||
| | menu | 关于 [menu](#menu) 的配置,暂时只有 locale,locale 可以关闭 menu 的自带的全球化 | [`menuConfig`](#menu) | `{ locale: true }` | - | | ||
| | iconfontUrl | 使用 [IconFont](https://ant.design/components/icon-cn/#components-icon-demo-iconfont) 的图标配置 | `URL` | - | - | | ||
| | locale | 当前 layout 的语言设置 | `LocaleType` (`'zh-CN'` \| `'zh-TW'` \| `'en-US'` \| `'it-IT'` \| `'ko-KR'`) | navigator.language | - | | ||
| | settings | layout 的设置 | [`Settings`](#Settings) | - | - | | ||
| | siderWidth | 侧边菜单宽度 | `number` | mix 模式: 215, 其他: 256 | - | | ||
| | suppressSiderWhenMenuEmpty | 在菜单为空时隐藏 Sider | `boolean` | - | - | | ||
| | defaultCollapsed | 默认的菜单的收起和展开,会受到 `breakpoint` 的影响,`breakpoint=false` 生效 | `boolean` | - | - | | ||
| | collapsed | 控制菜单的收起和展开,layout 是严格受控的,可以设置为 true,一直收起 | `boolean` | - | - | | ||
| | onCollapse | 收起和展开的时候触发事件 | `(collapsed: boolean) => void` | - | - | | ||
| | onPageChange | 页面切换的时候触发 | `(location?: RouterTypes['location']) => void` | - | - | | ||
| | headerRender | 自定义头的 render 方法 | `WithFalse<(props: ProLayoutProps & {hasSiderMenu?: boolean}, defaultDom: ReactNode) => ReactNode>` | - | - | | ||
| | headerTitleRender | 自定义头标题的方法,mix 模式和 top 模式下生效 | `WithFalse<(logo: ReactNode, title: ReactNode, props: HeaderViewProps) => ReactNode>` | - | - | | ||
| | headerContentRender | 自定义头内容的方法 | `WithFalse<(props: HeaderViewProps, defaultDom: ReactNode) => ReactNode>` | - | - | | ||
| | avatarProps | layout 的头像设置,不同的 layout 放在不同的位置 | `WithFalse<AvatarProps & {title?: ReactNode, render?: (avatarProps: AvatarProps, defaultDom: ReactNode, props: SiderMenuProps) => ReactNode}>` | - | - | | ||
| | actionsRender | Layout的操作功能列表,不同的 layout 会放到不同的位置 | `WithFalse<(props: HeaderViewProps) => ReactNode[] \| ReactNode>` | - | - | | ||
| | collapsedButtonRender | 自定义展开收起按钮的渲染 | `WithFalse<(collapsed: boolean) => ReactNode>` | - | - | | ||
| | footerRender | 自定义页脚的 render 方法 | `WithFalse<(props: ProLayoutProps & {hasSiderMenu?: boolean}, defaultDom: ReactNode) => ReactNode>` | - | - | | ||
| | pageTitleRender | 自定义页面标题的显示方法 | `WithFalse<(props: GetPageTitleProps, defaultPageTitle?: string, info?: {title: string, id: string, pageName: string}) => string>` | - | - | | ||
| | menuRender | 虽然叫menuRender,但是其实是整个 SiderMenu 面板的渲染函数 | `WithFalse<(props: HeaderViewProps, defaultDom: ReactNode) => ReactNode>` | - | - | | ||
| | postMenuData | 在显示前对菜单数据进行查看,修改不会触发重新渲染 | `(menuData: MenuDataItem[]) => MenuDataItem[]` | - | - | | ||
| | menuItemRender | 自定义菜单项的 render 方法 | `(itemProps: MenuDataItem, defaultDom: ReactNode, props: BaseMenuProps) => ReactNode` | - | - | | ||
| | subMenuItemRender | 自定义拥有子菜单菜单项的 render 方法 | `(itemProps: MenuDataItem) => ReactNode` | - | - | | ||
| | menuDataRender | 处理 menuData 的数据,可以动态的控制数据 | `(menuData: MenuDataItem[]) => MenuDataItem[]` | - | - | | ||
| | breadcrumbRender | 设置 PageHeader 的面包屑,只能处理数据 | `WithFalse<(routers: BreadcrumbProps['items']) => BreadcrumbProps['items']>` | - | - | | ||
| | breadcrumbProps | PageHeader 的 BreadcrumbProps 配置,会透传下去 | `Omit<BreadcrumbProps, 'itemRender'> & LayoutBreadcrumbProps` | - | - | | ||
| | itemRender | 处理每个面包屑的配置,需要直接返回 dom | `BreadcrumbProps['itemRender']` | - | - | | ||
| | route | 用于生成菜单和面包屑。Umi 的 Layout 会自动带有 | [route](#route) | - | - | | ||
| | disableMobile | 是否禁用移动端模式 | `boolean` | `false` | - | | ||
| | ErrorBoundary | 错误处理组件 | `React.ComponentClass<any, any> \| boolean` | 内置 ErrorBoundary | - | | ||
| | links | 显示在菜单右下角的快捷操作 | `ReactNode[]` | - | - | | ||
| | menuProps | 传递到 antd menu 组件的 props, 参考 [导航菜单](https://ant.design/components/menu-cn/) | `MenuProps` | - | - | | ||
| | waterMarkProps | 水印的相关配置 | `WatermarkProps` | - | - | | ||
| | formatMessage | 国际化方法 | `(message: MessageDescriptor) => string` | - | - | | ||
| | siderMenuType | 侧边菜单的类型, menu.type 的快捷方式 | `'sub'` \| `'group'` | - | - | | ||
| | isChildrenLayout | 是否为子布局 | `boolean` | - | - | | ||
| | bgLayoutImgList | Layout 的品牌配置,表现为一张背景图片 | `{src?: string, width?: string, height?: string, left?: number, top?: number, bottom?: number, right?: number}[]` | - | - | | ||
| | stylish | 样式配置 | `{header?: GenerateStyle<SiderMenuToken>, sider?: GenerateStyle<SiderMenuToken>}` | - | - | | ||
| | className | 外层容器的 className | `string` | - | - | | ||
| | style | 外层容器的 style | `React.CSSProperties` | - | - | | ||
| | token | Layout 的 token 配置 | `ProTokenType['layout']` | - | - | |
优化 API 文档以符合
AGENTS.md规范,并修复scripts/readApi.mjs中的导入错误。Summary by CodeRabbit