fat-design 0.0.1-beta.20250930224035 → 0.0.1-beta.20251010070112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@ export { default as Cascader } from './cascader';
14
14
  export { default as CascaderSelect } from './cascader-select';
15
15
  export { default as Checkbox } from './checkbox';
16
16
  export { default as Collapse } from './collapse';
17
+ export { default as Comments } from './comments';
17
18
  export { default as ConfigProvider } from './config-provider';
18
19
  export { default as DatePicker } from './date-picker';
19
20
  export { default as DetailPage } from './pages/detail-page';
@@ -0,0 +1,279 @@
1
+ /// <reference types="react" />
2
+
3
+ import { ReactNode, ReactElement, Component } from 'react';
4
+ import CommonProps from '../util';
5
+ import { PaginationProps } from '../pagination';
6
+
7
+ export interface CommentItem {
8
+ /**
9
+ * 评论唯一标识
10
+ */
11
+ id: string | number;
12
+ /**
13
+ * 评论内容
14
+ */
15
+ content: string;
16
+ /**
17
+ * 评论作者
18
+ */
19
+ author: {
20
+ /**
21
+ * 作者名称
22
+ */
23
+ name: string;
24
+ /**
25
+ * 作者头像
26
+ */
27
+ avatar?: string;
28
+ /**
29
+ * 作者ID
30
+ */
31
+ id?: string | number;
32
+ /**
33
+ * 用户信息修改时间(可选,用于性能优化)
34
+ */
35
+ modifiedAt?: string | Date;
36
+ };
37
+ /**
38
+ * 评论时间
39
+ */
40
+ createdAt: string | Date;
41
+ /**
42
+ * 修改时间(可选,用于性能优化)
43
+ */
44
+ modifiedAt?: string | Date;
45
+ /**
46
+ * 点赞数
47
+ */
48
+ likes?: number;
49
+ /**
50
+ * 是否已点赞
51
+ */
52
+ liked?: boolean;
53
+ /**
54
+ * 二级评论列表
55
+ */
56
+ children?: CommentItem[];
57
+ /**
58
+ * 二级评论总数(用于分页)
59
+ */
60
+ childrenTotal?: number;
61
+ /**
62
+ * 自定义数据
63
+ */
64
+ [key: string]: any;
65
+ }
66
+
67
+ export interface CommentInputProps {
68
+ /**
69
+ * 输入框占位符
70
+ */
71
+ placeholder?: string;
72
+ /**
73
+ * 输入框值
74
+ */
75
+ value?: string;
76
+ /**
77
+ * 输入框值变化回调
78
+ */
79
+ onChange?: (value: string) => void;
80
+ /**
81
+ * 提交回调
82
+ */
83
+ onSubmit?: (content: string) => void | Promise<void>;
84
+ /**
85
+ * 是否显示提交按钮
86
+ */
87
+ showSubmitButton?: boolean;
88
+ /**
89
+ * 提交按钮文字
90
+ */
91
+ submitText?: string;
92
+ /**
93
+ * 是否正在加载
94
+ */
95
+ loading?: boolean;
96
+ /**
97
+ * 是否禁用
98
+ */
99
+ disabled?: boolean;
100
+ /**
101
+ * 输入框行数
102
+ */
103
+ rows?: number;
104
+ /**
105
+ * 自定义渲染函数
106
+ */
107
+ render?: (props: CommentInputProps) => ReactNode;
108
+ }
109
+
110
+ export interface CommentItemRenderProps {
111
+ /**
112
+ * 评论数据
113
+ */
114
+ comment: CommentItem;
115
+ /**
116
+ * 是否为二级评论
117
+ */
118
+ isChild?: boolean;
119
+ /**
120
+ * 回复评论回调
121
+ */
122
+ onReply?: (parentId: string | number, content: string) => void | Promise<void>;
123
+ /**
124
+ * 点赞回调
125
+ */
126
+ onLike?: (commentId: string | number) => void | Promise<void>;
127
+ /**
128
+ * 删除回调
129
+ */
130
+ onDelete?: (commentId: string | number) => void | Promise<void>;
131
+ /**
132
+ * 编辑回调
133
+ */
134
+ onEdit?: (commentId: string | number, content: string) => void | Promise<void>;
135
+ /**
136
+ * 加载更多子评论
137
+ */
138
+ onLoadMoreChildren?: (parentId: string | number, page: number, pageSize: number) => void | Promise<void>;
139
+ /**
140
+ * 显示所有子评论(对话框模式)
141
+ */
142
+ onShowAllChildren?: (parentId: string | number) => void;
143
+ }
144
+
145
+ export interface CommentsAPI {
146
+ /**
147
+ * 加载评论列表
148
+ */
149
+ loadComments?: (page: number, pageSize: number) => Promise<{
150
+ list: CommentItem[];
151
+ total: number;
152
+ }>;
153
+ /**
154
+ * 加载子评论列表
155
+ */
156
+ loadChildComments?: (parentId: string | number, page: number, pageSize: number) => Promise<{
157
+ list: CommentItem[];
158
+ total: number;
159
+ }>;
160
+ /**
161
+ * 提交一级评论
162
+ */
163
+ submitComment?: (content: string) => Promise<CommentItem>;
164
+ /**
165
+ * 提交二级评论
166
+ */
167
+ submitReply?: (parentId: string | number, content: string) => Promise<CommentItem>;
168
+ /**
169
+ * 点赞评论
170
+ */
171
+ likeComment?: (commentId: string | number) => Promise<void>;
172
+ /**
173
+ * 删除评论
174
+ */
175
+ deleteComment?: (commentId: string | number) => Promise<void>;
176
+ /**
177
+ * 编辑评论
178
+ */
179
+ editComment?: (commentId: string | number, content: string) => Promise<void>;
180
+ }
181
+
182
+ export interface CommentsProps extends CommonProps {
183
+ /**
184
+ * 评论数据(非受控模式)
185
+ */
186
+ defaultComments?: CommentItem[];
187
+ /**
188
+ * 评论数据(受控模式)
189
+ */
190
+ comments?: CommentItem[];
191
+ /**
192
+ * 评论总数
193
+ */
194
+ total?: number;
195
+ /**
196
+ * 当前页码
197
+ */
198
+ current?: number;
199
+ /**
200
+ * 每页评论数
201
+ */
202
+ pageSize?: number;
203
+ /**
204
+ * 一级评论输入框位置
205
+ */
206
+ inputPosition?: 'top' | 'bottom' | 'none';
207
+ /**
208
+ * 二级评论默认显示数量
209
+ */
210
+ defaultChildrenCount?: number;
211
+ /**
212
+ * 二级评论最大显示数量
213
+ */
214
+ maxChildrenCount?: number;
215
+ /**
216
+ * API 接口配置
217
+ */
218
+ api?: CommentsAPI;
219
+ /**
220
+ * 分页配置
221
+ */
222
+ paginationProps?: PaginationProps;
223
+ /**
224
+ * 一级评论输入框配置
225
+ */
226
+ inputProps?: CommentInputProps;
227
+ /**
228
+ * 二级评论输入框配置
229
+ */
230
+ childInputProps?: CommentInputProps;
231
+ /**
232
+ * 自定义评论项渲染
233
+ */
234
+ renderComment?: (props: CommentItemRenderProps) => ReactNode;
235
+ /**
236
+ * 自定义一级评论输入框渲染
237
+ */
238
+ renderInput?: (props: CommentInputProps) => ReactNode;
239
+ /**
240
+ * 自定义二级评论输入框渲染
241
+ */
242
+ renderChildInput?: (props: CommentInputProps) => ReactNode;
243
+ /**
244
+ * 页码变化回调
245
+ */
246
+ onPageChange?: (page: number, pageSize: number) => void;
247
+ /**
248
+ * 评论数据变化回调
249
+ */
250
+ onChange?: (comments: CommentItem[]) => void;
251
+ /**
252
+ * 提交评论成功回调
253
+ */
254
+ onCommentSubmit?: (comment: CommentItem) => void;
255
+ /**
256
+ * 提交回复成功回调
257
+ */
258
+ onReplySubmit?: (reply: CommentItem, parentId: string | number) => void;
259
+ /**
260
+ * 是否显示分页
261
+ */
262
+ showPagination?: boolean;
263
+ /**
264
+ * 空状态提示
265
+ */
266
+ emptyText?: ReactNode;
267
+ /**
268
+ * 是否显示用户悬浮卡片
269
+ */
270
+ showUserCard?: boolean;
271
+ /**
272
+ * 自定义用户卡片渲染
273
+ */
274
+ userCardRender?: (user: CommentItem['author']) => ReactNode;
275
+ }
276
+
277
+ export default class Comments extends Component<CommentsProps, any> {
278
+ static displayName: 'Comments';
279
+ }
@@ -0,0 +1,79 @@
1
+ /// <reference types="react" />
2
+
3
+ import * as React from 'react';
4
+ import CommonProps from '../util';
5
+
6
+ /**
7
+ * Empty组件的图片类型常量
8
+ */
9
+ export const EMPTY_TYPE: {
10
+ DEFAULT: 'DEFAULT';
11
+ SIMPLE: 'SIMPLE';
12
+ };
13
+
14
+ export interface EmptyProps extends React.HTMLAttributes<HTMLDivElement>, CommonProps {
15
+ /**
16
+ * 组件样式类名前缀
17
+ */
18
+ prefixCls?: string;
19
+
20
+ /**
21
+ * 自定义样式类名
22
+ */
23
+ className?: string;
24
+
25
+ /**
26
+ * 自定义样式
27
+ */
28
+ style?: React.CSSProperties;
29
+
30
+ /**
31
+ * 图片样式
32
+ */
33
+ imageStyle?: React.CSSProperties;
34
+
35
+ /**
36
+ * 自定义图片类型
37
+ */
38
+ image?: string | React.ReactNode;
39
+
40
+ /**
41
+ * 自定义描述内容
42
+ */
43
+ description?: React.ReactNode;
44
+
45
+ /**
46
+ * 国际化配置
47
+ */
48
+ locale?: {
49
+ description?: string;
50
+ };
51
+
52
+ /**
53
+ * 子元素(显示在底部)
54
+ */
55
+ children?: React.ReactNode;
56
+
57
+ /**
58
+ * 是否为右到左布局
59
+ */
60
+ rtl?: boolean;
61
+
62
+ /**
63
+ * 自定义图片节点
64
+ */
65
+ imageNode?: React.ReactNode;
66
+
67
+ /**
68
+ * 组件样式前缀
69
+ */
70
+ prefix?: string;
71
+ }
72
+
73
+ declare const Empty: React.FC<EmptyProps> & {
74
+ defaultProps: Partial<EmptyProps>;
75
+ SIMPLE: string;
76
+ DEFAULT: string;
77
+ };
78
+
79
+ export default Empty;
package/types/index.d.ts CHANGED
@@ -8,7 +8,6 @@ export { PopConfirm } from './balloon-confirm';
8
8
  export { default as BatchInput } from './batch-input';
