bhd-components 0.10.4 → 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.
@@ -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 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';
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 fetchEventSource, a1 as Divider } 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, a1 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';
@@ -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, {
@@ -15235,105 +15244,89 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
15235
15244
  sendMsgAjax();
15236
15245
  };
15237
15246
  var sendMsgAjax = function() {
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
- ];
15247
+ 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 ? {} : _sendMsgAjaxParams_headers, _sendMsgAjaxParams_params = sendMsgAjaxParams.params, params = _sendMsgAjaxParams_params === void 0 ? function() {
15248
+ return "";
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) {
15250
+ return ev;
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;
15254
+ ctrl.current = new AbortController();
15255
+ // apiRef
15256
+ console.log("apiRef", apiRef);
15257
+ var msgId = "inputing";
15258
+ var createTime = new Date().getTime();
15259
+ apiRef.contentApi.addMsg({
15260
+ id: msgId,
15261
+ createTime: createTime,
15262
+ content: "正在输入...",
15263
+ location: "left",
15264
+ reference: null,
15265
+ source: null
15266
+ });
15267
+ var msgContent = "";
15268
+ setSending(true);
15269
+ setTextValue("");
15270
+ setReferencesSource(null);
15271
+ var recordMsgObj = {};
15272
+ var arg = [
15273
+ recordRef.current.value,
15274
+ recordRef.current.referencesSource,
15275
+ fileListRef.current ? fileListRef.current.getFileList() : []
15276
+ ];
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);
15330
15324
  }
15331
- });
15325
+ }, coverProps));
15326
+ }).catch(function() {
15327
+ stopMessage();
15332
15328
  });
15333
- return function sendMsgAjax() {
15334
- return _ref.apply(this, arguments);
15335
- };
15336
- }();
15329
+ };
15337
15330
  // 判断是否超出最大字数
15338
15331
  var judegTextLengthWarn = function() {
15339
15332
  if (typeof maxLength === "function") {