pb-sxp-ui 1.19.18 → 1.19.19
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 +130 -113
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +130 -113
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +130 -113
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/Modal/index.js +14 -11
- package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/VideoWidget/index.js +3 -3
- package/es/core/components/SxpPageRender/index.js +14 -7
- package/es/core/hooks/useVisibleHeight.d.ts +4 -1
- package/es/core/hooks/useVisibleHeight.js +12 -4
- package/lib/core/components/SxpPageRender/Modal/index.js +14 -11
- package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +3 -3
- package/lib/core/components/SxpPageRender/index.js +14 -7
- package/lib/core/hooks/useVisibleHeight.d.ts +4 -1
- package/lib/core/hooks/useVisibleHeight.js +12 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10305,6 +10305,106 @@ const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailDat
|
|
|
10305
10305
|
};
|
|
10306
10306
|
var CommodityGroup$1 = memo(CommodityGroup);
|
|
10307
10307
|
|
|
10308
|
+
function useVisibleHeight() {
|
|
10309
|
+
const [visibleHeight, setVisibleHeight] = useState(0);
|
|
10310
|
+
const [bottomHeight, setBottomHeight] = useState(0);
|
|
10311
|
+
const getVisibleContentHeight = () => {
|
|
10312
|
+
// 方法优先级:
|
|
10313
|
+
// 1. visualViewport.height (最准确)
|
|
10314
|
+
// 2. window.innerHeight (次之)
|
|
10315
|
+
// 3. document.documentElement.clientHeight (fallback)
|
|
10316
|
+
if (typeof window === 'undefined')
|
|
10317
|
+
return 0;
|
|
10318
|
+
let height = window.innerHeight;
|
|
10319
|
+
// 优先使用 visualViewport
|
|
10320
|
+
if (window.visualViewport) {
|
|
10321
|
+
height = window.visualViewport.height;
|
|
10322
|
+
}
|
|
10323
|
+
// 验证高度合理性
|
|
10324
|
+
if (height <= 0 || height > window.screen.height) {
|
|
10325
|
+
height = window.innerHeight;
|
|
10326
|
+
}
|
|
10327
|
+
// 最终 fallback
|
|
10328
|
+
if (height <= 0) {
|
|
10329
|
+
height = document.documentElement.clientHeight;
|
|
10330
|
+
}
|
|
10331
|
+
return height;
|
|
10332
|
+
};
|
|
10333
|
+
const updateHeight = useCallback(() => {
|
|
10334
|
+
var _a;
|
|
10335
|
+
const visibleHeight = getVisibleContentHeight();
|
|
10336
|
+
const screenHeight = (_a = window.screen) === null || _a === void 0 ? void 0 : _a.height;
|
|
10337
|
+
const ua = navigator.userAgent;
|
|
10338
|
+
// Instagram 检测
|
|
10339
|
+
const isInstagram = /Instagram/i.test(ua);
|
|
10340
|
+
// Facebook 检测
|
|
10341
|
+
const isFacebook = /FBAV|FBAN|FBSN/i.test(ua);
|
|
10342
|
+
// 安全检查
|
|
10343
|
+
if (!screenHeight || visibleHeight <= 0 || (!isInstagram && !isFacebook)) {
|
|
10344
|
+
setVisibleHeight(visibleHeight);
|
|
10345
|
+
return;
|
|
10346
|
+
}
|
|
10347
|
+
const ratio = visibleHeight / screenHeight;
|
|
10348
|
+
const threshold = 0.9;
|
|
10349
|
+
const h = screenHeight >= 900 ? screenHeight * 0.8 : screenHeight * 0.79;
|
|
10350
|
+
// 当内容高度占屏幕高度90%以上时,使用按比例计算的高度
|
|
10351
|
+
// 否则使用实际内容高度
|
|
10352
|
+
const isRatio = ratio >= threshold && ratio !== 1;
|
|
10353
|
+
const finalHeight = isRatio ? Math.round(h) : visibleHeight;
|
|
10354
|
+
if (isRatio) {
|
|
10355
|
+
setBottomHeight(screenHeight - Math.round(h));
|
|
10356
|
+
}
|
|
10357
|
+
else {
|
|
10358
|
+
setBottomHeight(0);
|
|
10359
|
+
}
|
|
10360
|
+
if ('fundebug' in window) {
|
|
10361
|
+
const systemInfo = {
|
|
10362
|
+
ratio,
|
|
10363
|
+
h,
|
|
10364
|
+
finalHeight,
|
|
10365
|
+
visibleHeight,
|
|
10366
|
+
screenHeight,
|
|
10367
|
+
isInstagram,
|
|
10368
|
+
isFacebook,
|
|
10369
|
+
ua
|
|
10370
|
+
};
|
|
10371
|
+
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
10372
|
+
}
|
|
10373
|
+
setVisibleHeight(finalHeight);
|
|
10374
|
+
}, [getVisibleContentHeight]);
|
|
10375
|
+
useEffect(() => {
|
|
10376
|
+
// 初始计算
|
|
10377
|
+
updateHeight();
|
|
10378
|
+
// 事件监听
|
|
10379
|
+
const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
|
|
10380
|
+
events.forEach((event) => {
|
|
10381
|
+
window.addEventListener(event, updateHeight);
|
|
10382
|
+
});
|
|
10383
|
+
// visualViewport 监听(最重要)
|
|
10384
|
+
if (window.visualViewport) {
|
|
10385
|
+
window.visualViewport.addEventListener('resize', updateHeight);
|
|
10386
|
+
window.visualViewport.addEventListener('scroll', updateHeight);
|
|
10387
|
+
}
|
|
10388
|
+
// 键盘弹出/收起监听(移动端重要)
|
|
10389
|
+
if ('virtualKeyboard' in navigator) {
|
|
10390
|
+
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
10391
|
+
}
|
|
10392
|
+
return () => {
|
|
10393
|
+
events.forEach((event) => {
|
|
10394
|
+
window.removeEventListener(event, updateHeight);
|
|
10395
|
+
});
|
|
10396
|
+
if (window.visualViewport) {
|
|
10397
|
+
window.visualViewport.removeEventListener('resize', updateHeight);
|
|
10398
|
+
window.visualViewport.removeEventListener('scroll', updateHeight);
|
|
10399
|
+
}
|
|
10400
|
+
if ('virtualKeyboard' in navigator) {
|
|
10401
|
+
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
10402
|
+
}
|
|
10403
|
+
};
|
|
10404
|
+
}, [updateHeight]);
|
|
10405
|
+
return { visibleHeight, bottomHeight };
|
|
10406
|
+
}
|
|
10407
|
+
|
|
10308
10408
|
/*
|
|
10309
10409
|
* @Author: binruan@chatlabs.com
|
|
10310
10410
|
* @Date: 2023-11-02 18:34:34
|
|
@@ -10314,15 +10414,17 @@ var CommodityGroup$1 = memo(CommodityGroup);
|
|
|
10314
10414
|
*
|
|
10315
10415
|
*/
|
|
10316
10416
|
const closeIcon$1 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
|
|
10317
|
-
const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight
|
|
10417
|
+
const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight, isFullScreen = false, openState }) => {
|
|
10318
10418
|
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;
|
|
10419
|
+
const { visibleHeight, bottomHeight } = useVisibleHeight();
|
|
10319
10420
|
const touchRef = useRef(null);
|
|
10320
10421
|
const fTouchRef = useRef(null);
|
|
10321
10422
|
const touchMoveRef = useRef(null);
|
|
10322
10423
|
const ref = useRef(null);
|
|
10323
10424
|
const modalRef = useRef(null);
|
|
10324
|
-
const
|
|
10325
|
-
const
|
|
10425
|
+
const modalHeight = fullHeight || visibleHeight;
|
|
10426
|
+
const MODAL_DEF_TRANS = modalHeight * 0.2;
|
|
10427
|
+
const MODAL_DEF_CON_H = isFullScreen ? modalHeight : modalHeight * 0.8;
|
|
10326
10428
|
const [modalTrans, setModalTrans] = useState(MODAL_DEF_TRANS);
|
|
10327
10429
|
const [isShow, setIsShow] = useState(false);
|
|
10328
10430
|
const modalEleRef = useRef(null);
|
|
@@ -10370,17 +10472,17 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
|
10370
10472
|
}, [_popup, openState, globalConfig, schema]);
|
|
10371
10473
|
useEffect(() => {
|
|
10372
10474
|
const trapFocus = (element) => {
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10475
|
+
const focusableEls = element === null || element === void 0 ? void 0 : element.querySelectorAll('[role="button"],a, a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])');
|
|
10476
|
+
const firstFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[0];
|
|
10477
|
+
const lastFocusableEl = focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls[(focusableEls === null || focusableEls === void 0 ? void 0 : focusableEls.length) - 1];
|
|
10478
|
+
const KEYCODE_TAB = 9;
|
|
10377
10479
|
element.addEventListener('keydown', function (e) {
|
|
10378
10480
|
if (e.key === 'Escape' || e.key === 'Esc') {
|
|
10379
10481
|
// 在这里执行按下 Esc 键时的操作
|
|
10380
10482
|
handleClose();
|
|
10381
10483
|
e.preventDefault();
|
|
10382
10484
|
}
|
|
10383
|
-
|
|
10485
|
+
const isTabPressed = e.key === 'Tab' || e.keyCode === KEYCODE_TAB;
|
|
10384
10486
|
if (!isTabPressed) {
|
|
10385
10487
|
return;
|
|
10386
10488
|
}
|
|
@@ -10462,12 +10564,12 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
|
10462
10564
|
}
|
|
10463
10565
|
touchMoveRef.current = false;
|
|
10464
10566
|
};
|
|
10465
|
-
return ReactDOM.createPortal(React.createElement(React.Fragment, null, isShow && (React.createElement("div", { className: 'modal-bg', style: Object.assign({ display: 'flex', backgroundColor: isOpen ? 'rgba(0, 0, 0, 0.7)' : 'rgba(0, 0, 0, 0)' }, modalStyle), onClick: handleClose },
|
|
10567
|
+
return ReactDOM.createPortal(React.createElement(React.Fragment, null, isShow && (React.createElement("div", { className: 'modal-bg', style: Object.assign({ display: 'flex', backgroundColor: isOpen ? 'rgba(0, 0, 0, 0.7)' : 'rgba(0, 0, 0, 0)', bottom: bottomHeight + 'px' }, modalStyle), onClick: handleClose },
|
|
10466
10568
|
React.createElement("div", { style: {
|
|
10467
10569
|
position: 'relative',
|
|
10468
10570
|
left: `${(_d = (_c = (_b = (_a = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.popupBg) === null || _c === void 0 ? void 0 : _c.horizontalMargin) !== null && _d !== void 0 ? _d : 0}px`,
|
|
10469
10571
|
right: `${(_h = (_g = (_f = (_e = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _e === void 0 ? void 0 : _e.props) === null || _f === void 0 ? void 0 : _f.popupBg) === null || _g === void 0 ? void 0 : _g.horizontalMargin) !== null && _h !== void 0 ? _h : 0}px`,
|
|
10470
|
-
bottom: `${(_m = (_l = (_k = (_j = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _j === void 0 ? void 0 : _j.props) === null || _k === void 0 ? void 0 : _k.popupBg) === null || _l === void 0 ? void 0 : _l.bottomMargin) !== null && _m !== void 0 ? _m : 0}px`,
|
|
10572
|
+
bottom: `${((_m = (_l = (_k = (_j = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _j === void 0 ? void 0 : _j.props) === null || _k === void 0 ? void 0 : _k.popupBg) === null || _l === void 0 ? void 0 : _l.bottomMargin) !== null && _m !== void 0 ? _m : 0) + bottomHeight}px`,
|
|
10471
10573
|
overflow: 'hidden',
|
|
10472
10574
|
width: `calc(100% - ${((_r = (_q = (_p = (_o = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _o === void 0 ? void 0 : _o.props) === null || _p === void 0 ? void 0 : _p.popupBg) === null || _q === void 0 ? void 0 : _q.horizontalMargin) !== null && _r !== void 0 ? _r : 0) * 2}px)`,
|
|
10473
10575
|
height: '100%'
|
|
@@ -10483,7 +10585,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
|
|
|
10483
10585
|
onTouchEnd: handleTouchEnd
|
|
10484
10586
|
})),
|
|
10485
10587
|
React.createElement("div", Object.assign({ id: 'modal-content', ref: ref, style: {
|
|
10486
|
-
height: isScrollFullScreen ?
|
|
10588
|
+
height: isScrollFullScreen ? modalHeight : MODAL_DEF_CON_H,
|
|
10487
10589
|
overflow: (isScrollFullScreen && modalTrans <= 0) || !isScrollFullScreen ? 'auto' : 'hidden',
|
|
10488
10590
|
zIndex: 1
|
|
10489
10591
|
} }, (((_z = (_y = getPopupById === null || getPopupById === void 0 ? void 0 : getPopupById.item) === null || _y === void 0 ? void 0 : _y.props) === null || _z === void 0 ? void 0 : _z.enableFixedCloseButton) && {
|
|
@@ -18118,7 +18220,7 @@ const mountVideoPlayerAtNode = (() => {
|
|
|
18118
18220
|
};
|
|
18119
18221
|
})();
|
|
18120
18222
|
|
|
18121
|
-
const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef }, ref) => {
|
|
18223
|
+
const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoPlayIcon, loopPlay, swiperRef, visibleHeight }, ref) => {
|
|
18122
18224
|
var _a, _b;
|
|
18123
18225
|
const [isPauseVideo, setIsPauseVideo] = useState(false);
|
|
18124
18226
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport, isDiyH5 } = useSxpDataSource();
|
|
@@ -18226,7 +18328,7 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
|
|
|
18226
18328
|
const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
|
|
18227
18329
|
const ctx = canvas.getContext('2d');
|
|
18228
18330
|
const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
|
|
18229
|
-
const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
|
|
18331
|
+
const targetHeight = visibleHeight || (window === null || window === void 0 ? void 0 : window.innerHeight);
|
|
18230
18332
|
canvas.height = targetHeight;
|
|
18231
18333
|
canvas.width = targetWidth;
|
|
18232
18334
|
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(videoRef.current, 0, 0, canvas.width, canvas.height);
|
|
@@ -18236,7 +18338,7 @@ const VideoWidget$4 = forwardRef(({ rec, index, height, data, muted, activeIndex
|
|
|
18236
18338
|
setTimeout(() => {
|
|
18237
18339
|
setFrameImg();
|
|
18238
18340
|
}, 500);
|
|
18239
|
-
}, [videoRef.current, isBgColor, rec, firstFrameSrc, blur]);
|
|
18341
|
+
}, [videoRef.current, isBgColor, rec, firstFrameSrc, blur, visibleHeight]);
|
|
18240
18342
|
const handleLoadedmetadata = useCallback(() => {
|
|
18241
18343
|
if (!videoRef.current)
|
|
18242
18344
|
return;
|
|
@@ -18978,98 +19080,6 @@ const NavBack = ({ data, minusHeight, tagHeight, onClick }) => {
|
|
|
18978
19080
|
};
|
|
18979
19081
|
var NavBack$1 = memo(NavBack);
|
|
18980
19082
|
|
|
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
|
-
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);
|
|
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
|
-
};
|
|
19036
|
-
window === null || window === void 0 ? void 0 : window.fundebug.notify('Collect_Info', 'resize', { metaData: { systemInfo, otherInfo: {} } });
|
|
19037
|
-
}
|
|
19038
|
-
setVisibleHeight(finalHeight);
|
|
19039
|
-
}, [getVisibleContentHeight]);
|
|
19040
|
-
useEffect(() => {
|
|
19041
|
-
// 初始计算
|
|
19042
|
-
updateHeight();
|
|
19043
|
-
// 事件监听
|
|
19044
|
-
const events = ['resize', 'orientationchange', 'load', 'DOMContentLoaded'];
|
|
19045
|
-
events.forEach((event) => {
|
|
19046
|
-
window.addEventListener(event, updateHeight);
|
|
19047
|
-
});
|
|
19048
|
-
// visualViewport 监听(最重要)
|
|
19049
|
-
if (window.visualViewport) {
|
|
19050
|
-
window.visualViewport.addEventListener('resize', updateHeight);
|
|
19051
|
-
window.visualViewport.addEventListener('scroll', updateHeight);
|
|
19052
|
-
}
|
|
19053
|
-
// 键盘弹出/收起监听(移动端重要)
|
|
19054
|
-
if ('virtualKeyboard' in navigator) {
|
|
19055
|
-
navigator.virtualKeyboard.addEventListener('geometrychange', updateHeight);
|
|
19056
|
-
}
|
|
19057
|
-
return () => {
|
|
19058
|
-
events.forEach((event) => {
|
|
19059
|
-
window.removeEventListener(event, updateHeight);
|
|
19060
|
-
});
|
|
19061
|
-
if (window.visualViewport) {
|
|
19062
|
-
window.visualViewport.removeEventListener('resize', updateHeight);
|
|
19063
|
-
window.visualViewport.removeEventListener('scroll', updateHeight);
|
|
19064
|
-
}
|
|
19065
|
-
if ('virtualKeyboard' in navigator) {
|
|
19066
|
-
navigator.virtualKeyboard.removeEventListener('geometrychange', updateHeight);
|
|
19067
|
-
}
|
|
19068
|
-
};
|
|
19069
|
-
}, [updateHeight]);
|
|
19070
|
-
return visibleHeight;
|
|
19071
|
-
};
|
|
19072
|
-
|
|
19073
19083
|
/*
|
|
19074
19084
|
* @Author: binruan@chatlabs.com
|
|
19075
19085
|
* @Date: 2024-03-20 10:27:31
|
|
@@ -19098,7 +19108,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19098
19108
|
const fbcRef = useRef('');
|
|
19099
19109
|
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();
|
|
19100
19110
|
const { backMainFeed, productView, jumpToWeb } = useEventReport();
|
|
19101
|
-
const visibleHeight = useVisibleHeight();
|
|
19111
|
+
const { visibleHeight, bottomHeight } = useVisibleHeight();
|
|
19102
19112
|
const isShowFingerTip = useMemo(() => {
|
|
19103
19113
|
return data.length > 0 && !loading && (getFeUserState() || (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip));
|
|
19104
19114
|
}, [data, loading, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableSwiperTip]);
|
|
@@ -19312,7 +19322,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19312
19322
|
return (React.createElement(MultiPosts$2, Object.assign({ recData: data === null || data === void 0 ? void 0 : data[1] }, (_c = (_b = (_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.item) === null || _c === void 0 ? void 0 : _c.props, (_f = (_e = (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.multiPosts) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.item) === null || _f === void 0 ? void 0 : _f.event)));
|
|
19313
19323
|
}
|
|
19314
19324
|
if ((_g = rec === null || rec === void 0 ? void 0 : rec.video) === null || _g === void 0 ? void 0 : _g.url) {
|
|
19315
|
-
return (React.createElement(VideoWidget$5, Object.assign({ key: isReload }, (activeIndex === index && { ref: videoWidgetRef }), { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon, loopPlay: true, swiperRef: swiperRef })));
|
|
19325
|
+
return (React.createElement(VideoWidget$5, Object.assign({ key: isReload }, (activeIndex === index && { ref: videoWidgetRef }), { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon, loopPlay: true, swiperRef: swiperRef, visibleHeight: visibleHeight })));
|
|
19316
19326
|
}
|
|
19317
19327
|
if ((_h = rec === null || rec === void 0 ? void 0 : rec.video) === null || _h === void 0 ? void 0 : _h.imgUrls) {
|
|
19318
19328
|
return (React.createElement(PictureGroup$5, { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onViewImageEndEvent: handleViewImageStartEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
|
|
@@ -19339,7 +19349,8 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19339
19349
|
tipText,
|
|
19340
19350
|
resolver,
|
|
19341
19351
|
schema,
|
|
19342
|
-
isReload
|
|
19352
|
+
isReload,
|
|
19353
|
+
visibleHeight
|
|
19343
19354
|
]);
|
|
19344
19355
|
const onExpandableChange = useCallback((v) => {
|
|
19345
19356
|
setIsShowMore(v);
|
|
@@ -19411,6 +19422,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19411
19422
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) === 'top') {
|
|
19412
19423
|
top += minusHeight;
|
|
19413
19424
|
}
|
|
19425
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconYPosit) !== 'top') {
|
|
19426
|
+
top += bottomHeight;
|
|
19427
|
+
}
|
|
19414
19428
|
if (rec === null || rec === void 0 ? void 0 : rec.video) {
|
|
19415
19429
|
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: {
|
|
19416
19430
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.likeIconFixed) ? 'fixed' : 'absolute',
|
|
@@ -19419,7 +19433,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19419
19433
|
}, position: index }));
|
|
19420
19434
|
}
|
|
19421
19435
|
return null;
|
|
19422
|
-
}, [globalConfig, waterFallData]);
|
|
19436
|
+
}, [globalConfig, waterFallData, bottomHeight]);
|
|
19423
19437
|
const handleViewImageStartEnd = (item) => {
|
|
19424
19438
|
var _a, _b, _c, _d, _e, _f;
|
|
19425
19439
|
if (!((_a = item === null || item === void 0 ? void 0 : item.video) === null || _a === void 0 ? void 0 : _a.url) && ((_b = item === null || item === void 0 ? void 0 : item.video) === null || _b === void 0 ? void 0 : _b.imgUrls)) {
|
|
@@ -19645,6 +19659,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19645
19659
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) === 'top') {
|
|
19646
19660
|
top += minusHeight;
|
|
19647
19661
|
}
|
|
19662
|
+
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== 'top') {
|
|
19663
|
+
top += bottomHeight;
|
|
19664
|
+
}
|
|
19648
19665
|
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: {
|
|
19649
19666
|
position: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed) ? 'fixed' : 'absolute',
|
|
19650
19667
|
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',
|
|
@@ -19653,7 +19670,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19653
19670
|
[(_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconXPosit) !== null && _d !== void 0 ? _d : 'right']: (_e = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconX) !== null && _e !== void 0 ? _e : 0,
|
|
19654
19671
|
[(_f = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconYPosit) !== null && _f !== void 0 ? _f : 'bottom']: top
|
|
19655
19672
|
}, defaultValue: isMuted, activeIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.unMuteIcon : mutedIcon, unactiveIcon: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon) ? globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIcon : unmutedIcon, onChange: setIsMuted })));
|
|
19656
|
-
}, [globalConfig, visList, activeIndex, isMuted, waterFallData]);
|
|
19673
|
+
}, [globalConfig, visList, activeIndex, isMuted, waterFallData, bottomHeight]);
|
|
19657
19674
|
const renderView = useMemo(() => {
|
|
19658
19675
|
if (loading) {
|
|
19659
19676
|
return (React.createElement("div", { style: { height, width: containerWidth, display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
|
@@ -19747,10 +19764,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight, containerWidt
|
|
|
19747
19764
|
renderToggleButton(!!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.muteIconFixed))),
|
|
19748
19765
|
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)),
|
|
19749
19766
|
React.createElement(ConsentPopup, { resolver: resolver, globalConfig: globalConfig }),
|
|
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 } }))))),
|
|
19767
|
+
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, bottom: bottomHeight + 'px' } }))))),
|
|
19751
19768
|
(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.enableCookieSetting) && (React.createElement("div", { style: {
|
|
19752
19769
|
position: 'fixed',
|
|
19753
|
-
bottom:
|
|
19770
|
+
bottom: bottomHeight + 'px',
|
|
19754
19771
|
left: 0,
|
|
19755
19772
|
right: 0,
|
|
19756
19773
|
width: '100%',
|