bhd-components 0.10.18 → 0.10.20
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.js +38 -47
- 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 +0 -1
- package/es2017/AIMessageList/components/fileList/index.js +34 -29
- package/es2017/AIMessageList/components/footer/index.js +0 -5
- package/es2017/AIMessageList/components/referencesIcon/index.js +2 -3
- package/es2017/AIMessageList/components/renderReferrnce/index.js +0 -4
- package/es2017/AIMessageList/components/virtuosoList/index.js +0 -4
- package/esm/AIMessageList/components/copyIcon/index.js +0 -1
- package/esm/AIMessageList/components/fileList/index.js +36 -31
- package/esm/AIMessageList/components/footer/index.js +0 -5
- package/esm/AIMessageList/components/referencesIcon/index.js +2 -3
- package/esm/AIMessageList/components/renderReferrnce/index.js +0 -4
- package/esm/AIMessageList/components/virtuosoList/index.js +0 -4
- package/package.json +1 -1
|
@@ -6,17 +6,16 @@ import styles from "./index.module.less";
|
|
|
6
6
|
import { fileIconRender, statusRender } from "./fileIcon";
|
|
7
7
|
import { CloseCircleFilled, DoubleRightOutlined } from "../../../icons";
|
|
8
8
|
import { guidGenerator } from "../../../utils/number";
|
|
9
|
-
import { Upload } from "antd";
|
|
10
9
|
// 通过文件名 获取文件后缀
|
|
11
10
|
const getSuffix = (fileName)=>{
|
|
12
11
|
return fileName.split(".").pop().toLowerCase();
|
|
13
12
|
};
|
|
14
13
|
const FileList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
15
14
|
const { prefix, fileUpload, errorCallback, changeFileCanSending, onChange } = props;
|
|
16
|
-
console.log("fileUpload", fileUpload);
|
|
17
15
|
const [fileList, setFileList] = useState([]);
|
|
18
16
|
const [page, setPage] = useState(1);
|
|
19
17
|
const [pageSize, setPageSize] = useState(5);
|
|
18
|
+
const recordListLength = useRef(0);
|
|
20
19
|
const recordObj = useRef({
|
|
21
20
|
page: page,
|
|
22
21
|
pageSize: pageSize,
|
|
@@ -65,10 +64,11 @@ const FileList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
65
64
|
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
66
65
|
};
|
|
67
66
|
const clearFileList = ()=>{
|
|
67
|
+
recordListLength.current = 0;
|
|
68
68
|
setFileList([]);
|
|
69
69
|
};
|
|
70
70
|
const vaildFile = (file, fileId)=>{
|
|
71
|
-
if (fileUpload.maxCount > 0 &&
|
|
71
|
+
if (fileUpload.maxCount > 0 && recordListLength.current + 1 > fileUpload.maxCount) {
|
|
72
72
|
errorCallback({
|
|
73
73
|
type: "fileCountOver",
|
|
74
74
|
message: "上传失败,文件数量超过限制"
|
|
@@ -117,8 +117,8 @@ const FileList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
117
117
|
return true;
|
|
118
118
|
};
|
|
119
119
|
const addFile = (file, fileId)=>{
|
|
120
|
-
console.log("addFileaddFile", file, fileUpload);
|
|
121
120
|
if (vaildFile(file, fileId)) {
|
|
121
|
+
recordListLength.current += 1;
|
|
122
122
|
// 等待上传
|
|
123
123
|
// 判断是否存在等待上传的文件
|
|
124
124
|
setFileList((fileList)=>{
|
|
@@ -204,13 +204,14 @@ const FileList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
204
204
|
// 删除文件
|
|
205
205
|
const deleteFile = (fileId)=>{
|
|
206
206
|
let fileObj = null;
|
|
207
|
+
recordListLength.current -= 0;
|
|
207
208
|
setFileList((fileList)=>{
|
|
208
209
|
return fileList.filter((item)=>{
|
|
209
210
|
if (item.fileId === fileId) {
|
|
210
211
|
fileObj = item;
|
|
211
|
-
return
|
|
212
|
+
return false;
|
|
212
213
|
}
|
|
213
|
-
return
|
|
214
|
+
return true;
|
|
214
215
|
});
|
|
215
216
|
});
|
|
216
217
|
// 删除文件时如果删除的是最后一条 则page-1
|
|
@@ -250,6 +251,22 @@ const FileList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
250
251
|
setPage(page);
|
|
251
252
|
setPageSize(pageSize);
|
|
252
253
|
};
|
|
254
|
+
const retryUploadFile = (fileItem)=>{
|
|
255
|
+
setFileList((fileList)=>{
|
|
256
|
+
let uploadingList = fileList.filter((item)=>item.status === "uploading");
|
|
257
|
+
return fileList.map((item)=>{
|
|
258
|
+
if (fileItem.fileId === item.fileId) {
|
|
259
|
+
if (uploadingList.length >= fileUpload.mapUploadCount) {
|
|
260
|
+
item.status = "waiting";
|
|
261
|
+
} else {
|
|
262
|
+
item.status = "uploading";
|
|
263
|
+
uploadFile(item.source);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return item;
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
};
|
|
253
270
|
const list = fileList.slice((page - 1) * pageSize, page * pageSize);
|
|
254
271
|
if (list.length === 0) return null;
|
|
255
272
|
return /*#__PURE__*/ _jsxs("div", {
|
|
@@ -258,16 +275,21 @@ const FileList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
258
275
|
page !== 1 && /*#__PURE__*/ _jsx("div", {
|
|
259
276
|
className: `${getCls("footer-fileList-pre")}`,
|
|
260
277
|
onClick: ()=>changePage(page - 1),
|
|
261
|
-
children: /*#__PURE__*/ _jsx(DoubleRightOutlined, {
|
|
262
|
-
onPointerEnterCapture: undefined,
|
|
263
|
-
onPointerLeaveCapture: undefined
|
|
264
|
-
})
|
|
278
|
+
children: /*#__PURE__*/ _jsx(DoubleRightOutlined, {})
|
|
265
279
|
}),
|
|
266
280
|
/*#__PURE__*/ _jsx("div", {
|
|
267
281
|
className: `${getCls("footer-fileList-list")}`,
|
|
268
282
|
children: list.map((item)=>{
|
|
269
283
|
return /*#__PURE__*/ _jsxs("div", {
|
|
270
284
|
className: `${getCls("footer-fileList-listItem")}`,
|
|
285
|
+
style: {
|
|
286
|
+
cursor: item.status === "uploadError" ? "pointer" : "default"
|
|
287
|
+
},
|
|
288
|
+
onClick: ()=>{
|
|
289
|
+
if (item.status === "uploadError") {
|
|
290
|
+
retryUploadFile(item);
|
|
291
|
+
}
|
|
292
|
+
},
|
|
271
293
|
children: [
|
|
272
294
|
/*#__PURE__*/ _jsx("div", {
|
|
273
295
|
className: `${getCls("footer-fileList-listItem-icon")}`,
|
|
@@ -278,27 +300,13 @@ const FileList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
278
300
|
title: item.name,
|
|
279
301
|
children: item.name
|
|
280
302
|
}),
|
|
281
|
-
|
|
282
|
-
fileList: [],
|
|
283
|
-
accept: fileUpload.accept,
|
|
284
|
-
customRequest: (options)=>addFile(options.file, item.fileId),
|
|
285
|
-
multiple: false,
|
|
286
|
-
children: /*#__PURE__*/ _jsx("div", {
|
|
287
|
-
className: `${getCls("footer-fileList-listItem-status")}`,
|
|
288
|
-
style: {
|
|
289
|
-
cursor: "pointer"
|
|
290
|
-
},
|
|
291
|
-
children: statusRender(item.status, fileUpload.statusText)
|
|
292
|
-
})
|
|
293
|
-
}) : /*#__PURE__*/ _jsx("div", {
|
|
303
|
+
/*#__PURE__*/ _jsx("div", {
|
|
294
304
|
className: `${getCls("footer-fileList-listItem-status")}`,
|
|
295
305
|
children: statusRender(item.status, fileUpload.statusText)
|
|
296
306
|
}),
|
|
297
307
|
/*#__PURE__*/ _jsx("div", {
|
|
298
308
|
className: `${getCls("footer-fileList-listItem-delete")}`,
|
|
299
309
|
children: /*#__PURE__*/ _jsx(CloseCircleFilled, {
|
|
300
|
-
onPointerEnterCapture: undefined,
|
|
301
|
-
onPointerLeaveCapture: undefined,
|
|
302
310
|
onClick: ()=>deleteFile(item.fileId)
|
|
303
311
|
})
|
|
304
312
|
})
|
|
@@ -309,10 +317,7 @@ const FileList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
309
317
|
page * pageSize < fileList.length && /*#__PURE__*/ _jsx("div", {
|
|
310
318
|
className: `${getCls("footer-fileList-next")}`,
|
|
311
319
|
onClick: ()=>changePage(page + 1),
|
|
312
|
-
children: /*#__PURE__*/ _jsx(DoubleRightOutlined, {
|
|
313
|
-
onPointerEnterCapture: undefined,
|
|
314
|
-
onPointerLeaveCapture: undefined
|
|
315
|
-
})
|
|
320
|
+
children: /*#__PURE__*/ _jsx(DoubleRightOutlined, {})
|
|
316
321
|
})
|
|
317
322
|
]
|
|
318
323
|
});
|
|
@@ -151,7 +151,6 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
151
151
|
fileUpload: fileUpload,
|
|
152
152
|
customRequest: (options)=>{
|
|
153
153
|
var _fileListRef_current;
|
|
154
|
-
console.log("customRequestcustomRequest", options);
|
|
155
154
|
(_fileListRef_current = fileListRef.current) === null || _fileListRef_current === void 0 ? void 0 : _fileListRef_current.addFile(options.file);
|
|
156
155
|
}
|
|
157
156
|
});
|
|
@@ -200,7 +199,6 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
200
199
|
};
|
|
201
200
|
// 发现消息
|
|
202
201
|
const sendMsg = (value)=>{
|
|
203
|
-
console.log("发送消息:", value);
|
|
204
202
|
if (value.trim().length === 0) {
|
|
205
203
|
throw new Error("消息不能为空");
|
|
206
204
|
return;
|
|
@@ -238,7 +236,6 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
238
236
|
const { url, method = "POST", headers = ()=>({}), params = ()=>"", onOpen = ()=>{}, onMessage = (ev)=>ev, onClose = ()=>{}, onError = ()=>{}, coverProps = {}, beforeSendMsg = ()=>Promise.resolve() } = sendMsgAjaxParams;
|
|
239
237
|
ctrl.current = new AbortController();
|
|
240
238
|
// apiRef
|
|
241
|
-
console.log("apiRef", apiRef);
|
|
242
239
|
let msgId = "inputing";
|
|
243
240
|
let createTime = new Date().getTime();
|
|
244
241
|
if (recordObj) {
|
|
@@ -299,7 +296,6 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
299
296
|
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
300
297
|
}
|
|
301
298
|
apiRef.contentApi.setSendingId("");
|
|
302
|
-
console.log("onclose: ", recordMsgObj);
|
|
303
299
|
};
|
|
304
300
|
fetchEventSource(url, _object_spread({
|
|
305
301
|
method,
|
|
@@ -351,7 +347,6 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
351
347
|
if (recordMsgObj.id) {
|
|
352
348
|
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
353
349
|
}
|
|
354
|
-
console.log("onerror: ", err);
|
|
355
350
|
}
|
|
356
351
|
}, coverProps));
|
|
357
352
|
};
|
|
@@ -29,9 +29,7 @@ const ReferencesIcon = (props)=>{
|
|
|
29
29
|
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
30
30
|
};
|
|
31
31
|
const clickFn = ()=>{
|
|
32
|
-
console.log("apiRef", apiRef);
|
|
33
32
|
if (apiRef && apiRef.footerApi) {
|
|
34
|
-
console.log("itemitem", item);
|
|
35
33
|
if (item.type === "file") {
|
|
36
34
|
apiRef.footerApi.setReferences({
|
|
37
35
|
type: "file",
|
|
@@ -41,7 +39,8 @@ const ReferencesIcon = (props)=>{
|
|
|
41
39
|
fileId: item.id,
|
|
42
40
|
url: "",
|
|
43
41
|
status: "success",
|
|
44
|
-
source: null
|
|
42
|
+
source: null,
|
|
43
|
+
size: 0
|
|
45
44
|
},
|
|
46
45
|
source: item
|
|
47
46
|
});
|
|
@@ -23,8 +23,6 @@ const References = (props)=>{
|
|
|
23
23
|
/*#__PURE__*/ _jsx("div", {
|
|
24
24
|
className: `${getCls("footerReferences_right")}`,
|
|
25
25
|
children: /*#__PURE__*/ _jsx(CloseCircleFilled, {
|
|
26
|
-
onPointerEnterCapture: undefined,
|
|
27
|
-
onPointerLeaveCapture: undefined,
|
|
28
26
|
onClick: ()=>deleteReferences()
|
|
29
27
|
})
|
|
30
28
|
})
|
|
@@ -55,8 +53,6 @@ const References = (props)=>{
|
|
|
55
53
|
/*#__PURE__*/ _jsx("div", {
|
|
56
54
|
className: `${getCls("footerReferences_right")}`,
|
|
57
55
|
children: /*#__PURE__*/ _jsx(CloseCircleFilled, {
|
|
58
|
-
onPointerEnterCapture: undefined,
|
|
59
|
-
onPointerLeaveCapture: undefined,
|
|
60
56
|
onClick: ()=>deleteReferences()
|
|
61
57
|
})
|
|
62
58
|
})
|
|
@@ -180,7 +180,6 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
180
180
|
}
|
|
181
181
|
let list = [];
|
|
182
182
|
if (msg.location === "right" && msg.fileList && msg.fileList.length > 0) {
|
|
183
|
-
console.log("fileList", msg, msg.fileList);
|
|
184
183
|
msg.fileList.map((item)=>{
|
|
185
184
|
list.push({
|
|
186
185
|
type: "file",
|
|
@@ -218,7 +217,6 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
218
217
|
setLoading(true);
|
|
219
218
|
return getList(page, pageSize).then((listObj)=>{
|
|
220
219
|
setLoading(false);
|
|
221
|
-
console.log("listObjlistObj", listObj);
|
|
222
220
|
setDataSource((data)=>{
|
|
223
221
|
return [
|
|
224
222
|
...data,
|
|
@@ -357,7 +355,6 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
357
355
|
const topDom = dom.querySelector("." + styles["msgItem-action-popover-floatTop"]);
|
|
358
356
|
const bottomDom = dom.querySelector("." + styles["msgItem-action-popover-floatBottom"]);
|
|
359
357
|
if (!topDom || !bottomDom) return;
|
|
360
|
-
console.log("itemitem", dom, container);
|
|
361
358
|
let con_obj = container.getBoundingClientRect(); // 外层盒子
|
|
362
359
|
let dom_obj = dom.getBoundingClientRect(); // 鼠标滑过元素
|
|
363
360
|
let y = dom_obj.y - con_obj.y;
|
|
@@ -373,7 +370,6 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
373
370
|
topDom.style.cssText = "display:flex";
|
|
374
371
|
}
|
|
375
372
|
} else {
|
|
376
|
-
console.log("yyyy", y, dom_obj, con_obj, y + dom_obj.height < con_obj.height);
|
|
377
373
|
// 元素top不在可视区域内
|
|
378
374
|
if (y + dom_obj.height < con_obj.height) {
|
|
379
375
|
// 底部在可视区域内
|
|
@@ -8,17 +8,16 @@ import styles from "./index.module.less";
|
|
|
8
8
|
import { fileIconRender, statusRender } from "./fileIcon";
|
|
9
9
|
import { CloseCircleFilled, DoubleRightOutlined } from "../../../icons";
|
|
10
10
|
import { guidGenerator } from "../../../utils/number";
|
|
11
|
-
import { Upload } from "antd";
|
|
12
11
|
// 通过文件名 获取文件后缀
|
|
13
12
|
var getSuffix = function(fileName) {
|
|
14
13
|
return fileName.split(".").pop().toLowerCase();
|
|
15
14
|
};
|
|
16
15
|
var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
17
16
|
var prefix = props.prefix, fileUpload = props.fileUpload, errorCallback = props.errorCallback, changeFileCanSending = props.changeFileCanSending, onChange = props.onChange;
|
|
18
|
-
console.log("fileUpload", fileUpload);
|
|
19
17
|
var _useState = _sliced_to_array(useState([]), 2), fileList = _useState[0], setFileList = _useState[1];
|
|
20
18
|
var _useState1 = _sliced_to_array(useState(1), 2), page = _useState1[0], setPage = _useState1[1];
|
|
21
19
|
var _useState2 = _sliced_to_array(useState(5), 2), pageSize = _useState2[0], setPageSize = _useState2[1];
|
|
20
|
+
var recordListLength = useRef(0);
|
|
22
21
|
var recordObj = useRef({
|
|
23
22
|
page: page,
|
|
24
23
|
pageSize: pageSize,
|
|
@@ -71,10 +70,11 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
71
70
|
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
72
71
|
};
|
|
73
72
|
var clearFileList = function() {
|
|
73
|
+
recordListLength.current = 0;
|
|
74
74
|
setFileList([]);
|
|
75
75
|
};
|
|
76
76
|
var vaildFile = function(file, fileId) {
|
|
77
|
-
if (fileUpload.maxCount > 0 &&
|
|
77
|
+
if (fileUpload.maxCount > 0 && recordListLength.current + 1 > fileUpload.maxCount) {
|
|
78
78
|
errorCallback({
|
|
79
79
|
type: "fileCountOver",
|
|
80
80
|
message: "上传失败,文件数量超过限制"
|
|
@@ -125,8 +125,8 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
125
125
|
return true;
|
|
126
126
|
};
|
|
127
127
|
var addFile = function(file, fileId) {
|
|
128
|
-
console.log("addFileaddFile", file, fileUpload);
|
|
129
128
|
if (vaildFile(file, fileId)) {
|
|
129
|
+
recordListLength.current += 1;
|
|
130
130
|
// 等待上传
|
|
131
131
|
// 判断是否存在等待上传的文件
|
|
132
132
|
setFileList(function(fileList) {
|
|
@@ -214,13 +214,14 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
214
214
|
// 删除文件
|
|
215
215
|
var deleteFile = function(fileId) {
|
|
216
216
|
var fileObj = null;
|
|
217
|
+
recordListLength.current -= 0;
|
|
217
218
|
setFileList(function(fileList) {
|
|
218
219
|
return fileList.filter(function(item) {
|
|
219
220
|
if (item.fileId === fileId) {
|
|
220
221
|
fileObj = item;
|
|
221
|
-
return
|
|
222
|
+
return false;
|
|
222
223
|
}
|
|
223
|
-
return
|
|
224
|
+
return true;
|
|
224
225
|
});
|
|
225
226
|
});
|
|
226
227
|
// 删除文件时如果删除的是最后一条 则page-1
|
|
@@ -264,6 +265,24 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
264
265
|
setPage(page);
|
|
265
266
|
setPageSize(pageSize);
|
|
266
267
|
};
|
|
268
|
+
var retryUploadFile = function(fileItem) {
|
|
269
|
+
setFileList(function(fileList) {
|
|
270
|
+
var uploadingList = fileList.filter(function(item) {
|
|
271
|
+
return item.status === "uploading";
|
|
272
|
+
});
|
|
273
|
+
return fileList.map(function(item) {
|
|
274
|
+
if (fileItem.fileId === item.fileId) {
|
|
275
|
+
if (uploadingList.length >= fileUpload.mapUploadCount) {
|
|
276
|
+
item.status = "waiting";
|
|
277
|
+
} else {
|
|
278
|
+
item.status = "uploading";
|
|
279
|
+
uploadFile(item.source);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return item;
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
};
|
|
267
286
|
var list = fileList.slice((page - 1) * pageSize, page * pageSize);
|
|
268
287
|
if (list.length === 0) return null;
|
|
269
288
|
return /*#__PURE__*/ _jsxs("div", {
|
|
@@ -274,16 +293,21 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
274
293
|
onClick: function() {
|
|
275
294
|
return changePage(page - 1);
|
|
276
295
|
},
|
|
277
|
-
children: /*#__PURE__*/ _jsx(DoubleRightOutlined, {
|
|
278
|
-
onPointerEnterCapture: undefined,
|
|
279
|
-
onPointerLeaveCapture: undefined
|
|
280
|
-
})
|
|
296
|
+
children: /*#__PURE__*/ _jsx(DoubleRightOutlined, {})
|
|
281
297
|
}),
|
|
282
298
|
/*#__PURE__*/ _jsx("div", {
|
|
283
299
|
className: "".concat(getCls("footer-fileList-list")),
|
|
284
300
|
children: list.map(function(item) {
|
|
285
301
|
return /*#__PURE__*/ _jsxs("div", {
|
|
286
302
|
className: "".concat(getCls("footer-fileList-listItem")),
|
|
303
|
+
style: {
|
|
304
|
+
cursor: item.status === "uploadError" ? "pointer" : "default"
|
|
305
|
+
},
|
|
306
|
+
onClick: function() {
|
|
307
|
+
if (item.status === "uploadError") {
|
|
308
|
+
retryUploadFile(item);
|
|
309
|
+
}
|
|
310
|
+
},
|
|
287
311
|
children: [
|
|
288
312
|
/*#__PURE__*/ _jsx("div", {
|
|
289
313
|
className: "".concat(getCls("footer-fileList-listItem-icon")),
|
|
@@ -294,29 +318,13 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
294
318
|
title: item.name,
|
|
295
319
|
children: item.name
|
|
296
320
|
}),
|
|
297
|
-
|
|
298
|
-
fileList: [],
|
|
299
|
-
accept: fileUpload.accept,
|
|
300
|
-
customRequest: function(options) {
|
|
301
|
-
return addFile(options.file, item.fileId);
|
|
302
|
-
},
|
|
303
|
-
multiple: false,
|
|
304
|
-
children: /*#__PURE__*/ _jsx("div", {
|
|
305
|
-
className: "".concat(getCls("footer-fileList-listItem-status")),
|
|
306
|
-
style: {
|
|
307
|
-
cursor: "pointer"
|
|
308
|
-
},
|
|
309
|
-
children: statusRender(item.status, fileUpload.statusText)
|
|
310
|
-
})
|
|
311
|
-
}) : /*#__PURE__*/ _jsx("div", {
|
|
321
|
+
/*#__PURE__*/ _jsx("div", {
|
|
312
322
|
className: "".concat(getCls("footer-fileList-listItem-status")),
|
|
313
323
|
children: statusRender(item.status, fileUpload.statusText)
|
|
314
324
|
}),
|
|
315
325
|
/*#__PURE__*/ _jsx("div", {
|
|
316
326
|
className: "".concat(getCls("footer-fileList-listItem-delete")),
|
|
317
327
|
children: /*#__PURE__*/ _jsx(CloseCircleFilled, {
|
|
318
|
-
onPointerEnterCapture: undefined,
|
|
319
|
-
onPointerLeaveCapture: undefined,
|
|
320
328
|
onClick: function() {
|
|
321
329
|
return deleteFile(item.fileId);
|
|
322
330
|
}
|
|
@@ -331,10 +339,7 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
331
339
|
onClick: function() {
|
|
332
340
|
return changePage(page + 1);
|
|
333
341
|
},
|
|
334
|
-
children: /*#__PURE__*/ _jsx(DoubleRightOutlined, {
|
|
335
|
-
onPointerEnterCapture: undefined,
|
|
336
|
-
onPointerLeaveCapture: undefined
|
|
337
|
-
})
|
|
342
|
+
children: /*#__PURE__*/ _jsx(DoubleRightOutlined, {})
|
|
338
343
|
})
|
|
339
344
|
]
|
|
340
345
|
});
|
|
@@ -155,7 +155,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
155
155
|
fileUpload: fileUpload,
|
|
156
156
|
customRequest: function(options) {
|
|
157
157
|
var _fileListRef_current;
|
|
158
|
-
console.log("customRequestcustomRequest", options);
|
|
159
158
|
(_fileListRef_current = fileListRef.current) === null || _fileListRef_current === void 0 ? void 0 : _fileListRef_current.addFile(options.file);
|
|
160
159
|
}
|
|
161
160
|
});
|
|
@@ -204,7 +203,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
204
203
|
};
|
|
205
204
|
// 发现消息
|
|
206
205
|
var sendMsg = function(value) {
|
|
207
|
-
console.log("发送消息:", value);
|
|
208
206
|
if (value.trim().length === 0) {
|
|
209
207
|
throw new Error("消息不能为空");
|
|
210
208
|
return;
|
|
@@ -250,7 +248,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
250
248
|
} : _sendMsgAjaxParams_beforeSendMsg;
|
|
251
249
|
ctrl.current = new AbortController();
|
|
252
250
|
// apiRef
|
|
253
|
-
console.log("apiRef", apiRef);
|
|
254
251
|
var msgId = "inputing";
|
|
255
252
|
var createTime = new Date().getTime();
|
|
256
253
|
if (recordObj) {
|
|
@@ -313,7 +310,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
313
310
|
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
314
311
|
}
|
|
315
312
|
apiRef.contentApi.setSendingId("");
|
|
316
|
-
console.log("onclose: ", recordMsgObj);
|
|
317
313
|
};
|
|
318
314
|
fetchEventSource(url, _object_spread({
|
|
319
315
|
method: method,
|
|
@@ -365,7 +361,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
365
361
|
if (recordMsgObj.id) {
|
|
366
362
|
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
367
363
|
}
|
|
368
|
-
console.log("onerror: ", err);
|
|
369
364
|
}
|
|
370
365
|
}, coverProps));
|
|
371
366
|
};
|
|
@@ -29,9 +29,7 @@ var ReferencesIcon = function(props) {
|
|
|
29
29
|
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
30
30
|
};
|
|
31
31
|
var clickFn = function() {
|
|
32
|
-
console.log("apiRef", apiRef);
|
|
33
32
|
if (apiRef && apiRef.footerApi) {
|
|
34
|
-
console.log("itemitem", item);
|
|
35
33
|
if (item.type === "file") {
|
|
36
34
|
apiRef.footerApi.setReferences({
|
|
37
35
|
type: "file",
|
|
@@ -41,7 +39,8 @@ var ReferencesIcon = function(props) {
|
|
|
41
39
|
fileId: item.id,
|
|
42
40
|
url: "",
|
|
43
41
|
status: "success",
|
|
44
|
-
source: null
|
|
42
|
+
source: null,
|
|
43
|
+
size: 0
|
|
45
44
|
},
|
|
46
45
|
source: item
|
|
47
46
|
});
|
|
@@ -23,8 +23,6 @@ var References = function(props) {
|
|
|
23
23
|
/*#__PURE__*/ _jsx("div", {
|
|
24
24
|
className: "".concat(getCls("footerReferences_right")),
|
|
25
25
|
children: /*#__PURE__*/ _jsx(CloseCircleFilled, {
|
|
26
|
-
onPointerEnterCapture: undefined,
|
|
27
|
-
onPointerLeaveCapture: undefined,
|
|
28
26
|
onClick: function() {
|
|
29
27
|
return deleteReferences();
|
|
30
28
|
}
|
|
@@ -57,8 +55,6 @@ var References = function(props) {
|
|
|
57
55
|
/*#__PURE__*/ _jsx("div", {
|
|
58
56
|
className: "".concat(getCls("footerReferences_right")),
|
|
59
57
|
children: /*#__PURE__*/ _jsx(CloseCircleFilled, {
|
|
60
|
-
onPointerEnterCapture: undefined,
|
|
61
|
-
onPointerLeaveCapture: undefined,
|
|
62
58
|
onClick: function() {
|
|
63
59
|
return deleteReferences();
|
|
64
60
|
}
|
|
@@ -186,7 +186,6 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
186
186
|
}
|
|
187
187
|
var list = [];
|
|
188
188
|
if (msg.location === "right" && msg.fileList && msg.fileList.length > 0) {
|
|
189
|
-
console.log("fileList", msg, msg.fileList);
|
|
190
189
|
msg.fileList.map(function(item) {
|
|
191
190
|
list.push({
|
|
192
191
|
type: "file",
|
|
@@ -221,7 +220,6 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
221
220
|
setLoading(true);
|
|
222
221
|
return getList(page, pageSize).then(function(listObj) {
|
|
223
222
|
setLoading(false);
|
|
224
|
-
console.log("listObjlistObj", listObj);
|
|
225
223
|
setDataSource(function(data) {
|
|
226
224
|
return _to_consumable_array(data).concat(_to_consumable_array(listObj.dataSource));
|
|
227
225
|
});
|
|
@@ -361,7 +359,6 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
361
359
|
var topDom = dom.querySelector("." + styles["msgItem-action-popover-floatTop"]);
|
|
362
360
|
var bottomDom = dom.querySelector("." + styles["msgItem-action-popover-floatBottom"]);
|
|
363
361
|
if (!topDom || !bottomDom) return;
|
|
364
|
-
console.log("itemitem", dom, container);
|
|
365
362
|
var con_obj = container.getBoundingClientRect(); // 外层盒子
|
|
366
363
|
var dom_obj = dom.getBoundingClientRect(); // 鼠标滑过元素
|
|
367
364
|
var y = dom_obj.y - con_obj.y;
|
|
@@ -377,7 +374,6 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
377
374
|
topDom.style.cssText = "display:flex";
|
|
378
375
|
}
|
|
379
376
|
} else {
|
|
380
|
-
console.log("yyyy", y, dom_obj, con_obj, y + dom_obj.height < con_obj.height);
|
|
381
377
|
// 元素top不在可视区域内
|
|
382
378
|
if (y + dom_obj.height < con_obj.height) {
|
|
383
379
|
// 底部在可视区域内
|