pb-sxp-ui 1.19.9 → 1.19.10
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.cjs +67 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +67 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +4 -4
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +67 -2
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +4 -4
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/index.js +4 -2
- package/es/core/hooks/useVisibleHeight.d.ts +1 -0
- package/es/core/hooks/useVisibleHeight.js +52 -0
- package/lib/core/components/SxpPageRender/index.js +4 -2
- package/lib/core/hooks/useVisibleHeight.d.ts +1 -0
- package/lib/core/hooks/useVisibleHeight.js +56 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18978,6 +18978,70 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
|
|
|
18978
18978
|
};
|
|
18979
18979
|
var NavBack$1 = memo(NavBack);
|
|
18980
18980
|
|
|
18981
|
+
const useVisibleHeight = () => {
|
|
18982
|
+
const [visibleHeight, setVisibleHeight] = useState(0);
|
|
18983
|
+
const getVisibleContentHeight = () => {
|
|
18984
|
+
// 方法优先级:
|
|
18985
|
+
// 1. visualViewport.height (最准确)
|
|
18986
|
+
// 2. window.innerHeight (次之)
|
|
18987
|
+
// 3. document.documentElement.clientHeight (fallback)
|
|
18988
|
+
if (typeof window === 'undefined')
|
|
18989
|
+
return 0;
|
|
18990
|
+
let height = window.innerHeight;
|
|
18991
|
+
// 优先使用 visualViewport
|
|
18992
|
+
if (window.visualViewport) {
|
|
18993
|
+
height = window.visualViewport.height;
|
|
18994
|
+
}
|
|
18995
|
+
// 验证高度合理性
|
|
18996
|
+
if (height <= 0 || height > window.screen.height) {
|
|
18997
|
+
height = window.innerHeight;
|
|
18998
|
+
}
|
|
18999
|
+
// 最终 fallback
|
|
19000
|
+
if (height <= 0) {
|
|
19001
|
+
height = document.documentElement.clientHeight;
|
|
19002
|
+
}
|
|
19003
|
+
return height;
|
|
19004
|
+
};
|
|
19005
|
+
const updateHeight = useCallback(() => {
|
|
19006
|
+
const height = getVisibleContentHeight();
|
|
19007
|
+
setVisibleHeight(height);
|
|
19008
|
+
}, []);
|
|
19009
|
+
useEffect(() => {
|
|
19010
|
+
// 初始计算
|
|
19011
|
+
updateHeight();
|
|
19012
|
+
// 事件监听
|
|
19013
|
+
const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
|
|
19014
|
+
events.forEach((event) => {
|
|
19015
|
+
window.addEventListener(event, updateHeight);
|
|
19016
|
+
});
|
|
19017
|
+
// visualViewport 监听(最重要)
|
|
19018
|
+
if (window.visualViewport) {
|
|
19019
|
+
window.visualViewport.addEventListener('resize', updateHeight);
|
|
19020
|
+
window.visualViewport.addEventListener('scroll', updateHeight);
|
|
19021
|
+
}
|
|
19022
|
+
// 键盘弹出/收起监听(移动端重要)
|
|
19023
|
+
if ('virtualKeyboard' in navigator) {
|
|
19024
|
+
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
19025
|
+
}
|
|
19026
|
+
// 定期检查(应对某些特殊情况)
|
|
19027
|
+
const interval = setInterval(updateHeight, 1000);
|
|
19028
|
+
return () => {
|
|
19029
|
+
events.forEach((event) => {
|
|
19030
|
+
window.removeEventListener(event, updateHeight);
|
|
19031
|
+
});
|
|
19032
|
+
if (window.visualViewport) {
|
|
19033
|
+
window.visualViewport.removeEventListener('resize', updateHeight);
|
|
19034
|
+
window.visualViewport.removeEventListener('scroll', updateHeight);
|
|
19035
|
+
}
|
|
19036
|
+
if ('virtualKeyboard' in navigator) {
|
|
19037
|
+
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
19038
|
+
}
|
|
19039
|
+
clearInterval(interval);
|
|
19040
|
+
};
|
|
19041
|
+
}, [updateHeight]);
|
|
19042
|
+
return visibleHeight;
|
|
19043
|
+
};
|
|
19044
|
+
|
|
18981
19045
|
/*
|
|
18982
19046
|
* @Author: binruan@chatlabs.com
|
|
18983
19047
|
* @Date: 2024-03-20 10:27:31
|
|
@@ -19006,6 +19070,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19006
19070
|
const fbcRef = useRef('');
|
|
19007
19071
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData, bffFbReport, curTime, h5EnterLink, isShowConsent, selectTag, isPreview, isEditor, cacheRtcList, setRtcList, cacheActiveIndex, rtcList, isNoMoreData, channel, refreshFeSession, isDiyH5, pixelPvStatusRef } = useSxpDataSource();
|
|
19008
19072
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
|
19073
|
+
const visibleHeight = useVisibleHeight();
|
|
19009
19074
|
const isShowFingerTip = useMemo(() => {
|
|
19010
19075
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
|
19011
19076
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
|
@@ -19190,8 +19255,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19190
19255
|
return safeAreaBottom;
|
|
19191
19256
|
};
|
|
19192
19257
|
const height = useMemo(() => {
|
|
19193
|
-
return
|
|
19194
|
-
}, [minusHeight,
|
|
19258
|
+
return visibleHeight - minusHeight - tagHeight;
|
|
19259
|
+
}, [minusHeight, visibleHeight, tagHeight]);
|
|
19195
19260
|
const visList = useMemo(() => {
|
|
19196
19261
|
var _a;
|
|
19197
19262
|
const list = activeIndex === 0 && !waterFallData && !isEditor && !isDiyH5
|