Comparing version 0.8.1-beta1 to 0.9.0-beta1
@@ -0,1 +1,46 @@ | ||
## 0.9.0 (not ready) | ||
### Upload | ||
**重构了 API 接口,不向下兼容**,支持自定义的功能扩展。 | ||
* 新增 `onChange(file) {}` 接口,移出原来的 `onSuccess`、`onProgess`、`onError` 等接口。 | ||
* 新增 `fileList` 和 `defaultFileList` 属性,以满足更多的自定义功能,具体见演示。 | ||
* 设置 fileList 数组项的 url 属性可以作为链接展示在文件列表中方便下载。 | ||
### Table | ||
* 新增无数据的展示样式。[4c54644](https://github.com/ant-design/ant-design/commit/4c54644116d46cb2510d2d475234529bad60e5d5) | ||
* 修复本地模式 `dataSource` 无法更新的问题。[6d2dcc4](https://github.com/ant-design/ant-design/commit/6d2dcc45393b6ec0ad1ba73caf8b1ec42353743f) | ||
* 修复远程模式 loading 失效的问题。[9b8abb2](https://github.com/ant-design/ant-design/commit/9b8abb219934c246970a84200818aa8f85974bdf) | ||
* 用 [reqwest-without-xhr2](http://npmjs.com/reqwest-without-xhr2) 代替了 reqwest,解决某些开发环境下 xhr2 依赖的问题。 | ||
### Notification | ||
* 修复不会自动消失的问题。[23fce55](https://github.com/ant-design/ant-design/commit/23fce559b0b2faf4e0b686a92dbcdd045727a464) | ||
### Steps | ||
* 新增竖版的步骤条。 | ||
### Carousel | ||
* 修复 fade 模式下可以拖拽的问题。#212 | ||
### Collapse | ||
* 修复动画不生效的问题。 | ||
### Datepicker | ||
* 修复无法设置为空值的问题。 | ||
### 其他 | ||
* 新增 [badge](http://ant.design/components/badge) 组件。 | ||
* tooltip、popover、popconfirm 等动画效果优化。 | ||
* 部分文案更新。 | ||
* 优化主站在小分辨率屏幕下的样式。 | ||
## 0.8.0 (2015-08-25) | ||
@@ -2,0 +47,0 @@ |
@@ -35,2 +35,3 @@ 'use strict'; | ||
props.fade = true; | ||
props.draggable = false; | ||
} | ||
@@ -37,0 +38,0 @@ |
@@ -40,9 +40,9 @@ 'use strict'; | ||
enter: function enter(node, done) { | ||
animate(node, false, 'slideDown', done); | ||
return animate(node, false, 'slideDown', done); | ||
}, | ||
leave: function leave(node, done) { | ||
animate(node, true, 'slideUp', done); | ||
return animate(node, true, 'slideUp', done); | ||
}, | ||
appear: function appear(node, done) { | ||
animate(node, false, 'slideDown', done); | ||
return animate(node, false, 'slideDown', done); | ||
} | ||
@@ -49,0 +49,0 @@ }; |
@@ -59,5 +59,8 @@ 'use strict'; | ||
componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | ||
if (nextProps.value) { | ||
var value = new _gregorianCalendar2['default'](_gregorianCalendarLibLocaleZhCn2['default']); | ||
value.setTime(new Date(nextProps.value).valueOf()); | ||
if ('value' in nextProps) { | ||
var value = null; | ||
if (nextProps.value) { | ||
value = new _gregorianCalendar2['default'](_gregorianCalendarLibLocaleZhCn2['default']); | ||
value.setTime(new Date(nextProps.value).valueOf()); | ||
} | ||
this.setState({ | ||
@@ -64,0 +67,0 @@ value: value |
@@ -44,2 +44,3 @@ require('./index.css'); | ||
Upload: require('./upload'), | ||
Badge: require('./badge'), | ||
Menu: require('./menu') | ||
@@ -50,2 +51,2 @@ }; | ||
antd.version = '0.8.1-beta1'; | ||
antd.version = '0.9.0-beta1'; |
@@ -19,6 +19,2 @@ 'use strict'; | ||
var _velocityAnimate = require('velocity-animate'); | ||
var _velocityAnimate2 = _interopRequireDefault(_velocityAnimate); | ||
var _commonOpenAnimation = require('../common/openAnimation'); | ||
@@ -25,0 +21,0 @@ |
@@ -41,3 +41,3 @@ 'use strict'; | ||
if (args.duration === undefined) { | ||
duration = 500; | ||
duration = 4.5; | ||
} else { | ||
@@ -44,0 +44,0 @@ duration = args.duration; |
@@ -32,2 +32,3 @@ 'use strict'; | ||
{ size: this.props.size, | ||
direction: this.props.direction, | ||
iconPrefix: this.props.iconPrefix, | ||
@@ -34,0 +35,0 @@ maxDescriptionWidth: this.props.maxDescriptionWidth, |
@@ -21,5 +21,5 @@ 'use strict'; | ||
var _reqwest = require('reqwest'); | ||
var _reqwestWithoutXhr2 = require('reqwest-without-xhr2'); | ||
var _reqwest2 = _interopRequireDefault(_reqwest); | ||
var _reqwestWithoutXhr22 = _interopRequireDefault(_reqwestWithoutXhr2); | ||
@@ -360,3 +360,9 @@ var _rcTable = require('rc-table'); | ||
} | ||
column.title = [column.title, sortButton, filterDropdown]; | ||
column.title = _react2['default'].createElement( | ||
'div', | ||
null, | ||
column.title, | ||
sortButton, | ||
filterDropdown | ||
); | ||
return column; | ||
@@ -375,11 +381,11 @@ }); | ||
} | ||
var total = undefined; | ||
if (this.isLocalDataSource()) { | ||
var total = this.state.pagination.total; | ||
if (!total && this.isLocalDataSource()) { | ||
total = this.getLocalData().length; | ||
} | ||
return _react2['default'].createElement(_pagination2['default'], _extends({ className: classString, | ||
return total > 0 ? _react2['default'].createElement(_pagination2['default'], _extends({ className: classString, | ||
onChange: this.handlePageChange, | ||
total: total, | ||
pageSize: 10 | ||
}, this.state.pagination)); | ||
}, this.state.pagination)) : null; | ||
}, | ||
@@ -427,3 +433,3 @@ | ||
return { | ||
v: (0, _reqwest2['default'])({ | ||
v: (0, _reqwestWithoutXhr22['default'])({ | ||
url: dataSource.url, | ||
@@ -540,2 +546,15 @@ method: 'get', | ||
columns = this.renderColumnsDropdown(columns); | ||
columns = columns.map(function (column, i) { | ||
column.key = column.dataIndex || i; | ||
return column; | ||
}); | ||
var emptyText = undefined; | ||
if (!data || data.length === 0) { | ||
emptyText = _react2['default'].createElement( | ||
'div', | ||
{ className: 'ant-table-empty' }, | ||
_react2['default'].createElement('i', { className: 'anticon anticon-frown' }), | ||
'暂无数据' | ||
); | ||
} | ||
return _react2['default'].createElement( | ||
@@ -545,6 +564,7 @@ 'div', | ||
_react2['default'].createElement(_rcTable2['default'], _extends({}, this.props, { | ||
data: data || [], | ||
data: data, | ||
columns: columns, | ||
className: classString | ||
})), | ||
emptyText, | ||
this.renderPagination() | ||
@@ -551,0 +571,0 @@ ); |
@@ -19,6 +19,2 @@ 'use strict'; | ||
var _velocityAnimate = require('velocity-animate'); | ||
var _velocityAnimate2 = _interopRequireDefault(_velocityAnimate); | ||
var _commonOpenAnimation = require('../common/openAnimation'); | ||
@@ -25,0 +21,0 @@ |
@@ -12,3 +12,3 @@ 'use strict'; | ||
if (matchWay === 'byName') { | ||
return item.filename === file.filename; | ||
return item.name === file.name; | ||
} else { | ||
@@ -15,0 +15,0 @@ return item.uid === file.uid; |
@@ -36,3 +36,2 @@ 'use strict'; | ||
var prefixCls = 'ant-upload'; | ||
var fileIndex = 0; | ||
@@ -46,55 +45,75 @@ function noop() {} | ||
return { | ||
downloadList: [] | ||
fileList: this.props.fileList || this.props.defaultFileList || [] | ||
}; | ||
}, | ||
onStart: function onStart(file) { | ||
var nextDownloadList = this.state.downloadList; | ||
nextDownloadList.push({ | ||
index: fileIndex++, | ||
uid: file.uid || '', | ||
filename: file.name, | ||
var nextFileList = this.state.fileList.concat(); | ||
file.status = 'uploading'; | ||
nextFileList.push(file); | ||
this.onChange({ | ||
file: file, | ||
status: 'downloading' | ||
fileList: nextFileList | ||
}); | ||
this.setState({ | ||
downloadList: nextDownloadList | ||
}); | ||
this.props.onStart(file); | ||
}, | ||
removeFile: function removeFile(file) { | ||
var downloadList = this.state.downloadList.concat(); | ||
var targetItem = (0, _getFileItem2['default'])(file, downloadList); | ||
var index = downloadList.indexOf(targetItem); | ||
file.status = 'removed'; | ||
var fileList = this.state.fileList.concat(); | ||
var targetItem = (0, _getFileItem2['default'])(file, fileList); | ||
var index = fileList.indexOf(targetItem); | ||
if (index !== -1) { | ||
downloadList.splice(index, 1); | ||
fileList.splice(index, 1); | ||
return fileList; | ||
} | ||
this.setState({ | ||
downloadList: downloadList | ||
}); | ||
return null; | ||
}, | ||
onSuccess: function onSuccess(ret, file) { | ||
var res = this.props.onSuccess(ret, file); | ||
if (res !== false) { | ||
var downloadList = this.state.downloadList.concat(); | ||
_message2['default'].success(file.name + '上传完成'); | ||
var targetItem = (0, _getFileItem2['default'])(file, downloadList); | ||
onSuccess: function onSuccess(response, file) { | ||
var fileList = this.state.fileList.concat(); | ||
_message2['default'].success(file.name + '上传完成。'); | ||
var targetItem = (0, _getFileItem2['default'])(file, fileList); | ||
// 之前已经删除 | ||
if (targetItem) { | ||
targetItem.status = 'done'; | ||
this.setState({ | ||
downloadList: this.state.downloadList | ||
targetItem.response = response; | ||
this.onChange({ | ||
file: targetItem, | ||
fileList: this.state.fileList | ||
}); | ||
} else { | ||
this.removeFile(file); | ||
} | ||
}, | ||
onProgress: function onProgress(e, file) { | ||
this.props.onProgress(e, file); | ||
var fileList = this.state.fileList; | ||
var targetItem = (0, _getFileItem2['default'])(file, fileList); | ||
if (targetItem) { | ||
this.onChange({ | ||
event: e, | ||
file: file, | ||
fileList: this.state.fileList | ||
}); | ||
} | ||
}, | ||
onError: function onError(err, responce, file) { | ||
_message2['default'].error(file.name + ' 上传失败'); | ||
this.removeFile(file); | ||
this.props.onError(err, responce, file); | ||
onError: function onError(error, response, file) { | ||
_message2['default'].error(file.name + ' 上传失败。'); | ||
file.error = error; | ||
file.response = response; | ||
this.handleRemove(file); | ||
}, | ||
onRemove: function onRemove(file) { | ||
this.props.onRemove(file); | ||
handleRemove: function handleRemove(file) { | ||
var fileList = this.removeFile(file); | ||
if (fileList) { | ||
this.onChange({ | ||
file: file, | ||
fileList: fileList | ||
}); | ||
} | ||
}, | ||
onChange: function onChange(info) { | ||
// 1. 有设置外部属性时不改变 fileList | ||
// 2. 上传中状态(info.event)不改变 fileList | ||
if (!('fileList' in this.props) && !info.event) { | ||
this.setState({ | ||
fileList: info.fileList | ||
}); | ||
} | ||
this.props.onChange(info); | ||
}, | ||
getDefaultProps: function getDefaultProps() { | ||
@@ -108,10 +127,12 @@ return { | ||
accept: '', | ||
uploadTip: '', | ||
onStart: noop, | ||
onError: noop, | ||
onSuccess: noop, | ||
onProgress: noop, | ||
onRemove: noop | ||
onChange: noop | ||
}; | ||
}, | ||
componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | ||
if ('fileList' in nextProps) { | ||
this.setState({ | ||
fileList: nextProps.fileList | ||
}); | ||
} | ||
}, | ||
render: function render() { | ||
@@ -152,3 +173,4 @@ var type = this.props.type || 'select'; | ||
), | ||
_react2['default'].createElement(_uploadList2['default'], { items: this.state.downloadList, onRemove: this.onRemove }) | ||
_react2['default'].createElement(_uploadList2['default'], { items: this.state.fileList, | ||
onRemove: this.handleRemove }) | ||
); | ||
@@ -155,0 +177,0 @@ } |
@@ -43,11 +43,3 @@ 'use strict'; | ||
handleClose: function handleClose(file) { | ||
var items = this.state.items; | ||
var removeItem = (0, _getFileItem2['default'])(file, items); | ||
if (removeItem) { | ||
items.splice(items.indexOf(removeItem), 1); | ||
} | ||
this.setState({ | ||
items: items | ||
}); | ||
this.props.onRemove(file.file); | ||
this.props.onRemove(file); | ||
}, | ||
@@ -57,18 +49,22 @@ render: function render() { | ||
var items = this.state.items; | ||
var downloadItem = function downloadItem(file) { | ||
var list = this.state.items.map(function (file) { | ||
var statusIcon = file.status === 'done' ? _react2['default'].createElement('i', { className: 'anticon anticon-check ' + prefixCls + '-success-icon' }) : _react2['default'].createElement('i', { className: 'anticon anticon-loading' }); | ||
var filename = file.url ? _react2['default'].createElement( | ||
'a', | ||
{ className: prefixCls + '-item-name', href: file.url, _target: '_blank' }, | ||
file.name | ||
) : _react2['default'].createElement( | ||
'b', | ||
{ className: prefixCls + '-item-name' }, | ||
file.name | ||
); | ||
return _react2['default'].createElement( | ||
'div', | ||
{ className: prefixCls + '-list-item', key: file.index }, | ||
{ className: prefixCls + '-list-item', key: file.uid }, | ||
statusIcon, | ||
_react2['default'].createElement( | ||
'b', | ||
{ className: prefixCls + '-item-name' }, | ||
file.filename | ||
), | ||
filename, | ||
_react2['default'].createElement('i', { className: 'anticon anticon-cross', ref: 'theCloseBtn', | ||
onClick: _this.handleClose.bind(_this, file) }) | ||
); | ||
}; | ||
}); | ||
return _react2['default'].createElement( | ||
@@ -80,3 +76,3 @@ 'div', | ||
{ transitionName: prefixCls + '-margin-top' }, | ||
items.map(downloadItem) | ||
list | ||
) | ||
@@ -83,0 +79,0 @@ ); |
{ | ||
"name": "antd", | ||
"version": "0.8.1-beta1", | ||
"version": "0.9.0-beta1", | ||
"stableVersion": "0.8.0", | ||
@@ -40,3 +40,3 @@ "title": "Ant Design", | ||
"object-assign": "~4.0.1", | ||
"rc-animate": "~1.2.0", | ||
"rc-animate": "~1.2.9", | ||
"rc-calendar": "~3.16.1", | ||
@@ -54,5 +54,5 @@ "rc-checkbox": "~1.1.1", | ||
"rc-radio": "~2.0.0", | ||
"rc-select": "~4.8.1", | ||
"rc-select": "~4.8.5", | ||
"rc-slider": "~1.4.0", | ||
"rc-steps": "~1.1.4", | ||
"rc-steps": "~1.2.1", | ||
"rc-switch": "~1.2.0", | ||
@@ -66,5 +66,4 @@ "rc-table": "~3.1.0", | ||
"react-slick2": "~0.6.6", | ||
"reqwest": "~2.0.2", | ||
"velocity-animate": "^1.2.2", | ||
"xhr2": "~0.1.3" | ||
"reqwest-without-xhr2": "~2.0.2", | ||
"velocity-animate": "^1.2.2" | ||
}, | ||
@@ -71,0 +70,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
348060
31
46
12343
+ Addedreqwest-without-xhr2@~2.0.2
+ Addedrc-steps@1.2.4(transitive)
+ Addedreqwest-without-xhr2@2.0.2(transitive)
- Removedreqwest@~2.0.2
- Removedxhr2@~0.1.3
- Removedrc-steps@1.1.4(transitive)
- Removedreqwest@2.0.5(transitive)
- Removedxhr2@0.1.4(transitive)
Updatedrc-animate@~1.2.9
Updatedrc-select@~4.8.5
Updatedrc-steps@~1.2.1