Skip to content

Commit 9a79f78

Browse files
authored
docs(React): generate api doc for multiple components (#616)
1 parent 2dbb7be commit 9a79f78

File tree

12 files changed

+61
-26
lines changed

12 files changed

+61
-26
lines changed

db/TDesign.db

0 Bytes
Binary file not shown.

packages/products/tdesign-mobile-react/src/grid/defaultProps.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
33
* */
44

5-
import { TdGridItemProps } from './type';
5+
import { TdGridProps, TdGridItemProps } from './type';
6+
7+
export const gridDefaultProps: TdGridProps = { align: 'center', border: false, column: 4, theme: 'default' };
68

79
export const gridItemDefaultProps: TdGridItemProps = { badge: null, layout: 'vertical' };

packages/products/tdesign-mobile-react/src/grid/grid.en-US.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
## API
44

5-
65
### Grid Props
76

87
name | type | default | description | required
@@ -24,6 +23,6 @@ className | String | - | className of component | N
2423
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
2524
badge | Object | null | Typescript:`BadgeProps`[Badge API Documents](./badge?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/grid/type.ts) | N
2625
description | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
27-
image | TNode | - | Typescript:`string \| object \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
26+
image | TNode | - | Typescript:`String \| TNode \| ImageProps`[Image API Documents](./image?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/grid/type.ts) | N
2827
layout | String | vertical | options: vertical/horizontal | N
2928
text | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N

packages/products/tdesign-mobile-react/src/grid/grid.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
## API
44

5-
65
### Grid Props
76

87
名称 | 类型 | 默认值 | 描述 | 必传
@@ -24,6 +23,6 @@ className | String | - | 类名 | N
2423
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
2524
badge | Object | null | 透传至 Badge 属性。TS 类型:`BadgeProps`[Badge API Documents](./badge?tab=api)[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/grid/type.ts) | N
2625
description | TNode | - | 文本以外的更多描述,辅助信息。可以通过 Props 传入文本,也可以自定义标题节点。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
27-
image | TNode | - | 图片,可以是图片地址,也可以自定义图片节点,如果传入对象则透传至 image 组件。TS 类型:`string \| object \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
26+
image | TNode | - | 图片,可以是图片地址,也可以自定义图片节点,如果传入对象则透传至 image 组件。TS 类型:`String \| TNode \| ImageProps`[Image API Documents](./image?tab=api)[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts)[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/grid/type.ts) | N
2827
layout | String | vertical | 内容布局方式。可选项:vertical/horizontal | N
2928
text | TNode | - | 文本,可以通过 Props 传入文本,也可以自定义标题节点。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N

packages/products/tdesign-mobile-react/src/grid/type.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,36 @@
55
* */
66

77
import { BadgeProps } from '../badge';
8+
import { ImageProps } from '../image';
89
import { TNode } from '../common';
910

11+
export interface TdGridProps {
12+
/**
13+
* 内容对齐方式
14+
* @default center
15+
*/
16+
align?: 'left' | 'center';
17+
/**
18+
* 是否显示边框
19+
* @default false
20+
*/
21+
border?: boolean;
22+
/**
23+
* 每一行的列数量;为 0 时等于固定大小
24+
* @default 4
25+
*/
26+
column?: number;
27+
/**
28+
* 间隔大小
29+
*/
30+
gutter?: number;
31+
/**
32+
* 宫格的风格
33+
* @default default
34+
*/
35+
theme?: 'default' | 'card';
36+
}
37+
1038
export interface TdGridItemProps {
1139
/**
1240
* 透传至 Badge 属性
@@ -20,7 +48,7 @@ export interface TdGridItemProps {
2048
/**
2149
* 图片,可以是图片地址,也可以自定义图片节点,如果传入对象则透传至 image 组件
2250
*/
23-
image?: TNode;
51+
image?: String | TNode | ImageProps;
2452
/**
2553
* 内容布局方式
2654
* @default vertical

packages/products/tdesign-mobile-react/src/swipe-cell/swipe-cell.en-US.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ content | TNode | - | Typescript:`string \| TNode`。[see more ts definition](
1212
disabled | Boolean | - | \- | N
1313
left | TNode | - | Typescript:`Array<SwipeActionItem> \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
1414
opened | Boolean / Array | false | Typescript:`boolean \| Array<boolean>` | N
15-
right | TNode | - | Typescript:`Array<SwipeActionItem> \| TNode` `interface SwipeActionItem {text: string; className?: string; style?: string; sure?: string \| TNode; onClick?: () => void; [key: string]: any }`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swipe-cell/type.ts) | N
15+
right | TNode | - | Typescript:`Array<SwipeActionItem> \| TNode` `interface SwipeActionItem {text: string; className?: string; style?: Styles; sure?: Sure; onClick?: () => void; [key: string]: any }` `type Sure = string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts)[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swipe-cell/type.ts) | N
1616
onChange | Function | | Typescript:`(value: string) => void`<br/> | N
1717
onClick | Function | | Typescript:`(action: SwipeActionItem, source: SwipeSource) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swipe-cell/type.ts)。<br/>`type SwipeSource = 'left' \| 'right'`<br/> | N

packages/products/tdesign-mobile-react/src/swipe-cell/swipe-cell.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ content | TNode | - | 操作项以外的内容。TS 类型:`string \| TNode`
1212
disabled | Boolean | - | 是否禁用滑动 | N
1313
left | TNode | - | 左侧滑动操作项。所有行为同 `right`。TS 类型:`Array<SwipeActionItem> \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
1414
opened | Boolean / Array | false | 操作项是否呈现为打开态,值为数组时表示分别控制左右滑动的展开和收起状态。TS 类型:`boolean \| Array<boolean>` | N
15-
right | TNode | - | 右侧滑动操作项。有两种定义方式,一种是使用数组,二种是使用插槽。`right.text` 表示操作文本,`right.className` 表示操作项类名,`right.style` 表示操作项样式,`right.onClick` 表示点击操作项后执行的回调函数。示例:`[{ text: '删除', style: 'background-color: red', onClick: () => {} }]`。TS 类型:`Array<SwipeActionItem> \| TNode` `interface SwipeActionItem {text: string; className?: string; style?: string; sure?: string \| TNode; onClick?: () => void; [key: string]: any }`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts)[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swipe-cell/type.ts) | N
15+
right | TNode | - | 右侧滑动操作项。有两种定义方式,一种是使用数组,二种是使用插槽。`right.text` 表示操作文本,`right.className` 表示操作项类名,`right.style` 表示操作项样式,`right.onClick` 表示点击操作项后执行的回调函数。示例:`[{ text: '删除', style: 'background-color: red', onClick: () => {} }]`。TS 类型:`Array<SwipeActionItem> \| TNode` `interface SwipeActionItem {text: string; className?: string; style?: Styles; sure?: Sure; onClick?: () => void; [key: string]: any }` `type Sure = string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts)[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swipe-cell/type.ts) | N
1616
onChange | Function | | TS 类型:`(value: string) => void`<br/>菜单展开或者收回后将菜单的状态传递给父组件,值为数组时表示分别控制左右滑动的展开和收起状态 | N
1717
onClick | Function | | TS 类型:`(action: SwipeActionItem, source: SwipeSource) => void`<br/>操作项点击时触发(插槽写法组件不触发,业务侧自定义内容和事件)。[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swipe-cell/type.ts)。<br/>`type SwipeSource = 'left' \| 'right'`<br/> | N

packages/products/tdesign-mobile-react/src/swipe-cell/type.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
55
* */
66

7-
import { TNode } from '../common';
7+
import { TNode, Styles } from '../common';
88

99
export interface TdSwipeCellProps {
1010
/**
@@ -41,10 +41,12 @@ export interface TdSwipeCellProps {
4141
export interface SwipeActionItem {
4242
text: string;
4343
className?: string;
44-
style?: string;
45-
sure?: string | TNode;
44+
style?: Styles;
45+
sure?: Sure;
4646
onClick?: () => void;
4747
[key: string]: any;
4848
}
4949

50+
export type Sure = string | TNode;
51+
5052
export type SwipeSource = 'left' | 'right';

packages/products/tdesign-mobile-react/src/swiper/swiper.en-US.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
## API
44

5-
65
### Swiper Props
76

87
name | type | default | description | required
@@ -14,21 +13,22 @@ autoplay | Boolean | true | \- | N
1413
current | Number | 0 | \- | N
1514
direction | String | horizontal | options: horizontal/vertical | N
1615
duration | Number | 300 | \- | N
17-
height | Number | - | \- | N
16+
height | String / Number | - | \- | N
1817
interval | Number | 5000 | \- | N
1918
loop | Boolean | true | \- | N
2019
navigation | TNode | - | Typescript:`SwiperNavigation \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
2120
nextMargin | String / Number | 0 | \- | N
2221
previousMargin | String / Number | 0 | \- | N
2322
type | String | default | options: default/card | N
24-
onChange | Function | | Typescript:`(current: number, context: { source: SwiperChangeSource }) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swiper/type.ts)。<br/>`type SwiperChangeSource = 'autoplay' \| 'touch' \| ''`<br/> | N
23+
onChange | Function | | Typescript:`(current: number, context: { source: SwiperChangeSource }) => void`<br/>[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swiper/type.ts)。<br/>`type SwiperChangeSource = 'autoplay' \| 'touch' \| 'nav'`<br/> | N
2524
onClick | Function | | Typescript:`(index: number) => void`<br/> | N
2625

2726
### SwiperNavigation
2827

2928
name | type | default | description | required
3029
-- | -- | -- | -- | --
3130
minShowNum | Number | - | \- | N
32-
paginationPosition | String | bottom | options: top-left/top/top-right/bottom-left/bottom/bottom-right | N
31+
paginationPosition | String | bottom | options: top-left/top/top-right/bottom-left/bottom/bottom-right/left/right | N
32+
placement | String | inside | options: inside/outside | N
3333
showControls | Boolean | false | \- | N
3434
type | String | - | Typescript:`SwiperNavigationType` `type SwiperNavigationType = 'dots' \| 'dots-bar' \| 'fraction'`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swiper/type.ts) | N

packages/products/tdesign-mobile-react/src/swiper/swiper.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
## API
44

5-
65
### Swiper Props
76

87
名称 | 类型 | 默认值 | 描述 | 必传
@@ -14,21 +13,22 @@ autoplay | Boolean | true | 是否自动播放 | N
1413
current | Number | 0 | 当前轮播在哪一项(下标) | N
1514
direction | String | horizontal | 轮播滑动方向,包括横向滑动和纵向滑动两个方向。可选项:horizontal/vertical | N
1615
duration | Number | 300 | 滑动动画时长 | N
17-
height | Number | - | 当使用垂直方向滚动时的高度 | N
16+
height | String / Number | - | 当使用垂直方向滚动时的高度 | N
1817
interval | Number | 5000 | 轮播间隔时间 | N
1918
loop | Boolean | true | 是否循环播放 | N
2019
navigation | TNode | - | 导航器全部配置。TS 类型:`SwiperNavigation \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
2120
nextMargin | String / Number | 0 | 后边距,可用于露出后一项的一小部分。默认单位 `px` | N
2221
previousMargin | String / Number | 0 | 前边距,可用于露出前一项的一小部分。默认单位 `px` | N
2322
type | String | default | 样式类型:默认样式、卡片样式。可选项:default/card | N
24-
onChange | Function | | TS 类型:`(current: number, context: { source: SwiperChangeSource }) => void`<br/>轮播切换时触发。[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swiper/type.ts)。<br/>`type SwiperChangeSource = 'autoplay' \| 'touch' \| ''`<br/> | N
23+
onChange | Function | | TS 类型:`(current: number, context: { source: SwiperChangeSource }) => void`<br/>轮播切换时触发。[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swiper/type.ts)。<br/>`type SwiperChangeSource = 'autoplay' \| 'touch' \| 'nav'`<br/> | N
2524
onClick | Function | | TS 类型:`(index: number) => void`<br/>点击轮播项时触发 | N
2625

2726
### SwiperNavigation
2827

2928
名称 | 类型 | 默认值 | 描述 | 必传
3029
-- | -- | -- | -- | --
3130
minShowNum | Number | - | 小于这个数字不会显示导航器 | N
32-
paginationPosition | String | bottom | 页码信息展示位置。可选项:top-left/top/top-right/bottom-left/bottom/bottom-right | N
31+
paginationPosition | String | bottom | 页码信息展示位置。可选项:top-left/top/top-right/bottom-left/bottom/bottom-right/left/right | N
32+
placement | String | inside | 导航器位置,位于主体的内侧或是外侧。可选项:inside/outside | N
3333
showControls | Boolean | false | 是否显示两侧的控制按钮 | N
3434
type | String | - | 导航器类型,点状(dots)、点条状(dots-bar)、分式(fraction)等。TS 类型:`SwiperNavigationType` `type SwiperNavigationType = 'dots' \| 'dots-bar' \| 'fraction'`[详细类型定义](https://github.com/Tencent/tdesign-mobile-react/tree/develop/src/swiper/type.ts) | N

0 commit comments

Comments
 (0)