Skip to content

refactor(ResultPage): v16 适配#3493

Open
irisSong wants to merge 1 commit into
jdf2e:feat_v4.xfrom
irisSong:feat_4.x_resultpage
Open

refactor(ResultPage): v16 适配#3493
irisSong wants to merge 1 commit into
jdf2e:feat_v4.xfrom
irisSong:feat_4.x_resultpage

Conversation

@irisSong

@irisSong irisSong commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

☑️ 请求合并前的自查清单

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

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

Summary by CodeRabbit

  • New Features

    • ResultPage 新增“半弹层内嵌”和“弹窗内嵌”两个示例,展示在弹层场景中的使用方式。
    • ResultPage 文档补充了操作项说明与更多样式变量,便于自定义外观。
  • Bug Fixes

    • 修正部分 ResultPage 文案与按钮文案显示,统一展示内容。
    • 优化按钮加载态图标的无障碍属性表现。
    • 调整 ResultPage 的标题、描述、间距与按钮宽度,页面更协调。

@github-actions github-actions Bot added the action:review This PR needs more reviews (less than 2 approvals) label Jun 25, 2026
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

ResultPage 的类型、主题变量、样式、示例、文档和迁移说明都被更新,并新增 Popup/Dialog 内嵌示例。Button 的 loading 图标改为固定 aria-hidden="true"src/config.json 中 ResultPage 的 v16 标记被启用。

Changes

ResultPage 更新

Layer / File(s) Summary
契约与主题变量
src/packages/resultpage/types.ts, src/config.json, src/packages/configprovider/types.ts, src/styles/variables.scss, src/styles/variables-daojia.scss, src/styles/variables-jmapp.scss, src/styles/variables-jrkf.scss
ResultPage 的公开类型、v16 标记和主题变量默认值更新。
组件样式与默认状态
src/packages/resultpage/resultpage.tsx, src/packages/resultpage/resultpage.scss, src/packages/resultpage/resultpage.taro.tsx
ResultPage 的默认状态色值和布局样式更新,Taro 包装文件只调整了空白行。
既有示例文案更新
src/packages/resultpage/demos/h5/demo1.tsx ... demo5.tsx, src/packages/resultpage/demos/taro/demo1.tsx ... demo5.tsx, src/packages/resultpage/__test__/resultpage.spec.tsx
既有 H5/Taro 示例的 description 和 action 文案更新,demo2 改名为 Demo2,描述断言同步更新。
Popup 和 Dialog 示例
src/packages/resultpage/demos/h5/demo6.tsx, src/packages/resultpage/demos/h5/demo7.tsx, src/packages/resultpage/demos/taro/demo6.tsx, src/packages/resultpage/demos/taro/demo7.tsx, src/packages/resultpage/demo.tsx, src/packages/resultpage/demo.taro.tsx
Demo6/Demo7 组件在 H5/Taro 中新增 Popup/Dialog 内嵌 ResultPage 的交互样例,demo 页面补充了对应翻译文案和区块。
组件文档
src/packages/resultpage/doc.md, src/packages/resultpage/doc.en-US.md, src/packages/resultpage/doc.taro.md, src/packages/resultpage/doc.zh-TW.md
ResultPage 的 package 文档新增 Popup/Dialog 示例、ResultPageAction 表和新的 CSS 变量表。
迁移文档
src/sites/sites-react/doc/docs/react/migrate-from-v3.md, src/sites/sites-react/doc/docs/react/migrate-from-v3.en-US.md, src/sites/sites-react/doc/docs/taro/migrate-from-v3.md, src/sites/sites-react/doc/docs/taro/migrate-from-v3.en-US.md
v3→v4 迁移文档新增 Popover 和 ResultPage 章节,包含类型来源、默认行为和主题变量变化。

Button 调整

Layer / File(s) Summary
Loading 图标 aria 调整
src/packages/button/button.taro.tsx
Button 的 loading 图标渲染改为单行条件输出,并固定使用 aria-hidden="true"

Sequence Diagram(s)

sequenceDiagram
  participant Cell
  participant Demo6
  participant Popup
  participant ResultPage
  participant Button
  participant Demo7
  participant Dialog

  Cell->>Demo6: click
  Demo6->>Popup: visible = true
  Popup->>ResultPage: render success content
  ResultPage->>Button: render actions
  Button-->>Demo6: onClick closes Popup
  Demo6->>Popup: visible = false

  Cell->>Demo7: click
  Demo7->>Dialog: visible = true
  Dialog->>ResultPage: render success content
  ResultPage->>Button: render actions
  Button-->>Demo7: onClick closes Dialog
  Demo7->>Dialog: visible = false
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • xiaoyatong

