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

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/pb-ui.js CHANGED
@@ -8828,11 +8828,12 @@ Made in Italy` })));
8828
8828
  }), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
8829
8829
  React.createElement("div", { className: 'pb-commondityDiroNew-content' },
8830
8830
  React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
8831
- 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'),
8832
- React.createElement("div", { className: '' },
8831
+ React.createElement("div", null,
8832
+ 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'),
8833
+ 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')),
8834
+ React.createElement("div", null,
8833
8835
  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),
8834
8836
  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 : '税费'))),
8835
- 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'),
8836
8837
  (!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')),
8837
8838
  productInfoText({ isPost }))),
8838
8839
  React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
@@ -11533,7 +11534,7 @@ Made in Italy` })));
11533
11534
  React.createElement("img", { className: 'list-content-listItem-picture-img', loading: 'lazy', ref: imgDom })),
11534
11535
  React.createElement("div", { className: 'list-content-listItem-info' },
11535
11536
  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),
11536
- React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles.price, hidden: !priceText }, priceText))));
11537
+ React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText }, priceText))));
11537
11538
  };
11538
11539
  function WaterfallList(_a) {
11539
11540
  var _b, _c, _d, _e, _f, _g, _h;
@@ -11895,10 +11896,8 @@ Made in Italy` })));
11895
11896
  videoRef.current.muted = muted;
11896
11897
  }, [muted]);
11897
11898
  const handleVideoStart = React.useCallback(() => {
11898
- var _a, _b;
11899
- 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)
11900
- return;
11901
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
11899
+ var _a;
11900
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
11902
11901
  }, []);
11903
11902
  const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
11904
11903
  const handlePlaying = React.useCallback(() => {
@@ -11955,38 +11954,37 @@ Made in Italy` })));
11955
11954
  });
11956
11955
  }
11957
11956
  setTimeout(() => {
11958
- var _a, _b;
11959
- 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)
11960
- return;
11961
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
11957
+ var _a;
11958
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
11962
11959
  }, 0);
11963
11960
  }, [index, bffEventReport, data, isLoad]);
11964
11961
  const handleClickVideo = React.useCallback((type) => () => {
11965
- var _a, _b, _c, _d, _e, _f;
11966
- 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)
11967
- return;
11962
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11968
11963
  if (!isLoad)
11969
11964
  return;
11970
- const isPause = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.paused;
11965
+ data[index];
11966
+ ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
11967
+ ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
11968
+ const isPause = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.paused;
11971
11969
  switch (type) {
11972
11970
  case 'start':
11973
11971
  if (!isPause)
11974
11972
  return;
11975
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
11973
+ (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.play();
11976
11974
  setIsPauseVideo(false);
11977
11975
  break;
11978
11976
  case 'pause':
11979
11977
  if (isPause)
11980
11978
  return;
11981
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.pause();
11979
+ (_g = videoRef.current) === null || _g === void 0 ? void 0 : _g.pause();
11982
11980
  setIsPauseVideo(true);
11983
11981
  break;
11984
11982
  default:
11985
11983
  if (isPause) {
11986
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.play();
11984
+ (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
11987
11985
  }
11988
11986
  else {
11989
- (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.pause();
11987
+ (_j = videoRef.current) === null || _j === void 0 ? void 0 : _j.pause();
11990
11988
  }
11991
11989
  setIsPauseVideo(!isPause);
11992
11990
  break;
@@ -12017,16 +12015,14 @@ Made in Italy` })));
12017
12015
  }
12018
12016
  }, [data, index, bffEventReport]);
12019
12017
  React.useEffect(() => {
12020
- var _a, _b, _c, _d, _e, _f;
12018
+ var _a, _b, _c;
12021
12019
  if (data.length <= 0)
12022
12020
  return;
12023
12021
  if (!videoRef.current)
12024
12022
  return;
12025
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12026
12023
  setIsPauseVideo(false);
12027
12024
  if (!isActive) {
12028
- if (!isPause && ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.readyState) >= 2)
12029
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
12025
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
12030
12026
  return;
12031
12027
  }
12032
12028
  if (!videoRef.current.src) {
@@ -12049,12 +12045,10 @@ Made in Italy` })));
12049
12045
  videoRef.current.setAttribute('webkit-playsinline', 'true');
12050
12046
  }
