bhd-components 0.10.3 → 0.10.4
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 +100 -76
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +2 -2
- package/dist/vendor.esm.es5.production.js +2 -2
- package/es2017/AIMessageList/components/footer/index.js +4 -3
- package/es2017/AIMessageList/type.d.ts +25 -12
- package/esm/AIMessageList/components/footer/index.js +100 -74
- package/esm/AIMessageList/type.d.ts +25 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z as zhCN, A as App, _ as _object_spread, a as AntdMessage, M as Modal$1, b as AntdNotification, C as ConfigProvider, c as _extends, d as _object_destructuring_empty, j as jsx, e as _object_spread_props, f as jsxs, t as transform, S as StyleProvider, g as _sliced_to_array, T as Tooltip, h as Table$2, i as _to_consumable_array, P as Pagination$1, I as Icon, k as Select, l as CaretDownOutlined, m as _inherits, n as _create_super, o as _create_class, p as _class_call_check, q as _define_property, r as _assert_this_initialized, s as _async_to_generator, u as MinusOutlined, v as PlusOutlined, L as LeftOutlined, R as RightOutlined, w as __generator, x as Input, y as SearchOutlined, B as Spin, D as CloseOutlined, X, E as I, H, F as html2canvas$1, G as Remarkable, J as Drawer, K as HighlightJS, Z as ZoomInOutlined, N as DatePicker, O as Button, Q as l, U as Upload, V as cn, W as Popover, Y as DoubleRightOutlined, $ as CloseCircleFilled, a0 as
|
|
2
|
-
export { a2 as Affix, a3 as Alert, a4 as Anchor, a as AntdMessage, A as App, a5 as AutoComplete, a6 as Avatar, a8 as BackTop, a9 as Badge, aa as Breadcrumb, O as Button, ab as Calendar, ac as Card, ad as Carousel, ae as Cascader, af as Checkbox, ag as Col, ah as Collapse, N as DatePicker, ai as Descriptions,
|
|
1
|
+
import { z as zhCN, A as App, _ as _object_spread, a as AntdMessage, M as Modal$1, b as AntdNotification, C as ConfigProvider, c as _extends, d as _object_destructuring_empty, j as jsx, e as _object_spread_props, f as jsxs, t as transform, S as StyleProvider, g as _sliced_to_array, T as Tooltip, h as Table$2, i as _to_consumable_array, P as Pagination$1, I as Icon, k as Select, l as CaretDownOutlined, m as _inherits, n as _create_super, o as _create_class, p as _class_call_check, q as _define_property, r as _assert_this_initialized, s as _async_to_generator, u as MinusOutlined, v as PlusOutlined, L as LeftOutlined, R as RightOutlined, w as __generator, x as Input, y as SearchOutlined, B as Spin, D as CloseOutlined, X, E as I, H, F as html2canvas$1, G as Remarkable, J as Drawer, K as HighlightJS, Z as ZoomInOutlined, N as DatePicker, O as Button, Q as l, U as Upload, V as cn, W as Popover, Y as DoubleRightOutlined, $ as CloseCircleFilled, a0 as Divider, a1 as fetchEventSource } from './vendor.esm.es5.development.js';
|
|
2
|
+
export { a2 as Affix, a3 as Alert, a4 as Anchor, a as AntdMessage, A as App, a5 as AutoComplete, a6 as Avatar, a8 as BackTop, a9 as Badge, aa as Breadcrumb, O as Button, ab as Calendar, ac as Card, ad as Carousel, ae as Cascader, af as Checkbox, ag as Col, ah as Collapse, N as DatePicker, ai as Descriptions, a0 as Divider, J as Drawer, aj as Dropdown, ak as Empty, a7 as FloatButton, al as Form, am as Grid, an as Image, x as Input, ao as InputNumber, ap as Layout, aq as List, ar as Mentions, as as Menu, M as Modal, at as Popconfirm, W as Popover, au as Progress, aR as QRCode, av as Radio, aw as Rate, ax as Result, ay as Row, az as Segmented, k as Select, aA as Skeleton, aB as Slider, aC as Space, B as Spin, aD as Statistic, aE as Steps, aF as Switch, aG as Tabs, aH as Tag, aJ as TimePicker, aK as Timeline, T as Tooltip, aL as Tour, aM as Transfer, aN as Tree, aO as TreeSelect, aP as Typography, U as Upload, aQ as Watermark, aT as en_US, b as notification, aI as theme, aS as version, z as zh_CN } from './vendor.esm.es5.development.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { useState, useRef, useEffect, useLayoutEffect, forwardRef, useImperativeHandle, useCallback, useMemo } from 'react';
|
|
5
5
|
import { Fragment } from 'react/jsx-runtime';
|
|
@@ -15235,81 +15235,105 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15235
15235
|
sendMsgAjax();
|
|
15236
15236
|
};
|
|
15237
15237
|
var sendMsgAjax = function() {
|
|
15238
|
-
var
|
|
15239
|
-
|
|
15240
|
-
|
|
15241
|
-
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15254
|
-
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
|
-
|
|
15258
|
-
|
|
15259
|
-
|
|
15260
|
-
|
|
15261
|
-
|
|
15262
|
-
|
|
15263
|
-
|
|
15264
|
-
|
|
15265
|
-
|
|
15266
|
-
|
|
15267
|
-
|
|
15268
|
-
|
|
15269
|
-
|
|
15270
|
-
|
|
15271
|
-
|
|
15272
|
-
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
|
|
15278
|
-
|
|
15279
|
-
|
|
15280
|
-
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
|
|
15284
|
-
|
|
15285
|
-
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
|
|
15295
|
-
|
|
15296
|
-
|
|
15297
|
-
|
|
15298
|
-
|
|
15299
|
-
|
|
15300
|
-
|
|
15301
|
-
|
|
15302
|
-
|
|
15303
|
-
|
|
15304
|
-
|
|
15305
|
-
|
|
15306
|
-
|
|
15307
|
-
|
|
15238
|
+
var _ref = _async_to_generator(function() {
|
|
15239
|
+
var url, _sendMsgAjaxParams_method, method, _sendMsgAjaxParams_headers, headers, _sendMsgAjaxParams_params, params, _sendMsgAjaxParams_onOpen, onOpen, _sendMsgAjaxParams_onMessage, onMessage, _sendMsgAjaxParams_onClose, onClose, _sendMsgAjaxParams_onError, onError, _sendMsgAjaxParams_coverProps, coverProps, _sendMsgAjaxParams_beforeSendMsg, beforeSendMsg, msgId, createTime, msgContent, recordMsgObj, arg, beforeInfo;
|
|
15240
|
+
return __generator(this, function(_state) {
|
|
15241
|
+
switch(_state.label){
|
|
15242
|
+
case 0:
|
|
15243
|
+
url = sendMsgAjaxParams.url, _sendMsgAjaxParams_method = sendMsgAjaxParams.method, method = _sendMsgAjaxParams_method === void 0 ? "POST" : _sendMsgAjaxParams_method, _sendMsgAjaxParams_headers = sendMsgAjaxParams.headers, headers = _sendMsgAjaxParams_headers === void 0 ? {} : _sendMsgAjaxParams_headers, _sendMsgAjaxParams_params = sendMsgAjaxParams.params, params = _sendMsgAjaxParams_params === void 0 ? function() {
|
|
15244
|
+
return "";
|
|
15245
|
+
} : _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) {
|
|
15246
|
+
return ev;
|
|
15247
|
+
} : _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() {
|
|
15248
|
+
return Promise.resolve();
|
|
15249
|
+
} : _sendMsgAjaxParams_beforeSendMsg;
|
|
15250
|
+
ctrl.current = new AbortController();
|
|
15251
|
+
// apiRef
|
|
15252
|
+
console.log("apiRef", apiRef);
|
|
15253
|
+
msgId = "inputing";
|
|
15254
|
+
createTime = new Date().getTime();
|
|
15255
|
+
apiRef.contentApi.addMsg({
|
|
15256
|
+
id: msgId,
|
|
15257
|
+
createTime: createTime,
|
|
15258
|
+
content: "正在输入...",
|
|
15259
|
+
location: "left",
|
|
15260
|
+
reference: null,
|
|
15261
|
+
source: null
|
|
15262
|
+
});
|
|
15263
|
+
msgContent = "";
|
|
15264
|
+
setSending(true);
|
|
15265
|
+
setTextValue("");
|
|
15266
|
+
setReferencesSource(null);
|
|
15267
|
+
recordMsgObj = {};
|
|
15268
|
+
arg = [
|
|
15269
|
+
recordRef.current.value,
|
|
15270
|
+
recordRef.current.referencesSource,
|
|
15271
|
+
fileListRef.current ? fileListRef.current.getFileList() : []
|
|
15272
|
+
];
|
|
15273
|
+
return [
|
|
15274
|
+
4,
|
|
15275
|
+
beforeSendMsg.apply(void 0, _to_consumable_array(arg))
|
|
15276
|
+
];
|
|
15277
|
+
case 1:
|
|
15278
|
+
beforeInfo = _state.sent();
|
|
15279
|
+
fetchEventSource(url, _object_spread({
|
|
15280
|
+
method: method,
|
|
15281
|
+
headers: _object_spread({
|
|
15282
|
+
"Content-Type": "application/json",
|
|
15283
|
+
Accept: "text/event-stream,application/json"
|
|
15284
|
+
}, headers),
|
|
15285
|
+
body: params.apply(void 0, _to_consumable_array(arg).concat([
|
|
15286
|
+
beforeInfo
|
|
15287
|
+
])),
|
|
15288
|
+
openWhenHidden: true,
|
|
15289
|
+
signal: ctrl.current.signal,
|
|
15290
|
+
onopen: function(res) {
|
|
15291
|
+
onOpen(res);
|
|
15292
|
+
if (res.status === 200) ;
|
|
15293
|
+
return null;
|
|
15294
|
+
},
|
|
15295
|
+
onmessage: function(ev) {
|
|
15296
|
+
var data = onMessage(ev);
|
|
15297
|
+
msgContent += data.content;
|
|
15298
|
+
delete data.content;
|
|
15299
|
+
recordMsgObj = _object_spread({
|
|
15300
|
+
createTime: createTime,
|
|
15301
|
+
content: msgContent,
|
|
15302
|
+
location: "left",
|
|
15303
|
+
reference: null,
|
|
15304
|
+
source: null
|
|
15305
|
+
}, data);
|
|
15306
|
+
updateMsgRef.current = setTimeout(function() {
|
|
15307
|
+
apiRef.contentApi.updateMsg(msgId, recordMsgObj);
|
|
15308
|
+
msgId = data.id;
|
|
15309
|
+
}, 100);
|
|
15310
|
+
},
|
|
15311
|
+
onclose: function() {
|
|
15312
|
+
onClose();
|
|
15313
|
+
setSending(false);
|
|
15314
|
+
if (recordMsgObj.id) {
|
|
15315
|
+
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
15316
|
+
}
|
|
15317
|
+
console.log("onclose: ", recordMsgObj);
|
|
15318
|
+
},
|
|
15319
|
+
onerror: function(err) {
|
|
15320
|
+
onError(err);
|
|
15321
|
+
if (recordMsgObj.id) {
|
|
15322
|
+
apiRef.contentApi.recordMsg(recordMsgObj);
|
|
15323
|
+
}
|
|
15324
|
+
console.log("onerror: ", err);
|
|
15325
|
+
}
|
|
15326
|
+
}, coverProps));
|
|
15327
|
+
return [
|
|
15328
|
+
2
|
|
15329
|
+
];
|
|
15308
15330
|
}
|
|
15309
|
-
|
|
15310
|
-
|
|
15311
|
-
|
|
15312
|
-
|
|
15331
|
+
});
|
|
15332
|
+
});
|
|
15333
|
+
return function sendMsgAjax() {
|
|
15334
|
+
return _ref.apply(this, arguments);
|
|
15335
|
+
};
|
|
15336
|
+
}();
|
|
15313
15337
|
// 判断是否超出最大字数
|
|
15314
15338
|
var judegTextLengthWarn = function() {
|
|
15315
15339
|
if (typeof maxLength === "function") {
|