Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix tooltip trigger type #22043

Merged
merged 4 commits into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/rate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class Rate extends React.Component<RateProps, any> {
this.rcRate = node;
};

characterRender = (node: React.ReactNode, { index }: RateNodeProps) => {
characterRender = (node: React.ReactElement, { index }: RateNodeProps) => {
const { tooltips } = this.props;
if (!tooltips) return node;

Expand Down
2 changes: 1 addition & 1 deletion components/tooltip/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The following APIs are shared by Tooltip, Popconfirm, Popover.
| overlayClassName | Class name of the tooltip card | string | - |
| overlayStyle | Style of the tooltip card | object | - |
| placement | The position of the tooltip relative to the target, which can be one of `top` `left` `right` `bottom` `topLeft` `topRight` `bottomLeft` `bottomRight` `leftTop` `leftBottom` `rightTop` `rightBottom` | string | `top` |
| trigger | Tooltip trigger mode | `hover` \| `focus` \| `click` \| `contextMenu` | `hover` |
| trigger | Tooltip trigger mode. Could be multiple by passing an array | `hover` \| `focus` \| `click` \| `contextMenu` \| `Array<string>` | `hover` |
| visible | Whether the floating tooltip card is visible or not | boolean | `false` |
| onVisibleChange | Callback executed when visibility of the tooltip card is changed | (visible) => void | - |
| align | this value will be merged into placement's config, please refer to the settings [rc-tooltip](https://github.com/react-component/tooltip) | Object | - |
Expand Down
22 changes: 3 additions & 19 deletions components/tooltip/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as React from 'react';
import RcTooltip from 'rc-tooltip';
import { TooltipProps as RcTooltipProps } from 'rc-tooltip/lib/Tooltip';
import classNames from 'classnames';
import { AlignType, ActionType, BuildInPlacements } from 'rc-trigger/lib/interface';
import { BuildInPlacements } from 'rc-trigger/lib/interface';
import getPlacements, { AdjustOverflow, PlacementsConfig } from './placements';
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';

Expand Down Expand Up @@ -33,32 +34,15 @@ export interface TooltipAlignConfig {
useCssTransform?: boolean;
}

export interface AbstractTooltipProps {
prefixCls?: string;
overlayClassName?: string;
export interface AbstractTooltipProps extends Partial<RcTooltipProps> {
style?: React.CSSProperties;
className?: string;
overlayStyle?: React.CSSProperties;
placement?: TooltipPlacement;
builtinPlacements?: BuildInPlacements;
defaultVisible?: boolean;
visible?: boolean;
onVisibleChange?: (visible: boolean) => void;
mouseEnterDelay?: number;
mouseLeaveDelay?: number;
transitionName?: string;
trigger?: ActionType;
openClassName?: string;
arrowPointAtCenter?: boolean;
autoAdjustOverflow?: boolean | AdjustOverflow;
// getTooltipContainer had been rename to getPopupContainer
getTooltipContainer?: (triggerNode: HTMLElement) => HTMLElement;
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
children?: React.ReactNode;
// align is a more higher api
align?: AlignType;
/** Internal. Hide tooltip when hidden. This will be renamed in future. */
destroyTooltipOnHide?: boolean;
}

export type RenderFunction = () => React.ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion components/tooltip/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ title: Tooltip
| overlayClassName | 卡片类名 | string | 无 |
| overlayStyle | 卡片样式 | object | 无 |
| placement | 气泡框位置,可选 `top` `left` `right` `bottom` `topLeft` `topRight` `bottomLeft` `bottomRight` `leftTop` `leftBottom` `rightTop` `rightBottom` | string | top |
| trigger | 触发行为,可选 `hover/focus/click/contextMenu` | string | hover |
| trigger | 触发行为,可选 `hover/focus/click/contextMenu`,可使用数组设置多个触发行为 | string \| string[] | hover |
| visible | 用于手动控制浮层显隐 | boolean | false |
| onVisibleChange | 显示隐藏的回调 | (visible) => void | 无 |
| align | 该值将合并到 placement 的配置中,设置参考 [rc-tooltip](https://github.com/react-component/tooltip) | Object | 无 |
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"rc-switch": "~1.9.0",
"rc-table": "~7.3.0",
"rc-tabs": "~10.0.0",
"rc-tooltip": "~4.0.0",
"rc-tooltip": "~4.0.2",
"rc-tree": "~3.0.0",
"rc-tree-select": "~3.0.0",
"rc-trigger": "~4.0.0",
Expand Down