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/pb-ui.js
CHANGED
|
@@ -19401,38 +19401,48 @@ Made in Italy` })));
|
|
|
19401
19401
|
// Carousel Section
|
|
19402
19402
|
carouselSection: {
|
|
19403
19403
|
width: '100%',
|
|
19404
|
-
position: 'relative'
|
|
19404
|
+
position: 'relative',
|
|
19405
|
+
padding: '20px'
|
|
19405
19406
|
},
|
|
19406
19407
|
carouselImageContainer: {
|
|
19407
19408
|
width: '100%',
|
|
19408
|
-
|
|
19409
|
+
maxWidth: '100%',
|
|
19410
|
+
margin: '0 auto',
|
|
19409
19411
|
position: 'relative',
|
|
19410
|
-
overflow: 'hidden'
|
|
19412
|
+
overflow: 'hidden',
|
|
19413
|
+
aspectRatio: '9 / 16',
|
|
19414
|
+
touchAction: 'pan-y pinch-zoom'
|
|
19411
19415
|
},
|
|
19412
19416
|
carouselContainer: {
|
|
19413
19417
|
display: 'flex',
|
|
19414
|
-
transition: 'transform 0.
|
|
19415
|
-
width: '100%'
|
|
19418
|
+
transition: 'transform 0.3s ease-out',
|
|
19419
|
+
width: '100%',
|
|
19420
|
+
height: '100%'
|
|
19416
19421
|
},
|
|
19417
19422
|
carouselSlide: {
|
|
19418
19423
|
minWidth: '100%',
|
|
19424
|
+
height: '100%',
|
|
19419
19425
|
position: 'relative'
|
|
19420
19426
|
},
|
|
19421
19427
|
carouselImage: {
|
|
19422
19428
|
width: '100%',
|
|
19423
|
-
height: '
|
|
19429
|
+
height: '100%',
|
|
19424
19430
|
display: 'block',
|
|
19425
|
-
objectFit: 'cover'
|
|
19431
|
+
objectFit: 'cover',
|
|
19432
|
+
userSelect: 'none',
|
|
19433
|
+
WebkitUserDrag: 'none'
|
|
19426
19434
|
},
|
|
19427
19435
|
carouselVideo: {
|
|
19428
19436
|
width: '100%',
|
|
19429
|
-
height: '
|
|
19437
|
+
height: '100%',
|
|
19430
19438
|
display: 'block',
|
|
19431
|
-
objectFit: 'cover'
|
|
19439
|
+
objectFit: 'cover',
|
|
19440
|
+
userSelect: 'none',
|
|
19441
|
+
WebkitUserDrag: 'none'
|
|
19432
19442
|
},
|
|
19433
19443
|
carouselInfoSection: {
|
|
19434
19444
|
width: '100%',
|
|
19435
|
-
padding: '20px',
|
|
19445
|
+
padding: '10px 20px',
|
|
19436
19446
|
backgroundColor: '#000',
|
|
19437
19447
|
color: '#fff',
|
|
19438
19448
|
textAlign: 'center'
|
|
@@ -19634,6 +19644,8 @@ Made in Italy` })));
|
|
|
19634
19644
|
const [loading, setLoading] = React.useState(true);
|
|
19635
19645
|
const [error, setError] = React.useState(null);
|
|
19636
19646
|
const [carouselIndex, setCarouselIndex] = React.useState(0);
|
|
19647
|
+
const [touchStart, setTouchStart] = React.useState(null);
|
|
19648
|
+
const [touchEnd, setTouchEnd] = React.useState(null);
|
|
19637
19649
|
const heroVideoRef = React.useRef(null);
|
|
19638
19650
|
const carouselVideoRefs = React.useRef([]);
|
|
19639
19651
|
// 视频暂停状态管理
|
|
@@ -19713,7 +19725,7 @@ Made in Italy` })));
|
|
|
19713
19725
|
const config = multiCTAConfig[configKey];
|
|
19714
19726
|
// 定义允许的样式属性列表
|
|
19715
19727
|
const styleKeys = [
|
|
19716
|
-
'fontSize', 'color', 'textAlign', 'fontWeight',
|
|
19728
|
+
'fontSize', 'color', 'textAlign', 'fontWeight', 'fontStyle', 'textDecoration',
|
|
19717
19729
|
'backgroundColor', 'padding', 'margin', 'borderRadius',
|
|
19718
19730
|
'showBorder', 'borderWidth', 'borderColor',
|
|
19719
19731
|
'buttonBackgroundColor', 'buttonTextColor', 'buttonWidth', 'buttonHeight'
|
|
@@ -19740,8 +19752,16 @@ Made in Italy` })));
|
|
|
19740
19752
|
if (styleConfig.textAlign && typeof styleConfig.textAlign === 'string') {
|
|
19741
19753
|
customStyle.textAlign = styleConfig.textAlign;
|
|
19742
19754
|
}
|
|
19743
|
-
if (styleConfig.fontWeight
|
|
19744
|
-
customStyle.fontWeight = styleConfig.fontWeight
|
|
19755
|
+
if (styleConfig.fontWeight) {
|
|
19756
|
+
customStyle.fontWeight = typeof styleConfig.fontWeight === 'number'
|
|
19757
|
+
? styleConfig.fontWeight
|
|
19758
|
+
: styleConfig.fontWeight;
|
|
19759
|
+
}
|
|
19760
|
+
if (styleConfig.fontStyle && typeof styleConfig.fontStyle === 'string') {
|
|
19761
|
+
customStyle.fontStyle = styleConfig.fontStyle;
|
|
19762
|
+
}
|
|
19763
|
+
if (styleConfig.textDecoration && typeof styleConfig.textDecoration === 'string') {
|
|
19764
|
+
customStyle.textDecoration = styleConfig.textDecoration;
|
|
19745
19765
|
}
|
|
19746
19766
|
if (styleConfig.backgroundColor && typeof styleConfig.backgroundColor === 'string') {
|
|
19747
19767
|
customStyle.backgroundColor = styleConfig.backgroundColor;
|
|
@@ -20001,6 +20021,39 @@ Made in Italy` })));
|
|
|
20001
20021
|
setCarouselIndex((prev) => (prev === data.carouselSection.length - 1 ? 0 : prev + 1));
|
|
20002
20022
|
}
|
|
20003
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
|
+
};
|
|
20004
20057
|
if (loading) {
|
|
20005
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..."));
|
|
20006
20059
|
}
|
|
@@ -20021,14 +20074,14 @@ Made in Italy` })));
|
|
|
20021
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,
|
|
20022
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))))),
|
|
20023
20076
|
data.carouselSection && data.carouselSection.length > 0 && (React.createElement("div", { style: mergeStyles(baseStyles.carouselSection, 'carouselSection') },
|
|
20024
|
-
React.createElement("div", { style: baseStyles.carouselImageContainer },
|
|
20077
|
+
React.createElement("div", { style: baseStyles.carouselImageContainer, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd },
|
|
20025
20078
|
React.createElement("div", { style: Object.assign(Object.assign({}, baseStyles.carouselContainer), { transform: `translateX(-${carouselIndex * 100}%)` }) }, data.carouselSection.map((item, index) => {
|
|
20026
20079
|
var _a;
|
|
20027
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) },
|
|
20028
20081
|
React.createElement("video", { ref: (el) => {
|
|
20029
20082
|
carouselVideoRefs.current[index] = el;
|
|
20030
|
-
}, src: item.url, style: baseStyles.carouselVideo, muted: true, loop: true, playsInline: true, controls: false }),
|
|
20031
|
-
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));
|
|
20032
20085
|
})),
|
|
20033
20086
|
React.createElement("button", { style: Object.assign(Object.assign({}, baseStyles.arrowButton), { left: '10px' }), onClick: handleCarouselPrev }, "\u2039"),
|
|
20034
20087
|
React.createElement("button", { style: Object.assign(Object.assign({}, baseStyles.arrowButton), { right: '10px' }), onClick: handleCarouselNext }, "\u203A")),
|
|
@@ -20039,7 +20092,8 @@ Made in Italy` })));
|
|
|
20039
20092
|
React.createElement("div", { style: baseStyles.highlightImageContainer },
|
|
20040
20093
|
React.createElement("img", { src: data.highlightRevealSection.landingImageUrl || data.highlightRevealSection.cover, alt: data.highlightRevealSection.title, style: baseStyles.highlightImage })),
|
|
20041
20094
|
React.createElement("div", { style: mergeStyles(baseStyles.highlightInfoSection, 'highlightSection') },
|
|
20042
|
-
React.createElement("div", { style:
|
|
20095
|
+
data.highlightRevealSection.text && (React.createElement("div", { style: { marginBottom: '10px' } },
|
|
20096
|
+
React.createElement("div", { style: mergeStyles(baseStyles.highlightTitle, 'highlightSection') }, data.highlightRevealSection.text))),
|
|
20043
20097
|
renderCTA('highlightButton', data.highlightRevealSection.bindCta, data.highlightRevealSection, baseStyles.highlightButton)))),
|
|
20044
20098
|
data.productGridSection && data.productGridSection.length > 0 && (React.createElement("div", { style: mergeStyles(baseStyles.productGrid, 'productGrid') }, (() => {
|
|
20045
20099
|
// 创建一个6格的网格 (3行 x 2列),根据position放置产品
|
|
@@ -20089,7 +20143,10 @@ Made in Italy` })));
|
|
|
20089
20143
|
});
|
|
20090
20144
|
})())),
|
|
20091
20145
|
data.footerSection && (React.createElement("div", { style: mergeStyles(baseStyles.footerSection, 'footerSection') },
|
|
20092
|
-
React.createElement("div", { style: mergeStyles(baseStyles.footerInfoSection, 'footerSection') },
|
|
20146
|
+
React.createElement("div", { style: mergeStyles(baseStyles.footerInfoSection, 'footerSection') },
|
|
20147
|
+
data.footerSection.text && (React.createElement("div", { style: { marginBottom: '15px' } },
|
|
20148
|
+
React.createElement("div", { style: mergeStyles(baseStyles.footerText, 'footerSection') }, data.footerSection.text))),
|
|
20149
|
+
renderCTA('footerButton', data.footerSection.bindCta, data.footerSection, baseStyles.footerButton)),
|
|
20093
20150
|
React.createElement("div", { style: baseStyles.footerImageContainer },
|
|
20094
20151
|
React.createElement("img", { src: data.footerSection.landingImageUrl || data.footerSection.cover, alt: data.footerSection.title, style: baseStyles.footerImage }))))));
|
|
20095
20152
|
};
|