Fix arrowPointAtCenter not work in Popconfirm

This commit is contained in:
afc163 2016-10-07 15:30:05 +08:00
parent 6df2100a5c
commit 36058f7173
5 changed files with 6 additions and 14 deletions

View File

@ -2,7 +2,6 @@ import React from 'react';
import Tooltip from '../tooltip';
import Icon from '../icon';
import Button from '../button';
import getPlacements from '../popover/placements';
import splitObject from '../_util/splitObject';
const noop = () => {};
@ -93,9 +92,9 @@ export default class Popconfirm extends React.Component<PopconfirmProps, any> {
}
render() {
const [{ prefixCls, title, placement, arrowPointAtCenter }, restProps] = splitObject(
const [{ prefixCls, title, placement }, restProps] = splitObject(
this.props,
['prefixCls', 'title', 'placement', 'arrowPointAtCenter']
['prefixCls', 'title', 'placement']
);
let { okText, cancelText } = this.props;
if (this.context.antLocale && this.context.antLocale.Popconfirm) {
@ -120,7 +119,6 @@ export default class Popconfirm extends React.Component<PopconfirmProps, any> {
return (
<Tooltip
{...restProps}
builtinPlacements={getPlacements({ arrowPointAtCenter })}
prefixCls={prefixCls}
placement={placement}
onVisibleChange={this.onVisibleChange}

View File

@ -50,7 +50,7 @@ ReactDOM.render(
<Button>LB</Button>
</Popover>
</div>
<div style={{ width: buttonWidth, marginLeft: buttonWidth*4 + 24 }}>
<div style={{ width: buttonWidth, marginLeft: (buttonWidth * 4) + 24 }}>
<Popover placement="rightTop" title={text} content={content} trigger="click">
<Button>RT</Button>
</Popover>

View File

@ -1,8 +1,5 @@
import React from 'react';
import Tooltip from '../tooltip';
import getPlacements from './placements';
const placements = getPlacements();
export interface PopoverProps {
/** trigger type, options: `hover` `focus` `click` */
@ -47,14 +44,11 @@ export default class Popover extends React.Component<PopoverProps, any> {
render() {
return (
<Tooltip transitionName={this.props.transitionName}
builtinPlacements={placements}
<Tooltip
ref="tooltip"
{...this.props}
overlay={this.getOverlay()}
>
{this.props.children}
</Tooltip>
/>
);
}

View File

@ -1,7 +1,7 @@
import React from 'react';
import { cloneElement } from 'react';
import RcTooltip from 'rc-tooltip';
import getPlacements from '../popover/placements';
import getPlacements from './placements';
import classNames from 'classnames';
export type PopoverPlacement =