Skip to content

refactor(Rate): v16 适配#3487

Merged
xiaoyatong merged 6 commits into
jdf2e:feat_v4.xfrom
xiyehutao:feat_v16_Rate
Jun 18, 2026
Merged

refactor(Rate): v16 适配#3487
xiaoyatong merged 6 commits into
jdf2e:feat_v4.xfrom
xiyehutao:feat_v16_Rate

Conversation

@xiyehutao

@xiyehutao xiyehutao commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

🤔 这个变动的性质是?

  • [✅] 新特性提交

⚠️ 请自检并全部勾选全部选项⚠️

  • [✅] 文档已补充或无须补充
  • [✅] 代码演示已提供或无须提供
  • [✅] TypeScript 定义已补充或无须补充
  • [✅] fork仓库代码是否为最新避免文件冲突
  • [✅] Files changed 没有 package.json lock 等无关文件

Uploading image.png…

Summary by CodeRabbit

Release Notes

  • New Features

    • 新增 direction(horizontal/vertical)布局模式
    • 新增 label 支持单值/数组,展示自定义评分级别文案
    • 新增过渡动画:在竖向布局或大尺寸下自动增强交互
  • Bug Fixes & Improvements

    • 优化默认样式:评分图标尺寸默认从 12px 调整为 16px
    • 新增/完善主题变量:支持 --nutui-rate-label-color 自定义标签颜色
  • Documentation

    • 更新 Props/样式变量说明,并新增上下布局、带标签、过渡动画示例
  • Tests

    • 扩展并更新渲染与交互断言用例

xiyehutao and others added 3 commits June 17, 2026 16:32
- 新增 layout 属性支持水平/垂直两种布局
- 新增 label 属性支持标签文字,支持 ReactNode | ReactNode[] 实现每颗星独立标签
- 水平布局适配 12DP/16DP/20DP 三种尺寸
- 垂直布局适配 20DP/28DP 尺寸,大尺寸支持 flex 均分布局
- 12DP 星间距调整为 2px
- 星星外层新增 .nut-rate-list 容器
- 补充垂直布局、带标签 demo 及文档
- 新增 layout/label/array-label 相关单测

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- 点击星星选中时播放 scale bounce 动画(1 → 1.25 → 1)
- 仅在图标尺寸≥20px时启用(水平large、垂直normal/large)
- 仅在评分增加时触发,减少时不动画
- 动画持续300ms,自动清除状态

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the action:review This PR needs more reviews (less than 2 approvals) label Jun 17, 2026
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.44%. Comparing base (a938cf8) to head (bd44d3f).
⚠️ Report is 12 commits behind head on feat_v4.x.

Files with missing lines Patch % Lines
src/packages/rate/rate.tsx 92.30% 7 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##           feat_v4.x    #3487      +/-   ##
=============================================
+ Coverage      88.33%   88.44%   +0.10%     
=============================================
  Files            295      296       +1     
  Lines          19747    19812      +65     
  Branches        3117     3134      +17     
=============================================
+ Hits           17443    17522      +79     
+ Misses          2298     2284      -14     
  Partials           6        6              

☔ View full report in Codecov by Harness.
📢 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.

@xiyehutao

Copy link
Copy Markdown
Collaborator Author
rate16

xiyehutao and others added 2 commits June 17, 2026 16:50
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
构建自动生成,新增 nutuiRateLabelColor 变量类型

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e6e1d676-6e4c-4471-879d-d8a78207b17c

📥 Commits

Reviewing files that changed from the base of the PR and between a1ac0c2 and bd44d3f.

📒 Files selected for processing (16)
  • src/packages/rate/__test__/rate.spec.tsx
  • src/packages/rate/demos/h5/demo13.tsx
  • src/packages/rate/demos/h5/demo14.tsx
  • src/packages/rate/demos/h5/demo15.tsx
  • src/packages/rate/demos/taro/demo13.tsx
  • src/packages/rate/demos/taro/demo14.tsx
  • src/packages/rate/demos/taro/demo15.tsx
  • src/packages/rate/doc.en-US.md
  • src/packages/rate/doc.md
  • src/packages/rate/doc.taro.md
  • src/packages/rate/doc.zh-TW.md
  • src/packages/rate/index.taro.ts
  • src/packages/rate/index.ts
  • src/packages/rate/rate.taro.tsx
  • src/packages/rate/rate.tsx
  • src/types/spec/rate/base.ts

