Skip to content

Commit 98b5e5d

Browse files
committed
fix: popover & popconfirm auto placement, close #4767
1 parent 7638d3c commit 98b5e5d

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

components/popconfirm/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import classNames from '../_util/classNames';
1919
import { getTransitionName } from '../_util/transition';
2020
import { cloneVNodes } from '../_util/vnode';
2121
import omit from '../_util/omit';
22+
import { tooltipDefaultProps } from '../tooltip/Tooltip';
2223

2324
export const popconfirmProps = () => ({
2425
...abstractTooltipProps(),
@@ -47,6 +48,7 @@ export interface PopconfirmLocale {
4748
const Popconfirm = defineComponent({
4849
name: 'APopconfirm',
4950
props: initDefaultProps(popconfirmProps(), {
51+
...tooltipDefaultProps,
5052
trigger: 'click',
5153
transitionName: 'zoom-big',
5254
align: () => ({}),

components/popover/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { withInstall } from '../_util/type';
88
import useConfigInject from '../_util/hooks/useConfigInject';
99
import omit from '../_util/omit';
1010
import { getTransitionName } from '../_util/transition';
11+
import { tooltipDefaultProps } from '../tooltip/Tooltip';
1112

1213
export const popoverProps = () => ({
1314
...abstractTooltipProps(),
@@ -20,6 +21,7 @@ export type PopoverProps = Partial<ExtractPropTypes<ReturnType<typeof popoverPro
2021
const Popover = defineComponent({
2122
name: 'APopover',
2223
props: initDefaultProps(popoverProps(), {
24+
...tooltipDefaultProps,
2325
trigger: 'hover',
2426
transitionName: 'zoom-big',
2527
placement: 'top',

components/tooltip/Tooltip.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ export const tooltipProps = () => ({
4747
title: PropTypes.any,
4848
});
4949

50+
export const tooltipDefaultProps = {
51+
trigger: 'hover',
52+
transitionName: 'zoom-big-fast',
53+
align: () => ({}),
54+
placement: 'top',
55+
mouseEnterDelay: 0.1,
56+
mouseLeaveDelay: 0.1,
57+
arrowPointAtCenter: false,
58+
autoAdjustOverflow: true,
59+
};
60+
5061
export type TriggerTypes = typeof triggerTypes[number];
5162

5263
export type PlacementTypes = typeof placementTypes[number];

0 commit comments

Comments
 (0)