Skip to content

Comments

feat(input): 适配鸿蒙、小程序、H5、RN; 鸿蒙下无法隐藏密码Icon#2338

Merged
xiaoyatong merged 2 commits intojdf2e:dev-harmonyfrom
oasis-cloud:feat/input-standard
Jun 18, 2024
Merged

feat(input): 适配鸿蒙、小程序、H5、RN; 鸿蒙下无法隐藏密码Icon#2338
xiaoyatong merged 2 commits intojdf2e:dev-harmonyfrom
oasis-cloud:feat/input-standard

Conversation

@oasis-cloud
Copy link
Collaborator

@oasis-cloud oasis-cloud commented Jun 11, 2024

🤔 这个变动的性质是?

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

🔗 相关 Issue

💡 需求背景和解决方案

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

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

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

Summary by CodeRabbit

  • 新功能

    • Input 组件添加 placeholderTextColor 属性,允许自定义占位符文本颜色。
  • 样式

    • 优化 Input 组件的样式,包括使用 ScrollViewView 组件替换 <div> 元素,改进布局和样式。
  • 文档

    • 更新 Input 组件版本号至 3.0.0
  • 修复

    • 删除配置文件中的额外换行符。
    • 修改导航栏标题文本。
  • 重构

    • 重新导出 Demo 组件以替代简单的按钮元素。
    • 更新 Input 组件的事件处理和条件渲染逻辑,增强跨平台兼容性。

@xiaoyatong
Copy link
Collaborator

修复一下 冲突~

# Conflicts:
#	packages/nutui-taro-demo-rn/scripts/taro/adapted.js
#	packages/nutui-taro-demo-rn/src/app.config.ts
@coderabbitai
Copy link

coderabbitai bot commented Jun 18, 2024

Walkthrough

这些更改主要集中在更新 Taro Demo 项目中的输入组件和样例展示。它们包括增加新属性、改进样式、重构组件结构和导入路径。具体改动包括添加新导出项、修改配置信息、引入新版本号和增强组件的样式和功能。

Changes

文件路径 更改摘要
packages/.../adapted.js 增加 'input' 作为导出项
packages/.../src/app.config.ts 删除末尾多余的换行符
packages/.../index.config.ts, index.tsx 修改 navigationBarTitleText,更改导出组件
src/config.json 将 Input 组件的版本号从 2.0.0 更新到 3.0.0
src/packages/input/demo... 更新 <Input> 组件中 placeholderTextColor 属性,以自定义占位符文本颜色。重构 <div> 为 Taro 组件如 <ScrollView><View> 以改善结构和样式。引入条件渲染逻辑和新导入路径。
src/packages/input/.../input.harmony.css, input.scss 更新输入组件的 CSS 样式,增加对占位符文本的样式定义。
src/packages/input/input.taro.tsx 重构输入组件的导入路径和事件处理方式,添加基于平台兼容性的条件渲染。

Sequence Diagram(s)

忽略生成 Sequence Diagram,因为更改内容过于简单或多样,不适合用流程图表示。

Poem

代码更改如夏风,

新增输入暖心中。

占位颜色尤光明,

样式更新显峻峥。

Taro 项目展新容,

精雕细琢好东风。


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a56beac and d9d6ffb.

