Merge branch 'develop-1.0.0' of https://github.com/ddcat1115/ant-design into ddcat1115-develop-1.0.0

This commit is contained in:
afc163 2016-05-07 15:19:35 +08:00
commit aa38caf51f
6 changed files with 15 additions and 1 deletions

View File

@ -11,6 +11,7 @@ const noop = () => {};
export default class Popconfirm extends React.Component { export default class Popconfirm extends React.Component {
static defaultProps = { static defaultProps = {
transitionName: 'zoom-big', transitionName: 'zoom-big',
openClassName: 'ant-popup',
placement: 'top', placement: 'top',
trigger: 'click', trigger: 'click',
overlayStyle: {}, overlayStyle: {},

View File

@ -25,3 +25,5 @@ english: Popconfirm
| onVisibleChange | 显示隐藏的回调 | function(visible) | 无 | | onVisibleChange | 显示隐藏的回调 | function(visible) | 无 |
| okText | 确认按钮文字 | String | 确定 | | okText | 确认按钮文字 | String | 确定 |
| cancelText| 取消按钮文字 | String | 取消 | | cancelText| 取消按钮文字 | String | 取消 |
| openClassName | 气泡框展现时触发器添加的class可用于触发时触发器的样式指定 | string | ant-popup |

View File

@ -8,6 +8,7 @@ const placements = getPlacements();
export default class Popover extends React.Component { export default class Popover extends React.Component {
static defaultProps = { static defaultProps = {
prefixCls: 'ant-popover', prefixCls: 'ant-popover',
openClassName: 'ant-popup',
placement: 'top', placement: 'top',
transitionName: 'zoom-big', transitionName: 'zoom-big',
trigger: 'hover', trigger: 'hover',

View File

@ -26,3 +26,5 @@ english: Popover
| visible | 用于手动控制浮层显隐 | boolean | false | | visible | 用于手动控制浮层显隐 | boolean | false |
| onVisibleChange | 显示隐藏改变的回调 | function | 无 | | onVisibleChange | 显示隐藏改变的回调 | function | 无 |
| getTooltipContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/ONjyba?editors=001) | Function(triggerNode) | () => document.body | | getTooltipContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](http://codepen.io/anon/pen/ONjyba?editors=001) | Function(triggerNode) | () => document.body |
| openClassName | 气泡框展现时触发器添加的class可用于触发时触发器的样式指定 | string | ant-popup |

View File

@ -9,6 +9,7 @@ const placements = getPlacements({
export default class Tooltip extends React.Component { export default class Tooltip extends React.Component {
static defaultProps = { static defaultProps = {
prefixCls: 'ant-tooltip', prefixCls: 'ant-tooltip',
openClassName: 'ant-popup',
placement: 'top', placement: 'top',
transitionName: 'zoom-big', transitionName: 'zoom-big',
mouseEnterDelay: 0.1, mouseEnterDelay: 0.1,
@ -67,6 +68,11 @@ export default class Tooltip extends React.Component {
if (!this.props.title && !this.props.overlay) { if (!this.props.title && !this.props.overlay) {
visible = false; 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 ( return (
<RcTooltip transitionName={this.props.transitionName} <RcTooltip transitionName={this.props.transitionName}
builtinPlacements={placements} builtinPlacements={placements}
@ -76,7 +82,7 @@ export default class Tooltip extends React.Component {
onPopupAlign={this.onPopupAlign} onPopupAlign={this.onPopupAlign}
ref="tooltip" ref="tooltip"
{...this.props}> {...this.props}>
{this.props.children} {visible ? React.cloneElement(children, { className: childrenCls }) : this.props.children}
</RcTooltip> </RcTooltip>
); );
} }

View File

@ -19,3 +19,5 @@ english: Tooltip
|-----------|------------------------------------------|------------|--------| |-----------|------------------------------------------|------------|--------|
| placement | 气泡框位置,可选 `top` `left` `right` `bottom` `topLeft` `topRight` `bottomLeft` `bottomRight` `leftTop` `leftBottom` `rightTop` `rightBottom` | string | top | | placement | 气泡框位置,可选 `top` `left` `right` `bottom` `topLeft` `topRight` `bottomLeft` `bottomRight` `leftTop` `leftBottom` `rightTop` `rightBottom` | string | top |
| title | 提示文字 | string/React.Element | 无 | | title | 提示文字 | string/React.Element | 无 |
| openClassName | 气泡框展现时触发器添加的class可用于触发时触发器的样式指定 | string | ant-popup |