Skip to content

Conversation

@xiaoyatong
Copy link
Collaborator

@xiaoyatong xiaoyatong commented Mar 3, 2025

🤔 这个变动的性质是?

1、overlay 下 支持 csstransition
2、popup 和 overlay 层级修改
3、dialog 和 overlay 层级修改,删除了zindex css 变量
4、日历demo变更了下日期
5、以上都是基于 鸿蒙壳子和插件进行了升级

🔗 相关 Issue

💡 需求背景和解决方案

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

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

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

Summary by CodeRabbit

  • 新功能

    • 更新日历组件默认日期和导航按钮标签,提供更符合未来趋势的日期选择(例如显示2025或2026)。
  • 样式

    • 优化弹窗和对话框的层级、间距及动画效果,提升整体视觉一致性。
  • Bug 修复

    • 改进弹窗关闭交互,防止背景滚动等不期望的行为。
  • 文档

    • 更新组件文档,调整部分样式自定义说明。
  • 杂项

    • 清理无效布局配置并更新部分依赖。

@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2025

Walkthrough

此次变更对多个组件的默认日期、日志输出格式以及样式渲染逻辑进行了更新。在日历组件中,默认日期从 2023 调整为 2025(或 2026),并统一在 onChange 事件中添加日志前缀。Dialog、Popup 与 Overlay 组件调整了 zIndex 的控制、动画过渡和条件渲染逻辑,同时更新了相关样式与文档说明。此外,还更新了依赖版本及配置文件,删除了冗余变量与组件配置。

Changes

文件(s) 变更摘要
src/packages/calendarcard/demos/h5/demo*.tsx 更新默认日期值(从 2023 改为 2025)、调整 onChange 日志输出(添加前缀),按钮跳转参数及标签更新(2023→2025)
src/packages/calendarcard/demos/taro/demo*.tsx 修改默认日期、状态初始化及日志打印(添加前缀 "onChange"),调整样式(如 View padding 格式转换),按钮跳转参数更新(2023→2026)
src/packages/dialog/{dialog.taro.tsx, dialog.scss, dialogwrap.tsx, doc*.md} 引入 harmony 控制 zIndex,更新 Content 组件传递样式;移除 dialog z-index 属性、变量及文档中相关说明
src/packages/popup/{popup.taro.tsx, demos/taro/demo4.tsx, demos/taro/demo8.tsx, popup.scss} 使用 harmony 调整 zIndex,重构渲染逻辑;在关闭图标点击与 onClose 事件中新增状态更新(调用 setShowCloseIconStop(false) 和更新 scrollPenetration),更新动画 keyframes
src/packages/overlay/{demos/taro/demo3.tsx, overlay.scss, overlay.taro.tsx} 移除 JSX 中的多余换行及条件判断,修改 CSS keyframes 以实现更直接的动画过渡
packages/nutui-taro-demo/package.json, src/config.json, src/styles/variables*.scss 更新 @jdtaro/plugin-platform-jdharmony-cpp 依赖版本至 0.1.29-beta.0;删除配置文件中的 Divider 组件;移除对 $dialog-z-index 变量的声明

Sequence Diagram(s)

sequenceDiagram
    participant 用户 as 用户
    participant 日历 as CalendarCard 组件
    participant 日志 as Console.log
    用户->>日历: 选择或更改日期
    日历->>日志: onChange 事件触发,打印 "onChange" + 新值
Loading
sequenceDiagram
    participant 用户 as 用户
    participant 弹窗 as Popup 组件
    participant 状态 as 状态管理
    用户->>弹窗: 点击关闭图标
    弹窗->>状态: 调用 setShowCloseIconStop(false) / onClose 处理
    状态-->>弹窗: 更新状态,关闭弹窗
Loading

Possibly related PRs

Poem

我是一只快乐的小兔子,
跳跃在代码的草地上,
数字舞动,2023变为2025,
日志响起“onChange”轻语柔长,
组件协奏,代码里春光明媚,
在这园中欢唱,🐰🍃庆变更!


📜 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 6954abd and 2891714.

📒 Files selected for processing (2)
  • src/packages/dialog/dialogwrap.tsx (1 hunks)
  • src/packages/popup/demos/h5/demo4.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (2)
src/packages/dialog/dialogwrap.tsx (1)

65-65: 增加了 zIndex 样式属性传递,有效解决层级问题

此处更改通过将 zIndex 作为内联样式直接传递给 Content 组件,解决了鸿蒙系统下的层级显示问题。这是一个简单但有效的修复方案,使得对话框组件可以正确地显示在适当的层级上。

