bhd-components 0.10.14 → 0.10.16
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 +90 -87
- package/dist/index.esm.es5.development.js +15 -3
- 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/footer/index.js +9 -0
- package/es2017/AIMessageList/components/virtuosoList/index.js +5 -2
- package/es2017/AIMessageList/components/virtuosoList/index.module.less +4 -0
- package/es2017/AIMessageList/type.d.ts +3 -1
- package/esm/AIMessageList/components/footer/index.js +9 -0
- package/esm/AIMessageList/components/virtuosoList/index.js +5 -2
- package/esm/AIMessageList/components/virtuosoList/index.module.less +4 -0
- package/esm/AIMessageList/type.d.ts +3 -1
- package/package.json +1 -1
|
@@ -60,6 +60,7 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
60
60
|
setTextValue,
|
|
61
61
|
sendMsg,
|
|
62
62
|
refreshSendMsg,
|
|
63
|
+
sendMsgLeft,
|
|
63
64
|
clearText: ()=>{
|
|
64
65
|
setTextValue("");
|
|
65
66
|
},
|
|
@@ -219,6 +220,14 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
219
220
|
fileList: fileList || []
|
|
220
221
|
});
|
|
221
222
|
};
|
|
223
|
+
const sendMsgLeft = function(msgId, value, reference, fileList) {
|
|
224
|
+
sendMsgAjax({
|
|
225
|
+
id: msgId,
|
|
226
|
+
value: value,
|
|
227
|
+
reference: reference || null,
|
|
228
|
+
fileList: fileList || []
|
|
229
|
+
});
|
|
230
|
+
};
|
|
222
231
|
const sendMsgAjax = (recordObj)=>{
|
|
223
232
|
const { url, method = "POST", headers = ()=>({}), params = ()=>"", onOpen = ()=>{}, onMessage = (ev)=>ev, onClose = ()=>{}, onError = ()=>{}, coverProps = {}, beforeSendMsg = ()=>Promise.resolve() } = sendMsgAjaxParams;
|
|
224
233
|
ctrl.current = new AbortController();
|
|
@@ -46,7 +46,7 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
46
46
|
const { getList, coverRenderText, msgAction = [
|
|
47
47
|
"copy",
|
|
48
48
|
"reference"
|
|
49
|
-
], coverRenderReferences, onRecordMessage = ()=>{}, onVoteChange = ()=>{}, onRefresh = ()=>{}, helloMsg, fileCustomRender = {} } = contentConfig;
|
|
49
|
+
], coverRenderReferences, onRecordMessage = ()=>{}, onVoteChange = ()=>{}, onRefresh = ()=>{}, helloMsg, fileCustomRender = {}, onSendedHelloMsg = ()=>{} } = contentConfig;
|
|
50
50
|
const loadMoreProps = contentConfig.loadMore || true;
|
|
51
51
|
const virtuosoRef = useRef(null);
|
|
52
52
|
const [loading, setLoading] = useState(false); // 是否加载中
|
|
@@ -127,6 +127,7 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
127
127
|
source: null,
|
|
128
128
|
fileList: []
|
|
129
129
|
});
|
|
130
|
+
onSendedHelloMsg();
|
|
130
131
|
}
|
|
131
132
|
});
|
|
132
133
|
let removeFn = delegate(wrapperRef.current, "click", `.${styles.copyCode}`, (event, target)=>{
|
|
@@ -394,7 +395,9 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
394
395
|
topDom.style.cssText = "";
|
|
395
396
|
};
|
|
396
397
|
const renderAction = (location, item)=>{
|
|
397
|
-
if (item.id === "inputing" || item.id === "helloMsg" || item.id === recordRef.current.sendingId) return
|
|
398
|
+
if (item.id === "inputing" || item.id === "helloMsg" || item.id === recordRef.current.sendingId || item.hideAction) return /*#__PURE__*/ _jsx("div", {
|
|
399
|
+
className: `${getCls("msgItem-action-empty")}`
|
|
400
|
+
});
|
|
398
401
|
let copyNode = /*#__PURE__*/ _jsx(CopyIcon, {
|
|
399
402
|
prefix: prefix,
|
|
400
403
|
content: item.content
|
|
@@ -65,9 +65,9 @@ export interface contentConfigProps {
|
|
|
65
65
|
fileCustomRender?: {// 文件对象的自定义渲染
|
|
66
66
|
iconFileRender?: (suffix: string) => React.ReactNode; // 文件上传的 icon。参数 文件对象file 返回值为图标
|
|
67
67
|
fileTitleRender?: (item: dataItemType) => React.ReactNode;
|
|
68
|
-
fileBottomRender?: (item: dataItemType) => React.ReactNode;
|
|
69
68
|
fileRender?: (item: dataItemType) => React.ReactNode;
|
|
70
69
|
};
|
|
70
|
+
onSendedHelloMsg?:()=>void;//发送招呼语之后
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
// content props
|
|
@@ -161,6 +161,7 @@ export interface footerRefProps {
|
|
|
161
161
|
setTextValue: (value: string) => void; // 设置输入框的值
|
|
162
162
|
sendMsg: (value: string) => void; // 发送消息
|
|
163
163
|
refreshSendMsg:(msgId:string,value:string,reference?:any,fileList?:any)=>void;// 刷新消息
|
|
164
|
+
sendMsgLeft:(msgId:string,value:string,reference?:any,fileList?:any)=>void;// 发送消息只显示ai返回的 不显示自己发送的
|
|
164
165
|
clearText: () => void; // 清空输入框
|
|
165
166
|
getCanSendMsg: () => boolean; //获取当前是否允许发送消息的状态
|
|
166
167
|
stopMessage: () => void; //停止发送消息
|
|
@@ -304,4 +305,5 @@ export interface dataItemType {
|
|
|
304
305
|
suffix?:string;
|
|
305
306
|
fileTitle?:string;
|
|
306
307
|
fileList?:fileCustomProps[];
|
|
308
|
+
hideAction?:boolean;
|
|
307
309
|
}
|
|
@@ -64,6 +64,7 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
64
64
|
setTextValue: setTextValue,
|
|
65
65
|
sendMsg: sendMsg,
|
|
66
66
|
refreshSendMsg: refreshSendMsg,
|
|
67
|
+
sendMsgLeft: sendMsgLeft,
|
|
67
68
|
clearText: function() {
|
|
68
69
|
setTextValue("");
|
|
69
70
|
},
|
|
@@ -223,6 +224,14 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
223
224
|
fileList: fileList || []
|
|
224
225
|
});
|
|
225
226
|
};
|
|
227
|
+
var sendMsgLeft = function sendMsgLeft(msgId, value, reference, fileList) {
|
|
228
|
+
sendMsgAjax({
|
|
229
|
+
id: msgId,
|
|
230
|
+
value: value,
|
|
231
|
+
reference: reference || null,
|
|
232
|
+
fileList: fileList || []
|
|
233
|
+
});
|
|
234
|
+
};
|
|
226
235
|
var sendMsgAjax = function(recordObj) {
|
|
227
236
|
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() {
|
|
228
237
|
return {};
|
|
@@ -50,7 +50,7 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
50
50
|
var getList = contentConfig.getList, coverRenderText = contentConfig.coverRenderText, _contentConfig_msgAction = contentConfig.msgAction, msgAction = _contentConfig_msgAction === void 0 ? [
|
|
51
51
|
"copy",
|
|
52
52
|
"reference"
|
|
53
|
-
] : _contentConfig_msgAction, coverRenderReferences = contentConfig.coverRenderReferences, _contentConfig_onRecordMessage = contentConfig.onRecordMessage, onRecordMessage = _contentConfig_onRecordMessage === void 0 ? function() {} : _contentConfig_onRecordMessage, _contentConfig_onVoteChange = contentConfig.onVoteChange, onVoteChange = _contentConfig_onVoteChange === void 0 ? function() {} : _contentConfig_onVoteChange, _contentConfig_onRefresh = contentConfig.onRefresh, onRefresh = _contentConfig_onRefresh === void 0 ? function() {} : _contentConfig_onRefresh, helloMsg = contentConfig.helloMsg, _contentConfig_fileCustomRender = contentConfig.fileCustomRender, fileCustomRender = _contentConfig_fileCustomRender === void 0 ? {} : _contentConfig_fileCustomRender;
|
|
53
|
+
] : _contentConfig_msgAction, coverRenderReferences = contentConfig.coverRenderReferences, _contentConfig_onRecordMessage = contentConfig.onRecordMessage, onRecordMessage = _contentConfig_onRecordMessage === void 0 ? function() {} : _contentConfig_onRecordMessage, _contentConfig_onVoteChange = contentConfig.onVoteChange, onVoteChange = _contentConfig_onVoteChange === void 0 ? function() {} : _contentConfig_onVoteChange, _contentConfig_onRefresh = contentConfig.onRefresh, onRefresh = _contentConfig_onRefresh === void 0 ? function() {} : _contentConfig_onRefresh, helloMsg = contentConfig.helloMsg, _contentConfig_fileCustomRender = contentConfig.fileCustomRender, fileCustomRender = _contentConfig_fileCustomRender === void 0 ? {} : _contentConfig_fileCustomRender, _contentConfig_onSendedHelloMsg = contentConfig.onSendedHelloMsg, onSendedHelloMsg = _contentConfig_onSendedHelloMsg === void 0 ? function() {} : _contentConfig_onSendedHelloMsg;
|
|
54
54
|
var loadMoreProps = contentConfig.loadMore || true;
|
|
55
55
|
var virtuosoRef = useRef(null);
|
|
56
56
|
var _useState = _sliced_to_array(useState(false), 2), loading = _useState[0], setLoading = _useState[1]; // 是否加载中
|
|
@@ -133,6 +133,7 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
133
133
|
source: null,
|
|
134
134
|
fileList: []
|
|
135
135
|
});
|
|
136
|
+
onSendedHelloMsg();
|
|
136
137
|
}
|
|
137
138
|
});
|
|
138
139
|
var removeFn = delegate(wrapperRef.current, "click", ".".concat(styles.copyCode), function(event, target) {
|
|
@@ -398,7 +399,9 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
398
399
|
topDom.style.cssText = "";
|
|
399
400
|
};
|
|
400
401
|
var renderAction = function(location, item) {
|
|
401
|
-
if (item.id === "inputing" || item.id === "helloMsg" || item.id === recordRef.current.sendingId) return
|
|
402
|
+
if (item.id === "inputing" || item.id === "helloMsg" || item.id === recordRef.current.sendingId || item.hideAction) return /*#__PURE__*/ _jsx("div", {
|
|
403
|
+
className: "".concat(getCls("msgItem-action-empty"))
|
|
404
|
+
});
|
|
402
405
|
var copyNode = /*#__PURE__*/ _jsx(CopyIcon, {
|
|
403
406
|
prefix: prefix,
|
|
404
407
|
content: item.content
|
|
@@ -65,9 +65,9 @@ export interface contentConfigProps {
|
|
|
65
65
|
fileCustomRender?: {// 文件对象的自定义渲染
|
|
66
66
|
iconFileRender?: (suffix: string) => React.ReactNode; // 文件上传的 icon。参数 文件对象file 返回值为图标
|
|
67
67
|
fileTitleRender?: (item: dataItemType) => React.ReactNode;
|
|
68
|
-
fileBottomRender?: (item: dataItemType) => React.ReactNode;
|
|
69
68
|
fileRender?: (item: dataItemType) => React.ReactNode;
|
|
70
69
|
};
|
|
70
|
+
onSendedHelloMsg?:()=>void;//发送招呼语之后
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
// content props
|
|
@@ -161,6 +161,7 @@ export interface footerRefProps {
|
|
|
161
161
|
setTextValue: (value: string) => void; // 设置输入框的值
|
|
162
162
|
sendMsg: (value: string) => void; // 发送消息
|
|
163
163
|
refreshSendMsg:(msgId:string,value:string,reference?:any,fileList?:any)=>void;// 刷新消息
|
|
164
|
+
sendMsgLeft:(msgId:string,value:string,reference?:any,fileList?:any)=>void;// 发送消息只显示ai返回的 不显示自己发送的
|
|
164
165
|
clearText: () => void; // 清空输入框
|
|
165
166
|
getCanSendMsg: () => boolean; //获取当前是否允许发送消息的状态
|
|
166
167
|
stopMessage: () => void; //停止发送消息
|
|
@@ -304,4 +305,5 @@ export interface dataItemType {
|
|
|
304
305
|
suffix?:string;
|
|
305
306
|
fileTitle?:string;
|
|
306
307
|
fileList?:fileCustomProps[];
|
|
308
|
+
hideAction?:boolean;
|
|
307
309
|
}
|