-
-
Notifications
You must be signed in to change notification settings - Fork 460
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
feat(select): allows select the behavior of triggering blur event in … #962
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/Select.tsx
Outdated
@@ -198,6 +201,9 @@ const Select = React.forwardRef( | |||
labelInValue, | |||
onChange, | |||
|
|||
// Blur | |||
tagsModeCommitOnBlur = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样加 API 感觉就过于零碎了...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样加 API 感觉就过于零碎了...
是不是因为针对tags的模式有点过于零碎? 或许可以提供一个配置,来取消所有模式下的这个失焦行为?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样加 API 感觉就过于零碎了...
是不是因为针对tags的模式有点过于零碎? 或许可以提供一个配置,来取消所有模式下的这个失焦行为?
就是我觉得,例如对于multiple
的模式,支持设置 失焦自动提交 就是说multiple
实际支持这个行为,但是现在的情况是这个模式并不支持,所以会有一定的误导。暂时还没想到有更合适的方式来设置这个api。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tags 模式本身设计就是带着一些交互逻辑的,如果是不需要这个逻辑 HOC multiple 实现一个 Tags 其实也不难。最关键的是,从设计上看其实是希望使用这个交互的,所以我在想这个 API 的必要性。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tags 模式本身设计就是带着一些交互逻辑的,如果是不需要这个逻辑 HOC multiple 实现一个 Tags 其实也不难。最关键的是,从设计上看其实是希望使用这个交互的,所以我在想这个 API 的必要性。
好的,如果确实考虑到没有必要性,那就麻烦您到时候关一下PR了。在最新的提交里面是把针对tags的改成了针对所有模式的,考虑到后续有新增的不同于tags的默认交互逻辑的模式,我个人觉得这样是合理一点的,。
|
select组件,mode="tags"时候,任意输入文字,失去焦点自动生成了tag
新增:
增加配置项
tagsModeCommitOnBlur
preventCommitOnBlur
,默认值为true。功能:
默认情况下,处于
tags
模式下的select框在输入文字后失去焦点的时候会默认的submit
,结果就是生成一个新的tag
并记录tag。参考上述提供的issue,提供tagsModeCommitOnBlur
preventCommitOnBlur
来实现当此配置的value
为false
true
的时候,失去焦点不默认触发在任何模式下失去焦点的时候都会阻止submit
submit
行为,也就是不生成一个新的标签并且不记录,只有当点击候选框中的标签的时候才会生成。