Walkthrough

Rate 组件新增 directionlabel 属性支持纵向布局与多样化标签展示,引入点击值上升时的弹跳动画。SCSS 按方向重写布局块,CSS 变量扩展标签颜色定义,组件逻辑增加 animatingIndex 状态与渲染分支,测试、演示、文档同步覆盖新特性。

Changes

Rate 组件方向、标签与动画功能扩展

Layer / File(s) Summary
类型系统与公共 API 定义
src/types/spec/rate/base.ts, src/packages/rate/index.ts, src/packages/rate/index.taro.ts, src/packages/configprovider/types.ts
新增导出类型 RateDirection = 'horizontal' | 'vertical'BaseRate 接口扩展 direction 属性,label 类型更新为 ReactNode | ReactNode[];index.ts 与 index.taro.ts 将类型重导出改为多行形式并追加 RateDirectionNutCSSVariables 新增 'nutuiRateLabelColor' 字面量。
CSS 变量与主题调整
src/styles/variables.scss, src/styles/variables-daojia.scss, src/styles/variables-jmapp.scss, src/styles/variables-jrkf.scss
$rate-icon-size 默认值从 12px 改为 16px;$rate-font-size-large / $rate-font-size-small 改用固定基础字号而非 $rate-font-size 的 calc 推导;四个主题文件统一新增 $rate-label-color,默认值为 $color-text-disabled
SCSS 布局与动画重写
src/packages/rate/rate.scss
.nut-rate 内新增基础子结构选择器(&-list&-label(s) 等),引入 &-horizontal&-vertical 双布局块,按 small/normal/large 分别配置图标与标签字号、行高、padding/margin;新增 &-animate 类与 @keyframes nut-rate-bounce 缩放动画;重做 RTL 适配覆盖双向布局的左右翻转。
Rate 组件逻辑(Web + Taro 同步)
src/packages/rate/rate.tsx, src/packages/rate/rate.taro.tsx
defaultProps 增加 direction: 'horizontal';props 解构引入 directionlabel;新增 shouldAnimate 判定与 animatingIndex 状态,点击或半击点数上升时触发 300ms 动画;新增 renderSingleLabelrenderArrayLabelsrenderScore 辅助函数;JSX 按 direction 分支:horizontal 时 label → list → score,vertical 时 score → label(数组或单值)。
单元测试拓展
src/packages/rate/__test__/rate.spec.tsx
更新 props 测试使用 container 查询而非 getByTestId;新增 direction 类名与列表存在性验证;新增 label 在横纵两向的 DOM 结构、innerHTML 内容及渲染顺序(horizontal label 在前,vertical label 在后)验证;新增数组 label 的项数与首尾文本断言。
演示组件(H5 + Taro 同步)
src/packages/rate/demos/h5/demo{1,9,13,14,15}.tsx, src/packages/rate/demos/taro/demo{1,9,13,14,15}.tsx
新增 demo13(纵向布局与标签分级演示)、demo14(多尺寸与数组标签示例)、demo15(弹跳动画展示);demo1 调整尺寸排列顺序为 small → default → large;demo9 扩展为展示 showScore + label 组合。
演示页面与文档更新
src/packages/rate/demo.tsx, src/packages/rate/demo.taro.tsx, src/packages/rate/doc.md, src/packages/rate/doc.en-US.md, src/packages/rate/doc.taro.md, src/packages/rate/doc.zh-TW.md
demo.tsx / demo.taro.tsx 导入新演示组件并新增三语翻译文案;四份文档在"Code"区新增三个示例入口,在"Props"表补充 direction(方向)、label(标签)、touchable(滑动选择)属性说明,在"CSS Variables"更新 --nutui-rate-icon-size 默认值与新增 --nutui-rate-label-color

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • jdf2e/nutui-react#2754: 同样对 rate.scss 布局与 RTL 规则进行了直接修改,与本次 SCSS 重写在代码层面存在交叉。
  • jdf2e/nutui-react#2797: 在 Rate 组件实现层新增了 size/showScore 及对应样式类逻辑,与本次 direction/label 扩展属于同一代码区域的相关改动。
  • jdf2e/nutui-react#3463: 主 PR 对 .nut-rate-score 的尺寸/排版逻辑做出重写,检索 PR 同样在该选择器调整 small/large/normal 的字号与行高,两者在相同样式参数层面存在直接重叠。

