Compare commits

...

4 Commits
6.2.3 ... 3.4.4

Author SHA1 Message Date
afc163
b6a617f2e9 Fix ts error temporarily, DefinitelyTyped/DefinitelyTyped#25342 2018-04-28 15:02:25 +08:00
afc163
1a790a5a9f 3.4.4 2018-04-28 14:32:20 +08:00
afc163
2a411130bc Fix upload onChange arg type when beforeUpload return false, close #10293 2018-04-28 14:17:29 +08:00
Wu Haotian
bf22853f41 add lib/**/style/* as sideEffects (#10217) 2018-04-28 14:17:01 +08:00
7 changed files with 27 additions and 13 deletions

View File

@@ -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`

View File

@@ -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

View File

@@ -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;

View File

@@ -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,
],
},
});

View File

@@ -16,7 +16,7 @@ export interface UploadFile {
name: string;
filename?: string;
lastModified?: number;
lastModifiedDate?: Date;
lastModrcFlieifiedDate?: Date;
url?: string;
status?: UploadFileStatus;
percent?: number;

View File

@@ -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;
}

View File

@@ -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/*"
]
}