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
|
@@ -114,7 +114,11 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
114
114
|
prefix: prefix,
|
|
115
115
|
canSendMsg: canSendMsg,
|
|
116
116
|
sending: sending,
|
|
117
|
-
stopMessage: stopMessage
|
|
117
|
+
stopMessage: stopMessage,
|
|
118
|
+
clickFn: ()=>{
|
|
119
|
+
if (textValue.trim().length === 0) return;
|
|
120
|
+
sendMsg(textValue);
|
|
121
|
+
}
|
|
118
122
|
});
|
|
119
123
|
if (fileUpload) {
|
|
120
124
|
let fileNode = /*#__PURE__*/ _jsx(UploadFileBtn, {
|
|
@@ -184,7 +188,7 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
184
188
|
sendMsgAjax();
|
|
185
189
|
};
|
|
186
190
|
const sendMsgAjax = ()=>{
|
|
187
|
-
const { url, method = "POST", headers = {}, params = ()=>"", onOpen = ()=>{}, onMessage = (ev)=>ev, onClose = ()=>{}, onError = ()=>{}, coverProps = {} } = sendMsgAjaxParams;
|
|
191
|
+
const { url, method = "POST", headers = {}, params = ()=>"", onOpen = ()=>{}, onMessage = (ev)=>ev, onClose = ()=>{}, onError = ()=>{}, coverProps = {}, beforeSendMsg = ()=>Promise.resolve() } = sendMsgAjaxParams;
|
|
188
192
|
ctrl.current = new AbortController();
|
|
189
193
|
// apiRef
|
|
190
194
|
console.log("apiRef", apiRef);
|
|
@@ -208,52 +212,56 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
208
212
|
recordRef.current.referencesSource,
|
|
209
213
|
fileListRef.current ? fileListRef.current.getFileList() : []
|
|
210
214
|
];
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
215
|
+
beforeSendMsg(...arg).then((beforeInfo)=>{
|
|
216
|
+
fetchEventSource(url, _object_spread({
|
|
217
|
+
method,
|
|
218
|
+
headers: _object_spread({
|
|
219
|
+
"Content-Type": "application/json",
|
|
220
|
+
Accept: "text/event-stream,application/json"
|
|
221
|
+
}, headers),
|
|
222
|
+
body: params(...arg, beforeInfo),
|
|
223
|
+
openWhenHidden: true,
|
|
224
|
+
signal: ctrl.current.signal,
|
|
225
|
+
onopen: (res)=>{
|
|
226
|
+
onOpen(res);
|
|
227
|
+
if (res.status === 200) {}
|
|
228
|
+
return null;
|
|
229
|
+
},
|
|
230
|
+
onmessage: (ev)=>{
|
|
231
|
+
let data = onMessage(ev);
|
|
232
|
+
msgContent += data.content;
|
|
233
|
+
delete data.content;
|
|
234
|
+
recordMsgObj = _object_spread({
|
|
235
|
+
createTime: createTime,
|
|
236
|
+
content: msgContent,
|
|
237
|
+
location: "left",
|
|
238
|
+
reference: null,
|
|
239
|
+
source: null
|
|
240
|
+
}, data);
|
|
241
|
+
updateMsgRef.current = setTimeout(()=>{
|
|
242
|
+
apiRef.contentApi.updateMsg(msgId, recordMsgObj);
|
|
243
|
+
msgId = data.id;
|
|
244
|
+
}, 100);
|
|
245
|
+
},
|
|
246
|
+
onclose: ()=>{
|
|
247
|
+
onClose();
|
|
248
|
+
setSending(false);
|
|
249
|
+
if (recordMsgObj.id) {
|
|
250
|
+
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
251
|
+
}
|
|
252
|
+
console.log("onclose: ", recordMsgObj);
|
|
253
|
+
},
|
|
254
|
+
onerror: (err)=>{
|
|
255
|
+
onError(err);
|
|
256
|
+
if (recordMsgObj.id) {
|
|
257
|
+
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
258
|
+
}
|
|
259
|
+
console.log("onerror: ", err);
|
|
246
260
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
if (recordMsgObj.id) {
|
|
252
|
-
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
253
|
-
}
|
|
254
|
-
console.log("onerror: ", err);
|
|
255
|
-
}
|
|
256
|
-
}, coverProps));
|
|
261
|
+
}, coverProps));
|
|
262
|
+
}).catch(()=>{
|
|
263
|
+
stopMessage();
|
|
264
|
+
});
|
|
257
265
|
};
|
|
258
266
|
// 判断是否超出最大字数
|
|
259
267
|
const judegTextLengthWarn = ()=>{
|
|
@@ -23,7 +23,7 @@ const sendingSvg = /*#__PURE__*/ _jsx("svg", {
|
|
|
23
23
|
})
|
|
24
24
|
});
|
|
25
25
|
const SendBtn = (props)=>{
|
|
26
|
-
const { prefix, canSendMsg, sending, stopMessage } = props;
|
|
26
|
+
const { prefix, canSendMsg, sending, stopMessage, clickFn = ()=>{} } = props;
|
|
27
27
|
const getCls = (clsName)=>{
|
|
28
28
|
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
29
29
|
};
|
|
@@ -40,6 +40,11 @@ const SendBtn = (props)=>{
|
|
|
40
40
|
}
|
|
41
41
|
return /*#__PURE__*/ _jsx("i", {
|
|
42
42
|
className: `${getCls("sendBtnIcon")} ${canSendMsg ? "" : getCls("disabled")}`,
|
|
43
|
+
onClick: ()=>{
|
|
44
|
+
if (canSendMsg) {
|
|
45
|
+
clickFn();
|
|
46
|
+
}
|
|
47
|
+
},
|
|
43
48
|
children: sendBtnSvg
|
|
44
49
|
});
|
|
45
50
|
};
|
|
@@ -47,10 +47,13 @@ export interface contentConfigProps {
|
|
|
47
47
|
}>; // 列表数据
|
|
48
48
|
loadMore?: boolean; // 是否开启加载更多 // 默认为true
|
|
49
49
|
helloMsg?: string; //欢迎语
|
|
50
|
-
pageSize?: number
|
|
50
|
+
pageSize?: number; //每页数量 默认为30
|
|
51
51
|
coverRenderText?: (item, html) => React.ReactNode; // 覆盖文本内容
|
|
52
|
-
coverRenderReferences?: (
|
|
53
|
-
|
|
52
|
+
coverRenderReferences?: (
|
|
53
|
+
item: dataItemType,
|
|
54
|
+
referenceNode: React.ReactNode
|
|
55
|
+
) => React.ReactNode; //覆盖引用内容
|
|
56
|
+
onRecordMessage?: (item: dataItemType) => void; // 发送和接收的消息记录
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
// content props
|
|
@@ -82,13 +85,19 @@ export interface sendMsgAjaxParams {
|
|
|
82
85
|
params: (
|
|
83
86
|
value: string,
|
|
84
87
|
refereces: referenceType,
|
|
85
|
-
fileList: fileCustomProps[]
|
|
88
|
+
fileList: fileCustomProps[],
|
|
89
|
+
beforeInfo:any,
|
|
86
90
|
) => string;
|
|
87
91
|
onOpen?: (res: Response) => void;
|
|
88
92
|
onMessage?: (ev: EventSourceMessage) => { id: string; content: string };
|
|
89
93
|
onClose?: () => void;
|
|
90
94
|
onError?: (err: any) => void;
|
|
91
95
|
coverProps?: object;
|
|
96
|
+
beforeSendMsg: (
|
|
97
|
+
value: string,
|
|
98
|
+
refereces: referenceType,
|
|
99
|
+
fileList: fileCustomProps[]
|
|
100
|
+
) => Promise<any>;
|
|
92
101
|
}
|
|
93
102
|
|
|
94
103
|
// footer file Props
|
|
@@ -100,7 +109,12 @@ export interface fileUploadProps {
|
|
|
100
109
|
multiple?: boolean; // 是否允许多选
|
|
101
110
|
customRequest: (
|
|
102
111
|
file: File
|
|
103
|
-
) => Promise<{
|
|
112
|
+
) => Promise<{
|
|
113
|
+
url: string;
|
|
114
|
+
fileId: string;
|
|
115
|
+
source: File;
|
|
116
|
+
status: fileStatus;
|
|
117
|
+
}>; // 自定义上传方法
|
|
104
118
|
mapUploadCount?: number; // 并发上传的数量 默认为1
|
|
105
119
|
deleteFileAjax?: (fileId: string) => Promise<{ fileId: string }>; // 删除文件的ajax 返回删除文件的fileId
|
|
106
120
|
statusText?: (status: fileStatus) => React.ReactNode; // 自定义状态显示
|
|
@@ -127,7 +141,7 @@ export interface footerRefProps {
|
|
|
127
141
|
clearText: () => void; // 清空输入框
|
|
128
142
|
getCanSendMsg: () => boolean; //获取当前是否允许发送消息的状态
|
|
129
143
|
stopMessage: () => void; //停止发送消息
|
|
130
|
-
setReferences:(reference:referenceType)=>void
|
|
144
|
+
setReferences: (reference: referenceType) => void; // 添加引用
|
|
131
145
|
}
|
|
132
146
|
|
|
133
147
|
// sendBtn Props
|
|
@@ -137,6 +151,7 @@ export interface sendBtnProps {
|
|
|
137
151
|
canSendMsg: boolean;
|
|
138
152
|
sending: boolean;
|
|
139
153
|
stopMessage: () => void;
|
|
154
|
+
clickFn?: () => void;
|
|
140
155
|
}
|
|
141
156
|
|
|
142
157
|
// uploadFileBtn Props
|
|
@@ -152,10 +167,9 @@ export interface fileListProps {
|
|
|
152
167
|
prefix: string;
|
|
153
168
|
fileUpload: fileUploadProps;
|
|
154
169
|
errorCallback: (error: errorMessageProps) => void;
|
|
155
|
-
changeFileCanSending:(flag:boolean)=>void;
|
|
170
|
+
changeFileCanSending: (flag: boolean) => void;
|
|
156
171
|
}
|
|
157
172
|
|
|
158
|
-
|
|
159
173
|
// file 自定义对象
|
|
160
174
|
|
|
161
175
|
export interface fileCustomProps {
|
|
@@ -175,8 +189,8 @@ export interface FileListRefProps {
|
|
|
175
189
|
deleteFile: (fileId: string) => void;
|
|
176
190
|
updateFile: (fileId: string, status: fileStatus) => void;
|
|
177
191
|
getFileList: () => fileCustomProps[];
|
|
178
|
-
vaildFile: (file: File,fileId?:string) => boolean
|
|
179
|
-
fileToCustomFile:(file:File)=>fileCustomProps
|
|
192
|
+
vaildFile: (file: File, fileId?: string) => boolean; // 校验文件是否合规
|
|
193
|
+
fileToCustomFile: (file: File) => fileCustomProps;
|
|
180
194
|
}
|
|
181
195
|
|
|
182
196
|
// error Message
|
|
@@ -222,8 +236,8 @@ export interface VirtuosoListProps {
|
|
|
222
236
|
export interface VirtuosoListRefProps {
|
|
223
237
|
addMsg: (msg: dataItemType) => void;
|
|
224
238
|
updateMsg: (id: string, obj: any) => void;
|
|
225
|
-
clearInputing: () => void
|
|
226
|
-
recordMsg:(item: dataItemType) => void;
|
|
239
|
+
clearInputing: () => void; //清楚正在输入的inputing
|
|
240
|
+
recordMsg: (item: dataItemType) => void;
|
|
227
241
|
}
|
|
228
242
|
|
|
229
243
|
export interface contentRefProps extends VirtuosoListRefProps {}
|
|
@@ -116,7 +116,11 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
116
116
|
prefix: prefix,
|
|
117
117
|
canSendMsg: canSendMsg,
|
|
118
118
|
sending: sending,
|
|
119
|
-
stopMessage: stopMessage
|
|
119
|
+
stopMessage: stopMessage,
|
|
120
|
+
clickFn: function() {
|
|
121
|
+
if (textValue.trim().length === 0) return;
|
|
122
|
+
sendMsg(textValue);
|
|
123
|
+
}
|
|
120
124
|
});
|
|
121
125
|
if (fileUpload) {
|
|
122
126
|
var fileNode = /*#__PURE__*/ _jsx(UploadFileBtn, {
|
|
@@ -190,7 +194,9 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
190
194
|
return "";
|
|
191
195
|
} : _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) {
|
|
192
196
|
return ev;
|
|
193
|
-
} : _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
|
|
197
|
+
} : _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() {
|
|
198
|
+
return Promise.resolve();
|
|
199
|
+
} : _sendMsgAjaxParams_beforeSendMsg;
|
|
194
200
|
ctrl.current = new AbortController();
|
|
195
201
|
// apiRef
|
|
196
202
|
console.log("apiRef", apiRef);
|
|
@@ -214,52 +220,58 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
214
220
|
recordRef.current.referencesSource,
|
|
215
221
|
fileListRef.current ? fileListRef.current.getFileList() : []
|
|
216
222
|
];
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
content
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
223
|
+
beforeSendMsg.apply(void 0, _to_consumable_array(arg)).then(function(beforeInfo) {
|
|
224
|
+
fetchEventSource(url, _object_spread({
|
|
225
|
+
method: method,
|
|
226
|
+
headers: _object_spread({
|
|
227
|
+
"Content-Type": "application/json",
|
|
228
|
+
Accept: "text/event-stream,application/json"
|
|
229
|
+
}, headers),
|
|
230
|
+
body: params.apply(void 0, _to_consumable_array(arg).concat([
|
|
231
|
+
beforeInfo
|
|
232
|
+
])),
|
|
233
|
+
openWhenHidden: true,
|
|
234
|
+
signal: ctrl.current.signal,
|
|
235
|
+
onopen: function(res) {
|
|
236
|
+
onOpen(res);
|
|
237
|
+
if (res.status === 200) {}
|
|
238
|
+
return null;
|
|
239
|
+
},
|
|
240
|
+
onmessage: function(ev) {
|
|
241
|
+
var data = onMessage(ev);
|
|
242
|
+
msgContent += data.content;
|
|
243
|
+
delete data.content;
|
|
244
|
+
recordMsgObj = _object_spread({
|
|
245
|
+
createTime: createTime,
|
|
246
|
+
content: msgContent,
|
|
247
|
+
location: "left",
|
|
248
|
+
reference: null,
|
|
249
|
+
source: null
|
|
250
|
+
}, data);
|
|
251
|
+
updateMsgRef.current = setTimeout(function() {
|
|
252
|
+
apiRef.contentApi.updateMsg(msgId, recordMsgObj);
|
|
253
|
+
msgId = data.id;
|
|
254
|
+
}, 100);
|
|
255
|
+
},
|
|
256
|
+
onclose: function() {
|
|
257
|
+
onClose();
|
|
258
|
+
setSending(false);
|
|
259
|
+
if (recordMsgObj.id) {
|
|
260
|
+
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
261
|
+
}
|
|
262
|
+
console.log("onclose: ", recordMsgObj);
|
|
263
|
+
},
|
|
264
|
+
onerror: function(err) {
|
|
265
|
+
onError(err);
|
|
266
|
+
if (recordMsgObj.id) {
|
|
267
|
+
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
268
|
+
}
|
|
269
|
+
console.log("onerror: ", err);
|
|
252
270
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (recordMsgObj.id) {
|
|
258
|
-
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
259
|
-
}
|
|
260
|
-
console.log("onerror: ", err);
|
|
261
|
-
}
|
|
262
|
-
}, coverProps));
|
|
271
|
+
}, coverProps));
|
|
272
|
+
}).catch(function() {
|
|
273
|
+
stopMessage();
|
|
274
|
+
});
|
|
263
275
|
};
|
|
264
276
|
// 判断是否超出最大字数
|
|
265
277
|
var judegTextLengthWarn = function() {
|
|
@@ -23,7 +23,7 @@ var sendingSvg = /*#__PURE__*/ _jsx("svg", {
|
|
|
23
23
|
})
|
|
24
24
|
});
|
|
25
25
|
var SendBtn = function(props) {
|
|
26
|
-
var prefix = props.prefix, canSendMsg = props.canSendMsg, sending = props.sending, stopMessage = props.stopMessage;
|
|
26
|
+
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;
|
|
27
27
|
var getCls = function(clsName) {
|
|
28
28
|
return styles[clsName] + " " + prefix + "-" + clsName;
|
|
29
29
|
};
|
|
@@ -42,6 +42,11 @@ var SendBtn = function(props) {
|
|
|
42
42
|
}
|
|
43
43
|
return /*#__PURE__*/ _jsx("i", {
|
|
44
44
|
className: "".concat(getCls("sendBtnIcon"), " ").concat(canSendMsg ? "" : getCls("disabled")),
|
|
45
|
+
onClick: function() {
|
|
46
|
+
if (canSendMsg) {
|
|
47
|
+
clickFn();
|
|
48
|
+
}
|
|
49
|
+
},
|
|
45
50
|
children: sendBtnSvg
|
|
46
51
|
});
|
|
47
52
|
};
|
|
@@ -47,10 +47,13 @@ export interface contentConfigProps {
|
|
|
47
47
|
}>; // 列表数据
|
|
48
48
|
loadMore?: boolean; // 是否开启加载更多 // 默认为true
|
|
49
49
|
helloMsg?: string; //欢迎语
|
|
50
|
-
pageSize?: number
|
|
50
|
+
pageSize?: number; //每页数量 默认为30
|
|
51
51
|
coverRenderText?: (item, html) => React.ReactNode; // 覆盖文本内容
|
|
52
|
-
coverRenderReferences?: (
|
|
53
|
-
|
|
52
|
+
coverRenderReferences?: (
|
|
53
|
+
item: dataItemType,
|
|
54
|
+
referenceNode: React.ReactNode
|
|
55
|
+
) => React.ReactNode; //覆盖引用内容
|
|
56
|
+
onRecordMessage?: (item: dataItemType) => void; // 发送和接收的消息记录
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
// content props
|
|
@@ -82,13 +85,19 @@ export interface sendMsgAjaxParams {
|
|
|
82
85
|
params: (
|
|
83
86
|
value: string,
|
|
84
87
|
refereces: referenceType,
|
|
85
|
-
fileList: fileCustomProps[]
|
|
88
|
+
fileList: fileCustomProps[],
|
|
89
|
+
beforeInfo:any,
|
|
86
90
|
) => string;
|
|
87
91
|
onOpen?: (res: Response) => void;
|
|
88
92
|
onMessage?: (ev: EventSourceMessage) => { id: string; content: string };
|
|
89
93
|
onClose?: () => void;
|
|
90
94
|
onError?: (err: any) => void;
|
|
91
95
|
coverProps?: object;
|
|
96
|
+
beforeSendMsg: (
|
|
97
|
+
value: string,
|
|
98
|
+
refereces: referenceType,
|
|
99
|
+
fileList: fileCustomProps[]
|
|
100
|
+
) => Promise<any>;
|
|
92
101
|
}
|
|
93
102
|
|
|
94
103
|
// footer file Props
|
|
@@ -100,7 +109,12 @@ export interface fileUploadProps {
|
|
|
100
109
|
multiple?: boolean; // 是否允许多选
|
|
101
110
|
customRequest: (
|
|
102
111
|
file: File
|
|
103
|
-
) => Promise<{
|
|
112
|
+
) => Promise<{
|
|
113
|
+
url: string;
|
|
114
|
+
fileId: string;
|
|
115
|
+
source: File;
|
|
116
|
+
status: fileStatus;
|
|
117
|
+
}>; // 自定义上传方法
|
|
104
118
|
mapUploadCount?: number; // 并发上传的数量 默认为1
|
|
105
119
|
deleteFileAjax?: (fileId: string) => Promise<{ fileId: string }>; // 删除文件的ajax 返回删除文件的fileId
|
|
106
120
|
statusText?: (status: fileStatus) => React.ReactNode; // 自定义状态显示
|
|
@@ -127,7 +141,7 @@ export interface footerRefProps {
|
|
|
127
141
|
clearText: () => void; // 清空输入框
|
|
128
142
|
getCanSendMsg: () => boolean; //获取当前是否允许发送消息的状态
|
|
129
143
|
stopMessage: () => void; //停止发送消息
|
|
130
|
-
setReferences:(reference:referenceType)=>void
|
|
144
|
+
setReferences: (reference: referenceType) => void; // 添加引用
|
|
131
145
|
}
|
|
132
146
|
|
|
133
147
|
// sendBtn Props
|
|
@@ -137,6 +151,7 @@ export interface sendBtnProps {
|
|
|
137
151
|
canSendMsg: boolean;
|
|
138
152
|
sending: boolean;
|
|
139
153
|
stopMessage: () => void;
|
|
154
|
+
clickFn?: () => void;
|
|
140
155
|
}
|
|
141
156
|
|
|
142
157
|
// uploadFileBtn Props
|
|
@@ -152,10 +167,9 @@ export interface fileListProps {
|
|
|
152
167
|
prefix: string;
|
|
153
168
|
fileUpload: fileUploadProps;
|
|
154
169
|
errorCallback: (error: errorMessageProps) => void;
|
|
155
|
-
changeFileCanSending:(flag:boolean)=>void;
|
|
170
|
+
changeFileCanSending: (flag: boolean) => void;
|
|
156
171
|
}
|
|
157
172
|
|
|
158
|
-
|
|
159
173
|
// file 自定义对象
|
|
160
174
|
|
|
161
175
|
export interface fileCustomProps {
|
|
@@ -175,8 +189,8 @@ export interface FileListRefProps {
|
|
|
175
189
|
deleteFile: (fileId: string) => void;
|
|
176
190
|
updateFile: (fileId: string, status: fileStatus) => void;
|
|
177
191
|
getFileList: () => fileCustomProps[];
|
|
178
|
-
vaildFile: (file: File,fileId?:string) => boolean
|
|
179
|
-
fileToCustomFile:(file:File)=>fileCustomProps
|
|
192
|
+
vaildFile: (file: File, fileId?: string) => boolean; // 校验文件是否合规
|
|
193
|
+
fileToCustomFile: (file: File) => fileCustomProps;
|
|
180
194
|
}
|
|
181
195
|
|
|
182
196
|
// error Message
|
|
@@ -222,8 +236,8 @@ export interface VirtuosoListProps {
|
|
|
222
236
|
export interface VirtuosoListRefProps {
|
|
223
237
|
addMsg: (msg: dataItemType) => void;
|
|
224
238
|
updateMsg: (id: string, obj: any) => void;
|
|
225
|
-
clearInputing: () => void
|
|
226
|
-
recordMsg:(item: dataItemType) => void;
|
|
239
|
+
clearInputing: () => void; //清楚正在输入的inputing
|
|
240
|
+
recordMsg: (item: dataItemType) => void;
|
|
227
241
|
}
|
|
228
242
|
|
|
229
243
|
export interface contentRefProps extends VirtuosoListRefProps {}
|