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.
@@ -28,7 +28,7 @@ const defaultFileUploadProps = {
28
28
  };
29
29
  const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
30
30
  let { footerConfig, prefix, errorCallback, apiRef } = props;
31
- let { placeholder = defaultProps.placeholder, className = defaultProps.className, maxLength = defaultProps.maxLength, renderAction, fileUpload, sendMsgAjaxParams, onClickStop = ()=>{}, conversionContent = (str)=>str, renderTopContent, inputingText = "正在输入...", canStopMessage = true, speed = 0 } = footerConfig;
31
+ let { placeholder = defaultProps.placeholder, className = defaultProps.className, maxLength = defaultProps.maxLength, renderAction, fileUpload, sendMsgAjaxParams, onClickStop = ()=>{}, conversionContent = (str)=>str, renderTopContent, inputingText = "正在输入...", canStopMessage = true, speed = 0, textAreaProps = {} } = footerConfig;
32
32
  if (speed < 0) {
33
33
  speed = 0;
34
34
  }
@@ -41,6 +41,7 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
41
41
  const ctrl = useRef(); //停止生成ai回答时使用
42
42
  const [textValue, setTextValue] = useState("");
43
43
  const [sending, setSending] = useState(false);
44
+ const [isFocus, setIsFocus] = useState(false);
44
45
  const [isDisabled, setIsDisabled] = useState(false);
45
46
  const [fileCanSending, setFileCanSending] = useState(true); // 是否允许发送 关联文件
46
47
  const updateMsgRef = useRef(null);
@@ -100,7 +101,8 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
100
101
  },
101
102
  setDisabled: (flag)=>{
102
103
  setIsDisabled(flag);
103
- }
104
+ },
105
+ setIsFocus
104
106
  }, fileListRef.current || {});
105
107
  });
106
108
  useEffect(()=>{
@@ -462,12 +464,12 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
462
464
  }
463
465
  };
464
466
  return /*#__PURE__*/ _jsxs("div", {
465
- className: `${getCls("footer")} ${className}`,
467
+ className: `${getCls("footer")} ${className} `,
466
468
  ref: footerDomRef,
467
469
  children: [
468
470
  renderTopContent && renderTopContent(),
469
471
  /*#__PURE__*/ _jsxs("div", {
470
- className: `${getCls("footerBody")} ${judegTextLengthWarn() ? getCls("footerBodyWarn") : ""}`,
472
+ className: `${getCls("footerBody")} ${judegTextLengthWarn() ? getCls("footerBodyWarn") : ""} ${isFocus ? getCls("footerBodyFocus") : ""}`,
471
473
  children: [
472
474
  fileUpload && /*#__PURE__*/ _jsx("div", {
473
475
  className: getCls("footerFile"),
@@ -487,7 +489,7 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
487
489
  /*#__PURE__*/ _jsxs("div", {
488
490
  className: getCls("footerInput"),
489
491
  children: [
490
- /*#__PURE__*/ _jsx(TextArea, {
492
+ /*#__PURE__*/ _jsx(TextArea, _object_spread({
491
493
  value: textValue,
492
494
  onChange: (e)=>{
493
495
  setTextValue(e.target.value);
@@ -497,8 +499,14 @@ const Footer = /*#__PURE__*/ forwardRef((props, ref)=>{
497
499
  minRows: 2,
498
500
  maxRows: 6
499
501
  },
500
- onPressEnter: onPressEnter
501
- }),
502
+ onPressEnter: onPressEnter,
503
+ onFocus: ()=>{
504
+ setIsFocus(true);
505
+ },
506
+ onBlur: ()=>{
507
+ setIsFocus(false);
508
+ }
509
+ }, textAreaProps)),
502
510
  /*#__PURE__*/ _jsx(References, {
503
511
  prefix: prefix,
504
512
  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%;
@@ -91,7 +91,8 @@ const remarkable = new Remarkable({
91
91
  return hljs.highlightAuto(str).value;
92
92
  } catch (err) {}
93
93
  return ""; // use external default escaping
94
- }
94
+ },
95
+ breaks: true
95
96
  });
96
97
  const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
97
98
  const { prefix, contentConfig, apiRef } = props;
@@ -99,7 +100,7 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
99
100
  "copy",
100
101
  "reference"
101
102
  ], coverRenderReferences, onRecordMessage = ()=>{}, onVoteChange = ()=>{}, onRefresh = ()=>{}, helloMsg, showTime = true, fileCustomRender = {}, // onSendedHelloMsg = () => {},
102
- onInit = ()=>{}, renderLoading } = contentConfig;
103
+ onInit = ()=>{}, renderLoading, renderItemBottom, renderItemTop, htmlStyle = "richText" } = contentConfig;
103
104
  const loadMoreProps = contentConfig.loadMore || true;
104
105
  const virtuosoRef = useRef(null);
105
106
  const [loading, setLoading] = useState(false); // 是否加载中
@@ -376,19 +377,21 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
376
377
  onMouseEnter: ()=>onMouseEnter(item),
377
378
  onMouseLeave: ()=>onMouseLeave(item),
378
379
  children: [
380
+ renderItemTop && renderItemTop(item),
379
381
  renderAction("floatTop", item),
380
382
  /*#__PURE__*/ _jsxs("div", {
381
383
  className: `${getCls("msgItem-content")}`,
382
384
  children: [
383
385
  /*#__PURE__*/ _jsx("div", {
384
- className: `${getCls("msgItem-text")}`,
386
+ className: `${htmlStyle === "richText" ? getCls("msgItem-text") : getCls("msgItem-text-aibody")}`,
385
387
  children: contentNode
386
388
  }),
387
389
  renderAction("bottom", item)
388
390
  ]
389
391
  }),
390
392
  item.location === "left" && renderAction("floatBottom", item),
391
- renderReference(item)
393
+ renderReference(item),
394
+ renderItemBottom && renderItemBottom(item)
392
395
  ]
393
396
  })
394
397
  });
@@ -625,6 +628,9 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
625
628
  };
626
629
  const markToHtml = (markStr, id)=>{
627
630
  let html = remarkable.render(markStr);
631
+ if (htmlStyle === "ai_body") {
632
+ html = html.replace(/<table/g, '<div class="ai-table-wrap"><table').replace(/<\/table>/g, '</table></div>');
633
+ }
628
634
  let position = 0;
629
635
  html = html.replace(new RegExp(`<pre`, "ig"), ()=>{
630
636
  position++;