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.cjs CHANGED
@@ -8232,7 +8232,7 @@ var Modal$1 = React.memo(Modal);
8232
8232
  * @Author: binruan@chatlabs.com
8233
8233
  * @Date: 2023-12-26 16:11:34
8234
8234
  * @LastEditors: binruan@chatlabs.com
8235
- * @LastEditTime: 2024-04-02 18:52:59
8235
+ * @LastEditTime: 2024-04-09 11:00:07
8236
8236
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\ExpandableText.tsx
8237
8237
  *
8238
8238
  */
@@ -8275,7 +8275,7 @@ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldTex
8275
8275
  const cs = (_a = window === null || window === void 0 ? void 0 : window.getComputedStyle) === null || _a === void 0 ? void 0 : _a.call(window, multiRow.current);
8276
8276
  const height = parseFloat(cs === null || cs === void 0 ? void 0 : cs.height);
8277
8277
  const lh = parseFloat(cs === null || cs === void 0 ? void 0 : cs.lineHeight);
8278
- const fs = parseFloat(cs === null || cs === void 0 ? void 0 : cs.fontSize) + 4;
8278
+ const fs = parseFloat(cs === null || cs === void 0 ? void 0 : cs.fontSize) + 6;
8279
8279
  const lineHeight = isNaN(lh) ? fs : lh;
8280
8280
  if (text && height > lineHeight * lineClamp) {
8281
8281
  setIsShowMore(false);
@@ -8343,15 +8343,16 @@ const CommodityDetail$1 = (_a) => {
8343
8343
  const width = isPreview ? 375 : window.innerWidth;
8344
8344
  const renderContent = ({ isPost }) => {
8345
8345
  var _a, _b, _c;
8346
- return (React.createElement("div", { className: 'pb-commondity-content' },
8347
- 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'),
8348
- 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'),
8349
- React.createElement("div", { className: 'pb-commondity-content-price', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price }, priceText),
8350
- 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
8346
+ return (React.createElement("div", null,
8347
+ 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'),
8348
+ 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'),
8349
+ 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),
8350
+ React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
8351
+ 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
8351
8352
  bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
8352
8353
  collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
8353
8354
  necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
8354
- 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 })));
8355
+ 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 }))));
8355
8356
  };
8356
8357
  const renderBtn = () => {
8357
8358
  var _a;
@@ -8390,10 +8391,10 @@ const CommodityDetail$1 = (_a) => {
8390
8391
  objectFit: 'cover',
8391
8392
  width: '100%'
8392
8393
  }), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
8393
- renderContent({ isPost })),
8394
+ React.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
8394
8395
  renderBtn(),
8395
8396
  React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) },
8396
- renderContent({ isPost: false }),
8397
+ React.createElement("div", { style: { paddingBottom: '80px' } }, renderContent({ isPost: false })),
8397
8398
  renderBtn())));
8398
8399
  };
8399
8400
  var CommodityDetailComponent = React.memo(CommodityDetail$1);
