bhd-components 0.10.3 → 0.10.5
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/README.md +1 -1
- package/dist/index.esm.es5.development.js +65 -48
- 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/footer/index.js +55 -47
- package/es2017/AIMessageList/components/sendBtn/index.js +6 -1
- package/es2017/AIMessageList/type.d.ts +26 -12
- package/esm/AIMessageList/components/footer/index.js +59 -47
- package/esm/AIMessageList/components/sendBtn/index.js +6 -1
- package/esm/AIMessageList/type.d.ts +26 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13640,7 +13640,7 @@ var sendingSvg = /*#__PURE__*/ jsx("svg", {
|
|
|
13640
13640
|
})
|
|
13641
13641
|
});
|
|
13642
13642
|
var SendBtn$1 = function(props) {
|
|
13643
|
-
var prefix = props.prefix, canSendMsg = props.canSendMsg, sending = props.sending, stopMessage = props.stopMessage;
|
|
13643
|
+
var prefix = props.prefix, canSendMsg = props.canSendMsg, sending = props.sending, stopMessage = props.stopMessage, _props_clickFn = props.clickFn, clickFn = _props_clickFn === void 0 ? function() {} : _props_clickFn;
|
|
13644
13644
|
var getCls = function(clsName) {
|
|
13645
13645
|
return modules_63b47c51$3[clsName] + " " + prefix + "-" + clsName;
|
|
13646
13646
|
};
|
|
@@ -13659,6 +13659,11 @@ var SendBtn$1 = function(props) {
|
|
|
13659
13659
|
}
|
|
13660
13660
|
return /*#__PURE__*/ jsx("i", {
|
|
13661
13661
|
className: "".concat(getCls("sendBtnIcon"), " ").concat(canSendMsg ? "" : getCls("disabled")),
|
|
13662
|
+
onClick: function() {
|
|
13663
|
+
if (canSendMsg) {
|
|
13664
|
+
clickFn();
|
|
13665
|
+
}
|
|
13666
|
+
},
|
|
13662
13667
|
children: sendBtnSvg
|
|
13663
13668
|
});
|
|
13664
13669
|
};
|
|
@@ -15165,7 +15170,11 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15165
15170
|
prefix: prefix,
|
|
15166
15171
|
canSendMsg: canSendMsg,
|
|
15167
15172
|
sending: sending,
|
|
15168
|
-
stopMessage: stopMessage
|
|
15173
|
+
stopMessage: stopMessage,
|
|
15174
|
+
clickFn: function() {
|
|
15175
|
+
if (textValue.trim().length === 0) return;
|
|
15176
|
+
sendMsg(textValue);
|
|
15177
|
+
}
|
|
15169
15178
|
});
|
|
15170
15179
|
if (fileUpload) {
|
|
15171
15180
|
var fileNode = /*#__PURE__*/ jsx(UploadFileBtn, {
|
|
@@ -15239,7 +15248,9 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15239
15248
|
return "";
|
|
15240
15249
|
} : _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) {
|
|
15241
15250
|
return ev;
|
|
15242
|
-
} : _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
|
|
15251
|
+
} : _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() {
|
|
15252
|
+
return Promise.resolve();
|
|
15253
|
+
} : _sendMsgAjaxParams_beforeSendMsg;
|
|
15243
15254
|
ctrl.current = new AbortController();
|
|
15244
15255
|
// apiRef
|
|
15245
15256
|
console.log("apiRef", apiRef);
|
|
@@ -15263,52 +15274,58 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15263
15274
|
recordRef.current.referencesSource,
|
|
15264
15275
|
fileListRef.current ? fileListRef.current.getFileList() : []
|
|
15265
15276
|
];
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
|
|
15269
|
-
|
|
15270
|
-
|
|
15271
|
-
|
|
15272
|
-
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
|
|
15278
|
-
|
|
15279
|
-
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
content
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
|
|
15295
|
-
|
|
15296
|
-
|
|
15297
|
-
|
|
15298
|
-
|
|
15299
|
-
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
|
|
15303
|
-
|
|
15304
|
-
|
|
15305
|
-
|
|
15306
|
-
|
|
15307
|
-
|
|
15277
|
+
beforeSendMsg.apply(void 0, _to_consumable_array(arg)).then(function(beforeInfo) {
|
|
15278
|
+
fetchEventSource(url, _object_spread({
|
|
15279
|
+
method: method,
|
|
15280
|
+
headers: _object_spread({
|
|
15281
|
+
"Content-Type": "application/json",
|
|
15282
|
+
Accept: "text/event-stream,application/json"
|
|
15283
|
+
}, headers),
|
|
15284
|
+
body: params.apply(void 0, _to_consumable_array(arg).concat([
|
|
15285
|
+
beforeInfo
|
|
15286
|
+
])),
|
|
15287
|
+
openWhenHidden: true,
|
|
15288
|
+
signal: ctrl.current.signal,
|
|
15289
|
+
onopen: function(res) {
|
|
15290
|
+
onOpen(res);
|
|
15291
|
+
if (res.status === 200) ;
|
|
15292
|
+
return null;
|
|
15293
|
+
},
|
|
15294
|
+
onmessage: function(ev) {
|
|
15295
|
+
var data = onMessage(ev);
|
|
15296
|
+
msgContent += data.content;
|
|
15297
|
+
delete data.content;
|
|
15298
|
+
recordMsgObj = _object_spread({
|
|
15299
|
+
createTime: createTime,
|
|
15300
|
+
content: msgContent,
|
|
15301
|
+
location: "left",
|
|
15302
|
+
reference: null,
|
|
15303
|
+
source: null
|
|
15304
|
+
}, data);
|
|
15305
|
+
updateMsgRef.current = setTimeout(function() {
|
|
15306
|
+
apiRef.contentApi.updateMsg(msgId, recordMsgObj);
|
|
15307
|
+
msgId = data.id;
|
|
15308
|
+
}, 100);
|
|
15309
|
+
},
|
|
15310
|
+
onclose: function() {
|
|
15311
|
+
onClose();
|
|
15312
|
+
setSending(false);
|
|
15313
|
+
if (recordMsgObj.id) {
|
|
15314
|
+
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
15315
|
+
}
|
|
15316
|
+
console.log("onclose: ", recordMsgObj);
|
|
15317
|
+
},
|
|
15318
|
+
onerror: function(err) {
|
|
15319
|
+
onError(err);
|
|
15320
|
+
if (recordMsgObj.id) {
|
|
15321
|
+
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
15322
|
+
}
|
|
15323
|
+
console.log("onerror: ", err);
|
|
15308
15324
|
}
|
|
15309
|
-
|
|
15310
|
-
|
|
15311
|
-
|
|
15325
|
+
}, coverProps));
|
|
15326
|
+
}).catch(function() {
|
|
15327
|
+
stopMessage();
|
|
15328
|
+
});
|
|
15312
15329
|
};
|
|
15313
15330
|
// 判断是否超出最大字数
|
|
15314
15331
|
var judegTextLengthWarn = function() {
|