Files selected for processing (23)
  • packages/nutui-taro-demo-rn/scripts/taro/adapted.js (1 hunks)
  • packages/nutui-taro-demo-rn/src/app.config.ts (2 hunks)
  • packages/nutui-taro-demo-rn/src/dentry/pages/input/index.config.ts (1 hunks)
  • packages/nutui-taro-demo-rn/src/dentry/pages/input/index.tsx (1 hunks)
  • src/config.json (1 hunks)
  • src/packages/input/demo.taro.tsx (2 hunks)
  • src/packages/input/demos/taro/demo1.tsx (1 hunks)
  • src/packages/input/demos/taro/demo10.tsx (1 hunks)
  • src/packages/input/demos/taro/demo11.tsx (1 hunks)
  • src/packages/input/demos/taro/demo12.tsx (1 hunks)
  • src/packages/input/demos/taro/demo13.tsx (1 hunks)
  • src/packages/input/demos/taro/demo14.tsx (1 hunks)
  • src/packages/input/demos/taro/demo2.tsx (1 hunks)
  • src/packages/input/demos/taro/demo3.tsx (1 hunks)
  • src/packages/input/demos/taro/demo4.tsx (1 hunks)
  • src/packages/input/demos/taro/demo5.tsx (1 hunks)
  • src/packages/input/demos/taro/demo6.tsx (1 hunks)
  • src/packages/input/demos/taro/demo7.tsx (1 hunks)
  • src/packages/input/demos/taro/demo8.tsx (1 hunks)
  • src/packages/input/demos/taro/demo9.tsx (1 hunks)
  • src/packages/input/input.harmony.css (2 hunks)
  • src/packages/input/input.scss (2 hunks)
  • src/packages/input/input.taro.tsx (3 hunks)
Files skipped from review due to trivial changes (7)
  • packages/nutui-taro-demo-rn/src/app.config.ts
  • packages/nutui-taro-demo-rn/src/dentry/pages/input/index.config.ts
  • packages/nutui-taro-demo-rn/src/dentry/pages/input/index.tsx
  • src/packages/input/demos/taro/demo1.tsx
  • src/packages/input/demos/taro/demo14.tsx
  • src/packages/input/demos/taro/demo3.tsx
  • src/packages/input/demos/taro/demo4.tsx
Additional context used
Biome
packages/nutui-taro-demo-rn/scripts/taro/adapted.js

[error] 1-1: A global variable should not be reassigned. (lint/suspicious/noGlobalAssign)

Assigning to a global variable can override essential functionality.

src/packages/input/input.taro.tsx

[error] 175-175: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 177-177: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.


[error] 213-213: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.

Additional comments not posted (19)
src/packages/input/demos/taro/demo2.tsx (1)

7-11: 新增的 placeholderTextColor 属性允许用户自定义占位符文本颜色,以增强界面的视觉体验。此更改符合 PR 的目标,代码实现正确。

src/packages/input/demos/taro/demo5.tsx (1)

7-8: 在只读和禁用的输入框中添加了 placeholderTextColor 属性,这有助于保持用户界面的一致性并增强可访问性。此更改符合 PR 的目标,代码实现正确。

src/packages/input/demos/taro/demo12.tsx (1)

14-14: 为事件触发的输入框添加了 placeholderTextColor 属性,以增强视觉一致性。此更改符合 PR 的目标,代码实现正确。

src/packages/input/demos/taro/demo11.tsx (1)

7-16: 在具有不同文本对齐方式的输入框中添加了 placeholderTextColor 属性,这有助于增强用户界面的视觉一致性和自定义能力。此更改符合 PR 的目标,代码实现正确。

src/packages/input/demos/taro/demo7.tsx (1)

9-36: 代码整体结构清晰,使用了React Hooks和Taro组件。新增的placeholderTextColor属性符合PR目标,即增强组件在不同平台上的兼容性和功能性。

src/packages/input/input.scss (1)

Line range hint 4-47: SCSS文件中的更改主要是结构性的,例如使用flex属性确保组件正确对齐。为React Native引入的占位符样式显示出尝试在不同平台上保持一致的样式。

src/packages/input/demos/taro/demo8.tsx (1)

10-39: 此文件与demo7.tsx类似,但侧重于显示输入文本的长度。引入的placeholderTextColor与其他演示文件一致。使用状态跟踪输入的当前长度并在输入字段旁边显示它,增强了用户交互和反馈。

src/packages/input/demos/taro/demo13.tsx (1)

11-42: 此文件包含一个更复杂的示例,其中包括基于平台的条件渲染。使用harmonyAndRn实用函数根据平台有条件地渲染组件,直接响应PR的目标,即解决特定平台问题,如鸿蒙操作系统上的密码图标可见性问题。更改得当,增强了组件的功能性。

