mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 12:09:14 +08:00
fix: Popover shift (#45015)
* fix: Popover shift * chore: update snapshot
This commit is contained in:
parent
7e1ecf9133
commit
3928ce9fc1
@ -39,11 +39,15 @@ export function getOverflowOptions(
|
||||
case 'top':
|
||||
case 'bottom':
|
||||
baseOverflow.shiftX = arrowOffset.dropdownArrowOffset * 2 + arrowWidth;
|
||||
baseOverflow.shiftY = true;
|
||||
baseOverflow.adjustY = true;
|
||||
break;
|
||||
|
||||
case 'left':
|
||||
case 'right':
|
||||
baseOverflow.shiftY = arrowOffset.dropdownArrowOffsetVertical * 2 + arrowWidth;
|
||||
baseOverflow.shiftX = true;
|
||||
baseOverflow.adjustX = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -626,110 +626,6 @@ exports[`renders components/popover/demo/arrow.tsx extend context correctly 1`]
|
||||
|
||||
exports[`renders components/popover/demo/arrow.tsx extend context correctly 2`] = `[]`;
|
||||
|
||||
exports[`renders components/popover/demo/arrow-point-at-center.tsx extend context correctly 1`] = `
|
||||
<div
|
||||
class="ant-space ant-space-horizontal ant-space-align-center ant-space-gap-row-small ant-space-gap-col-small"
|
||||
style="flex-wrap: wrap;"
|
||||
>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Align edge / 边缘对齐
|
||||
</span>
|
||||
</button>
|
||||
<div
|
||||
class="ant-popover ant-zoom-big-appear ant-zoom-big-appear-prepare ant-zoom-big ant-popover-placement-topLeft"
|
||||
style="--arrow-x: 0px; --arrow-y: 0px; left: -1000vw; top: -1000vh; box-sizing: border-box;"
|
||||
>
|
||||
<div
|
||||
class="ant-popover-arrow"
|
||||
style="position: absolute;"
|
||||
/>
|
||||
<div
|
||||
class="ant-popover-content"
|
||||
>
|
||||
<div
|
||||
class="ant-popover-inner"
|
||||
role="tooltip"
|
||||
>
|
||||
<div
|
||||
class="ant-popover-title"
|
||||
>
|
||||
Title
|
||||
</div>
|
||||
<div
|
||||
class="ant-popover-inner-content"
|
||||
>
|
||||
<p>
|
||||
Content
|
||||
</p>
|
||||
<p>
|
||||
Content
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Arrow points to center / 箭头指向中心
|
||||
</span>
|
||||
</button>
|
||||
<div
|
||||
class="ant-popover ant-zoom-big-appear ant-zoom-big-appear-prepare ant-zoom-big ant-popover-placement-topLeft"
|
||||
style="--arrow-x: 0px; --arrow-y: 0px; left: -1000vw; top: -1000vh; box-sizing: border-box;"
|
||||
>
|
||||
<div
|
||||
class="ant-popover-arrow"
|
||||
style="position: absolute;"
|
||||
/>
|
||||
<div
|
||||
class="ant-popover-content"
|
||||
>
|
||||
<div
|
||||
class="ant-popover-inner"
|
||||
role="tooltip"
|
||||
>
|
||||
<div
|
||||
class="ant-popover-title"
|
||||
>
|
||||
Title
|
||||
</div>
|
||||
<div
|
||||
class="ant-popover-inner-content"
|
||||
>
|
||||
<p>
|
||||
Content
|
||||
</p>
|
||||
<p>
|
||||
Content
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders components/popover/demo/arrow-point-at-center.tsx extend context correctly 2`] = `
|
||||
[
|
||||
"Warning: [antd: Tooltip] \`arrowPointAtCenter\` is deprecated. Please use \`arrow={{ pointAtCenter: true }}\` instead.",
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`renders components/popover/demo/basic.tsx extend context correctly 1`] = `
|
||||
Array [
|
||||
<button
|
||||
|
@ -180,38 +180,6 @@ exports[`renders components/popover/demo/arrow.tsx correctly 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders components/popover/demo/arrow-point-at-center.tsx correctly 1`] = `
|
||||
<div
|
||||
class="ant-space ant-space-horizontal ant-space-align-center ant-space-gap-row-small ant-space-gap-col-small"
|
||||
style="flex-wrap:wrap"
|
||||
>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Align edge / 边缘对齐
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<button
|
||||
class="ant-btn ant-btn-default"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
Arrow points to center / 箭头指向中心
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders components/popover/demo/basic.tsx correctly 1`] = `
|
||||
<button
|
||||
class="ant-btn ant-btn-primary"
|
||||
|
@ -1,22 +0,0 @@
|
||||
import React from 'react';
|
||||
import { Button, Popover, Space } from 'antd';
|
||||
|
||||
const content = (
|
||||
<>
|
||||
<p>Content</p>
|
||||
<p>Content</p>
|
||||
</>
|
||||
);
|
||||
|
||||
const App: React.FC = () => (
|
||||
<Space wrap>
|
||||
<Popover placement="topLeft" title="Title" content={content}>
|
||||
<Button>Align edge / 边缘对齐</Button>
|
||||
</Popover>
|
||||
<Popover placement="topLeft" title="Title" content={content} arrowPointAtCenter>
|
||||
<Button>Arrow points to center / 箭头指向中心</Button>
|
||||
</Popover>
|
||||
</Space>
|
||||
);
|
||||
|
||||
export default App;
|
Loading…
Reference in New Issue
Block a user