Browse Source

feat: update tooltips

pull/802/head
wangxueliang 6 years ago
parent
commit
5a627fc5f3
  1. 6
      components/tooltip/Tooltip.jsx
  2. 2
      components/tooltip/abstractTooltipProps.js

6
components/tooltip/Tooltip.jsx

@ -9,6 +9,7 @@ import {
getStyle,
isValidElement,
} from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import abstractTooltipProps from './abstractTooltipProps';
const splitObject = (obj, keys) => {
@ -158,8 +159,10 @@ export default {
render() {
const { $props, $data, $slots, $listeners } = this;
const { prefixCls, openClassName, getPopupContainer } = $props;
const { prefixCls: customizePrefixCls, openClassName, getPopupContainer } = $props;
const { getPopupContainer: getContextPopupContainer } = this.configProvider;
const getPrefixCls = this.configProvider.getPrefixCls || ConfigConsumerProps.getPrefixCls;
const prefixCls = getPrefixCls('tooltip', customizePrefixCls);
let children = ($slots.default || []).filter(c => c.tag || c.text.trim() !== '');
children = children.length === 1 ? children[0] : children;
let sVisible = $data.sVisible;
@ -179,6 +182,7 @@ export default {
const tooltipProps = {
props: {
...$props,
prefixCls,
getTooltipContainer: getPopupContainer || getContextPopupContainer,
builtinPlacements: this.getPlacements(),
visible: sVisible,

2
components/tooltip/abstractTooltipProps.js

@ -22,7 +22,7 @@ export default () => ({
// onVisibleChange: PropTypes.func,
overlayStyle: PropTypes.object.def({}),
overlayClassName: PropTypes.string,
prefixCls: PropTypes.string.def('ant-tooltip'),
prefixCls: PropTypes.string,
mouseEnterDelay: PropTypes.number.def(0.1),
mouseLeaveDelay: PropTypes.number.def(0.1),
getPopupContainer: PropTypes.func,

Loading…
Cancel
Save