bhd-components 0.11.13 → 0.11.15

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.
@@ -32,7 +32,7 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
32
32
  var footerConfig = props.footerConfig, prefix = props.prefix, errorCallback = props.errorCallback, apiRef = props.apiRef;
33
33
  var _footerConfig_placeholder = footerConfig.placeholder, placeholder = _footerConfig_placeholder === void 0 ? defaultProps.placeholder : _footerConfig_placeholder, _footerConfig_className = footerConfig.className, className = _footerConfig_className === void 0 ? defaultProps.className : _footerConfig_className, _footerConfig_maxLength = footerConfig.maxLength, maxLength = _footerConfig_maxLength === void 0 ? defaultProps.maxLength : _footerConfig_maxLength, renderAction = footerConfig.renderAction, fileUpload = footerConfig.fileUpload, sendMsgAjaxParams = footerConfig.sendMsgAjaxParams, _footerConfig_onClickStop = footerConfig.onClickStop, onClickStop = _footerConfig_onClickStop === void 0 ? function() {} : _footerConfig_onClickStop, _footerConfig_conversionContent = footerConfig.conversionContent, conversionContent = _footerConfig_conversionContent === void 0 ? function(str) {
34
34
  return str;
35
- } : _footerConfig_conversionContent, renderTopContent = footerConfig.renderTopContent, _footerConfig_inputingText = footerConfig.inputingText, inputingText = _footerConfig_inputingText === void 0 ? "正在输入..." : _footerConfig_inputingText, _footerConfig_canStopMessage = footerConfig.canStopMessage, canStopMessage = _footerConfig_canStopMessage === void 0 ? true : _footerConfig_canStopMessage, _footerConfig_speed = footerConfig.speed, speed = _footerConfig_speed === void 0 ? 0 : _footerConfig_speed;
35
+ } : _footerConfig_conversionContent, renderTopContent = footerConfig.renderTopContent, _footerConfig_inputingText = footerConfig.inputingText, inputingText = _footerConfig_inputingText === void 0 ? "正在输入..." : _footerConfig_inputingText, _footerConfig_canStopMessage = footerConfig.canStopMessage, canStopMessage = _footerConfig_canStopMessage === void 0 ? true : _footerConfig_canStopMessage, _footerConfig_speed = footerConfig.speed, speed = _footerConfig_speed === void 0 ? 0 : _footerConfig_speed, _footerConfig_textAreaProps = footerConfig.textAreaProps, textAreaProps = _footerConfig_textAreaProps === void 0 ? {} : _footerConfig_textAreaProps;
36
36
  if (speed < 0) {
37
37
  speed = 0;
38
38
  }
@@ -45,8 +45,9 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
45
45
  var ctrl = useRef(); //停止生成ai回答时使用
46
46
  var _useState = _sliced_to_array(useState(""), 2), textValue = _useState[0], setTextValue = _useState[1];
47
47
  var _useState1 = _sliced_to_array(useState(false), 2), sending = _useState1[0], setSending = _useState1[1];
48
- var _useState2 = _sliced_to_array(useState(false), 2), isDisabled = _useState2[0], setIsDisabled = _useState2[1];
49
- var _useState3 = _sliced_to_array(useState(true), 2), fileCanSending = _useState3[0], setFileCanSending = _useState3[1]; // 是否允许发送 关联文件
48
+ var _useState2 = _sliced_to_array(useState(false), 2), isFocus = _useState2[0], setIsFocus = _useState2[1];
49
+ var _useState3 = _sliced_to_array(useState(false), 2), isDisabled = _useState3[0], setIsDisabled = _useState3[1];
50
+ var _useState4 = _sliced_to_array(useState(true), 2), fileCanSending = _useState4[0], setFileCanSending = _useState4[1]; // 是否允许发送 关联文件
50
51
  var updateMsgRef = useRef(null);
51
52
  var canSendMsgRef = useRef(false);
52
53
  var recordFileList = useRef({
@@ -65,7 +66,7 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
65
66
  // source: undefined,
66
67
  // },
67
68
  // });
68
- var _useState4 = _sliced_to_array(useState(null), 2), referencesSource = _useState4[0], setReferencesSource = _useState4[1];
69
+ var _useState5 = _sliced_to_array(useState(null), 2), referencesSource = _useState5[0], setReferencesSource = _useState5[1];
69
70
  var recordRef = useRef({
70
71
  value: textValue,
71
72
  referencesSource: referencesSource,
@@ -104,7 +105,8 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
104
105
  },
105
106
  setDisabled: function(flag) {
106
107
  setIsDisabled(flag);
107
- }
108
+ },
109
+ setIsFocus: setIsFocus
108
110
  }, fileListRef.current || {});
109
111
  });
110
112
  useEffect(function() {
@@ -477,12 +479,12 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
477
479
  }
478
480
  };