src/packages/popup/demos/h5/demo4.tsx (1)

43-46:

❓ Verification inconclusive

修复了关闭图标点击行为,使其能够正确关闭弹窗

这个更改使关闭图标能够正确关闭弹窗,这是一个很好的改进。之前用户点击关闭图标时,只会触发日志输出,而不会实际关闭弹窗。

然而,这个改动与 Cell 标题 "阻塞点击 close icon 关闭" 存在逻辑不一致。现在点击关闭图标会导致弹窗关闭,而不是阻塞关闭操作。

建议考虑以下两种方案之一:

  1. 修改 Cell 的标题以反映实际行为
  2. 保留当前标题,但移除 setShowCloseIconStop(false) 行,这样点击关闭图标确实会被阻塞(仅触发日志但不关闭弹窗)

🌐 Web query:

NutUI React Popup 组件文档中关于 closeIcon 和 onCloseIconClick 属性的说明

💡 Result:

NutUI React 的 Popup 组件通过 closeIcononCloseIconClick 属性实现了关闭图标的自定义控制和事件处理机制:

关闭图标配置

  • closeIcon:支持类型为 ReactNode 的自定义图标配置,默认使用内置的关闭图标
  • 可通过该属性完全自定义图标样式和内容,如设为 null 可隐藏关闭图标

事件交互

  • onCloseIconClick:点击关闭图标时触发的回调函数
  • 该事件默认会触发弹窗关闭逻辑,同时支持自定义扩展操作(如二次确认弹窗)

从实现原理看,该组件通过 overlay-manager 管理弹窗层级[1][2],在关闭时会触发栈结构弹出操作并更新遮罩层[1]。关闭图标采用绝对定位布局,与弹窗内容并列放置以保证层级关系[1][2]。

使用示例:

<Popup 
  visible={visible}
  closeIcon={<Icon name="close" size={20} />}
  onCloseIconClick={() => {
    console.log('自定义关闭逻辑');
    setVisible(false);
  }}
>
  <div>弹窗内容</div>
</Popup>

需要注意在微信小程序环境下,若使用自定义 TabBar 需特别处理层级问题[4]。该组件支持 H5 和微信小程序平台,需注意不同平台的兼容性表现[3][10]。

Citations:


注意:请确认组件关闭行为与 UI 描述的一致性

目前该 demo 中点击关闭图标时,会输出日志并调用 setShowCloseIconStop(false),这符合 NutUI React Popup 组件文档中关于 onCloseIconClick 默认关闭弹窗的逻辑(见文档示例)。然而,Cell 的标题标注为“阻塞点击 close icon 关闭”,与当前实际行为存在不符。建议考虑以下两种调整方案之一:

  • 修改 Cell 的标题,使其准确描述点击关闭图标后会关闭弹窗;
  • 或者保留原有标题,移除(或者调整)setShowCloseIconStop(false) 这一行,使点击关闭图标仅触发日志输出而不关闭弹窗。

请根据业务需求确认最终实现。

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
  • @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 Mar 3, 2025
@codecov
Copy link

codecov bot commented Mar 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.05%. Comparing base (827ab5c) to head (2891714).
Report is 3 commits behind head on feat_v3.x.

Additional details and impacted files
@@            Coverage Diff             @@
##           feat_v3.x    #3038   +/-   ##
==========================================
  Coverage      86.05%   86.05%           
==========================================
  Files            281      281           
  Lines          18255    18255           
  Branches        2749     2749           
==========================================
  Hits           15709    15709           
  Misses          2541     2541           
  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/textarea/demos/h5/demo7.tsx (1)

5-12: 建议增加辅助文本说明禁用状态

考虑到这是一个演示禁用状态的例子,建议添加一段简短的说明文字,以便用户更清楚地了解此演示的目的。

  return (
+   <>
+     <div className="demo-title">禁用状态的文本域</div>
    <TextArea
      disabled
      defaultValue="textarea禁用状态"
      showCount
      maxLength={20}
    />
+   </>
  )
src/packages/popup/popup.taro.tsx (1)

200-220: 针对鸿蒙OS环境优化动画处理

基于harmony()函数的返回值,条件性地使用CSSTransition组件。这是解决鸿蒙OS环境下CSS过渡动画兼容性问题的关键。在鸿蒙环境下直接渲染内容,避免了可能的渲染问题。

