Skip to content

Commit

Permalink
feat(menu): add tooltip props (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn authored Nov 14, 2024
1 parent 4185a62 commit e63cb6a
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 0 deletions.
Binary file modified db/TDesign.db
Binary file not shown.
1 change: 1 addition & 0 deletions packages/products/tdesign-react/src/menu/menu.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ disabled | Boolean | - | \- | N
href | String | - | \- | N
icon | TElement | - | Typescript:`TNode`[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
target | String | _self | options: _blank/_self/_parent/_top | N
tooltipProps | Object | - | Transparent all feature props of the Tooltip。Typescript:`TooltipProps`[Tooltip API Documents](./tooltip?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-react/blob/develop/src/menu/type.ts) | N
value | String / Number | - | Typescript:`MenuValue` | N
onClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/>trigger on click | N

Expand Down
1 change: 1 addition & 0 deletions packages/products/tdesign-react/src/menu/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ disabled | Boolean | - | 是否禁用菜单项展开/收起/跳转等功能 | N
href | String | - | 跳转链接 | N
icon | TElement | - | 图标。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/common.ts) | N
target | String | _self | 链接或路由跳转方式。可选项:_blank/_self/_parent/_top | N
tooltipProps | Object | - | 透传 Tooltip 组件的特性,作用于一级菜单收起下聚焦时出现的节点。TS 类型:`TooltipProps`[Tooltip API Documents](./tooltip?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-react/blob/develop/src/menu/type.ts) | N
value | String / Number | - | 菜单项唯一标识。TS 类型:`MenuValue` | N
onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>点击时触发 | N

Expand Down
5 changes: 5 additions & 0 deletions packages/products/tdesign-react/src/menu/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* */

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

Expand Down Expand Up @@ -175,6 +176,10 @@ export interface TdMenuItemProps {
* @default _self
*/
target?: '_blank' | '_self' | '_parent' | '_top';
/**
* 透传 Tooltip 组件的特性,作用于一级菜单收起下聚焦时出现的节点
*/
tooltipProps?: TooltipProps;
/**
* 菜单项唯一标识
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export default {
to: {
type: [String, Object] as PropType<TdMenuItemProps['to']>,
},
/** 透传 Tooltip 组件的特性,作用于一级菜单收起下聚焦时出现的节点 */
tooltipProps: {
type: Object as PropType<TdMenuItemProps['tooltipProps']>,
},
/** 菜单项唯一标识 */
value: {
type: [String, Number] as PropType<TdMenuItemProps['value']>,
Expand Down
1 change: 1 addition & 0 deletions packages/products/tdesign-vue-next/src/menu/menu.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ router | Object | - | Typescript:`Record<string, any>` | N
routerLink | Boolean | - | `1.3.11`。This API is valid if and only if the Router exists. Enable menu item content to be rendered as an `<a />` consistent with router-link behavior | N
target | String | _self | options: _blank/_self/_parent/_top | N
to | String / Object | - | Typescript:`MenuRoute` `interface MenuRoute { path?: string; name?: string; hash?: string; query?: MenuQueryData; params?: MenuQueryData }` `type MenuQueryData = { [key: string]: string \| string[] }`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/menu/type.ts) | N
tooltipProps | Object | - | Transparent all feature props of the Tooltip。Typescript:`TooltipProps`[Tooltip API Documents](./tooltip?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/menu/type.ts) | N
value | String / Number | - | Typescript:`MenuValue` | N
onClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/>trigger on click | N

Expand Down
1 change: 1 addition & 0 deletions packages/products/tdesign-vue-next/src/menu/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ router | Object | - | 路由对象。如果项目存在 Router,则默认使用
routerLink | Boolean | - | `1.3.11`。当且仅当 Router 存在时,该 API 有效。开启菜单项内容渲染为与router-link行为一致的`<a />`标签 | N
target | String | _self | 链接或路由跳转方式。可选项:_blank/_self/_parent/_top | N
to | String / Object | - | 路由跳转目标,当且仅当 Router 存在时,该 API 有效。TS 类型:`MenuRoute` `interface MenuRoute { path?: string; name?: string; hash?: string; query?: MenuQueryData; params?: MenuQueryData }` `type MenuQueryData = { [key: string]: string \| string[] }`[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/menu/type.ts) | N
tooltipProps | Object | - | 透传 Tooltip 组件的特性,作用于一级菜单收起下聚焦时出现的节点。TS 类型:`TooltipProps`[Tooltip API Documents](./tooltip?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/menu/type.ts) | N
value | String / Number | - | 菜单项唯一标识。TS 类型:`MenuValue` | N
onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>点击时触发 | N

Expand Down
5 changes: 5 additions & 0 deletions packages/products/tdesign-vue-next/src/menu/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* */

import { PopupProps } from '../popup';
import { TooltipProps } from '../tooltip';
import { TNode } from '../common';

export interface TdMenuProps {
Expand Down Expand Up @@ -199,6 +200,10 @@ export interface TdMenuItemProps {
* 路由跳转目标,当且仅当 Router 存在时,该 API 有效
*/
to?: MenuRoute;
/**
* 透传 Tooltip 组件的特性,作用于一级菜单收起下聚焦时出现的节点
*/
tooltipProps?: TooltipProps;
/**
* 菜单项唯一标识
*/
Expand Down
4 changes: 4 additions & 0 deletions packages/products/tdesign-vue/src/menu/menu-item-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export default {
to: {
type: [String, Object] as PropType<TdMenuItemProps['to']>,
},
/** 透传 Tooltip 组件的特性,作用于一级菜单收起下聚焦时出现的节点 */
tooltipProps: {
type: Object as PropType<TdMenuItemProps['tooltipProps']>,
},
/** 菜单项唯一标识 */
value: {
type: [String, Number] as PropType<TdMenuItemProps['value']>,
Expand Down
1 change: 1 addition & 0 deletions packages/products/tdesign-vue/src/menu/menu.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ router | Object | - | Typescript:`Record<string, any>` | N
routerLink | Boolean | - | `1.5.0`。This API is valid if and only if the Router exists. Enable menu item content to be rendered as an `<a />` consistent with router-link behavior | N
target | String | _self | options: _blank/_self/_parent/_top | N
to | String / Object | - | Typescript:`MenuRoute` `interface MenuRoute { path?: string; name?: string; hash?: string; query?: MenuQueryData; params?: MenuQueryData }` `type MenuQueryData = { [key: string]: string \| string[] }`[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/menu/type.ts) | N
tooltipProps | Object | - | Transparent all feature props of the Tooltip。Typescript:`TooltipProps`[Tooltip API Documents](./tooltip?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/menu/type.ts) | N
value | String / Number | - | Typescript:`MenuValue` | N
onClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/>trigger on click | N

Expand Down
1 change: 1 addition & 0 deletions packages/products/tdesign-vue/src/menu/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ router | Object | - | 路由对象。如果项目存在 Router,则默认使用
routerLink | Boolean | - | `1.5.0`。当且仅当 Router 存在时,该 API 有效。开启菜单项内容渲染为与router-link行为一致的`<a />`标签 | N
target | String | _self | 链接或路由跳转方式。可选项:_blank/_self/_parent/_top | N
to | String / Object | - | 路由跳转目标,当且仅当 Router 存在时,该 API 有效。TS 类型:`MenuRoute` `interface MenuRoute { path?: string; name?: string; hash?: string; query?: MenuQueryData; params?: MenuQueryData }` `type MenuQueryData = { [key: string]: string \| string[] }`[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/menu/type.ts) | N
tooltipProps | Object | - | 透传 Tooltip 组件的特性,作用于一级菜单收起下聚焦时出现的节点。TS 类型:`TooltipProps`[Tooltip API Documents](./tooltip?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/menu/type.ts) | N
value | String / Number | - | 菜单项唯一标识。TS 类型:`MenuValue` | N
onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>点击时触发 | N

Expand Down
5 changes: 5 additions & 0 deletions packages/products/tdesign-vue/src/menu/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* */

import { PopupProps } from '../popup';
import { TooltipProps } from '../tooltip';
import { TNode } from '../common';

export interface TdMenuProps {
Expand Down Expand Up @@ -191,6 +192,10 @@ export interface TdMenuItemProps {
* 路由跳转目标,当且仅当 Router 存在时,该 API 有效
*/
to?: MenuRoute;
/**
* 透传 Tooltip 组件的特性,作用于一级菜单收起下聚焦时出现的节点
*/
tooltipProps?: TooltipProps;
/**
* 菜单项唯一标识
*/
Expand Down
41 changes: 41 additions & 0 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -72604,6 +72604,47 @@
"Object"
]
},
{
"id": 1731555489,
"platform_framework": [
"1",
"2",
"4"
],
"component": "MenuItem",
"field_category": 1,
"field_name": "tooltipProps",
"field_type": [
"8"
],
"field_default_value": "",
"field_enum": "",
"field_desc_zh": "透传 Tooltip 组件的特性,作用于一级菜单收起下聚焦时出现的节点",
"field_desc_en": "Transparent all feature props of the Tooltip",
"field_required": 0,
"event_input": "",
"create_time": "2024-11-14 03:38:09",
"update_time": "2024-11-14 03:38:09",
"event_output": null,
"custom_field_type": "TooltipProps【import { TooltipProps } from '@Tooltip'】",
"syntactic_sugar": null,
"readonly": 1,
"html_attribute": 0,
"trigger_elements": "",
"deprecated": 0,
"version": "",
"test_description": null,
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(PC)",
"React(PC)",
"Angular(PC)"
],
"field_type_text": [
"Object"
]
},
{
"id": 845,
"platform_framework": [
Expand Down

0 comments on commit e63cb6a

Please sign in to comment.