Skip to content

Commit

Permalink
Merge branch 'develop' into hotfix/#1653
Browse files Browse the repository at this point in the history
  • Loading branch information
solarjoker authored Apr 7, 2021
2 parents a5e3993 + 327ff0b commit 7b956eb
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 28 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
- 修复 `Modal` 组件 closeable 属性无效问题 [#1645](https://github.com/XiaoMi/hiui/issues/1645)
- 修复 `Form` 组件 setFieldsValue 方式调用显示异常问题 [#1642](https://github.com/XiaoMi/hiui/issues/1642)
- 修复 `Form` 组件中包裹多个 List 组件,值未展示问题 [#1649](https://github.com/XiaoMi/hiui/issues/1649)
- 修复 `Table` 组件 data值为带正负符号的数字类型字符串时,无法进行求和及平均值的问题 [#1616](https://github.com/XiaoMi/hiui/issues/1616)
- 修复 `Table` 组件 data值为带正负符号的数字类型字符串时,无法进行求和及平均值的问题 [#1616](https://github.com/XiaoMi/hiui/issues/1616)
- 修复 `Tabs` 组件 panes 数据源异步变更,导致Tabs.Pane重渲染时,底部高亮线偏移的问题 [#1651](https://github.com/XiaoMi/hiui/issues/1651)
- 修复 `DatePicker` 组件 type 为 timeperiod 在受控时,选择完成时间后该组件内容显示为空 [#1653](https://github.com/XiaoMi/hiui/issues/1653)
- 优化 `Tabs` 组件 在 type 为 editable 时右上角的加号的显示隐藏随 onAdd 方法自动显示隐藏 [#1662](https://github.com/XiaoMi/hiui/issues/1662)
- 修复 `Select` 组件在分组形态下,搜索功能无效 [#1655](https://github.com/XiaoMi/hiui/issues/1655)

## 3.5.0

- 新增 `Table` 组件 showColHighlight 方法 [#1602](https://github.com/XiaoMi/hiui/issues/1602)
- 修复 `Table` 组件 列冻结无法展示求和及平均值的问题 [#1616](https://github.com/XiaoMi/hiui/issues/1616)
- 修复 `Table` 组件列冻结无法展示求和及平均值的问题 [#1616](https://github.com/XiaoMi/hiui/issues/1616)
- 新增 `Table` 组件 表格表头事件回调函数输出 [#1625](https://github.com/XiaoMi/hiui/issues/1625)
- 新增 `Form` SchemaForm 中 component 属性接受 ReactNode,SchemaForm 新增 updateSchema 更新函数 [#1612](https://github.com/XiaoMi/hiui/issues/1612)
- 新增 `DatePicker` onSelect 选择日期的回调函数 [#1592](https://github.com/XiaoMi/hiui/issues/1592)
Expand All @@ -26,7 +28,7 @@
- 修复 `TimePicker` 时间范围选择,为空时无法选择打开弹窗时的当前值 [#1530](https://github.com/XiaoMi/hiui/issues/1530)
- 修复 `Collapse` onChange 属性未传入控制台报错问题 [#1580](https://github.com/XiaoMi/hiui/issues/1580)
- 修复 `Select` 组件在异步多选时,关闭弹层下拉选项内容丢失问题 [#1578](https://github.com/XiaoMi/hiui/issues/1578)
- 修复 `Table` 组件 data值为数字类型字符串时,无法进行求和及平均值的问题 [#1616](https://github.com/XiaoMi/hiui/issues/1616)
- 修复 `Table` 组件 data值为数字类型字符串时,无法进行求和及平均值的问题 [#1616](https://github.com/XiaoMi/hiui/issues/1616)

## 3.4.0

Expand Down
1 change: 0 additions & 1 deletion components/select/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ const InternalSelect = (props) => {
if (typeof filterOption === 'function') {
return shouldMatch || filterOption(keyword, item)
}

return (
shouldMatch ||
String(item[transKeys(fieldNames, 'id')] || '').includes(keyword) ||
Expand Down
14 changes: 7 additions & 7 deletions components/select/SelectDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,13 @@ const SelectDropdown = ({
)
renderGroup.push(label)
filterGroupItem[transKeys(fieldNames, 'children')].forEach((item, index) => {
matchFilter(item) && renderGroup.push(normalItem(item, filterItemsIndex + '-' + index, true))
renderGroup.push(normalItem(item, filterItemsIndex + '-' + index, true))
})
return renderGroup
// 无子节点情况下,不显示该分组
return renderGroup.filter((item) => !!item).length === 1 ? null : renderGroup
}
const normalItem = (item, filterItemsIndex, isChildItem) => {
if (!matchFilter(item)) return null
matched++
const _filterItemsIndex = filterItemsIndex
const isSelected = itemSelected(item)
Expand Down Expand Up @@ -283,11 +285,9 @@ const SelectDropdown = ({
>
{filterItems &&
filterItems.map((item, filterItemsIndex) => {
if (matchFilter(item)) {
return item[transKeys(fieldNames, 'children')]
? groupItem(item, filterItemsIndex)
: normalItem(item, filterItemsIndex)
}
return item[transKeys(fieldNames, 'children')]
? groupItem(item, filterItemsIndex)
: normalItem(item, filterItemsIndex)
})}
{matched === 0 && (
<li
Expand Down
2 changes: 1 addition & 1 deletion components/table/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ interface Props {
resizable?: boolean
standard?: boolean
emptyContent?: string | JSX.Element
onHeaderRow: HeaderRowFunc
onHeaderRow?: HeaderRowFunc
columns: ColumnItem[]
data: object[]
style?: CSSProperties
Expand Down
25 changes: 12 additions & 13 deletions components/tabs/Tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,17 @@ const Tabs = ({
const [dragged, setDragged] = useState()
const [over, setOver] = useState()
const [deletetabId, setDeletetabId] = useState()
const [checkEditable, setCheckEditable] = useState(editable && type === 'editable')

const latestActiveId = useRef(activeId)

const inkRef = useRef()
const childRef = useRef()

useEffect(() => {
setCheckEditable(editable && type === 'editable')
}, [editable, type])

useEffect(() => {
if (deletetabId && latestActiveId.current === activeId) {
setActiveId(children[0] && children[0].props.tabId)
Expand Down Expand Up @@ -100,12 +106,10 @@ const Tabs = ({
// 计算激活状态下选中横线
const pseudoPosition = useCallback(
(index) => {
const parentNode = containRef.current
if (!parentNode.childNodes.length) {
return
}
const child = parentNode.childNodes[index]
if (child) {
const parentNode = containRef.current || {}
const { childNodes = [] } = parentNode
if (childNodes[index]) {
const child = childNodes[index]
const { width } = child.getBoundingClientRect()
const ink = inkRef.current
if (placement === 'horizontal' && ink) {
Expand Down Expand Up @@ -164,8 +168,6 @@ const Tabs = ({
[editable, activeId]
)

const checkEditable = useCallback(() => editable && type === 'editable', [editable])

const renderTabContent = useCallback(
(child, index) => {
const { tabId, animation } = child.props
Expand Down Expand Up @@ -407,7 +409,7 @@ const Tabs = ({
activeId={activeId}
type={type}
showTabItems={showTabItems}
editable={editableFlag}
editable={checkEditable}
handleClick={handleClick}
deleteTab={deleteTab}
dragStart={dragStart}
Expand Down Expand Up @@ -454,7 +456,7 @@ const Tabs = ({
/>
)}
</div>
{editableFlag && !canScroll && (
{checkEditable && onAdd && !canScroll && (
<div className={`${prefixCls}__add`}>
<Icon onClick={addTab} name="plus" />
</div>
Expand All @@ -478,8 +480,6 @@ const Tabs = ({
}
)

const editableFlag = checkEditable()

const animateDone = (tabId) => {
Tooltip.close(`tab-${tabId}`)
}
Expand Down Expand Up @@ -530,7 +530,6 @@ Tabs.defaultProps = {
onDrop: noop,
onDropEnd: noop,
onDragStart: noop,
onAdd: noop,
onDelete: noop,
draggable: false
}
Expand Down
6 changes: 3 additions & 3 deletions components/upload/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
type FileItem = {
fileId: string
fileId?: string
fileType: string
name: string
uploadState: 'success' | 'uploading' | 'error'
url: string
url?: string
}
interface Props {
type?: 'default' | 'drag' | 'pictureCard' | 'avatar' | 'photo'
Expand All @@ -12,7 +12,7 @@ interface Props {
tips?: string | JSX.Element,
maxSize?: number
maxCount?: number
uploadAction: string
uploadAction?: string
data?: {
[prop: string]: any
}
Expand Down
1 change: 1 addition & 0 deletions docs/demo/select/select-group.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Demo extends React.Component {
<Select
type='multiple'
data={data}
searchable
placeholder='请选择'
showCheckAll
style={{ width: 200 }}
Expand Down
14 changes: 14 additions & 0 deletions docs/zh-CN/docs/upgrade-from-2x.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ HIUI v3.0.0 是一次大版本更新,在此次迭代中,我们主要对 HIUI

3.0.0 是基于 2.14.0 进行开发的,最大限度的对组件已有 API 进行了的兼容,但是有些组件进行的功能升级,带来一些破坏性,需要做一些调整

## 样式方面

升级过程中,需引入 `hiui``3.0`基础样式。

```js
import "@hi-ui/hiui/es/base-css"
```

### Dropdown 下拉菜单

- 对 DataItem 配置 href 属性后做了优化,渲染为 a 标签,同时也支持 target 属性设置打开方式
Expand Down Expand Up @@ -67,6 +75,12 @@ HIUI v3.0.0 是一次大版本更新,在此次迭代中,我们主要对 HIUI

除上述组件以外的其余组件,我们均提供了向前兼容,但是我们建议您使用新的 API 来完成后续的开发。

### DatePicker 日期选择器

- 时间处理库由 `date-fns` 改为使用 `moment`,如使用了 `format` 方法;请关注

除上述组件以外的其余组件,我们均提供了向前兼容,但是我们建议您使用新的 API 来完成后续的开发。

#### 组件重构

- `<DatePicker/> 、<TimePicker/>、<Tree/> 、<Tabs/>`
Expand Down

0 comments on commit 7b956eb

Please sign in to comment.