Browse Source

Merge branch 'master' of github.com:ant-design/ant-design into enterAnimation0.4.0

pull/249/head
jljsj 9 years ago
parent
commit
eba40467a4
  1. 8
      CHANGELOG.md
  2. 2
      components/modal/confirm.jsx
  3. 7
      components/modal/demo/basic.md
  4. 3
      components/modal/demo/custom.md
  5. 2
      components/modal/demo/info.md
  6. 3
      components/modal/index.jsx
  7. 11
      components/upload/demo/basic.md
  8. 2
      components/upload/demo/defaultFileList.md
  9. 2
      components/upload/demo/fileList.md
  10. 36
      components/upload/demo/multiple.md
  11. 22
      components/upload/index.jsx
  12. 6
      docs/download.md
  13. 31
      docs/introduce.md
  14. 6
      index.js
  15. 3
      package.json
  16. 2
      static/style.css
  17. 2
      style/components/radio.less
  18. 4
      style/components/select.less

8
CHANGELOG.md

@ -13,6 +13,8 @@
* 新增 `onChange(file) {}` 接口,移出原来的 `onSuccess`、`onProgess`、`onError` 等接口。
* 新增 `fileList``defaultFileList` 属性,以满足更多的自定义功能,具体见演示。
* 设置 fileList 数组项的 url 属性可以作为链接展示在文件列表中方便下载。
* 移除内建的上传成功或失败的信息提示,业务可自行实现。
* 修正多文件选择上传时文件列表只展示一个文件的问题。
### Table
@ -44,11 +46,17 @@
### Modal
* 添加 [通知类型](http://ant.design/components/modal/#demo-info) 的对话框函数。
* 用 `Modal.confirm()` 代替 `confirm()` 方法。
* 修改为需要在 onCancel 手动设置 visible 属性来关闭。
### Message
* 添加 [加载中类型](http://ant.design/components/message/#demo-loading)。
### Radio
* 修改 Radio.Group 容器的盒模型属性为 inline-block 。
### 其他
* 新增 [timeline](http://ant.design/components/timeline) 和 [badge](http://ant.design/components/badge) 组件。

2
components/modal/confirm.jsx

@ -76,7 +76,7 @@ export default function (props) {
</div>;
} else {
footer = <div className="ant-confirm-btns">
<button type="button" className="ant-btn-primary ant-btn ant-btn-lg" onClick={onOk}> </button>
<button type="button" className="ant-btn-primary ant-btn ant-btn-lg" onClick={onOk}>知道了</button>
</div>;
}

7
components/modal/demo/basic.md

@ -9,8 +9,6 @@
````jsx
var Modal = antd.Modal;
console.log(Modal.info);
var Test = React.createClass({
getInitialState(){
return{
@ -28,6 +26,11 @@ var Test = React.createClass({
visible: false
});
},
handleCancel() {
this.setState({
visible: false
});
},
render() {
return <div>
<button className="ant-btn ant-btn-primary" onClick={this.showModal}>显示对话框</button>

3
components/modal/demo/custom.md

@ -34,6 +34,9 @@ var Test = React.createClass({
},
handleCancel() {
console.log('点击了取消');
this.setState({
visible: false
});
},
render() {
return <div>

2
components/modal/demo/info.md

@ -2,7 +2,7 @@
- order: 5
各种类型的信息提示,只有一个 `确认` 按钮
各种类型的信息提示,只提供一个按钮用于关闭
---

3
components/modal/index.jsx

@ -30,9 +30,6 @@ let AntModal = React.createClass({
handleCancel() {
this.props.onCancel();
this.setState({
visible: false
});
},
handleOk() {

11
components/upload/demo/basic.md

@ -8,20 +8,25 @@
````jsx
var Upload = antd.Upload;
var message = antd.message;
var props = {
action: '/upload.do',
onChange(info) {
if (info.file.status !== 'uploading') {
console.log(info.file);
console.log(info.fileList);
console.log(info.file, info.fileList);
}
if (info.file.status === 'done') {
message.success(info.file.name + ' 上传成功。');
} else if (info.file.error) {
message.error(info.file.name + ' 上传失败。');
}
}
};
React.render(
<Upload {...props}>
<button className="ant-btn ant-btn-ghost">
<button type="button" className="ant-btn ant-btn-ghost">
<i className="anticon anticon-upload"></i> 点击上传
</button>
</Upload>

2
components/upload/demo/defaultFileList.md

@ -32,7 +32,7 @@ var props = {
React.render(
<Upload {...props}>
<button className="ant-btn ant-btn-ghost">
<button type="button" className="ant-btn ant-btn-ghost">
<i className="anticon anticon-upload"></i> 点击上传
</button>
</Upload>

2
components/upload/demo/fileList.md

@ -61,7 +61,7 @@ var MyUpload = React.createClass({
onChange: this.handleChange
};
return <Upload {...props} fileList={this.state.fileList}>
<button className="ant-btn ant-btn-ghost">
<button type="button" className="ant-btn ant-btn-ghost">
<i className="anticon anticon-upload"></i> 点击上传
</button>
</Upload>;

36
components/upload/demo/multiple.md

@ -0,0 +1,36 @@
# 多文件选择
- order: 5
按住 ctrl 可选择多个文件,`ie10+` 支持。
---
````jsx
var Upload = antd.Upload;
var message = antd.message;
var props = {
action: '/upload.do',
multiple: true,
onChange(info) {
if (info.file.status !== 'uploading') {
console.log(info.file, info.fileList);
}
if (info.file.status === 'done') {
message.success(info.file.name + ' 上传成功。');
} else if (info.file.error) {
message.error(info.file.name + ' 上传失败。');
}
}
};
React.render(
<Upload {...props}>
<button type="button" className="ant-btn ant-btn-ghost">
<i className="anticon anticon-upload"></i> 点击上传
</button>
</Upload>
, document.getElementById('components-upload-demo-multiple'));
````

22
components/upload/index.jsx

@ -1,7 +1,6 @@
import React from 'react';
import Upload from 'rc-upload';
import assign from 'object-assign';
import Message from '../message';
import UploadList from './uploadList';
import getFileItem from './getFileItem';
const prefixCls = 'ant-upload';
@ -16,12 +15,10 @@ const AntUpload = React.createClass({
};
},
onStart(file) {
let nextFileList = this.state.fileList.concat();
file.status = 'uploading';
nextFileList.push(file);
this.onChange({
file: file,
fileList: nextFileList
add: true
});
},
removeFile(file) {
@ -37,7 +34,6 @@ const AntUpload = React.createClass({
},
onSuccess(response, file) {
let fileList = this.state.fileList.concat();
Message.success(file.name + '上传完成。');
let targetItem = getFileItem(file, fileList);
//
if (targetItem) {
@ -61,7 +57,6 @@ const AntUpload = React.createClass({
}
},
onError(error, response, file) {
Message.error(file.name + ' 上传失败。');
file.error = error;
file.response = response;
this.handleRemove(file);
@ -79,9 +74,18 @@ const AntUpload = React.createClass({
// 1. fileList
// 2. info.event fileList
if (!('fileList' in this.props) && !info.event) {
this.setState({
fileList: info.fileList
});
// 使 multiple setState
if (info.add) {
this.setState((prevState) => {
return {
fileList: prevState.fileList.concat(info.file)
};
});
} else {
this.setState({
fileList: info.fileList
});
}
}
this.props.onChange(info);
},

6
docs/download.md

@ -38,16 +38,18 @@
**我们推荐使用 npm 的方式进行开发**,这样可以享受整个生态圈和工具链带来的诸多好处。
[![npm package](https://img.shields.io/npm/v/antd.svg?style=flat-square)](https://www.npmjs.org/package/antd)
可以通过 npm 直接安装到本地,使用 `require``import` 进行引用。
[![npm package](https://img.shields.io/npm/v/antd.svg?style=flat-square)](https://www.npmjs.org/package/antd)
```bash
$ npm install antd --save
```
安装最新的开发版本:
[![](https://cnpmjs.org/badge/v/antd.svg?&tag=beta&subject=npm)](https://www.npmjs.org/package/antd)
```bash
$ npm install antd@beta --save
```

31
docs/introduce.md

@ -44,35 +44,8 @@ React.render(<Datepicker />, mountNode);
## 版本
- 稳定版:<span class="versions" id="stable-version"></span>
- 开发版:<span class="versions" id="latest-version"></span>
<style>
.versions {
font-weight: bold;
color: #C05B4D;
font-family: Consolas;
margin-left: 0.3em;
background: #FFF1E7;
padding: 2px 5px;
border-radius: 3px;
}
</style>
<script>
$('#latest-version').html(antdVersion.latest);
$('#latest-links a').each(function(i, item) {
$(item).attr('href', $(item).attr('href').replace('dist/antd', 'dist/antd-' + antdVersion.latest));
});
if (antdVersion.stable) {
$('#stable-version').html(antdVersion.stable);
$('#stable-link').attr('href', 'https://github.com/ant-design/ant-design/releases/tag/' + antdVersion.stable);
} else {
$('#stable-version').html('暂无');
$('#stable-link').hide();
}
</script>
- 稳定版:[![npm package](https://img.shields.io/npm/v/antd.svg?style=flat-square)](https://www.npmjs.org/package/antd)
- 开发版:[![](https://cnpmjs.org/badge/v/antd.svg?&tag=beta&subject=npm)](https://www.npmjs.org/package/antd)
## 链接

6
index.js

@ -1,4 +1,5 @@
require('./style/index.less');
import './style/index.less';
import deprecate from 'util-deprecate';
// matchMedia polyfill for
// https://github.com/WickyNilliams/enquire.js/issues/82
@ -46,6 +47,9 @@ const antd = {
Timeline: require('./components/timeline')
};
// deprecate antd.confirm
antd.confirm = deprecate(antd.confirm, 'antd.confirm() is deprecated, use antd.Modal.confirm() instead');
module.exports = antd;
antd.version = require('./package.json').version;

3
package.json

@ -1,6 +1,6 @@
{
"name": "antd",
"version": "0.9.0-beta3",
"version": "0.9.0-beta4",
"stableVersion": "0.8.0",
"title": "Ant Design",
"description": "一个 UI 设计语言",
@ -62,6 +62,7 @@
"rc-util": "~2.0.3",
"react-slick": "~0.7.0",
"reqwest-without-xhr2": "~2.0.2",
"util-deprecate": "~1.0.1",
"velocity-animate": "^1.2.2"
},
"devDependencies": {

2
static/style.css

@ -505,7 +505,7 @@ footer ul li > a {
}
.markdown img {
display: block;
vertical-align: middle;
}
.markdown h1 {

2
style/components/radio.less

@ -4,6 +4,8 @@
@radio-duration: .3s;
.@{radio-group-prefix-cls} {
display: inline-block;
vertical-align: middle;
label {
margin-right: 16px;
}

4
style/components/select.less

@ -202,7 +202,7 @@
.@{select-prefix-cls}-search__field__placeholder {
top: 6px;
left: 4px;
left: 10px;
}
.@{select-prefix-cls}-search--inline {
@ -215,7 +215,7 @@
.@{select-prefix-cls}-selection__rendered {
overflow: hidden;
text-overflow: ellipsis;
padding-left: 4px;
padding-left: 6px;
padding-bottom: 4px;
}

Loading…
Cancel
Save