From f4872c25e195919bb3471fe262125803259ed742 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Tue, 10 Mar 2020 12:51:28 +0800 Subject: [PATCH 1/8] feat: #613 --- components/upload/UploadClick.js | 12 +++++-- components/upload/UploadDrag.js | 14 ++++++-- components/upload/UploadPictureCard.js | 12 +++++-- components/upload/style/index.scss | 33 +++++++++++-------- docs/zh-CN/components/upload.mdx | 45 +++++++++++++------------- 5 files changed, 73 insertions(+), 43 deletions(-) diff --git a/components/upload/UploadClick.js b/components/upload/UploadClick.js index 6a66141e7..aced1e1ee 100644 --- a/components/upload/UploadClick.js +++ b/components/upload/UploadClick.js @@ -21,7 +21,8 @@ class UploadClick extends Upload { accept, loading, localeDatas, - theme + theme, + onDownload } = this.props const { fileList, @@ -64,7 +65,14 @@ class UploadClick extends Upload { >
- {file.name} + { + if (onDownload) { + e.preventDefault() + onDownload(file) + } + }}> + {file.name} + { onRemove && diff --git a/components/upload/UploadDrag.js b/components/upload/UploadDrag.js index 15fa3c546..a6f0c114d 100644 --- a/components/upload/UploadDrag.js +++ b/components/upload/UploadDrag.js @@ -47,7 +47,8 @@ class UploadDrag extends Upload { tips, localeDatas, onRemove, - theme + theme, + onDownload } = this.props const { overEvent, @@ -123,7 +124,7 @@ class UploadDrag extends Upload { } {fileList.map((file, index) => { const fileNameCls = classNames( - 'file-name', + 'hi-upload__filename', 'upload-list__item-name', file.uploadState === 'error' && 'hi-upload__filename--error' ) @@ -136,7 +137,14 @@ class UploadDrag extends Upload { >
- {file.name} + { + if (onDownload) { + e.preventDefault() + onDownload(file) + } + }}> + {file.name} + { onRemove && boolean | - | () => true | -| customUpload | 自定义上传,此时不会再触发 onChange,所有上传逻辑转移到该函数 | (files: Files[]) => void | - | - | -| onChange | 上传回调。当 function 返回 false 或者返回 promise( 例如 promise resolve(false))则已上传的文件列表不会展示该文件 | (file: File, fileList: File[], response: object) => boolean | - | - | -| onRemove | 删除上传的文件,为 false 时不可删除。当 function 返回 true 或者返回 promise(如果 promise resolve(true))则会在前端删除文件(可参考 demo:照片墙上传) | (file: File, fileList: File[], index: number) => boolean | - | () => true | -| loading | 文件上传按钮是否 loading,为 true 时按钮不可点击。仅在 type='default' 时有效 | boolean | true \| false | false | +| 参数 | 说明 | 类型 | 可选值 | 默认值 | +| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------- | ------------------------------------------------- | ----------------------------------------- | +| type | 上传组件类型 | string | default \| drag \| pictureCard \| avatar \| photo | default | +| accept | 接收上传的文件类型, 用逗号隔开的 MIME 类型列表,参考 [MDN-MIME 类型](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Basics_of_HTTP/MIME_Types) | string | - | - | +| content | 上传按钮文案,仅在 type === 'default' 的时候有效 | string \| ReactNode | - | 本地上传 | +| maxSize | 接收上传的文件体积上限(单位:KB) | number | - | - | +| maxCount | 接收上传的文件最大数量 | number | - | - | +| uploadAction | 必选,上传的地址 | string | - | - | +| params | 除了上传文件外的其它 form 参数 | object | - | - | +| name | 发到后台文件参数名 | string | - | file | +| disabled | 是否禁用 | boolean | true \| false | false | +| headers | 设置上传的请求头部 | object | - | { 'Content-type': 'multipart/form-data' } | +| withCredentials | 上传请求时是否携带 cookie | boolean | true \| false | false | +| showUploadList | 是否展示 uploadList, 仅在 type === 'default' 和 type === 'pictureCard' 时有效 | boolean | true \| false | true | +| multiple | 是否支持多选文件 | boolean | true \| false | false | +| defaultFileList | 默认已上传文件列表 | File[] | - | [] | +| fileList | 已上传文件列表(受控) | File[] | - | - | +| beforeUpload | 上传文件前的钩子,返回 true 继续上传,其他终止上传 | (files: File[], fileList: File[]) => boolean | - | () => true | +| customUpload | 自定义上传,此时不会再触发 onChange,所有上传逻辑转移到该函数 | (files: Files[]) => void | - | - | +| onChange | 上传回调。当 function 返回 false 或者返回 promise( 例如 promise resolve(false))则已上传的文件列表不会展示该文件 | (file: File, fileList: File[], response: object) => boolean | - | - | +| onRemove | 删除上传的文件,为 false 时不可删除。当 function 返回 true 或者返回 promise(如果 promise resolve(true))则会在前端删除文件(可参考 demo:照片墙上传) | (file: File, fileList: File[], index: number) => boolean | - | () => true | +| onDownload | 点击已上传的文件时的回调,如果没有指定,则默认新标签页跳转到文件 url | (file: File) => void | - | 新标签页访问文件 url | +| loading | 文件上传按钮是否 loading,为 true 时按钮不可点击。仅在 type='default' 时有效 | boolean | true \| false | false | ## Type From f19f4dd4385118eaa2c41ba4332773fe44a194b1 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Tue, 10 Mar 2020 20:43:20 +0800 Subject: [PATCH 2/8] fix: update #973 --- CHANGELOG.md | 8 ++++++++ components/carousel/style/index.scss | 1 + package.json | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 699386789..efdd91e67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # 更新日志 +## 2.10.0 + +- 新增 `` onDownload 点击上传成功文件的回调 [#613](https://github.com/XiaoMi/hiui/issues/613) +- 优化 `` 异步模式下有默认值不能正常使用的问题 [#962](https://github.com/XiaoMi/hiui/issues/962) +- 优化若干视觉还原问题:[#952](https://github.com/XiaoMi/hiui/issues/952) [#954](https://github.com/XiaoMi/hiui/issues/954) [#956](https://github.com/XiaoMi/hiui/issues/956) [#958](https://github.com/XiaoMi/hiui/issues/958) [#960](https://github.com/XiaoMi/hiui/issues/960) [#961](https://github.com/XiaoMi/hiui/issues/961) [#965](https://github.com/XiaoMi/hiui/issues/965) [#967](https://github.com/XiaoMi/hiui/issues/967) [#968](https://github.com/XiaoMi/hiui/issues/968) [#969](https://github.com/XiaoMi/hiui/issues/969) [#970](https://github.com/XiaoMi/hiui/issues/970) [#971](https://github.com/XiaoMi/hiui/issues/971) [#975](https://github.com/XiaoMi/hiui/issues/975) [#976](https://github.com/XiaoMi/hiui/issues/976) [#977](https://github.com/XiaoMi/hiui/issues/977) [#978](https://github.com/XiaoMi/hiui/issues/978) [#982](https://github.com/XiaoMi/hiui/issues/982) [#983](https://github.com/XiaoMi/hiui/issues/983) + ## 2.9.0 - 新增 `` active 属性展示加载动效 [#941](https://github.com/XiaoMi/hiui/issues/941) diff --git a/components/carousel/style/index.scss b/components/carousel/style/index.scss index 8e01e2e26..34d58f669 100644 --- a/components/carousel/style/index.scss +++ b/components/carousel/style/index.scss @@ -17,6 +17,7 @@ left: 50%; transform: translateX(-50%); max-width: 50%; + display: flex; } &__dot { diff --git a/package.json b/package.json index 41c57db00..c2413920e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hi-ui/hiui", - "version": "2.9.0", + "version": "2.10.0", "description": "HIUI for React", "scripts": { "test": "node_modules/.bin/standard && node_modules/.bin/stylelint --config .stylelintrc 'components/**/*.scss'", From 6702c88b8113033732ace819c96046e18b8765b2 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Tue, 10 Mar 2020 20:53:55 +0800 Subject: [PATCH 3/8] fix: #952 --- components/tag/style/index.scss | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/tag/style/index.scss b/components/tag/style/index.scss index 4b2695baf..f0404159c 100644 --- a/components/tag/style/index.scss +++ b/components/tag/style/index.scss @@ -5,11 +5,14 @@ $primary: get-color($palette-primary, 'hiui-blue') !default; .#{$prefix} { &__container { + height: $line-height-size-normal; display: inline-block; vertical-align: middle; - padding: 0 4px; + padding: 0 6px; font-size: $font-size-small; - line-height: $line-height-size-x-small; + box-sizing: border-box; + text-align: center; + line-height: $line-height-size-normal; -webkit-font-smoothing: antialiased; border-radius: 2px; @@ -34,7 +37,8 @@ $primary: get-color($palette-primary, 'hiui-blue') !default; background: transparent; border: 1px solid $primary; color: $primary; - line-height: $line-height-size-x-small - 2; + padding: 0 5px; + line-height: $line-height-size-normal - 2; @each $key in 'success', 'danger', 'warning' { &.#{$prefix}__container--#{$key} { From e7f87d364877dd9461c0d2f7a652ad2b4587347b Mon Sep 17 00:00:00 2001 From: solarjoker Date: Tue, 10 Mar 2020 21:52:22 +0800 Subject: [PATCH 4/8] fix: #958 --- components/dropdown/DropdownButton.jsx | 3 +-- components/dropdown/DropdownMenu.jsx | 1 + components/dropdown/style/index.scss | 16 ++-------------- docs/demo/dropdown/section-trigger.jsx | 2 +- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/components/dropdown/DropdownButton.jsx b/components/dropdown/DropdownButton.jsx index f64f3db8b..f0473ff06 100644 --- a/components/dropdown/DropdownButton.jsx +++ b/components/dropdown/DropdownButton.jsx @@ -20,8 +20,7 @@ export default class DropdownButton extends React.Component { const isGroup = type === 'group' const buttonCls = classNames( `${prefixCls}__button`, - isButton || `${prefixCls}__button--text`, - visible && `${prefixCls}__button--active` + isButton || `${prefixCls}__button--text` ) const iconGroupCls = classNames( `${prefixCls}__icon`, diff --git a/components/dropdown/DropdownMenu.jsx b/components/dropdown/DropdownMenu.jsx index 482d032ec..79f9396f5 100644 --- a/components/dropdown/DropdownMenu.jsx +++ b/components/dropdown/DropdownMenu.jsx @@ -30,6 +30,7 @@ class DropdownMenu extends React.Component { placement={placement} width={width} onMouseEnter={onMouseEnter} + leftGap={1} onMouseLeave={onMouseLeave} >
    diff --git a/components/dropdown/style/index.scss b/components/dropdown/style/index.scss index 3f3647aea..d775eeb0c 100644 --- a/components/dropdown/style/index.scss +++ b/components/dropdown/style/index.scss @@ -24,10 +24,6 @@ $prefixCls: 'hi-dropdown' !default; .#{$prefixCls}__button { color: #ccc; cursor: not-allowed; - - &:hover { - color: #ccc !important; - } } } @@ -47,10 +43,6 @@ $prefixCls: 'hi-dropdown' !default; padding-left: 0; padding-right: 0; } - - &--active { - color: get-color($palette-primary, 'hiui-blue') !important; - } } &__icon { @@ -117,7 +109,7 @@ $prefixCls: 'hi-dropdown' !default; width: 100%; } - &:not(#{&}--disabled):hover { + &:not(.hi-dropdown__menu-item--disabled):hover { background-color: #ecf2fe; } } @@ -125,12 +117,8 @@ $prefixCls: 'hi-dropdown' !default; } @each $key, $value in $palette-primary { - .theme__#{$key}.#{$prefixCls}__button--active { - color: $value !important; - } - .theme__#{$key}.#{$prefixCls}__menu { - .#{$prefixCls}__menu-item:not(.hi-dropdown__menu-item----disabled):hover { + .#{$prefixCls}__menu-item:not(.hi-dropdown__menu-item--disabled):hover { background-color: rgba($value, 0.15); } } diff --git a/docs/demo/dropdown/section-trigger.jsx b/docs/demo/dropdown/section-trigger.jsx index 50c630525..262bc16e1 100644 --- a/docs/demo/dropdown/section-trigger.jsx +++ b/docs/demo/dropdown/section-trigger.jsx @@ -73,7 +73,7 @@ class Demo extends React.Component { data={list} type='button' trigger='click' - title='单击' + title='左键单击' /> ) } From 8e445d4e7c45d8c17e4602fff6a934f6e16d40c3 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Tue, 10 Mar 2020 22:02:07 +0800 Subject: [PATCH 5/8] fix: #987 --- components/switch/style/index.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/switch/style/index.scss b/components/switch/style/index.scss index e590b0fe7..776418c3b 100755 --- a/components/switch/style/index.scss +++ b/components/switch/style/index.scss @@ -45,7 +45,7 @@ $basic-color: #4284f5 !default; } &__text { - color: rgba(255, 255, 255, 0.5); + color: #fff; font-size: 12px; position: absolute; top: 0; From d708b901af50de0a6db3c6c95697262479704bae Mon Sep 17 00:00:00 2001 From: solarjoker Date: Tue, 10 Mar 2020 22:11:23 +0800 Subject: [PATCH 6/8] fix: #956 --- components/breadcrumb/style/index.scss | 2 +- docs/demo/breadcrumb/section-base.jsx | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/components/breadcrumb/style/index.scss b/components/breadcrumb/style/index.scss index e1ab92a15..e75ef26e2 100644 --- a/components/breadcrumb/style/index.scss +++ b/components/breadcrumb/style/index.scss @@ -17,7 +17,7 @@ } &__separator { - margin: 0 10px; + margin: 0 8px; color: #ccc; } diff --git a/docs/demo/breadcrumb/section-base.jsx b/docs/demo/breadcrumb/section-base.jsx index 79825b80f..42bec7816 100644 --- a/docs/demo/breadcrumb/section-base.jsx +++ b/docs/demo/breadcrumb/section-base.jsx @@ -11,18 +11,11 @@ class Demo extends React.Component { content: '首页', path: '/home' }, { - content: '产品类', - icon: 'document', - path: '/product' + content: '列表', + path: '/list' }, { - icon: 'component', + content: '手机详情', path: '/phone' - }, { - content: '红米系列', - path: '/redmi' - }, { - content: 'Note7', - path: '/note7' }] return (
    From 4e13a73b9c5e1d5c7fb8609046a9935a41080ee2 Mon Sep 17 00:00:00 2001 From: solarjoker Date: Tue, 10 Mar 2020 23:31:42 +0800 Subject: [PATCH 7/8] fix: #975 --- components/checkbox/style/index.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/checkbox/style/index.scss b/components/checkbox/style/index.scss index 1833e48ac..662833796 100644 --- a/components/checkbox/style/index.scss +++ b/components/checkbox/style/index.scss @@ -70,11 +70,11 @@ $prefixCls: '.hi-checkbox' !default; content: ''; border: none; border-bottom: 2px solid #fff; - height: 6px; - left: 5px; + height: 8px; + left: 6px; position: absolute; - top: 3px; - width: 4px; + top: 2px; + width: 2px; transform-origin: center; } } From 8db79557425b6bb6234f1a194a3c8d42a271ebcd Mon Sep 17 00:00:00 2001 From: solarjoker Date: Wed, 11 Mar 2020 00:11:44 +0800 Subject: [PATCH 8/8] chore: update changelog --- CHANGELOG.md | 8 ++++---- docs/zh-CN/components/changelog.mdx | 14 +++++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efdd91e67..4adf39ef5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,13 @@ - 优化 `` 异步模式下有默认值不能正常使用的问题 [#962](https://github.com/XiaoMi/hiui/issues/962) -- 优化若干视觉还原问题:[#952](https://github.com/XiaoMi/hiui/issues/952) [#954](https://github.com/XiaoMi/hiui/issues/954) [#956](https://github.com/XiaoMi/hiui/issues/956) [#958](https://github.com/XiaoMi/hiui/issues/958) [#960](https://github.com/XiaoMi/hiui/issues/960) [#961](https://github.com/XiaoMi/hiui/issues/961) [#965](https://github.com/XiaoMi/hiui/issues/965) [#967](https://github.com/XiaoMi/hiui/issues/967) [#968](https://github.com/XiaoMi/hiui/issues/968) [#969](https://github.com/XiaoMi/hiui/issues/969) [#970](https://github.com/XiaoMi/hiui/issues/970) [#971](https://github.com/XiaoMi/hiui/issues/971) [#975](https://github.com/XiaoMi/hiui/issues/975) [#976](https://github.com/XiaoMi/hiui/issues/976) [#977](https://github.com/XiaoMi/hiui/issues/977) [#978](https://github.com/XiaoMi/hiui/issues/978) [#982](https://github.com/XiaoMi/hiui/issues/982) [#983](https://github.com/XiaoMi/hiui/issues/983) +- 优化若干视觉还原问题:[#952](https://github.com/XiaoMi/hiui/issues/952) [#958](https://github.com/XiaoMi/hiui/issues/958) [#971](https://github.com/XiaoMi/hiui/issues/971) [#973](https://github.com/XiaoMi/hiui/issues/973) [#975](https://github.com/XiaoMi/hiui/issues/975) [#976](https://github.com/XiaoMi/hiui/issues/976) [#977](https://github.com/XiaoMi/hiui/issues/977) [#983](https://github.com/XiaoMi/hiui/issues/983)[#987](https://github.com/XiaoMi/hiui/issues/987) ## 2.9.0 - 新增 `` active 属性展示加载动效 [#941](https://github.com/XiaoMi/hiui/issues/941) - 新增 `` 拖拽用法支持多选上传 [#942](https://github.com/XiaoMi/hiui/issues/942) -- 新增 `` disabledDate 属性自定义日期禁选 [#943](https://github.com/XiaoMi/hiui/issues/943) +- 新增 `` disabledDate 属性自定义日期禁选 [#943](https://github.com/XiaoMi/hiui/issues/943) - 优化 `` 视觉效果 [#937](https://github.com/XiaoMi/hiui/issues/937) - 修复 `` 点击外部区域不能正常隐藏菜单的问题 [#947](https://github.com/XiaoMi/hiui/issues/947) - 修复``同时上传多个文件的展示问题 [#948](https://github.com/XiaoMi/hiui/issues/948) @@ -25,8 +25,8 @@ - 新增 `` withCredentials 属性 [#922](https://github.com/XiaoMi/hiui/issues/922) - 修复 `` 单选模式下 targetLimit 无效的问题 [#919](https://github.com/XiaoMi/hiui/issues/919) - 修复 `` 可搜索模式下自动获取输入框焦点 [#925](https://github.com/XiaoMi/hiui/issues/925) +- 优化 `` 轮播定位交互,并新增 showPages 是否显示页码指示器 [#925](https://github.com/XiaoMi/hiui/issues/925) +- 修复 `
    ` withCredentials 属性 [#922](https://github.com/XiaoMi/hiui/issues/922) - 修复 `` 单选模式下 targetLimit 无效的问题 [#919](https://github.com/XiaoMi/hiui/issues/919) - 修复 `