jdf2e / nutui-react

京东风格的移动端 React 组件库 、支持多端小程序(A React UI Toolkit for Mobile Web)
https://nutui.jd.com/react/
919 stars 263 forks source link

refactor(uploader): Upoader 3.0 重构 & 多端适配 #2660

Open Alex-huxiyang opened 1 month ago

Alex-huxiyang commented 1 month ago

🤔 这个变动的性质是?

🔗 相关 Issue

💡 需求背景和解决方案

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

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

Summary by CodeRabbit

发布说明

coderabbitai[bot] commented 1 month ago

Walkthrough

此拉取请求对多个文件进行了修改,主要更新了 src/config.json 文件中的组件版本,特别是将 Uploader 组件的版本从 2.0.0 更新至 3.0.0。同时,多个新组件被引入或更新至 3.0.0 版本。测试文件和演示文件中的组件逻辑和结构也进行了相应的调整,以支持新的状态管理和上传功能。文档部分则进行了重构,以提高可读性和组织性。

Changes

文件路径 更改摘要
src/config.json 更新多个组件版本至 3.0.0,包括 UploaderEmptyResultPage 等。某些组件的 show 属性设置为 false
src/packages/uploader/tests/uploader.spec.tsx 修改 UploaderPreview 组件的测试用例,更新类型和事件处理逻辑。
src/packages/uploader/demo.taro.tsx 更新 UploaderDemo 组件的翻译对象和 JSX 结构,调整了翻译内容和演示顺序。
src/packages/uploader/demo.tsx 修改 UploaderDemo 组件,移除多个演示组件的导入,更新翻译字符串,调整 JSX 结构。
src/packages/uploader/demos/h5/demo1.tsx 实现状态管理,移除静态上传 URL,添加新的上传逻辑和样式。
src/packages/uploader/demos/h5/demo10.tsx 新增 Demo10 组件,使用 React Hooks 管理状态,重构上传逻辑。
src/packages/uploader/demos/h5/demo11.tsx 删除 Demo11 组件。
src/packages/uploader/demos/h5/demo12.tsx 删除 Demo12 组件。
src/packages/uploader/demos/h5/demo13.tsx 删除 Demo13 组件。
src/packages/uploader/demos/h5/demo14.tsx 删除 Demo14 组件。
src/packages/uploader/demos/h5/demo2.tsx 修改组件名称,更新内部逻辑,添加新的文件列表和删除处理函数。
src/packages/uploader/demos/h5/demo3.tsx 实现动态状态管理,移除静态上传 URL,添加新的上传功能。
src/packages/uploader/demos/h5/demo4.tsx 转向动态状态管理,添加文件大小限制和上传处理函数。
src/packages/uploader/demos/h5/demo5.tsx 引入文件类型过滤,更新上传逻辑,简化界面。
src/packages/uploader/demos/h5/demo6.tsx 更新组件结构,禁用上传功能。
src/packages/uploader/demos/h5/demo7.tsx 允许多个上传组件,更新文件列表和样式。
src/packages/uploader/demos/h5/demo8.tsx 实现动态和异步上传处理,更新组件结构。
src/packages/uploader/demos/h5/demo9.tsx 引入状态管理,更新上传逻辑,添加按钮以增强用户交互。
src/packages/uploader/demos/taro/demo1.tsx 更新状态管理,重构上传逻辑,简化 JSX 结构。
src/packages/uploader/demos/taro/demo10.tsx 删除 Demo10 组件。
src/packages/uploader/demos/taro/demo11.tsx 删除 Demo11 组件。
src/packages/uploader/demos/taro/demo12.tsx 删除 Demo12 组件。
src/packages/uploader/demos/taro/demo13.tsx 删除 Demo13 组件。
src/packages/uploader/demos/taro/demo14.tsx 删除 Demo14 组件。
src/packages/uploader/demos/taro/demo2.tsx 完全重构组件,更新文件管理逻辑和删除处理。
src/packages/uploader/demos/taro/demo3.tsx 实现动态状态管理,重构上传功能。
src/packages/uploader/demos/taro/demo4.tsx 更新组件结构,添加文件大小限制和上传处理函数。
src/packages/uploader/demos/taro/demo5.tsx 引入文件类型过滤,更新上传逻辑,简化界面。
src/packages/uploader/demos/taro/demo6.tsx 更新组件结构,禁用上传功能。
src/packages/uploader/demos/taro/demo7.tsx 允许多个上传组件,更新文件列表和样式。
src/packages/uploader/demos/taro/demo8.tsx 实现动态和异步上传处理,更新组件结构。
src/packages/uploader/demos/taro/demo9.tsx 引入状态管理,更新上传逻辑,添加按钮以增强用户交互。
src/packages/uploader/doc.en-US.md 更新文档标题和内容,重组结构,添加新属性,更新现有属性描述。
src/packages/uploader/doc.md 更新文档标题和内容,重组结构,添加新属性,更新现有属性描述。
src/packages/uploader/doc.taro.md 更新文档标题和内容,重组结构,添加新属性,更新现有属性描述。
src/packages/uploader/doc.zh-TW.md 更新文档标题和内容,重组结构,添加新属性,更新现有属性描述。
src/packages/uploader/file-item.taro.ts 删除 FileItem 类及相关类型。
src/packages/uploader/file-item.ts 删除 FileItem 类及相关类型。
src/packages/uploader/index.taro.ts 更新类型导出路径。
src/packages/uploader/preview.taro.tsx 更新导入路径和错误处理逻辑,增强代码可读性。
src/packages/uploader/preview.tsx 更新导入路径和状态检查,增强类型安全和代码可读性。
src/packages/uploader/uploader.taro.tsx 更新 UploaderProps 接口,添加新的上传方法,移除旧属性,简化上传逻辑。
src/packages/uploader/uploader.tsx 更新 UploaderProps 接口,添加新的上传方法,移除旧属性,简化上传逻辑。
src/packages/uploader/index.ts 添加新的类型定义,更新导出语句。
package.json 更新依赖项,移除并重新添加 cypress,添加新依赖 simple-git

