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 CHANGED
@@ -19408,38 +19408,48 @@ const baseStyles = {
19408
19408
  // Carousel Section
19409
19409
  carouselSection: {
19410
19410
  width: '100%',
19411
- position: 'relative'
19411
+ position: 'relative',
19412
+ padding: '20px'
19412
19413
  },
19413
19414
  carouselImageContainer: {
19414
19415
  width: '100%',
19415
- height: 'auto',
19416
+ maxWidth: '100%',
19417
+ margin: '0 auto',
19416
19418
  position: 'relative',
19417
- overflow: 'hidden'
19419
+ overflow: 'hidden',
19420
+ aspectRatio: '9 / 16',
19421
+ touchAction: 'pan-y pinch-zoom'
19418
19422
  },
19419
19423
  carouselContainer: {
19420
19424
  display: 'flex',
19421
- transition: 'transform 0.5s ease-in-out',
19422
- width: '100%'
19425
+ transition: 'transform 0.3s ease-out',
19426
+ width: '100%',
19427
+ height: '100%'
19423
19428
  },
19424
19429
  carouselSlide: {
19425
19430
  minWidth: '100%',
19431
+ height: '100%',
19426
19432
  position: 'relative'
19427
19433
  },
19428
19434
  carouselImage: {
19429
19435
  width: '100%',
19430
- height: 'auto',
19436
+ height: '100%',
19431
19437
  display: 'block',
19432
- objectFit: 'cover'
19438
+ objectFit: 'cover',
19439
+ userSelect: 'none',
19440
+ WebkitUserDrag: 'none'
19433
19441
  },
19434
19442
  carouselVideo: {
19435
19443
  width: '100%',
19436
- height: 'auto',
19444
+ height: '100%',
19437
19445
  display: 'block',
19438
- objectFit: 'cover'
19446
+ objectFit: 'cover',
19447
+ userSelect: 'none',
19448
+ WebkitUserDrag: 'none'
19439
19449
  },
19440
19450
  carouselInfoSection: {
19441
19451
  width: '100%',
19442
- padding: '20px',
19452
+ padding: '10px 20px',
19443
19453
  backgroundColor: '#000',
19444
19454
  color: '#fff',
19445
19455
  textAlign: 'center'
@@ -19641,6 +19651,8 @@ const StructurePage = (_a) => {
19641
19651
  const [loading, setLoading] = React.useState(true);
19642
19652
  const [error, setError] = React.useState(null);
19643
19653
  const [carouselIndex, setCarouselIndex] = React.useState(0);
19654
+ const [touchStart, setTouchStart] = React.useState(null);
19655
+ const [touchEnd, setTouchEnd] = React.useState(null);
19644
19656
  const heroVideoRef = React.useRef(null);
19645
19657
  const carouselVideoRefs = React.useRef([]);
19646
19658
  // 视频暂停状态管理
@@ -19720,7 +19732,7 @@ const StructurePage = (_a) => {
19720
19732
  const config = multiCTAConfig[configKey];
19721
19733
  // 定义允许的样式属性列表
19722
19734
  const styleKeys = [
19723
- 'fontSize', 'color', 'textAlign', 'fontWeight',
19735
+ 'fontSize', 'color', 'textAlign', 'fontWeight', 'fontStyle', 'textDecoration',
19724
19736
  'backgroundColor', 'padding', 'margin', 'borderRadius',
19725
19737
  'showBorder', 'borderWidth', 'borderColor',
19726
19738
  'buttonBackgroundColor', 'buttonTextColor', 'buttonWidth', 'buttonHeight'
@@ -19747,8 +19759,16 @@ const StructurePage = (_a) => {
19747
19759
  if (styleConfig.textAlign && typeof styleConfig.textAlign === 'string') {
19748
19760
  customStyle.textAlign = styleConfig.textAlign;
19749
19761
  }
19750
- if (styleConfig.fontWeight && typeof styleConfig.fontWeight === 'number') {
19751
- customStyle.fontWeight = styleConfig.fontWeight;
19762
+ if (styleConfig.fontWeight) {
19763
+ customStyle.fontWeight = typeof styleConfig.fontWeight === 'number'
19764
+ ? styleConfig.fontWeight
19765
+ : styleConfig.fontWeight;
19766
+ }
19767
+ if (styleConfig.fontStyle && typeof styleConfig.fontStyle === 'string') {
19768
+ customStyle.fontStyle = styleConfig.fontStyle;
19769
+ }
19770
+ if (styleConfig.textDecoration && typeof styleConfig.textDecoration === 'string') {
19771
+ customStyle.textDecoration = styleConfig.textDecoration;
19752
19772
  }
19753
19773
  if (styleConfig.backgroundColor && typeof styleConfig.backgroundColor === 'string') {
19754
19774
  customStyle.backgroundColor = styleConfig.backgroundColor;
@@ -20008,6 +20028,39 @@ const StructurePage = (_a) => {
20008
20028
  setCarouselIndex((prev) => (prev === data.carouselSection.length - 1 ? 0 : prev + 1));
20009
20029
  }
20010
20030
  };
20031
+ // 触摸滑动处理
20032
+ const handleTouchStart = (e) => {
20033
+ setTouchEnd(null);
20034
+ setTouchStart(e.targetTouches[0].clientX);
20035
+ };
20036
+ const handleTouchMove = (e) => {
20037
+ if (!touchStart)
20038
+ return;
20039
+ const currentTouch = e.targetTouches[0].clientX;
20040
+ setTouchEnd(currentTouch);
20041
+ // 如果移动距离大于阈值,阻止默认行为(防止拖拽图片)
20042
+ const distance = Math.abs(touchStart - currentTouch);
20043
+ if (distance > 10) {
20044
+ e.preventDefault();
20045
+ }
20046
+ };
20047
+ const handleTouchEnd = () => {
20048
+ if (!touchStart || !touchEnd)
20049
+ return;
20050
+ const distance = touchStart - touchEnd;
20051
+ const minSwipeDistance = 50;
20052
+ if (distance > minSwipeDistance) {
20053
+ // 向左滑动,下一张
20054
+ handleCarouselNext();
20055
+ }
20056
+ else if (distance < -minSwipeDistance) {
20057
+ // 向右滑动,上一张
20058
+ handleCarouselPrev();
20059
+ }
20060
+ // 重置状态
20061
+ setTouchStart(null);
20062
+ setTouchEnd(null);
20063
+ };
20011
20064
  if (loading) {
20012
20065
  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..."));
20013
20066
  }
@@ -20028,14 +20081,14 @@ const StructurePage = (_a) => {
20028
20081
  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,
20029
20082
  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))))),
20030
20083
  data.carouselSection && data.carouselSection.length > 0 && (React.createElement("div", { style: mergeStyles(baseStyles.carouselSection, 'carouselSection') },
20031
- React.createElement("div", { style: baseStyles.carouselImageContainer },
20084
+ React.createElement("div", { style: baseStyles.carouselImageContainer, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd },
20032
20085
  React.createElement("div", { style: Object.assign(Object.assign({}, baseStyles.carouselContainer), { transform: `translateX(-${carouselIndex * 100}%)` }) }, data.carouselSection.map((item, index) => {
20033
20086
  var _a;
20034
20087
  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) },
20035
20088
  React.createElement("video", { ref: (el) => {
20036
20089
  carouselVideoRefs.current[index] = el;
20037
- }, src: item.url, style: baseStyles.carouselVideo, muted: true, loop: true, playsInline: true, controls: false }),
20038
- 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));
20090
+ }, src: item.url, style: baseStyles.carouselVideo, muted: true, loop: true, playsInline: true, controls: false, draggable: false, onDragStart: (e) => e.preventDefault() }),
20091
+ 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));
20039
20092
  })),
