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
|
@@ -13085,7 +13085,6 @@ var CopyIcon = function(props) {
|
|
|
13085
13085
|
setCopySuccess(true);
|
|
13086
13086
|
clearTimeout(timer.current);
|
|
13087
13087
|
timer.current = setTimeout(function() {
|
|
13088
|
-
console.log("定时器定时器");
|
|
13089
13088
|
setCopySuccess(false);
|
|
13090
13089
|
}, 2000);
|
|
13091
13090
|
};
|
|
@@ -13129,9 +13128,7 @@ var ReferencesIcon = function(props) {
|
|
|
13129
13128
|
return modules_63b47c51$7[clsName] + " " + prefix + "-" + clsName;
|
|
13130
13129
|
};
|
|
13131
13130
|
var clickFn = function() {
|
|
13132
|
-
console.log("apiRef", apiRef);
|
|
13133
13131
|
if (apiRef && apiRef.footerApi) {
|
|
13134
|
-
console.log("itemitem", item);
|
|
13135
13132
|
if (item.type === "file") {
|
|
13136
13133
|
apiRef.footerApi.setReferences({
|
|
13137
13134
|
type: "file",
|
|
@@ -13141,7 +13138,8 @@ var ReferencesIcon = function(props) {
|
|
|
13141
13138
|
fileId: item.id,
|
|
13142
13139
|
url: "",
|
|
13143
13140
|
status: "success",
|
|
13144
|
-
source: null
|
|
13141
|
+
source: null,
|
|
13142
|
+
size: 0
|
|
13145
13143
|
},
|
|
13146
13144
|
source: item
|
|
13147
13145
|
});
|
|
@@ -14384,7 +14382,6 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
14384
14382
|
}
|
|
14385
14383
|
var list = [];
|
|
14386
14384
|
if (msg.location === "right" && msg.fileList && msg.fileList.length > 0) {
|
|
14387
|
-
console.log("fileList", msg, msg.fileList);
|
|
14388
14385
|
msg.fileList.map(function(item) {
|
|
14389
14386
|
list.push({
|
|
14390
14387
|
type: "file",
|
|
@@ -14419,7 +14416,6 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
14419
14416
|
setLoading(true);
|
|
14420
14417
|
return getList(page, pageSize).then(function(listObj) {
|
|
14421
14418
|
setLoading(false);
|
|
14422
|
-
console.log("listObjlistObj", listObj);
|
|
14423
14419
|
setDataSource(function(data) {
|
|
14424
14420
|
return _to_consumable_array(data).concat(_to_consumable_array(listObj.dataSource));
|
|
14425
14421
|
});
|
|
@@ -14559,7 +14555,6 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
14559
14555
|
var topDom = dom.querySelector("." + modules_63b47c51$9["msgItem-action-popover-floatTop"]);
|
|
14560
14556
|
var bottomDom = dom.querySelector("." + modules_63b47c51$9["msgItem-action-popover-floatBottom"]);
|
|
14561
14557
|
if (!topDom || !bottomDom) return;
|
|
14562
|
-
console.log("itemitem", dom, container);
|
|
14563
14558
|
var con_obj = container.getBoundingClientRect(); // 外层盒子
|
|
14564
14559
|
var dom_obj = dom.getBoundingClientRect(); // 鼠标滑过元素
|
|
14565
14560
|
var y = dom_obj.y - con_obj.y;
|
|
@@ -14575,7 +14570,6 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
14575
14570
|
topDom.style.cssText = "display:flex";
|
|
14576
14571
|
}
|
|
14577
14572
|
} else {
|
|
14578
|
-
console.log("yyyy", y, dom_obj, con_obj, y + dom_obj.height < con_obj.height);
|
|
14579
14573
|
// 元素top不在可视区域内
|
|
14580
14574
|
if (y + dom_obj.height < con_obj.height) {
|
|
14581
14575
|
// 底部在可视区域内
|
|
@@ -15006,10 +15000,10 @@ var getSuffix = function(fileName) {
|
|
|
15006
15000
|
};
|
|
15007
15001
|
var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
15008
15002
|
var prefix = props.prefix, fileUpload = props.fileUpload, errorCallback = props.errorCallback, changeFileCanSending = props.changeFileCanSending, onChange = props.onChange;
|
|
15009
|
-
console.log("fileUpload", fileUpload);
|
|
15010
15003
|
var _useState = _sliced_to_array(useState([]), 2), fileList = _useState[0], setFileList = _useState[1];
|
|
15011
15004
|
var _useState1 = _sliced_to_array(useState(1), 2), page = _useState1[0], setPage = _useState1[1];
|
|
15012
15005
|
var _useState2 = _sliced_to_array(useState(5), 2), pageSize = _useState2[0], setPageSize = _useState2[1];
|
|
15006
|
+
var recordListLength = useRef(0);
|
|
15013
15007
|
var recordObj = useRef({
|
|
15014
15008
|
page: page,
|
|
15015
15009
|
pageSize: pageSize,
|
|
@@ -15062,10 +15056,11 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15062
15056
|
return modules_63b47c51$1[clsName] + " " + prefix + "-" + clsName;
|
|
15063
15057
|
};
|
|
15064
15058
|
var clearFileList = function() {
|
|
15059
|
+
recordListLength.current = 0;
|
|
15065
15060
|
setFileList([]);
|
|
15066
15061
|
};
|
|
15067
15062
|
var vaildFile = function(file, fileId) {
|
|
15068
|
-
if (fileUpload.maxCount > 0 &&
|
|
15063
|
+
if (fileUpload.maxCount > 0 && recordListLength.current + 1 > fileUpload.maxCount) {
|
|
15069
15064
|
errorCallback({
|
|
15070
15065
|
type: "fileCountOver",
|
|
15071
15066
|
message: "上传失败,文件数量超过限制"
|
|
@@ -15116,8 +15111,8 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15116
15111
|
return true;
|
|
15117
15112
|
};
|
|
15118
15113
|
var addFile = function(file, fileId) {
|
|
15119
|
-
console.log("addFileaddFile", file, fileUpload);
|
|
15120
15114
|
if (vaildFile(file, fileId)) {
|
|
15115
|
+
recordListLength.current += 1;
|
|
15121
15116
|
// 等待上传
|
|
15122
15117
|
// 判断是否存在等待上传的文件
|
|
15123
15118
|
setFileList(function(fileList) {
|
|
@@ -15205,13 +15200,14 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15205
15200
|
// 删除文件
|
|
15206
15201
|
var deleteFile = function(fileId) {
|
|
15207
15202
|
var fileObj = null;
|
|
15203
|
+
recordListLength.current -= 0;
|
|
15208
15204
|
setFileList(function(fileList) {
|
|
15209
15205
|
return fileList.filter(function(item) {
|
|
15210
15206
|
if (item.fileId === fileId) {
|
|
15211
15207
|
fileObj = item;
|
|
15212
|
-
return
|
|
15208
|
+
return false;
|
|
15213
15209
|
}
|
|
15214
|
-
return
|
|
15210
|
+
return true;
|
|
15215
15211
|
});
|
|
15216
15212
|
});
|
|
15217
15213
|
// 删除文件时如果删除的是最后一条 则page-1
|
|
@@ -15255,6 +15251,24 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15255
15251
|
setPage(page);
|
|
15256
15252
|
setPageSize(pageSize);
|
|
15257
15253
|
};
|
|
15254
|
+
var retryUploadFile = function(fileItem) {
|
|
15255
|
+
setFileList(function(fileList) {
|
|
15256
|
+
var uploadingList = fileList.filter(function(item) {
|
|
15257
|
+
return item.status === "uploading";
|
|
15258
|
+
});
|
|
15259
|
+
return fileList.map(function(item) {
|
|
15260
|
+
if (fileItem.fileId === item.fileId) {
|
|
15261
|
+
if (uploadingList.length >= fileUpload.mapUploadCount) {
|
|
15262
|
+
item.status = "waiting";
|
|
15263
|
+
} else {
|
|
15264
|
+
item.status = "uploading";
|
|
15265
|
+
uploadFile(item.source);
|
|
15266
|
+
}
|
|
15267
|
+
}
|
|
15268
|
+
return item;
|
|
15269
|
+
});
|
|
15270
|
+
});
|
|
15271
|
+
};
|
|
15258
15272
|
var list = fileList.slice((page - 1) * pageSize, page * pageSize);
|
|
15259
15273
|
if (list.length === 0) return null;
|
|
15260
15274
|
return /*#__PURE__*/ jsxs("div", {
|
|
@@ -15265,16 +15279,21 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15265
15279
|
onClick: function() {
|
|
15266
15280
|
return changePage(page - 1);
|
|
15267
15281
|
},
|
|
15268
|
-
children: /*#__PURE__*/ jsx(DoubleRightOutlined, {
|
|
15269
|
-
onPointerEnterCapture: undefined,
|
|
15270
|
-
onPointerLeaveCapture: undefined
|
|
15271
|
-
})
|
|
15282
|
+
children: /*#__PURE__*/ jsx(DoubleRightOutlined, {})
|
|
15272
15283
|
}),
|
|
15273
15284
|
/*#__PURE__*/ jsx("div", {
|
|
15274
15285
|
className: "".concat(getCls("footer-fileList-list")),
|
|
15275
15286
|
children: list.map(function(item) {
|
|
15276
15287
|
return /*#__PURE__*/ jsxs("div", {
|
|
15277
15288
|
className: "".concat(getCls("footer-fileList-listItem")),
|
|
15289
|
+
style: {
|
|
15290
|
+
cursor: item.status === "uploadError" ? "pointer" : "default"
|
|
15291
|
+
},
|
|
15292
|
+
onClick: function() {
|
|
15293
|
+
if (item.status === "uploadError") {
|
|
15294
|
+
retryUploadFile(item);
|
|
15295
|
+
}
|
|
15296
|
+
},
|
|
15278
15297
|
children: [
|
|
15279
15298
|
/*#__PURE__*/ jsx("div", {
|
|
15280
15299
|
className: "".concat(getCls("footer-fileList-listItem-icon")),
|
|
@@ -15285,29 +15304,13 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15285
15304
|
title: item.name,
|
|
15286
15305
|
children: item.name
|
|
15287
15306
|
}),
|
|
15288
|
-
|
|
15289
|
-
fileList: [],
|
|
15290
|
-
accept: fileUpload.accept,
|
|
15291
|
-
customRequest: function(options) {
|
|
15292
|
-
return addFile(options.file, item.fileId);
|
|
15293
|
-
},
|
|
15294
|
-
multiple: false,
|
|
15295
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
15296
|
-
className: "".concat(getCls("footer-fileList-listItem-status")),
|
|
15297
|
-
style: {
|
|
15298
|
-
cursor: "pointer"
|
|
15299
|
-
},
|
|
15300
|
-
children: statusRender(item.status, fileUpload.statusText)
|
|
15301
|
-
})
|
|
15302
|
-
}) : /*#__PURE__*/ jsx("div", {
|
|
15307
|
+
/*#__PURE__*/ jsx("div", {
|
|
15303
15308
|
className: "".concat(getCls("footer-fileList-listItem-status")),
|
|
15304
15309
|
children: statusRender(item.status, fileUpload.statusText)
|
|
15305
15310
|
}),
|
|
15306
15311
|
/*#__PURE__*/ jsx("div", {
|
|
15307
15312
|
className: "".concat(getCls("footer-fileList-listItem-delete")),
|
|
15308
15313
|
children: /*#__PURE__*/ jsx(CloseCircleFilled, {
|
|
15309
|
-
onPointerEnterCapture: undefined,
|
|
15310
|
-
onPointerLeaveCapture: undefined,
|
|
15311
15314
|
onClick: function() {
|
|
15312
15315
|
return deleteFile(item.fileId);
|
|
15313
15316
|
}
|
|
@@ -15322,10 +15325,7 @@ var FileList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15322
15325
|
onClick: function() {
|
|
15323
15326
|
return changePage(page + 1);
|
|
15324
15327
|
},
|
|
15325
|
-
children: /*#__PURE__*/ jsx(DoubleRightOutlined, {
|
|
15326
|
-
onPointerEnterCapture: undefined,
|
|
15327
|
-
onPointerLeaveCapture: undefined
|
|
15328
|
-
})
|
|
15328
|
+
children: /*#__PURE__*/ jsx(DoubleRightOutlined, {})
|
|
15329
15329
|
})
|
|
15330
15330
|
]
|
|
15331
15331
|
});
|
|
@@ -15354,8 +15354,6 @@ var References = function(props) {
|
|
|
15354
15354
|
/*#__PURE__*/ jsx("div", {
|
|
15355
15355
|
className: "".concat(getCls("footerReferences_right")),
|
|
15356
15356
|
children: /*#__PURE__*/ jsx(CloseCircleFilled, {
|
|
15357
|
-
onPointerEnterCapture: undefined,
|
|
15358
|
-
onPointerLeaveCapture: undefined,
|
|
15359
15357
|
onClick: function() {
|
|
15360
15358
|
return deleteReferences();
|
|
15361
15359
|
}
|
|
@@ -15388,8 +15386,6 @@ var References = function(props) {
|
|
|
15388
15386
|
/*#__PURE__*/ jsx("div", {
|
|
15389
15387
|
className: "".concat(getCls("footerReferences_right")),
|
|
15390
15388
|
children: /*#__PURE__*/ jsx(CloseCircleFilled, {
|
|
15391
|
-
onPointerEnterCapture: undefined,
|
|
15392
|
-
onPointerLeaveCapture: undefined,
|
|
15393
15389
|
onClick: function() {
|
|
15394
15390
|
return deleteReferences();
|
|
15395
15391
|
}
|
|
@@ -15545,7 +15541,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15545
15541
|
fileUpload: fileUpload,
|
|
15546
15542
|
customRequest: function(options) {
|
|
15547
15543
|
var _fileListRef_current;
|
|
15548
|
-
console.log("customRequestcustomRequest", options);
|
|
15549
15544
|
(_fileListRef_current = fileListRef.current) === null || _fileListRef_current === void 0 ? void 0 : _fileListRef_current.addFile(options.file);
|
|
15550
15545
|
}
|
|
15551
15546
|
});
|
|
@@ -15594,7 +15589,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15594
15589
|
};
|
|
15595
15590
|
// 发现消息
|
|
15596
15591
|
var sendMsg = function(value) {
|
|
15597
|
-
console.log("发送消息:", value);
|
|
15598
15592
|
if (value.trim().length === 0) {
|
|
15599
15593
|
throw new Error("消息不能为空");
|
|
15600
15594
|
}
|
|
@@ -15639,7 +15633,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15639
15633
|
} : _sendMsgAjaxParams_beforeSendMsg;
|
|
15640
15634
|
ctrl.current = new AbortController();
|
|
15641
15635
|
// apiRef
|
|
15642
|
-
console.log("apiRef", apiRef);
|
|
15643
15636
|
var msgId = "inputing";
|
|
15644
15637
|
var createTime = new Date().getTime();
|
|
15645
15638
|
if (recordObj) {
|
|
@@ -15702,7 +15695,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15702
15695
|
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
15703
15696
|
}
|
|
15704
15697
|
apiRef.contentApi.setSendingId("");
|
|
15705
|
-
console.log("onclose: ", recordMsgObj);
|
|
15706
15698
|
};
|
|
15707
15699
|
fetchEventSource(url, _object_spread({
|
|
15708
15700
|
method: method,
|
|
@@ -15754,7 +15746,6 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15754
15746
|
if (recordMsgObj.id) {
|
|
15755
15747
|
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
15756
15748
|
}
|
|
15757
|
-
console.log("onerror: ", err);
|
|
15758
15749
|
}
|
|
15759
15750
|
}, coverProps));
|
|
15760
15751
|
};
|