src/packages/input/demos/taro/demo9.tsx (6)

3-3: 代码导入了 @tarojs/components 中的 View 组件,这是一个常规的组件导入,用于在页面中布局和组织内容。


5-6: 新增了 harmonyAndRnpxTransform 两个工具函数的导入。这些函数用于处理平台兼容性和像素转换,对于跨平台应用非常有用。


12-18: 更新了 View 组件的样式,包括背景色、布局方式等,这些改动有助于改善组件的视觉表现和布局。


22-25: 在 Input 组件中添加了 placeholderTextColor 属性,允许自定义占位符文本颜色,这是一个增强用户体验的小改动。


27-31: 为密码可见性切换按钮设置了样式,并使用了 pxTransform 函数进行样式单位转换,确保样式的一致性和正确性。


36-43: 根据 inputType 的值和平台类型(通过 harmonyAndRn 函数判断),动态渲染不同的图标。这是一个很好的跨平台处理实例。

src/packages/input/demo.taro.tsx (1)

99-131: 更新了 ScrollView 组件的类名和样式,以及内部多个 View 组件用于展示不同示例的标题。这些改动有助于提升页面的结构性和视觉效果。

src/packages/input/input.taro.tsx (3)

10-10: 引入了 TaroInput 和相关类型定义,这是为了使用 Taro 框架的输入组件而进行的必要导入。


16-21: 引入了多个工具函数和配置,包括环境判断、格式化数字、配置提供者等,这些都是为了组件功能的完整性和正确性。


267-270: 根据 harmonyAndRn 函数的返回值决定是否渲染清除图标,这是处理不同平台特性的一个实例。

src/config.json (1)

518-518: 在配置文件中更新了 Input 组件的版本号到 3.0.0,并标记为在 Taro 平台上可用。这是版本迭代中常见的修改,用于跟踪组件的版本变更和兼容性。


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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

@oasis-cloud
Copy link
Collaborator Author

修复一下 冲突~

fixed

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

Comment on lines +246 to +247
console.log('eeeeee', e.detail.value)
handleInput((e.currentTarget || e.detail).value)
Copy link

Choose a reason for hiding this comment

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

在输入事件处理函数中添加了日志输出,这对于调试是有帮助的,但在生产环境中应考虑去除或使用更合适的日志级别。

- console.log('eeeeee', e.detail.value)
+ // TODO: Remove debug logs before production or adjust log level

Committable suggestion was skipped due to low confidence.

formatter={formatter}
formatTrigger="onBlur"
placeholder="在失焦时执行格式化"
placeholderTextColor="#757575"
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

重复添加 placeholderTextColor 属性确实存在于多个 demo 文件中。

  • src/packages/input/demos/taro/demo10.tsx 包含了两次相同的 placeholderTextColor 属性。

请检查这些重复添加是否是有意为之,以便在不同场景中进行配置。如果不是,请移除多余的属性。

Analysis chain

重复添加 placeholderTextColor 属性。请确保这是有意为之,用于不同场景的配置。

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the usage of `placeholderTextColor` across different demo files.
fd 'demo*.tsx' src/packages/input/demos/taro --exec rg 'placeholderTextColor'

Length of output: 77



Script:

#!/bin/bash
# Description: Verify the usage of `placeholderTextColor` across different demo files.
fd 'demo*.tsx' src/packages/input/demos/taro -x rg 'placeholderTextColor' {}

Length of output: 78



Script:

#!/bin/bash
# Description: Verify the usage of `placeholderTextColor` across the entire repository.
rg 'placeholderTextColor'

Length of output: 1771

@xiaoyatong xiaoyatong merged commit d390973 into jdf2e:dev-harmony Jun 18, 2024
@coderabbitai coderabbitai bot mentioned this pull request Sep 26, 2024
20 tasks
@coderabbitai coderabbitai bot mentioned this pull request Feb 10, 2025
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants