pb-sxp-ui 1.0.3-alpha.2 → 1.0.3-alpha.4

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.css CHANGED
@@ -62,6 +62,7 @@
62
62
 
63
63
  .pb-commondity {
64
64
  position: relative;
65
+ height: 100%;
65
66
  }
66
67
  .pb-commondity-content {
67
68
  padding: 21px 19px 80px;
@@ -162,14 +163,16 @@
162
163
  -ms-flex: 1;
163
164
  flex: 1;
164
165
  }
165
- .pb-commondityDiroNew-content-top-price {
166
- font-size: 13px;
167
- font-weight: bold;
166
+ .pb-commondityDiroNew-content-top-right {
168
167
  -webkit-flex-shrink: 0;
169
168
  -ms-flex-negative: 0;
170
169
  flex-shrink: 0;
171
170
  margin-left: 35px;
172
171
  }
172
+ .pb-commondityDiroNew-content-top-right-price {
173
+ font-size: 13px;
174
+ font-weight: bold;
175
+ }
173
176
  .pb-commondityDiroNew-content-collection {
174
177
  font-size: 13px;
175
178
  color: #757575;
@@ -669,7 +672,6 @@
669
672
  margin-bottom: 40px;
670
673
  text-align: center;
671
674
  color: #757575;
672
- display: block;
673
675
  font-size: 12px;
674
676
  text-decoration: underline;
675
677
  cursor: pointer;
@@ -1454,6 +1456,7 @@ button.swiper-pagination-bullet {
1454
1456
  height: 100%;
1455
1457
  -o-object-fit: contain;
1456
1458
  object-fit: contain;
1459
+ display: block;
1457
1460
  }
1458
1461
  .flex {
1459
1462
  display: -webkit-box;
package/dist/index.js CHANGED
@@ -8209,7 +8209,7 @@ var Modal$1 = memo(Modal);
8209
8209
  * @Author: binruan@chatlabs.com
8210
8210
  * @Date: 2023-12-26 16:11:34
8211
8211
  * @LastEditors: binruan@chatlabs.com
8212
- * @LastEditTime: 2024-04-02 18:52:59
8212
+ * @LastEditTime: 2024-04-09 11:00:07
8213
8213
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\ExpandableText.tsx
8214
8214
  *
8215
8215
  */
@@ -8252,7 +8252,7 @@ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldTex
8252
8252
  const cs = (_a = window === null || window === void 0 ? void 0 : window.getComputedStyle) === null || _a === void 0 ? void 0 : _a.call(window, multiRow.current);
8253
8253
  const height = parseFloat(cs === null || cs === void 0 ? void 0 : cs.height);
8254
8254
  const lh = parseFloat(cs === null || cs === void 0 ? void 0 : cs.lineHeight);
8255
- const fs = parseFloat(cs === null || cs === void 0 ? void 0 : cs.fontSize) + 4;
8255
+ const fs = parseFloat(cs === null || cs === void 0 ? void 0 : cs.fontSize) + 6;
8256
8256
  const lineHeight = isNaN(lh) ? fs : lh;
8257
8257
  if (text && height > lineHeight * lineClamp) {
8258
8258
  setIsShowMore(false);
@@ -8320,15 +8320,16 @@ const CommodityDetail$1 = (_a) => {
8320
8320
  const width = isPreview ? 375 : window.innerWidth;
8321
8321
  const renderContent = ({ isPost }) => {
8322
8322
  var _a, _b, _c;
8323
- return (React.createElement("div", { className: 'pb-commondity-content' },
8324
- React.createElement("div", { className: 'pb-commondity-content-collection', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection }, (_a = product === null || product === void 0 ? void 0 : product.collection) !== null && _a !== void 0 ? _a : 'Tiffany Lock'),
8325
- React.createElement("div", { className: 'pb-commondity-content-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (_b = product === null || product === void 0 ? void 0 : product.title) !== null && _b !== void 0 ? _b : 'Pendant in Yellow Gold with Diamonds, Medium'),
8326
- React.createElement("div", { className: 'pb-commondity-content-price', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price }, priceText),
8327
- React.createElement(ExpandableText$1, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_c = product === null || product === void 0 ? void 0 : product.info) !== null && _c !== void 0 ? _c : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
8323
+ return (React.createElement("div", null,
8324
+ React.createElement("div", { className: 'pb-commondity-content-collection', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection, hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === '') }, (_a = product === null || product === void 0 ? void 0 : product.collection) !== null && _a !== void 0 ? _a : 'Tiffany Lock'),
8325
+ React.createElement("div", { className: 'pb-commondity-content-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title, hidden: !!product && !(product === null || product === void 0 ? void 0 : product.title) }, (_b = product === null || product === void 0 ? void 0 : product.title) !== null && _b !== void 0 ? _b : 'Pendant in Yellow Gold with Diamonds, Medium'),
8326
+ React.createElement("div", { className: 'pb-commondity-content-price', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price) }, priceText),
8327
+ React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
8328
+ React.createElement(ExpandableText$1, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_c = product === null || product === void 0 ? void 0 : product.info) !== null && _c !== void 0 ? _c : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
8328
8329
  bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
8329
8330
  collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
8330
8331
  necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
8331
- 18-karat gold, this necklace is embellished with hand-set diamonds.`, maxStr: 79, className: 'pb-commondity-content-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info })));
8332
+ 18-karat gold, this necklace is embellished with hand-set diamonds.`, maxStr: 79, className: 'pb-commondity-content-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info }))));
8332
8333
  };
8333
8334
  const renderBtn = () => {
8334
8335
  var _a;
@@ -8367,10 +8368,10 @@ const CommodityDetail$1 = (_a) => {
8367
8368
  objectFit: 'cover',
8368
8369
  width: '100%'
8369
8370
  }), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
8370
- renderContent({ isPost })),
8371
+ React.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
8371
8372
  renderBtn(),
8372
8373
  React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) },
8373
- renderContent({ isPost: false }),
8374
+ React.createElement("div", { style: { paddingBottom: '80px' } }, renderContent({ isPost: false })),
8374
8375
  renderBtn())));
8375
8376
  };
8376
8377
  var CommodityDetailComponent = memo(CommodityDetail$1);
@@ -8813,11 +8814,12 @@ Made in Italy` })));
8813
8814
  }), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
8814
8815
  React.createElement("div", { className: 'pb-commondityDiroNew-content' },
8815
8816
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
8816
- React.createElement("div", { className: 'pb-commondityDiroNew-content-top-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (_k = product === null || product === void 0 ? void 0 : product.title) !== null && _k !== void 0 ? _k : 'Large Dior Toujours Bag'),
8817
- React.createElement("div", { className: '' },
8818
- React.createElement("div", { className: 'pb-commondityDiroNew-content-top-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price }, priceText),
8819
- React.createElement("div", { className: 'pb-commondityDiroNew-content-top-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo }, (_l = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _l !== void 0 ? _l : '税费'))),
8820
- React.createElement("div", { className: 'pb-commondityDiroNew-content-collection', hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === ''), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection }, (product === null || product === void 0 ? void 0 : product.collection) || 'Black Macrocannage Calfskin'),
8817
+ React.createElement("div", null,
8818
+ React.createElement("div", { className: 'pb-commondityDiroNew-content-top-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (_k = product === null || product === void 0 ? void 0 : product.title) !== null && _k !== void 0 ? _k : 'Large Dior Toujours Bag'),
8819
+ React.createElement("div", { className: 'pb-commondityDiroNew-content-collection', hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === ''), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection }, (product === null || product === void 0 ? void 0 : product.collection) || 'Black Macrocannage Calfskin')),
8820
+ React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right' },
8821
+ React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price }, priceText),
8822
+ React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo }, (_l = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _l !== void 0 ? _l : '税费'))),
8821
8823
  (!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle }, (_m = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _m !== void 0 ? _m : 'Shop now')),
8822
8824
  productInfoText({ isPost }))),
8823
8825
  React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
@@ -11518,7 +11520,7 @@ const WaterfallFlowItem = (props) => {
11518
11520
  React.createElement("img", { className: 'list-content-listItem-picture-img', loading: 'lazy', ref: imgDom })),
11519
11521
  React.createElement("div", { className: 'list-content-listItem-info' },
11520
11522
  React.createElement("div", { className: `${'list-content-listItem-info-title'} ${priceText ? 'list-content-listItem-info-nowrap' : ''}`, style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.title }, title && title),
11521
- React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles.price, hidden: !priceText }, priceText))));
11523
+ React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText }, priceText))));
11522
11524
  };
11523
11525
  function WaterfallList(_a) {
11524
11526
  var _b, _c, _d, _e, _f, _g, _h;
@@ -11880,10 +11882,8 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
11880
11882
  videoRef.current.muted = muted;
11881
11883
  }, [muted]);
11882
11884
  const handleVideoStart = useCallback(() => {
11883
- var _a, _b;
11884
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) < 2)
11885
- return;
11886
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
11885
+ var _a;
11886
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
11887
11887
  }, []);
11888
11888
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
11889
11889
  const handlePlaying = useCallback(() => {
@@ -11940,38 +11940,37 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
11940
11940
  });
11941
11941
  }
11942
11942
  setTimeout(() => {
11943
- var _a, _b;
11944
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) < 2)
11945
- return;
11946
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
11943
+ var _a;
11944
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
11947
11945
  }, 0);
11948
11946
  }, [index, bffEventReport, data, isLoad]);
11949
11947
  const handleClickVideo = useCallback((type) => () => {
11950
- var _a, _b, _c, _d, _e, _f;
11951
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) < 2)
11952
- return;
11948
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11953
11949
  if (!isLoad)
11954
11950
  return;
11955
- const isPause = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.paused;
11951
+ data[index];
11952
+ ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
11953
+ ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
11954
+ const isPause = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.paused;
11956
11955
  switch (type) {
11957
11956
  case 'start':
11958
11957
  if (!isPause)
11959
11958
  return;
11960
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
11959
+ (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.play();
11961
11960
  setIsPauseVideo(false);
11962
11961
  break;
11963
11962
  case 'pause':
11964
11963
  if (isPause)
11965
11964
  return;
11966
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.pause();
11965
+ (_g = videoRef.current) === null || _g === void 0 ? void 0 : _g.pause();
11967
11966
  setIsPauseVideo(true);
11968
11967
  break;
11969
11968
  default:
11970
11969
  if (isPause) {
11971
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
11970
+ (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
11972
11971
  }
11973
11972
  else {
11974
- (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
11973
+ (_j = videoRef.current) === null || _j === void 0 ? void 0 : _j.pause();
11975
11974
  }
11976
11975
  setIsPauseVideo(!isPause);
11977
11976
  break;
@@ -12002,16 +12001,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
12002
12001
  }
12003
12002
  }, [data, index, bffEventReport]);
12004
12003
  useEffect(() => {
12005
- var _a, _b, _c, _d, _e, _f;
12004
+ var _a, _b, _c;
12006
12005
  if (data.length <= 0)
12007
12006
  return;
12008
12007
  if (!videoRef.current)
12009
12008
  return;
12010
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12011
12009
  setIsPauseVideo(false);
12012
12010
  if (!isActive) {
12013
- if (!isPause && ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.readyState) >= 2)
12014
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
12011
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
12015
12012
  return;
12016
12013
  }
12017
12014
  if (!videoRef.current.src) {
@@ -12034,12 +12031,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
12034
12031
  videoRef.current.setAttribute('webkit-playsinline', 'true');
12035
12032
  }
12036
12033
  else {
12037
- if (((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.readyState) < 2)
12038
- return;
12039
12034
  videoRef.current.play();
12040
12035
  }
12041
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.addEventListener('canplay', handleLoadedMetadata);
12042
- (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.addEventListener('playing', handlePlaying);
12036
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
12037
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
12043
12038
  return () => {
12044
12039
  var _a, _b;
12045
12040
  (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
@@ -12050,17 +12045,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
12050
12045
  打开/关闭hashtag暂停/播放视频
12051
12046
  */
12052
12047
  useEffect(() => {
12053
- var _a, _b, _c, _d;
12054
- if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) < 2)
12055
- return;
12056
- const isPause = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.paused;
12048
+ var _a, _b, _c;
12049
+ const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12057
12050
  if (!isActive)
12058
12051
  return;
12059
12052
  if (!isPause && openHashtag) {
12060
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
12053
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
12061
12054
  }
12062
12055
  else if (!openHashtag) {
12063
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
12056
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
12064
12057
  }
12065
12058
  }, [openHashtag, isActive]);
12066
12059
  useEffect(() => {
@@ -12152,10 +12145,35 @@ const FingerSwipeTip = ({ imageUrl }) => {
12152
12145
  React.createElement("img", { src: imageUrl || FINGER_SWIPE_ICON })));
12153
12146
  };
12154
12147
 
12148
+ /*
12149
+ * @Author: binruan@chatlabs.com
12150
+ * @Date: 2024-03-20 10:27:31
12151
+ * @LastEditors: binruan@chatlabs.com
12152
+ * @LastEditTime: 2024-04-08 18:44:58
12153
+ * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
12154
+ *
12155
+ */
12155
12156
  const Picture = (props) => {
12156
12157
  const { src, height, width } = props;
12158
+ const [blur, setBlur] = useState(false);
12157
12159
  const imgDom = useRef(null);
12158
12160
  const { sxpParameter } = useSxpDataSource();
12161
+ useEffect(() => {
12162
+ if (imgDom.current === null || src === '') {
12163
+ return;
12164
+ }
12165
+ const img = new Image();
12166
+ img.src = src;
12167
+ img.onload = () => {
12168
+ const aspectRatio = img.height / img.width;
12169
+ const targetAspectRatio = 16 / 9;
12170
+ const tolerance = 0.05; // 允许的宽高比误差范围
12171
+ if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
12172
+ setBlur(true);
12173
+ }
12174
+ };
12175
+ imgDom.current.src = src;
12176
+ }, [src]);
12159
12177
  return (React.createElement("div", { style: {
12160
12178
  overflow: 'hidden',
12161
12179
  height,
@@ -12165,8 +12183,19 @@ const Picture = (props) => {
12165
12183
  React.createElement("img", { ref: imgDom, loading: 'lazy', src: src !== null && src !== void 0 ? src : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, style: {
12166
12184
  height: '100%',
12167
12185
  width: '100%',
12168
- objectFit: 'cover'
12169
- } })));
12186
+ objectFit: 'cover',
12187
+ filter: blur ? 'blur(10px)' : 'none',
12188
+ transform: blur ? 'scale(1.2)' : 'none'
12189
+ } }),
12190
+ blur && (React.createElement("img", { ref: imgDom, src: src, loading: 'lazy', style: {
12191
+ width: '100%',
12192
+ objectFit: 'contain',
12193
+ position: 'absolute',
12194
+ top: '50%',
12195
+ transform: 'translateY(-50%)',
12196
+ left: 0,
12197
+ right: 0
12198
+ } }))));
12170
12199
  };
12171
12200
 
12172
12201
  /*