Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions src/menu/demos/zhCN/indent.demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<template>
<n-menu
v-model:value="activeKey"
:root-indent="36"
:indent="12"
:root-indent="0"
:indent="0"
07akioni marked this conversation as resolved.
Show resolved Hide resolved
:options="menuOptions"
/>
</template>
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