pb-sxp-ui 1.20.30 → 1.20.31
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 +60 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +60 -16
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +7 -7
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +7 -7
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +60 -16
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +7 -7
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/StructurePage/index.js +55 -16
- package/lib/core/components/StructurePage/index.js +55 -16
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
|
@@ -19402,34 +19402,43 @@ Made in Italy` })));
|
|
|
19402
19402
|
carouselSection: {
|
|
19403
19403
|
width: '100%',
|
|
19404
19404
|
position: 'relative',
|
|
19405
|
-
padding: '20px
|
|
19405
|
+
padding: '20px'
|
|
19406
19406
|
},
|
|
19407
19407
|
carouselImageContainer: {
|
|
19408
19408
|
width: '100%',
|
|
19409
|
-
|
|
19409
|
+
maxWidth: '100%',
|
|
19410
|
+
margin: '0 auto',
|
|
19410
19411
|
position: 'relative',
|
|
19411
|
-
overflow: 'hidden'
|
|
19412
|
+
overflow: 'hidden',
|
|
19413
|
+
aspectRatio: '9 / 16',
|
|
19414
|
+
touchAction: 'pan-y pinch-zoom'
|
|
19412
19415
|
},
|
|
19413
19416
|
carouselContainer: {
|
|
19414
19417
|
display: 'flex',
|
|
19415
|
-
transition: 'transform 0.
|
|
19416
|
-
width: '100%'
|
|
19418
|
+
transition: 'transform 0.3s ease-out',
|
|
19419
|
+
width: '100%',
|
|
19420
|
+
height: '100%'
|
|
19417
19421
|
},
|
|
19418
19422
|
carouselSlide: {
|
|
19419
19423
|
minWidth: '100%',
|
|
19424
|
+
height: '100%',
|
|
19420
19425
|
position: 'relative'
|
|
19421
19426
|
},
|
|
19422
19427
|
carouselImage: {
|
|
19423
19428
|
width: '100%',
|
|
19424
|
-
height: '
|
|
19429
|
+
height: '100%',
|
|
19425
19430
|
display: 'block',
|
|
19426
|
-
objectFit: 'cover'
|
|
19431
|
+
objectFit: 'cover',
|
|
19432
|
+
userSelect: 'none',
|
|
19433
|
+
WebkitUserDrag: 'none'
|
|
19427
19434
|
},
|
|
19428
19435
|
carouselVideo: {
|
|
19429
19436
|
width: '100%',
|
|
19430
|
-
height: '
|
|
19437
|
+
height: '100%',
|
|
19431
19438
|
display: 'block',
|
|
19432
|
-
objectFit: 'cover'
|
|
19439
|
+
objectFit: 'cover',
|
|
19440
|
+
userSelect: 'none',
|
|
19441
|
+
WebkitUserDrag: 'none'
|
|
19433
19442
|
},
|
|
19434
19443
|
carouselInfoSection: {
|
|
19435
19444
|
width: '100%',
|
|
@@ -19629,12 +19638,14 @@ Made in Italy` })));
|
|
|
19629
19638
|
}
|
|
19630
19639
|
};
|
|
19631
19640
|
const StructurePage = (_a) => {
|
|
19632
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q
|
|
19641
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
19633
19642
|
var { containerStyle, containerHeight = 664, containerWidth = 375, className = '', apiUrl = 'https://bff-be-dev.chatlabs.net/api/v1/recommend/list', requestBody, editorMode = false, multiCTAConfig: propMultiCTAConfig, videoPlayIcon: propVideoPlayIcon, isCmsMode = false, storyId, customHeaders } = _a, rest = __rest(_a, ["containerStyle", "containerHeight", "containerWidth", "className", "apiUrl", "requestBody", "editorMode", "multiCTAConfig", "videoPlayIcon", "isCmsMode", "storyId", "customHeaders"]);
|
|
19634
19643
|
const [data, setData] = React.useState(null);
|
|
19635
19644
|
const [loading, setLoading] = React.useState(true);
|
|
19636
19645
|
const [error, setError] = React.useState(null);
|
|
19637
19646
|
const [carouselIndex, setCarouselIndex] = React.useState(0);
|
|
19647
|
+
const [touchStart, setTouchStart] = React.useState(null);
|
|
19648
|
+
const [touchEnd, setTouchEnd] = React.useState(null);
|
|
19638
19649
|
const heroVideoRef = React.useRef(null);
|
|
19639
19650
|
const carouselVideoRefs = React.useRef([]);
|
|
19640
19651
|
// 视频暂停状态管理
|
|
@@ -20010,6 +20021,39 @@ Made in Italy` })));
|
|
|
20010
20021
|
setCarouselIndex((prev) => (prev === data.carouselSection.length - 1 ? 0 : prev + 1));
|
|
20011
20022
|
}
|
|
20012
20023
|
};
|
|
20024
|
+
// 触摸滑动处理
|
|
20025
|
+
const handleTouchStart = (e) => {
|
|
20026
|
+
setTouchEnd(null);
|
|
20027
|
+
setTouchStart(e.targetTouches[0].clientX);
|
|
20028
|
+
};
|
|
20029
|
+
const handleTouchMove = (e) => {
|
|
20030
|
+
if (!touchStart)
|
|
20031
|
+
return;
|
|
20032
|
+
const currentTouch = e.targetTouches[0].clientX;
|
|
20033
|
+
setTouchEnd(currentTouch);
|
|
20034
|
+
// 如果移动距离大于阈值,阻止默认行为(防止拖拽图片)
|
|
20035
|
+
const distance = Math.abs(touchStart - currentTouch);
|
|
20036
|
+
if (distance > 10) {
|
|
20037
|
+
e.preventDefault();
|
|
20038
|
+
}
|
|
20039
|
+
};
|
|
20040
|
+
const handleTouchEnd = () => {
|
|
20041
|
+
if (!touchStart || !touchEnd)
|
|
20042
|
+
return;
|
|
20043
|
+
const distance = touchStart - touchEnd;
|
|
20044
|
+
const minSwipeDistance = 50;
|
|
20045
|
+
if (distance > minSwipeDistance) {
|
|
20046
|
+
// 向左滑动,下一张
|
|
20047
|
+
handleCarouselNext();
|
|
20048
|
+
}
|
|
20049
|
+
else if (distance < -minSwipeDistance) {
|
|
20050
|
+
// 向右滑动,上一张
|
|
20051
|
+
handleCarouselPrev();
|
|
20052
|
+
}
|
|
20053
|
+
// 重置状态
|
|
20054
|
+
setTouchStart(null);
|
|
20055
|
+
setTouchEnd(null);
|
|
20056
|
+
};
|
|
20013
20057
|
if (loading) {
|
|
20014
20058
|
return (React.createElement("div", { style: Object.assign(Object.assign({}, baseStyles.container), { height: containerHeight, width: containerWidth, display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff', fontSize: '16px' }) }, "Loading..."));
|
|
20015
20059
|
}
|
|
@@ -20029,21 +20073,21 @@ Made in Italy` })));
|
|
|
20029
20073
|
React.createElement("video", { ref: heroVideoRef, src: data.heroSection.url, style: baseStyles.heroVideo, autoPlay: true, muted: true, loop: true, playsInline: true, controls: false }),
|
|
20030
20074
|
isHeroVideoPaused && (React.createElement(FormatImage$1, { className: 'clc-pb-video-pause', src: videoPlayIcon, alt: 'play' })))) : ((_e = data.heroSection.imgUrls) === null || _e === void 0 ? void 0 : _e[0]) ? (React.createElement("img", { src: data.heroSection.imgUrls[0], alt: 'Hero', style: baseStyles.heroImage })) : null,
|
|
20031
20075
|
React.createElement("div", { style: baseStyles.heroOverlay }, renderCTA('heroButton', (_g = (_f = data.heroSection.bindProducts) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.bindCta, (_h = data.heroSection.bindProducts) === null || _h === void 0 ? void 0 : _h[0], baseStyles.heroButton))))),
|
|
20032
|
-
data.carouselSection && data.carouselSection.length > 0 && (React.createElement("div", { style:
|
|
20033
|
-
React.createElement("div", { style:
|
|
20076
|
+
data.carouselSection && data.carouselSection.length > 0 && (React.createElement("div", { style: mergeStyles(baseStyles.carouselSection, 'carouselSection') },
|
|
20077
|
+
React.createElement("div", { style: baseStyles.carouselImageContainer, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd },
|
|
20034
20078
|
React.createElement("div", { style: Object.assign(Object.assign({}, baseStyles.carouselContainer), { transform: `translateX(-${carouselIndex * 100}%)` }) }, data.carouselSection.map((item, index) => {
|
|
20035
20079
|
var _a;
|
|
20036
20080
|
return (React.createElement("div", { key: item.itemId, style: baseStyles.carouselSlide }, item.url ? (React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' }, onClick: () => handleCarouselVideoClick(index) },
|
|
20037
20081
|
React.createElement("video", { ref: (el) => {
|
|
20038
20082
|
carouselVideoRefs.current[index] = el;
|
|
20039
|
-
}, src: item.url, style: baseStyles.carouselVideo, muted: true, loop: true, playsInline: true, controls: false }),
|
|
20040
|
-
carouselVideoPausedStates[index] && (React.createElement(FormatImage$1, { className: 'clc-pb-video-pause', src: videoPlayIcon, alt: 'play' })))) : ((_a = item.imgUrls) === null || _a === void 0 ? void 0 : _a[0]) ? (React.createElement("img", { src: item.imgUrls[0], alt: item.text || 'Carousel', style: baseStyles.carouselImage })) : null));
|
|
20083
|
+
}, src: item.url, style: baseStyles.carouselVideo, muted: true, loop: true, playsInline: true, controls: false, draggable: false, onDragStart: (e) => e.preventDefault() }),
|
|
20084
|
+
carouselVideoPausedStates[index] && (React.createElement(FormatImage$1, { className: 'clc-pb-video-pause', src: videoPlayIcon, alt: 'play' })))) : ((_a = item.imgUrls) === null || _a === void 0 ? void 0 : _a[0]) ? (React.createElement("img", { src: item.imgUrls[0], alt: item.text || 'Carousel', style: baseStyles.carouselImage, draggable: false, onDragStart: (e) => e.preventDefault() })) : null));
|
|
20041
20085
|
})),
|
|
20042
20086
|
React.createElement("button", { style: Object.assign(Object.assign({}, baseStyles.arrowButton), { left: '10px' }), onClick: handleCarouselPrev }, "\u2039"),
|
|
20043
20087
|
React.createElement("button", { style: Object.assign(Object.assign({}, baseStyles.arrowButton), { right: '10px' }), onClick: handleCarouselNext }, "\u203A")),
|
|
20044
20088
|
React.createElement("div", { style: mergeStyles(baseStyles.carouselInfoSection, 'carouselSection') },
|
|
20045
|
-
((
|
|
20046
|
-
renderCTA('carouselButton', (
|
|
20089
|
+
((_j = data.carouselSection[carouselIndex]) === null || _j === void 0 ? void 0 : _j.text) && (React.createElement("div", { style: mergeStyles(baseStyles.carouselText, 'carouselSection') }, (_k = data.carouselSection[carouselIndex]) === null || _k === void 0 ? void 0 : _k.text)),
|
|
20090
|
+
renderCTA('carouselButton', (_o = (_m = (_l = data.carouselSection[carouselIndex]) === null || _l === void 0 ? void 0 : _l.bindProducts) === null || _m === void 0 ? void 0 : _m[0]) === null || _o === void 0 ? void 0 : _o.bindCta, (_q = (_p = data.carouselSection[carouselIndex]) === null || _p === void 0 ? void 0 : _p.bindProducts) === null || _q === void 0 ? void 0 : _q[0], baseStyles.carouselButton)))),
|
|
20047
20091
|
data.highlightRevealSection && (React.createElement("div", { style: mergeStyles(baseStyles.highlightSection, 'highlightSection') },
|
|
20048
20092
|
React.createElement("div", { style: baseStyles.highlightImageContainer },
|
|
20049
20093
|
React.createElement("img", { src: data.highlightRevealSection.landingImageUrl || data.highlightRevealSection.cover, alt: data.highlightRevealSection.title, style: baseStyles.highlightImage })),
|