diff --git a/packages/s2-react/__tests__/unit/components/tooltip/__snapshots__/index-spec.tsx.snap b/packages/s2-react/__tests__/unit/components/tooltip/__snapshots__/index-spec.tsx.snap index 6d237cc704..e15fad005c 100644 --- a/packages/s2-react/__tests__/unit/components/tooltip/__snapshots__/index-spec.tsx.snap +++ b/packages/s2-react/__tests__/unit/components/tooltip/__snapshots__/index-spec.tsx.snap @@ -106,54 +106,43 @@ exports[`Tooltip Common Components Tests render custom react component icon 1`] tabindex="0" >
  • - + + + react component icon +
  • - + + + + + 隐藏 +
  • - + + + + 组内升序 +
  • - + + + + 组内降序 +
  • - + 不排序 +
  • - + + + + 组内升序 +
  • - + + + + 组内降序 +
  • - + 不排序 +
  • - + + + + 组内升序 +
  • - + + + + 组内降序 +
  • - + 不排序 +
  • - + + + + 组内升序 +
  • - + + + + 组内降序 +
  • - + 不排序 +
  • { expect(screen.getByText('不排序')).toBeDefined(); const selectedMenu = Array.from( - document.querySelectorAll('.ant-menu-submenu-selected'), + document.querySelectorAll('.ant-menu-item-selected'), ); expect(selectedMenu).toHaveLength(1); diff --git a/packages/s2-react/src/components/tooltip/components/operator.tsx b/packages/s2-react/src/components/tooltip/components/operator.tsx index 31312ea99a..ab0ea5baaf 100644 --- a/packages/s2-react/src/components/tooltip/components/operator.tsx +++ b/packages/s2-react/src/components/tooltip/components/operator.tsx @@ -54,7 +54,7 @@ export const TooltipOperator: React.FC> = onTitleClick?.(info as any, cell); onMenuClick?.(info); }, - children: subMenus, + children: !isEmpty(subMenus) ? subMenus : undefined, }; }; diff --git a/packages/s2-shared/src/styles/tooltip/operator.less b/packages/s2-shared/src/styles/tooltip/operator.less index 12bf087eeb..d55b166b3f 100644 --- a/packages/s2-shared/src/styles/tooltip/operator.less +++ b/packages/s2-shared/src/styles/tooltip/operator.less @@ -14,6 +14,10 @@ border: 0; cursor: pointer; + .ant-menu { + font-size: @tooltip-menu-font-size; + } + .ant-menu-horizontal:not(.ant-menu-dark) { background: transparent; line-height: @tooltip-menu-item-height; @@ -29,7 +33,6 @@ color: var(~'@{css-var-prefix}-font', ~'@{tooltip-menu-item-text-color}'); border: 0; user-select: none; - padding: 4px; width: 100%; .ant-menu-item { @@ -122,51 +125,3 @@ } } } - -// mobile style -@media only screen and (max-device-width: 480px) { - .@{tooltip-operator-cls-prefix} { - &-menus.ant-menu-vertical.ant-menu { - font-size: @tooltip-menu-font-size; - - .ant-menu-item { - height: @tooltip-menu-item-height; - } - } - - &-menus.ant-dropdown-menu-vertical, - &-menus.ant-menu-vertical { - .ant-dropdown-menu-item, - .ant-menu-item { - line-height: @tooltip-menu-item-height; - } - - .ant-dropdown-menu-submenu, - .ant-dropdown-menu-submenu-vertical, - .ant-menu-submenu, - .ant-menu-submenu-vertical { - .ant-menu-submenu-title { - .with-menu-item-color(); - - font-size: @tooltip-menu-font-size; - } - } - } - - &-submenu-popup { - .ant-dropdown-menu-item, - .ant-menu-item { - .with-menu-item-color(); - - font-size: @tooltip-menu-font-size; - } - } - - &-icon { - svg { - width: @tooltip-menu-font-size; - height: @tooltip-menu-font-size; - } - } - } -}