20040
20093
  React.createElement("button", { style: Object.assign(Object.assign({}, baseStyles.arrowButton), { left: '10px' }), onClick: handleCarouselPrev }, "\u2039"),
20041
20094
  React.createElement("button", { style: Object.assign(Object.assign({}, baseStyles.arrowButton), { right: '10px' }), onClick: handleCarouselNext }, "\u203A")),
@@ -20046,7 +20099,8 @@ const StructurePage = (_a) => {
20046
20099
  React.createElement("div", { style: baseStyles.highlightImageContainer },
20047
20100
  React.createElement("img", { src: data.highlightRevealSection.landingImageUrl || data.highlightRevealSection.cover, alt: data.highlightRevealSection.title, style: baseStyles.highlightImage })),
20048
20101
  React.createElement("div", { style: mergeStyles(baseStyles.highlightInfoSection, 'highlightSection') },
20049
- React.createElement("div", { style: mergeStyles(baseStyles.highlightTitle, 'highlightSection') }, data.highlightRevealSection.title),
20102
+ data.highlightRevealSection.text && (React.createElement("div", { style: { marginBottom: '10px' } },
20103
+ React.createElement("div", { style: mergeStyles(baseStyles.highlightTitle, 'highlightSection') }, data.highlightRevealSection.text))),
20050
20104
  renderCTA('highlightButton', data.highlightRevealSection.bindCta, data.highlightRevealSection, baseStyles.highlightButton)))),
20051
20105
  data.productGridSection && data.productGridSection.length > 0 && (React.createElement("div", { style: mergeStyles(baseStyles.productGrid, 'productGrid') }, (() => {
20052
20106
  // 创建一个6格的网格 (3行 x 2列),根据position放置产品
@@ -20096,7 +20150,10 @@ const StructurePage = (_a) => {
20096
20150
  });
20097
20151
  })())),
20098
20152
  data.footerSection && (React.createElement("div", { style: mergeStyles(baseStyles.footerSection, 'footerSection') },
20099
- React.createElement("div", { style: mergeStyles(baseStyles.footerInfoSection, 'footerSection') }, renderCTA('footerButton', data.footerSection.bindCta, data.footerSection, baseStyles.footerButton)),
20153
+ React.createElement("div", { style: mergeStyles(baseStyles.footerInfoSection, 'footerSection') },
20154
+ data.footerSection.text && (React.createElement("div", { style: { marginBottom: '15px' } },
20155
+ React.createElement("div", { style: mergeStyles(baseStyles.footerText, 'footerSection') }, data.footerSection.text))),
20156
+ renderCTA('footerButton', data.footerSection.bindCta, data.footerSection, baseStyles.footerButton)),
20100
20157
  React.createElement("div", { style: baseStyles.footerImageContainer },
20101
20158
  React.createElement("img", { src: data.footerSection.landingImageUrl || data.footerSection.cover, alt: data.footerSection.title, style: baseStyles.footerImage }))))));
20102
20159
  };