9
9
  export { default as Breadcrumb } from './breadcrumb';
10
10
  export { default as Box } from './box';
11
- export { default as Filter } from './filter';
12
11
  export { default as Button } from './button';
13
12
  export { default as Calendar } from './calendar';
14
13
  export { default as Card } from './card';
@@ -16,12 +15,16 @@ export { default as Cascader } from './cascader';
16
15
  export { default as CascaderSelect } from './cascader-select';
17
16
  export { default as Checkbox } from './checkbox';
18
17
  export { default as Collapse } from './collapse';
18
+ export { default as Comments } from './comments';
19
19
  export { default as ConfigProvider } from './config-provider';
20
20
  export { default as DatePicker } from './date-picker';
21
21
  export { default as Dialog } from './dialog';
22
22
  export { default as Divider } from './divider';
23
23
  export { default as Drawer } from './drawer';
24
24
  export { default as Dropdown } from './dropdown';
25
+ export { default as EditableTable } from './editable-table';
26
+ export { default as Empty, EMPTY_TYPE } from './empty';
27
+ export { default as Filter } from './filter';
25
28
  export { default as Form } from './form';
26
29
  export { default as Grid } from './grid';
27
30
  export { default as Icon } from './icon';
@@ -59,10 +62,8 @@ export { default as Upload } from './upload';
59
62
  export { default as VirtualList } from './virtual-list';
60
63
  export { default as Image } from './image';
61
64
  export { default as QueryForm } from './query-form';
62
- export { default as EditableTable } from './editable-table';
63
65
  export { default as SortableList } from './sortable-list';
64
66
  export { default as hooks } from './0buildTypes/hooks';
65
- export { default as Empty } from './0buildTypes/empty';
66
67
 
67
68
 
68
69
  export * from './0buildTypes/others';