12051
12047
  else {
12052
- if (((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.readyState) < 2)
12053
- return;
12054
12048
  videoRef.current.play();
12055
12049
  }
12056
- (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.addEventListener('canplay', handleLoadedMetadata);
12057
- (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.addEventListener('playing', handlePlaying);
12050
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
12051
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
12058
12052
  return () => {
12059
12053
  var _a, _b;
12060
12054
  (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
@@ -12065,17 +12059,15 @@ Made in Italy` })));
12065
12059
  打开/关闭hashtag暂停/播放视频
12066
12060
  */
12067
12061
  React.useEffect(() => {
12068
- var _a, _b, _c, _d;
12069
- 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)
12070
- return;
12071
- const isPause = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.paused;
12062
+ var _a, _b, _c;
12063
+ const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12072
12064
  if (!isActive)
12073
12065
  return;
12074
12066
  if (!isPause && openHashtag) {
12075
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
12067
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
12076
12068
  }
12077
12069
  else if (!openHashtag) {
12078
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
12070
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
12079
12071
  }
12080
12072
  }, [openHashtag, isActive]);
12081
12073
  React.useEffect(() => {
@@ -12167,10 +12159,35 @@ Made in Italy` })));
12167
12159
  React.createElement("img", { src: imageUrl || FINGER_SWIPE_ICON })));
12168
12160
  };
12169
12161
 
12162
+ /*
12163
+ * @Author: binruan@chatlabs.com
12164
+ * @Date: 2024-03-20 10:27:31
12165
+ * @LastEditors: binruan@chatlabs.com
12166
+ * @LastEditTime: 2024-04-08 18:44:58
12167
+ * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
12168
+ *
12169
+ */
12170
12170
  const Picture = (props) => {
12171
12171
  const { src, height, width } = props;
12172
+ const [blur, setBlur] = React.useState(false);
12172
12173
  const imgDom = React.useRef(null);
12173
12174
  const { sxpParameter } = useSxpDataSource();
12175
+ React.useEffect(() => {
12176
+ if (imgDom.current === null || src === '') {
12177
+ return;
12178
+ }
12179
+ const img = new Image();
12180
+ img.src = src;
12181
+ img.onload = () => {
12182
+ const aspectRatio = img.height / img.width;
12183
+ const targetAspectRatio = 16 / 9;
12184
+ const tolerance = 0.05; // 允许的宽高比误差范围
12185
+ if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
12186
+ setBlur(true);
12187
+ }
12188
+ };
12189
+ imgDom.current.src = src;
12190
+ }, [src]);
12174
12191
  return (React.createElement("div", { style: {
12175
12192
  overflow: 'hidden',
12176
12193
  height,
@@ -12180,8 +12197,19 @@ Made in Italy` })));
12180
12197
  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: {
12181
12198
  height: '100%',
12182
12199
  width: '100%',
12183
- objectFit: 'cover'
12184
- } })));
12200
+ objectFit: 'cover',
12201
+ filter: blur ? 'blur(10px)' : 'none',
12202
+ transform: blur ? 'scale(1.2)' : 'none'
12203
+ } }),
12204
+ blur && (React.createElement("img", { ref: imgDom, src: src, loading: 'lazy', style: {
12205
+ width: '100%',
12206
+ objectFit: 'contain',
12207
+ position: 'absolute',
12208
+ top: '50%',
12209
+ transform: 'translateY(-50%)',
12210
+ left: 0,
12211
+ right: 0
12212
+ } }))));
12185
12213
  };
12186
12214
 
12187
12215
  /*