fix: popover & popconfirm auto placement, close #4767
parent
7638d3cc69
commit
98b5e5d53f
|
@ -19,6 +19,7 @@ import classNames from '../_util/classNames';
|
||||||
import { getTransitionName } from '../_util/transition';
|
import { getTransitionName } from '../_util/transition';
|
||||||
import { cloneVNodes } from '../_util/vnode';
|
import { cloneVNodes } from '../_util/vnode';
|
||||||
import omit from '../_util/omit';
|
import omit from '../_util/omit';
|
||||||
|
import { tooltipDefaultProps } from '../tooltip/Tooltip';
|
||||||
|
|
||||||
export const popconfirmProps = () => ({
|
export const popconfirmProps = () => ({
|
||||||
...abstractTooltipProps(),
|
...abstractTooltipProps(),
|
||||||
|
@ -47,6 +48,7 @@ export interface PopconfirmLocale {
|
||||||
const Popconfirm = defineComponent({
|
const Popconfirm = defineComponent({
|
||||||
name: 'APopconfirm',
|
name: 'APopconfirm',
|
||||||
props: initDefaultProps(popconfirmProps(), {
|
props: initDefaultProps(popconfirmProps(), {
|
||||||
|
...tooltipDefaultProps,
|
||||||
trigger: 'click',
|
trigger: 'click',
|
||||||
transitionName: 'zoom-big',
|
transitionName: 'zoom-big',
|
||||||
align: () => ({}),
|
align: () => ({}),
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { withInstall } from '../_util/type';
|
||||||
import useConfigInject from '../_util/hooks/useConfigInject';
|
import useConfigInject from '../_util/hooks/useConfigInject';
|
||||||
import omit from '../_util/omit';
|
import omit from '../_util/omit';
|
||||||
import { getTransitionName } from '../_util/transition';
|
import { getTransitionName } from '../_util/transition';
|
||||||
|
import { tooltipDefaultProps } from '../tooltip/Tooltip';
|
||||||
|
|
||||||
export const popoverProps = () => ({
|
export const popoverProps = () => ({
|
||||||
...abstractTooltipProps(),
|
...abstractTooltipProps(),
|
||||||
|
@ -20,6 +21,7 @@ export type PopoverProps = Partial<ExtractPropTypes<ReturnType<typeof popoverPro
|
||||||
const Popover = defineComponent({
|
const Popover = defineComponent({
|
||||||
name: 'APopover',
|
name: 'APopover',
|
||||||
props: initDefaultProps(popoverProps(), {
|
props: initDefaultProps(popoverProps(), {
|
||||||
|
...tooltipDefaultProps,
|
||||||
trigger: 'hover',
|
trigger: 'hover',
|
||||||
transitionName: 'zoom-big',
|
transitionName: 'zoom-big',
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
|
|
|
@ -47,6 +47,17 @@ export const tooltipProps = () => ({
|
||||||
title: PropTypes.any,
|
title: PropTypes.any,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const tooltipDefaultProps = {
|
||||||
|
trigger: 'hover',
|
||||||
|
transitionName: 'zoom-big-fast',
|
||||||
|
align: () => ({}),
|
||||||
|
placement: 'top',
|
||||||
|
mouseEnterDelay: 0.1,
|
||||||
|
mouseLeaveDelay: 0.1,
|
||||||
|
arrowPointAtCenter: false,
|
||||||
|
autoAdjustOverflow: true,
|
||||||
|
};
|
||||||
|
|
||||||
export type TriggerTypes = typeof triggerTypes[number];
|
export type TriggerTypes = typeof triggerTypes[number];
|
||||||
|
|
||||||
export type PlacementTypes = typeof placementTypes[number];
|
export type PlacementTypes = typeof placementTypes[number];
|
||||||
|
|
Loading…
Reference in New Issue