建议添加注释说明这种条件渲染的目的,以便其他开发者理解这一特殊处理的原因:

  const renderPop = () => {
    return (
      <>
        {!harmony() ? (
          <CSSTransition
            nodeRef={refObject}
            classNames={transitionName}
            mountOnEnter
            unmountOnExit={destroyOnClose}
            timeout={duration}
            in={innerVisible}
            onEntered={afterShow}
            onExited={afterClose}
          >
            {renderContent()}
          </CSSTransition>
+        /* 在鸿蒙环境下不使用CSSTransition,避免动画渲染问题 */
        ) : (
          innerVisible && renderContent()
        )}
      </>
    )
  }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6697e45 and 2e87120.

📒 Files selected for processing (41)
  • src/packages/calendarcard/demos/h5/demo1.tsx (1 hunks)
  • src/packages/calendarcard/demos/h5/demo11.tsx (1 hunks)
  • src/packages/calendarcard/demos/h5/demo2.tsx (1 hunks)
  • src/packages/calendarcard/demos/h5/demo3.tsx (1 hunks)
  • src/packages/calendarcard/demos/h5/demo4.tsx (1 hunks)
  • src/packages/calendarcard/demos/h5/demo5.tsx (1 hunks)
  • src/packages/calendarcard/demos/h5/demo7.tsx (1 hunks)
  • src/packages/calendarcard/demos/h5/demo8.tsx (1 hunks)
  • src/packages/calendarcard/demos/h5/demo9.tsx (1 hunks)
  • src/packages/calendarcard/demos/taro/demo1.tsx (1 hunks)
  • src/packages/calendarcard/demos/taro/demo10.tsx (1 hunks)
  • src/packages/calendarcard/demos/taro/demo11.tsx (1 hunks)
  • src/packages/calendarcard/demos/taro/demo2.tsx (1 hunks)
  • src/packages/calendarcard/demos/taro/demo3.tsx (1 hunks)
  • src/packages/calendarcard/demos/taro/demo4.tsx (1 hunks)
  • src/packages/calendarcard/demos/taro/demo5.tsx (1 hunks)
  • src/packages/calendarcard/demos/taro/demo7.tsx (1 hunks)
  • src/packages/calendarcard/demos/taro/demo8.tsx (1 hunks)
  • src/packages/calendarcard/demos/taro/demo9.tsx (1 hunks)
  • src/packages/dialog/dialog.taro.tsx (3 hunks)
  • src/packages/popup/popup.taro.tsx (5 hunks)
  • src/packages/textarea/demo.taro.tsx (1 hunks)
  • src/packages/textarea/demos/h5/demo1.tsx (2 hunks)
  • src/packages/textarea/demos/h5/demo2.tsx (1 hunks)
  • src/packages/textarea/demos/h5/demo3.tsx (1 hunks)
  • src/packages/textarea/demos/h5/demo4.tsx (1 hunks)
  • src/packages/textarea/demos/h5/demo5.tsx (2 hunks)
  • src/packages/textarea/demos/h5/demo6.tsx (1 hunks)
  • src/packages/textarea/demos/h5/demo7.tsx (1 hunks)
  • src/packages/textarea/demos/h5/demo8.tsx (2 hunks)
  • src/packages/textarea/demos/h5/demo9.tsx (1 hunks)
  • src/packages/textarea/demos/taro/demo1.tsx (2 hunks)
  • src/packages/textarea/demos/taro/demo2.tsx (1 hunks)
  • src/packages/textarea/demos/taro/demo3.tsx (1 hunks)
  • src/packages/textarea/demos/taro/demo4.tsx (1 hunks)
  • src/packages/textarea/demos/taro/demo5.tsx (2 hunks)
  • src/packages/textarea/demos/taro/demo6.tsx (1 hunks)
  • src/packages/textarea/demos/taro/demo7.tsx (1 hunks)
  • src/packages/textarea/demos/taro/demo8.tsx (2 hunks)
  • src/packages/textarea/demos/taro/demo9.tsx (1 hunks)
  • src/packages/textarea/textarea.taro.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (24)
  • src/packages/calendarcard/demos/taro/demo10.tsx
  • src/packages/calendarcard/demos/taro/demo3.tsx
  • src/packages/calendarcard/demos/h5/demo4.tsx
  • src/packages/textarea/demos/taro/demo5.tsx
  • src/packages/textarea/demos/taro/demo3.tsx
  • src/packages/calendarcard/demos/taro/demo9.tsx
  • src/packages/textarea/demos/taro/demo2.tsx
  • src/packages/calendarcard/demos/taro/demo7.tsx
  • src/packages/textarea/demo.taro.tsx
  • src/packages/calendarcard/demos/h5/demo7.tsx
  • src/packages/calendarcard/demos/taro/demo4.tsx
  • src/packages/calendarcard/demos/taro/demo8.tsx
  • src/packages/textarea/demos/h5/demo5.tsx
  • src/packages/textarea/demos/h5/demo9.tsx
  • src/packages/textarea/demos/taro/demo7.tsx
  • src/packages/textarea/demos/taro/demo1.tsx
  • src/packages/calendarcard/demos/h5/demo3.tsx
  • src/packages/textarea/demos/taro/demo8.tsx
  • src/packages/textarea/demos/h5/demo8.tsx
  • src/packages/textarea/demos/h5/demo4.tsx
  • src/packages/textarea/demos/taro/demo9.tsx
  • src/packages/textarea/demos/h5/demo2.tsx
  • src/packages/textarea/demos/taro/demo4.tsx
  • src/packages/textarea/demos/h5/demo3.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (30)
