bhd-components 0.11.15 → 0.11.16

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.
@@ -69,13 +69,13 @@ const Header = ({ context })=>{
69
69
  });
70
70
  if (isInitLoad) {
71
71
  if (renderLoading) {
72
- let node = renderLoading("init");
72
+ let node = renderLoading("init", initLoadNode, loadMoreNode);
73
73
  if (node) return node;
74
74
  }
75
75
  return initLoadNode;
76
76
  }
77
77
  if (renderLoading) {
78
- let node = renderLoading("loadMore");
78
+ let node = renderLoading("loadMore", initLoadNode, loadMoreNode);
79
79
  if (node) return node;
80
80
  }
81
81
  return loadMoreNode;
@@ -100,7 +100,7 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
100
100
  "copy",
101
101
  "reference"
102
102
  ], coverRenderReferences, onRecordMessage = ()=>{}, onVoteChange = ()=>{}, onRefresh = ()=>{}, helloMsg, showTime = true, fileCustomRender = {}, // onSendedHelloMsg = () => {},
103
- onInit = ()=>{}, renderLoading, renderItemBottom, renderItemTop, htmlStyle = "richText" } = contentConfig;
103
+ onInit = ()=>{}, renderLoading, renderItemBottom, renderItemTop, htmlStyle = "richText", scrollOffset = 0, renderVirtuosoFooter = ()=>null } = contentConfig;
104
104
  const loadMoreProps = contentConfig.loadMore || true;
105
105
  const virtuosoRef = useRef(null);
106
106
  const [loading, setLoading] = useState(false); // 是否加载中
@@ -279,7 +279,8 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
279
279
  virtuosoRef.current.scrollToIndex({
280
280
  index: "LAST",
281
281
  align: "end",
282
- behavior: "auto"
282
+ behavior: "auto",
283
+ offset: scrollOffset
283
284
  });
284
285
  }, 100);
285
286
  }
