diff --git a/CHANGELOG.md b/CHANGELOG.md index 73cba4a431..7caaea819e 100644 --- a/CHANGELOG.md +++ b/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) 组件。 diff --git a/components/modal/confirm.jsx b/components/modal/confirm.jsx index 96edadc020..de72a817b9 100644 --- a/components/modal/confirm.jsx +++ b/components/modal/confirm.jsx @@ -76,7 +76,7 @@ export default function (props) { ; } else { footer =
- +
; } diff --git a/components/modal/demo/basic.md b/components/modal/demo/basic.md index b5d586e9d2..44ba9a9f7b 100644 --- a/components/modal/demo/basic.md +++ b/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
diff --git a/components/modal/demo/custom.md b/components/modal/demo/custom.md index 2d1adbceb9..cbcf5f0fab 100644 --- a/components/modal/demo/custom.md +++ b/components/modal/demo/custom.md @@ -34,6 +34,9 @@ var Test = React.createClass({ }, handleCancel() { console.log('点击了取消'); + this.setState({ + visible: false + }); }, render() { return
diff --git a/components/modal/demo/info.md b/components/modal/demo/info.md index 44f9ae3439..f7a9fe62b0 100644 --- a/components/modal/demo/info.md +++ b/components/modal/demo/info.md @@ -2,7 +2,7 @@ - order: 5 -各种类型的信息提示,只有一个 `确认` 按钮。 +各种类型的信息提示,只提供一个按钮用于关闭。 --- diff --git a/components/modal/index.jsx b/components/modal/index.jsx index e1783ad27e..90e8a8816c 100644 --- a/components/modal/index.jsx +++ b/components/modal/index.jsx @@ -30,9 +30,6 @@ let AntModal = React.createClass({ handleCancel() { this.props.onCancel(); - this.setState({ - visible: false - }); }, handleOk() { diff --git a/components/upload/demo/basic.md b/components/upload/demo/basic.md index fd5659d200..1dc0290efc 100644 --- a/components/upload/demo/basic.md +++ b/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( - diff --git a/components/upload/demo/defaultFileList.md b/components/upload/demo/defaultFileList.md index 0cbdc7d096..4e92cab282 100644 --- a/components/upload/demo/defaultFileList.md +++ b/components/upload/demo/defaultFileList.md @@ -32,7 +32,7 @@ var props = { React.render( - diff --git a/components/upload/demo/fileList.md b/components/upload/demo/fileList.md index ecc371814f..82fbcba45c 100644 --- a/components/upload/demo/fileList.md +++ b/components/upload/demo/fileList.md @@ -61,7 +61,7 @@ var MyUpload = React.createClass({ onChange: this.handleChange }; return - ; diff --git a/components/upload/demo/multiple.md b/components/upload/demo/multiple.md new file mode 100644 index 0000000000..60af122c6c --- /dev/null +++ b/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( + + + +, document.getElementById('components-upload-demo-multiple')); +```` + diff --git a/components/upload/index.jsx b/components/upload/index.jsx index e8f2b1c665..c261f09769 100644 --- a/components/upload/index.jsx +++ b/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); }, diff --git a/docs/download.md b/docs/download.md index 969abf9814..114fac31af 100644 --- a/docs/download.md +++ b/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 ``` diff --git a/docs/introduce.md b/docs/introduce.md index 80872b4695..74b65b7f68 100644 --- a/docs/introduce.md +++ b/docs/introduce.md @@ -44,35 +44,8 @@ React.render(, mountNode); ## 版本 -- 稳定版: -- 开发版: - - - - +- 稳定版:[![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) ## 链接 diff --git a/index.js b/index.js index 1a48880b96..a59ed43415 100644 --- a/index.js +++ b/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; diff --git a/package.json b/package.json index ac890cc4c4..e3fa34c912 100644 --- a/package.json +++ b/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": { diff --git a/static/style.css b/static/style.css index 619a206c29..b1dce9ecd6 100644 --- a/static/style.css +++ b/static/style.css @@ -505,7 +505,7 @@ footer ul li > a { } .markdown img { - display: block; + vertical-align: middle; } .markdown h1 { diff --git a/style/components/radio.less b/style/components/radio.less index 9a0a842082..890d58cec2 100644 --- a/style/components/radio.less +++ b/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; } diff --git a/style/components/select.less b/style/components/select.less index d89e9318b2..e27499e7f9 100644 --- a/style/components/select.less +++ b/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; }