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

feat(breadcrumb): add tooltipProps #2990

Merged
merged 2 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 8 additions & 1 deletion src/breadcrumb/BreadcrumbItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const BreadcrumbItem = forwardRef<HTMLDivElement, BreadcrumbItemProps>((props, r
className,
content,
onClick,
tooltipProps,
...restProps
} = useDefaultProps<BreadcrumbItemProps>(props, breadcrumbItemDefaultProps);

Expand Down Expand Up @@ -95,7 +96,13 @@ const BreadcrumbItem = forwardRef<HTMLDivElement, BreadcrumbItemProps>((props, r

return (
<div className={classNames(breadcrumbItemClassNames, className)} ref={ref} onClick={handleClick} {...restProps}>
{isCutOff ? <TooltipLite content={children || content}>{itemContent}</TooltipLite> : itemContent}
{isCutOff ? (
<TooltipLite content={children || content} {...tooltipProps}>
{itemContent}
</TooltipLite>
) : (
itemContent
)}
<span className={separatorClassName}>{separatorContent}</span>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/breadcrumb/breadcrumb.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ replace | Boolean | false | \- | N
router | Object | - | Typescript:`any` | N
target | String | _self | options: _blank/_self/_parent/_top | N
to | String / Object | - | Typescript:`string \| Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
tooltipProps | Object | - | Typescript:`TooltipProps`,[Tooltip API Documents](./tooltip?tab=api)。[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
onClick | Function | | Typescript:`(e: MouseEvent) => void`<br/>trigger on click | N
1 change: 1 addition & 0 deletions src/breadcrumb/breadcrumb.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ replace | Boolean | false | 路由跳转是否采用覆盖的方式(覆盖后
router | Object | - | 路由对象。如果项目存在 Router,则默认使用 Router。TS 类型:`any` | N
target | String | _self | 链接或路由跳转方式。可选项:_blank/_self/_parent/_top | N
to | String / Object | - | 路由跳转目标,当且仅当 Router 存在时,该 API 有效。TS 类型:`string \| Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
tooltipProps | Object | - | 透传提示组件属性。TS 类型:`TooltipProps`,[Tooltip API Documents](./tooltip?tab=api)。[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/breadcrumb/type.ts) | N
onClick | Function | | TS 类型:`(e: MouseEvent) => void`<br/>点击时触发 | N
5 changes: 5 additions & 0 deletions src/breadcrumb/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TooltipLiteProps as TooltipProps } from '../tooltip';
import { TNode, TElement } from '../common';
import { MouseEvent } from 'react';

Expand Down Expand Up @@ -66,6 +67,10 @@ export interface TdBreadcrumbItemProps {
* 路由跳转目标,当且仅当 Router 存在时,该 API 有效
*/
to?: string | Route;
/**
* 透传提示组件属性
*/
tooltipProps?: TooltipProps;
/**
* 点击时触发
*/
Expand Down
Loading
Loading