src/packages/textarea/demos/h5/demo6.tsx (1)

4-7: 组件命名变更与结构简化

将组件名从 Demo6 更改为 Demo,并移除了包裹 TextArea 的片段标签,使结构更加简洁。这种统一的命名约定有助于保持整个演示代码库的一致性。

src/packages/textarea/textarea.taro.tsx (1)

153-159:

❓ Verification inconclusive

将 Text 组件替换为 View 组件

这个修改可能是针对 PR 中提到的"鸿蒙下层级问题"进行的调整。将显示字符计数的 Text 组件替换为 View 组件可能解决了在 HarmonyOS 环境中的层级或渲染问题。保持了相同的类名和内容,确保功能和样式保持一致。


🏁 Script executed:

#!/bin/bash
# 查找代码库中是否有其他类似的模式(Text 替换为 View)
rg "Text" --type=tsx -A 3 -B 3 | grep -A 3 -B 3 "limit"

Length of output: 81


验证提醒:请确认所有 Text 组件已成功替换为 View

目前针对 PR 中提到的“鸿蒙下层级问题”的修正,我们需要确保在整个代码库中(特别是文件 src/packages/textarea/textarea.taro.tsx 的 153-159 行处)没有遗留 <Text 组件的使用。如果该处仅使用了 <View 组件,且功能与样式均保持一致,则此次修改已满足要求。但由于之前的搜索命令因未识别 tsx 文件类型而未产出有效结果,建议使用下面的脚本进行进一步验证:

  • 方案1:直接使用 grep 检查指定文件
    请运行以下脚本,确认文件中不再包含 <Text 的引用:

    #!/bin/bash
    grep "<Text" src/packages/textarea/textarea.taro.tsx || echo "已确认:文件中未找到 <Text"
  • 方案2:使用 rg 搜索整个项目(并添加 tsx 文件类型支持)
    该命令将帮助你确认项目中是否存在残留的 <Text 使用:

    #!/bin/bash
    rg --type-add 'tsx:*.tsx' --type=tsx "<Text" || echo "已确认:项目中未找到 <Text"

请根据脚本输出进行确认,如无 <Text 的残留,则此次修改可视为符合预期。如在其它文件中仍发现 <Text 的引用,可能需要跟进进一步的处理。

src/packages/textarea/demos/h5/demo1.tsx (1)

4-23: 组件命名统一为 Demo

将组件名从 Demo1 更改为 Demo,保持了功能不变。这种统一命名的模式简化了组件的引用和维护,提高了代码库的一致性。

src/packages/textarea/demos/taro/demo6.tsx (1)

4-7: Taro 版本组件命名统一与结构简化

与 H5 版本一致,将 Taro 版本的组件名从 Demo6 更改为 Demo,并简化了组件结构。这种一致性有助于在跨平台代码库中维护统一的命名约定。

src/packages/textarea/demos/h5/demo7.tsx (2)

4-4: 组件重命名符合标准化的要求!

将组件从 Demo7 重命名为 Demo 使其与目录中的其他演示组件保持一致,符合代码标准化的良好实践。

Also applies to: 14-14


6-11: 组件结构优化得当

移除了不必要的 JSX Fragment 包装,对于只有单个组件的情况下直接返回 TextArea 更为简洁。组件属性设置合理,disableddefaultValueshowCountmaxLength 属性都保持了正确的演示效果。

src/packages/calendarcard/demos/h5/demo9.tsx (1)

6-6: 改进了日志输出的清晰度!

通过添加"onChange"前缀,使得控制台输出更加明确,便于调试和追踪事件流程。这是一个良好的日志记录实践。

