Browse Source

Fix arrowPointAtCenter not work in Popconfirm

pull/3318/head
afc163 8 years ago
parent
commit
36058f7173
  1. 6
      components/popconfirm/index.tsx
  2. 2
      components/popover/demo/placement.md
  3. 10
      components/popover/index.tsx
  4. 2
      components/tooltip/index.tsx
  5. 0
      components/tooltip/placements.tsx

6
components/popconfirm/index.tsx

@ -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}

2
components/popover/demo/placement.md

@ -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>

10
components/popover/index.tsx

@ -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>
/>
);
}

2
components/tooltip/index.tsx

@ -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 =

0
components/popover/placements.tsx → components/tooltip/placements.tsx

Loading…
Cancel
Save