mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-19 14:53:16 +08:00
Merge branch 'ddcat1115-develop-1.0.0' into develop-1.0.0
This commit is contained in:
commit
e48d8e5a85
@ -11,6 +11,7 @@ const noop = () => {};
|
||||
export default class Popconfirm extends React.Component {
|
||||
static defaultProps = {
|
||||
transitionName: 'zoom-big',
|
||||
openClassName: 'ant-popup',
|
||||
placement: 'top',
|
||||
trigger: 'click',
|
||||
overlayStyle: {},
|
||||
|
@ -25,3 +25,5 @@ english: Popconfirm
|
||||
| onVisibleChange | 显示隐藏的回调 | function(visible) | 无 |
|
||||
| okText | 确认按钮文字 | String | 确定 |
|
||||
| cancelText| 取消按钮文字 | String | 取消 |
|
||||
| openClassName | 气泡框展现时触发器添加的class,可用于触发时触发器的样式指定 | string | ant-popup |
|
||||
|
||||
|
@ -26,3 +26,4 @@ english: Popover
|
||||
| visible | 用于手动控制浮层显隐 | boolean | false |
|
||||
| onVisibleChange | 显示隐藏改变的回调 | function | 无 |
|
||||
| getTooltipContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/ONjyba?editors=001) | Function(triggerNode) | () => document.body |
|
||||
| openClassName | 气泡框展现时触发器添加的类名,可用于打开浮层时高亮触发器 | string | ant-popover-open |
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, { cloneElement } from 'react';
|
||||
import RcTooltip from 'rc-tooltip';
|
||||
import getPlacements from '../popover/placements';
|
||||
|
||||
@ -62,21 +62,29 @@ export default class Tooltip extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { prefixCls, title, overlay, children, transitionName } = this.props;
|
||||
// Hide tooltip when there is no title
|
||||
let visible = this.state.visible;
|
||||
if (!this.props.title && !this.props.overlay) {
|
||||
if (!title && !overlay) {
|
||||
visible = false;
|
||||
}
|
||||
if ('visible' in this.props) {
|
||||
visible = this.props.visible;
|
||||
}
|
||||
const openClassName = this.props.openClassName || `${prefixCls}-open`;
|
||||
const childrenCls = (children && children.props && children.props.className)
|
||||
? `${children.props.className} ${openClassName}` : openClassName;
|
||||
return (
|
||||
<RcTooltip transitionName={this.props.transitionName}
|
||||
<RcTooltip
|
||||
transitionName={transitionName}
|
||||
builtinPlacements={placements}
|
||||
overlay={this.props.title}
|
||||
overlay={title}
|
||||
visible={visible}
|
||||
onVisibleChange={this.onVisibleChange}
|
||||
onPopupAlign={this.onPopupAlign}
|
||||
ref="tooltip"
|
||||
{...this.props}>
|
||||
{this.props.children}
|
||||
{visible ? cloneElement(children, { className: childrenCls, }) : children}
|
||||
</RcTooltip>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user