src/packages/calendarcard/demos/h5/demo11.tsx (1)

17-18: 更新了年份设置,使示例更加与时俱进

将跳转年份从2023年更新到2025年,使得示例更加符合当前时间,提高了用户体验的相关性。这是一个很好的更新,保持了示例的时效性。

src/packages/calendarcard/demos/h5/demo5.tsx (2)

5-5: 更新了初始日期值

将初始日期从2023年更新到2025年,与其他示例保持一致,使得组件展示更加与时俱进。


7-7: 统一了日志输出格式

添加"onChange"前缀到日志输出,这种修改与其他示例保持一致,提高了整体代码的一致性和可维护性。

src/packages/calendarcard/demos/taro/demo5.tsx (2)

5-5: 更新了Taro版本的初始日期值

将Taro版本的初始日期也同步更新到2025年,保持了H5版本和Taro版本之间的一致性,这是非常好的做法。


7-7: 统一了Taro版本的日志输出格式

与H5版本相同,添加了"onChange"前缀到日志输出,确保了不同平台版本之间的一致性,有利于维护和调试。

src/packages/calendarcard/demos/h5/demo1.tsx (2)

4-4: 日期更新为更合适的年份

将默认日期从2023年更新到了2025年,这样的更新可以让示例更加具有时效性,避免使用过去的日期。


8-8: 改进了控制台日志输出

添加了'onChange'前缀使得日志输出更加清晰,便于开发者在控制台中识别日志来源。这是一个良好的实践,有助于调试和日志追踪。

src/packages/calendarcard/demos/taro/demo1.tsx (2)

4-4: 日期更新为更合适的年份

将默认日期从2023年更新到了2025年,这样的更新可以让示例更加具有时效性,避免使用过去的日期。与H5版本的变更保持一致,确保了跨平台的统一体验。


8-8: 改进了控制台日志输出

添加了'onChange'前缀使得日志输出更加清晰,便于开发者在控制台中识别日志来源。这种一致性的改进有助于在Taro环境中进行更高效的调试。

src/packages/calendarcard/demos/h5/demo8.tsx (2)

6-6: 改进了控制台日志输出

添加了'onChange'前缀使得日志输出更加清晰,与其他demo文件保持一致的日志格式,便于开发者在调试过程中快速定位相关信息。


10-10: 更新了日历卡起始日期

将起始日期从2023年更新到2025年,保持了与其他示例文件的一致性,使示例更具有时效性。同时确保了endDate属性(2025-11-11)与startDate在同一年份,避免了潜在的日期范围问题。

src/packages/calendarcard/demos/taro/demo11.tsx (2)

13-13: 添加了空间组件的底部边距

为Space组件添加了底部边距,改善了UI布局,使按钮组与下方的日历卡之间有更好的视觉分隔,提升了用户体验。


17-18: 更新了年份跳转目标和按钮文本

将跳转目标年份从2023年更新为2026年,并相应地更新了按钮文本。这个变更保持了与其他demo的一致性,使用了更具有未来性的日期展示。

src/packages/calendarcard/demos/taro/demo2.tsx (2)

11-11: 已将日期从2023年更新到2025年以保持一致性

将初始值中的第二个日期从2023年更新到了2025年,保持了与其他日历卡组件示例的一致性。


19-19: 添加了适当的底部间距,提高了布局视觉效果

为Space组件添加了底部间距,使标签与日历卡之间的布局更加合理,提升了用户界面的视觉体验。

src/packages/calendarcard/demos/h5/demo2.tsx (2)

11-11: 已将日期从2023年更新到2025年以保持演示数据的时效性

将日期从2023年更新到2025年,保持了演示数据的时效性和与其他日历卡组件示例的一致性。


15-15: 改进了日志输出格式,增加了前缀标识符

为控制台日志添加了"onChange"前缀,使日志输出更加清晰,便于调试和跟踪事件流程。

src/packages/dialog/dialog.taro.tsx (2)

252-263: 优化了渲染逻辑,确保内容始终渲染

改进了渲染逻辑,将renderContent()从条件渲染中抽离出来,确保对话框内容总是被渲染,而不受overlay显示状态的影响。这样的调整使组件结构更加合理,有助于解决鸿蒙OS环境下的层级问题。


232-232:

✅ Verification successful

解决鸿蒙OS环境下的层级问题

通过将Content组件的zIndex设置为比overlay高1个层级,解决了在鸿蒙OS环境下对话框内容可能被覆盖的问题。这是解决PR中提到的"popup鸿蒙下层级问题"的一部分。


