bhd-components 0.10.4 → 0.10.6
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.
- package/dist/index.esm.es5.development.css +127 -87
- package/dist/index.esm.es5.development.js +491 -294
- package/dist/index.esm.es5.production.css +1 -1
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +1 -1
- package/dist/vendor.esm.es5.production.js +1 -1
- package/es2017/AIMessageList/components/copyIcon/index.js +22 -7
- package/es2017/AIMessageList/components/copyIcon/index.module.less +2 -2
- package/es2017/AIMessageList/components/fileList/index.js +11 -2
- package/es2017/AIMessageList/components/footer/index.js +69 -51
- package/es2017/AIMessageList/components/referencesIcon/index.js +19 -8
- package/es2017/AIMessageList/components/referencesIcon/index.module.less +1 -1
- package/es2017/AIMessageList/components/refreshBtn/index.d.ts +4 -0
- package/es2017/AIMessageList/components/refreshBtn/index.js +29 -0
- package/es2017/AIMessageList/components/refreshBtn/index.module.less +12 -0
- package/es2017/AIMessageList/components/remarkBtn/index.d.ts +4 -0
- package/es2017/AIMessageList/components/remarkBtn/index.js +51 -0
- package/es2017/AIMessageList/components/remarkBtn/index.module.less +13 -0
- package/es2017/AIMessageList/components/sendBtn/index.js +6 -1
- package/es2017/AIMessageList/components/virtuosoList/index.js +91 -13
- package/es2017/AIMessageList/components/virtuosoList/index.module.less +10 -1
- package/es2017/AIMessageList/type.d.ts +43 -10
- package/esm/AIMessageList/components/copyIcon/index.js +22 -7
- package/esm/AIMessageList/components/copyIcon/index.module.less +2 -2
- package/esm/AIMessageList/components/fileList/index.js +7 -2
- package/esm/AIMessageList/components/footer/index.js +97 -98
- package/esm/AIMessageList/components/referencesIcon/index.js +19 -8
- package/esm/AIMessageList/components/referencesIcon/index.module.less +1 -1
- package/esm/AIMessageList/components/refreshBtn/index.d.ts +4 -0
- package/esm/AIMessageList/components/refreshBtn/index.js +31 -0
- package/esm/AIMessageList/components/refreshBtn/index.module.less +12 -0
- package/esm/AIMessageList/components/remarkBtn/index.d.ts +4 -0
- package/esm/AIMessageList/components/remarkBtn/index.js +51 -0
- package/esm/AIMessageList/components/remarkBtn/index.module.less +13 -0
- package/esm/AIMessageList/components/sendBtn/index.js +6 -1
- package/esm/AIMessageList/components/virtuosoList/index.js +93 -13
- package/esm/AIMessageList/components/virtuosoList/index.module.less +10 -1
- package/esm/AIMessageList/type.d.ts +43 -10
- package/package.json +1 -1
|
@@ -26,11 +26,17 @@ export interface headerConfigProps {
|
|
|
26
26
|
export interface msgActionProps {
|
|
27
27
|
renderLeft?: (
|
|
28
28
|
copyNode: React.ReactNode,
|
|
29
|
-
referencesNode: React.ReactNode
|
|
29
|
+
referencesNode: React.ReactNode,
|
|
30
|
+
upVoteNode: React.ReactNode,
|
|
31
|
+
downVoteNode: React.ReactNode,
|
|
32
|
+
refreshNode:React.ReactNode,
|
|
30
33
|
) => React.ReactNode;
|
|
31
34
|
renderRight?: (
|
|
32
35
|
copyNode: React.ReactNode,
|
|
33
|
-
referencesNode: React.ReactNode
|
|
36
|
+
referencesNode: React.ReactNode,
|
|
37
|
+
upVoteNode: React.ReactNode,
|
|
38
|
+
downVoteNode: React.ReactNode,
|
|
39
|
+
refreshNode:React.ReactNode,
|
|
34
40
|
) => React.ReactNode;
|
|
35
41
|
}
|
|
36
42
|
|
|
@@ -54,6 +60,8 @@ export interface contentConfigProps {
|
|
|
54
60
|
referenceNode: React.ReactNode
|
|
55
61
|
) => React.ReactNode; //覆盖引用内容
|
|
56
62
|
onRecordMessage?: (item: dataItemType) => void; // 发送和接收的消息记录
|
|
63
|
+
onVoteChange?: (type:string,item: dataItemType) => void; // 点赞 或踩
|
|
64
|
+
onRefresh?: (item:dataItemType) => void;// 刷新
|
|
57
65
|
}
|
|
58
66
|
|
|
59
67
|
// content props
|
|
@@ -76,19 +84,25 @@ export interface footerConfigProps {
|
|
|
76
84
|
) => React.ReactNode; // 自定义渲染操作栏
|
|
77
85
|
fileUpload?: boolean | fileUploadProps; // 默认为false
|
|
78
86
|
sendMsgAjaxParams: sendMsgAjaxParams;
|
|
87
|
+
onClickStop?: () => void;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface onOpenProps {
|
|
91
|
+
retryFetch: () => void; // 重试
|
|
92
|
+
stopMessage: () => void;
|
|
79
93
|
}
|
|
80
94
|
|
|
81
95
|
export interface sendMsgAjaxParams {
|
|
82
96
|
url: string;
|
|
83
97
|
method?: string;
|
|
84
|
-
headers?: object;
|
|
98
|
+
headers?: () => object;
|
|
85
99
|
params: (
|
|
86
100
|
value: string,
|
|
87
101
|
refereces: referenceType,
|
|
88
102
|
fileList: fileCustomProps[],
|
|
89
|
-
beforeInfo:any
|
|
103
|
+
beforeInfo: any
|
|
90
104
|
) => string;
|
|
91
|
-
onOpen?: (res: Response) => void;
|
|
105
|
+
onOpen?: (res: Response, onOpenProps: onOpenProps) => void;
|
|
92
106
|
onMessage?: (ev: EventSourceMessage) => { id: string; content: string };
|
|
93
107
|
onClose?: () => void;
|
|
94
108
|
onError?: (err: any) => void;
|
|
@@ -107,16 +121,17 @@ export interface fileUploadProps {
|
|
|
107
121
|
maxCount?: number; // 上传文件数量限制 -1为不限制 默认为10
|
|
108
122
|
maxSize?: number; // 默认为50Mb 目前不考虑切片上传 业务上不要设置太大
|
|
109
123
|
multiple?: boolean; // 是否允许多选
|
|
110
|
-
customRequest: (
|
|
111
|
-
file: File
|
|
112
|
-
) => Promise<{
|
|
124
|
+
customRequest: (file: File) => Promise<{
|
|
113
125
|
url: string;
|
|
114
126
|
fileId: string;
|
|
115
127
|
source: File;
|
|
116
128
|
status: fileStatus;
|
|
117
129
|
}>; // 自定义上传方法
|
|
118
130
|
mapUploadCount?: number; // 并发上传的数量 默认为1
|
|
119
|
-
deleteFileAjax?: (
|
|
131
|
+
deleteFileAjax?: (
|
|
132
|
+
fileId: string,
|
|
133
|
+
file: fileCustomProps
|
|
134
|
+
) => Promise<{ fileId: string }>; // 删除文件的ajax 返回删除文件的fileId
|
|
120
135
|
statusText?: (status: fileStatus) => React.ReactNode; // 自定义状态显示
|
|
121
136
|
parseFileAjax?: (fileId: string) => { status: fileStatus; fileId; string }; //文件解析的 ajax 请求 如不存在解析过程,可在此函数内直接返回上传成功的状态
|
|
122
137
|
iconFileRender?: (suffix: string) => React.ReactNode; // 文件上传的 icon。参数 文件对象file 返回值为图标
|
|
@@ -151,6 +166,7 @@ export interface sendBtnProps {
|
|
|
151
166
|
canSendMsg: boolean;
|
|
152
167
|
sending: boolean;
|
|
153
168
|
stopMessage: () => void;
|
|
169
|
+
clickFn?: () => void;
|
|
154
170
|
}
|
|
155
171
|
|
|
156
172
|
// uploadFileBtn Props
|
|
@@ -160,6 +176,17 @@ export interface uploadFileBtnProps {
|
|
|
160
176
|
customRequest: (options: any) => void;
|
|
161
177
|
}
|
|
162
178
|
|
|
179
|
+
export interface VoteBtnProps {
|
|
180
|
+
prefix: string;
|
|
181
|
+
clickFn: () => void;
|
|
182
|
+
isActive: boolean;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export interface refreshBtnProps{
|
|
186
|
+
prefix:string;
|
|
187
|
+
clickFn:()=>void;
|
|
188
|
+
}
|
|
189
|
+
|
|
163
190
|
// fileList Props
|
|
164
191
|
|
|
165
192
|
export interface fileListProps {
|
|
@@ -189,7 +216,7 @@ export interface FileListRefProps {
|
|
|
189
216
|
updateFile: (fileId: string, status: fileStatus) => void;
|
|
190
217
|
getFileList: () => fileCustomProps[];
|
|
191
218
|
vaildFile: (file: File, fileId?: string) => boolean; // 校验文件是否合规
|
|
192
|
-
fileToCustomFile: (file: File) => fileCustomProps;
|
|
219
|
+
fileToCustomFile: (file: File, params: any) => fileCustomProps;
|
|
193
220
|
}
|
|
194
221
|
|
|
195
222
|
// error Message
|
|
@@ -219,11 +246,13 @@ export type referenceType = referenceTypeText | referenceTypeFile;
|
|
|
219
246
|
export type referenceTypeText = {
|
|
220
247
|
type: "text";
|
|
221
248
|
value: string;
|
|
249
|
+
source:any;
|
|
222
250
|
};
|
|
223
251
|
|
|
224
252
|
export type referenceTypeFile = {
|
|
225
253
|
type: "file";
|
|
226
254
|
value: fileCustomProps;
|
|
255
|
+
source:any;
|
|
227
256
|
};
|
|
228
257
|
|
|
229
258
|
export interface VirtuosoListProps {
|
|
@@ -237,6 +266,9 @@ export interface VirtuosoListRefProps {
|
|
|
237
266
|
updateMsg: (id: string, obj: any) => void;
|
|
238
267
|
clearInputing: () => void; //清楚正在输入的inputing
|
|
239
268
|
recordMsg: (item: dataItemType) => void;
|
|
269
|
+
getDataSource: () => dataItemType[];
|
|
270
|
+
upateDataSource:(id:string,obj:dataItemType)=>void;
|
|
271
|
+
changeDataSource:(list:dataItemType[])=>void
|
|
240
272
|
}
|
|
241
273
|
|
|
242
274
|
export interface contentRefProps extends VirtuosoListRefProps {}
|
|
@@ -255,4 +287,5 @@ export interface dataItemType {
|
|
|
255
287
|
location: "left" | "right"; // 消息显示在左边还是右边
|
|
256
288
|
reference: referenceType | null; // 引用数据
|
|
257
289
|
source: any; //原消息对象
|
|
290
|
+
vote?:string;// "up":点赞。"down":踩
|
|
258
291
|
}
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
2
|
-
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
3
3
|
import React, { useEffect, useState, useRef } from "react";
|
|
4
4
|
import styles from "./index.module.less";
|
|
5
5
|
import { copyText } from "../../../utils/dom";
|
|
6
6
|
var copyIconSvg = /*#__PURE__*/ _jsx("i", {
|
|
7
|
-
children: /*#__PURE__*/
|
|
8
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
children: /*#__PURE__*/ _jsxs("svg", {
|
|
9
8
|
width: "1em",
|
|
10
9
|
height: "1em",
|
|
11
|
-
viewBox: "0 0
|
|
10
|
+
viewBox: "0 0 14 14",
|
|
11
|
+
"shape-rendering": "geometricPrecision",
|
|
12
12
|
fill: "currentColor",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
children: [
|
|
15
|
+
/*#__PURE__*/ _jsx("g", {
|
|
16
|
+
"clip-path": "url(#clip0_518_8403)",
|
|
17
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
18
|
+
d: "M6.16666 1.66666H13.1667C13.4761 1.66666 13.7728 1.78957 13.9916 2.00837C14.2104 2.22716 14.3333 2.5239 14.3333 2.83332V9.83332C14.3333 10.1427 14.2104 10.4395 13.9916 10.6583C13.7728 10.8771 13.4761 11 13.1667 11H6.16666C5.85724 11 5.5605 10.8771 5.34171 10.6583C5.12291 10.4395 5 10.1427 5 9.83332V2.83332C5 2.5239 5.12291 2.22716 5.34171 2.00837C5.5605 1.78957 5.85724 1.66666 6.16666 1.66666ZM6.16666 2.66666C6.12246 2.66666 6.08007 2.68422 6.04881 2.71547C6.01756 2.74673 6 2.78912 6 2.83332V9.83332C6 9.85521 6.00431 9.87688 6.01268 9.8971C6.02106 9.91732 6.03334 9.9357 6.04881 9.95117C6.06429 9.96665 6.08266 9.97893 6.10288 9.9873C6.1231 9.99568 6.14478 9.99999 6.16666 9.99999H13.1667C13.2109 9.99999 13.2533 9.98243 13.2845 9.95117C13.3158 9.91992 13.3333 9.87753 13.3333 9.83332V2.83332C13.3333 2.78912 13.3158 2.74673 13.2845 2.71547C13.2533 2.68422 13.2109 2.66666 13.1667 2.66666H6.16666ZM10 12C10 11.8674 10.0527 11.7402 10.1464 11.6464C10.2402 11.5527 10.3674 11.5 10.5 11.5C10.6326 11.5 10.7598 11.5527 10.8536 11.6464C10.9473 11.7402 11 11.8674 11 12V13.1667C11 13.4761 10.8771 13.7728 10.6583 13.9916C10.4395 14.2104 10.1427 14.3333 9.83333 14.3333H2.83333C2.52391 14.3333 2.22717 14.2104 2.00837 13.9916C1.78958 13.7728 1.66666 13.4761 1.66666 13.1667V6.16666C1.66666 5.85724 1.78958 5.56049 2.00837 5.3417C2.22717 5.12291 2.52391 4.99999 2.83333 4.99999H4C4.13261 4.99999 4.25978 5.05267 4.35355 5.14644C4.44732 5.2402 4.5 5.36738 4.5 5.49999C4.5 5.6326 4.44732 5.75978 4.35355 5.85354C4.25978 5.94731 4.13261 5.99999 4 5.99999H2.83333C2.78913 5.99999 2.74674 6.01755 2.71548 6.04881C2.68422 6.08006 2.66666 6.12245 2.66666 6.16666V13.1667C2.66666 13.2109 2.68422 13.2533 2.71548 13.2845C2.74674 13.3158 2.78913 13.3333 2.83333 13.3333H9.83333C9.87753 13.3333 9.91993 13.3158 9.95118 13.2845C9.98244 13.2533 10 13.2109 10 13.1667V12Z"
|
|
19
|
+
})
|
|
20
|
+
}),
|
|
21
|
+
/*#__PURE__*/ _jsx("defs", {
|
|
22
|
+
children: /*#__PURE__*/ _jsx("clipPath", {
|
|
23
|
+
id: "clip0_518_8403",
|
|
24
|
+
children: /*#__PURE__*/ _jsx("rect", {
|
|
25
|
+
width: "16",
|
|
26
|
+
height: "16"
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
]
|
|
16
31
|
})
|
|
17
32
|
});
|
|
18
33
|
var copySuccessSvg = /*#__PURE__*/ _jsx("i", {
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
background-color: transparent;
|
|
9
9
|
&>i{
|
|
10
10
|
color: #f4523b;
|
|
11
|
-
font-size:
|
|
11
|
+
font-size: 16px;
|
|
12
12
|
transform:scale(0.8);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
& > i {
|
|
16
16
|
color: rgba(140, 140, 140, 1);
|
|
17
|
-
font-size:
|
|
17
|
+
font-size: 16px;
|
|
18
18
|
}
|
|
19
19
|
&:hover {
|
|
20
20
|
background-color: rgba(0, 0, 0, 0.04);
|
|
@@ -202,9 +202,14 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
202
202
|
};
|
|
203
203
|
// 删除文件
|
|
204
204
|
var deleteFile = function(fileId) {
|
|
205
|
+
var fileObj = null;
|
|
205
206
|
setFileList(function(fileList) {
|
|
206
207
|
return fileList.filter(function(item) {
|
|
207
|
-
|
|
208
|
+
if (item.fileId === fileId) {
|
|
209
|
+
fileObj = item;
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
return false;
|
|
208
213
|
});
|
|
209
214
|
});
|
|
210
215
|
// 删除文件时如果删除的是最后一条 则page-1
|
|
@@ -216,7 +221,7 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
216
221
|
if (list.length === 0 && page > 1) {
|
|
217
222
|
changePage(page - 1);
|
|
218
223
|
}
|
|
219
|
-
fileUpload.deleteFileAjax && fileUpload.deleteFileAjax(fileId);
|
|
224
|
+
fileUpload.deleteFileAjax && fileUpload.deleteFileAjax(fileId, fileObj);
|
|
220
225
|
};
|
|
221
226
|
// 更新文件状态
|
|
222
227
|
var updateFile = function(fileId, status) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
3
2
|
import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
|
|
4
3
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
5
|
-
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
6
4
|
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
7
5
|
import React, { useState, useEffect, useImperativeHandle, forwardRef, useRef, useMemo } from "react";
|
|
8
6
|
import styles from "./index.module.less";
|
|
@@ -30,7 +28,7 @@ var defaultFileUploadProps = {
|
|
|
30
28
|
};
|
|
31
29
|
var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
32
30
|
var footerConfig = props.footerConfig, prefix = props.prefix, errorCallback = props.errorCallback, apiRef = props.apiRef;
|
|
33
|
-
var _footerConfig_placeholder = footerConfig.placeholder, placeholder = _footerConfig_placeholder === void 0 ? defaultProps.placeholder : _footerConfig_placeholder, _footerConfig_className = footerConfig.className, className = _footerConfig_className === void 0 ? defaultProps.className : _footerConfig_className, _footerConfig_maxLength = footerConfig.maxLength, maxLength = _footerConfig_maxLength === void 0 ? defaultProps.maxLength : _footerConfig_maxLength, renderAction = footerConfig.renderAction, fileUpload = footerConfig.fileUpload, sendMsgAjaxParams = footerConfig.sendMsgAjaxParams;
|
|
31
|
+
var _footerConfig_placeholder = footerConfig.placeholder, placeholder = _footerConfig_placeholder === void 0 ? defaultProps.placeholder : _footerConfig_placeholder, _footerConfig_className = footerConfig.className, className = _footerConfig_className === void 0 ? defaultProps.className : _footerConfig_className, _footerConfig_maxLength = footerConfig.maxLength, maxLength = _footerConfig_maxLength === void 0 ? defaultProps.maxLength : _footerConfig_maxLength, renderAction = footerConfig.renderAction, fileUpload = footerConfig.fileUpload, sendMsgAjaxParams = footerConfig.sendMsgAjaxParams, _footerConfig_onClickStop = footerConfig.onClickStop, onClickStop = _footerConfig_onClickStop === void 0 ? function() {} : _footerConfig_onClickStop;
|
|
34
32
|
if (fileUpload) {
|
|
35
33
|
fileUpload = _object_spread({}, defaultFileUploadProps, fileUpload);
|
|
36
34
|
}
|
|
@@ -118,7 +116,14 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
118
116
|
prefix: prefix,
|
|
119
117
|
canSendMsg: canSendMsg,
|
|
120
118
|
sending: sending,
|
|
121
|
-
stopMessage:
|
|
119
|
+
stopMessage: function() {
|
|
120
|
+
onClickStop();
|
|
121
|
+
stopMessage();
|
|
122
|
+
},
|
|
123
|
+
clickFn: function() {
|
|
124
|
+
if (textValue.trim().length === 0) return;
|
|
125
|
+
sendMsg(textValue);
|
|
126
|
+
}
|
|
122
127
|
});
|
|
123
128
|
if (fileUpload) {
|
|
124
129
|
var fileNode = /*#__PURE__*/ _jsx(UploadFileBtn, {
|
|
@@ -188,105 +193,99 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
188
193
|
sendMsgAjax();
|
|
189
194
|
};
|
|
190
195
|
var sendMsgAjax = function() {
|
|
191
|
-
var
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
196
|
+
var url = sendMsgAjaxParams.url, _sendMsgAjaxParams_method = sendMsgAjaxParams.method, method = _sendMsgAjaxParams_method === void 0 ? "POST" : _sendMsgAjaxParams_method, _sendMsgAjaxParams_headers = sendMsgAjaxParams.headers, headers = _sendMsgAjaxParams_headers === void 0 ? function() {
|
|
197
|
+
return {};
|
|
198
|
+
} : _sendMsgAjaxParams_headers, _sendMsgAjaxParams_params = sendMsgAjaxParams.params, params = _sendMsgAjaxParams_params === void 0 ? function() {
|
|
199
|
+
return "";
|
|
200
|
+
} : _sendMsgAjaxParams_params, _sendMsgAjaxParams_onOpen = sendMsgAjaxParams.onOpen, onOpen = _sendMsgAjaxParams_onOpen === void 0 ? function() {} : _sendMsgAjaxParams_onOpen, _sendMsgAjaxParams_onMessage = sendMsgAjaxParams.onMessage, onMessage = _sendMsgAjaxParams_onMessage === void 0 ? function(ev) {
|
|
201
|
+
return ev;
|
|
202
|
+
} : _sendMsgAjaxParams_onMessage, _sendMsgAjaxParams_onClose = sendMsgAjaxParams.onClose, onClose = _sendMsgAjaxParams_onClose === void 0 ? function() {} : _sendMsgAjaxParams_onClose, _sendMsgAjaxParams_onError = sendMsgAjaxParams.onError, onError = _sendMsgAjaxParams_onError === void 0 ? function() {} : _sendMsgAjaxParams_onError, _sendMsgAjaxParams_coverProps = sendMsgAjaxParams.coverProps, coverProps = _sendMsgAjaxParams_coverProps === void 0 ? {} : _sendMsgAjaxParams_coverProps, _sendMsgAjaxParams_beforeSendMsg = sendMsgAjaxParams.beforeSendMsg, beforeSendMsg = _sendMsgAjaxParams_beforeSendMsg === void 0 ? function() {
|
|
203
|
+
return Promise.resolve();
|
|
204
|
+
} : _sendMsgAjaxParams_beforeSendMsg;
|
|
205
|
+
ctrl.current = new AbortController();
|
|
206
|
+
// apiRef
|
|
207
|
+
console.log("apiRef", apiRef);
|
|
208
|
+
var msgId = "inputing";
|
|
209
|
+
var createTime = new Date().getTime();
|
|
210
|
+
apiRef.contentApi.addMsg({
|
|
211
|
+
id: msgId,
|
|
212
|
+
createTime: createTime,
|
|
213
|
+
content: "正在输入...",
|
|
214
|
+
location: "left",
|
|
215
|
+
reference: null,
|
|
216
|
+
source: null
|
|
217
|
+
});
|
|
218
|
+
var msgContent = "";
|
|
219
|
+
setSending(true);
|
|
220
|
+
setTextValue("");
|
|
221
|
+
setReferencesSource(null);
|
|
222
|
+
var recordMsgObj = {};
|
|
223
|
+
var arg = [
|
|
224
|
+
recordRef.current.value,
|
|
225
|
+
recordRef.current.referencesSource,
|
|
226
|
+
fileListRef.current ? fileListRef.current.getFileList() : []
|
|
227
|
+
];
|
|
228
|
+
beforeSendMsg.apply(void 0, _to_consumable_array(arg)).then(function(beforeInfo) {
|
|
229
|
+
var callback = function() {
|
|
230
|
+
fetchEventSource(url, _object_spread({
|
|
231
|
+
method: method,
|
|
232
|
+
headers: _object_spread({
|
|
233
|
+
"Content-Type": "application/json",
|
|
234
|
+
"Accept": "text/event-stream,application/json"
|
|
235
|
+
}, headers()),
|
|
236
|
+
body: params.apply(void 0, _to_consumable_array(arg).concat([
|
|
237
|
+
beforeInfo
|
|
238
|
+
])),
|
|
239
|
+
openWhenHidden: true,
|
|
240
|
+
signal: ctrl.current.signal,
|
|
241
|
+
onopen: function(res) {
|
|
242
|
+
var retryFetch = function() {
|
|
243
|
+
callback();
|
|
244
|
+
};
|
|
245
|
+
onOpen(res, {
|
|
246
|
+
retryFetch: retryFetch,
|
|
247
|
+
stopMessage: stopMessage
|
|
248
|
+
});
|
|
249
|
+
return null;
|
|
250
|
+
},
|
|
251
|
+
onmessage: function(ev) {
|
|
252
|
+
var data = onMessage(ev);
|
|
253
|
+
msgContent += data.content;
|
|
254
|
+
delete data.content;
|
|
255
|
+
recordMsgObj = _object_spread({
|
|
210
256
|
createTime: createTime,
|
|
211
|
-
content:
|
|
257
|
+
content: msgContent,
|
|
212
258
|
location: "left",
|
|
213
259
|
reference: null,
|
|
214
260
|
source: null
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
openWhenHidden: true,
|
|
242
|
-
signal: ctrl.current.signal,
|
|
243
|
-
onopen: function(res) {
|
|
244
|
-
onOpen(res);
|
|
245
|
-
if (res.status === 200) {}
|
|
246
|
-
return null;
|
|
247
|
-
},
|
|
248
|
-
onmessage: function(ev) {
|
|
249
|
-
var data = onMessage(ev);
|
|
250
|
-
msgContent += data.content;
|
|
251
|
-
delete data.content;
|
|
252
|
-
recordMsgObj = _object_spread({
|
|
253
|
-
createTime: createTime,
|
|
254
|
-
content: msgContent,
|
|
255
|
-
location: "left",
|
|
256
|
-
reference: null,
|
|
257
|
-
source: null
|
|
258
|
-
}, data);
|
|
259
|
-
updateMsgRef.current = setTimeout(function() {
|
|
260
|
-
apiRef.contentApi.updateMsg(msgId, recordMsgObj);
|
|
261
|
-
msgId = data.id;
|
|
262
|
-
}, 100);
|
|
263
|
-
},
|
|
264
|
-
onclose: function() {
|
|
265
|
-
onClose();
|
|
266
|
-
setSending(false);
|
|
267
|
-
if (recordMsgObj.id) {
|
|
268
|
-
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
269
|
-
}
|
|
270
|
-
console.log("onclose: ", recordMsgObj);
|
|
271
|
-
},
|
|
272
|
-
onerror: function(err) {
|
|
273
|
-
onError(err);
|
|
274
|
-
if (recordMsgObj.id) {
|
|
275
|
-
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
276
|
-
}
|
|
277
|
-
console.log("onerror: ", err);
|
|
278
|
-
}
|
|
279
|
-
}, coverProps));
|
|
280
|
-
return [
|
|
281
|
-
2
|
|
282
|
-
];
|
|
283
|
-
}
|
|
284
|
-
});
|
|
261
|
+
}, data);
|
|
262
|
+
updateMsgRef.current = setTimeout(function() {
|
|
263
|
+
apiRef.contentApi.updateMsg(msgId, recordMsgObj);
|
|
264
|
+
msgId = data.id;
|
|
265
|
+
}, 100);
|
|
266
|
+
},
|
|
267
|
+
onclose: function() {
|
|
268
|
+
onClose();
|
|
269
|
+
setSending(false);
|
|
270
|
+
if (recordMsgObj.id) {
|
|
271
|
+
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
272
|
+
}
|
|
273
|
+
console.log("onclose: ", recordMsgObj);
|
|
274
|
+
},
|
|
275
|
+
onerror: function(err) {
|
|
276
|
+
onError(err);
|
|
277
|
+
if (recordMsgObj.id) {
|
|
278
|
+
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
279
|
+
}
|
|
280
|
+
console.log("onerror: ", err);
|
|
281
|
+
}
|
|
282
|
+
}, coverProps));
|
|
283
|
+
};
|
|
284
|
+
callback();
|
|
285
|
+
}).catch(function() {
|
|
286
|
+
stopMessage();
|
|
285
287
|
});
|
|
286
|
-
|
|
287
|
-
return _ref.apply(this, arguments);
|
|
288
|
-
};
|
|
289
|
-
}();
|
|
288
|
+
};
|
|
290
289
|
// 判断是否超出最大字数
|
|
291
290
|
var judegTextLengthWarn = function() {
|
|
292
291
|
if (typeof maxLength === "function") {
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@ice/jsx-runtime/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import styles from "./index.module.less";
|
|
4
4
|
var referencesIcon = /*#__PURE__*/ _jsx("i", {
|
|
5
|
-
children: /*#__PURE__*/
|
|
6
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
5
|
+
children: /*#__PURE__*/ _jsxs("svg", {
|
|
7
6
|
width: "1em",
|
|
8
7
|
height: "1em",
|
|
9
|
-
|
|
8
|
+
"shape-rendering": "geometricPrecision",
|
|
10
9
|
fill: "currentColor",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
viewBox: "0 0 14 14",
|
|
11
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ _jsx("path", {
|
|
14
|
+
"fill-rule": "evenodd",
|
|
15
|
+
"clip-rule": "evenodd",
|
|
16
|
+
d: "M6.28443 3.03861C3.77423 4.65069 2.37971 6.52702 2.10085 8.66759C1.66674 12 4.6468 13.6311 6.15677 12.1655C7.66673 10.7 6.7616 8.83982 5.66823 8.33136C4.57487 7.82286 3.90623 7.99996 4.02287 7.32046C4.1395 6.64099 5.69503 4.75706 7.06163 3.87969C7.1523 3.80259 7.1868 3.65299 7.0995 3.53949C7.04207 3.46486 6.92943 3.31847 6.7616 3.10033C6.61483 2.90957 6.47423 2.91671 6.28443 3.03861Z"
|
|
17
|
+
}),
|
|
18
|
+
/*#__PURE__*/ _jsx("path", {
|
|
19
|
+
"fill-rule": "evenodd",
|
|
20
|
+
"clip-rule": "evenodd",
|
|
21
|
+
d: "M12.893 3.03861C10.3828 4.65069 8.98827 6.52702 8.7094 8.66759C8.2753 12 11.2554 13.6311 12.7653 12.1655C14.2753 10.7 13.3702 8.83982 12.2768 8.33136C11.1834 7.82286 10.5148 7.99996 10.6314 7.32046C10.7481 6.64099 12.3036 4.75706 13.6702 3.87969C13.7609 3.80259 13.7954 3.65299 13.708 3.53949C13.6506 3.46486 13.538 3.31847 13.3702 3.10033C13.2234 2.90957 13.0828 2.91671 12.893 3.03861Z"
|
|
22
|
+
})
|
|
23
|
+
]
|
|
14
24
|
})
|
|
15
25
|
});
|
|
16
26
|
var ReferencesIcon = function(props) {
|
|
@@ -24,7 +34,8 @@ var ReferencesIcon = function(props) {
|
|
|
24
34
|
console.log("itemitem", item);
|
|
25
35
|
apiRef.footerApi.setReferences({
|
|
26
36
|
type: "text",
|
|
27
|
-
value: item.content
|
|
37
|
+
value: item.content,
|
|
38
|
+
source: item
|
|
28
39
|
});
|
|
29
40
|
}
|
|
30
41
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styles from "./index.module.less";
|
|
4
|
+
var refreshSvg = /*#__PURE__*/ _jsx("svg", {
|
|
5
|
+
viewBox: "0 0 14 14",
|
|
6
|
+
version: "1.1",
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8
|
+
"p-id": "8340",
|
|
9
|
+
width: "1em",
|
|
10
|
+
height: "1em",
|
|
11
|
+
fill: "currentColor",
|
|
12
|
+
"shape-rendering": "geometricPrecision",
|
|
13
|
+
"aria-hidden": "true",
|
|
14
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
15
|
+
d: "M8 3.80001C7.27938 3.80001 6.60141 3.97512 6.00464 4.2846C5.71048 4.43715 5.34834 4.32235 5.19579 4.02818C5.04324 3.73401 5.15804 3.37187 5.4522 3.21932C6.21563 2.82342 7.0826 2.60001 8 2.60001C11.0603 2.60001 13.5412 5.08088 13.5412 8.14118C13.5412 8.40936 13.5221 8.67343 13.4851 8.93202C13.4737 9.01141 13.4607 9.09026 13.446 9.16853L13.7175 9.02364C14.0098 8.86759 14.3733 8.97808 14.5293 9.27041C14.6854 9.56274 14.5749 9.92622 14.2825 10.0823L12.6718 10.9421C12.3819 11.0968 12.0215 10.9896 11.8633 10.7016L11.0035 9.13588C10.844 8.84542 10.9501 8.48065 11.2406 8.32115C11.5311 8.16164 11.8958 8.2678 12.0553 8.55825L12.2672 8.94405C12.2784 8.88383 12.2885 8.82318 12.2972 8.76211C12.3261 8.55962 12.3412 8.35233 12.3412 8.14118C12.3412 5.74362 10.3976 3.80001 8 3.80001ZM3.32824 5.34029C3.61811 5.18556 3.97853 5.29278 4.13669 5.58079L4.99651 7.14649C5.15601 7.43694 5.04986 7.80171 4.7594 7.96122C4.46895 8.12072 4.10418 8.01457 3.94467 7.72411L3.73281 7.33832C3.72156 7.39853 3.71155 7.45919 3.70282 7.52026C3.67386 7.72275 3.65883 7.93003 3.65883 8.14118C3.65883 10.5387 5.60244 12.4824 8 12.4824C8.72063 12.4824 9.39859 12.3072 9.99536 11.9978C10.2895 11.8452 10.6517 11.96 10.8042 12.2542C10.9568 12.5484 10.842 12.9105 10.5478 13.063C9.78437 13.4589 8.9174 13.6824 8 13.6824C4.93969 13.6824 2.45883 11.2015 2.45883 8.14118C2.45883 7.87301 2.47792 7.60894 2.51491 7.35034C2.52627 7.27095 2.5393 7.19211 2.55399 7.11384L2.28254 7.25873C1.99021 7.41477 1.62673 7.30429 1.47069 7.01196C1.31465 6.71963 1.42513 6.35615 1.71746 6.20011L3.32824 5.34029Z"
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
var RefreshBtn = function(props) {
|
|
19
|
+
var prefix = props.prefix, clickFn = props.clickFn;
|
|
20
|
+
var getCls = function(clsName) {
|
|
21
|
+
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
22
|
+
};
|
|
23
|
+
return /*#__PURE__*/ _jsx("i", {
|
|
24
|
+
className: "".concat(getCls("refreshBtn")),
|
|
25
|
+
onClick: function() {
|
|
26
|
+
return clickFn();
|
|
27
|
+
},
|
|
28
|
+
children: refreshSvg
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
export default RefreshBtn;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styles from "./index.module.less";
|
|
4
|
+
var upvoteBtnSvg = /*#__PURE__*/ _jsx("svg", {
|
|
5
|
+
width: "1em",
|
|
6
|
+
height: "1em",
|
|
7
|
+
viewBox: "0 0 16 16",
|
|
8
|
+
"shape-rendering": "geometricPrecision",
|
|
9
|
+
fill: "currentColor",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
12
|
+
d: "M14.9948 7.82355C14.999 7.88679 14.9948 7.95002 14.978 8.01326L13.7172 13.4046C13.7003 13.4699 13.6709 13.527 13.633 13.58C13.4983 13.8411 13.292 14.0716 13.0205 14.2409C12.7321 14.4184 12.4122 14.5 12.0944 14.5V14.4959L4.00144 14.4918C3.97408 14.4959 3.94461 14.498 3.91514 14.498C3.88568 14.498 3.85621 14.4959 3.82885 14.4918H1.67564C1.64617 14.4959 1.6146 14.5 1.58303 14.5C1.26099 14.5 1 14.2471 1 13.935L1.00631 7.1504C1.00631 6.8383 1.26731 6.58536 1.58934 6.58536C1.6125 6.58536 1.63775 6.5874 1.66091 6.58944L3.59522 6.58536V6.57516C5.37587 6.45073 6.78609 5.03711 6.8366 3.29303C6.83239 3.24408 6.82818 3.19512 6.82818 3.14412C6.82818 2.23639 7.58802 1.5 8.52465 1.5C9.32868 1.5 10.0022 2.04464 10.1769 2.77287L10.1853 2.77083C10.2801 3.18696 10.3327 3.61941 10.3327 4.06206C10.3327 4.74745 10.2127 5.40428 9.99169 6.0142L13.2457 6.01828C13.2752 6.01828 13.3046 6.02032 13.3341 6.02644C13.8898 6.04684 14.4244 6.32426 14.7401 6.8179C14.9422 7.13204 15.0222 7.4829 14.9948 7.82355ZM2.16816 13.3618H3.33422L3.33843 7.71544L2.17448 7.71748L2.16816 13.3618ZM13.7572 7.40946C13.6456 7.23403 13.4478 7.14224 13.2478 7.15244V7.1504H13.2457L9.13294 7.14632C8.8109 7.14632 8.54991 6.89338 8.54991 6.58128C8.54991 6.49153 8.57306 6.40585 8.61095 6.33038L8.60463 6.3263C8.83827 5.90609 9.00665 5.44712 9.10347 4.96367H9.10979C9.10979 4.96367 9.18766 4.6577 9.18556 4.0743C9.18556 3.61125 9.09716 3.18696 9.09716 3.18696H9.09295C9.09295 3.1788 9.09505 3.17064 9.09505 3.16248C9.09505 2.87078 8.85089 2.63416 8.54991 2.63416C8.24892 2.63416 8.00477 2.87078 8.00477 3.16248C8.00477 3.17472 8.00687 3.18696 8.00687 3.1992H7.99845C7.99845 3.1992 8.00687 3.63981 7.91636 4.09878C7.87848 4.29256 7.82375 4.47411 7.77324 4.6169C7.77324 4.6169 7.77113 4.6169 7.77113 4.61486C7.28072 6.06928 6.0473 7.19528 4.50449 7.57673L4.49817 13.3638L12.0965 13.3658C12.1217 13.3658 12.147 13.3679 12.1723 13.372C12.248 13.3618 12.3238 13.3373 12.3912 13.2944C12.488 13.2353 12.5595 13.1496 12.6016 13.0517H12.6037L13.8161 7.86231L13.8119 7.86027C13.8624 7.71544 13.8477 7.55021 13.7572 7.40946Z"
|
|
13
|
+
})
|
|
14
|
+
});
|
|
15
|
+
var downvoteBtnSvg = /*#__PURE__*/ _jsx("svg", {
|
|
16
|
+
width: "1em",
|
|
17
|
+
height: "1em",
|
|
18
|
+
"shape-rendering": "geometricPrecision",
|
|
19
|
+
fill: "currentColor",
|
|
20
|
+
viewBox: "0 0 16 16",
|
|
21
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
22
|
+
children: /*#__PURE__*/ _jsx("path", {
|
|
23
|
+
d: "M1.0052 8.17645C1.00099 8.11321 1.0052 8.04998 1.02204 7.98674L2.28281 2.5954C2.29965 2.53013 2.32912 2.47301 2.36701 2.41998C2.50171 2.15887 2.70798 1.92837 2.9795 1.75906C3.26786 1.58159 3.58779 1.5 3.90561 1.5V1.50408L11.9986 1.50816C12.0259 1.50408 12.0554 1.50204 12.0849 1.50204C12.1143 1.50204 12.1438 1.50408 12.1712 1.50816H14.3244C14.3538 1.50408 14.3854 1.5 14.417 1.5C14.739 1.5 15 1.75294 15 2.06504L14.9937 8.8496C14.9937 9.1617 14.7327 9.41464 14.4107 9.41464C14.3875 9.41464 14.3622 9.4126 14.3391 9.41056L12.4048 9.41464V9.42484C10.6241 9.54927 9.21391 10.9629 9.1634 12.707C9.16761 12.7559 9.17182 12.8049 9.17182 12.8559C9.17182 13.7636 8.41198 14.5 7.47535 14.5C6.67132 14.5 5.99778 13.9554 5.82308 13.2271L5.81466 13.2292C5.71995 12.813 5.66733 12.3806 5.66733 11.9379C5.66733 11.2526 5.7873 10.5957 6.00831 9.9858L2.75429 9.98172C2.72482 9.98172 2.69535 9.97968 2.66589 9.97356C2.11022 9.95316 1.5756 9.67574 1.25988 9.1821C1.05782 8.86796 0.977839 8.5171 1.0052 8.17645ZM13.8318 2.63824H12.6658L12.6616 8.28456L13.8255 8.28252L13.8318 2.63824ZM2.24282 8.59054C2.35438 8.76597 2.55223 8.85776 2.75218 8.84756V8.8496H2.75429L6.86706 8.85368C7.1891 8.85368 7.45009 9.10662 7.45009 9.41872C7.45009 9.50847 7.42694 9.59415 7.38905 9.66962L7.39537 9.6737C7.16173 10.0939 6.99335 10.5529 6.89653 11.0363H6.89021C6.89021 11.0363 6.81234 11.3423 6.81444 11.9257C6.81444 12.3887 6.90284 12.813 6.90284 12.813H6.90705C6.90705 12.8212 6.90495 12.8294 6.90495 12.8375C6.90495 13.1292 7.14911 13.3658 7.45009 13.3658C7.75108 13.3658 7.99523 13.1292 7.99523 12.8375C7.99523 12.8253 7.99313 12.813 7.99313 12.8008H8.00155C8.00155 12.8008 7.99313 12.3602 8.08364 11.9012C8.12152 11.7074 8.17625 11.5259 8.22676 11.3831C8.22676 11.3831 8.22887 11.3831 8.22887 11.3851C8.71928 9.93072 9.9527 8.80472 11.4955 8.42327L11.5018 2.6362L3.90351 2.63416C3.87825 2.63416 3.85299 2.63212 3.82773 2.62804C3.75196 2.63824 3.67619 2.66272 3.60884 2.70555C3.51201 2.76471 3.44045 2.85038 3.39836 2.9483H3.39625L2.18389 8.13769L2.1881 8.13973C2.13758 8.28456 2.15232 8.44979 2.24282 8.59054Z"
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
export var UpVoteBtn = function(props) {
|
|
27
|
+
var prefix = props.prefix, isActive = props.isActive, clickFn = props.clickFn;
|
|
28
|
+
var getCls = function(clsName) {
|
|
29
|
+
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
30
|
+
};
|
|
31
|
+
return /*#__PURE__*/ _jsx("i", {
|
|
32
|
+
onClick: function() {
|
|
33
|
+
clickFn();
|
|
34
|
+
},
|
|
35
|
+
className: "".concat(getCls("upVoteBtn"), " ").concat(isActive ? getCls("active") : ""),
|
|
36
|
+
children: upvoteBtnSvg
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export var DownVoteBtn = function(props) {
|
|
40
|
+
var prefix = props.prefix, isActive = props.isActive, clickFn = props.clickFn;
|
|
41
|
+
var getCls = function(clsName) {
|
|
42
|
+
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
43
|
+
};
|
|
44
|
+
return /*#__PURE__*/ _jsx("i", {
|
|
45
|
+
onClick: function() {
|
|
46
|
+
clickFn();
|
|
47
|
+
},
|
|
48
|
+
className: "".concat(getCls("downVoteBtn"), " ").concat(isActive ? getCls("active") : ""),
|
|
49
|
+
children: downvoteBtnSvg
|
|
50
|
+
});
|
|
51
|
+
};
|