update rate to 2.4.0 for support allowClear (#8627)

This commit is contained in:
愚指导-TZ 2017-12-15 15:30:38 +08:00 committed by 偏右
parent 28e9d1ee88
commit c30ac8d138
7 changed files with 229 additions and 2 deletions

View File

@ -351,6 +351,204 @@ exports[`renders ./components/rate/demo/character.md correctly 1`] = `
</div>
`;
exports[`renders ./components/rate/demo/clear.md correctly 1`] = `
<div>
<ul
class="ant-rate"
tabindex="0"
>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-zero"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-zero"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
</ul>
allowClear: true
<br />
<ul
class="ant-rate"
tabindex="0"
>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-full"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-zero"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
<li
class="ant-rate-star ant-rate-star-zero"
>
<div
class="ant-rate-star-first"
>
<i
class="anticon anticon-star"
/>
</div>
<div
class="ant-rate-star-second"
>
<i
class="anticon anticon-star"
/>
</div>
</li>
</ul>
allowClear: false
</div>
`;
exports[`renders ./components/rate/demo/disabled.md correctly 1`] = `
<ul
class="ant-rate ant-rate-disabled"

View File

@ -1,5 +1,5 @@
---
order: 4
order: 5
title:
zh-CN: 其他字符
en-US: Other Character

View File

@ -0,0 +1,26 @@
---
order: 4
title:
zh-CN: 清除
en-US: Clear star
---
## zh-CN
支持允许或者禁用清除。
## en-US
Support set allow to clear star when click again.
````jsx
import { Rate } from 'antd';
ReactDOM.render(
<div>
<Rate defaultValue={3} /> allowClear: true
<br />
<Rate allowClear={false} defaultValue={3} /> allowClear: false
</div>
, mountNode);
````

View File

@ -16,6 +16,7 @@ Rate component.
| Property | Description | type | Default |
| -------- | ----------- | ---- | ------- |
| allowHalf | whether to allow semi selection | boolean | false |
| allowClear | whether to allow clear when click again | boolean | true |
| autoFocus | get focus when component mounted | boolean | false |
| character | custom character of rate | ReactNode | `<Icon type="star" />` |
| className | custom class name of rate | string | - |

View File

@ -9,6 +9,7 @@ export interface RateProps {
value?: number;
defaultValue?: number;
allowHalf?: boolean;
allowClear?: boolean;
disabled?: boolean;
onChange?: (value: number) => any;
onHoverChange?: (value: number) => any;

View File

@ -17,6 +17,7 @@ title: Rate
| 属性 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| allowHalf | 是否允许半选 | boolean | false |
| allowClear | 是否允许再次点击后清除 | boolean | true |
| autoFocus | 自动获取焦点 | boolean | false |
| character | 自定义字符 | ReactNode | `<Icon type="star" />` |
| className | 自定义样式类名 | string | - |

View File

@ -64,7 +64,7 @@
"rc-notification": "~3.0.0",
"rc-pagination": "~1.12.4",
"rc-progress": "~2.2.2",
"rc-rate": "~2.3.0",
"rc-rate": "~2.4.0",
"rc-select": "~7.5.0",
"rc-slider": "~8.5.0",
"rc-steps": "~3.0.0",