Merge branch "1.x-stable"

This commit is contained in:
afc163 2016-08-16 17:54:59 +08:00
commit 24d2973c32
15 changed files with 143 additions and 113 deletions

View File

@ -9,6 +9,32 @@ timeline: true
---
## 1.9.1
`2016-08-16`
- 修复 Tabs 的 `type="editable-card"` 模式activeKey 错误的问题。[#2725](https://github.com/ant-design/ant-design/issues/2725)
- 修复一个 Table 的样式兼容性问题。[#2723](https://github.com/ant-design/ant-design/issues/2723)
- 更新 axure 部件库。[#2714](https://github.com/ant-design/ant-design/issues/2714)
## 1.9.0
`2016-08-15`
- Transfer 修复在火狐下 item 文案过长时只显示省略号的问题。[#2674](https://github.com/ant-design/ant-design/issues/2674)
- Input 修复 `autosize` 模式下特定场景中不能输入中文及光标定位不准的问题。[#2666](https://github.com/ant-design/ant-design/issues/2666) [#2239](https://github.com/ant-design/ant-design/issues/2239)
- Tabs 修复 `type="editable-card"` 模式下的 `children` 解析问题。[#2658](https://github.com/ant-design/ant-design/issues/2658)
- Radio 修复若干 less 硬编码问题。[#2424](https://github.com/ant-design/ant-design/issues/2424)
- Upload 的 rc-upload 依赖升级至 2.x引入的变化有
- 增加 `disabled` 属性。[#2645](https://github.com/ant-design/ant-design/issues/2645)
- 取消上传时会自动 abort 上传请求。[#2571](https://github.com/ant-design/ant-design/issues/2571) [#2518](https://github.com/ant-design/ant-design/issues/2518)
- Table
- 修复 spin 在可滚动区域的定位问题。[#2652](https://github.com/ant-design/ant-design/issues/2652)
- 修复无数据时 提示样式错位的问题。[#2663](https://github.com/ant-design/ant-design/issues/2663)
- Popover 修复设定 `getTooltipContainer` 后会导致内嵌 DatePicker 样式失效的问题。[#2675](https://github.com/ant-design/ant-design/issues/2675)
- Modal 修复重复卸载组件导致的报错。[#2688](https://github.com/ant-design/ant-design/issues/2688)
- 升级 rc-slider 组件依赖。
## 1.8.0
`2016-08-08`

View File

@ -9,7 +9,7 @@ title:
通过 `locale` 配置时区、语言等, 默认支持 en_US, zh_CN
## en_US
## en-US
To set the properties like time zone, language and etc. en_US, zh_CN are supported by default.

View File

@ -9,7 +9,7 @@ title:
一个复杂的应用示例。
## en_US
## en-US
A complex application.

View File

@ -72,11 +72,10 @@ export default function confirm(config) {
let d;
function close() {
d.setState({
visible: false,
});
ReactDOM.unmountComponentAtNode(div);
div.parentNode.removeChild(div);
const unmountResult = ReactDOM.unmountComponentAtNode(div);
if (unmountResult) {
div.parentNode.removeChild(div);
}
}
let body = (
@ -129,9 +128,7 @@ export default function confirm(config) {
>
<div style={{ zoom: 1, overflow: 'hidden' }}>{body} {footer}</div>
</Dialog>
, div, function () {
d = this;
});
, div);
return {
destroy: close,

View File

@ -215,7 +215,6 @@
height: 20px;
max-width: 100%;
margin-top: -10px;
cursor: text;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;

View File

@ -9,19 +9,18 @@
.@{spin-prefix-cls} {
color: @primary-color;
display: inline-block;
vertical-align: middle;
text-align: center;
opacity: 0;
position: absolute;
visibility: hidden;
transition: transform 0.3s @ease-in-out-circ;
font-size: @font-size-base;
display: none;
&-spinning {
opacity: 1;
position: static;
visibility: visible;
display: inline-block;
}
&-nested-loading {

View File

@ -9,9 +9,11 @@ import Spin from '../spin';
import classNames from 'classnames';
import { flatArray } from './util';
import assign from 'object-assign';
import splitObject from '../_util/splitObject';
function noop() {
}
import splitObject from '../_util/splitObject';
function stopPropagation(e) {
e.stopPropagation();
if (e.nativeEvent.stopImmediatePropagation) {
@ -800,9 +802,9 @@ export default class Table extends React.Component<TableProps, any> {
render() {
const [{
style, className,
}, restProps] = splitObject(this.props, ['style', 'className']);
const data = this.getCurrentPageData();
style, className, rowKey,
}, restProps] = splitObject(this.props, ['style', 'className', 'rowKey']);
let data = this.getCurrentPageData();
let columns = this.renderRowSelection();
const expandIconAsCell = this.props.expandedRowRender && this.props.expandIconAsCell !== false;
const locale = this.getLocale();
@ -818,28 +820,33 @@ export default class Table extends React.Component<TableProps, any> {
newColumn.key = this.getColumnKey(newColumn, i);
return newColumn;
});
let emptyText;
let emptyClass = '';
// Empty Data
let emptyRowKey;
if (!data || data.length === 0) {
emptyText = (
<div className="ant-table-placeholder">
{locale.emptyText}
</div>
);
emptyClass = 'ant-table-empty';
columns.forEach((column, index) => {
column.render = () => ({
children: !index ? <div className="ant-table-placeholder">{locale.emptyText}</div> : null,
props: {
colSpan: !index ? columns.length : 0,
},
});
});
emptyRowKey = 'key';
data = [{
[emptyRowKey]: 'empty',
}];
}
let table = (
<div>
<RcTable {...restProps}
data={data}
columns={columns}
className={classString}
expandIconColumnIndex={(columns[0] && columns[0].key === 'selection-column') ? 1 : 0}
expandIconAsCell={expandIconAsCell}
/>
{emptyText}
</div>
<RcTable {...restProps}
data={data}
columns={columns}
className={classString}
expandIconColumnIndex={(columns[0] && columns[0].key === 'selection-column') ? 1 : 0}
expandIconAsCell={expandIconAsCell}
rowKey={emptyRowKey || rowKey}
/>
);
// if there is no pagination or no data,
// the height of spin should decrease by half of pagination
@ -849,7 +856,7 @@ export default class Table extends React.Component<TableProps, any> {
const spinClassName = this.props.loading ? `${paginationPatchClass} ant-table-spin-holder` : '';
table = <Spin className={spinClassName} spinning={this.props.loading}>{table}</Spin>;
return (
<div className={`${emptyClass} ${className} clearfix`} style={style}>
<div className={`${className} clearfix`} style={style}>
{table}
{this.renderPagination()}
</div>

View File

@ -19,9 +19,7 @@ import { Table } from 'antd';
const columns = [{
title: '姓名',
dataIndex: 'name',
render(text) {
return <a href="#">{text}</a>;
},
render: (text) => <a href="#">{text}</a>,
}, {
title: '资产',
className: 'column-money',
@ -48,13 +46,15 @@ const data = [{
address: '西湖区湖底公园1号',
}];
ReactDOM.render(<Table
columns={columns}
dataSource={data}
bordered
title={() => '页头'}
footer={() => '页脚'}
/>, mountNode);
ReactDOM.render(
<Table
columns={columns}
dataSource={data}
bordered
title={() => '页头'}
footer={() => '页脚'}
/>
, mountNode);
````
````css

View File

@ -25,7 +25,7 @@
overflow: hidden;
}
th {
&-thead > tr > th {
background: @table-head-background-color;
font-weight: bold;
transition: background .3s ease;
@ -47,11 +47,12 @@
}
}
td {
&-tbody > tr > td {
border-bottom: 1px solid @border-color-split;
}
tr {
&-thead > tr,
&-tbody > tr {
transition: all .3s ease;
&.@{table-prefix-cls}-row-hover,
&:hover {
@ -59,7 +60,7 @@
}
}
thead tr:hover {
&-thead > tr:hover {
background: none;
}
@ -95,22 +96,22 @@
}
}
tr.@{table-prefix-cls}-row-selected {
&-tbody > tr.@{table-prefix-cls}-row-selected {
background: #fafafa;
}
th.@{table-prefix-cls}-column-sort {
&-thead > tr > th.@{table-prefix-cls}-column-sort {
background: #eaeaea;
}
th,
td {
&-thead > tr > th,
&-tbody > tr > td {
padding: 16px 8px;
word-break: break-all;
}
th.@{table-prefix-cls}-selection-column,
td.@{table-prefix-cls}-selection-column {
&-thead > tr > th.@{table-prefix-cls}-selection-column,
&-tbody > tr > td.@{table-prefix-cls}-selection-column {
text-align: center;
width: 60px;
}
@ -148,8 +149,8 @@
}
&-middle {
th,
td {
.@{table-prefix-cls}-thead > tr > th,
.@{table-prefix-cls}-tbody > tr > td {
padding: 10px 8px;
}
}
@ -158,18 +159,22 @@
border: 1px solid @border-color-split;
border-radius: @border-radius-base;
table {
.@{table-prefix-cls}-body > table {
border: 0;
padding: 0 8px;
}
th {
&.@{table-prefix-cls}-bordered .@{table-prefix-cls}-body > table {
border: 0;
}
.@{table-prefix-cls}-thead > tr > th {
padding: 10px 8px;
background: #fff;
border-bottom: 1px solid @border-color-split;
}
td {
.@{table-prefix-cls}-tbody > tr > td {
padding: 6px 8px;
}
@ -178,7 +183,7 @@
table {
border-bottom: 1px solid @border-color-split;
}
th {
.@{table-prefix-cls}-thead > tr > th {
border-bottom: 0;
}
}
@ -225,7 +230,7 @@
}
&-bordered {
table {
.@{table-prefix-cls}-body > table {
border: 1px solid @border-color-split;
}
@ -242,19 +247,19 @@
}
}
th {
.@{table-prefix-cls}-thead > tr > th {
border-bottom: 1px solid @border-color-split;
}
tbody tr:last-child {
th,
td {
.@{table-prefix-cls}-tbody tr:last-child {
> th,
> td {
border-bottom: 0;
}
}
th,
td {
.@{table-prefix-cls}-thead > tr > th,
.@{table-prefix-cls}-tbody > tr > td {
border-right: 1px solid @border-color-split;
&:last-child {
border-right: 0;
@ -262,26 +267,12 @@
}
}
&-empty {
position: relative;
margin-bottom: 16px;
}
&-empty &-body {
height: 150px;
}
&-placeholder {
height: 100px;
line-height: 100px;
height: 65px;
line-height: 65px;
text-align: center;
font-size: 12px;
color: #999;
border-bottom: 1px solid @border-color-split;
position: absolute;
top: 50px;
left: 0;
width: 100%;
.anticon {
margin-right: 4px;
}
@ -500,12 +491,12 @@
display: none;
}
th&-column-has-prev {
&-thead > tr > th&-column-has-prev {
position: relative;
}
th&-column-has-prev,
td&-column-has-prev {
&-thead > tr > th&-column-has-prev,
&-tbody > tr > td&-column-has-prev {
padding-left: 24px;
}

View File

@ -1,6 +1,6 @@
import RcTabs from 'rc-tabs';
import * as React from 'react';
import { cloneElement, Children } from 'react';
import { cloneElement } from 'react';
import classNames from 'classnames';
import Icon from '../icon';
@ -83,7 +83,10 @@ export default class Tabs extends React.Component<TabsProps, any> {
// only card type tabs can be added and closed
if (type === 'editable-card') {
children = Array.isArray(children) ? children : [children];
children = Children.map(children, (child, index) => {
children = children.map((child, index) => {
if (Array.isArray(child)) {
return child;
}
return cloneElement(child, {
tab: <div>
{child.props.tab}

View File

@ -34,6 +34,7 @@ english: Upload
| onPreview | 点击文件链接时的回调 | Function(file) | 无 |
| onRemove | 点击移除文件时的回调 | Function(file) | 无 |
| supportServerRender | 服务端渲染时需要打开这个 | Boolean | false |
| disabled | 是否禁用 | Boolean | false |
### onChange

View File

@ -78,6 +78,7 @@ export default class Upload extends React.Component<UploadProps, any> {
showUploadList: true,
listType: 'text', // or pictrue
className: '',
disabled: false,
};
recentUploadStatus: boolean | PromiseLike<any>;
@ -209,9 +210,8 @@ export default class Upload extends React.Component<UploadProps, any> {
}
handleManualRemove = (file) => {
/* eslint-disable */
file.status = 'removed';
/* eslint-enable */
this.refs.upload.abort(file);
file.status = 'removed'; // eslint-disable-line
if ('onRemove' in this.props) {
this.props.onRemove(file);
} else {
@ -265,19 +265,21 @@ export default class Upload extends React.Component<UploadProps, any> {
);
}
if (type === 'drag') {
let dragUploadingClass = this.state.fileList.some(file => file.status === 'uploading')
? `${prefixCls}-drag-uploading` : '';
let draggingClass = this.state.dragState === 'dragover'
? `${prefixCls}-drag-hover` : '';
const dragCls = classNames({
[prefixCls]: true,
[`${prefixCls}-drag`]: true,
[`${prefixCls}-drag-uploading`]: this.state.fileList.some(file => file.status === 'uploading'),
[`${prefixCls}-drag-hover`]: this.state.dragState === 'dragover',
[`${prefixCls}-disabled`]: this.props.disabled,
});
return (
<span className={this.props.className}>
<div
className={`${prefixCls} ${prefixCls}-drag ${dragUploadingClass} ${draggingClass}`}
<div className={dragCls}
onDrop={this.onFileDrop}
onDragOver={this.onFileDrop}
onDragLeave={this.onFileDrop}
>
<RcUpload {...props}>
<RcUpload {...props} ref="upload">
<div className={`${prefixCls}-drag-container`}>
{this.props.children}
</div>
@ -292,10 +294,11 @@ export default class Upload extends React.Component<UploadProps, any> {
[prefixCls]: true,
[`${prefixCls}-select`]: true,
[`${prefixCls}-select-${this.props.listType}`]: true,
[`${prefixCls}-disabled`]: this.props.disabled,
});
const uploadButton = this.props.children
? <div className={uploadButtonCls}><RcUpload {...props} /></div>
? <div className={uploadButtonCls}><RcUpload {...props} ref="upload" /></div>
: null;
const className = this.props.className;

View File

@ -8,7 +8,7 @@
.@{upload-prefix-cls} {
font-size: @font-size-base;
.ant-upload-btn {
&-btn {
display: block;
width: 100%;
outline: none;
@ -52,11 +52,15 @@
height: 100%;
position: relative;
&.@{upload-prefix-cls}-drag-hover {
&.@{upload-prefix-cls}-drag-hover:not(.@{upload-prefix-cls}-disabled) {
border: 2px dashed tint(@primary-color, 20%);
}
.ant-upload-btn {
&.@{upload-prefix-cls}-disabled {
cursor: not-allowed;
}
.@{upload-prefix-cls}-btn {
display: table;
height: 100%;
}
@ -66,7 +70,7 @@
vertical-align: middle;
}
&:hover {
&:not(.@{upload-prefix-cls}-disabled):hover {
border-color: tint(@primary-color, 20%);
}

View File

@ -7,10 +7,10 @@ english: Download
这里提供 Ant Design 相关设计资源和设计工具的下载,更多设计资源正在整理和完善中。
<div class="resource-cards">
<a target="_blank" href="https://github.com/ant-design/ant-design/releases/download/resource/AntD_Component_v1.3.rplib" class="resource-card">
<a target="_blank" href="https://github.com/ant-design/ant-design/releases/download/resource/AntD_Library_V2.01.rplib" class="resource-card">
<img src="https://os.alipayobjects.com/rmsportal/cnmjGfbBWUZPFiO.png">
<span class="resource-card-content">
<span class="resource-card-title">Axure Components v1.3</span>
<span class="resource-card-title">Axure Components v2.0.1</span>
<span class="resource-card-description">一套强大的 Ant Design 的 Axure 部件库</span>
</span>
</a>

View File

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "1.8.0",
"version": "1.9.1",
"title": "Ant Design",
"description": "一个 UI 设计语言",
"homepage": "http://ant.design/",
@ -50,16 +50,16 @@
"rc-dropdown": "~1.4.8",
"rc-editor-mention": "^0.2.2",
"rc-form": "~0.17.1",
"rc-input-number": "~2.5.14",
"rc-input-number": "~2.6.3",
"rc-menu": "~4.13.0",
"rc-notification": "~1.3.4",
"rc-pagination": "~1.5.3",
"rc-progress": "~1.0.4",
"rc-queue-anim": "~0.11.12",
"rc-queue-anim": "~0.12.4",
"rc-radio": "~2.0.0",
"rc-rate": "~1.1.2",
"rc-select": "~6.4.6",
"rc-slider": "~3.7.4",
"rc-slider": "~4.0.0",
"rc-steps": "~2.1.5",
"rc-switch": "~1.4.2",
"rc-table": "~4.4.0",
@ -68,7 +68,7 @@
"rc-tooltip": "~3.4.2",
"rc-tree": "~1.3.6",
"rc-tree-select": "~1.8.0",
"rc-upload": "~1.13.3",
"rc-upload": "~2.0.3",
"rc-util": "~3.3.0",
"react-addons-pure-render-mixin": "^15.0.0",
"react-slick": "~0.12.0",