479
481
  return /*#__PURE__*/ _jsxs("div", {
480
- className: "".concat(getCls("footer"), " ").concat(className),
482
+ className: "".concat(getCls("footer"), " ").concat(className, " "),
481
483
  ref: footerDomRef,
482
484
  children: [
483
485
  renderTopContent && renderTopContent(),
484
486
  /*#__PURE__*/ _jsxs("div", {
485
- className: "".concat(getCls("footerBody"), " ").concat(judegTextLengthWarn() ? getCls("footerBodyWarn") : ""),
487
+ className: "".concat(getCls("footerBody"), " ").concat(judegTextLengthWarn() ? getCls("footerBodyWarn") : "", " ").concat(isFocus ? getCls("footerBodyFocus") : ""),
486
488
  children: [
487
489
  fileUpload && /*#__PURE__*/ _jsx("div", {
488
490
  className: getCls("footerFile"),
@@ -503,7 +505,7 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
503
505
  /*#__PURE__*/ _jsxs("div", {
504
506
  className: getCls("footerInput"),
505
507
  children: [
506
- /*#__PURE__*/ _jsx(TextArea, {
508
+ /*#__PURE__*/ _jsx(TextArea, _object_spread({
507
509
  value: textValue,
508
510
  onChange: function(e) {
509
511
  setTextValue(e.target.value);
@@ -513,8 +515,14 @@ var Footer = /*#__PURE__*/ forwardRef(function(props, ref) {
513
515
  minRows: 2,
514
516
  maxRows: 6
515
517
  },
516
- onPressEnter: onPressEnter
517
- }),
518
+ onPressEnter: onPressEnter,
519
+ onFocus: function() {
520
+ setIsFocus(true);
521
+ },
522
+ onBlur: function() {
523
+ setIsFocus(false);
524
+ }
525
+ }, textAreaProps)),
518
526
  /*#__PURE__*/ _jsx(References, {
519
527
  prefix: prefix,
520
528
  referencesSource: referencesSource,
@@ -11,6 +11,9 @@
11
11
  &.footerBodyWarn {
12
12
  border-color: #f4523b;
13
13
  }
14
+ &.footerBodyFocus{
15
+
16
+ }
14
17
 
15
18
  .footerFile {
16
19
  width: 100%;
@@ -95,7 +95,8 @@ var remarkable = new Remarkable({
95
95
  return hljs.highlightAuto(str).value;
96
96
  } catch (err) {}
97
97
  return ""; // use external default escaping
98
- }
98
+ },
99
+ breaks: true
99
100
  });
100
101
  var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
101
102
  var prefix = props.prefix, contentConfig = props.contentConfig, apiRef = props.apiRef;
@@ -103,7 +104,7 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
103
104
  "copy",
104
105
  "reference"
105
106
  ] : _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_showTime = contentConfig.showTime, showTime = _contentConfig_showTime === void 0 ? true : _contentConfig_showTime, _contentConfig_fileCustomRender = contentConfig.fileCustomRender, fileCustomRender = _contentConfig_fileCustomRender === void 0 ? {} : _contentConfig_fileCustomRender, _contentConfig_onInit = contentConfig.// onSendedHelloMsg = () => {},
106
- onInit, onInit = _contentConfig_onInit === void 0 ? function() {} : _contentConfig_onInit, renderLoading = contentConfig.renderLoading;
107
+ onInit, onInit = _contentConfig_onInit === void 0 ? function() {} : _contentConfig_onInit, renderLoading = contentConfig.renderLoading, renderItemBottom = contentConfig.renderItemBottom, renderItemTop = contentConfig.renderItemTop, _contentConfig_htmlStyle = contentConfig.htmlStyle, htmlStyle = _contentConfig_htmlStyle === void 0 ? "richText" : _contentConfig_htmlStyle;
107
108
  var loadMoreProps = contentConfig.loadMore || true;
108
109
  var virtuosoRef = useRef(null);
109
110
  var _useState = _sliced_to_array(useState(false), 2), loading = _useState[0], setLoading = _useState[1]; // 是否加载中
@@ -384,19 +385,21 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
384
385
  return onMouseLeave(item);
385
386
  },
386
387
  children: [
388
+ renderItemTop && renderItemTop(item),
387
389
  renderAction("floatTop", item),
388
390
  /*#__PURE__*/ _jsxs("div", {
389
391
  className: "".concat(getCls("msgItem-content")),
390
392
  children: [
391
393
  /*#__PURE__*/ _jsx("div", {
392
- className: "".concat(getCls("msgItem-text")),
394
+ className: "".concat(htmlStyle === "richText" ? getCls("msgItem-text") : getCls("msgItem-text-aibody")),
393
395
  children: contentNode
394
396
  }),
395
397
  renderAction("bottom", item)
396
398
  ]
397
399
  }),
398
400
  item.location === "left" && renderAction("floatBottom", item),
399
- renderReference(item)
401
+ renderReference(item),
402
+ renderItemBottom && renderItemBottom(item)
400
403
  ]
401
404
  })
402
405
  });
@@ -637,6 +640,9 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
637
640
  };
638
641
  var markToHtml = function(markStr, id) {
639
642
  var html = remarkable.render(markStr);
643
+ if (htmlStyle === "ai_body") {
644
+ html = html.replace(/<table/g, '<div class="ai-table-wrap"><table').replace(/<\/table>/g, "</table></div>");
645
+ }
640
646
  var position = 0;
641
647
  html = html.replace(new RegExp("<pre", "ig"), function() {
642
648
  position++;