@@ -8836,11 +8837,12 @@ Made in Italy` })));
8836
8837
  }), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
8837
8838
  React.createElement("div", { className: 'pb-commondityDiroNew-content' },
8838
8839
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
8839
- 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'),
8840
- React.createElement("div", { className: '' },
8841
- 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),
8842
- 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 : '税费'))),
8843
- 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'),
8840
+ React.createElement("div", null,
8841
+ 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'),
8842
+ 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')),
8843
+ React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right' },
8844
+ 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),
8845
+ 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 : '税费'))),
8844
8846
  (!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')),
8845
8847
  productInfoText({ isPost }))),
8846
8848
  React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
@@ -11541,7 +11543,7 @@ const WaterfallFlowItem = (props) => {
11541
11543
  React.createElement("img", { className: 'list-content-listItem-picture-img', loading: 'lazy', ref: imgDom })),
11542
11544
  React.createElement("div", { className: 'list-content-listItem-info' },
11543
11545
  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),
11544
- React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles.price, hidden: !priceText }, priceText))));
11546
+ React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText }, priceText))));
11545
11547
  };
11546
11548
  function WaterfallList(_a) {
11547
11549
  var _b, _c, _d, _e, _f, _g, _h;
@@ -11903,10 +11905,8 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
11903
11905
  videoRef.current.muted = muted;
11904
11906
  }, [muted]);
11905
11907
  const handleVideoStart = React.useCallback(() => {
11906
- var _a, _b;
11907
- 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)
11908
- return;
11909
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
11908
+ var _a;
11909
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
11910
11910
  }, []);
11911
11911
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
11912
11912
  const handlePlaying = React.useCallback(() => {
@@ -11963,38 +11963,37 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
11963
11963
  });
11964
11964
  }
11965
11965
  setTimeout(() => {
11966
- var _a, _b;
11967
- 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)
11968
- return;
11969
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
11966
+ var _a;
11967
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
11970
11968
  }, 0);
11971
11969
  }, [index, bffEventReport, data, isLoad]);
11972
11970
  const handleClickVideo = React.useCallback((type) => () => {
11973
- var _a, _b, _c, _d, _e, _f;
11974
- 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)
11975
- return;
11971
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11976
11972
  if (!isLoad)
11977
11973
  return;
11978
- const isPause = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.paused;
11974
+ data[index];
11975
+ ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
11976
+ ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
11977
+ const isPause = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.paused;
11979
11978
  switch (type) {
11980
11979
  case 'start':
11981
11980
  if (!isPause)
11982
11981
  return;
11983
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
11982
+ (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.play();
11984
11983
  setIsPauseVideo(false);
11985
11984
  break;
11986
11985
  case 'pause':
11987
11986
  if (isPause)
11988
11987
  return;
11989
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.pause();
11988
+ (_g = videoRef.current) === null || _g === void 0 ? void 0 : _g.pause();
11990
11989
  setIsPauseVideo(true);
11991
11990
  break;
11992
11991
  default:
11993
11992
  if (isPause) {
11994
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
11993
+ (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
11995
11994
  }
11996
11995
  else {
11997
- (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
11996
+ (_j = videoRef.current) === null || _j === void 0 ? void 0 : _j.pause();
11998
11997
  }
11999
11998
  setIsPauseVideo(!isPause);
12000
11999
  break;
@@ -12025,16 +12024,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
12025
12024
  }
12026
12025
  }, [data, index, bffEventReport]);
12027
12026
  React.useEffect(() => {
12028
- var _a, _b, _c, _d, _e, _f;
12027
+ var _a, _b, _c;
12029
12028
  if (data.length <= 0)
12030
12029
  return;
12031
12030
  if (!videoRef.current)
12032
12031
  return;
12033
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12034
12032
  setIsPauseVideo(false);
12035
12033
  if (!isActive) {
12036
- if (!isPause && ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.readyState) >= 2)
12037
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
12034
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
12038
12035
  return;
12039
12036
  }
12040
12037
  if (!videoRef.current.src) {
@@ -12057,12 +12054,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
12057
12054
  videoRef.current.setAttribute('webkit-playsinline', 'true');
12058
12055
  }
12059
12056
  else {
12060
- if (((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.readyState) < 2)
12061
- return;
12062
12057
  videoRef.current.play();
12063
12058
  }
12064
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.addEventListener('canplay', handleLoadedMetadata);
12065
- (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.addEventListener('playing', handlePlaying);
12059
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
12060
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
12066
12061
  return () => {
12067
12062
  var _a, _b;
12068
12063
  (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
@@ -12073,17 +12068,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
12073
12068
  打开/关闭hashtag暂停/播放视频
12074
12069
  */
12075
12070
  React.useEffect(() => {
12076
- var _a, _b, _c, _d;
12077
- 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)
12078
- return;
12079
- const isPause = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.paused;
12071
+ var _a, _b, _c;
12072
+ const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12080
12073
  if (!isActive)
12081
12074
  return;
12082
12075
  if (!isPause && openHashtag) {
12083
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
12076
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
12084
12077
  }
12085
12078
  else if (!openHashtag) {
12086
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
12079
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
12087
12080
  }
12088
12081
  }, [openHashtag, isActive]);
12089
12082
  React.useEffect(() => {
@@ -12175,10 +12168,35 @@ const FingerSwipeTip = ({ imageUrl }) => {
12175
12168
  React.createElement("img", { src: imageUrl || FINGER_SWIPE_ICON })));
12176
12169
  };
12177
12170
 
12171
+ /*
12172
+ * @Author: binruan@chatlabs.com
12173
+ * @Date: 2024-03-20 10:27:31
12174
+ * @LastEditors: binruan@chatlabs.com
12175
+ * @LastEditTime: 2024-04-08 18:44:58
12176
+ * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
12177
+ *
12178
+ */
12178
12179
  const Picture = (props) => {
12179
12180
  const { src, height, width } = props;
12181
+ const [blur, setBlur] = React.useState(false);
12180
12182
  const imgDom = React.useRef(null);
12181
12183
  const { sxpParameter } = useSxpDataSource();
12184
+ React.useEffect(() => {
12185
+ if (imgDom.current === null || src === '') {
12186
+ return;
12187
+ }
12188
+ const img = new Image();
12189
+ img.src = src;
12190
+ img.onload = () => {
12191
+ const aspectRatio = img.height / img.width;
12192
+ const targetAspectRatio = 16 / 9;
12193
+ const tolerance = 0.05; // 允许的宽高比误差范围
12194
+ if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
12195
+ setBlur(true);
12196
+ }
12197
+ };
12198
+ imgDom.current.src = src;
12199
+ }, [src]);
12182
12200
  return (React.createElement("div", { style: {
12183
12201
  overflow: 'hidden',
12184
12202
  height,
@@ -12188,8 +12206,19 @@ const Picture = (props) => {
12188
12206
  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: {
12189
12207
  height: '100%',
12190
12208
  width: '100%',
12191
- objectFit: 'cover'
12192
- } })));
12209
+ objectFit: 'cover',
12210
+ filter: blur ? 'blur(10px)' : 'none',
12211
+ transform: blur ? 'scale(1.2)' : 'none'
12212
+ } }),
12213
+ blur && (React.createElement("img", { ref: imgDom, src: src, loading: 'lazy', style: {
12214
+ width: '100%',
12215
+ objectFit: 'contain',
12216
+ position: 'absolute',
12217
+ top: '50%',
12218
+ transform: 'translateY(-50%)',
12219
+ left: 0,
12220
+ right: 0
12221
+ } }))));
12193
12222
  };
12194
12223
 
12195
12224
  /*