Skip to content
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(checkbox group): checkbox group support disable specified item. #1218

Merged
merged 1 commit into from
Mar 17, 2016

Conversation

hotoo
Copy link
Contributor

@hotoo hotoo commented Mar 17, 2016

First of all, thanks for your contribution! :-)

Please makes sure these boxes are checked before submitting your PR, thank you!

[x] Run npm run lint and fix those errors before submitting in order to keep consistent code style.
[x] Rebase before creating a PR to keep commit history clear.
[x] Add some descriptions and refer relative issues for you PR.

支持在 Checkbox Group 的子项中指定 disabled 属性。

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @afc163, @benjycui and @yiminghe to be potential reviewers

const optionsWithDisabled = [
{ label: '苹果', value: 'Apple' },
{ label: '梨', value: 'Pear' },
{ label: '橙子', value: 'Orange', disabled: false },
Copy link
Member

Choose a reason for hiding this comment

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

false ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个例子同时使用了子项和整个 Group 的 disabled 特性。整个 Group disabled, 某个 enabled

{option.label}
</Checkbox>
options.map(option => {
const disabled = Object.hasOwnProperty.call(option, 'disabled') ? option.disabled : this.props.disabled;
Copy link
Member

Choose a reason for hiding this comment

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

此处可以简单的用 'disabled' in option 来判断。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

不能,disabled 是特殊属性,会抛出异常。

Copy link
Member

Choose a reason for hiding this comment

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

不会吧,option 是普通对象。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

奇怪,刚试了下,又没问题了。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

哦,想起来了,昨天是基于 master 改的,option 是字符串的时候会抛出异常。

@hotoo
Copy link
Contributor Author

hotoo commented Mar 17, 2016

好了,再看看。

afc163 added a commit that referenced this pull request Mar 17, 2016
feat(checkbox group): checkbox group support disable specified item.
@afc163 afc163 merged commit 90d8996 into ant-design:develop-1.0.0 Mar 17, 2016
@hotoo hotoo deleted the group-checkbox-disabled branch March 17, 2016 06:14
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.

None yet

3 participants