Poem

我是一只兔子,耳朵轻轻摇,
ResultPage 新装真清俏。
Popup 一开花儿笑,
Dialog 轻轻把门敲,
按钮一按就回家,
胡萝卜嚼得咔嚓嚓 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning 描述基本只保留了模板占位内容,未填写变动性质、相关 Issue、背景方案和自查清单。 请补充变动性质、相关 Issue、需求背景与解决方案,并勾选/说明自查清单项。
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题简洁且准确概括了本次对 ResultPage 的 v16 适配重构。
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

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.

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.44%. Comparing base (a938cf8) to head (1dac6df).
⚠️ Report is 13 commits behind head on feat_v4.x.

Additional details and impacted files
@@              Coverage Diff              @@
##           feat_v4.x    #3493      +/-   ##
=============================================
+ Coverage      88.33%   88.44%   +0.10%     
=============================================
  Files            295      296       +1     
  Lines          19747    19812      +65     
  Branches        3117     3135      +18     
=============================================
+ 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.

@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: 2

🤖 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/resultpage/doc.md`:
- Around line 84-96: `ResultPageAction.size` is documented but not actually
honored because `ResultPage` hardcodes `size="large"` on the `Button`,
overriding any action-level value. Update `resultpage.tsx` in the
`ResultPage`/`ResultPageAction` rendering path so the action’s `size` prop is
passed through instead of being fixed, or remove `size` from the
`ResultPageAction` docs if the API should stay unsupported. Make sure the
`Button` usage and the `ResultPageAction` type/docs stay consistent.

In `@src/sites/sites-react/doc/docs/react/migrate-from-v3.en-US.md`:
- Around line 112-120: The migration doc’s ResultPageProps import guidance is
wrong because `@/types` does not export that public alias; update the text in the
React migrate-from-v3 docs to point readers to the component package entry for
ResultPageProps, or to the platform-specific alias used there. Use the existing
ResultPageProps, WebResultPageProps, TaroResultPageProps, and `@nutui/resultpage`
symbols to clarify the correct import source and avoid suggesting a symbol that
TypeScript cannot resolve.
🪄 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: fd4a0e2c-427a-4267-9b96-02bff30b3e48

📥 Commits

Reviewing files that changed from the base of the PR and between 79f7ea1 and 1dac6df.

⛔ Files ignored due to path filters (1)
  • src/packages/resultpage/__test__/__snapshots__/resultpage.spec.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (36)
  • src/config.json
  • src/packages/button/button.taro.tsx
  • src/packages/configprovider/types.ts
  • src/packages/resultpage/__test__/resultpage.spec.tsx
  • src/packages/resultpage/demo.taro.tsx
  • src/packages/resultpage/demo.tsx
  • src/packages/resultpage/demos/h5/demo1.tsx
  • src/packages/resultpage/demos/h5/demo2.tsx
  • src/packages/resultpage/demos/h5/demo3.tsx
  • src/packages/resultpage/demos/h5/demo4.tsx
  • src/packages/resultpage/demos/h5/demo5.tsx
  • src/packages/resultpage/demos/h5/demo6.tsx
  • src/packages/resultpage/demos/h5/demo7.tsx
  • src/packages/resultpage/demos/taro/demo1.tsx
  • src/packages/resultpage/demos/taro/demo2.tsx
  • src/packages/resultpage/demos/taro/demo3.tsx
  • src/packages/resultpage/demos/taro/demo4.tsx
  • src/packages/resultpage/demos/taro/demo5.tsx
  • src/packages/resultpage/demos/taro/demo6.tsx
  • src/packages/resultpage/demos/taro/demo7.tsx
  • src/packages/resultpage/doc.en-US.md
  • src/packages/resultpage/doc.md
  • src/packages/resultpage/doc.taro.md
  • src/packages/resultpage/doc.zh-TW.md
  • src/packages/resultpage/resultpage.scss
  • src/packages/resultpage/resultpage.taro.tsx
  • src/packages/resultpage/resultpage.tsx
  • src/packages/resultpage/types.ts
  • src/sites/sites-react/doc/docs/react/migrate-from-v3.en-US.md
  • src/sites/sites-react/doc/docs/react/migrate-from-v3.md
  • src/sites/sites-react/doc/docs/taro/migrate-from-v3.en-US.md
  • src/sites/sites-react/doc/docs/taro/migrate-from-v3.md
  • src/styles/variables-daojia.scss
  • src/styles/variables-jmapp.scss
  • src/styles/variables-jrkf.scss
  • src/styles/variables.scss
💤 Files with no reviewable changes (1)
  • src/packages/resultpage/types.ts

Comment on lines +84 to +96
| icon | 自定义图标 | `ReactNode` | `-` |
| actions | 底部操作按钮 | `ResultPageAction[]` | `[]` |

### ResultPageAction

| 属性 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| text | 按钮文案 | `ReactNode` | `-` |
| type | 按钮类型 | `UIType` | `default` |
| size | 按钮尺寸 | `UISize` | `large` |
| fill | 填充模式 | `UIFill` | `outline` |
| disabled | 是否禁用 | `boolean` | `false` |
| onClick | 点击回调 | `() => void` | `-` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

ResultPageAction.size 现在是死字段。

src/packages/resultpage/resultpage.tsxButton 在展开 ...rest 后又写死了 size="large",会覆盖这里新增的 size 文档字段。这样四份 ResultPage 文档都在暗示一个实际上不生效的 API。请要么把 size 从文档里移除,要么先改组件实现把 action 的 size 真正透传出去。

🤖 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/resultpage/doc.md` around lines 84 - 96, `ResultPageAction.size`
is documented but not actually honored because `ResultPage` hardcodes
`size="large"` on the `Button`, overriding any action-level value. Update
`resultpage.tsx` in the `ResultPage`/`ResultPageAction` rendering path so the
action’s `size` prop is passed through instead of being fixed, or remove `size`
from the `ResultPageAction` docs if the API should stay unsupported. Make sure
the `Button` usage and the `ResultPageAction` type/docs stay consistent.