Suggested reviewers


📜 Recent review details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
📥 Commits Reviewing files that changed from the base of the PR and between 59593622448ad1cbfff97b279abb00feaf53f539 and 18734d62d9629229680d8ea4113a144463f2c26d.
⛔ Files ignored due to path filters (1) * `pnpm-lock.yaml` is excluded by `!**/pnpm-lock.yaml`
📒 Files selected for processing (3) * `package.json` (2 hunks) * `src/config.json` (1 hunks) * `src/packages/uploader/demo.tsx` (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3) * package.json * src/config.json * src/packages/uploader/demo.tsx

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?

❤️ Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
🪧 Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit , 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 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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit. - Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 47.71242% with 80 lines in your changes missing coverage. Please review.

Project coverage is 84.61%. Comparing base (9332996) to head (18734d6).

Files with missing lines Patch % Lines
src/packages/uploader/uploader.tsx 39.23% 79 Missing :warning:
src/packages/uploader/preview.tsx 95.65% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## feat_v3.x #2660 +/- ## ============================================= + Coverage 83.99% 84.61% +0.61% ============================================= Files 220 217 -3 Lines 17885 17714 -171 Branches 2679 2673 -6 ============================================= - Hits 15023 14988 -35 + Misses 2857 2721 -136 Partials 5 5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

oasis-cloud commented 3 weeks ago
image

pnpm dev 的 H5

oasis-cloud commented 2 weeks ago

AI 针对 uloader.tsx 和 uploader.taro.tsx 文件提出的建议中,重点关注抛错给用户的细节处理。可以把这部分补充下。

oasis-cloud commented 2 weeks ago

需要增加 V2 升级 V3 的说明文档。

oasis-cloud commented 2 weeks ago
image

鸿蒙下可点击区域太小。

Alex-huxiyang commented 2 weeks ago

image 鸿蒙下可点击区域太小。

这个是受到了button组件可点击区域的影响了,右侧部分点击失效。应该会一起修复

image 鸿蒙下可点击区域太小。