Suggested reviewers

  • irisSong
  • xiaoyatong

Poem

🐇 星星竖排站成列,横排舞动有韵律~
Label 数组来做伴,Bounce 弹跳真欢乐!
RTL 两边都照顾,样式变量齐齐全。
✨ 一颗颗闪闪发光,代码美妙又安详~

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning PR 描述仅包含检查清单,缺少必要的变更背景、问题说明、解决方案和实现细节等核心内容。 补充 PR 描述:添加需求背景(为什么需要这些变更)、具体的 API 实现说明、主要功能特性总结(如垂直布局、标签、动画),以及相关 Issue 链接。
Title check ❓ Inconclusive 标题描述了 Rate 组件的 v16 版本更新,但表述过于简洁且缺乏具体信息,难以充分反映实际变更内容。 建议将标题改为更具体的描述,如'feat(rate): v16 版本特性更新——支持垂直布局、标签和动画',以便更清楚地传达主要变更。
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/packages/rate/__test__/rate.spec.tsx`:
- Around line 102-106: The 'layout vertical test' test case is missing an
assertion to verify that the `.nut-rate-list` element is rendered, which weakens
the test coverage. After the existing expect statement that checks for the
'nut-rate-vertical' class in the vertical layout test, add an additional
assertion to confirm that the `.nut-rate-list` element exists in the container.
This ensures the component's contract to always render the list is properly
verified, similar to what should be done for the horizontal layout tests
mentioned at lines 117/132.
- Around line 39-47: The test assertions in this block are wrapped inside an if
condition checking el and valueEl, which causes the test to silently pass if
these elements are not found rather than failing. Replace the conditional
wrapper with explicit assertions that verify el and valueEl exist before
proceeding. Use expect() statements to assert that el and valueEl are defined
and truthy, then remove the if condition wrapping and place all the subsequent
assertions (el.length, childNodes checks, click events, and innerHTML
validation) outside the conditional block so they execute unconditionally and
cause test failure if the selectors fail.

In `@src/packages/rate/doc.en-US.md`:
- Line 141: Update the type documentation for the label property in the Rate
component documentation table to reflect support for array labels. Find the
table row where the label property is documented and change its type from
ReactNode to ReactNode | ReactNode[] to accurately represent that the label can
now accept either a ReactNode or an array of ReactNodes.

In `@src/packages/rate/doc.md`:
- Line 141: The type definition for the label property on line 141 in the rate
component documentation is incomplete and does not reflect the actual supported
types. Update the type annotation from `ReactNode` to `ReactNode | ReactNode[]`
to accurately document that the label prop can accept either a single ReactNode
or an array of ReactNode elements, matching the actual component capabilities
demonstrated in the array label demo.

In `@src/packages/rate/doc.taro.md`:
- Line 141: In the documentation table for the rate component, the `label`
parameter type is currently documented as `ReactNode`, but the component
actually accepts `ReactNode | ReactNode[]`. Update the type specification in
line 141 from `ReactNode` to `ReactNode | ReactNode[]` to accurately reflect the
component's actual contract and prevent misleading callers.

In `@src/packages/rate/doc.zh-TW.md`:
- Line 141: The type definition for the label property in the documentation
table is incomplete. Update the type annotation for label from ReactNode to
ReactNode | ReactNode[] to accurately reflect the actual API support, ensuring
the documentation table row for label stays consistent with the implementation.
This change should be made in the properties table where label is defined.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 79eebb5a-5d42-4759-b08a-090695aef434

📥 Commits

Reviewing files that changed from the base of the PR and between 5d49996 and a1ac0c2.

⛔ Files ignored due to path filters (1)
  • src/packages/rate/__test__/__snapshots__/rate.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (28)
  • src/packages/configprovider/types.ts
  • src/packages/rate/__test__/rate.spec.tsx
  • src/packages/rate/demo.taro.tsx
  • src/packages/rate/demo.tsx
  • src/packages/rate/demos/h5/demo1.tsx
  • src/packages/rate/demos/h5/demo13.tsx
  • src/packages/rate/demos/h5/demo14.tsx
  • src/packages/rate/demos/h5/demo15.tsx
  • src/packages/rate/demos/h5/demo9.tsx
  • src/packages/rate/demos/taro/demo1.tsx
  • src/packages/rate/demos/taro/demo13.tsx
  • src/packages/rate/demos/taro/demo14.tsx
  • src/packages/rate/demos/taro/demo15.tsx
  • src/packages/rate/demos/taro/demo9.tsx
  • src/packages/rate/doc.en-US.md
  • src/packages/rate/doc.md
  • src/packages/rate/doc.taro.md
  • src/packages/rate/doc.zh-TW.md
  • src/packages/rate/index.taro.ts
  • src/packages/rate/index.ts
  • src/packages/rate/rate.scss
  • src/packages/rate/rate.taro.tsx
  • src/packages/rate/rate.tsx
  • src/styles/variables-daojia.scss
  • src/styles/variables-jmapp.scss
  • src/styles/variables-jrkf.scss
  • src/styles/variables.scss
  • src/types/spec/rate/base.ts

Comment on lines 39 to 47
if (el && valueEl) {
expect(el.length).toBe(state.count) // count
expect(el[2].childNodes[0]).toHaveClass('nut-rate-item-icon') // active
expect(el.length).toBe(state.count)
expect(el[2].childNodes[0]).toHaveClass('nut-rate-item-icon')
expect(el[2].childNodes[0].childNodes[0]).toHaveClass('nut-icon-HeartFill')
expect(el[3].childNodes[0]).toHaveClass('nut-rate-item-icon-disabled') // disabled
expect(el[3].childNodes[0]).toHaveClass('nut-rate-item-icon-disabled')
expect(el[3].childNodes[0].childNodes[0]).toHaveClass('nut-icon-Heart')
fireEvent.click(el[1])
expect(valueEl.innerHTML).toBe('2') // onChange
expect(valueEl.innerHTML).toBe('2')
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

避免在 Line 39 用条件分支包裹核心断言,防止测试静默通过。

这里把所有关键校验都放进 if (el && valueEl),一旦选择器失效会直接跳过断言,测试会误通过。建议先显式断言节点存在,再执行后续行为断言。

建议修改
   const valueEl = container.querySelector('.score')
   const el = container.querySelectorAll('.nut-rate-item')
-  if (el && valueEl) {
-    expect(el.length).toBe(state.count)
-    expect(el[2].childNodes[0]).toHaveClass('nut-rate-item-icon')
-    expect(el[2].childNodes[0].childNodes[0]).toHaveClass('nut-icon-HeartFill')
-    expect(el[3].childNodes[0]).toHaveClass('nut-rate-item-icon-disabled')
-    expect(el[3].childNodes[0].childNodes[0]).toHaveClass('nut-icon-Heart')
-    fireEvent.click(el[1])
-    expect(valueEl.innerHTML).toBe('2')
-  }
+  expect(valueEl).toBeTruthy()
+  expect(el.length).toBe(state.count)
+  expect(el[2].childNodes[0]).toHaveClass('nut-rate-item-icon')
+  expect(el[2].childNodes[0].childNodes[0]).toHaveClass('nut-icon-HeartFill')
+  expect(el[3].childNodes[0]).toHaveClass('nut-rate-item-icon-disabled')
+  expect(el[3].childNodes[0].childNodes[0]).toHaveClass('nut-icon-Heart')
+  fireEvent.click(el[1])
+  expect(valueEl!.innerHTML).toBe('2')
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/packages/rate/__test__/rate.spec.tsx` around lines 39 - 47, The test
assertions in this block are wrapped inside an if condition checking el and
valueEl, which causes the test to silently pass if these elements are not found
rather than failing. Replace the conditional wrapper with explicit assertions
that verify el and valueEl exist before proceeding. Use expect() statements to
assert that el and valueEl are defined and truthy, then remove the if condition
wrapping and place all the subsequent assertions (el.length, childNodes checks,
click events, and innerHTML validation) outside the conditional block so they
execute unconditionally and cause test failure if the selectors fail.

