Skip to content

Commit

Permalink
fix(menu): resolve overflow issue with n-menu root-indent (#5616) (#5618
Browse files Browse the repository at this point in the history
)

* fix(menu): resolve overflow issue with `n-menu` `root-indent` (#5616)

* chore: add comment

* Update src/menu/demos/zhCN/indent.demo.vue

---------

Co-authored-by: 07akioni <07akioni2@gmail.com>
  • Loading branch information
kirklin and 07akioni committed Jan 23, 2024
1 parent fce7b64 commit 558c4b4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- Fix `n-tree`'s `override-default-node-click-behavior` prop may conflict with default switcher click or checkbox click behavior.
- Fix overflow issue with `n-menu` `root-indent` `indent`, closes (#5616)

## 2.37.3

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- 修复 `n-tree``override-default-node-click-behavior` 属性可能覆盖掉默认展开按钮和选中按钮的行为
- 修复 `n-menu` `root-indent` `indent` 下内容溢出的问题,关闭(#5616)

## 2.37.3

Expand Down
7 changes: 5 additions & 2 deletions src/menu/src/use-menu-child.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ export function useMenuChild (props: UseMenuChildProps): UseMenuChild {
})
const paddingLeftRef = computed(() => {
if (horizontalRef.value) return undefined
const { collapsedWidth, indent, rootIndent } = menuProps
const { collapsedWidth, indent: propsIdent, rootIndent: propsRootIdent } = menuProps
const { root, isGroup } = props
// Fix overflow issue with `n-menu` `root-indent` `indent`, closes (#5616)
const indent = propsIdent + 8
const rootIndent = propsRootIdent === undefined ? undefined : propsRootIdent + 8
const mergedRootIndent = rootIndent === undefined ? indent : rootIndent
if (root) {
if (mergedCollapsedRef.value) {
Expand All @@ -99,7 +102,7 @@ export function useMenuChild (props: UseMenuChildProps): UseMenuChild {
if (NSubmenu && typeof NSubmenu.paddingLeftRef.value === 'number') {
return (isGroup ? indent / 2 : indent) + NSubmenu.paddingLeftRef.value
}
return 0
return 8
})
const iconMarginRightRef = computed(() => {
const { collapsedWidth, indent, rootIndent } = menuProps
Expand Down

0 comments on commit 558c4b4

Please sign in to comment.