@@ -629,7 +630,7 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
629
630
  const markToHtml = (markStr, id)=>{
630
631
  let html = remarkable.render(markStr);
631
632
  if (htmlStyle === "ai_body") {
632
- html = html.replace(/<table/g, '<div class="ai-table-wrap"><table').replace(/<\/table>/g, '</table></div>');
633
+ html = html.replace(/<table/g, '<div class="ai-table-wrap"><table').replace(/<\/table>/g, "</table></div>");
633
634
  }
634
635
  let position = 0;
635
636
  html = html.replace(new RegExp(`<pre`, "ig"), ()=>{
@@ -804,11 +805,14 @@ const VirtuosoList = /*#__PURE__*/ forwardRef((props, ref)=>{
804
805
  loading,
805
806
  prefix,
806
807
  isInitLoad,
807
- renderLoading
808
+ renderLoading,
809
+ isSending,
810
+ dataSource
808
811
  },
809
812
  itemContent: itemContent,
810
813
  components: {
811
- Header: Header
814
+ Header: Header,
815
+ Footer: renderVirtuosoFooter
812
816
  },
813
817
  increaseViewportBy: 200,
814
818
  overscan: 10,
@@ -538,6 +538,7 @@
538
538
  /* 表格 */
539
539
  .ai-table-wrap {
540
540
  margin-top: 12px;
541
+ margin-bottom: 12px;
541
542
  overflow-x: auto;
542
543
  border: 1px solid rgba(120, 161, 138, 0.12);
543
544
  border-radius: 10px;
@@ -579,6 +580,7 @@
579
580
  border-radius: 10px;
580
581
  padding: 14px 16px;
581
582
  margin-top: 10px;
583
+ margin-bottom: 10px;
582
584
  overflow-x: auto;
583
585
  }
584
586
  pre code {
@@ -81,9 +81,20 @@ export interface contentConfigProps {
81
81
  renderLoading?: (type:"init"|"loadMore",initLoadNode:React.ReactNode,loadMoreNode:React.ReactNode) => React.ReactNode;
82
82
  renderItemBottom?: (item: dataItemType) => React.ReactNode;
83
83
  renderItemTop?: (item: dataItemType) => React.ReactNode;
84
+ scrollOffset?: number;
85
+ renderVirtuosoFooter?: (props:{context:ContextProps} ) => React.ReactNode;
84
86
 
85
87
  }
86
88
 
89
+ export interface ContextProps{
90
+ loading: boolean;
91
+ prefix: string;
92
+ isInitLoad: boolean;
93
+ renderLoading: (type: "init" | "loadMore",initLoadNode:React.ReactNode,loadMoreNode:React.ReactNode) => React.ReactNode;
94
+ isSending:boolean;
95
+ dataSource:dataItemType[]
96
+ }
97
+
87
98
  // content props
88
99
 
89
100
  export interface contentProps {
@@ -73,13 +73,13 @@ var Header = function(param) {
73
73
  });
74
74
  if (isInitLoad) {
75
75
  if (renderLoading) {
76
- var node = renderLoading("init");
76
+ var node = renderLoading("init", initLoadNode, loadMoreNode);
77
77
  if (node) return node;
78
78
  }
79
79
  return initLoadNode;
80
80
  }
81
81
  if (renderLoading) {
82
- var node1 = renderLoading("loadMore");
82
+ var node1 = renderLoading("loadMore", initLoadNode, loadMoreNode);
83
83
  if (node1) return node1;
84
84
  }
85
85
  return loadMoreNode;
@@ -104,7 +104,9 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
104
104
  "copy",
105
105
  "reference"
106
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 = () => {},
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
+ 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, _contentConfig_scrollOffset = contentConfig.scrollOffset, scrollOffset = _contentConfig_scrollOffset === void 0 ? 0 : _contentConfig_scrollOffset, _contentConfig_renderVirtuosoFooter = contentConfig.renderVirtuosoFooter, renderVirtuosoFooter = _contentConfig_renderVirtuosoFooter === void 0 ? function() {
108
+ return null;
109
+ } : _contentConfig_renderVirtuosoFooter;
108
110
  var loadMoreProps = contentConfig.loadMore || true;
109
111
  var virtuosoRef = useRef(null);
110
112
  var _useState = _sliced_to_array(useState(false), 2), loading = _useState[0], setLoading = _useState[1]; // 是否加载中
@@ -282,7 +284,8 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
282
284
  virtuosoRef.current.scrollToIndex({
283
285
  index: "LAST",
284
286
  align: "end",
285
- behavior: "auto"
287
+ behavior: "auto",
288
+ offset: scrollOffset
286
289
  });
287
290
  }, 100);
288
291
  }
@@ -785,11 +788,14 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
785
788
  loading: loading,
786
789
  prefix: prefix,
787
790
  isInitLoad: isInitLoad,
788
- renderLoading: renderLoading
791
+ renderLoading: renderLoading,
792
+ isSending: isSending,
793
+ dataSource: dataSource
789
794
  },
790
795
  itemContent: itemContent,
791
796
  components: {
792
- Header: Header
797
+ Header: Header,
798
+ Footer: renderVirtuosoFooter
793
799
  },
794
800
  increaseViewportBy: 200,
795
801
  overscan: 10,
@@ -538,6 +538,7 @@
538
538
  /* 表格 */
539
539
  .ai-table-wrap {
540
540
  margin-top: 12px;
541
+ margin-bottom: 12px;
541
542
  overflow-x: auto;
542
543
  border: 1px solid rgba(120, 161, 138, 0.12);
543
544
  border-radius: 10px;
@@ -579,6 +580,7 @@
579
580
  border-radius: 10px;
580
581
  padding: 14px 16px;
581
582
  margin-top: 10px;
583
+ margin-bottom: 10px;
582
584
  overflow-x: auto;
583
585
  }
584
586
  pre code {
@@ -81,9 +81,20 @@ export interface contentConfigProps {
81
81
  renderLoading?: (type:"init"|"loadMore",initLoadNode:React.ReactNode,loadMoreNode:React.ReactNode) => React.ReactNode;
82
82
  renderItemBottom?: (item: dataItemType) => React.ReactNode;
83
83
  renderItemTop?: (item: dataItemType) => React.ReactNode;
84
+ scrollOffset?: number;
85
+ renderVirtuosoFooter?: (props:{context:ContextProps} ) => React.ReactNode;
84
86
 
85
87
  }
86
88
 
89
+ export interface ContextProps{
90
+ loading: boolean;
91
+ prefix: string;
92
+ isInitLoad: boolean;
93
+ renderLoading: (type: "init" | "loadMore",initLoadNode:React.ReactNode,loadMoreNode:React.ReactNode) => React.ReactNode;
94
+ isSending:boolean;
95
+ dataSource:dataItemType[]
96
+ }
97
+
87
98
  // content props
88
99
 
89
100
  export interface contentProps {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhd-components",
3
- "version": "0.11.15",
3
+ "version": "0.11.16",
4
4
  "description": "组件功能描述",
5
5
  "config": {
6
6
  "commitizen": {