From 929c56eb255b745d95e5c69af2947da7eff74e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <645381995@qq.com> Date: Wed, 4 Sep 2019 16:38:20 +0800 Subject: [PATCH 01/22] feat: upload add download icon --- .../__snapshots__/components.test.js.snap | 219 +++- components/locale/default.tsx | 1 + components/locale/zh_CN.tsx | 1 + components/upload/Upload.tsx | 5 +- components/upload/UploadList.tsx | 76 +- .../__tests__/__snapshots__/demo.test.js.snap | 886 ++++++++++---- .../__snapshots__/uploadlist.test.js.snap | 1071 +++++++++++------ components/upload/__tests__/upload.test.js | 33 +- .../upload/__tests__/uploadlist.test.js | 122 +- components/upload/index.en-US.md | 3 +- components/upload/index.zh-CN.md | 3 +- components/upload/interface.tsx | 9 +- components/upload/style/index.less | 30 +- 13 files changed, 1760 insertions(+), 699 deletions(-) diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap index c5a1285f3924..5be03a6d61a3 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap @@ -17339,30 +17339,61 @@ exports[`ConfigProvider components Upload configProvider 1`] = ` title="xxx.png" > xxx.png + + + + + + + + + + + + - - - @@ -17409,30 +17440,61 @@ exports[`ConfigProvider components Upload normal 1`] = ` title="xxx.png" > xxx.png + + + + + + + + + + + + - - - @@ -17479,30 +17541,61 @@ exports[`ConfigProvider components Upload prefixCls 1`] = ` title="xxx.png" > xxx.png + + + + + + + + + + + + - - - diff --git a/components/locale/default.tsx b/components/locale/default.tsx index 9ed202190d6f..788c25689c0e 100644 --- a/components/locale/default.tsx +++ b/components/locale/default.tsx @@ -42,6 +42,7 @@ export default { removeFile: 'Remove file', uploadError: 'Upload error', previewFile: 'Preview file', + downloadFile: 'Download file', }, Empty: { description: 'No Data', diff --git a/components/locale/zh_CN.tsx b/components/locale/zh_CN.tsx index 6dd924069e3f..67534a324a1f 100644 --- a/components/locale/zh_CN.tsx +++ b/components/locale/zh_CN.tsx @@ -42,6 +42,7 @@ export default { removeFile: '删除文件', uploadError: '上传错误', previewFile: '预览文件', + downloadFile: '下载文件', }, Empty: { description: '暂无数据', diff --git a/components/upload/Upload.tsx b/components/upload/Upload.tsx index 775c687d69e4..ed52105bfe63 100644 --- a/components/upload/Upload.tsx +++ b/components/upload/Upload.tsx @@ -246,11 +246,12 @@ class Upload extends React.Component { showUploadList, listType, onPreview, + onDownload, previewFile, disabled, locale: propLocale, } = this.props; - const { showRemoveIcon, showPreviewIcon } = showUploadList as any; + const { showRemoveIcon, showPreviewIcon, showDownloadIcon } = showUploadList as any; const { fileList } = this.state; return ( { items={fileList} previewFile={previewFile} onPreview={onPreview} + onDownload={onDownload} onRemove={this.handleManualRemove} showRemoveIcon={!disabled && showRemoveIcon} showPreviewIcon={showPreviewIcon} + showDownloadIcon={showDownloadIcon} locale={{ ...locale, ...propLocale }} /> ); diff --git a/components/upload/UploadList.tsx b/components/upload/UploadList.tsx index 5ffcf7e0868b..29fa839ea0d2 100644 --- a/components/upload/UploadList.tsx +++ b/components/upload/UploadList.tsx @@ -16,6 +16,7 @@ export default class UploadList extends React.Component { showInfo: false, }, showRemoveIcon: true, + showDownloadIcon: true, showPreviewIcon: true, previewFile: previewImage, }; @@ -56,6 +57,15 @@ export default class UploadList extends React.Component { return onPreview(file); }; + handleDownload = (file: UploadFile) => { + const { onDownload } = this.props; + if (typeof onDownload === 'function') { + onDownload(file); + } else if (file.url) { + window.open(file.url); + } + }; + handleClose = (file: UploadFile) => { const { onRemove } = this.props; if (onRemove) { @@ -70,6 +80,7 @@ export default class UploadList extends React.Component { listType, showPreviewIcon, showRemoveIcon, + showDownloadIcon, locale, progressAttr, } = this.props; @@ -128,18 +139,36 @@ export default class UploadList extends React.Component { }); const linkProps = typeof file.linkProps === 'string' ? JSON.parse(file.linkProps) : file.linkProps; - const preview = file.url ? ( - this.handlePreview(file, e)} + const downloadOrDelete = listType !== 'picture-card' && ( + - {file.name} - + {file.status === 'done' && ( + + this.handleDownload(file)} /> + + )} + + this.handleClose(file)} /> + + + ); + const preview = file.url ? ( + + this.handlePreview(file, e)} + > + {file.name} + + {downloadOrDelete} + ) : ( { title={file.name} > {file.name} + {downloadOrDelete} ); const style: React.CSSProperties = { @@ -168,18 +198,20 @@ export default class UploadList extends React.Component { const removeIcon = showRemoveIcon ? ( this.handleClose(file)} /> ) : null; - const removeIconClose = showRemoveIcon ? ( - this.handleClose(file)} /> + const downloadIcon = showDownloadIcon ? ( + this.handleDownload(file)} + /> ) : null; - const actions = - listType === 'picture-card' && file.status !== 'uploading' ? ( - - {previewIcon} - {removeIcon} - - ) : ( - removeIconClose - ); + const actions = listType === 'picture-card' && file.status !== 'uploading' && ( + + {previewIcon} + {file.status === 'done' && downloadIcon} + {removeIcon} + + ); let message; if (file.response && typeof file.response === 'string') { message = file.response; diff --git a/components/upload/__tests__/__snapshots__/demo.test.js.snap b/components/upload/__tests__/__snapshots__/demo.test.js.snap index d681b37ab3a0..f52be7e7f9f7 100644 --- a/components/upload/__tests__/__snapshots__/demo.test.js.snap +++ b/components/upload/__tests__/__snapshots__/demo.test.js.snap @@ -59,38 +59,72 @@ exports[`renders ./components/upload/demo/defaultFileList.md correctly 1`] = ` /> - - xxx.png - + + xxx.png + + + + + + + + + + + + + + - - - - - - - - - @@ -276,38 +354,72 @@ exports[`renders ./components/upload/demo/fileList.md correctly 1`] = ` /> - - xxx.png - + + xxx.png + + + + + + + + + + + + + + - - - @@ -342,15 +454,18 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - - image.png - + + image.png + + + + + - - image.png - + + image.png + + + + + - - image.png - + + image.png + + + + + - - image.png - + + image.png + + + + + - - image.png - + + image.png + + + + + - - xxx.png - + + xxx.png + + + + + + + + + + + + + + - - - - - - @@ -888,38 +1188,72 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - - xxx.png - + + xxx.png + + + + + + + + + + + + + + - - - - - - diff --git a/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap b/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap index 20a9c1020284..d609ca8a535c 100644 --- a/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap +++ b/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap @@ -58,30 +58,37 @@ exports[`Upload List handle error 1`] = ` title="foo.png" > foo.png + + + + + + + - - -
@@ -167,30 +174,37 @@ exports[`Upload List should be uploading when upload a file 1`] = ` title="foo.png" > foo.png + + + + + + +
- - -
@@ -276,30 +290,61 @@ exports[`Upload List should be uploading when upload a file 2`] = ` title="foo.png" > foo.png + + + + + + + + + + + +
- - -
@@ -392,38 +437,72 @@ exports[`Upload List should non-image format file preview 1`] = ` - - not-image - + + not-image + + + + + + + + + + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/upload/__tests__/upload.test.js b/components/upload/__tests__/upload.test.js index 07e2b408c1cb..05547abd50a8 100644 --- a/components/upload/__tests__/upload.test.js +++ b/components/upload/__tests__/upload.test.js @@ -367,7 +367,7 @@ describe('Upload', () => { }, ]; const wrapper = mount(); - const linkNode = wrapper.find('a.ant-upload-list-item-name'); + const linkNode = wrapper.find('span.ant-upload-list-item-name > a'); expect(linkNode.props().download).toBe('image'); expect(linkNode.props().rel).toBe('noopener'); }); @@ -387,7 +387,7 @@ describe('Upload', () => { }, ]; const wrapper = mount(); - const linkNode = wrapper.find('a.ant-upload-list-item-name'); + const linkNode = wrapper.find('span.ant-upload-list-item-name > a'); expect(linkNode.props().download).toBe('image'); expect(linkNode.props().rel).toBe('noopener'); }); @@ -408,7 +408,7 @@ describe('Upload', () => { const wrapper = mount(); - wrapper.find('div.ant-upload-list-item i.anticon-close').simulate('click'); + wrapper.find('div.ant-upload-list-item i.anticon-delete').simulate('click'); setImmediate(() => { wrapper.update(); @@ -420,6 +420,33 @@ describe('Upload', () => { }); }); + it('should not stop download when return use onDownload', done => { + const mockRemove = jest.fn(() => false); + const props = { + onRemove: mockRemove, + fileList: [ + { + uid: '-1', + name: 'foo.png', + status: 'done', + url: 'http://www.baidu.com/xxx.png', + }, + ], + }; + + const wrapper = mount( {}} />); + + wrapper.find('div.ant-upload-list-item i.anticon-download').simulate('click'); + + setImmediate(() => { + wrapper.update(); + + expect(props.fileList).toHaveLength(1); + expect(props.fileList[0].status).toBe('done'); + done(); + }); + }); + // https://github.com/ant-design/ant-design/issues/14439 it('should allow call abort function through upload instance', () => { const wrapper = mount( diff --git a/components/upload/__tests__/uploadlist.test.js b/components/upload/__tests__/uploadlist.test.js index 8690ba6d27c8..1d8c236409dc 100644 --- a/components/upload/__tests__/uploadlist.test.js +++ b/components/upload/__tests__/uploadlist.test.js @@ -121,7 +121,7 @@ describe('Upload List', () => { wrapper .find('.ant-upload-list-item') .at(0) - .find('.anticon-close') + .find('.anticon-delete') .simulate('click'); await sleep(400); wrapper.update(); @@ -202,6 +202,36 @@ describe('Upload List', () => { expect(handleChange.mock.calls[0][0].fileList).toHaveLength(3); }); + it('In the case of listType=picture, the error status does not show the download.', () => { + const file = { status: 'error', uid: 'file' }; + const wrapper = mount( + + + , + ); + expect(wrapper.find('div.ant-upload-list-item i.anticon-download').length).toBe(0); + }); + + it('In the case of listType=picture-card, the error status does not show the download.', () => { + const file = { status: 'error', uid: 'file' }; + const wrapper = mount( + + + , + ); + expect(wrapper.find('div.ant-upload-list-item i.anticon-download').length).toBe(0); + }); + + it('In the case of listType=text, the error status does not show the download.', () => { + const file = { status: 'error', uid: 'file' }; + const wrapper = mount( + + + , + ); + expect(wrapper.find('div.ant-upload-list-item i.anticon-download').length).toBe(0); + }); + it('should support onPreview', () => { const handlePreview = jest.fn(); const wrapper = mount( @@ -248,6 +278,52 @@ describe('Upload List', () => { expect(handleChange.mock.calls.length).toBe(2); }); + it('should support onDownload', async () => { + const handleDownload = jest.fn(); + const wrapper = mount( + + + , + ); + wrapper + .find('.anticon-download') + .at(0) + .simulate('click'); + }); + + it('should support no onDownload', async () => { + const wrapper = mount( + + + , + ); + wrapper + .find('.anticon-download') + .at(0) + .simulate('click'); + }); + describe('should generate thumbUrl from file', () => { [ { width: 100, height: 200, name: 'height large than width' }, @@ -431,6 +507,13 @@ describe('Upload List', () => { expect(wrapper.handlePreview()).toBe(undefined); }); + it('return when prop onDownload not exists', () => { + const file = new File([''], 'test.txt', { type: 'text/plain' }); + const items = [{ uid: 'upload-list-item', url: '' }]; + const wrapper = mount().instance(); + expect(wrapper.handleDownload(file)).toBe(undefined); + }); + it('previewFile should work correctly', async () => { const file = new File([''], 'test.txt', { type: 'text/plain' }); const items = [{ uid: 'upload-list-item', url: '' }]; @@ -440,6 +523,28 @@ describe('Upload List', () => { return wrapper.props.previewFile(file); }); + it('downloadFile should work correctly', async () => { + const file = new File([''], 'test.txt', { type: 'text/plain' }); + const items = [{ uid: 'upload-list-item', url: '' }]; + const wrapper = mount( + {}} + locale={{ downloadFile: '' }} + />, + ).instance(); + return wrapper.props.onDownload(file); + }); + + it('downloadFile is true should work correctly', async () => { + const items = [{ uid: 'upload-list-item', url: '' }]; + const wrapper = mount( + , + ).instance(); + return expect(wrapper.props.onDownload).toBe(true); + }); + it('extname should work correctly when url not exists', () => { const items = [{ uid: 'upload-list-item', url: '' }]; const wrapper = mount( @@ -448,6 +553,21 @@ describe('Upload List', () => { expect(wrapper.find('.ant-upload-list-item-thumbnail').length).toBe(2); }); + it('extname should work correctly when url exists', () => { + const items = [{ status: 'done', uid: 'upload-list-item', url: '/example' }]; + const wrapper = mount( + { + expect(file.url).toBe('/example'); + }} + items={items} + locale={{ downloadFile: '' }} + />, + ); + wrapper.find('div.ant-upload-list-item i.anticon-download').simulate('click'); + }); + it('when picture-card is loading, icon should render correctly', () => { const items = [{ status: 'uploading', uid: 'upload-list-item' }]; const wrapper = mount( diff --git a/components/upload/index.en-US.md b/components/upload/index.en-US.md index c0b1e33e1223..e04df9d34dac 100644 --- a/components/upload/index.en-US.md +++ b/components/upload/index.en-US.md @@ -32,13 +32,14 @@ Uploading is the process of publishing information (web pages, text, pictures, v | multiple | Whether to support selected multiple file. `IE10+` supported. You can select multiple files with CTRL holding down while multiple is set to be true | boolean | false | | | name | The name of uploading file | string | 'file' | | | previewFile | Customize preview file logic | (file: File \| Blob) => Promise | - | 3.17.0 | -| showUploadList | Whether to show default upload list, could be an object to specify `showPreviewIcon` and `showRemoveIcon` individually | Boolean or { showPreviewIcon?: boolean, showRemoveIcon?: boolean } | true | | +| showUploadList | Whether to show default upload list, could be an object to specify `showPreviewIcon`, `showRemoveIcon` and `showDownloadIcon` individually | Boolean or { showPreviewIcon?: boolean, showRemoveIcon?: boolean } | true | | | supportServerRender | Need to be turned on while the server side is rendering | boolean | false | | | withCredentials | ajax upload with cookie sent | boolean | false | | | openFileDialogOnClick | click open file dialog | boolean | true | 3.10.0 | | onChange | A callback function, can be executed when uploading state is changing, see [onChange](#onChange) | Function | - | | | onPreview | A callback function, will be executed when file link or preview icon is clicked | Function(file) | - | | | onRemove | A callback function, will be executed when removing file button is clicked, remove event will be prevented when return value is `false` or a Promise which resolve(false) or reject | Function(file): `boolean | Promise` | - | | +| onDownload | Click the method to download the file, pass the method to perform the method logic, do not pass the default jump to the new TAB. | Function(file): void | Jump to new TAB | | | transformFile   | Customize transform file before request | Function(file): `string | Blob | File | Promise` | - | 3.21.0 | ### onChange diff --git a/components/upload/index.zh-CN.md b/components/upload/index.zh-CN.md index 3a1d5f5b528e..a51fb0e8116f 100644 --- a/components/upload/index.zh-CN.md +++ b/components/upload/index.zh-CN.md @@ -33,13 +33,14 @@ title: Upload | multiple | 是否支持多选文件,`ie10+` 支持。开启后按住 ctrl 可选择多个文件 | boolean | false | | | name | 发到后台的文件参数名 | string | 'file' | | | previewFile | 自定义文件预览逻辑 | (file: File \| Blob) => Promise | 无 | 3.17.0 | -| showUploadList | 是否展示文件列表, 可设为一个对象,用于单独设定 `showPreviewIcon` 和 `showRemoveIcon` | Boolean or { showPreviewIcon?: boolean, showRemoveIcon?: boolean } | true | | +| showUploadList | 是否展示文件列表, 可设为一个对象,用于单独设定 `showPreviewIcon`, `showRemoveIcon` 和 `showDownloadIcon` | Boolean or { showPreviewIcon?: boolean, showRemoveIcon?: boolean, showDownloadIcon?: boolean } | true | | | supportServerRender | 服务端渲染时需要打开这个 | boolean | false | | | withCredentials | 上传请求时是否携带 cookie | boolean | false | | | openFileDialogOnClick | 点击打开文件对话框 | boolean | true | 3.10.0 | | onChange | 上传文件改变时的状态,详见 [onChange](#onChange) | Function | 无 | | | onPreview | 点击文件链接或预览图标时的回调 | Function(file) | 无 | | | onRemove   | 点击移除文件时的回调,返回值为 false 时不移除。支持返回一个 Promise 对象,Promise 对象 resolve(false) 或 reject 时不移除。               | Function(file): `boolean | Promise` | 无   | | +| onDownload | 点击下载文件时的方法,传方法择执行方法逻辑,不传则默认跳转新标签页。 | Function(file): void | 跳转新标签页 | | | transformFile   | 在上传之前转换文件。支持返回一个 Promise 对象   | Function(file): `string | Blob | File | Promise` | 无   | 3.21.0 | ### onChange diff --git a/components/upload/interface.tsx b/components/upload/interface.tsx index f24b2ff8435d..b5326ead3c4d 100755 --- a/components/upload/interface.tsx +++ b/components/upload/interface.tsx @@ -40,11 +40,13 @@ export interface UploadChangeParam { export interface ShowUploadListInterface { showRemoveIcon?: boolean; showPreviewIcon?: boolean; + showDownloadIcon?: boolean; } export interface UploadLocale { uploading?: string; removeFile?: string; + downloadFile?: string; uploadError?: string; previewFile?: string; } @@ -53,7 +55,9 @@ export type UploadType = 'drag' | 'select'; export type UploadListType = 'text' | 'picture' | 'picture-card'; type PreviewFileHandler = (file: File | Blob) => PromiseLike; -type TransformFileHandler = (file: UploadFile) => string | Blob | File | PromiseLike; +type TransformFileHandler = ( + file: UploadFile, +) => string | Blob | File | PromiseLike; export interface UploadProps { type?: UploadType; @@ -72,6 +76,7 @@ export interface UploadProps { listType?: UploadListType; className?: string; onPreview?: (file: UploadFile) => void; + onDownload?: (file: UploadFile) => void; onRemove?: (file: UploadFile) => void | boolean | Promise; supportServerRender?: boolean; style?: React.CSSProperties; @@ -94,11 +99,13 @@ export interface UploadState { export interface UploadListProps { listType?: UploadListType; onPreview?: (file: UploadFile) => void; + onDownload?: (file: UploadFile) => void; onRemove?: (file: UploadFile) => void | boolean; items?: Array; progressAttr?: Object; prefixCls?: string; showRemoveIcon?: boolean; + showDownloadIcon?: boolean; showPreviewIcon?: boolean; locale: UploadLocale; previewFile?: PreviewFileHandler; diff --git a/components/upload/style/index.less b/components/upload/style/index.less index 328278335903..fc027122a0b4 100644 --- a/components/upload/style/index.less +++ b/components/upload/style/index.less @@ -147,13 +147,27 @@ font-size: @font-size-base; &-name { display: inline-block; - width: 100%; padding-left: @font-size-base + 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } + &-card-actions { + position: absolute; + right: 0; + opacity: 0; + &.picture { + top: 25px; + line-height: 1; + opacity: 1; + } + .anticon { + padding-right: 5px; + color: rgba(0, 0, 0, 0.45); + } + } + &-info { height: 100%; padding: 0 12px 0 4px; @@ -196,14 +210,21 @@ opacity: 1; } + &:hover &-card-actions { + opacity: 1; + } + &-error, &-error .@{iconfont-css-prefix}-paper-clip, &-error &-name { color: @error-color; } - &-error .@{iconfont-css-prefix}-close { - color: @error-color !important; + &-error &-card-actions { + .anticon { + padding-right: 5px; + color: @error-color; + } opacity: 1; } @@ -281,7 +302,7 @@ box-sizing: border-box; max-width: 100%; margin: 0 0 0 8px; - padding-right: 8px; + padding-right: 48px; padding-left: 48px; overflow: hidden; line-height: 44px; @@ -353,6 +374,7 @@ transition: all 0.3s; .@{iconfont-css-prefix}-eye-o, + .@{iconfont-css-prefix}-download, .@{iconfont-css-prefix}-delete { z-index: 10; width: 16px; From 8bf444be82ae8a058cfe76c3c7732fb33729e8b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <645381995@qq.com> Date: Wed, 4 Sep 2019 19:08:37 +0800 Subject: [PATCH 02/22] feat: clear up --- CHANGELOG.en-US.md | 4 + CHANGELOG.zh-CN.md | 4 + components/upload/UploadList.tsx | 5 +- .../__tests__/__snapshots__/demo.test.js.snap | 897 +++++++------- .../__snapshots__/uploadlist.test.js.snap | 1070 ++++++++--------- components/upload/__tests__/upload.test.js | 4 +- components/upload/index.en-US.md | 2 +- components/upload/index.zh-CN.md | 2 +- components/upload/style/index.less | 3 +- 9 files changed, 966 insertions(+), 1025 deletions(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 82b8d352191d..d5a92c1a2689 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -15,6 +15,10 @@ timeline: true --- +## 3.22.2 + +- 🔥 add download icon of Upload。[#18664](https://github.com/ant-design/ant-design/pull/18664) + ## 3.22.1 - 🔥 The official website now supports the search icon through the picture! [#18425](https://github.com/ant-design/ant-design/pull/18425) diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index 3b4898eb3048..e4e29e7f0211 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -15,6 +15,10 @@ timeline: true --- +## 3.22.2 + +- 🔥 新增 Upload 添加下载图标。[#18664](https://github.com/ant-design/ant-design/pull/18664) + ## 3.22.1 - 🔥 官网现在支持通过图片搜索图标啦![#18425](https://github.com/ant-design/ant-design/pull/18425) diff --git a/components/upload/UploadList.tsx b/components/upload/UploadList.tsx index 29fa839ea0d2..3f5974e13bcc 100644 --- a/components/upload/UploadList.tsx +++ b/components/upload/UploadList.tsx @@ -156,10 +156,11 @@ export default class UploadList extends React.Component { ); const preview = file.url ? ( - + <> { {file.name} {downloadOrDelete} - + ) : ( - + xxx.png + + - xxx.png - - - - - - + + + + + - - - + + + + @@ -152,69 +149,66 @@ exports[`renders ./components/upload/demo/defaultFileList.md correctly 1`] = ` /> - + yyy.png + + - yyy.png - - - - - - + + + + + - - - + + + + @@ -245,45 +239,42 @@ exports[`renders ./components/upload/demo/defaultFileList.md correctly 1`] = ` /> - + zzz.png + + - zzz.png - - - - - - + + + + @@ -354,69 +345,66 @@ exports[`renders ./components/upload/demo/fileList.md correctly 1`] = ` /> - + xxx.png + + - xxx.png - - - - - - + + + + + - - - + + + + @@ -454,18 +442,15 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - - - image.png - - + image.png + - - - image.png - - + image.png + - - - image.png - - + image.png + - - - image.png - - + image.png + - - - image.png - - + image.png + - + xxx.png + + - xxx.png - - - - - - + + + + + - - - + + + + @@ -1089,69 +1059,66 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - + yyy.png + + - yyy.png - - - - - - + + + + + - - - + + + + @@ -1188,69 +1155,66 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - + xxx.png + + - xxx.png - - - - - - + + + + + - - - + + + + @@ -1274,69 +1238,66 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - + yyy.png + + - yyy.png - - - - - - + + + + + - - - + + + + diff --git a/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap b/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap index d609ca8a535c..705bff6dc5e8 100644 --- a/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap +++ b/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap @@ -437,69 +437,66 @@ exports[`Upload List should non-image format file preview 1`] = ` - + not-image + + - not-image - - - - - - + + + + + - - - + + + + @@ -523,69 +520,66 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/aaa" /> - + image + + - image - - - - - - + + + + + - - - + + + + @@ -628,69 +622,66 @@ exports[`Upload List should non-image format file preview 1`] = ` - + not-image + + - not-image - - - - - - + + + + + - - - + + + + @@ -733,69 +724,66 @@ exports[`Upload List should non-image format file preview 1`] = ` - + not-image + + - not-image - - - - - - + + + + + - - - + + + + @@ -819,69 +807,66 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/xx.xx/aaa.png" /> - + image + + - image + + + - - - - - - - - - - + + + + @@ -905,69 +890,66 @@ exports[`Upload List should non-image format file preview 1`] = ` src="data:image/png;base64,UEsDBAoAAAAAADYZYkwAAAAAAAAAAAAAAAAdAAk" /> - + image + + - image - - - - - - + + + + + - - - + + + + @@ -991,69 +973,66 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/xx.xx/aaa.png?query=123" /> - + image + + - image - - - - - - + + + + + - - - + + + + @@ -1077,69 +1056,66 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/xx.xx/aaa.png#anchor" /> - + image + + - image - - - - - - + + + + + - - - + + + + @@ -1163,69 +1139,66 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/xx.xx/aaa.png?query=some.query.with.dot" /> - + image + + - image - - - - - - + + + + + - - - + + + + @@ -1249,69 +1222,66 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://publish-pic-cpu.baidu.com/1296beb3-50d9-4276-885f-52645cbb378e.jpeg@w_228%2ch_152" /> - + image + + - image - - - - - - + + + + + - - - + + + + diff --git a/components/upload/__tests__/upload.test.js b/components/upload/__tests__/upload.test.js index 05547abd50a8..8f1f416f4a3c 100644 --- a/components/upload/__tests__/upload.test.js +++ b/components/upload/__tests__/upload.test.js @@ -367,7 +367,7 @@ describe('Upload', () => { }, ]; const wrapper = mount(); - const linkNode = wrapper.find('span.ant-upload-list-item-name > a'); + const linkNode = wrapper.find('a.ant-upload-list-item-name'); expect(linkNode.props().download).toBe('image'); expect(linkNode.props().rel).toBe('noopener'); }); @@ -387,7 +387,7 @@ describe('Upload', () => { }, ]; const wrapper = mount(); - const linkNode = wrapper.find('span.ant-upload-list-item-name > a'); + const linkNode = wrapper.find('a.ant-upload-list-item-name'); expect(linkNode.props().download).toBe('image'); expect(linkNode.props().rel).toBe('noopener'); }); diff --git a/components/upload/index.en-US.md b/components/upload/index.en-US.md index e04df9d34dac..62671e73eed8 100644 --- a/components/upload/index.en-US.md +++ b/components/upload/index.en-US.md @@ -32,7 +32,7 @@ Uploading is the process of publishing information (web pages, text, pictures, v | multiple | Whether to support selected multiple file. `IE10+` supported. You can select multiple files with CTRL holding down while multiple is set to be true | boolean | false | | | name | The name of uploading file | string | 'file' | | | previewFile | Customize preview file logic | (file: File \| Blob) => Promise | - | 3.17.0 | -| showUploadList | Whether to show default upload list, could be an object to specify `showPreviewIcon`, `showRemoveIcon` and `showDownloadIcon` individually | Boolean or { showPreviewIcon?: boolean, showRemoveIcon?: boolean } | true | | +| showUploadList | Whether to show default upload list, could be an object to specify `showPreviewIcon`, `showRemoveIcon` and `showDownloadIcon` individually | Boolean or { showPreviewIcon?: boolean, showDownloadIcon?: boolean, showRemoveIcon?: boolean } | true | | | supportServerRender | Need to be turned on while the server side is rendering | boolean | false | | | withCredentials | ajax upload with cookie sent | boolean | false | | | openFileDialogOnClick | click open file dialog | boolean | true | 3.10.0 | diff --git a/components/upload/index.zh-CN.md b/components/upload/index.zh-CN.md index a51fb0e8116f..38a732fc4d4b 100644 --- a/components/upload/index.zh-CN.md +++ b/components/upload/index.zh-CN.md @@ -40,7 +40,7 @@ title: Upload | onChange | 上传文件改变时的状态,详见 [onChange](#onChange) | Function | 无 | | | onPreview | 点击文件链接或预览图标时的回调 | Function(file) | 无 | | | onRemove   | 点击移除文件时的回调,返回值为 false 时不移除。支持返回一个 Promise 对象,Promise 对象 resolve(false) 或 reject 时不移除。               | Function(file): `boolean | Promise` | 无   | | -| onDownload | 点击下载文件时的方法,传方法择执行方法逻辑,不传则默认跳转新标签页。 | Function(file): void | 跳转新标签页 | | +| onDownload | 点击下载文件时的回调,如果没有指定,则默认跳转到文件 url 对应的标签页。 | Function(file): void | 跳转新标签页 | | | transformFile   | 在上传之前转换文件。支持返回一个 Promise 对象   | Function(file): `string | Blob | File | Promise` | 无   | 3.21.0 | ### onChange diff --git a/components/upload/style/index.less b/components/upload/style/index.less index fc027122a0b4..2a30d8d6c869 100644 --- a/components/upload/style/index.less +++ b/components/upload/style/index.less @@ -147,7 +147,8 @@ font-size: @font-size-base; &-name { display: inline-block; - padding-left: @font-size-base + 8px; + width: 100%; + padding: 0 28px 0 @font-size-base + 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; From 3f0c684185b138b1b9bff5d3333b9fe494192eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <645381995@qq.com> Date: Wed, 4 Sep 2019 19:12:34 +0800 Subject: [PATCH 03/22] feat: log --- CHANGELOG.en-US.md | 1 + CHANGELOG.zh-CN.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index d5a92c1a2689..02edb9e9daf3 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -18,6 +18,7 @@ timeline: true ## 3.22.2 - 🔥 add download icon of Upload。[#18664](https://github.com/ant-design/ant-design/pull/18664) +- 🐞 Fix `close` replace `remove` on Upload。[#18664](https://github.com/ant-design/ant-design/issues/18664) ## 3.22.1 diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index e4e29e7f0211..5f2b7d3d057c 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -18,6 +18,7 @@ timeline: true ## 3.22.2 - 🔥 新增 Upload 添加下载图标。[#18664](https://github.com/ant-design/ant-design/pull/18664) +- 🐞 修复 Upload 组件的 `close` 替换 `remove`。[#18664](https://github.com/ant-design/ant-design/issues/18664) ## 3.22.1 From cc13047e5bdcbbd7a9b247dabc224065b00f1400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <645381995@qq.com> Date: Wed, 4 Sep 2019 20:03:38 +0800 Subject: [PATCH 04/22] empty From 552fc6749c3f09eda345b17f7387cc91fb1b4fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <645381995@qq.com> Date: Wed, 4 Sep 2019 20:10:22 +0800 Subject: [PATCH 05/22] =?UTF-8?q?feat:=20=E7=90=86=E8=A7=A3=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.en-US.md | 2 -- CHANGELOG.zh-CN.md | 2 -- 2 files changed, 4 deletions(-) diff --git a/CHANGELOG.en-US.md b/CHANGELOG.en-US.md index 09ce5fb9d851..1f306ba96fed 100644 --- a/CHANGELOG.en-US.md +++ b/CHANGELOG.en-US.md @@ -24,8 +24,6 @@ timeline: true - 🐞 Fix Input.Password crash with `Cannot read property 'input' of null` when unmount. [#18475](https://github.com/ant-design/ant-design/pull/18475) - 🐞 Fix Table `style` should applied to outside wrapper. [#18494](https://github.com/ant-design/ant-design/pull/18494) - 🐞 Fix PageHeader default english text. [#18471](https://github.com/ant-design/ant-design/pull/18471) [@hjiawei](https://github.com/hjiawei) -- 🔥 add download icon of Upload。[#18664](https://github.com/ant-design/ant-design/pull/18664) -- 🐞 Fix `close` replace `remove` on Upload。[#18664](https://github.com/ant-design/ant-design/issues/18664) ## 3.22.1 diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index e85e64e5c96d..db1e61ff4ccf 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -24,8 +24,6 @@ timeline: true - 🐞 修复 Input.Password unmount 时报错 `Cannot read property 'input' of null`。[#18475](https://github.com/ant-design/ant-design/pull/18475) - 🐞 修正 Table `style` 属性到最外层容器。[#18494](https://github.com/ant-design/ant-design/pull/18494) - 🐞 修正 PageHeader 默认英文文案。[#18471](https://github.com/ant-design/ant-design/pull/18471) [@hjiawei](https://github.com/hjiawei) -- 🔥 新增 Upload 添加下载图标。[#18664](https://github.com/ant-design/ant-design/pull/18664) -- 🐞 修复 Upload 组件的 `close` 替换 `remove`。[#18664](https://github.com/ant-design/ant-design/issues/18664) ## 3.22.1 From 950a319f2685e99f5e6ee506533fbe58ed319869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <645381995@qq.com> Date: Thu, 5 Sep 2019 18:50:48 +0800 Subject: [PATCH 06/22] feat: test --- .../Table.rowSelection.test.js.snap | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 74 +++++++++---------- .../__snapshots__/empty.test.js.snap | 2 +- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap b/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap index b6719b3a1faf..a4c0c97c469a 100644 --- a/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap +++ b/components/table/__tests__/__snapshots__/Table.rowSelection.test.js.snap @@ -11,7 +11,7 @@ exports[`Table.rowSelection fix selection column on the left 1`] = ` class="ant-spin-container" >
New York No. 1 Lake Park, New York No. 1 Lake Park New York No. 1 Lake Park, New York No. 1 Lake Park New York No. 1 Lake Park, New York No. 1 Lake Park New York No. 1 Lake Park, New York No. 1 Lake Park @@ -4665,22 +4665,22 @@ exports[`renders ./components/table/demo/ellipsis.md correctly 1`] = ` 42 London No. 2 Lake Park, London No. 2 Lake Park London No. 2 Lake Park, London No. 2 Lake Park London No. 2 Lake Park, London No. 2 Lake Park London No. 2 Lake Park, London No. 2 Lake Park @@ -4702,22 +4702,22 @@ exports[`renders ./components/table/demo/ellipsis.md correctly 1`] = ` 32 Sidney No. 1 Lake Park, Sidney No. 1 Lake Park Sidney No. 1 Lake Park, Sidney No. 1 Lake Park Sidney No. 1 Lake Park, Sidney No. 1 Lake Park Sidney No. 1 Lake Park, Sidney No. 1 Lake Park @@ -5439,7 +5439,7 @@ exports[`renders ./components/table/demo/fixed-columns.md correctly 1`] = ` class="ant-spin-container" >
John Brown 32 New York No. 1 Lake Park @@ -11722,17 +11722,17 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` data-row-key="2" > Jim Green 42 London No. 1 Lake Park @@ -11742,17 +11742,17 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` data-row-key="3" > Joe Black 32 Sidney No. 1 Lake Park @@ -11762,17 +11762,17 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` data-row-key="4" > Jim Red 32 London No. 2 Lake Park diff --git a/components/table/__tests__/__snapshots__/empty.test.js.snap b/components/table/__tests__/__snapshots__/empty.test.js.snap index 5ea5d8c18dbf..4073fd0381e8 100644 --- a/components/table/__tests__/__snapshots__/empty.test.js.snap +++ b/components/table/__tests__/__snapshots__/empty.test.js.snap @@ -453,7 +453,7 @@ exports[`Table renders empty table with fixed columns 1`] = ` class="ant-spin-container" >
Date: Sat, 7 Sep 2019 11:28:27 +0800 Subject: [PATCH 07/22] test --- .../__snapshots__/components.test.js.snap | 12 +- .../__tests__/__snapshots__/demo.test.js.snap | 16 +-- .../__tests__/__snapshots__/demo.test.js.snap | 32 ++--- .../__tests__/__snapshots__/demo.test.js.snap | 130 +++++++++--------- .../Table.rowSelection.test.js.snap | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 74 +++++----- .../__snapshots__/empty.test.js.snap | 2 +- .../__tests__/__snapshots__/demo.test.js.snap | 4 +- 8 files changed, 136 insertions(+), 136 deletions(-) diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap index c3d062417c1f..7924ebab4bb5 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap @@ -11085,7 +11085,7 @@ exports[`ConfigProvider components Slider configProvider 1`] = ` />
@@ -11134,7 +11134,7 @@ exports[`ConfigProvider components Slider normal 1`] = ` />
@@ -11183,7 +11183,7 @@ exports[`ConfigProvider components Slider prefixCls 1`] = ` />
diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap index 4363ca441c0c..684b2397ed69 100644 --- a/components/form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form/__tests__/__snapshots__/demo.test.js.snap @@ -3343,7 +3343,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = ` />
A B C D E F diff --git a/components/grid/__tests__/__snapshots__/demo.test.js.snap b/components/grid/__tests__/__snapshots__/demo.test.js.snap index 27b8a0c86982..2b38e970a778 100644 --- a/components/grid/__tests__/__snapshots__/demo.test.js.snap +++ b/components/grid/__tests__/__snapshots__/demo.test.js.snap @@ -480,7 +480,7 @@ exports[`renders ./components/grid/demo/playground.md correctly 1`] = ` />
8 16 24 32 40 48 @@ -578,7 +578,7 @@ exports[`renders ./components/grid/demo/playground.md correctly 1`] = ` />
2 3 4 6 8 12 diff --git a/components/slider/__tests__/__snapshots__/demo.test.js.snap b/components/slider/__tests__/__snapshots__/demo.test.js.snap index 2c4c6aef5d42..ff3f8bc4e573 100644 --- a/components/slider/__tests__/__snapshots__/demo.test.js.snap +++ b/components/slider/__tests__/__snapshots__/demo.test.js.snap @@ -10,7 +10,7 @@ exports[`renders ./components/slider/demo/basic.md correctly 1`] = ` />
0°C 26°C 37°C 100°C @@ -548,7 +548,7 @@ exports[`renders ./components/slider/demo/mark.md correctly 1`] = ` />
0°C 26°C 37°C 100°C @@ -657,7 +657,7 @@ exports[`renders ./components/slider/demo/mark.md correctly 1`] = ` aria-valuenow="37" class="ant-slider-handle" role="slider" - style="left:37%;right:auto;transform:translateX(-50%)" + style="left:37%" tabindex="0" />
0°C 26°C 37°C 100°C @@ -702,7 +702,7 @@ exports[`renders ./components/slider/demo/mark.md correctly 1`] = ` />
0°C 26°C 37°C 100°C @@ -776,7 +776,7 @@ exports[`renders ./components/slider/demo/mark.md correctly 1`] = ` />
0°C 26°C 37°C 100°C @@ -852,7 +852,7 @@ exports[`renders ./components/slider/demo/reverse.md correctly 1`] = ` />
@@ -982,7 +982,7 @@ exports[`renders ./components/slider/demo/tip-formatter.md correctly 1`] = ` />
New York No. 1 Lake Park, New York No. 1 Lake Park New York No. 1 Lake Park, New York No. 1 Lake Park New York No. 1 Lake Park, New York No. 1 Lake Park New York No. 1 Lake Park, New York No. 1 Lake Park @@ -4665,22 +4665,22 @@ exports[`renders ./components/table/demo/ellipsis.md correctly 1`] = ` 42 London No. 2 Lake Park, London No. 2 Lake Park London No. 2 Lake Park, London No. 2 Lake Park London No. 2 Lake Park, London No. 2 Lake Park London No. 2 Lake Park, London No. 2 Lake Park @@ -4702,22 +4702,22 @@ exports[`renders ./components/table/demo/ellipsis.md correctly 1`] = ` 32 Sidney No. 1 Lake Park, Sidney No. 1 Lake Park Sidney No. 1 Lake Park, Sidney No. 1 Lake Park Sidney No. 1 Lake Park, Sidney No. 1 Lake Park Sidney No. 1 Lake Park, Sidney No. 1 Lake Park @@ -5439,7 +5439,7 @@ exports[`renders ./components/table/demo/fixed-columns.md correctly 1`] = ` class="ant-spin-container" >
John Brown 32 New York No. 1 Lake Park @@ -11722,17 +11722,17 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` data-row-key="2" > Jim Green 42 London No. 1 Lake Park @@ -11742,17 +11742,17 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` data-row-key="3" > Joe Black 32 Sidney No. 1 Lake Park @@ -11762,17 +11762,17 @@ exports[`renders ./components/table/demo/reset-filter.md correctly 1`] = ` data-row-key="4" > Jim Red 32 London No. 2 Lake Park diff --git a/components/table/__tests__/__snapshots__/empty.test.js.snap b/components/table/__tests__/__snapshots__/empty.test.js.snap index 4073fd0381e8..5ea5d8c18dbf 100644 --- a/components/table/__tests__/__snapshots__/empty.test.js.snap +++ b/components/table/__tests__/__snapshots__/empty.test.js.snap @@ -453,7 +453,7 @@ exports[`Table renders empty table with fixed columns 1`] = ` class="ant-spin-container" >
Date: Sat, 7 Sep 2019 15:24:21 +0800 Subject: [PATCH 08/22] feat: clean up --- .../__snapshots__/components.test.js.snap | 237 ++++++------------ 1 file changed, 72 insertions(+), 165 deletions(-) diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap index 7924ebab4bb5..77328cac9e57 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap @@ -6496,7 +6496,7 @@ exports[`ConfigProvider components DatePicker RangePicker configProvider 1`] = ` - ~ + ~ - ~ + ~ - ~ + ~
@@ -11134,7 +11134,7 @@ exports[`ConfigProvider components Slider normal 1`] = ` />
@@ -11183,7 +11183,7 @@ exports[`ConfigProvider components Slider prefixCls 1`] = ` />
@@ -17339,61 +17339,30 @@ exports[`ConfigProvider components Upload configProvider 1`] = ` title="xxx.png" > xxx.png - - - - - - - - - - - -
+ + +
@@ -17440,61 +17409,30 @@ exports[`ConfigProvider components Upload normal 1`] = ` title="xxx.png" > xxx.png - - - - - - - - - - - -
+ + +
@@ -17541,61 +17479,30 @@ exports[`ConfigProvider components Upload prefixCls 1`] = ` title="xxx.png" > xxx.png - - - - - - - - - - - -
+ + +
From 742bafb3bbf677be29e0694e0f2c78c9a149c1e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= Date: Sat, 7 Sep 2019 15:26:08 +0800 Subject: [PATCH 09/22] Update components.test.js.snap --- .../__tests__/__snapshots__/components.test.js.snap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap index 77328cac9e57..9a2be2ad9ca0 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap @@ -6496,7 +6496,7 @@ exports[`ConfigProvider components DatePicker RangePicker configProvider 1`] = ` - ~ + ~ - ~ + ~ - ~ + ~ Date: Sat, 7 Sep 2019 15:28:14 +0800 Subject: [PATCH 10/22] Update demo.test.js.snap --- .../__tests__/__snapshots__/demo.test.js.snap | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap index 684b2397ed69..4363ca441c0c 100644 --- a/components/form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form/__tests__/__snapshots__/demo.test.js.snap @@ -3343,7 +3343,7 @@ exports[`renders ./components/form/demo/validate-other.md correctly 1`] = ` />
A B C D E F From c84ebe4b4ff35d5c5d25e2178bfc1553263af82e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= Date: Sat, 7 Sep 2019 15:28:46 +0800 Subject: [PATCH 11/22] Update demo.test.js.snap --- .../__tests__/__snapshots__/demo.test.js.snap | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/components/grid/__tests__/__snapshots__/demo.test.js.snap b/components/grid/__tests__/__snapshots__/demo.test.js.snap index 2b38e970a778..27b8a0c86982 100644 --- a/components/grid/__tests__/__snapshots__/demo.test.js.snap +++ b/components/grid/__tests__/__snapshots__/demo.test.js.snap @@ -480,7 +480,7 @@ exports[`renders ./components/grid/demo/playground.md correctly 1`] = ` />
8 16 24 32 40 48 @@ -578,7 +578,7 @@ exports[`renders ./components/grid/demo/playground.md correctly 1`] = ` />
2 3 4 6 8 12 From 6fc4023f3c35a625aeb70b2ac7ea9b52d6054423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= Date: Sat, 7 Sep 2019 15:29:24 +0800 Subject: [PATCH 12/22] Update demo.test.js.snap --- .../__tests__/__snapshots__/demo.test.js.snap | 130 +++++++++--------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/components/slider/__tests__/__snapshots__/demo.test.js.snap b/components/slider/__tests__/__snapshots__/demo.test.js.snap index ff3f8bc4e573..2c4c6aef5d42 100644 --- a/components/slider/__tests__/__snapshots__/demo.test.js.snap +++ b/components/slider/__tests__/__snapshots__/demo.test.js.snap @@ -10,7 +10,7 @@ exports[`renders ./components/slider/demo/basic.md correctly 1`] = ` />
0°C 26°C 37°C 100°C @@ -548,7 +548,7 @@ exports[`renders ./components/slider/demo/mark.md correctly 1`] = ` />
0°C 26°C 37°C 100°C @@ -657,7 +657,7 @@ exports[`renders ./components/slider/demo/mark.md correctly 1`] = ` aria-valuenow="37" class="ant-slider-handle" role="slider" - style="left:37%" + style="left:37%;right:auto;transform:translateX(-50%)" tabindex="0" />
0°C 26°C 37°C 100°C @@ -702,7 +702,7 @@ exports[`renders ./components/slider/demo/mark.md correctly 1`] = ` />
0°C 26°C 37°C 100°C @@ -776,7 +776,7 @@ exports[`renders ./components/slider/demo/mark.md correctly 1`] = ` />
0°C 26°C 37°C 100°C @@ -852,7 +852,7 @@ exports[`renders ./components/slider/demo/reverse.md correctly 1`] = ` />
@@ -982,7 +982,7 @@ exports[`renders ./components/slider/demo/tip-formatter.md correctly 1`] = ` />
Date: Sat, 7 Sep 2019 15:29:47 +0800 Subject: [PATCH 13/22] Update demo.test.js.snap --- .../typography/__tests__/__snapshots__/demo.test.js.snap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/typography/__tests__/__snapshots__/demo.test.js.snap b/components/typography/__tests__/__snapshots__/demo.test.js.snap index 50369cb9c83e..018ec70ff792 100644 --- a/components/typography/__tests__/__snapshots__/demo.test.js.snap +++ b/components/typography/__tests__/__snapshots__/demo.test.js.snap @@ -239,7 +239,7 @@ exports[`renders ./components/typography/demo/ellipsis-debug.md correctly 1`] = />
Date: Sat, 7 Sep 2019 15:30:33 +0800 Subject: [PATCH 14/22] Update work-with-us.zh-CN.md --- docs/spec/work-with-us.zh-CN.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/spec/work-with-us.zh-CN.md b/docs/spec/work-with-us.zh-CN.md index 203dbd3a1275..9f103b76fac3 100644 --- a/docs/spec/work-with-us.zh-CN.md +++ b/docs/spec/work-with-us.zh-CN.md @@ -6,6 +6,8 @@ title: 加入我们 我们(蚂蚁金服体验技术部)是一支兼具设计视角和工程视角的团队,服务蚂蚁金服上百个中后台系统,主打产品 Ant Design 服务全球 100 万设计师和工程师,是西湖区学院路西侧最具影响力的设计语言。欢迎来这里和我们一起打造优雅高效的人机设计/研发体系。 + + ## UI/UE 设计师 简历和作品集请投递:lindong.lld#alipay.com @@ -27,8 +29,8 @@ title: 加入我们 - 参与 Ant Design 的打磨,将其建设成全球卓越的设计体系。 - 参与 AntV 的打磨,将其建设成全球一流的数据可视化体系。 - One More Thing ❤️ : - - 你们总是为世界带去美好,但总是忘却你们也需要美好。我们正在努力打造 [🍳 Kitchen:一款为设计师提效的 Sketch 工具集](https://kitchen.alipay.com/)、[语雀画板](https://yuque.com/) 等专属设计师的产品,让设计真正变成财富。期待志同道合的你,一道给设计行业带来「微小而美好的改变」。 + ## 前端工程师 @@ -48,6 +50,7 @@ title: 加入我们 - 负责 Ant Design 前端基础设施研发。 - 负责中后台设计/前端工具体系建设。 + ## ADI(Artificial Design Intelligence) 工程师 简历和作品集请投递:lindong.lld#alipay.com From 557264c35c16beb2e67835a505f6e2f8f5e992bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <645381995@qq.com> Date: Sat, 7 Sep 2019 15:44:51 +0800 Subject: [PATCH 15/22] feat: clean up --- .../__snapshots__/components.test.js.snap | 219 +++++++++++++----- 1 file changed, 156 insertions(+), 63 deletions(-) diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap index 9a2be2ad9ca0..c3d062417c1f 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap @@ -17339,30 +17339,61 @@ exports[`ConfigProvider components Upload configProvider 1`] = ` title="xxx.png" > xxx.png + + + + + + + + + + + +
- - -
@@ -17409,30 +17440,61 @@ exports[`ConfigProvider components Upload normal 1`] = ` title="xxx.png" > xxx.png + + + + + + + + + + + +
- - -
@@ -17479,30 +17541,61 @@ exports[`ConfigProvider components Upload prefixCls 1`] = ` title="xxx.png" > xxx.png + + + + + + + + + + + +
- - -
From a4ed07f4fb0596dd94ddc01eb3e943bbfa32c49b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <645381995@qq.com> Date: Sat, 7 Sep 2019 16:20:27 +0800 Subject: [PATCH 16/22] fix: showDownloadIcon=false 24px --- components/upload/UploadList.tsx | 41 +++++++-------- .../__tests__/__snapshots__/demo.test.js.snap | 41 ++++++++++----- .../__snapshots__/uploadlist.test.js.snap | 50 ++++++++++++++----- components/upload/style/index.less | 5 +- 4 files changed, 90 insertions(+), 47 deletions(-) diff --git a/components/upload/UploadList.tsx b/components/upload/UploadList.tsx index 3f5974e13bcc..36e776bfb5d8 100644 --- a/components/upload/UploadList.tsx +++ b/components/upload/UploadList.tsx @@ -139,28 +139,38 @@ export default class UploadList extends React.Component { }); const linkProps = typeof file.linkProps === 'string' ? JSON.parse(file.linkProps) : file.linkProps; + + const removeIcon = showRemoveIcon ? ( + this.handleClose(file)} /> + ) : null; + const downloadIcon = + showDownloadIcon && file.status === 'done' ? ( + this.handleDownload(file)} + /> + ) : null; const downloadOrDelete = listType !== 'picture-card' && ( - {file.status === 'done' && ( - - this.handleDownload(file)} /> - - )} - - this.handleClose(file)} /> - + {downloadIcon && {downloadIcon}} + {removeIcon && {removeIcon}} ); + const listItemNameClass = classNames({ + [`${prefixCls}-list-item-name`]: true, + [`${prefixCls}-list-item-name-show-download`]: showDownloadIcon, + }); const preview = file.url ? ( <> { ) : ( this.handlePreview(file, e)} title={file.name} > @@ -196,16 +206,7 @@ export default class UploadList extends React.Component { ) : null; - const removeIcon = showRemoveIcon ? ( - this.handleClose(file)} /> - ) : null; - const downloadIcon = showDownloadIcon ? ( - this.handleDownload(file)} - /> - ) : null; + const actions = listType === 'picture-card' && file.status !== 'uploading' && ( {previewIcon} diff --git a/components/upload/__tests__/__snapshots__/demo.test.js.snap b/components/upload/__tests__/__snapshots__/demo.test.js.snap index 50c0903a8c40..203e56c17a8e 100644 --- a/components/upload/__tests__/__snapshots__/demo.test.js.snap +++ b/components/upload/__tests__/__snapshots__/demo.test.js.snap @@ -60,7 +60,7 @@ exports[`renders ./components/upload/demo/defaultFileList.md correctly 1`] = ` foo.png @@ -68,6 +68,7 @@ exports[`Upload List handle error 1`] = ` aria-label="icon: delete" class="anticon anticon-delete" tabindex="-1" + title="Remove file" > foo.png @@ -184,6 +185,7 @@ exports[`Upload List should be uploading when upload a file 1`] = ` aria-label="icon: delete" class="anticon anticon-delete" tabindex="-1" + title="Remove file" > foo.png @@ -300,6 +302,7 @@ exports[`Upload List should be uploading when upload a file 2`] = ` aria-label="icon: download" class="anticon anticon-download" tabindex="-1" + title="Download file" > foo.png @@ -171,7 +171,7 @@ exports[`Upload List should be uploading when upload a file 1`] = ` foo.png From 74da0c86cb59f1a4e7d193fb747da1b55ba18da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <645381995@qq.com> Date: Tue, 10 Sep 2019 10:13:47 +0800 Subject: [PATCH 18/22] fix: test --- .../__tests__/__snapshots__/components.test.js.snap | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/config-provider/__tests__/__snapshots__/components.test.js.snap b/components/config-provider/__tests__/__snapshots__/components.test.js.snap index c3d062417c1f..97a38507cbf2 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.js.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.js.snap @@ -17335,7 +17335,7 @@ exports[`ConfigProvider components Upload configProvider 1`] = ` xxx.png @@ -17349,6 +17349,7 @@ exports[`ConfigProvider components Upload configProvider 1`] = ` aria-label="icon: download" class="anticon anticon-download" tabindex="-1" + title="Download file" > xxx.png @@ -17450,6 +17452,7 @@ exports[`ConfigProvider components Upload normal 1`] = ` aria-label="icon: download" class="anticon anticon-download" tabindex="-1" + title="Download file" > xxx.png @@ -17551,6 +17555,7 @@ exports[`ConfigProvider components Upload prefixCls 1`] = ` aria-label="icon: download" class="anticon anticon-download" tabindex="-1" + title="Download file" > { {file.name} {downloadOrDelete} - + ) : ( - - xxx.png - - + + xxx.png + + - - - - - - + + - - - + + + +
@@ -151,68 +153,70 @@ exports[`renders ./components/upload/demo/defaultFileList.md correctly 1`] = ` /> - - yyy.png - - + + yyy.png + + - - - - - - + + - - - + + + +
@@ -243,43 +247,45 @@ exports[`renders ./components/upload/demo/defaultFileList.md correctly 1`] = ` /> - - zzz.png - - + + zzz.png + + - - - - + + + +
@@ -350,68 +356,70 @@ exports[`renders ./components/upload/demo/fileList.md correctly 1`] = ` /> - - xxx.png - - + + xxx.png + + - - - - - - + + - - - + + + +
@@ -449,15 +457,17 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - - image.png - + + + image.png + +
- - image.png - + + + image.png + +
- - image.png - + + + image.png + +
- - image.png - + + + image.png + +
- - image.png - + + + image.png + +
- - xxx.png - - + - + + - - - - - + + - - - + + + +
@@ -1068,68 +1088,70 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - - yyy.png - - + - + + - - - - - + + - - - + + + +
@@ -1166,68 +1188,70 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - - xxx.png - - + - + + - - - - - + + - - - + + + +
@@ -1251,68 +1275,70 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - - yyy.png - - + - + + - - - - - + + - - - + + + +
diff --git a/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap b/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap index b190980eda6a..21f2ff4a9c2c 100644 --- a/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap +++ b/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap @@ -441,68 +441,70 @@ exports[`Upload List should non-image format file preview 1`] = ` - - not-image - - + + not-image + + - - - - - - + + - - - + + + +
@@ -526,68 +528,70 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/aaa" /> - - image - - + + image + + - - - - - - + + - - - + + + +
@@ -630,68 +634,70 @@ exports[`Upload List should non-image format file preview 1`] = ` - - not-image - - + + not-image + + - - - - - - + + - - - + + + +
@@ -734,68 +740,70 @@ exports[`Upload List should non-image format file preview 1`] = ` - - not-image - - + - + + - - - - - + + - - - + + + +
@@ -819,68 +827,70 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/xx.xx/aaa.png" /> - - image - - + - - - + image - - + + + + + - - - + + + +
@@ -904,68 +914,70 @@ exports[`Upload List should non-image format file preview 1`] = ` src="data:image/png;base64,UEsDBAoAAAAAADYZYkwAAAAAAAAAAAAAAAAdAAk" /> - - image - - + - + + - - - - - + + - - - + + + +
@@ -989,68 +1001,70 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/xx.xx/aaa.png?query=123" /> - - image - - + + image + + - - - - - - + + - - - + + + +
@@ -1074,68 +1088,70 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/xx.xx/aaa.png#anchor" /> - - image - - + + image + + - - - - - - + + - - - + + + +
@@ -1159,68 +1175,70 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/xx.xx/aaa.png?query=some.query.with.dot" /> - - image - - + + image + + - - - - - - + + - - - + + + +
@@ -1244,68 +1262,70 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://publish-pic-cpu.baidu.com/1296beb3-50d9-4276-885f-52645cbb378e.jpeg@w_228%2ch_152" /> - - image - - + + image + + - - - - - - + + - - - + + + +
diff --git a/components/upload/__tests__/uploadlist.test.js b/components/upload/__tests__/uploadlist.test.js index e81e583255a4..d126b609f30d 100644 --- a/components/upload/__tests__/uploadlist.test.js +++ b/components/upload/__tests__/uploadlist.test.js @@ -537,14 +537,6 @@ describe('Upload List', () => { return wrapper.props.onDownload(file); }); - it('downloadFile is true should work correctly', async () => { - const items = [{ uid: 'upload-list-item', url: '' }]; - const wrapper = mount( - , - ).instance(); - return expect(wrapper.props.onDownload).toBe(true); - }); - it('extname should work correctly when url not exists', () => { const items = [{ uid: 'upload-list-item', url: '' }]; const wrapper = mount( From e02dbdc64fedee7ab6c0f8d2ab99bbfd98dc47b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <645381995@qq.com> Date: Tue, 10 Sep 2019 11:43:55 +0800 Subject: [PATCH 20/22] fix: [] key --- components/upload/UploadList.tsx | 10 +- .../__tests__/__snapshots__/demo.test.js.snap | 936 +++++++------- .../__snapshots__/uploadlist.test.js.snap | 1102 ++++++++--------- 3 files changed, 1002 insertions(+), 1046 deletions(-) diff --git a/components/upload/UploadList.tsx b/components/upload/UploadList.tsx index fe4a9e8111c9..0fed349ecb3d 100644 --- a/components/upload/UploadList.tsx +++ b/components/upload/UploadList.tsx @@ -153,6 +153,7 @@ export default class UploadList extends React.Component { ) : null; const downloadOrDelete = listType !== 'picture-card' && ( { [`${prefixCls}-list-item-name-show-download`]: downloadIcon, }); const preview = file.url ? ( - + [ { onClick={e => this.handlePreview(file, e)} > {file.name} - - {downloadOrDelete} - + , + downloadOrDelete, + ] ) : ( - + + xxx.png + + - xxx.png - - - - - - + + + + + - - - + + + +
@@ -153,70 +151,68 @@ exports[`renders ./components/upload/demo/defaultFileList.md correctly 1`] = ` /> - + + yyy.png + + - yyy.png - - - - - - + + + + + - - - + + + +
@@ -247,45 +243,43 @@ exports[`renders ./components/upload/demo/defaultFileList.md correctly 1`] = ` /> - + + zzz.png + + - zzz.png - - - - - - + + + +
@@ -356,70 +350,68 @@ exports[`renders ./components/upload/demo/fileList.md correctly 1`] = ` /> - + + xxx.png + + - xxx.png - - - - - - + + + + + - - - + + + +
@@ -457,17 +449,15 @@ exports[`renders ./components/upload/demo/picture-card.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - - - image.png - - + + image.png +
- - - image.png - - + + image.png +
- - - image.png - - + + image.png +
- - - image.png - - + + image.png +
- - - image.png - - + + image.png +
- + + xxx.png + + - xxx.png - - - - - - + + + + + - - - + + + +
@@ -1088,70 +1068,68 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - + + yyy.png + + - yyy.png - - - - - - + + + + + - - - + + + +
@@ -1188,70 +1166,68 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - + + xxx.png + + - xxx.png - - - - - - + + + + + - - - + + + +
@@ -1275,70 +1251,68 @@ exports[`renders ./components/upload/demo/picture-style.md correctly 1`] = ` src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png" /> - + + yyy.png + + - yyy.png - - - - - - + + + + + - - - + + + +
diff --git a/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap b/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap index 21f2ff4a9c2c..b190980eda6a 100644 --- a/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap +++ b/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap @@ -441,70 +441,68 @@ exports[`Upload List should non-image format file preview 1`] = ` - + + not-image + + - not-image - - - - - - + + + + + - - - + + + +
@@ -528,70 +526,68 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/aaa" /> - + + image + + - image - - - - - - + + + + + - - - + + + +
@@ -634,70 +630,68 @@ exports[`Upload List should non-image format file preview 1`] = ` - + + not-image + + - not-image - - - - - - + + + + + - - - + + + +
@@ -740,70 +734,68 @@ exports[`Upload List should non-image format file preview 1`] = ` - + + not-image + + - not-image - - - - - - + + + + + - - - + + + +
@@ -827,70 +819,68 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/xx.xx/aaa.png" /> - + + image + + - image + + + - - - - - - - - - - + + + +
@@ -914,70 +904,68 @@ exports[`Upload List should non-image format file preview 1`] = ` src="data:image/png;base64,UEsDBAoAAAAAADYZYkwAAAAAAAAAAAAAAAAdAAk" /> - + + image + + - image - - - - - - + + + + + - - - + + + +
@@ -1001,70 +989,68 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/xx.xx/aaa.png?query=123" /> - + + image + + - image - - - - - - + + + + + - - - + + + +
@@ -1088,70 +1074,68 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/xx.xx/aaa.png#anchor" /> - + + image + + - image - - - - - - + + + + + - - - + + + +
@@ -1175,70 +1159,68 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://cdn.xxx.com/xx.xx/aaa.png?query=some.query.with.dot" /> - + + image + + - image - - - - - - + + + + + - - - + + + +
@@ -1262,70 +1244,68 @@ exports[`Upload List should non-image format file preview 1`] = ` src="https://publish-pic-cpu.baidu.com/1296beb3-50d9-4276-885f-52645cbb378e.jpeg@w_228%2ch_152" /> - + + image + + - image - - - - - - + + + + + - - - + + + +
From a2a4d851b3838fafcc952da530701150d53cdde8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=9E=AB?= <645381995@qq.com> Date: Wed, 11 Sep 2019 19:30:56 +0800 Subject: [PATCH 21/22] fix: hover css --- components/upload/UploadList.tsx | 5 +- .../__tests__/__snapshots__/demo.test.js.snap | 52 +++++++++---------- .../__snapshots__/uploadlist.test.js.snap | 52 +++++++++---------- components/upload/style/index.less | 29 +++++++++-- 4 files changed, 80 insertions(+), 58 deletions(-) diff --git a/components/upload/UploadList.tsx b/components/upload/UploadList.tsx index 0fed349ecb3d..3b6a77b86191 100644 --- a/components/upload/UploadList.tsx +++ b/components/upload/UploadList.tsx @@ -136,6 +136,7 @@ export default class UploadList extends React.Component { const infoUploadingClass = classNames({ [`${prefixCls}-list-item`]: true, [`${prefixCls}-list-item-${file.status}`]: true, + [`${prefixCls}-list-item-list-type-${listType}`]: true, }); const linkProps = typeof file.linkProps === 'string' ? JSON.parse(file.linkProps) : file.linkProps; @@ -164,7 +165,9 @@ export default class UploadList extends React.Component { ); const listItemNameClass = classNames({ [`${prefixCls}-list-item-name`]: true, - [`${prefixCls}-list-item-name-show-download`]: downloadIcon, + [`${prefixCls}-list-item-name-icon-count-${ + [downloadIcon, removeIcon].filter(x => x).length + }`]: true, }); const preview = file.url ? ( [ diff --git a/components/upload/__tests__/__snapshots__/demo.test.js.snap b/components/upload/__tests__/__snapshots__/demo.test.js.snap index 11225ee86840..b2b0219df6e6 100644 --- a/components/upload/__tests__/__snapshots__/demo.test.js.snap +++ b/components/upload/__tests__/__snapshots__/demo.test.js.snap @@ -34,7 +34,7 @@ exports[`renders ./components/upload/demo/defaultFileList.md correctly 1`] = ` class="ant-upload-list ant-upload-list-text" >