Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(form): replace with Taro Form and add the rest property for passt… #3016

Merged
merged 3 commits into from
Feb 25, 2025

Conversation

oasis-cloud
Copy link
Collaborator

@oasis-cloud oasis-cloud commented Feb 25, 2025

Summary by CodeRabbit

  • Chores

    • 优化了构建和开发流程,移除了冗余环境变量,并调整了部分处理逻辑。
  • Refactor

    • 简化了页面组件的显示条件,使组件展示更直观一致。
  • New Features

    • 升级了表单组件,采用 Taro 原生表单实现,提升了兼容性和灵活性。

Copy link

coderabbitai bot commented Feb 25, 2025

"""

Walkthrough

本次变更涉及多个文件。主要调整包括在 package.json 中移除了对特定脚本的环境变量 SKIPDD=1,简化了渲染条件(移除组件属性 com.dd 检查),并在更新 Taro 入口脚本中删除了关于适配组件的部分处理逻辑。此外,还修改了表单组件,将其属性接口继承自 TFormProps 并使用 Taro 专用组件 <TForm> 来替换标准 HTML <form>,从而更好地整合 Taro 框架的功能。

Changes

文件路径 变更摘要
package.json 移除 predev:taropredev:jdtaroprebuild:taro:site 脚本中前置的 SKIPDD=1 环境变量。
packages/nutui-taro-demo/src/pages/index/index.tsx 调整组件渲染条件,去除对 com.dd 的要求,增加对环境的检查。
scripts/harmony/update-taro-entry.js 删除了导入 path 模块及处理适配组件的 adaptedArraychildAdaptedArray 的代码块,移除对组件适配逻辑的处理。
src/packages/form/form.taro.tsx 更新 FormProps 接口继承由 BasicComponent 改为 TFormProps;将 <form> 标签替换为 Taro 专用 <TForm>,并支持额外属性传递。

Sequence Diagram(s)

sequenceDiagram
    participant U as 用户
    participant F as TForm组件
    participant H as 事件处理器

    U->>F: 提交表单数据
    F->>H: 触发表单提交事件
    H-->>F: 返回处理结果
    F-->>U: 显示提交反馈
Loading

Possibly related PRs

Suggested reviewers

  • xiaoyatong
  • irisSong
  • Alex-huxiyang

Poem

嘿,我是一只快乐的小兔子,
代码世界里跳跃不停。
脚本简化规则更明确,
逻辑优化心情也晴。
一跳一行,快乐前行~ 🐰🎉
"""

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.

packages/nutui-taro-demo/src/pages/index/index.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "taro/react" to extend from. Please check that the name of the config is correct.

The config "taro/react" was referenced from the config file in "/packages/nutui-taro-demo/.eslintrc".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65c0b71 and 345398b.

📒 Files selected for processing (1)
  • packages/nutui-taro-demo/src/pages/index/index.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/nutui-taro-demo/src/pages/index/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test

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
🪧 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 @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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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 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.

@github-actions github-actions bot added action:review This PR needs more reviews (less than 2 approvals) 3.x Target branch 3.x labels Feb 25, 2025
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.79%. Comparing base (fd72f12) to head (345398b).
Report is 1 commits behind head on feat_v3.x.

Additional details and impacted files
@@              Coverage Diff              @@
##           feat_v3.x    #3016      +/-   ##
=============================================
+ Coverage      85.75%   85.79%   +0.04%     
=============================================
  Files            281      281              
  Lines          18527    18527              
  Branches        2809     2810       +1     
=============================================
+ Hits           15887    15896       +9     
+ Misses          2635     2626       -9     
  Partials           5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/packages/form/form.taro.tsx (2)

10-10: 继承自 TFormProps 以对接 Taro 表单属性
此变更使自定义表单组件与 Taro 框架更加契合,但需留意自定义属性与 Taro 自带属性是否存在重名或冲突。


82-83: 将原生 <form> 替换为 <TForm>
利用 Taro 原生组件可更好实现多端兼容,且仍保留对 onSubmit、onReset 等表单事件的支持。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fd72f12 and fed02ac.

📒 Files selected for processing (4)
  • package.json (2 hunks)
  • packages/nutui-taro-demo/src/pages/index/index.tsx (1 hunks)
  • scripts/harmony/update-taro-entry.js (0 hunks)
  • src/packages/form/form.taro.tsx (4 hunks)
💤 Files with no reviewable changes (1)
  • scripts/harmony/update-taro-entry.js
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build
  • GitHub Check: test
🔇 Additional comments (6)
packages/nutui-taro-demo/src/pages/index/index.tsx (1)

84-84: 从条件中移除 com.dd 判断项后,请确认是否影响组件的筛选逻辑
如果 com.dd 曾用于标识特殊组件,而此变更明确表示已不再需要该标识,则此更新可简化逻辑。若未来仍需区分这些组件,需确保具备新的标识或其它处理方式。

package.json (1)

60-60: 移除 SKIPDD=1 环境变量对脚本流程的潜在影响
在多个脚本命令中去除了 SKIPDD=1,可能导致脚本执行时跳过特定步骤的逻辑发生变化。请确认彻底不再需要此变量来规避特定流程,或考虑为相关用途提供新的可控方案。

Also applies to: 63-63, 73-73

src/packages/form/form.taro.tsx (4)

3-3: 改为从 Taro 引入表单相关接口
通过 import { Form as TForm, FormProps as TFormProps } from '@tarojs/components',可充分发挥 Taro 自带组件及其特性的优势。


6-6: 引入 ComponentDefaults
请确认 ComponentDefaults 中的属性与 TFormProps 不会产生冲突,以免覆盖或混淆同名属性。


52-52: 通过 ...rest 透传剩余属性
这样能够保留更高的灵活度,允许外部传入更多 Taro 支持的属性。若有关键属性需特殊处理,需主动拦截管理。


107-107: 闭合 <TForm> 标签
与上方 <TForm> 匹配,在多端编译环境中务必确认可稳定渲染完毕并正确处理事件。

@xiaoyatong xiaoyatong merged commit 9105003 into jdf2e:feat_v3.x Feb 25, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Target branch 3.x action:review This PR needs more reviews (less than 2 approvals) size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants