Skip to content

Commit

Permalink
feat: #1575 #1576 for v3
Browse files Browse the repository at this point in the history
  • Loading branch information
wugaoliang committed Feb 21, 2021
1 parent 572b761 commit 5383327
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# 更新日志
## 3.4.1

- 新增 `Transfer` 组件 render 自定义菜单渲染函数 [#1575](https://github.com/XiaoMi/hiui/issues/1575)
- 修复 `DatePicker` type 为 week 或者 weekrange 时 输入相应格式日期解析错误问题 [#1579](https://github.com/XiaoMi/hiui/issues/1579)
- 修复 `Preview` 图片预览组件,滚轮放大缩小错误 [#1573](https://github.com/XiaoMi/hiui/issues/1573)
- 修复 `TimePicker` 时间范围选择,为空时无法选择打开弹窗时的当前值 [#1530](https://github.com/XiaoMi/hiui/issues/1530)
Expand Down Expand Up @@ -202,3 +203,4 @@
## 1.x

[更新日志汇总](https://github.com/XiaoMi/hiui/blob/stable/1.x/CHANGELOG.md)

1 change: 1 addition & 0 deletions components/checkbox/style/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ $prefixCls: '.hi-checkbox' !default;
border-radius: 2px;
transition: 0.3s ease-out;
line-height: 1;
flex: none;

&--indeterminate {
&::after {
Expand Down
7 changes: 4 additions & 3 deletions components/transfer/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class Item extends Component {
dir,
draggable,
dividerPosition,
theme
theme,
render
} = this.props
const sourceStyle =
sourceNode === item.id && isDragging
Expand Down Expand Up @@ -51,10 +52,10 @@ class Item extends Component {
checkboxOnChange(item.id, e.checked)
}}
>
{item.content}
{render ? render(item) : item.content}
</Checkbox>
) : (
item.content
<span className="hi-transfer__item-content">{render ? render(item) : item.content}</span>
)}
</li>
)
Expand Down
4 changes: 3 additions & 1 deletion components/transfer/Transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,8 @@ class Transfer extends Component {
theme,
localeDatas,
onDragStart,
onDrop
onDrop,
render
} = this.props
const {
sourceSelectedKeys,
Expand Down Expand Up @@ -334,6 +335,7 @@ class Transfer extends Component {
draggable={draggable}
key={index}
theme={theme}
render={render}
onClick={(e) => this.clickItemEvent(item, index, dir)}
mode={mode === 'basic' && type === 'default' ? 'basic' : 'multiple'}
item={item}
Expand Down
22 changes: 22 additions & 0 deletions components/transfer/style/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@
}
}

.hi-checkbox {
max-width: 100%;
}

.hi-checkbox__text {
width: 100%;
height: 36px;
line-height: 36px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

&__split {
width: 100%;
height: 8px;
Expand Down Expand Up @@ -102,6 +115,15 @@
display: flex;
align-items: center;
}

&-content {
display: inline-block;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 14px;
}
}

&__warning {
Expand Down
4 changes: 2 additions & 2 deletions docs/zh-CN/components/transfer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ import DemoArea from '../../demo/transfer/section-area.jsx'
| 名称 | 说明 | 类型 | 参数 | 返回值 |
| -------- | -------------------------------- | ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ------ |
| onChange | 选中元素被移动到目标框内后的回调 | (targetKeys: number[] \| string[], direction: 'left' \| 'right', moveDatas: DataItem[]) => void | targetKeys: 目标框内的元素 ID 集合 <br/> direction: 移动方向 <br/> moveDatas: 移动的数据项集合 | - |

| render | 自定义菜单渲染函数 | (item: DataItem) => ReactNode | - | 无内容 |
## Type

### DataItem

| 参数 | 说明 | 类型 | 可选值 | 默认值 |
| -------- | -------- | ------------------- | ------------- | ------ |
| id | 唯一 id | string | number | - |
| content | 显示内容 | string \| ReactNode | - | - |
| content | 显示内容 | string | - | - |
| disabled | 是否禁用 | boolean | true \| false | false |

0 comments on commit 5383327

Please sign in to comment.