Comment on lines +112 to +120
- **Type entry change**:
- Removed `src/packages/resultpage/types.ts`; import `ResultPageStatus`, `ResultPageAction`, and `ResultPageProps` from `@/types`.
- **Visual spec aligned with JD APP 16.0**:
- Description text is centered by default; H5 error icon color aligns with `$color-primary` (`#ff2159`).
- 4px below icon; 4px between title and description; 12px above actions; 12px between buttons (`margin: 0 6px`).
- Title: `$font-size-md` / line height 24px; description line height 22px.
- **Theme variable updates**:
- Added `--nutui-resultpage-title-line-height`.
- `--nutui-resultpage-icon-margin-bottom` default `12px` → `4px`; `--nutui-resultpage-title-margin-bottom` `12px` → `4px`; `--nutui-resultpage-title-font-size` `$font-size-xl` → `$font-size-md`; `--nutui-resultpage-description-line-height` `20px` → `22px`; `--nutui-resultpage-actions-margin-top` `16px` → `12px`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n --hidden '\b(ResultPageProps|WebResultPageProps|TaroResultPageProps)\b' src/types src/packages/resultpage src/sites/sites-react/doc/docs

Repository: jdf2e/nutui-react

Length of output: 1850


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect index.ts and index.taro.ts to confirm how ResultPageProps is exported
echo "=== src/packages/resultpage/index.ts ==="
cat -n src/packages/resultpage/index.ts

echo ""
echo "=== src/packages/resultpage/index.taro.ts ==="
cat -n src/packages/resultpage/index.taro.ts

Repository: jdf2e/nutui-react

Length of output: 723


🏁 Script executed:

#!/bin/bash
set -euo pipefail
# Check the types entry point to see what is exported from `@/types`
echo "=== src/types/index.ts (if exists) ==="
cat src/types/index.ts 2>/dev/null || echo "File not found, checking exports in src/types"

# Aggregative check
echo "=== Checking if ResultPageProps is exported from src/types root ==="
rg -n "export.*ResultPageProps" src/types --no-heading || echo "No direct export of ResultPageProps found in src/types"

Repository: jdf2e/nutui-react

Length of output: 10161


🏁 Script executed:

cat src/packages/resultpage/package.json

Repository: jdf2e/nutui-react

Length of output: 224


🏁 Script executed:

pwd
find . -name "package.json" -maxdepth 1 -exec cat {} \;

Repository: jdf2e/nutui-react

Length of output: 10448


🏁 Script executed:

cat src/packages/nutui/index.ts | head -50

Repository: jdf2e/nutui-react

Length of output: 215


🏁 Script executed:

