pb-sxp-ui 1.20.29 → 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 +75 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +75 -18
- 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 +75 -18
- 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/StructurePage/index.js +70 -18
- package/lib/core/components/StructurePage/index.js +70 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -19386,38 +19386,48 @@ const baseStyles = {
|
|
|
19386
19386
|
// Carousel Section
|
|
19387
19387
|
carouselSection: {
|
|
19388
19388
|
width: '100%',
|
|
19389
|
-
position: 'relative'
|
|
19389
|
+
position: 'relative',
|
|
19390
|
+
padding: '20px'
|
|
19390
19391
|
},
|
|
19391
19392
|
carouselImageContainer: {
|
|
19392
19393
|
width: '100%',
|
|
19393
|
-
|
|
19394
|
+
maxWidth: '100%',
|
|
19395
|
+
margin: '0 auto',
|
|
19394
19396
|
position: 'relative',
|
|
19395
|
-
overflow: 'hidden'
|
|
19397
|
+
overflow: 'hidden',
|
|
19398
|
+
aspectRatio: '9 / 16',
|
|
19399
|
+
touchAction: 'pan-y pinch-zoom'
|
|
19396
19400
|
},
|
|
19397
19401
|
carouselContainer: {
|
|
19398
19402
|
display: 'flex',
|
|
19399
|
-
transition: 'transform 0.
|
|
19400
|
-
width: '100%'
|
|
19403
|
+
transition: 'transform 0.3s ease-out',
|
|
19404
|
+
width: '100%',
|
|
19405
|
+
height: '100%'
|
|
19401
19406
|
},
|
|
19402
19407
|
carouselSlide: {
|
|
19403
19408
|
minWidth: '100%',
|
|
19409
|
+
height: '100%',
|
|
19404
19410
|
position: 'relative'
|
|
19405
19411
|
},
|
|
19406
19412
|
carouselImage: {
|
|
19407
19413
|
width: '100%',
|
|
19408
|
-
height: '
|
|
19414
|
+
height: '100%',
|
|
19409
19415
|
display: 'block',
|
|
19410
|
-
objectFit: 'cover'
|
|
19416
|
+
objectFit: 'cover',
|
|
19417
|
+
userSelect: 'none',
|
|
19418
|
+
WebkitUserDrag: 'none'
|
|
19411
19419
|
},
|
|
19412
19420
|
carouselVideo: {
|
|
19413
19421
|
width: '100%',
|
|
19414
|
-
height: '
|
|
19422
|
+
height: '100%',
|
|
19415
19423
|
display: 'block',
|
|
19416
|
-
objectFit: 'cover'
|
|
19424
|
+
objectFit: 'cover',
|
|
19425
|
+
userSelect: 'none',
|
|
19426
|
+
WebkitUserDrag: 'none'
|
|
19417
19427
|
},
|
|
19418
19428
|
carouselInfoSection: {
|
|
19419
19429
|
width: '100%',
|
|
19420
|
-
padding: '20px',
|
|
19430
|
+
padding: '10px 20px',
|
|
19421
19431
|
backgroundColor: '#000',
|
|
19422
19432
|
color: '#fff',
|
|
19423
19433
|
textAlign: 'center'
|
|
@@ -19619,6 +19629,8 @@ const StructurePage = (_a) => {
|
|
|
19619
19629
|
const [loading, setLoading] = useState(true);
|
|
19620
19630
|
const [error, setError] = useState(null);
|
|
19621
19631
|
const [carouselIndex, setCarouselIndex] = useState(0);
|
|
19632
|
+
const [touchStart, setTouchStart] = useState(null);
|
|
19633
|
+
const [touchEnd, setTouchEnd] = useState(null);
|
|
19622
19634
|
const heroVideoRef = useRef(null);
|
|
19623
19635
|
const carouselVideoRefs = useRef([]);
|
|
19624
19636
|
// 视频暂停状态管理
|
|
@@ -19698,7 +19710,7 @@ const StructurePage = (_a) => {
|
|
|
19698
19710
|
const config = multiCTAConfig[configKey];
|
|
19699
19711
|
// 定义允许的样式属性列表
|
|
19700
19712
|
const styleKeys = [
|
|
19701
|
-
'fontSize', 'color', 'textAlign', 'fontWeight',
|
|
19713
|
+
'fontSize', 'color', 'textAlign', 'fontWeight', 'fontStyle', 'textDecoration',
|
|
19702
19714
|
'backgroundColor', 'padding', 'margin', 'borderRadius',
|
|
19703
19715
|
'showBorder', 'borderWidth', 'borderColor',
|
|
19704
19716
|
'buttonBackgroundColor', 'buttonTextColor', 'buttonWidth', 'buttonHeight'
|
|
@@ -19725,8 +19737,16 @@ const StructurePage = (_a) => {
|
|
|
19725
19737
|
if (styleConfig.textAlign && typeof styleConfig.textAlign === 'string') {
|
|
19726
19738
|
customStyle.textAlign = styleConfig.textAlign;
|
|
19727
19739
|
}
|
|
19728
|
-
if (styleConfig.fontWeight
|
|
19729
|
-
customStyle.fontWeight = styleConfig.fontWeight
|
|
19740
|
+
if (styleConfig.fontWeight) {
|
|
19741
|
+
customStyle.fontWeight = typeof styleConfig.fontWeight === 'number'
|
|
19742
|
+
? styleConfig.fontWeight
|
|
19743
|
+
: styleConfig.fontWeight;
|
|
19744
|
+
}
|
|
19745
|
+
if (styleConfig.fontStyle && typeof styleConfig.fontStyle === 'string') {
|
|
19746
|
+
customStyle.fontStyle = styleConfig.fontStyle;
|
|
19747
|
+
}
|
|
19748
|
+
if (styleConfig.textDecoration && typeof styleConfig.textDecoration === 'string') {
|
|
19749
|
+
customStyle.textDecoration = styleConfig.textDecoration;
|
|
19730
19750
|
}
|
|
19731
19751
|
if (styleConfig.backgroundColor && typeof styleConfig.backgroundColor === 'string') {
|
|
19732
19752
|
customStyle.backgroundColor = styleConfig.backgroundColor;
|
|
@@ -19986,6 +20006,39 @@ const StructurePage = (_a) => {
|
|
|
19986
20006
|
setCarouselIndex((prev) => (prev === data.carouselSection.length - 1 ? 0 : prev + 1));
|
|
19987
20007
|
}
|
|
19988
20008
|
};
|
|
20009
|
+
// 触摸滑动处理
|
|
20010
|
+
const handleTouchStart = (e) => {
|
|
20011
|
+
setTouchEnd(null);
|
|
20012
|
+
setTouchStart(e.targetTouches[0].clientX);
|
|
20013
|
+
};
|
|
20014
|
+
const handleTouchMove = (e) => {
|
|
20015
|
+
if (!touchStart)
|
|
20016
|
+
return;
|
|
20017
|
+
const currentTouch = e.targetTouches[0].clientX;
|
|
20018
|
+
setTouchEnd(currentTouch);
|
|
20019
|
+
// 如果移动距离大于阈值,阻止默认行为(防止拖拽图片)
|
|
20020
|
+
const distance = Math.abs(touchStart - currentTouch);
|
|
20021
|
+
if (distance > 10) {
|
|
20022
|
+
e.preventDefault();
|
|
20023
|
+
}
|
|
20024
|
+
};
|
|
20025
|
+
const handleTouchEnd = () => {
|
|
20026
|
+
if (!touchStart || !touchEnd)
|
|
20027
|
+
return;
|
|
20028
|
+
const distance = touchStart - touchEnd;
|
|
20029
|
+
const minSwipeDistance = 50;
|
|
20030
|
+
if (distance > minSwipeDistance) {
|
|
20031
|
+
// 向左滑动,下一张
|
|
20032
|
+
handleCarouselNext();
|
|
20033
|
+
}
|
|
20034
|
+
else if (distance < -minSwipeDistance) {
|
|
20035
|
+
// 向右滑动,上一张
|
|
20036
|
+
handleCarouselPrev();
|
|
20037
|
+
}
|
|
20038
|
+
// 重置状态
|
|
20039
|
+
setTouchStart(null);
|
|
20040
|
+
setTouchEnd(null);
|
|
20041
|
+
};
|
|
19989
20042
|
if (loading) {
|
|
19990
20043
|
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..."));
|
|
19991
20044
|
}
|
|
@@ -20006,14 +20059,14 @@ const StructurePage = (_a) => {
|
|
|
20006
20059
|
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,
|
|
20007
20060
|
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))))),
|
|
20008
20061
|
data.carouselSection && data.carouselSection.length > 0 && (React.createElement("div", { style: mergeStyles(baseStyles.carouselSection, 'carouselSection') },
|
|
20009
|
-
React.createElement("div", { style: baseStyles.carouselImageContainer },
|
|
20062
|
+
React.createElement("div", { style: baseStyles.carouselImageContainer, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd },
|
|
20010
20063
|
React.createElement("div", { style: Object.assign(Object.assign({}, baseStyles.carouselContainer), { transform: `translateX(-${carouselIndex * 100}%)` }) }, data.carouselSection.map((item, index) => {
|
|
20011
20064
|
var _a;
|
|
20012
20065
|
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) },
|
|
20013
20066
|
React.createElement("video", { ref: (el) => {
|
|
20014
20067
|
carouselVideoRefs.current[index] = el;
|
|
20015
|
-
}, src: item.url, style: baseStyles.carouselVideo, muted: true, loop: true, playsInline: true, controls: false }),
|
|
20016
|
-
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));
|
|
20068
|
+
}, src: item.url, style: baseStyles.carouselVideo, muted: true, loop: true, playsInline: true, controls: false, draggable: false, onDragStart: (e) => e.preventDefault() }),
|
|
20069
|
+
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));
|
|
20017
20070
|
})),
|
|
20018
20071
|
React.createElement("button", { style: Object.assign(Object.assign({}, baseStyles.arrowButton), { left: '10px' }), onClick: handleCarouselPrev }, "\u2039"),
|
|
20019
20072
|
React.createElement("button", { style: Object.assign(Object.assign({}, baseStyles.arrowButton), { right: '10px' }), onClick: handleCarouselNext }, "\u203A")),
|
|
@@ -20024,7 +20077,8 @@ const StructurePage = (_a) => {
|
|
|
20024
20077
|
React.createElement("div", { style: baseStyles.highlightImageContainer },
|
|
20025
20078
|
React.createElement("img", { src: data.highlightRevealSection.landingImageUrl || data.highlightRevealSection.cover, alt: data.highlightRevealSection.title, style: baseStyles.highlightImage })),
|
|
20026
20079
|
React.createElement("div", { style: mergeStyles(baseStyles.highlightInfoSection, 'highlightSection') },
|
|
20027
|
-
React.createElement("div", { style:
|
|
20080
|
+
data.highlightRevealSection.text && (React.createElement("div", { style: { marginBottom: '10px' } },
|
|
20081
|
+
React.createElement("div", { style: mergeStyles(baseStyles.highlightTitle, 'highlightSection') }, data.highlightRevealSection.text))),
|
|
20028
20082
|
renderCTA('highlightButton', data.highlightRevealSection.bindCta, data.highlightRevealSection, baseStyles.highlightButton)))),
|
|
20029
20083
|
data.productGridSection && data.productGridSection.length > 0 && (React.createElement("div", { style: mergeStyles(baseStyles.productGrid, 'productGrid') }, (() => {
|
|
20030
20084
|
// 创建一个6格的网格 (3行 x 2列),根据position放置产品
|
|
@@ -20074,7 +20128,10 @@ const StructurePage = (_a) => {
|
|
|
20074
20128
|
});
|
|
20075
20129
|
})())),
|
|
20076
20130
|
data.footerSection && (React.createElement("div", { style: mergeStyles(baseStyles.footerSection, 'footerSection') },
|
|
20077
|
-
React.createElement("div", { style: mergeStyles(baseStyles.footerInfoSection, 'footerSection') },
|
|
20131
|
+
React.createElement("div", { style: mergeStyles(baseStyles.footerInfoSection, 'footerSection') },
|
|
20132
|
+
data.footerSection.text && (React.createElement("div", { style: { marginBottom: '15px' } },
|
|
20133
|
+
React.createElement("div", { style: mergeStyles(baseStyles.footerText, 'footerSection') }, data.footerSection.text))),
|
|
20134
|
+
renderCTA('footerButton', data.footerSection.bindCta, data.footerSection, baseStyles.footerButton)),
|
|
20078
20135
|
React.createElement("div", { style: baseStyles.footerImageContainer },
|
|
20079
20136
|
React.createElement("img", { src: data.footerSection.landingImageUrl || data.footerSection.cover, alt: data.footerSection.title, style: baseStyles.footerImage }))))));
|
|
20080
20137
|
};
|