Skip to content

Commit f78f4d6

Browse files
authored
docs: added API for chat series components in miniprogram (#760)
1 parent 5856ee5 commit f78f4d6

File tree

41 files changed

+4322
-575
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4322
-575
lines changed

db/TDesign.db

12 KB
Binary file not shown.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
:: BASE_DOC ::
2+
3+
## API
4+
5+
### Attachments Props
6+
7+
name | type | default | description | required
8+
-- | -- | -- | -- | --
9+
style | Object | - | CSS(Cascading Style Sheets) | N
10+
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
11+
addable | Boolean | true | \- | N
12+
image-viewer | Boolean | true | \- | N
13+
items | Array | [] | Typescript: `FileItem[]` `interface FileItem { fileType: 'image'\|'video'\|'audio'\|'pdf'\|'doc'\|'ppt'\|'txt'; name: string; url: string; size: number; status?: 'success'\|'fail'\|'pending'\|'error'; progress?: number; errorMessage?: string; fileIcon?: string; width?: number; height?: number; mode?: 'aspectFit' \| 'aspectFill' \| 'widthFix' \| 'heightFix' \| 'scaleToFill'}`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/attachments/type.ts) | N
14+
removable | Boolean | true | \- | N
15+
16+
### Attachments Events
17+
18+
name | params | description
19+
-- | -- | --
20+
add | \- | \-
21+
file-click | `(item: FileItem)` | \-
22+
remove | `(item: FileItem, index: number)` | \-
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
:: BASE_DOC ::
2+
3+
## API
4+
5+
### Attachments Props
6+
7+
名称 | 类型 | 默认值 | 描述 | 必传
8+
-- | -- | -- | -- | --
9+
style | Object | - | 样式 | N
10+
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
11+
addable | Boolean | true | 【讨论中】是否显示添加按钮 | N
12+
image-viewer | Boolean | true | 是否启用图片预览功能 | N
13+
items | Array | [] | 【实验】附件列表。TS 类型:`FileItem[]` `interface FileItem { fileType: 'image'\|'video'\|'audio'\|'pdf'\|'doc'\|'ppt'\|'txt'; name: string; url: string; size: number; status?: 'success'\|'fail'\|'pending'\|'error'; progress?: number; errorMessage?: string; fileIcon?: string; width?: number; height?: number; mode?: 'aspectFit' \| 'aspectFill' \| 'widthFix' \| 'heightFix' \| 'scaleToFill'}`[详细类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/attachments/type.ts) | N
14+
removable | Boolean | true | 是否显示删除按钮 | N
15+
16+
### Attachments Events
17+
18+
名称 | 参数 | 描述
19+
-- | -- | --
20+
add | \- | 点击添加按钮时触发
21+
file-click | `(item: FileItem)` | 点击文件时触发
22+
remove | `(item: FileItem, index: number)` | 点击删除按钮时触发
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* eslint-disable */
2+
3+
/**
4+
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
5+
* */
6+
7+
import { TdAttachmentsProps } from './type';
8+
const props: TdAttachmentsProps = {
9+
/** 【讨论中】是否显示添加按钮 */
10+
addable: {
11+
type: Boolean,
12+
value: true,
13+
},
14+
/** 是否启用图片预览功能 */
15+
imageViewer: {
16+
type: Boolean,
17+
value: true,
18+
},
19+
/** 【实验】附件列表 */
20+
items: {
21+
type: Array,
22+
value: [],
23+
},
24+
/** 是否显示删除按钮 */
25+
removable: {
26+
type: Boolean,
27+
value: true,
28+
},
29+
};
30+
31+
export default props;
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/* eslint-disable */
2+
3+
/**
4+
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
5+
* */
6+
7+
export interface TdAttachmentsProps {
8+
/**
9+
* 【讨论中】是否显示添加按钮
10+
* @default true
11+
*/
12+
addable?: {
13+
type: BooleanConstructor;
14+
value?: boolean;
15+
};
16+
/**
17+
* 是否启用图片预览功能
18+
* @default true
19+
*/
20+
imageViewer?: {
21+
type: BooleanConstructor;
22+
value?: boolean;
23+
};
24+
/**
25+
* 【实验】附件列表
26+
* @default []
27+
*/
28+
items?: {
29+
type: ArrayConstructor;
30+
value?: FileItem[];
31+
};
32+
/**
33+
* 是否显示删除按钮
34+
* @default true
35+
*/
36+
removable?: {
37+
type: BooleanConstructor;
38+
value?: boolean;
39+
};
40+
}
41+
42+
export interface FileItem {
43+
fileType: 'image' | 'video' | 'audio' | 'pdf' | 'doc' | 'ppt' | 'txt';
44+
name: string;
45+
url: string;
46+
size: number;
47+
status?: 'success' | 'fail' | 'pending' | 'error';
48+
progress?: number;
49+
errorMessage?: string;
50+
fileIcon?: string;
51+
width?: number;
52+
height?: number;
53+
mode?: 'aspectFit' | 'aspectFill' | 'widthFix' | 'heightFix' | 'scaleToFill';
54+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
:: BASE_DOC ::
2+
3+
## API
4+
5+
### ChatActionbar Props
6+
7+
name | type | default | description | required
8+
-- | -- | -- | -- | --
9+
style | Object | - | CSS(Cascading Style Sheets) | N
10+
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
11+
action-bar | Array | ['replay', 'copy', 'good', 'bad', 'share'] | Typescript: `Array<'replay'\|'copy'\|'good'\|'bad'\|'share'>` | N
12+
chat-id | String | - | \- | N
13+
comment | String | - | \- | N
14+
content | String | - | \- | N
15+
copy-mode | String | markdown | options: markdown/text | N
16+
disabled | Boolean | false | \- | N
17+
placement | String | start | options: start/end/space-around/space-between | N
18+
19+
### ChatActionbar Events
20+
21+
name | params | description
22+
-- | -- | --
23+
actions | `(detail: {name: string, active: boolean})` | \-
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
:: BASE_DOC ::
2+
3+
## API
4+
5+
### ChatActionbar Props
6+
7+
名称 | 类型 | 默认值 | 描述 | 必传
8+
-- | -- | -- | -- | --
9+
style | Object | - | 样式 | N
10+
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
11+
action-bar | Array | ['replay', 'copy', 'good', 'bad', 'share'] | 操作栏配置。TS 类型:`Array<'replay'\|'copy'\|'good'\|'bad'\|'share'>` | N
12+
chat-id | String | - | 【实验】聊天消息的唯一标识 | N
13+
comment | String | - | 评价内容 | N
14+
content | String | - | 被复制的内容 | N
15+
copy-mode | String | markdown | 【实验】复制内容的模式,可选 'markdown'(复制markdown原文)或 'text'(复制纯文本)。可选项:markdown/text | N
16+
disabled | Boolean | false | 【讨论中】操作按钮是否可点击 | N
17+
placement | String | start | 【实验】操作栏位置。可选项:start/end/space-around/space-between | N
18+
19+
### ChatActionbar Events
20+
21+
名称 | 参数 | 描述
22+
-- | -- | --
23+
actions | `(detail: {name: string, active: boolean})` | 点击点赞,点踩,复制,分享,重新生成按钮时触发发
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* eslint-disable */
2+
3+
/**
4+
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
5+
* */
6+
7+
import { TdChatActionbarProps } from './type';
8+
const props: TdChatActionbarProps = {
9+
/** 操作栏配置 */
10+
actionBar: {
11+
type: Array,
12+
value: ['replay', 'copy', 'good', 'bad', 'share'],
13+
},
14+
/** 【实验】聊天消息的唯一标识 */
15+
chatId: {
16+
type: String,
17+
value: '',
18+
},
19+
/** 评价内容 */
20+
comment: {
21+
type: String,
22+
value: '',
23+
},
24+
/** 被复制的内容 */
25+
content: {
26+
type: String,
27+
value: '',
28+
},
29+
/** 【实验】复制内容的模式,可选 'markdown'(复制markdown原文)或 'text'(复制纯文本) */
30+
copyMode: {
31+
type: String,
32+
value: 'markdown',
33+
},
34+
/** 【讨论中】操作按钮是否可点击 */
35+
disabled: {
36+
type: Boolean,
37+
value: false,
38+
},
39+
/** 【实验】操作栏位置 */
40+
placement: {
41+
type: String,
42+
value: 'start',
43+
},
44+
};
45+
46+
export default props;
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/* eslint-disable */
2+
3+
/**
4+
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
5+
* */
6+
7+
export interface TdChatActionbarProps {
8+
/**
9+
* 操作栏配置
10+
* @default ['replay', 'copy', 'good', 'bad', 'share']
11+
*/
12+
actionBar?: {
13+
type: ArrayConstructor;
14+
value?: Array<'replay' | 'copy' | 'good' | 'bad' | 'share'>;
15+
};
16+
/**
17+
* 【实验】聊天消息的唯一标识
18+
* @default ''
19+
*/
20+
chatId?: {
21+
type: StringConstructor;
22+
value?: string;
23+
};
24+
/**
25+
* 评价内容
26+
* @default ''
27+
*/
28+
comment?: {
29+
type: StringConstructor;
30+
value?: string;
31+
};
32+
/**
33+
* 被复制的内容
34+
* @default ''
35+
*/
36+
content?: {
37+
type: StringConstructor;
38+
value?: string;
39+
};
40+
/**
41+
* 【实验】复制内容的模式,可选 'markdown'(复制markdown原文)或 'text'(复制纯文本)
42+
* @default markdown
43+
*/
44+
copyMode?: {
45+
type: StringConstructor;
46+
value?: 'markdown' | 'text';
47+
};
48+
/**
49+
* 【讨论中】操作按钮是否可点击
50+
* @default false
51+
*/
52+
disabled?: {
53+
type: BooleanConstructor;
54+
value?: boolean;
55+
};
56+
/**
57+
* 【实验】操作栏位置
58+
* @default start
59+
*/
60+
placement?: {
61+
type: StringConstructor;
62+
value?: 'start' | 'end' | 'space-around' | 'space-between';
63+
};
64+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
:: BASE_DOC ::
2+
3+
## API
4+
5+
### ChatContent Props
6+
7+
name | type | default | description | required
8+
-- | -- | -- | -- | --
9+
style | Object | - | CSS(Cascading Style Sheets) | N
10+
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
11+
content | Object | - | required。Typescript: `TdChatContentType ` `interface TdChatContentType { type: 'text' \| 'markdown'; data: string; }`[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/chat-content/type.ts) | Y
12+
markdown-props | Object | - | Typescript: `ChatMarkdownProps`[ChatMarkdown API Documents](./chat-markdown?tab=api)[see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/packages/components/chat-content/type.ts) | N
13+
role | String | - | required。options: user/assistant/system | Y
14+
status | String | - | options: error / '' | N

0 commit comments

Comments
 (0)