mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6a617f2e9 | ||
|
|
1a790a5a9f | ||
|
|
2a411130bc | ||
|
|
bf22853f41 |
@@ -15,6 +15,13 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 3.4.4
|
||||
|
||||
`2018-04-28`
|
||||
|
||||
- 🐞 Fix that Upload file in`onChange({ file })` is not a File instance introduced in `3.4.2`. [#10293](https://github.com/ant-design/ant-design/issues/10293)
|
||||
- 🐞 Fix style lose bug when use tree shaking in webpack@4. [#10217](https://github.com/ant-design/ant-design/pull/10217) [@whtsky](https://github.com/whtsky)
|
||||
|
||||
## 3.4.3
|
||||
|
||||
`2018-04-23`
|
||||
|
||||
@@ -15,6 +15,12 @@ timeline: true
|
||||
|
||||
---
|
||||
|
||||
## 3.4.4
|
||||
|
||||
`2018-04-28`
|
||||
|
||||
- 🐞 修复 3.4.2 中引入的 Upload 中 onChange 参数 `{ file }` file 不是 File 实例的问题。[#10293](https://github.com/ant-design/ant-design/issues/10293)
|
||||
- 🐞 修复 webpack@4 下使用 Tree Shaking 样式丢失的问题。[#10217](https://github.com/ant-design/ant-design/pull/10217) [@whtsky](https://github.com/whtsky)
|
||||
|
||||
## 3.4.3
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ export default class Upload extends React.Component<UploadProps, UploadState> {
|
||||
const result = this.props.beforeUpload(file, fileList);
|
||||
if (result === false) {
|
||||
this.onChange({
|
||||
file: fileToObject(file),
|
||||
file,
|
||||
fileList: uniqBy(fileList.map(fileToObject).concat(this.state.fileList), (item: UploadFile) => item.uid),
|
||||
});
|
||||
return false;
|
||||
|
||||
@@ -54,13 +54,17 @@ describe('Upload', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should not stop upload when return value of beforeUpload is not false', (done) => {
|
||||
it('should not stop upload when return value of beforeUpload is false', (done) => {
|
||||
const mockFile = new File(['foo'], 'foo.png', {
|
||||
type: 'image/png',
|
||||
});
|
||||
const data = jest.fn();
|
||||
const props = {
|
||||
action: 'http://upload.com',
|
||||
beforeUpload: () => false,
|
||||
data,
|
||||
onChange: () => {
|
||||
onChange: ({ file }) => {
|
||||
expect(file instanceof File).toBe(true);
|
||||
expect(data).not.toBeCalled();
|
||||
done();
|
||||
},
|
||||
@@ -75,7 +79,7 @@ describe('Upload', () => {
|
||||
wrapper.find('input').simulate('change', {
|
||||
target: {
|
||||
files: [
|
||||
{ file: 'foo.png' },
|
||||
mockFile,
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ export interface UploadFile {
|
||||
name: string;
|
||||
filename?: string;
|
||||
lastModified?: number;
|
||||
lastModifiedDate?: Date;
|
||||
lastModrcFlieifiedDate?: Date;
|
||||
url?: string;
|
||||
status?: UploadFileStatus;
|
||||
percent?: number;
|
||||
|
||||
@@ -8,13 +8,8 @@ export function T() {
|
||||
// via coping a new Object
|
||||
export function fileToObject(file: RcFile): UploadFile {
|
||||
return {
|
||||
lastModified: file.lastModified,
|
||||
lastModifiedDate: file.lastModifiedDate,
|
||||
name: file.name,
|
||||
size: file.size,
|
||||
type: file.type,
|
||||
...file,
|
||||
percent: 0,
|
||||
uid: file.uid,
|
||||
originFileObj: file,
|
||||
} as UploadFile;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "antd",
|
||||
"version": "3.4.3",
|
||||
"version": "3.4.4",
|
||||
"title": "Ant Design",
|
||||
"description": "An enterprise-class UI design language and React-based implementation",
|
||||
"homepage": "http://ant.design/",
|
||||
@@ -84,6 +84,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/types": "7.0.0-beta.44",
|
||||
"@types/node": "^9.6.7",
|
||||
"@types/react": "^16.0.0",
|
||||
"@types/react-dom": "^16.0.0",
|
||||
"ansi-styles": "^3.2.0",
|
||||
@@ -213,6 +214,7 @@
|
||||
"lint-staged"
|
||||
],
|
||||
"sideEffects": [
|
||||
"es/**/style/*"
|
||||
"es/**/style/*",
|
||||
"lib/**/style/*"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user