Comment on lines +102 to +106
test('layout vertical test', () => {
const { container } = render(<Rate defaultValue={3} layout="vertical" />)
const root = container.querySelector('.nut-rate')
expect(root).toHaveClass('nut-rate-vertical')
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Line 117/132 的顺序断言同样会被条件分支吞掉,且 Line 102-106 建议补 .nut-rate-list 存在性断言。

当前写法在 root/list/label 缺失时会跳过顺序校验,造成用例弱化;vertical 用例也应与 horizontal 一样确认 list 已渲染(组件契约是始终渲染 list)。

建议修改
 test('layout vertical test', () => {
   const { container } = render(<Rate defaultValue={3} layout="vertical" />)
   const root = container.querySelector('.nut-rate')
   expect(root).toHaveClass('nut-rate-vertical')
+  expect(container.querySelector('.nut-rate-list')).toBeTruthy()
 })
@@
   const root = container.querySelector('.nut-rate')
   const list = container.querySelector('.nut-rate-list')
-  if (root && label && list) {
-    const children = Array.from(root.children)
-    expect(children.indexOf(label)).toBeLessThan(children.indexOf(list))
-  }
+  expect(root).toBeTruthy()
+  expect(list).toBeTruthy()
+  const children = Array.from(root!.children)
+  expect(children.indexOf(label!)).toBeLessThan(children.indexOf(list!))
@@
   const root = container.querySelector('.nut-rate')
   const list = container.querySelector('.nut-rate-list')
-  if (root && label && list) {
-    const children = Array.from(root.children)
-    expect(children.indexOf(label)).toBeGreaterThan(children.indexOf(list))
-  }
+  expect(root).toBeTruthy()
+  expect(list).toBeTruthy()
+  const children = Array.from(root!.children)
+  expect(children.indexOf(label!)).toBeGreaterThan(children.indexOf(list!))

Also applies to: 117-120, 132-135

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/packages/rate/__test__/rate.spec.tsx` around lines 102 - 106, The 'layout
vertical test' test case is missing an assertion to verify that the
`.nut-rate-list` element is rendered, which weakens the test coverage. After the
existing expect statement that checks for the 'nut-rate-vertical' class in the
vertical layout test, add an additional assertion to confirm that the
`.nut-rate-list` element exists in the container. This ensures the component's
contract to always render the list is properly verified, similar to what should
be done for the horizontal layout tests mentioned at lines 117/132.

| --- | --- | --- | --- |
| size | Score size | `large` \| `normal` \| `small` | `normal` |
| layout | Layout type | `horizontal` \| `vertical` | `horizontal` |
| label | Label text | `ReactNode` | `-` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

label 的类型文档需要与组件契约保持一致。

Line 141 当前写为 ReactNode,但本次功能已支持数组标签;建议改为 ReactNode \| ReactNode[],避免误导使用方。

建议修改
-| label | Label text | `ReactNode` | `-` |
+| label | Label text | `ReactNode` \| `ReactNode[]` | `-` |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| label | Label text | `ReactNode` | `-` |
| label | Label text | `ReactNode` \| `ReactNode[]` | `-` |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/packages/rate/doc.en-US.md` at line 141, Update the type documentation
for the label property in the Rate component documentation table to reflect
support for array labels. Find the table row where the label property is
documented and change its type from ReactNode to ReactNode | ReactNode[] to
accurately represent that the label can now accept either a ReactNode or an
array of ReactNodes.

Comment thread src/packages/rate/doc.md
| --- | --- | --- | --- |
| size | star 尺寸 | `large` \| `normal` \| `small` | `normal` |
| layout | 布局方式 | `horizontal` \| `vertical` | `horizontal` |
| label | 标签文字 | `ReactNode` | `-` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

label 类型描述建议补全数组支持。

Line 141 建议从 ReactNode 调整为 ReactNode \| ReactNode[],与实际能力(如数组标签 demo)保持一致。

建议修改
-| label | 标签文字 | `ReactNode` | `-` |
+| label | 标签文字 | `ReactNode` \| `ReactNode[]` | `-` |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| label | 标签文字 | `ReactNode` | `-` |
| label | 标签文字 | `ReactNode` \| `ReactNode[]` | `-` |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/packages/rate/doc.md` at line 141, The type definition for the label
property on line 141 in the rate component documentation is incomplete and does
not reflect the actual supported types. Update the type annotation from
`ReactNode` to `ReactNode | ReactNode[]` to accurately document that the label
prop can accept either a single ReactNode or an array of ReactNode elements,
matching the actual component capabilities demonstrated in the array label demo.

| --- | --- | --- | --- |
| size | star 尺寸 | `large` \| `normal` \| `small` | `normal` |
| layout | 布局方式 | `horizontal` \| `vertical` | `horizontal` |
| label | 标签文字 | `ReactNode` | `-` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

修正文档中 label 类型与组件契约不一致

Line 141 当前写为 ReactNode,但组件实际支持 ReactNode | ReactNode[]。建议同步为联合类型,避免误导调用方。

建议修改
-| label | 标签文字 | `ReactNode` | `-` |
+| label | 标签文字 | `ReactNode` \| `ReactNode[]` | `-` |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| label | 标签文字 | `ReactNode` | `-` |
| label | 标签文字 | `ReactNode` \| `ReactNode[]` | `-` |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/packages/rate/doc.taro.md` at line 141, In the documentation table for
the rate component, the `label` parameter type is currently documented as
`ReactNode`, but the component actually accepts `ReactNode | ReactNode[]`.
Update the type specification in line 141 from `ReactNode` to `ReactNode |
ReactNode[]` to accurately reflect the component's actual contract and prevent
misleading callers.

| --- | --- | --- | --- |
| size | star 尺寸 | `large` \| `normal` \| `small` | `normal` |
| layout | 佈局方式 | `horizontal` \| `vertical` | `horizontal` |
| label | 標籤文字 | `ReactNode` | `-` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

修正文档中 label 類型定義不完整

Line 141 目前標註為 ReactNode,實際 API 支援 ReactNode | ReactNode[]。建議同步更新,避免文件與實作不一致。

建議修改
-| label | 標籤文字 | `ReactNode` | `-` |
+| label | 標籤文字 | `ReactNode` \| `ReactNode[]` | `-` |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| label | 標籤文字 | `ReactNode` | `-` |
| label | 標籤文字 | `ReactNode` \| `ReactNode[]` | `-` |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/packages/rate/doc.zh-TW.md` at line 141, The type definition for the
label property in the documentation table is incomplete. Update the type
annotation for label from ReactNode to ReactNode | ReactNode[] to accurately
reflect the actual API support, ensuring the documentation table row for label
stays consistent with the implementation. This change should be made in the
properties table where label is defined.

Comment thread src/packages/rate/doc.md Outdated
| 属性 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| size | star 尺寸 | `large` \| `normal` \| `small` | `normal` |
| layout | 布局方式 | `horizontal` \| `vertical` | `horizontal` |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

可以改为 direction

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@irisSong irisSong changed the title Feat v16 rate refactor(Rate): v16 Jun 18, 2026
@irisSong irisSong changed the title refactor(Rate): v16 refactor(Rate): v16 适配 Jun 18, 2026
@xiaoyatong xiaoyatong merged commit 72a4dc3 into jdf2e:feat_v4.x Jun 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action:review This PR needs more reviews (less than 2 approvals) size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants