pb-sxp-ui 1.19.16 → 1.19.18
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 +59 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3 -11
- package/dist/index.js +59 -121
- 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 +59 -121
- 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 +7 -31
- package/es/core/hooks/useVisibleHeight.js +26 -88
- package/lib/core/components/SxpPageRender/index.js +7 -31
- package/lib/core/hooks/useVisibleHeight.js +26 -88
- package/package.json +1 -2
package/dist/index.css
CHANGED
|
@@ -63,11 +63,7 @@ a:active {
|
|
|
63
63
|
color: #000;
|
|
64
64
|
outline: none;
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
:root {
|
|
68
|
-
--safe-area-inset-bottom: constant(safe-area-inset-bottom);
|
|
69
|
-
--safe-area-inset-bottom: env(safe-area-inset-bottom);
|
|
70
|
-
}
|
|
66
|
+
|
|
71
67
|
.pb-appoint-form {
|
|
72
68
|
position: relative;
|
|
73
69
|
height: 100%;
|
|
@@ -1073,10 +1069,7 @@ a:active {
|
|
|
1073
1069
|
flex: 1;
|
|
1074
1070
|
height: 100vh;
|
|
1075
1071
|
overflow-y: auto;
|
|
1076
|
-
padding
|
|
1077
|
-
padding-left: 18px;
|
|
1078
|
-
padding-right: 18px;
|
|
1079
|
-
padding-bottom: calc(18px + var(--safe-area-inset-bottom, 0px));
|
|
1072
|
+
padding: 18px;
|
|
1080
1073
|
}
|
|
1081
1074
|
.waterfallFlow__title {
|
|
1082
1075
|
text-align: center;
|
|
@@ -1555,7 +1548,6 @@ a:active {
|
|
|
1555
1548
|
top: 0;
|
|
1556
1549
|
left: 0;
|
|
1557
1550
|
right: 0;
|
|
1558
|
-
bottom: var(--safe-area-inset-bottom, 0px);
|
|
1559
1551
|
width: 100%;
|
|
1560
1552
|
-webkit-box-sizing: border-box;
|
|
1561
1553
|
box-sizing: border-box;
|
|
@@ -2467,7 +2459,7 @@ button.swiper-pagination-bullet {
|
|
|
2467
2459
|
left: 0;
|
|
2468
2460
|
top: 0;
|
|
2469
2461
|
right: 0;
|
|
2470
|
-
bottom:
|
|
2462
|
+
bottom: 0;
|
|
2471
2463
|
z-index: 100;
|
|
2472
2464
|
-webkit-box-orient: vertical;
|
|
2473
2465
|
-webkit-box-direction: normal;
|
package/dist/index.js
CHANGED
|
@@ -18979,98 +18979,64 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
|
|
|
18979
18979
|
var NavBack$1 = memo(NavBack);
|
|
18980
18980
|
|
|
18981
18981
|
const useVisibleHeight = () => {
|
|
18982
|
-
var _a, _b;
|
|
18983
18982
|
const [visibleHeight, setVisibleHeight] = useState(0);
|
|
18984
|
-
const
|
|
18985
|
-
|
|
18986
|
-
|
|
18987
|
-
|
|
18988
|
-
|
|
18989
|
-
|
|
18990
|
-
|
|
18991
|
-
|
|
18992
|
-
|
|
18993
|
-
|
|
18994
|
-
|
|
18995
|
-
|
|
18996
|
-
|
|
18997
|
-
|
|
18998
|
-
|
|
18999
|
-
|
|
19000
|
-
|
|
19001
|
-
|
|
19002
|
-
|
|
19003
|
-
|
|
19004
|
-
|
|
19005
|
-
document.body.appendChild(detector);
|
|
19006
|
-
const dvhInPx = detector.clientHeight;
|
|
19007
|
-
document.body.removeChild(detector);
|
|
19008
|
-
return dvhInPx;
|
|
19009
|
-
};
|
|
19010
|
-
const getFillAvailableInPx = () => {
|
|
19011
|
-
const detector = document.createElement('div');
|
|
19012
|
-
detector.style.position = 'fixed';
|
|
19013
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
19014
|
-
detector.style.left = '0';
|
|
19015
|
-
detector.style.height = '-webkit-fill-available';
|
|
19016
|
-
detector.style.visibility = 'hidden';
|
|
19017
|
-
detector.style.zIndex = '-1';
|
|
19018
|
-
document.body.appendChild(detector);
|
|
19019
|
-
const dvhInPx = detector.clientHeight;
|
|
19020
|
-
document.body.removeChild(detector);
|
|
19021
|
-
return dvhInPx;
|
|
19022
|
-
};
|
|
19023
|
-
const getHeightWithSafeArea = () => {
|
|
19024
|
-
const root = document.documentElement;
|
|
19025
|
-
const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
|
|
19026
|
-
// 处理可能的值(可能是 '0px', '34px' 等)
|
|
19027
|
-
const numericValue = parseInt(value) || 0;
|
|
19028
|
-
return numericValue;
|
|
19029
|
-
};
|
|
19030
|
-
const dvhToPx = (dvh) => {
|
|
19031
|
-
return Math.round((dvh / 100) * document.documentElement.clientHeight);
|
|
19032
|
-
};
|
|
19033
|
-
const systemInfo = {
|
|
19034
|
-
visualViewport: (_a = window.visualViewport) === null || _a === void 0 ? void 0 : _a.height,
|
|
19035
|
-
innerHeight: window.innerHeight,
|
|
19036
|
-
clientHeight: document.documentElement.clientHeight,
|
|
19037
|
-
screenHeight: window.screen.height,
|
|
19038
|
-
bodyHeight: (_b = document === null || document === void 0 ? void 0 : document.body) === null || _b === void 0 ? void 0 : _b.clientHeight,
|
|
19039
|
-
agent: navigator.userAgent,
|
|
19040
|
-
version: '1.19.16',
|
|
19041
|
-
safeArea: getHeightWithSafeArea(),
|
|
19042
|
-
dvh: dvhToPx(100),
|
|
19043
|
-
dvhInPx: getDvhInPx(),
|
|
19044
|
-
vhInPx: getVhInPx(),
|
|
19045
|
-
fillAvailableInPx: getFillAvailableInPx()
|
|
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;
|
|
19046
19004
|
};
|
|
19047
|
-
console.log(systemInfo, 'fundebug-init--------------------->systemInfo');
|
|
19048
|
-
if ('fundebug' in window) {
|
|
19049
|
-
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'init', { metaData: { systemInfo, otherInfo: {} } });
|
|
19050
|
-
}
|
|
19051
19005
|
const updateHeight = useCallback(() => {
|
|
19052
|
-
var _a
|
|
19053
|
-
const
|
|
19054
|
-
|
|
19055
|
-
|
|
19056
|
-
|
|
19057
|
-
|
|
19058
|
-
|
|
19059
|
-
|
|
19060
|
-
|
|
19061
|
-
|
|
19062
|
-
|
|
19063
|
-
|
|
19064
|
-
|
|
19065
|
-
|
|
19066
|
-
|
|
19067
|
-
|
|
19006
|
+
var _a;
|
|
19007
|
+
const visibleHeight = getVisibleContentHeight();
|
|
19008
|
+
const screenHeight = (_a = window.screen) === null || _a === void 0 ? void 0 : _a.height;
|
|
19009
|
+
const ua = navigator.userAgent;
|
|
19010
|
+
// Instagram 检测
|
|
19011
|
+
const isInstagram = /Instagram/i.test(ua);
|
|
19012
|
+
// Facebook 检测
|
|
19013
|
+
const isFacebook = /FBAV|FBAN|FBSN/i.test(ua);
|
|
19014
|
+
// 安全检查
|
|
19015
|
+
if (!screenHeight || visibleHeight <= 0 || (!isInstagram && !isFacebook)) {
|
|
19016
|
+
setVisibleHeight(visibleHeight);
|
|
19017
|
+
return;
|
|
19018
|
+
}
|
|
19019
|
+
const ratio = visibleHeight / screenHeight;
|
|
19020
|
+
const threshold = 0.9;
|
|
19021
|
+
const h = screenHeight >= 900 ? screenHeight * 0.8 : screenHeight * 0.79;
|
|
19022
|
+
// 当内容高度占屏幕高度90%以上时,使用按比例计算的高度
|
|
19023
|
+
// 否则使用实际内容高度
|
|
19024
|
+
const finalHeight = Math.round(ratio >= threshold ? h : visibleHeight);
|
|
19068
19025
|
if ('fundebug' in window) {
|
|
19026
|
+
const systemInfo = {
|
|
19027
|
+
ratio,
|
|
19028
|
+
h,
|
|
19029
|
+
finalHeight,
|
|
19030
|
+
visibleHeight,
|
|
19031
|
+
screenHeight,
|
|
19032
|
+
isInstagram,
|
|
19033
|
+
isFacebook,
|
|
19034
|
+
ua
|
|
19035
|
+
};
|
|
19069
19036
|
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
19070
19037
|
}
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
}, [getHeightWithSafeArea, dvhToPx, getDvhInPx, getVhInPx, getFillAvailableInPx]);
|
|
19038
|
+
setVisibleHeight(finalHeight);
|
|
19039
|
+
}, [getVisibleContentHeight]);
|
|
19074
19040
|
useEffect(() => {
|
|
19075
19041
|
// 初始计算
|
|
19076
19042
|
updateHeight();
|
|
@@ -19088,8 +19054,6 @@ const useVisibleHeight = () => {
|
|
|
19088
19054
|
if ('virtualKeyboard' in navigator) {
|
|
19089
19055
|
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
19090
19056
|
}
|
|
19091
|
-
// 定期检查(应对某些特殊情况)
|
|
19092
|
-
const interval = setInterval(updateHeight, 1000);
|
|
19093
19057
|
return () => {
|
|
19094
19058
|
events.forEach((event) => {
|
|
19095
19059
|
window.removeEventListener(event, updateHeight);
|
|
@@ -19101,7 +19065,6 @@ const useVisibleHeight = () => {
|
|
|
19101
19065
|
if ('virtualKeyboard' in navigator) {
|
|
19102
19066
|
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
19103
19067
|
}
|
|
19104
|
-
clearInterval(interval);
|
|
19105
19068
|
};
|
|
19106
19069
|
}, [updateHeight]);
|
|
19107
19070
|
return visibleHeight;
|
|
@@ -19115,7 +19078,7 @@ const useVisibleHeight = () => {
|
|
|
19115
19078
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
|
19116
19079
|
*
|
|
19117
19080
|
*/
|
|
19118
|
-
const SxpPageRender = ({ globalConfig, descStyle, containerHeight
|
|
19081
|
+
const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidth = window.innerWidth, tempMap, resolver, data = [], ctaType, tipText, nudge, _schema, hashTagStyle, hashTagRightMargin, tagList = [], defaultData }) => {
|
|
19119
19082
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
19120
19083
|
const mutedIcon = useIconLink('/pb_static/5beaaa5ce7f3477b99db3838619cc471.png');
|
|
19121
19084
|
const unmutedIcon = useIconLink('/pb_static/fea8668a8a894e4aa3a86bcc775e895e.png');
|
|
@@ -19304,29 +19267,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19304
19267
|
}
|
|
19305
19268
|
return minusHeight;
|
|
19306
19269
|
}, [globalConfig]);
|
|
19307
|
-
const getHeightWithSafeArea = () => {
|
|
19308
|
-
const root = document.documentElement;
|
|
19309
|
-
const value = getComputedStyle(root).getPropertyValue('--safe-area-inset-bottom');
|
|
19310
|
-
// 处理可能的值(可能是 '0px', '34px' 等)
|
|
19311
|
-
const numericValue = parseInt(value) || 0;
|
|
19312
|
-
return numericValue;
|
|
19313
|
-
};
|
|
19314
|
-
const getDvhInPx = () => {
|
|
19315
|
-
const detector = document.createElement('div');
|
|
19316
|
-
detector.style.position = 'fixed';
|
|
19317
|
-
detector.style.bottom = `${getHeightWithSafeArea()}px`;
|
|
19318
|
-
detector.style.left = '0';
|
|
19319
|
-
detector.style.height = '100dvh';
|
|
19320
|
-
detector.style.visibility = 'hidden';
|
|
19321
|
-
detector.style.zIndex = '-1';
|
|
19322
|
-
document.body.appendChild(detector);
|
|
19323
|
-
const dvhInPx = detector.clientHeight;
|
|
19324
|
-
document.body.removeChild(detector);
|
|
19325
|
-
return dvhInPx;
|
|
19326
|
-
};
|
|
19327
19270
|
const height = useMemo(() => {
|
|
19328
|
-
|
|
19329
|
-
|
|
19271
|
+
const h = containerHeight || visibleHeight;
|
|
19272
|
+
return h - minusHeight - tagHeight;
|
|
19273
|
+
}, [containerHeight, visibleHeight, minusHeight, tagHeight]);
|
|
19330
19274
|
const visList = useMemo(() => {
|
|
19331
19275
|
var _a;
|
|
19332
19276
|
const list = activeIndex === 0 && !waterFallData && !isEditor && !isDiyH5
|
|
@@ -19467,9 +19411,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19467
19411
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) === 'top') {
|
|
19468
19412
|
top += minusHeight;
|
|
19469
19413
|
}
|
|
19470
|
-
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) !== 'top') {
|
|
19471
|
-
top += getHeightWithSafeArea();
|
|
19472
|
-
}
|
|
19473
19414
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
|
19474
19415
|
return (React.createElement(LikeButton$1, { key: rec.position, activeIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIcon, unActicveIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unlikeIcon, active: rec.isCollected, recData: rec, className: 'clc-sxp-like-button', style: {
|
|
19475
19416
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) ? 'fixed' : 'absolute',
|
|
@@ -19704,9 +19645,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19704
19645
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
|
|
19705
19646
|
top += minusHeight;
|
|
19706
19647
|
}
|
|
19707
|
-
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== 'top') {
|
|
19708
|
-
top += getHeightWithSafeArea();
|
|
19709
|
-
}
|
|
19710
19648
|
return (((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === undefined || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowMute) === true) && (React.createElement(ToggleButton$1, { style: {
|
|
19711
19649
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
|
19712
19650
|
visibility: ((_c = (_b = visList === null || visList === void 0 ? void 0 : visList[activeIndex]) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.url) ? 'visible' : 'hidden',
|
|
@@ -19747,7 +19685,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19747
19685
|
isReload,
|
|
19748
19686
|
renderToggleButton
|
|
19749
19687
|
]);
|
|
19750
|
-
return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container' },
|
|
19688
|
+
return (React.createElement("div", { id: 'sxp-render', className: 'clc-sxp-container', style: { height } },
|
|
19751
19689
|
(data === null || data === void 0 ? void 0 : data.length) < 1 && loading ? (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
|
19752
19690
|
React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement("div", { style: Object.assign({}, ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset) && { textUnderlineOffset: `${globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.textUnderlineOffset}px` })) },
|
|
19753
19691
|
waterFallData && (React.createElement(Navbar$1, { icon: img, styles: { background: 'rgba(0,0,0,.3)', color: '#fff', top: `${minusHeight}px` }, textStyle: Object.assign(Object.assign({}, (_e = (_d = (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagTitle), { color: '#fff' }), onClose: () => {
|
|
@@ -19809,10 +19747,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
|
19809
19747
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
|
19810
19748
|
React.createElement(WaterFall$1, Object.assign({}, (_u = (_t = (_s = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.hashTag) === null || _s === void 0 ? void 0 : _s[0]) === null || _t === void 0 ? void 0 : _t.item) === null || _u === void 0 ? void 0 : _u.props)),
|
|
19811
19749
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
|
19812
|
-
openMultiPosts && (React.createElement(MultiPosts$2, Object.assign({}, (_x = (_w = (_v = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.item) === null || _x === void 0 ? void 0 : _x.props, (_0 = (_z = (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.item) === null || _0 === void 0 ? void 0 : _0.event, { style: { position: 'fixed', top: 0, left: 0, right: 0
|
|
19750
|
+
openMultiPosts && (React.createElement(MultiPosts$2, Object.assign({}, (_x = (_w = (_v = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _v === void 0 ? void 0 : _v[0]) === null || _w === void 0 ? void 0 : _w.item) === null || _x === void 0 ? void 0 : _x.props, (_0 = (_z = (_y = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.item) === null || _0 === void 0 ? void 0 : _0.event, { style: { position: 'fixed', top: 0, left: 0, right: 0 } }))))),
|
|
19813
19751
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: {
|
|
19814
19752
|
position: 'fixed',
|
|
19815
|
-
bottom:
|
|
19753
|
+
bottom: 0,
|
|
19816
19754
|
left: 0,
|
|
19817
19755
|
right: 0,
|
|
19818
19756
|
width: '100%',
|