Merge 1.x-stable

This commit is contained in:
afc163 2016-08-08 14:12:02 +08:00
commit b200f8a2d8
14 changed files with 122 additions and 27 deletions

View File

@ -9,6 +9,27 @@ timeline: true
---
## 1.8.0
`2016-08-08`
- Tabs
- 修复可关闭 Tabs 组件只有一个 Tab 的时候报错的问题。[#2559](https://github.com/ant-design/ant-design/issues/2559)
- Datepicker
- 修复 IE8 下关闭图标。[#2584](https://github.com/ant-design/ant-design/issues/2584)
- Tags
- 支持自定义标签颜色。[#2585](https://github.com/ant-design/ant-design/issues/2585)
- TreeSelect
- 修复未找到内容时的样式。[9cee9f](https://github.com/ant-design/ant-design/commit/9cee9f103a4729572358206c81cba84e2fdc20f5)
- Modal
- 适配小屏幕。[#2597](https://github.com/ant-design/ant-design/issues/2597)
- Layout
- 修复了 Row 组件在同一行闭合会报错的问题。[#2603](https://github.com/ant-design/ant-design/issues/2603)
- Table
- `rowSelection.onChange` 的参数 `selectedRows` 现在和 `selectedRowKeys` 保持一致。[#2566](https://github.com/ant-design/ant-design/issues/2603)
- Checkbox
- 支持了 `onClick` 事件。
## 1.7.0
`2016-07-30`

View File

@ -87,10 +87,6 @@ export default class BackTop extends React.Component<BackTopProps, any> {
</div>
);
const style = {
display: this.state.visible ? 'block' : 'none',
};
// fix https://fb.me/react-unknown-prop
const divProps = omit(this.props, [
'prefixCls',
@ -103,10 +99,8 @@ export default class BackTop extends React.Component<BackTopProps, any> {
<Animate component="" transitionName="fade">
{
this.state.visible ?
<div data-show={this.state.visible} style={style}>
<div {...divProps} className={classString} onClick={this.scrollToTop}>
{children || defaultElement}
</div>
<div {...divProps} className={classString} onClick={this.scrollToTop}>
{children || defaultElement}
</div>
: null
}

View File

@ -87,19 +87,23 @@ Ant Design 的布局组件若不能满足你的需求,你也可以直接使用
### Row
| 成员 | 说明 | 类型 | 默认值 |
|------------|-----------------|--------------------|-------------|
| gutter | 栅格间隔 | number | 0 |
| type | 布局模式,可选 `flex`,现代浏览器下有效 | string | |
| 成员 | 说明 | 类型 | 默认值 |
|-----------|-----------------|--------------------|-------------|
| gutter | 栅格间隔 | number | 0 |
| type | 布局模式,可选 `flex`,现代浏览器下有效 | string | |
| align | flex 布局下的垂直对齐方式:`top` `middle` `bottom` | string | `top` |
| justify | flex 布局下的水平排列方式:`start` `end` `center` `space-around` `space-between` | string | `start` |
### Col
| 成员 | 说明 | 类型 | 默认值 |
|------------|-----------------|--------------------|-------------|
| span | 栅格占位格数,为 0 时相当于 `display: none` | number | |
| order | 栅格顺序,`flex` 布局模式下有效 | number | 0 |
| offset | 栅格左侧的间隔格数,间隔内不可以有栅格 | number | 0 |
| 成员 | 说明 | 类型 | 默认值 |
|----------|-----------------|--------------------|-------------|
| span | 栅格占位格数,为 0 时相当于 `display: none` | number | - |
| order | 栅格顺序,`flex` 布局模式下有效 | number | 0 |
| offset | 栅格左侧的间隔格数,间隔内不可以有栅格 | number | 0 |
| push | 栅格向右移动格数 | number | 0 |
| pull | 栅格向左移动格数 | number | 0 |
| xs | `<768px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number or object | - |
| sm | `≥768px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number or object | - |
| md | `≥992px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number or object | - |
| lg | `≥1200px` 响应式栅格,可为栅格数或一个包含其他属性的对象 | number or object | - |

View File

@ -128,3 +128,16 @@
overflow: hidden;
}
}
@media (max-width: 768px) {
.@{dialog-prefix-cls} {
width: auto !important;
margin: 10px;
}
.vertical-center-modal {
.@{dialog-prefix-cls} {
flex: 1;
}
}
}

View File

@ -1,17 +1,17 @@
---
order: 1
title:
title:
zh-CN: 带搜索框
en-US: Search
---
## zh-CN
带搜索框的穿梭框。
带搜索框的穿梭框,可以自定义搜索函数
## en-US
Transfer with a search box
Transfer with a search box.
````jsx
import { Transfer } from 'antd';
@ -43,6 +43,9 @@ const App = React.createClass({
}
this.setState({ mockData, targetKeys });
},
filterOption(inputValue, option) {
return option.description.indexOf(inputValue) > -1;
},
handleChange(targetKeys) {
this.setState({ targetKeys });
},
@ -51,6 +54,7 @@ const App = React.createClass({
<Transfer
dataSource={this.state.mockData}
showSearch
filterOption={this.filterOption}
targetKeys={this.state.targetKeys}
onChange={this.handleChange}
render={item => item.title}

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import { PropTypes } from 'react';
import List from './list';
import Operation from './operation';
import Search from './search';
@ -61,6 +62,26 @@ export default class Transfer extends React.Component<TransferProps, any> {
footer: noop,
};
static propTypes = {
prefixCls: PropTypes.string,
dataSource: PropTypes.array,
render: PropTypes.func,
targetKeys: PropTypes.array,
onChange: PropTypes.func,
height: PropTypes.number,
listStyle: PropTypes.object,
className: PropTypes.string,
titles: PropTypes.array,
operations: PropTypes.array,
showSearch: PropTypes.bool,
filterOption: PropTypes.func,
searchPlaceholder: PropTypes.string,
notFoundContent: PropTypes.node,
body: PropTypes.func,
footer: PropTypes.func,
rowKey: PropTypes.func,
};
constructor(props) {
super(props);
this.state = {
@ -204,7 +225,7 @@ export default class Transfer extends React.Component<TransferProps, any> {
const {
prefixCls, titles, operations, showSearch, notFoundContent,
searchPlaceholder, body, footer, listStyle, className,
render,
filterOption, render,
} = this.props;
const { leftFilter, rightFilter, leftCheckedKeys, rightCheckedKeys } = this.state;
@ -222,6 +243,7 @@ export default class Transfer extends React.Component<TransferProps, any> {
<List titleText={titles[0]}
dataSource={leftDataSource}
filter={leftFilter}
filterOption={filterOption}
style={listStyle}
checkedKeys={leftCheckedKeys}
handleFilter={this.handleLeftFilter}
@ -247,6 +269,7 @@ export default class Transfer extends React.Component<TransferProps, any> {
<List titleText={titles[1]}
dataSource={rightDataSource}
filter={rightFilter}
filterOption={filterOption}
style={listStyle}
checkedKeys={rightCheckedKeys}
handleFilter={this.handleRightFilter}

View File

@ -28,6 +28,7 @@ english: Transfer
| titles | 标题集合,顺序从左至右 | Array | ['源列表', '目的列表'] |
| operations | 操作文案集合,顺序从上至下 | Array | [] |
| showSearch | 是否显示搜索框 | Boolean | false |
| filterOption | 接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`。| Function(inputValue, option) | |
| searchPlaceholder | 搜索框的默认值 | String | '请输入搜索内容' |
| notFoundContent | 当列表为空时显示的内容 | React.node | '列表为空' |
| footer | 底部渲染函数 | Function(props) | |

View File

@ -1,4 +1,5 @@
import * as React from 'react';
import { PropTypes } from 'react';
import Checkbox from '../checkbox';
import Search from './search';
import classNames from 'classnames';
@ -59,6 +60,23 @@ export default class TransferList extends React.Component<TransferListProps, any
footer: noop,
};
static propTypes = {
prefixCls: PropTypes.string,
dataSource: PropTypes.array,
showSearch: PropTypes.bool,
filterOption: PropTypes.func,
searchPlaceholder: PropTypes.string,
titleText: PropTypes.string,
style: PropTypes.object,
handleClear: PropTypes.func,
handleFilter: PropTypes.func,
handleSelect: PropTypes.func,
handleSelectAll: PropTypes.func,
render: PropTypes.func,
body: PropTypes.func,
footer: PropTypes.func,
};
static contextTypes = {
antLocale: React.PropTypes.object,
};
@ -131,7 +149,11 @@ export default class TransferList extends React.Component<TransferListProps, any
);
}
matchFilter(text, filterText) {
matchFilter(filterText, item, text) {
const filterOption = this.props.filterOption;
if (filterOption) {
return filterOption(filterText, item);
}
return text.indexOf(filterText) >= 0;
}
@ -165,7 +187,7 @@ export default class TransferList extends React.Component<TransferListProps, any
renderedEl = renderResult;
}
if (filter && filter.trim() && !this.matchFilter(renderedText, filter)) {
if (filter && filter.trim() && !this.matchFilter(filter, item, renderedText)) {
return null;
}

View File

@ -28,8 +28,9 @@ Ant Design 是一个致力于提升『用户』和『设计者』使用体验的
我们采用 [React](http://facebook.github.io/react/) 封装了一套 Ant Design 的组件库,也欢迎社区其他框架的实现版本。
- [Ant Design of React](/docs/react/introduce)(官方实现)
- [vue-antd](https://github.com/okoala/vue-antd)
- [antd-ember](https://github.com/idcos/antd-ember)
- <div class="outside-link internal"><a href="http://naza.alibaba.net" target="_blank">Ant Design of Angular 2.0</a></div>
- <div class="outside-link"><a href="https://github.com/okoala/vue-antd" target="_blank">vue-antd</a></div>
- <div class="outside-link"><a href="https://github.com/idcos/antd-ember" target="_blank">antd-ember</a></div>
## 如何贡献

View File

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

View File

@ -4,7 +4,9 @@ function pickerGenerator(module) {
const tester = new RegExp(`^docs/${module}`);
return (markdownData) => {
const filename = markdownData.meta.filename;
if (tester.test(filename) && !/\.en-US\.md/.test(filename)) {
if (tester.test(filename) &&
!/\/demo$/.test(path.dirname(filename)) &&
!/\.en-US\.md/.test(filename)) {
return {
meta: markdownData.meta,
};

View File

@ -67,11 +67,16 @@ div.main-container {
opacity: .67;
}
.outside-link {
display: inline-block;
}
.outside-link:after {
content: '\E669';
font-family: 'anticon';
margin-left: 5px;
font-size: 12px;
color: #aaa;
}
.outside-link.internal {

View File

@ -62,6 +62,9 @@
.markdown ul > li {
list-style: circle;
&:empty {
display: none;
}
}
.markdown > ul li,

View File

@ -17,6 +17,8 @@ export default class Article extends React.Component {
this.pingTimer = utils.ping(checkImgUrl, status => {
if (status === 'responded') {
links.forEach(link => (link.style.display = 'block'));
} else {
links.forEach(link => link.parentNode.removeChild(link));
}
});
}