🏁 Script executed:

#!/bin/bash
# 检查项目中是否有其他类似的z-index相关修复,确认解决方案的一致性

echo "检查其他组件中类似的zIndex调整:"
rg "zIndex.*\+\s*1" --type tsx -A 1 -B 1

Length of output: 252


注意:请确认鸿蒙OS层级问题解决方案的一致性

当前代码在 src/packages/dialog/dialog.taro.tsx 的第232行通过将 Content 组件的 zIndex 设置为 zIndex + 1 来确保其层级高于 overlay,解决了鸿蒙OS下对话框内容可能被覆盖的问题。从我们新执行的搜索脚本来看,未在其他 TSX 文件中发现类似调整的用法。但由于自动搜索可能遗漏部分情况,请您再手动检验一下代码库中是否存在需要类似处理的地方,以确保整体解决方案的一致性。


---

🏁 Script executed:

```shell

#!/bin/bash
echo "再次检查项目中所有tsx文件中关于 zIndex + 1 的用法:"
rg "zIndex\\s*:\\s*zIndex\\s*\\+\\s*1" -g "*.tsx" -A 2 -B 2

Length of output: 621


请注意鸿蒙OS层级问题修复方案的一致性

经过查询,确认目前只有在 src/packages/dialog/dialog.taro.tsx 第232行使用了 zIndex: zIndex + 1 的调整。这种方式确保 Content 组件的层级高于 overlay,以解决鸿蒙OS环境下对话框内容可能被覆盖的问题。请开发者手动复查其他相关组件,确保没有遗漏类似的层级调整需求。

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

88-88: 与对话框组件保持一致的zIndex处理

与dialog.taro.tsx中的修改保持一致,通过将弹出层的zIndex设置为比overlay高1个层级,解决了鸿蒙OS环境下的层级问题。


184-199: 抽取renderContent函数改善代码结构

将弹出层内容渲染逻辑抽取为单独的renderContent函数,提高了代码的模块化和可读性,便于维护和后续扩展。这是良好的代码重构实践。


236-238: 确保弹出层内容正确渲染

将renderPop()从条件渲染中抽离出来,确保弹出层内容总是被渲染,不受overlay显示状态的影响。这与dialog.taro.tsx中的修改保持一致,共同解决了鸿蒙OS环境下的层级问题。


17-17:

❓ Verification inconclusive

引入harmony函数以检测鸿蒙OS环境

添加了harmony函数的导入,用于检测应用是否在鸿蒙OS环境中运行,以便在不同平台上采用相应的渲染策略。


🏁 Script executed:

#!/bin/bash
# 检查harmony函数的实现和用法

echo "查找harmony函数的定义:"
fd "platform-taro" --type file --exec cat {} \; | grep -A 10 "harmony"

echo "检查harmony函数在其他组件中的使用情况:"
rg "harmony\(\)" --type tsx

Length of output: 779


已验证:harmony 函数定义和引入均正确,但建议手动确认 TSX 文件中对该函数的调用情况

  • @/utils/platform-taro 中,harmony 函数的实现逻辑符合预期,用于检测鸿蒙OS环境。
  • 导入语句在 src/packages/popup/popup.taro.tsx 中正确无误。
  • 注意:之前用 rg "harmony\(\)" --type tsx 搜索 TSX 文件时出现文件类型识别错误。建议使用如下命令手动验证 TSX 文件中是否有对该函数的调用(例如:rg 'harmony\(' -g '*.tsx'),以确保所有用法均符合预期。

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

🧹 Nitpick comments (2)
src/packages/popup/demos/taro/demo4.tsx (2)

36-47: 建议完善阻塞关闭的演示案例说明

当前示例标题为"阻塞点击 close icon 关闭",但实际实现却是允许关闭。为了保持示例的一致性和准确性,有两种解决方案:

  1. 如果目的是演示阻塞关闭功能,应移除 setShowCloseIconStop(false) 并在函数末尾添加 return false
  2. 如果目的是演示正常关闭功能,应更新 Cell 的标题文本

如果是第二种情况,可以这样修改:

<Cell
-  title="阻塞点击 close icon 关闭"
+  title="点击 close icon 关闭"
  onClick={() => {
    setShowCloseIconStop(true)
  }}
/>

19-19: 样式属性格式建议修改

当前 padding 使用字符串形式 '30px 50px' 设置,建议统一使用对象形式以保持一致性并提高可维护性。

-style={{ padding: '30px 50px' }}
+style={{ padding: '30px 50px' }}

备注:根据 AI 摘要,其他文件中已有相关样式格式的统一调整。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2e87120 and 350c999.

📒 Files selected for processing (1)
  • src/packages/popup/demos/taro/demo4.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (1)
src/packages/popup/demos/taro/demo4.tsx (1)

37-42:

❓ Verification inconclusive

验证 closeOnOverlayClick 属性设置的有效性

当前示例中设置了 closeOnOverlayClick={false},确保点击遮罩层不会关闭弹窗。但请注意,这个属性与上面的 closeableonCloseIconClick 处理函数共同决定了弹窗的关闭行为。


🏁 Script executed:

#!/bin/bash
# 查找 Popup 组件是否有 closeOnOverlayClick 属性及其默认值
ast-grep --pattern $'function Popup($params) {
  $$$
}'

# 检查 Popup 组件中关于 overlay 点击处理的代码
rg -A 10 "overlay.*click" --glob "*.tsx" src/packages/popup/

Length of output: 119


请验证 Popup 组件内 closeOnOverlayClick 属性的具体实现

  • 当前 demo 中已设置 closeOnOverlayClick={false},确保点击遮罩不会关闭弹窗。
  • 请仔细确认 Popup 组件中对于此属性的默认值设定以及事件处理逻辑,验证它是否与 closeableonCloseIconClick 配合使用时不会引入冲突。
  • 建议在 Popup 组件中搜索并验证“closeOnOverlayClick”的处理逻辑,确保示例行为和文档说明保持一致。

Comment on lines 43 to 46
onCloseIconClick={() => {
console.log('onCloseIconClick')
setShowCloseIconStop(false)
}}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

修复了点击关闭图标后 Popup 不关闭的问题

之前的实现中,点击关闭图标只记录了日志,但没有实际关闭弹窗。添加 setShowCloseIconStop(false) 确保了点击关闭图标后 Popup 会正确关闭,这与组件预期行为一致,解决了鸿蒙系统下的层级问题。

@xiaoyatong xiaoyatong marked this pull request as draft March 4, 2025 04:22
@xiaoyatong xiaoyatong marked this pull request as ready for review March 4, 2025 09:47
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

🔭 Outside diff range comments (1)
scripts/harmony/clone-jdharmony.js (1)

24-26: 🛠️ Refactor suggestion

考虑添加更详细的错误处理

现有代码在克隆和移除git文件夹过程中缺乏错误处理机制。如果这些操作失败,程序可能会在没有明确错误信息的情况下终止。

-  await git.clone(remote, ['-b', branch, '--depth', '1'])
-  await fse.remove(path.join(__dirname, '../../packages/JDHarmony/.git'))
+  try {
+    await git.clone(remote, ['-b', branch, '--depth', '1'])
+    await fse.remove(path.join(__dirname, '../../packages/JDHarmony/.git'))
+    console.log(`Clone completed successfully.`)
+  } catch (error) {
+    console.error(`克隆失败: ${error.message}`)
+    process.exit(1)
+  }
-  console.log(`Clone completed successfully.`)
🧹 Nitpick comments (4)
packages/nutui-taro-demo/package.json (1)

63-63: 依赖版本更新提醒

更新了依赖项 @jdtaro/plugin-platform-jdharmony-cpp 的版本,从 "0.1.27" 升级到 "0.1.29-beta.0"。请确保此 beta 版在当前环境下经过充分测试,因为 beta 版本可能会引入一些不稳定因素,影响整体兼容性和可靠性。

scripts/harmony/clone-jdharmony.js (1)

13-19: 分支选择逻辑可能需要更灵活的处理方式

当前的分支选择逻辑是硬编码的,这可能会在未来需要频繁更新代码。考虑通过配置文件或环境变量来管理分支名称,这样在需要切换到新版本时就不需要修改源代码。

-  const branch = args && args[0] === 'cpp' ? 'chore_0.1.22' : 'master'
+  // 从配置文件或环境变量中读取分支名称,默认值为当前硬编码的值
+  const cppBranch = process.env.CPP_BRANCH || 'chore_0.1.22'
+  const defaultBranch = process.env.DEFAULT_BRANCH || 'master'
+  const branch = args && args[0] === 'cpp' ? cppBranch : defaultBranch
src/packages/popup/demos/taro/demo8.tsx (1)

21-23: 完善生命周期处理,优化用户体验

新增的 onClose 回调函数确保当弹出层关闭时,scrollPenetration 状态也被正确重置为 false。这样的修改使组件状态管理更加完整,防止在弹窗关闭后状态不一致的问题。

建议在同样的逻辑下,也可以考虑为其他的交互方式(如点击遮罩层关闭)添加类似的状态管理,以确保各种场景下的状态一致性。

src/packages/popup/popup.taro.tsx (1)

88-89: 修复鸿蒙系统下的层级问题

通过条件判断鸿蒙环境并增加 z-index 值的方式解决了层级显示问题。这种方法是针对特定平台的兼容性处理,确保在鸿蒙系统下组件能够正确显示。

考虑将平台特定的调整逻辑抽象到单独的工具函数中,例如 getHarmonyZIndex(baseIndex),以提高代码的可维护性和可读性。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 350c999 and d9c9579.

📒 Files selected for processing (11)
  • packages/nutui-taro-demo/package.json (1 hunks)
  • scripts/harmony/clone-jdharmony.js (1 hunks)
  • src/config.json (0 hunks)
  • src/packages/dialog/dialog.scss (0 hunks)
  • src/packages/dialog/dialog.taro.tsx (5 hunks)
  • src/packages/overlay/demos/taro/demo3.tsx (0 hunks)
  • src/packages/overlay/overlay.scss (0 hunks)
  • src/packages/overlay/overlay.taro.tsx (2 hunks)
  • src/packages/popup/demos/taro/demo8.tsx (1 hunks)
  • src/packages/popup/popup.scss (4 hunks)
  • src/packages/popup/popup.taro.tsx (5 hunks)
💤 Files with no reviewable changes (4)
  • src/packages/overlay/demos/taro/demo3.tsx
  • src/packages/dialog/dialog.scss
  • src/packages/overlay/overlay.scss
  • src/config.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/packages/dialog/dialog.taro.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (11)
scripts/harmony/clone-jdharmony.js (1)

18-18: 分支切换有助于修复鸿蒙系统层级问题

代码修改了克隆JDHarmony仓库时使用的分支,从之前可能使用的功能分支切换到了特定的版本分支chore_0.1.22。这个变更与PR目标中提到的"修复鸿蒙下层级问题"直接相关,选择稳定的版本分支有助于确保组件在鸿蒙环境下的正常显示和交互。

请确认chore_0.1.22分支包含了解决popup层级问题的所有必要代码更改。您可能需要验证此分支在鸿蒙环境下的运行效果,以确保问题确实得到了解决。

src/packages/popup/popup.scss (4)

210-212: 完善动画定义,增强跨平台一致性

popup-slide-top-enter 关键帧动画添加了明确的结束状态 to,指定最终变换为 translate3d(0, 0%, 0)。这种做法符合标准的动画定义方式,有助于确保在不同浏览器和平台上有一致的动画行为。


240-242: 完善从右侧滑出动画的定义

popup-slide-right-enter 关键帧动画添加了明确的结束状态定义,提高了动画的完整性和可预测性。


270-272: 完善从底部滑出动画的定义

popup-slide-bottom-enter 关键帧动画添加了明确的结束状态定义,遵循了动画最佳实践。


300-302: 完善从左侧滑出动画的定义

popup-slide-left-enter 关键帧动画添加了明确的结束状态定义,保持了动画声明的一致性和完整性。

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

17-17: 引入平台判断工具

引入 harmony 函数用于检测当前平台,这是解决鸿蒙系统下层级问题的基础。


185-200: 优化渲染逻辑,提高代码可维护性

将内容渲染逻辑抽离为独立的 renderContent 函数,使代码结构更加清晰,遵循了单一职责原则。这种重构有助于提高代码的可读性和可维护性。


213-213: 简化渲染调用

使用新提取的 renderContent 函数替换原有的内联 JSX,使代码结构更加清晰。


231-234: 优化条件渲染逻辑

简化了条件渲染的表达方式,确保 renderPop 始终被调用,同时保持遮罩层的条件渲染。这种修改使代码更加简洁,同时保持了原有的功能逻辑。

src/packages/overlay/overlay.taro.tsx (2)

49-49: 修复样式优先级顺序

...style 移动到 zIndex 属性之后,确保自定义样式能够正确覆盖默认的 z-index 值。这种修改符合 CSS 对象合并的最佳实践,允许更灵活的样式定制。


72-83: 简化渲染逻辑,移除冗余条件判断

移除了与 harmony() 函数相关的条件逻辑,简化了组件的渲染方法。这种改变使代码更加简洁明了,同时平台特定的处理已经转移到 Popup 组件中。

@oasis-cloud oasis-cloud merged commit c5f27c5 into jdf2e:feat_v3.x Mar 4, 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/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants