Merge branch '1.x-stable'

pull/2167/head
afc163 9 years ago
commit 2ffa087aa1

@ -9,6 +9,27 @@ timeline: true
---
## 1.6.0
`2016-06-24`
- 新增置顶组件 [BackTop](/components/back-top)。
- 全新的 [Spin](/components/spin) 样式。
- 给 `Modal.xxx` 系列方法添加了 `{ destory }` 的访问值,方便事后销毁。[#2110](https://github.com/ant-design/ant-design/issues/2110)
- Table 的 `rowKey` 属性支持直接使用字符串。[#2058](https://github.com/ant-design/ant-design/issues/2058)
- Table 增加 `column.filterDropdown` 属性用于自定义渲染筛选菜单的浮层。[#1736](https://github.com/ant-design/ant-design/issues/1736)
- 修复 Tooltip、Popover、Popconfirm 设置 `onVisibleChange` 后失效的问题。[#2134](https://github.com/ant-design/ant-design/issues/2134)
- 修复在 IE8 下 Checkbox 的勾样式变形的问题。[#2148](https://github.com/ant-design/ant-design/issues/2148)
- 优化 Checkbox、Radio 失效状态的文字颜色。[#2114](https://github.com/ant-design/ant-design/issues/2114)
- 优化 Checkbox、Radio 的默认边距过于拥挤的问题。[#2137](https://github.com/ant-design/ant-design/issues/2137)
- 优化 Pagination 在暗色背景下的样式。[#2126](https://github.com/ant-design/ant-design/issues/2126)
- 修复 Table 固定列时内容无法换行和高度对齐的问题,同时修复了一个 Chrome 下的表格内容错位问题。[#2130](https://github.com/ant-design/ant-design/issues/2130)
- 修复一个 Table 的 `rowSelection` 设为 null 时可能导致报错的问题。[#2127](https://github.com/ant-design/ant-design/issues/2127)
- 修复在 IE8 下点击 Table 选择框报错的问题。[#2154](https://github.com/ant-design/ant-design/issues/2154)
- 小幅优化了 Transfer 的渲染性能。[#2112](https://github.com/ant-design/ant-design/issues/2112)
- 将 DatePicker 的清除按钮从面板上移到外部输入框,解决用户容易误解为关闭的问题。[#1708](https://github.com/ant-design/ant-design/issues/1708)
- Upload 的 `onPreview` 现在没有 `file.url` 时也能生效。[#2163](https://github.com/ant-design/ant-design/issues/2163)
## 1.5.1
`2016-06-21`
@ -44,6 +65,8 @@ timeline: true
`2016-06-12`
此版本之后你可能会遇到 [#2030](https://github.com/ant-design/ant-design/issues/2030),请使用 `react@15+``npm@3+`
- `Input[type="textarea"]` 支持自动调整高度。 [#](http://ant.design/components/input#components-input-demo-autosize-textarea)
- `Breadcrumb`
- `nameRender` 新增 `route``params` 参数。 [#1999](https://github.com/ant-design/ant-design/issues/1999)

@ -0,0 +1,17 @@
---
order: 0
title: 基本
---
最简单的用法。
````jsx
import { BackTop } from 'antd';
ReactDOM.render(
<div>
<BackTop />
向下滚动后,见右下角灰色按钮
</div>
, mountNode);
````

@ -0,0 +1,30 @@
---
order: 1
title: 自定义样式
---
可以自定义置顶按钮的样式,限制宽高:`40px * 40px`。
````jsx
import { BackTop } from 'antd';
const style = {
height: 40,
width: 40,
lineHeight: '40px',
borderRadius: 4,
backgroundColor: '#57c5f7',
color: '#fff',
textAlign: 'center',
fontSize: 20,
};
ReactDOM.render(
<div>
<BackTop style={{ bottom: 100 }}>
<div style={style}>UP</div>
</BackTop>
向下滚动后,见右下角蓝色按钮
</div>
, mountNode);
````

@ -0,0 +1,109 @@
import React from 'react';
import Animate from 'rc-animate';
import Icon from '../icon';
import addEventListener from 'rc-util/lib/Dom/addEventListener';
import classNames from 'classnames';
function getScroll(w, top) {
let ret = w[`page${top ? 'Y' : 'X'}Offset`];
const method = `scroll${top ? 'Top' : 'Left'}`;
if (typeof ret !== 'number') {
const d = w.document;
// ie6,7,8 standard mode
ret = d.documentElement[method];
if (typeof ret !== 'number') {
// quirks mode
ret = d.body[method];
}
}
return ret;
}
export default class BackTop extends React.Component {
static propTypes = {
visibilityHeight: React.PropTypes.number,
}
static defaultProps = {
onClick() {},
visibilityHeight: 400,
prefixCls: 'ant-back-top',
}
constructor(props) {
super(props);
const scrollTop = getScroll(window, true);
this.state = {
visible: scrollTop > this.props.visibilityHeight,
};
}
scrollToTop = (e) => {
if (e) e.preventDefault();
this.setScrollTop(0);
this.props.onClick(e);
}
setScrollTop(value) {
document.body.scrollTop = value;
document.documentElement.scrollTop = value;
}
handleScroll = () => {
const scrollTop = getScroll(window, true);
this.setState({
visible: scrollTop > this.props.visibilityHeight,
});
}
animationEnd = () => {
const scrollTop = getScroll(window, true);
this.setState({
visible: scrollTop > this.props.visibilityHeight,
});
}
componentDidMount() {
this.scrollEvent = addEventListener(window, 'scroll', this.handleScroll);
}
componentWillUnmount() {
if (this.scrollEvent) {
this.scrollEvent.remove();
}
}
render() {
const { prefixCls, className, children, ...restProps } = this.props;
const classString = classNames({
[prefixCls]: true,
[className]: !!className,
});
const defaultElement = (
<div className={`${prefixCls}-content`}>
<Icon className={`${prefixCls}-icon`} type="to-top" />
</div>
);
const style = {
display: this.state.visible ? 'block' : 'none',
};
return (
<Animate
showProp="data-show"
transitionName="fade"
onEnd={this.animationEnd}
transitionAppear
>
<div data-show={this.state.visible} style={style}>
<div {...restProps} className={classString} onClick={this.scrollToTop}>
{children || defaultElement}
</div>
</div>
</Animate>
);
}
}

@ -0,0 +1,23 @@
---
category: Components
chinese: 置顶
type: Other
english: BackTop
---
使用置顶组件可以方便地回到页面顶部。
## 何时使用
- 当页面内容区域比较长时;
- 当用户需要频繁返回顶部查看相关内容时。
## API
> 有默认样式,距离底部 `50px`,可覆盖。
> 自定义样式宽高不大于 40px * 40px。
| 参数 | 说明 | 类型 | 默认值 |
|-------------|----------------|--------------------|--------------|
| visibilityHeight | 滚动高度达到此参数值才出现 `BackTop` | Number | 400 |
| onClick | 点击按钮的回调函数 | Function | - |

@ -0,0 +1,2 @@
import '../../style/index.less';
import './index.less';

@ -0,0 +1,33 @@
@import "../../style/themes/default";
@backtop-prefix-cls: ant-back-top;
.@{backtop-prefix-cls} {
z-index: @zindex-back-top;
position: fixed;
right: 100px;
bottom: 50px;
height: 40px;
width: 40px;
cursor: pointer;
&-content {
height: 40px;
width: 40px;
border-radius: 20px;
background-color: rgba(64, 64, 64, 0.4);
color: #fff;
text-align: center;
transition: all .3s @ease-in-out;
&:hover {
background-color: rgba(64, 64, 64, 0.6);
transition: all .3s @ease-in-out;
}
}
&-icon {
font-size: 20px;
margin-top: 10px;
}
}

@ -119,6 +119,7 @@
// z-index list
@zindex-affix : 10;
@zindex-back-top : 10;
@zindex-modal-mask : 1000;
@zindex-modal : 1000;
@zindex-notification : 1010;

@ -100,23 +100,31 @@ export default class UploadList extends React.Component {
file.url
? (
<a
onClick={(e) => this.handlePreview(file, e)}
href={file.url} target="_blank"
href={file.url}
target="_blank"
className={`${prefixCls}-list-item-name`}
onClick={e => this.handlePreview(file, e)}
>
{file.name}
</a>
) : <span className={`${prefixCls}-list-item-name`}>{file.name}</span>
) : (
<span
className={`${prefixCls}-list-item-name`}
onClick={e => this.handlePreview(file, e)}
>
{file.name}
</span>
)
}
{
this.props.listType === 'picture-card' && file.status !== 'uploading'
? (
<span>
<a
onClick={(e) => this.handlePreview(file, e)}
href={file.url}
target="_blank"
style={{ pointerEvents: file.url ? '' : 'none' }}
onClick={e => this.handlePreview(file, e)}
>
<Icon type="eye-o" />
</a>

@ -18,6 +18,9 @@ Stable version
$ npm install antd --save
```
You can Subscribe to this feed for new version notification: https://github.com/ant-design/ant-design/releases.atom
Beta version
[![](https://cnpmjs.org/badge/v/antd.svg?&tag=beta&subject=npm)](https://www.npmjs.org/package/antd)

@ -17,6 +17,8 @@ title: 安装
$ npm install antd --save
```
你可以订阅https://github.com/ant-design/ant-design/releases.atom 来获得稳定版发布的通知。
开发版本:
[![](https://cnpmjs.org/badge/v/antd.svg?&tag=beta&subject=npm)](https://www.npmjs.org/package/antd)

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "1.5.1",
"version": "1.6.0",
"title": "Ant Design",
"description": "一个 UI 设计语言",
"homepage": "http://ant.design/",

@ -14,6 +14,7 @@ export default class MainContent extends React.Component {
componentDidMount() {
if (!location.hash) {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
} else {
location.hash = location.hash;

@ -77,6 +77,7 @@ describe('antd dist files', function() {
expect('TreeSelect' in antd).toBeTruthy();
expect('Upload' in antd).toBeTruthy();
expect('Validation' in antd).toBeTruthy();
expect('BackTop' in antd).toBeTruthy();
});
// https://github.com/ant-design/ant-design/issues/1970

Loading…
Cancel
Save