Skip to content

Commit

Permalink
feat(popover): mobile-react增加popover组件文档 (#426)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
epoll-j and github-actions[bot] authored Sep 18, 2024
1 parent 3ec0282 commit ebbbce7
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 16 deletions.
Binary file modified db/TDesign.db
Binary file not shown.
12 changes: 12 additions & 0 deletions packages/products/tdesign-mobile-react/src/popover/defaultProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdPopoverProps } from './type';

export const popoverDefaultProps: TdPopoverProps = {
closeOnClickOutside: true,
placement: 'top',
showArrow: true,
theme: 'dark',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
:: BASE_DOC ::

## API


### Popover Props

name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | className of component | N
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
children | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
closeOnClickOutside | Boolean | true | \- | N
content | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
placement | String | top | options: top/left/right/bottom/top-left/top-right/bottom-left/bottom-right/left-top/left-bottom/right-top/right-bottom | N
showArrow | Boolean | true | \- | N
theme | String | dark | options: dark/light/brand/success/warning/error | N
triggerElement | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
visible | Boolean | - | \- | N
onVisibleChange | Function | | Typescript:`(visible: boolean) => void`<br/> | N
20 changes: 20 additions & 0 deletions packages/products/tdesign-mobile-react/src/popover/popover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
:: BASE_DOC ::

## API


### Popover Props

名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
children | TNode | - | 触发元素,同 triggerElement。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
closeOnClickOutside | Boolean | true | 是否在点击外部元素后关闭菜单 | N
content | TNode | - | 确认框内容。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
placement | String | top | 浮层出现位置。可选项:top/left/right/bottom/top-left/top-right/bottom-left/bottom-right/left-top/left-bottom/right-top/right-bottom | N
showArrow | Boolean | true | 是否显示浮层箭头 | N
theme | String | dark | 弹出气泡主题。。可选项:dark/light/brand/success/warning/error | N
triggerElement | TNode | - | 触发元素。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
visible | Boolean | - | 是否显示气泡确认框 | N
onVisibleChange | Function | | TS 类型:`(visible: boolean) => void`<br/>确认框显示或隐藏时触发 | N
66 changes: 66 additions & 0 deletions packages/products/tdesign-mobile-react/src/popover/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TNode } from '../common';

export interface TdPopoverProps {
/**
* 触发元素,同 triggerElement
*/
children?: TNode;
/**
* 是否在点击外部元素后关闭菜单
* @default true
*/
closeOnClickOutside?: boolean;
/**
* 确认框内容
*/
content?: TNode;
/**
* 浮层出现位置
* @default top
*/
placement?:
| 'top'
| 'left'
| 'right'
| 'bottom'
| 'top-left'
| 'top-right'
| 'bottom-left'
| 'bottom-right'
| 'left-top'
| 'left-bottom'
| 'right-top'
| 'right-bottom';
/**
* 是否显示浮层箭头
* @default true
*/
showArrow?: boolean;
/**
* 弹出气泡主题。
* @default dark
*/
theme?: 'dark' | 'light' | 'brand' | 'success' | 'warning' | 'error';
/**
* 触发元素
*/
triggerElement?: TNode;
/**
* 是否显示气泡确认框
*/
visible?: boolean;
/**
* 是否显示气泡确认框,非受控属性
*/
defaultVisible?: boolean;
/**
* 确认框显示或隐藏时触发
*/
onVisibleChange?: (visible: boolean) => void;
}
87 changes: 71 additions & 16 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -80880,10 +80880,50 @@
"Object"
]
},
{
"id": 1726067019,
"platform_framework": [
"16"
],
"component": "Popover",
"field_category": 1,
"field_name": "children",
"field_type": [
"1",
"64"
],
"field_default_value": "",
"field_enum": "",
"field_desc_zh": "触发元素,同 triggerElement",
"field_desc_en": null,
"field_required": 0,
"event_input": "",
"create_time": "2024-09-11 15:03:39",
"update_time": "2024-09-11 15:03:39",
"event_output": null,
"custom_field_type": null,
"syntactic_sugar": null,
"readonly": 1,
"html_attribute": 0,
"trigger_elements": "MouseEvent<HTMLDivElement | HTMLButtonElement>",
"deprecated": 0,
"version": "",
"test_description": null,
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"React(Mobile)"
],
"field_type_text": [
"String",
"TNode"
]
},
{
"id": 3526,
"platform_framework": [
"8"
"8",
"16"
],
"component": "Popover",
"field_category": 1,
Expand Down Expand Up @@ -80911,7 +80951,8 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)"
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": [
"Boolean"
Expand All @@ -80920,7 +80961,8 @@
{
"id": 942,
"platform_framework": [
"8"
"8",
"16"
],
"component": "Popover",
"field_category": 1,
Expand Down Expand Up @@ -80949,7 +80991,8 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)"
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": [
"String",
Expand Down Expand Up @@ -80998,7 +81041,8 @@
{
"id": 3514,
"platform_framework": [
"8"
"8",
"16"
],
"component": "Popover",
"field_category": 1,
Expand Down Expand Up @@ -81026,7 +81070,8 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)"
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": [
"String"
Expand All @@ -81035,7 +81080,8 @@
{
"id": 3513,
"platform_framework": [
"8"
"8",
"16"
],
"component": "Popover",
"field_category": 1,
Expand Down Expand Up @@ -81063,7 +81109,8 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)"
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": [
"Boolean"
Expand All @@ -81072,7 +81119,8 @@
{
"id": 3516,
"platform_framework": [
"8"
"8",
"16"
],
"component": "Popover",
"field_category": 1,
Expand Down Expand Up @@ -81100,7 +81148,8 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)"
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": [
"String"
Expand All @@ -81109,7 +81158,8 @@
{
"id": 3517,
"platform_framework": [
"8"
"8",
"16"
],
"component": "Popover",
"field_category": 1,
Expand Down Expand Up @@ -81138,7 +81188,8 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)"
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": [
"String",
Expand All @@ -81148,7 +81199,8 @@
{
"id": 1160,
"platform_framework": [
"8"
"8",
"16"
],
"component": "Popover",
"field_category": 1,
Expand Down Expand Up @@ -81176,7 +81228,8 @@
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(Mobile)"
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": [
"Boolean"
Expand All @@ -81185,7 +81238,8 @@
{
"id": 3519,
"platform_framework": [
"8"
"8",
"16"
],
"component": "Popover",
"field_category": 2,
Expand All @@ -81211,7 +81265,8 @@
"support_default_value": 0,
"field_category_text": "Events",
"platform_framework_text": [
"Vue(Mobile)"
"Vue(Mobile)",
"React(Mobile)"
],
"field_type_text": []
},
Expand Down

0 comments on commit ebbbce7

Please sign in to comment.