Skip to content

feat: ✨ Input 组件新增clear-triger属性#476

Merged
Moonofweisheng merged 1 commit intomasterfrom
feat/input-clear-triger
Jul 31, 2024
Merged

feat: ✨ Input 组件新增clear-triger属性#476
Moonofweisheng merged 1 commit intomasterfrom
feat/input-clear-triger

Conversation

@Moonofweisheng
Copy link
Owner

@Moonofweisheng Moonofweisheng commented Jul 31, 2024

Closes: #462

🤔 这个 PR 的性质是?(至少选择一个)

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

🔗 相关 Issue

#462

💡 需求背景和解决方案

增加clear-triger用于控制clear显示的时机

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

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

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充

Summary by CodeRabbit

  • 新功能

    • wd-input组件添加了clear-triggerfocus-when-clear属性,以增强用户交互体验。
    • Index.vue中引入了新的输入字段,优化了清除按钮的显示逻辑和输入框的焦点管理。
  • 文档

    • 更新了wd-input组件的文档,描述了新属性的功能和默认值,帮助开发者更好地理解和使用这些功能。
  • 样式

    • 移除了wd-search组件中关于自定义的注释,简化了代码结构。

@vercel
Copy link

vercel bot commented Jul 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
wot-design-uni ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2024 2:31pm

@netlify
Copy link

netlify bot commented Jul 31, 2024

Deploy Preview for wot-design-uni ready!

Name Link
🔨 Latest commit 6217886
🔍 Latest deploy log https://app.netlify.com/sites/wot-design-uni/deploys/66aa4aa8a25c8d0008278bdc
😎 Deploy Preview https://deploy-preview-476--wot-design-uni.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@coderabbitai
Copy link

coderabbitai bot commented Jul 31, 2024

Walkthrough

这次更改主要集中在增强wd-input组件的功能,特别是关于清除按钮的显示与焦点管理。新增的clear-triggerfocus-when-clear属性使得输入框在用户交互时更灵活,为用户提供了更好的操作体验。同时,wd-search组件的文档进行了简化,去除了过时的示例代码,提升了代码的可读性。

Changes

文件路径 更改摘要
docs/component/input.md 添加clear-triggerfocus-when-clear属性,更新文档。
src/uni_modules/wot-design-uni/components/wd-input/types.ts 新增InputClearTrigger类型及clearTriggerfocusWhenClear属性。
src/uni_modules/wot-design-uni/components/wd-input/wd-input.vue 重构显示逻辑,更新状态管理,改善清除按钮的行为和焦点管理。
src/pages/input/Index.vue 添加新的输入字段,增强用户交互体验,修改现有输入字段以简化用法。
docs/component/search.md 移除与wd-search组件相关的注释代码,简化文档。

Assessment against linked issues

Objective Addressed Explanation
清除按钮聚焦有值才显示 (相关于 #462)

🐰 在输入框旁,清晰而明亮,
清除按钮随焦点微笑而现。
用户体验如兔子跳跃,
轻松一按,输入便可清空。
新增属性,灵活可控,
代码更清晰,文档更流畅! 🐇✨


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>.
    • 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 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 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.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bb3d329 and 6217886.

Files selected for processing (5)
  • docs/component/input.md (2 hunks)
  • docs/component/search.md (1 hunks)
  • src/pages/input/Index.vue (3 hunks)
  • src/uni_modules/wot-design-uni/components/wd-input/types.ts (2 hunks)
  • src/uni_modules/wot-design-uni/components/wd-input/wd-input.vue (5 hunks)
Files skipped from review due to trivial changes (1)
  • docs/component/search.md
Additional context used
Markdownlint
docs/component/input.md

168-168: Column: 67
Hard tabs

(MD010, no-hard-tabs)


168-168: Column: 90
Hard tabs

(MD010, no-hard-tabs)

Additional comments not posted (18)
src/uni_modules/wot-design-uni/components/wd-input/types.ts (3)

4-4: 新类型定义 InputClearTrigger 看起来很好。

这个新类型定义提供了明确的选项,用于控制 clearTrigger 属性的行为。


164-164: 新属性 clearTrigger 定义得很好。

该属性使用了新定义的 InputClearTrigger 类型,并且默认值为 'always',这是一个合理的默认值。


171-171: 新属性 focusWhenClear 定义得很好。

该属性默认值为 true,提供了控制清除按钮点击时焦点行为的有用功能。

src/pages/input/Index.vue (4)

18-20: 新演示块 clear-trigger 实现得很好。

该演示块清晰地展示了 clear-trigger 属性的功能,当输入框有值且聚焦时显示清空按钮。


21-23: 新演示块 focus-when-clear 实现得很好。

该演示块清晰地展示了 focus-when-clear 属性的功能,当点击清除按钮时不自动聚焦。


85-85: 新响应式变量 value20 定义得很好。

该变量被正确声明为引用,并集成到组件的状态管理中。


86-86: 新响应式变量 value21 定义得很好。

该变量被正确声明为引用,并集成到组件的状态管理中。

docs/component/input.md (3)

47-52: 新文档 clear-trigger 解释得很好。

文档清晰地解释了 clear-trigger 属性,并提供了一个有用的示例。


54-60: 新文档 focus-when-clear 解释得很好。

文档清晰地解释了 focus-when-clear 属性,并提供了一个有用的示例。


168-170: 属性表中的新属性添加得很好。

属性表更新正确,并为开发者提供了必要的信息。

Tools
Markdownlint

168-168: Column: 67
Hard tabs

(MD010, no-hard-tabs)


168-168: Column: 90
Hard tabs

(MD010, no-hard-tabs)

src/uni_modules/wot-design-uni/components/wd-input/wd-input.vue (8)

143-150: 代码更改通过!

showClear 计算属性的逻辑正确,符合 PR 目标。


155-158: 代码更改通过!

showWordCount 计算属性的逻辑正确,符合 PR 目标。


220-226: 代码更改通过!

formatValue 函数的逻辑正确,符合 PR 目标。


232-248: 代码更改通过!

clear 函数的修改逻辑正确,符合 PR 目标。


251-259: 代码更改通过!

handleBlur 函数的修改逻辑正确,符合 PR 目标。


267-269: 代码更改通过!

handleFocus 函数的修改逻辑正确,符合 PR 目标。


216-218: 代码更改通过!

initState 函数的简化逻辑正确,符合 PR 目标。


Line range hint 270-272:
代码更改通过!

handleInput 函数的修改逻辑正确,符合 PR 目标。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[新功能需求] 清除按钮聚焦有值才显示

1 participant