-
-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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
filter the disabled options #4981
Conversation
@tianlizhao, thanks for your PR! By analyzing the history of the files in this pull request, we identified @afc163, @benjycui and @dqaria to be potential reviewers. |
components/transfer/index.tsx
Outdated
// filter the disabled options | ||
const newMoveKeys = moveKeys.filter(key => { | ||
return !dataSource.some(data => !!(key === data.key && data.disabled)); | ||
}); |
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.
const newMoveKeys = moveKeys.filter(key => !dataSource.some(data => key === data.key && data.disabled));
我要设置下我的email么? |
好的,我把我邮箱加上了 |
并没有变化:34cfd9f |
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.
- 邮箱无法识别。
- 按评论简化下代码。
- 如果有时间的话,麻烦写一个用例如何?
typescript 语法有问题。 |
实在搞不明白了,我改了几次,每次都会有一个test文件不通过,我该怎么办呢? |
可以写一个用例,有没有模板呢?写在哪里? |
|
test 不过的原因在这里:79f222b 主干已修复,rebase 一下即可。 |
Why did this happen? Actually, disabled options should not be selectable... |
And it's not selectable https://ant.design/components/transfer/#components-transfer-demo-basic |
@benjycui 正常情况下disabled的选项是不可以选中的。只有当选项被选中后,再通过别的组件调用了render方法,动态disabled的时候会出现这样的问题。 我也想过是否可以在render方法里把disabled的option去掉选中状态,但是看API和源码,没有发现可以在render里设置,好像只可以用selectedKeys也自己维护了。 |
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.
补充用例后就可以合了。
Coverage remained the same at 81.962% when pulling 7d2c8e4c74a6da5234f0708e6b57f01a700b15d7 on tianlizhao:master into 90699b0 on ant-design:master. |
你这样修改单测,和你这次逻辑的修改没关系吧。 把这个单测修改回滚。 新增一个单测,其实就是把你 #4981 (comment) 说你话转成测试代码就可以了。 Thanks 然后不急的,周末才发版本,慢慢来吧 |
@benjycui 嗯嗯。好的,改的时候也觉得不太对,哈哈,好的,闲了我重写下 |
@tianlizhao just remove |
@tianlizhao any progress? |
今天下班回家弄吧,是周末才发吧?还是今天 ? |
2.8 没这么快发,今天会发 master。不过你这个就差个用例了,估计花不了半小时。 |
好的,我现在试试 |
disabled: true, | ||
}], | ||
selectedKeys: ['a'], | ||
targetKeys: [], |
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.
可以多加一个不是 disabled 的 b 数据,保证 b 会被移动过去。
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.
好的
提交了,不过写的有点不好,本来想共享 |
没关系,分开也清晰点。 |
Great job!!! @tianlizhao |
Excellent 👍 |
First of all, thanks for your contribution! :-)
Please makes sure these boxes are checked before submitting your PR, thank you!
npm run lint
and fix those errors before submitting in order to keep consistent code style.1、修复Transfer穿梭框这个组件,当选择已经被checked的时候,通过事件disable,然后还可以移动到左/右边