Skip to content

Commit

Permalink
fix(select): overflow popover won't hide after removing all options i…
Browse files Browse the repository at this point in the history
…n it when `maxTagCount="responsive"`, closes #3801
  • Loading branch information
07akioni committed Oct 2, 2022
1 parent 59d98a9 commit 1505899
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Fix `n-timeline-item`'s `title`'s `margin-bottom` can't be set by theme variable, closes [#3722](https://github.com/tusen-ai/naive-ui/issues/3722).
- Fix `n-timeline-item`'s `meta` part's `margin-bottom` is overrided when nested in horizontal and vertical mode.
- Fix `n-tree-select` would remove selected first option if it's clicked when placed in `label` tag, closes [#3715](https://github.com/tusen-ai/naive-ui/issues/3715).
- Fix `n-select`'s overflow popover won't hide after removing all options in it when `maxTagCount="responsive"`, closes [#3801](https://github.com/tusen-ai/naive-ui/issues/3801).

### Feats

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- 修复 `n-timeline-item``title``margin-bottom` 无法通过主题变量设置,关闭 [#3722](https://github.com/tusen-ai/naive-ui/issues/3722)
- 修复 `n-timeline-item``meta` 在水平垂直嵌套时 `margin-bottom` 被覆盖
- 修复 `n-tree-select` 在放置于 `label` 标签内时点击会删除掉第一个选中的选项,关闭 [#3715](https://github.com/tusen-ai/naive-ui/issues/3715)
- 修复 `n-select``maxTagCount="responsive"` 的情况下,在弹层删除掉所有已选中项后,弹层不会消失,关闭 [#3801](https://github.com/tusen-ai/naive-ui/issues/3801)

### Feats

Expand Down
9 changes: 8 additions & 1 deletion src/_internal/selection/src/Selection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,9 @@ export default defineComponent({
if (props.disabled || props.active) return
clearEnterTimer()
enterTimerId = window.setTimeout(() => {
showTagsPopoverRef.value = true
if (selectedRef.value) {
showTagsPopoverRef.value = true
}
}, 100)
}
function handleMouseLeaveCounter (): void {
Expand All @@ -358,6 +360,11 @@ export default defineComponent({
showTagsPopoverRef.value = false
}
}
watch(selectedRef, (value) => {
if (!value) {
showTagsPopoverRef.value = false
}
})
onMounted(() => {
watchEffect(() => {
const patternInputWrapperEl = patternInputWrapperRef.value
Expand Down

0 comments on commit 1505899

Please sign in to comment.