bhd-components 0.10.45 → 0.10.46
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/dist/index.esm.es5.development.js +15 -25
- package/dist/index.esm.es5.production.js +1 -1
- package/dist/vendor.esm.es5.development.js +1 -1
- package/dist/vendor.esm.es5.production.js +1 -1
- package/es2017/AIMessageList/components/virtuosoList/index.js +15 -25
- package/esm/AIMessageList/components/virtuosoList/index.js +15 -25
- package/package.json +1 -1
|
@@ -14902,8 +14902,6 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
14902
14902
|
loadMore: null,
|
|
14903
14903
|
scrollTimer: null
|
|
14904
14904
|
});
|
|
14905
|
-
var userScrolledUpRef = useRef(false);
|
|
14906
|
-
var isAutoScrollRef = useRef(true);
|
|
14907
14905
|
var wrapperRef = useRef(null);
|
|
14908
14906
|
var recordRef = useRef({
|
|
14909
14907
|
page: page,
|
|
@@ -14914,6 +14912,8 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
14914
14912
|
sendingId: ""
|
|
14915
14913
|
});
|
|
14916
14914
|
var timeRenderCache = useRef(new Map()).current;
|
|
14915
|
+
var autoScrollBottom = useRef(true);
|
|
14916
|
+
// const htmlRenderCache = useRef(new Map<string, React.ReactNode>()).current;
|
|
14917
14917
|
useImperativeHandle(ref, function() {
|
|
14918
14918
|
return {
|
|
14919
14919
|
addMsg: addMsg,
|
|
@@ -15008,6 +15008,9 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15008
15008
|
recordRef.current.dataSource = dataSource;
|
|
15009
15009
|
recordRef.current.maxPage = Math.ceil(total / pageSize);
|
|
15010
15010
|
recordRef.current.sendingId = sendingId;
|
|
15011
|
+
if (!sendingId) {
|
|
15012
|
+
autoScrollBottom.current = true;
|
|
15013
|
+
}
|
|
15011
15014
|
}, [
|
|
15012
15015
|
page,
|
|
15013
15016
|
pageSize,
|
|
@@ -15043,15 +15046,13 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15043
15046
|
scrollToBottom();
|
|
15044
15047
|
};
|
|
15045
15048
|
var scrollToBottom = function() {
|
|
15046
|
-
if (!virtuosoRef.current) return;
|
|
15049
|
+
if (!virtuosoRef.current || !autoScrollBottom.current) return;
|
|
15047
15050
|
timerRef.current.scrollTimer = setTimeout(function() {
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
});
|
|
15054
|
-
}
|
|
15051
|
+
virtuosoRef.current.scrollToIndex({
|
|
15052
|
+
index: "LAST",
|
|
15053
|
+
align: "end",
|
|
15054
|
+
behavior: "auto"
|
|
15055
|
+
});
|
|
15055
15056
|
}, 100);
|
|
15056
15057
|
};
|
|
15057
15058
|
var getData = function(page, pageSize) {
|
|
@@ -15496,20 +15497,9 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15496
15497
|
p[0].innerText = "复制代码";
|
|
15497
15498
|
}
|
|
15498
15499
|
};
|
|
15499
|
-
var
|
|
15500
|
-
|
|
15501
|
-
|
|
15502
|
-
var scrollHeight = element.scrollHeight;
|
|
15503
|
-
var clientHeight = element.clientHeight;
|
|
15504
|
-
// 如果距离底部小于30px,认为是底部,重新启用自动滚动
|
|
15505
|
-
var distanceToBottom = scrollHeight - scrollTop - clientHeight;
|
|
15506
|
-
if (distanceToBottom < 30) {
|
|
15507
|
-
userScrolledUpRef.current = false;
|
|
15508
|
-
isAutoScrollRef.current = true;
|
|
15509
|
-
} else {
|
|
15510
|
-
// 用户向上滚动,禁用自动滚动
|
|
15511
|
-
userScrolledUpRef.current = true;
|
|
15512
|
-
isAutoScrollRef.current = false;
|
|
15500
|
+
var onWheel = function() {
|
|
15501
|
+
if (recordRef.current.sendingId && recordRef.current.sendingId !== "inputing") {
|
|
15502
|
+
autoScrollBottom.current = false;
|
|
15513
15503
|
}
|
|
15514
15504
|
};
|
|
15515
15505
|
return /*#__PURE__*/ jsx("div", {
|
|
@@ -15538,7 +15528,7 @@ var VirtuosoList = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
15538
15528
|
},
|
|
15539
15529
|
increaseViewportBy: 200,
|
|
15540
15530
|
overscan: 10,
|
|
15541
|
-
|
|
15531
|
+
onWheel: onWheel
|
|
15542
15532
|
})
|
|
15543
15533
|
});
|
|
15544
15534
|
});
|