cat src/packages/nutui/index.tsx 2>/dev/null | head -50 || cat src/packages/nutui.tsx | head -50

Repository: jdf2e/nutui-react

Length of output: 155


🏁 Script executed:

find src -name "*.ts" -o -name "*.tsx" | xargs grep -l "export.*ResultPage" | head -5

Repository: jdf2e/nutui-react

Length of output: 341


🏁 Script executed:

# Check whether the main entry point (nutui.tsx or similar) exports ResultPageProps
find src/packages -maxdepth 2 \( -name "index.ts" -o -name "index.tsx" -o -name "nutui.ts" -o -name "nutui.tsx" \) -exec echo "=== {} ===" \; -exec head -n 20 {} \; 2>/dev/null | grep -A 10 "ResultPage"

Repository: jdf2e/nutui-react

Length of output: 640


修正 ResultPageProps 的引用来源

验证确认 ResultPageProps 并未直接在 @/types 中作为公共别名导出。它仅在组件入口文件(如 src/packages/resultpage/index.tsindex.taro.ts)中被分别定义为 WebResultPagePropsTaroResultPageProps 的别名。

文档中指示从 @/types 直接导入 ResultPageProps 会导致 TypeScript 报错(找不到符号)。请将迁移说明中的导入语句修正为从组件包入口导入,或明确指定平台化类型名称。

代码片段修改建议

原写法(错误):

- 从 `@/types` 引入 `ResultPageStatus`、`ResultPageAction` 和 `ResultPageProps`

建议修改为(React 环境):

import { ResultPageProps } from '`@nutui/resultpage`'; // 或从 packages/resultpage/index.ts 导入

或在无法解析包路径时显式使用完整类型名:

import { ResultPageStatus, ResultPageAction, WebResultPageProps as ResultPageProps } from '`@/types`';

请参照上述逻辑更新 src/sites/sites-react/doc/docs/react/migrate-from-v3.md 和相关英文文档。

📝 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
- **Type entry change**:
- Removed `src/packages/resultpage/types.ts`; import `ResultPageStatus`, `ResultPageAction`, and `ResultPageProps` from `@/types`.
- **Visual spec aligned with JD APP 16.0**:
- Description text is centered by default; H5 error icon color aligns with `$color-primary` (`#ff2159`).
- 4px below icon; 4px between title and description; 12px above actions; 12px between buttons (`margin: 0 6px`).
- Title: `$font-size-md` / line height 24px; description line height 22px.
- **Theme variable updates**:
- Added `--nutui-resultpage-title-line-height`.
- `--nutui-resultpage-icon-margin-bottom` default `12px``4px`; `--nutui-resultpage-title-margin-bottom` `12px``4px`; `--nutui-resultpage-title-font-size` `$font-size-xl``$font-size-md`; `--nutui-resultpage-description-line-height` `20px``22px`; `--nutui-resultpage-actions-margin-top` `16px``12px`.
- **Type entry change**:
- Removed `src/packages/resultpage/types.ts`; import `ResultPageStatus` and `ResultPageAction` from `@/types`, and use `WebResultPageProps as ResultPageProps` for React.
- **Visual spec aligned with JD APP 16.0**:
- Description text is centered by default; H5 error icon color aligns with `$color-primary` (`#ff2159`).
- 4px below icon; 4px between title and description; 12px above actions; 12px between buttons (`margin: 0 6px`).
- Title: `$font-size-md` / line height 24px; description line height 22px.
- **Theme variable updates**:
- Added `--nutui-resultpage-title-line-height`.
- `--nutui-resultpage-icon-margin-bottom` default `12px``4px`; `--nutui-resultpage-title-margin-bottom` `12px``4px`; `--nutui-resultpage-title-font-size` `$font-size-xl``$font-size-md`; `--nutui-resultpage-description-line-height` `20px``22px`; `--nutui-resultpage-actions-margin-top` `16px``12px`.
🤖 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/sites/sites-react/doc/docs/react/migrate-from-v3.en-US.md` around lines
112 - 120, The migration doc’s ResultPageProps import guidance is wrong because
`@/types` does not export that public alias; update the text in the React
migrate-from-v3 docs to point readers to the component package entry for
ResultPageProps, or to the platform-specific alias used there. Use the existing
ResultPageProps, WebResultPageProps, TaroResultPageProps, and `@nutui/resultpage`
symbols to clarify the correct import source and avoid suggesting a symbol that
TypeScript cannot resolve.

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/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant