Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ddcat1115 committed May 6, 2016
1 parent 7b54c49 commit 7c866bc
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/popconfirm/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {},
Expand Down
2 changes: 2 additions & 0 deletions components/popconfirm/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ english: Popconfirm
| onVisibleChange | 显示隐藏的回调 | function(visible) ||
| okText | 确认按钮文字 | String | 确定 |
| cancelText| 取消按钮文字 | String | 取消 |
| openClassName | 气泡框展现时触发器添加的class,可用于触发时触发器的样式指定 | string | ant-popup |

1 change: 1 addition & 0 deletions components/popover/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const placements = getPlacements();
export default class Popover extends React.Component {
static defaultProps = {
prefixCls: 'ant-popover',
openClassName: 'ant-popup',
placement: 'top',
transitionName: 'zoom-big',
trigger: 'hover',
Expand Down
2 changes: 2 additions & 0 deletions components/popover/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ english: Popover
| visible | 用于手动控制浮层显隐 | boolean | false |
| onVisibleChange | 显示隐藏改变的回调 | function ||
| getTooltipContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/ONjyba?editors=001) | Function(triggerNode) | () => document.body |
| openClassName | 气泡框展现时触发器添加的class,可用于触发时触发器的样式指定 | string | ant-popup |

8 changes: 7 additions & 1 deletion components/tooltip/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const placements = getPlacements({
export default class Tooltip extends React.Component {
static defaultProps = {
prefixCls: 'ant-tooltip',
openClassName: 'ant-popup',
placement: 'top',
transitionName: 'zoom-big',
mouseEnterDelay: 0.1,
Expand Down Expand Up @@ -67,6 +68,11 @@ export default class Tooltip extends React.Component {
if (!this.props.title && !this.props.overlay) {
visible = false;
}
if ('visible' in this.props) {
visible = this.props.visible;
}
const children = this.props.children;
const childrenCls = children.props.className ? `${children.props.className} ${this.props.openClassName}` : this.props.openClassName;
return (
<RcTooltip transitionName={this.props.transitionName}
builtinPlacements={placements}
Expand All @@ -76,7 +82,7 @@ export default class Tooltip extends React.Component {
onPopupAlign={this.onPopupAlign}
ref="tooltip"
{...this.props}>
{this.props.children}
{visible ? React.cloneElement(children, { className: childrenCls }) : this.props.children}
</RcTooltip>
);
}
Expand Down
2 changes: 2 additions & 0 deletions components/tooltip/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ english: Tooltip
|-----------|------------------------------------------|------------|--------|
| placement | 气泡框位置,可选 `top` `left` `right` `bottom` `topLeft` `topRight` `bottomLeft` `bottomRight` `leftTop` `leftBottom` `rightTop` `rightBottom` | string | top |
| title | 提示文字 | string/React.Element ||
| openClassName | 气泡框展现时触发器添加的class,可用于触发时触发器的样式指定 | string | ant-popup |

0 comments on commit 7c866bc

Please sign in to comment.