bhd-components 0.10.6 → 0.10.7
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 +1117 -1115
- package/dist/index.esm.es5.development.js +80 -50
- 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 +3 -3
- package/es2017/AIMessageList/components/fileList/index.js +5 -1
- package/es2017/AIMessageList/components/footer/index.js +19 -11
- package/es2017/AIMessageList/components/header/index.js +4 -4
- package/es2017/AIMessageList/components/referencesIcon/index.js +1 -1
- package/es2017/AIMessageList/components/refreshBtn/index.js +1 -1
- package/es2017/AIMessageList/components/remarkBtn/index.js +2 -2
- package/es2017/AIMessageList/components/virtuosoList/index.js +36 -24
- package/es2017/AIMessageList/type.d.ts +4 -2
- package/es2017/customerService/historyFun.js +7 -1
- package/es2017/customerService/index.module.less +1 -0
- package/es2017/customerService/index2.module.less +1 -0
- package/esm/AIMessageList/components/copyIcon/index.js +3 -3
- package/esm/AIMessageList/components/fileList/index.js +5 -1
- package/esm/AIMessageList/components/footer/index.js +18 -10
- package/esm/AIMessageList/components/header/index.js +4 -4
- package/esm/AIMessageList/components/referencesIcon/index.js +1 -1
- package/esm/AIMessageList/components/refreshBtn/index.js +1 -1
- package/esm/AIMessageList/components/remarkBtn/index.js +2 -2
- package/esm/AIMessageList/components/virtuosoList/index.js +36 -24
- package/esm/AIMessageList/type.d.ts +4 -2
- package/esm/customerService/historyFun.js +7 -1
- package/esm/customerService/index.module.less +1 -0
- package/esm/customerService/index2.module.less +1 -0
- package/package.json +1 -1
|
@@ -7,12 +7,12 @@ const copyIconSvg = /*#__PURE__*/ _jsx("i", {
|
|
|
7
7
|
width: "1em",
|
|
8
8
|
height: "1em",
|
|
9
9
|
viewBox: "0 0 14 14",
|
|
10
|
-
|
|
10
|
+
shapeRendering: "geometricPrecision",
|
|
11
11
|
fill: "currentColor",
|
|
12
12
|
xmlns: "http://www.w3.org/2000/svg",
|
|
13
13
|
children: [
|
|
14
14
|
/*#__PURE__*/ _jsx("g", {
|
|
15
|
-
|
|
15
|
+
clipPath: "url(#clip0_518_8403)",
|
|
16
16
|
children: /*#__PURE__*/ _jsx("path", {
|
|
17
17
|
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"
|
|
18
18
|
})
|
|
@@ -33,7 +33,7 @@ const copySuccessSvg = /*#__PURE__*/ _jsx("i", {
|
|
|
33
33
|
children: /*#__PURE__*/ _jsx("svg", {
|
|
34
34
|
width: "1em",
|
|
35
35
|
height: "1em",
|
|
36
|
-
|
|
36
|
+
shapeRendering: "geometricPrecision",
|
|
37
37
|
fill: "currentColor",
|
|
38
38
|
viewBox: "0 0 12 7",
|
|
39
39
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -52,12 +52,16 @@ const FileList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
52
52
|
updateFile,
|
|
53
53
|
getFileList: ()=>recordObj.current.fileList,
|
|
54
54
|
vaildFile,
|
|
55
|
-
fileToCustomFile
|
|
55
|
+
fileToCustomFile,
|
|
56
|
+
clearFileList
|
|
56
57
|
};
|
|
57
58
|
});
|
|
58
59
|
const getCls = (clsName)=>{
|
|
59
60
|
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
60
61
|
};
|
|
62
|
+
const clearFileList = ()=>{
|
|
63
|
+
setFileList([]);
|
|
64
|
+
};
|
|
61
65
|
const vaildFile = (file, fileId)=>{
|
|
62
66
|
if (fileUpload.maxCount > 0 && recordObj.current.fileList.length > fileUpload.maxCount) {
|
|
63
67
|
errorCallback({
|
|
@@ -208,6 +208,7 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
208
208
|
let msgContent = "";
|
|
209
209
|
setSending(true);
|
|
210
210
|
setTextValue("");
|
|
211
|
+
fileListRef.current.clearFileList();
|
|
211
212
|
setReferencesSource(null);
|
|
212
213
|
let recordMsgObj = {};
|
|
213
214
|
let arg = [
|
|
@@ -217,11 +218,22 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
217
218
|
];
|
|
218
219
|
beforeSendMsg(...arg).then((beforeInfo)=>{
|
|
219
220
|
const callback = ()=>{
|
|
221
|
+
let isClose = false;
|
|
222
|
+
const closeCallback = ()=>{
|
|
223
|
+
if (isClose) return;
|
|
224
|
+
isClose = true;
|
|
225
|
+
onClose();
|
|
226
|
+
setSending(false);
|
|
227
|
+
if (recordMsgObj.id) {
|
|
228
|
+
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
229
|
+
}
|
|
230
|
+
console.log("onclose: ", recordMsgObj);
|
|
231
|
+
};
|
|
220
232
|
fetchEventSource(url, _object_spread({
|
|
221
233
|
method,
|
|
222
234
|
headers: _object_spread({
|
|
223
235
|
"Content-Type": "application/json",
|
|
224
|
-
|
|
236
|
+
Accept: "text/event-stream,application/json"
|
|
225
237
|
}, headers()),
|
|
226
238
|
body: params(...arg, beforeInfo),
|
|
227
239
|
openWhenHidden: true,
|
|
@@ -237,7 +249,7 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
237
249
|
return null;
|
|
238
250
|
},
|
|
239
251
|
onmessage: (ev)=>{
|
|
240
|
-
let data = onMessage(ev);
|
|
252
|
+
let data = onMessage(ev, closeCallback);
|
|
241
253
|
msgContent += data.content;
|
|
242
254
|
delete data.content;
|
|
243
255
|
recordMsgObj = _object_spread({
|
|
@@ -247,18 +259,14 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
247
259
|
reference: null,
|
|
248
260
|
source: null
|
|
249
261
|
}, data);
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
262
|
+
apiRef.contentApi.updateMsg(msgId, recordMsgObj);
|
|
263
|
+
msgId = data.id;
|
|
264
|
+
updateMsgRef.current = setTimeout(function() {
|
|
265
|
+
apiRef.contentApi.scrollToBottom();
|
|
253
266
|
}, 100);
|
|
254
267
|
},
|
|
255
268
|
onclose: ()=>{
|
|
256
|
-
|
|
257
|
-
setSending(false);
|
|
258
|
-
if (recordMsgObj.id) {
|
|
259
|
-
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
260
|
-
}
|
|
261
|
-
console.log("onclose: ", recordMsgObj);
|
|
269
|
+
closeCallback();
|
|
262
270
|
},
|
|
263
271
|
onerror: (err)=>{
|
|
264
272
|
onError(err);
|
|
@@ -29,11 +29,11 @@ const defaultProps = {
|
|
|
29
29
|
gradientUnits: "userSpaceOnUse",
|
|
30
30
|
children: [
|
|
31
31
|
/*#__PURE__*/ _jsx("stop", {
|
|
32
|
-
|
|
32
|
+
stopColor: "#F87AFD"
|
|
33
33
|
}),
|
|
34
34
|
/*#__PURE__*/ _jsx("stop", {
|
|
35
35
|
offset: "1",
|
|
36
|
-
|
|
36
|
+
stopColor: "#41DAF8"
|
|
37
37
|
})
|
|
38
38
|
]
|
|
39
39
|
}),
|
|
@@ -46,11 +46,11 @@ const defaultProps = {
|
|
|
46
46
|
gradientUnits: "userSpaceOnUse",
|
|
47
47
|
children: [
|
|
48
48
|
/*#__PURE__*/ _jsx("stop", {
|
|
49
|
-
|
|
49
|
+
stopColor: "#F87AFD"
|
|
50
50
|
}),
|
|
51
51
|
/*#__PURE__*/ _jsx("stop", {
|
|
52
52
|
offset: "1",
|
|
53
|
-
|
|
53
|
+
stopColor: "#41DAF8"
|
|
54
54
|
})
|
|
55
55
|
]
|
|
56
56
|
})
|
|
@@ -5,7 +5,7 @@ const referencesIcon = /*#__PURE__*/ _jsx("i", {
|
|
|
5
5
|
children: /*#__PURE__*/ _jsxs("svg", {
|
|
6
6
|
width: "1em",
|
|
7
7
|
height: "1em",
|
|
8
|
-
|
|
8
|
+
shapeRendering: "geometricPrecision",
|
|
9
9
|
fill: "currentColor",
|
|
10
10
|
viewBox: "0 0 14 14",
|
|
11
11
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9,7 +9,7 @@ const refreshSvg = /*#__PURE__*/ _jsx("svg", {
|
|
|
9
9
|
width: "1em",
|
|
10
10
|
height: "1em",
|
|
11
11
|
fill: "currentColor",
|
|
12
|
-
|
|
12
|
+
shapeRendering: "geometricPrecision",
|
|
13
13
|
"aria-hidden": "true",
|
|
14
14
|
children: /*#__PURE__*/ _jsx("path", {
|
|
15
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"
|
|
@@ -5,7 +5,7 @@ const upvoteBtnSvg = /*#__PURE__*/ _jsx("svg", {
|
|
|
5
5
|
width: "1em",
|
|
6
6
|
height: "1em",
|
|
7
7
|
viewBox: "0 0 16 16",
|
|
8
|
-
|
|
8
|
+
shapeRendering: "geometricPrecision",
|
|
9
9
|
fill: "currentColor",
|
|
10
10
|
xmlns: "http://www.w3.org/2000/svg",
|
|
11
11
|
children: /*#__PURE__*/ _jsx("path", {
|
|
@@ -15,7 +15,7 @@ const upvoteBtnSvg = /*#__PURE__*/ _jsx("svg", {
|
|
|
15
15
|
const downvoteBtnSvg = /*#__PURE__*/ _jsx("svg", {
|
|
16
16
|
width: "1em",
|
|
17
17
|
height: "1em",
|
|
18
|
-
|
|
18
|
+
shapeRendering: "geometricPrecision",
|
|
19
19
|
fill: "currentColor",
|
|
20
20
|
viewBox: "0 0 16 16",
|
|
21
21
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -115,6 +115,13 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
115
115
|
},
|
|
116
116
|
changeDataSource: (data)=>{
|
|
117
117
|
setDataSource(data);
|
|
118
|
+
},
|
|
119
|
+
scrollToBottom: function() {
|
|
120
|
+
if (!virtuosoRef.current) return;
|
|
121
|
+
virtuosoRef.current.scrollToIndex({
|
|
122
|
+
index: "LAST",
|
|
123
|
+
behavior: "auto"
|
|
124
|
+
});
|
|
118
125
|
}
|
|
119
126
|
};
|
|
120
127
|
});
|
|
@@ -131,18 +138,18 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
131
138
|
}, []);
|
|
132
139
|
useEffect(()=>{
|
|
133
140
|
if (!virtuosoRef.current) return;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
// virtuosoRef.current.scrollToIndex({
|
|
142
|
+
// index: "LAST", // 或者使用 dataSource.length - 1
|
|
143
|
+
// behavior: "auto", // 可以是 "smooth" 实现平滑滚动
|
|
144
|
+
// });
|
|
145
|
+
// clearTimeout(timerRef.current.scrollTimer);
|
|
146
|
+
// timerRef.current.scrollTimer = setTimeout(() => {
|
|
147
|
+
// virtuosoRef.current.scrollToIndex({
|
|
148
|
+
// index: "LAST", // 或者使用 dataSource.length - 1
|
|
149
|
+
// behavior: "auto", // 可以是 "smooth" 实现平滑滚动
|
|
150
|
+
// align: "end",
|
|
151
|
+
// });
|
|
152
|
+
// }, 500);
|
|
146
153
|
}, [
|
|
147
154
|
dataSource
|
|
148
155
|
]);
|
|
@@ -194,19 +201,24 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
194
201
|
const timeNode = renderTime(item);
|
|
195
202
|
let cahceKey = item.id + "-" + item.content;
|
|
196
203
|
let contentNode = null;
|
|
197
|
-
if (htmlRenderCache.has(cahceKey)) {
|
|
198
|
-
|
|
199
|
-
} else {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
// if (htmlRenderCache.has(cahceKey)) {
|
|
205
|
+
// contentNode = htmlRenderCache.get(cahceKey);
|
|
206
|
+
// } else {
|
|
207
|
+
// const html = markToHtml(item.content, item.id);
|
|
208
|
+
// contentNode = <div dangerouslySetInnerHTML={{ __html: html }}></div>;
|
|
209
|
+
// if (coverRenderText) {
|
|
210
|
+
// contentNode = coverRenderText(item, html);
|
|
211
|
+
// }
|
|
212
|
+
// htmlRenderCache.set(cahceKey, contentNode);
|
|
213
|
+
// }
|
|
214
|
+
const html = markToHtml(item.content, item.id);
|
|
215
|
+
contentNode = /*#__PURE__*/ _jsx("div", {
|
|
216
|
+
dangerouslySetInnerHTML: {
|
|
217
|
+
__html: html
|
|
208
218
|
}
|
|
209
|
-
|
|
219
|
+
});
|
|
220
|
+
if (coverRenderText) {
|
|
221
|
+
contentNode = coverRenderText(item, html);
|
|
210
222
|
}
|
|
211
223
|
// 是否显示时间
|
|
212
224
|
let itemNode = /*#__PURE__*/ _jsx("div", {
|
|
@@ -103,7 +103,7 @@ export interface sendMsgAjaxParams {
|
|
|
103
103
|
beforeInfo: any
|
|
104
104
|
) => string;
|
|
105
105
|
onOpen?: (res: Response, onOpenProps: onOpenProps) => void;
|
|
106
|
-
onMessage?: (ev: EventSourceMessage) => { id: string; content: string };
|
|
106
|
+
onMessage?: (ev: EventSourceMessage,closeCallback:()=>void) => { id: string; content: string };
|
|
107
107
|
onClose?: () => void;
|
|
108
108
|
onError?: (err: any) => void;
|
|
109
109
|
coverProps?: object;
|
|
@@ -217,6 +217,7 @@ export interface FileListRefProps {
|
|
|
217
217
|
getFileList: () => fileCustomProps[];
|
|
218
218
|
vaildFile: (file: File, fileId?: string) => boolean; // 校验文件是否合规
|
|
219
219
|
fileToCustomFile: (file: File, params: any) => fileCustomProps;
|
|
220
|
+
clearFileList: () => void;
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
// error Message
|
|
@@ -268,7 +269,8 @@ export interface VirtuosoListRefProps {
|
|
|
268
269
|
recordMsg: (item: dataItemType) => void;
|
|
269
270
|
getDataSource: () => dataItemType[];
|
|
270
271
|
upateDataSource:(id:string,obj:dataItemType)=>void;
|
|
271
|
-
changeDataSource:(list:dataItemType[])=>void
|
|
272
|
+
changeDataSource:(list:dataItemType[])=>void;
|
|
273
|
+
scrollToBottom: () => void;
|
|
272
274
|
}
|
|
273
275
|
|
|
274
276
|
export interface contentRefProps extends VirtuosoListRefProps {}
|
|
@@ -462,7 +462,13 @@ const HistoryFun = (props)=>{
|
|
|
462
462
|
return /*#__PURE__*/ _jsxs("div", {
|
|
463
463
|
className: styles.list,
|
|
464
464
|
onClick: ()=>{
|
|
465
|
-
calculationData(item.roomId, list.id, list.receiver);
|
|
465
|
+
calculationData(item.roomId, list.id, props.userData.mid == list.sender ? list.receiver : list.sender);
|
|
466
|
+
console.log('答应一下111111', {
|
|
467
|
+
roomId: item.roomId,
|
|
468
|
+
id: list.id,
|
|
469
|
+
sender: list.sender
|
|
470
|
+
});
|
|
471
|
+
// calculationData(item.roomId, list.id, list.sender);
|
|
466
472
|
},
|
|
467
473
|
children: [
|
|
468
474
|
/*#__PURE__*/ _jsxs("div", {
|
|
@@ -8,12 +8,12 @@ var copyIconSvg = /*#__PURE__*/ _jsx("i", {
|
|
|
8
8
|
width: "1em",
|
|
9
9
|
height: "1em",
|
|
10
10
|
viewBox: "0 0 14 14",
|
|
11
|
-
|
|
11
|
+
shapeRendering: "geometricPrecision",
|
|
12
12
|
fill: "currentColor",
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
14
|
children: [
|
|
15
15
|
/*#__PURE__*/ _jsx("g", {
|
|
16
|
-
|
|
16
|
+
clipPath: "url(#clip0_518_8403)",
|
|
17
17
|
children: /*#__PURE__*/ _jsx("path", {
|
|
18
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
19
|
})
|
|
@@ -34,7 +34,7 @@ var copySuccessSvg = /*#__PURE__*/ _jsx("i", {
|
|
|
34
34
|
children: /*#__PURE__*/ _jsx("svg", {
|
|
35
35
|
width: "1em",
|
|
36
36
|
height: "1em",
|
|
37
|
-
|
|
37
|
+
shapeRendering: "geometricPrecision",
|
|
38
38
|
fill: "currentColor",
|
|
39
39
|
viewBox: "0 0 12 7",
|
|
40
40
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -58,12 +58,16 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
58
58
|
return recordObj.current.fileList;
|
|
59
59
|
},
|
|
60
60
|
vaildFile: vaildFile,
|
|
61
|
-
fileToCustomFile: fileToCustomFile
|
|
61
|
+
fileToCustomFile: fileToCustomFile,
|
|
62
|
+
clearFileList: clearFileList
|
|
62
63
|
};
|
|
63
64
|
});
|
|
64
65
|
var getCls = function(clsName) {
|
|
65
66
|
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
66
67
|
};
|
|
68
|
+
var clearFileList = function() {
|
|
69
|
+
setFileList([]);
|
|
70
|
+
};
|
|
67
71
|
var vaildFile = function(file, fileId) {
|
|
68
72
|
if (fileUpload.maxCount > 0 && recordObj.current.fileList.length > fileUpload.maxCount) {
|
|
69
73
|
errorCallback({
|
|
@@ -218,6 +218,7 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
218
218
|
var msgContent = "";
|
|
219
219
|
setSending(true);
|
|
220
220
|
setTextValue("");
|
|
221
|
+
fileListRef.current.clearFileList();
|
|
221
222
|
setReferencesSource(null);
|
|
222
223
|
var recordMsgObj = {};
|
|
223
224
|
var arg = [
|
|
@@ -227,11 +228,22 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
227
228
|
];
|
|
228
229
|
beforeSendMsg.apply(void 0, _to_consumable_array(arg)).then(function(beforeInfo) {
|
|
229
230
|
var callback = function() {
|
|
231
|
+
var isClose = false;
|
|
232
|
+
var closeCallback = function() {
|
|
233
|
+
if (isClose) return;
|
|
234
|
+
isClose = true;
|
|
235
|
+
onClose();
|
|
236
|
+
setSending(false);
|
|
237
|
+
if (recordMsgObj.id) {
|
|
238
|
+
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
239
|
+
}
|
|
240
|
+
console.log("onclose: ", recordMsgObj);
|
|
241
|
+
};
|
|
230
242
|
fetchEventSource(url, _object_spread({
|
|
231
243
|
method: method,
|
|
232
244
|
headers: _object_spread({
|
|
233
245
|
"Content-Type": "application/json",
|
|
234
|
-
|
|
246
|
+
Accept: "text/event-stream,application/json"
|
|
235
247
|
}, headers()),
|
|
236
248
|
body: params.apply(void 0, _to_consumable_array(arg).concat([
|
|
237
249
|
beforeInfo
|
|
@@ -249,7 +261,7 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
249
261
|
return null;
|
|
250
262
|
},
|
|
251
263
|
onmessage: function(ev) {
|
|
252
|
-
var data = onMessage(ev);
|
|
264
|
+
var data = onMessage(ev, closeCallback);
|
|
253
265
|
msgContent += data.content;
|
|
254
266
|
delete data.content;
|
|
255
267
|
recordMsgObj = _object_spread({
|
|
@@ -259,18 +271,14 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
259
271
|
reference: null,
|
|
260
272
|
source: null
|
|
261
273
|
}, data);
|
|
274
|
+
apiRef.contentApi.updateMsg(msgId, recordMsgObj);
|
|
275
|
+
msgId = data.id;
|
|
262
276
|
updateMsgRef.current = setTimeout(function() {
|
|
263
|
-
apiRef.contentApi.
|
|
264
|
-
msgId = data.id;
|
|
277
|
+
apiRef.contentApi.scrollToBottom();
|
|
265
278
|
}, 100);
|
|
266
279
|
},
|
|
267
280
|
onclose: function() {
|
|
268
|
-
|
|
269
|
-
setSending(false);
|
|
270
|
-
if (recordMsgObj.id) {
|
|
271
|
-
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
272
|
-
}
|
|
273
|
-
console.log("onclose: ", recordMsgObj);
|
|
281
|
+
closeCallback();
|
|
274
282
|
},
|
|
275
283
|
onerror: function(err) {
|
|
276
284
|
onError(err);
|
|
@@ -29,11 +29,11 @@ var defaultProps = {
|
|
|
29
29
|
gradientUnits: "userSpaceOnUse",
|
|
30
30
|
children: [
|
|
31
31
|
/*#__PURE__*/ _jsx("stop", {
|
|
32
|
-
|
|
32
|
+
stopColor: "#F87AFD"
|
|
33
33
|
}),
|
|
34
34
|
/*#__PURE__*/ _jsx("stop", {
|
|
35
35
|
offset: "1",
|
|
36
|
-
|
|
36
|
+
stopColor: "#41DAF8"
|
|
37
37
|
})
|
|
38
38
|
]
|
|
39
39
|
}),
|
|
@@ -46,11 +46,11 @@ var defaultProps = {
|
|
|
46
46
|
gradientUnits: "userSpaceOnUse",
|
|
47
47
|
children: [
|
|
48
48
|
/*#__PURE__*/ _jsx("stop", {
|
|
49
|
-
|
|
49
|
+
stopColor: "#F87AFD"
|
|
50
50
|
}),
|
|
51
51
|
/*#__PURE__*/ _jsx("stop", {
|
|
52
52
|
offset: "1",
|
|
53
|
-
|
|
53
|
+
stopColor: "#41DAF8"
|
|
54
54
|
})
|
|
55
55
|
]
|
|
56
56
|
})
|
|
@@ -5,7 +5,7 @@ var referencesIcon = /*#__PURE__*/ _jsx("i", {
|
|
|
5
5
|
children: /*#__PURE__*/ _jsxs("svg", {
|
|
6
6
|
width: "1em",
|
|
7
7
|
height: "1em",
|
|
8
|
-
|
|
8
|
+
shapeRendering: "geometricPrecision",
|
|
9
9
|
fill: "currentColor",
|
|
10
10
|
viewBox: "0 0 14 14",
|
|
11
11
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -9,7 +9,7 @@ var refreshSvg = /*#__PURE__*/ _jsx("svg", {
|
|
|
9
9
|
width: "1em",
|
|
10
10
|
height: "1em",
|
|
11
11
|
fill: "currentColor",
|
|
12
|
-
|
|
12
|
+
shapeRendering: "geometricPrecision",
|
|
13
13
|
"aria-hidden": "true",
|
|
14
14
|
children: /*#__PURE__*/ _jsx("path", {
|
|
15
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"
|
|
@@ -5,7 +5,7 @@ var upvoteBtnSvg = /*#__PURE__*/ _jsx("svg", {
|
|
|
5
5
|
width: "1em",
|
|
6
6
|
height: "1em",
|
|
7
7
|
viewBox: "0 0 16 16",
|
|
8
|
-
|
|
8
|
+
shapeRendering: "geometricPrecision",
|
|
9
9
|
fill: "currentColor",
|
|
10
10
|
xmlns: "http://www.w3.org/2000/svg",
|
|
11
11
|
children: /*#__PURE__*/ _jsx("path", {
|
|
@@ -15,7 +15,7 @@ var upvoteBtnSvg = /*#__PURE__*/ _jsx("svg", {
|
|
|
15
15
|
var downvoteBtnSvg = /*#__PURE__*/ _jsx("svg", {
|
|
16
16
|
width: "1em",
|
|
17
17
|
height: "1em",
|
|
18
|
-
|
|
18
|
+
shapeRendering: "geometricPrecision",
|
|
19
19
|
fill: "currentColor",
|
|
20
20
|
viewBox: "0 0 16 16",
|
|
21
21
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -120,6 +120,13 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
120
120
|
},
|
|
121
121
|
changeDataSource: function(data) {
|
|
122
122
|
setDataSource(data);
|
|
123
|
+
},
|
|
124
|
+
scrollToBottom: function scrollToBottom() {
|
|
125
|
+
if (!virtuosoRef.current) return;
|
|
126
|
+
virtuosoRef.current.scrollToIndex({
|
|
127
|
+
index: "LAST",
|
|
128
|
+
behavior: "auto"
|
|
129
|
+
});
|
|
123
130
|
}
|
|
124
131
|
};
|
|
125
132
|
});
|
|
@@ -136,18 +143,18 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
136
143
|
}, []);
|
|
137
144
|
useEffect(function() {
|
|
138
145
|
if (!virtuosoRef.current) return;
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
// virtuosoRef.current.scrollToIndex({
|
|
147
|
+
// index: "LAST", // 或者使用 dataSource.length - 1
|
|
148
|
+
// behavior: "auto", // 可以是 "smooth" 实现平滑滚动
|
|
149
|
+
// });
|
|
150
|
+
// clearTimeout(timerRef.current.scrollTimer);
|
|
151
|
+
// timerRef.current.scrollTimer = setTimeout(() => {
|
|
152
|
+
// virtuosoRef.current.scrollToIndex({
|
|
153
|
+
// index: "LAST", // 或者使用 dataSource.length - 1
|
|
154
|
+
// behavior: "auto", // 可以是 "smooth" 实现平滑滚动
|
|
155
|
+
// align: "end",
|
|
156
|
+
// });
|
|
157
|
+
// }, 500);
|
|
151
158
|
}, [
|
|
152
159
|
dataSource
|
|
153
160
|
]);
|
|
@@ -196,19 +203,24 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
196
203
|
var timeNode = renderTime(item);
|
|
197
204
|
var cahceKey = item.id + "-" + item.content;
|
|
198
205
|
var contentNode = null;
|
|
199
|
-
if (htmlRenderCache.has(cahceKey)) {
|
|
200
|
-
|
|
201
|
-
} else {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
206
|
+
// if (htmlRenderCache.has(cahceKey)) {
|
|
207
|
+
// contentNode = htmlRenderCache.get(cahceKey);
|
|
208
|
+
// } else {
|
|
209
|
+
// const html = markToHtml(item.content, item.id);
|
|
210
|
+
// contentNode = <div dangerouslySetInnerHTML={{ __html: html }}></div>;
|
|
211
|
+
// if (coverRenderText) {
|
|
212
|
+
// contentNode = coverRenderText(item, html);
|
|
213
|
+
// }
|
|
214
|
+
// htmlRenderCache.set(cahceKey, contentNode);
|
|
215
|
+
// }
|
|
216
|
+
var html = markToHtml(item.content, item.id);
|
|
217
|
+
contentNode = /*#__PURE__*/ _jsx("div", {
|
|
218
|
+
dangerouslySetInnerHTML: {
|
|
219
|
+
__html: html
|
|
210
220
|
}
|
|
211
|
-
|
|
221
|
+
});
|
|
222
|
+
if (coverRenderText) {
|
|
223
|
+
contentNode = coverRenderText(item, html);
|
|
212
224
|
}
|
|
213
225
|
// 是否显示时间
|
|
214
226
|
var itemNode = /*#__PURE__*/ _jsx("div", {
|
|
@@ -103,7 +103,7 @@ export interface sendMsgAjaxParams {
|
|
|
103
103
|
beforeInfo: any
|
|
104
104
|
) => string;
|
|
105
105
|
onOpen?: (res: Response, onOpenProps: onOpenProps) => void;
|
|
106
|
-
onMessage?: (ev: EventSourceMessage) => { id: string; content: string };
|
|
106
|
+
onMessage?: (ev: EventSourceMessage,closeCallback:()=>void) => { id: string; content: string };
|
|
107
107
|
onClose?: () => void;
|
|
108
108
|
onError?: (err: any) => void;
|
|
109
109
|
coverProps?: object;
|
|
@@ -217,6 +217,7 @@ export interface FileListRefProps {
|
|
|
217
217
|
getFileList: () => fileCustomProps[];
|
|
218
218
|
vaildFile: (file: File, fileId?: string) => boolean; // 校验文件是否合规
|
|
219
219
|
fileToCustomFile: (file: File, params: any) => fileCustomProps;
|
|
220
|
+
clearFileList: () => void;
|
|
220
221
|
}
|
|
221
222
|
|
|
222
223
|
// error Message
|
|
@@ -268,7 +269,8 @@ export interface VirtuosoListRefProps {
|
|
|
268
269
|
recordMsg: (item: dataItemType) => void;
|
|
269
270
|
getDataSource: () => dataItemType[];
|
|
270
271
|
upateDataSource:(id:string,obj:dataItemType)=>void;
|
|
271
|
-
changeDataSource:(list:dataItemType[])=>void
|
|
272
|
+
changeDataSource:(list:dataItemType[])=>void;
|
|
273
|
+
scrollToBottom: () => void;
|
|
272
274
|
}
|
|
273
275
|
|
|
274
276
|
export interface contentRefProps extends VirtuosoListRefProps {}
|
|
@@ -467,7 +467,13 @@ var HistoryFun = function(props) {
|
|
|
467
467
|
return /*#__PURE__*/ _jsxs("div", {
|
|
468
468
|
className: styles.list,
|
|
469
469
|
onClick: function() {
|
|
470
|
-
calculationData(item.roomId, list.id, list.receiver);
|
|
470
|
+
calculationData(item.roomId, list.id, props.userData.mid == list.sender ? list.receiver : list.sender);
|
|
471
|
+
console.log("答应一下111111", {
|
|
472
|
+
roomId: item.roomId,
|
|
473
|
+
id: list.id,
|
|
474
|
+
sender: list.sender
|
|
475
|
+
});
|
|
476
|
+
// calculationData(item.roomId, list.id, list.sender);
|
|
471
477
|
},
|
|
472
478
|
children: [
|
|
473
479
|
/*#__PURE__*/ _jsxs("div", {
|