Skip to content

Commit

Permalink
Merge branch 'develop' into hotfix/#1482
Browse files Browse the repository at this point in the history
  • Loading branch information
GleanCoder1116 authored Jan 13, 2021
2 parents df776ef + d6fd5c6 commit b3a35c2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- 修复 `Select` 组件分组形态全选以及受控问题 [#1501](https://github.com/XiaoMi/hiui/issues/1501)
- 修复 `Tabs` 组件垂直方向样式显示异常问题 [#1493](https://github.com/XiaoMi/hiui/issues/1493)
- 优化 `Checkbox` 样式相关内容 [#1482](https://github.com/XiaoMi/hiui/issues/1482)
- 优化 `SelectTree` 异步受控数据返显问题 [#1510](https://github.com/XiaoMi/hiui/issues/1510)
## 3.3.0
- 新增 `Card` 模式模式下 loading 加载中状态 [#1454](https://github.com/XiaoMi/hiui/issues/1454)
- 新增 `Table` loading 加载中状态 [#1466](https://github.com/XiaoMi/hiui/issues/1466)
Expand Down
20 changes: 18 additions & 2 deletions components/select-tree/SelectTreeHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const SelectTree = ({

// 依赖 flattenData & value 解析生成 checkedNodes 或 selectedItems
useEffect(() => {
if (flattenData.length > 0) {
if (flattenData.length > 0 && value) {
if (type === 'multiple') {
const cstatus = parseCheckStatusData(
value,
Expand All @@ -130,7 +130,7 @@ const SelectTree = ({
}
}
}
}, [value])
}, [value, flattenData])

// 依赖展开项生成展开节点数据
useEffect(() => {
Expand Down Expand Up @@ -479,6 +479,22 @@ const SelectTree = ({

leftHandle({ activeId, flattenData, expandIds, expandEvents, setActiveId, mode })
}
// enter
if (evt.keyCode === 13) {
evt.preventDefault()
evt.stopPropagation()
if (mode !== 'breadcrumb') {
type === 'multiple'
? checkedEvents(
!selectedItems.some((item) => {
return activeId === item.id
}),
getNodeByIdTitle(activeId, flattenData),
checkedNodes
)
: selectedEvents(getNodeByIdTitle(activeId, flattenData))
}
}
// space 选中
if (evt.keyCode === 32 && !document.activeElement.classList.value.includes('hi-selecttree__searchinput')) {
evt.preventDefault()
Expand Down
1 change: 1 addition & 0 deletions components/select/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ const InternalSelect = (props) => {
checkAll={checkAll}
loading={loading}
focusedIndex={focusedIndex}
setFocusedIndex={setFocusedIndex}
showJustSelected={showJustSelected}
filterOption={filterOption}
matchFilter={matchFilter}
Expand Down
6 changes: 5 additions & 1 deletion components/select/SelectDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const SelectDropdown = ({
show,
fieldNames,
focusedIndex,
isGroup
isGroup,
setFocusedIndex
}) => {
const [filterItems, setFilterItems] = useState(dropdownItems)
const [searchbarValue, setSearchbarValue] = useState('')
Expand Down Expand Up @@ -253,6 +254,9 @@ const SelectDropdown = ({
onClick={(e) => onClickOptionIntal(e, item, _filterItemsIndex)}
key={item[transKeys(fieldNames, 'id')]}
index={filterItemsIndex}
onMouseEnter={() => {
setFocusedIndex(_filterItemsIndex)
}}
>
{renderOption(isSelected, item, filterItemsIndex)}
</li>
Expand Down

0 comments on commit b3a35c2

Please sign in to comment.