pb-sxp-ui 1.0.23 → 1.0.25

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.
Files changed (35) hide show
  1. package/dist/index.cjs +104 -96
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +104 -96
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +3 -3
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +3 -3
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +104 -96
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +3 -3
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/SxpPageRender/ExpandableText.js +1 -1
  14. package/es/core/components/SxpPageRender/PictureGroup/Picture.d.ts +3 -2
  15. package/es/core/components/SxpPageRender/PictureGroup/Picture.js +13 -13
  16. package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +2 -0
  17. package/es/core/components/SxpPageRender/PictureGroup/index.js +4 -3
  18. package/es/core/components/SxpPageRender/RenderCard.js +1 -1
  19. package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +2 -0
  20. package/es/core/components/SxpPageRender/VideoWidget/index.js +77 -67
  21. package/es/core/components/SxpPageRender/index.d.ts +8 -1
  22. package/es/core/components/SxpPageRender/index.js +3 -3
  23. package/es/materials/sxp/template/components/Img.js +1 -1
  24. package/lib/core/components/SxpPageRender/ExpandableText.js +1 -1
  25. package/lib/core/components/SxpPageRender/PictureGroup/Picture.d.ts +3 -2
  26. package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +12 -12
  27. package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +2 -0
  28. package/lib/core/components/SxpPageRender/PictureGroup/index.js +4 -3
  29. package/lib/core/components/SxpPageRender/RenderCard.js +1 -1
  30. package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +2 -0
  31. package/lib/core/components/SxpPageRender/VideoWidget/index.js +77 -67
  32. package/lib/core/components/SxpPageRender/index.d.ts +8 -1
  33. package/lib/core/components/SxpPageRender/index.js +3 -3
  34. package/lib/materials/sxp/template/components/Img.js +1 -1
  35. package/package.json +1 -1
package/dist/pb-ui.js CHANGED
@@ -8240,7 +8240,7 @@
8240
8240
  * @Author: binruan@chatlabs.com
8241
8241
  * @Date: 2023-12-26 16:11:34
8242
8242
  * @LastEditors: binruan@chatlabs.com
8243
- * @LastEditTime: 2024-04-17 13:49:29
8243
+ * @LastEditTime: 2024-04-18 14:33:15
8244
8244
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\ExpandableText.tsx
8245
8245
  *
8246
8246
  */
@@ -8285,7 +8285,7 @@
8285
8285
  }
8286
8286
  multiRowCopy.current.style.display = 'none';
8287
8287
  }, [isPost]);
8288
- return (React.createElement("div", { className: className, style: Object.assign({}, style), hidden: !text || text === '' },
8288
+ return (React.createElement("div", { className: className, style: Object.assign(Object.assign({}, style), { transform: 'translate3d(0px, 0px, 0px)' }), hidden: !text || text === '' },
8289
8289
  React.createElement("div", { ref: multiRow, style: {
8290
8290
  overflow: 'hidden',
8291
8291
  WebkitLineClamp: !isPost || isShowMore ? '' : lineClamp,
@@ -9694,7 +9694,7 @@ Made in Italy` })));
9694
9694
  * @Author: binruan@chatlabs.com
9695
9695
  * @Date: 2024-01-16 14:50:13
9696
9696
  * @LastEditors: binruan@chatlabs.com
9697
- * @LastEditTime: 2024-04-17 19:03:01
9697
+ * @LastEditTime: 2024-04-18 12:32:49
9698
9698
  * @FilePath: \pb-sxp-ui\src\materials\sxp\template\components\Img.tsx
9699
9699
  *
9700
9700
  */
@@ -9710,7 +9710,7 @@ Made in Italy` })));
9710
9710
  }, rec, item, index);
9711
9711
  }
9712
9712
  }, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
9713
- return (React.createElement("div", { ref: ref, hidden: !src },
9713
+ return (React.createElement("div", { ref: ref, hidden: !src, className: css.css({ width: '100%', height: '100%' }) },
9714
9714
  React.createElement(FormatImage$1, { className: css.css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: src })));
9715
9715
  };
9716
9716
  var Img$1 = React.memo(Img);
@@ -11981,12 +11981,13 @@ Made in Italy` })));
11981
11981
  SXP_EVENT_TYPE["PAGE_DID_HIDE"] = "pageDidHide";
11982
11982
  })(SXP_EVENT_TYPE || (SXP_EVENT_TYPE = {}));
11983
11983
 
11984
- const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
11984
+ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig }) => {
11985
11985
  const [isPauseVideo, setIsPauseVideo] = React.useState(false);
11986
11986
  const videoRef = React.useRef(null);
11987
11987
  const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
11988
11988
  const videoStartTime = React.useRef(0);
11989
- const [isLoad, setIsLoad] = React.useState(false);
11989
+ const [isLoadFinish, setIsLoadFinish] = React.useState(false);
11990
+ const [isFirstPlay, setIsFirstPlay] = React.useState(true);
11990
11991
  const { isActive } = useSwiperSlide();
11991
11992
  React.useEffect(() => {
11992
11993
  if (!videoRef.current)
@@ -12002,11 +12003,11 @@ Made in Italy` })));
12002
12003
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
12003
12004
  setIsPauseVideo(false);
12004
12005
  const item = data[index];
12005
- if (item && isLoad && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
12006
+ if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
12006
12007
  videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
12007
12008
  const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
12008
12009
  const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
12009
- const playType = '1';
12010
+ const playType = isFirstPlay ? '0' : '1';
12010
12011
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
12011
12012
  eventInfo: {
12012
12013
  eventSubject: 'playVideo',
@@ -12022,72 +12023,41 @@ Made in Italy` })));
12022
12023
  traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
12023
12024
  }
12024
12025
  });
12026
+ setIsFirstPlay(false);
12025
12027
  }
12026
- if (!isLoad) {
12027
- setIsLoad(true);
12028
- }
12029
- }, [bffEventReport, data, index, isLoad]);
12028
+ }, [bffEventReport, data, index, isFirstPlay]);
12030
12029
  const handleLoadedMetadata = React.useCallback(() => {
12031
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
12032
- const item = data[index];
12033
- if (item && !isLoad && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
12034
- videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
12035
- const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
12036
- const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
12037
- const playType = '0';
12038
- bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
12039
- eventInfo: {
12040
- eventSubject: 'playVideo',
12041
- eventDescription: 'User played the video',
12042
- contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
12043
- contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
12044
- playType,
12045
- startTime: videoCurrentTime,
12046
- videoDuration,
12047
- contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
12048
- position: index + '',
12049
- contentFormat: 'video',
12050
- traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
12051
- }
12052
- });
12053
- }
12054
- setTimeout(() => {
12055
- var _a;
12056
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
12057
- }, 0);
12058
- }, [index, bffEventReport, data, isLoad]);
12030
+ setIsLoadFinish(true);
12031
+ }, []);
12059
12032
  const handleClickVideo = React.useCallback((type) => () => {
12060
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
12061
- if (!isLoad)
12033
+ var _a, _b, _c, _d, _e;
12034
+ if (!isLoadFinish)
12062
12035
  return;
12063
- data[index];
12064
- ((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
12065
- ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
12066
- const isPause = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.paused;
12036
+ const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12067
12037
  switch (type) {
12068
12038
  case 'start':
12069
12039
  if (!isPause)
12070
12040
  return;
12071
- (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.play();
12041
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
12072
12042
  setIsPauseVideo(false);
12073
12043
  break;
12074
12044
  case 'pause':
12075
12045
  if (isPause)
12076
12046
  return;
12077
- (_g = videoRef.current) === null || _g === void 0 ? void 0 : _g.pause();
12047
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
12078
12048
  setIsPauseVideo(true);
12079
12049
  break;
12080
12050
  default:
12081
12051
  if (isPause) {
12082
- (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
12052
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
12083
12053
  }
12084
12054
  else {
12085
- (_j = videoRef.current) === null || _j === void 0 ? void 0 : _j.pause();
12055
+ (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
12086
12056
  }
12087
12057
  setIsPauseVideo(!isPause);
12088
12058
  break;
12089
12059
  }
12090
- }, [data, index, isLoad]);
12060
+ }, [isLoadFinish]);
12091
12061
  const onPause = React.useCallback(() => {
12092
12062
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
12093
12063
  const item = data[index];
@@ -12113,16 +12083,10 @@ Made in Italy` })));
12113
12083
  }
12114
12084
  }, [data, index, bffEventReport]);
12115
12085
  React.useEffect(() => {
12116
- var _a, _b, _c;
12117
- if (data.length <= 0)
12118
- return;
12086
+ var _a, _b;
12119
12087
  if (!videoRef.current)
12120
12088
  return;
12121
12089
  setIsPauseVideo(false);
12122
- if (!isActive) {
12123
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
12124
- return;
12125
- }
12126
12090
  if (!videoRef.current.src) {
12127
12091
  const videoSrc = rec.video.url;
12128
12092
  // if (videoSrc.includes('.m3u8')) {
@@ -12142,25 +12106,33 @@ Made in Italy` })));
12142
12106
  videoRef.current.setAttribute('x5-playsinline', 'true');
12143
12107
  videoRef.current.setAttribute('webkit-playsinline', 'true');
12144
12108
  }
12145
- else {
12146
- videoRef.current.play();
12147
- }
12148
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
12149
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
12109
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('canplay', handleLoadedMetadata);
12110
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('playing', handlePlaying);
12150
12111
  return () => {
12151
12112
  var _a, _b;
12152
12113
  (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
12153
12114
  (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('playing', handlePlaying);
12154
12115
  };
12155
- }, [data, handleLoadedMetadata, handlePlaying, isActive, isLoad, rec.video]);
12116
+ }, [handleLoadedMetadata, handlePlaying, rec.video]);
12117
+ React.useEffect(() => {
12118
+ var _a;
12119
+ if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
12120
+ return;
12121
+ if (isActive) {
12122
+ videoRef.current.play();
12123
+ }
12124
+ else {
12125
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
12126
+ }
12127
+ }, [isActive, isLoadFinish]);
12156
12128
  /*
12157
12129
  打开/关闭hashtag暂停/播放视频
12158
12130
  */
12159
12131
  React.useEffect(() => {
12160
12132
  var _a, _b, _c;
12161
- const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12162
- if (!isActive)
12133
+ if (!isActive || !(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
12163
12134
  return;
12135
+ const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
12164
12136
  if (!isPause && openHashtag) {
12165
12137
  (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
12166
12138
  }
@@ -12181,11 +12153,11 @@ Made in Italy` })));
12181
12153
  };
12182
12154
  }, [handleClickVideo, isActive]);
12183
12155
  const renderPoster = React.useMemo(() => {
12184
- if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image)) {
12156
+ if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image) || isLoadFinish) {
12185
12157
  return null;
12186
12158
  }
12187
- return (React.createElement("img", { hidden: isLoad, style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image }));
12188
- }, [isLoad, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
12159
+ return (React.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image }));
12160
+ }, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
12189
12161
  React.useEffect(() => {
12190
12162
  const handleBeforeUnload = () => {
12191
12163
  var _a, _b;
@@ -12198,17 +12170,54 @@ Made in Italy` })));
12198
12170
  window.removeEventListener('beforeunload', handleBeforeUnload);
12199
12171
  };
12200
12172
  }, [activeIndex, index, rec, videoRef, handleClickVideo, isPauseVideo]);
12173
+ const blur = React.useMemo(() => {
12174
+ return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12175
+ }, [videoPostConfig]);
12176
+ const translateY = React.useMemo(() => {
12177
+ var _a;
12178
+ return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
12179
+ ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
12180
+ : 'translateY(-50%)';
12181
+ }, [videoPostConfig]);
12201
12182
  if (!rec.video) {
12202
12183
  return null;
12203
12184
  }
12204
- return (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
12185
+ return (React.createElement(React.Fragment, null, blur ? (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
12186
+ position: 'relative',
12187
+ width: '100%',
12188
+ height
12189
+ } },
12190
+ React.createElement(FormatImage$1, { src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, style: {
12191
+ height: '100%',
12192
+ width: '100%',
12193
+ objectFit: 'cover',
12194
+ filter: blur ? 'blur(10px)' : 'none',
12195
+ transform: blur ? 'scale(1.2)' : 'none'
12196
+ } }),
12197
+ React.createElement("div", { style: {
12198
+ position: 'absolute',
12199
+ width: '100%',
12200
+ height: 'auto',
12201
+ top: '50%',
12202
+ transform: translateY,
12203
+ left: 0,
12204
+ right: 0
12205
+ } },
12206
+ React.createElement("div", { style: { position: 'relative' } },
12207
+ React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, poster: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
12208
+ width: '100%',
12209
+ height: 'auto',
12210
+ objectFit: 'contain'
12211
+ } }),
12212
+ renderPoster,
12213
+ React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON }))))) : (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
12205
12214
  position: 'relative',
12206
12215
  width: '100%',
12207
12216
  height
12208
12217
  } },
12209
12218
  React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, poster: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
12210
12219
  renderPoster,
12211
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })));
12220
+ React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
12212
12221
  };
12213
12222
  var VideoWidget$1 = React.memo(VideoWidget);
12214
12223
 
@@ -12261,21 +12270,21 @@ Made in Italy` })));
12261
12270
  * @Author: binruan@chatlabs.com
12262
12271
  * @Date: 2024-03-20 10:27:31
12263
12272
  * @LastEditors: binruan@chatlabs.com
12264
- * @LastEditTime: 2024-04-18 10:30:17
12273
+ * @LastEditTime: 2024-04-18 19:27:35
12265
12274
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
12266
12275
  *
12267
12276
  */
12268
12277
  const Picture = (props) => {
12269
- const { src, height, width } = props;
12270
- const [blur, setBlur] = React.useState(false);
12271
- const onLoad = (img) => {
12272
- const aspectRatio = img.naturalHeight / img.naturalWidth;
12273
- const targetAspectRatio = 16 / 9;
12274
- const tolerance = 0.05; // 允许的宽高比误差范围
12275
- if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
12276
- setBlur(true);
12277
- }
12278
- };
12278
+ const { src, height, imgUrlsPostConfig } = props;
12279
+ const blur = React.useMemo(() => {
12280
+ return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2';
12281
+ }, [imgUrlsPostConfig]);
12282
+ const translateY = React.useMemo(() => {
12283
+ var _a;
12284
+ return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2'
12285
+ ? `translateY(-${50 + ((_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
12286
+ : 'translateY(-50%)';
12287
+ }, [imgUrlsPostConfig]);
12279
12288
  return (React.createElement("div", { style: {
12280
12289
  overflow: 'hidden',
12281
12290
  height,
@@ -12288,13 +12297,13 @@ Made in Italy` })));
12288
12297
  objectFit: 'cover',
12289
12298
  filter: blur ? 'blur(10px)' : 'none',
12290
12299
  transform: blur ? 'scale(1.2)' : 'none'
12291
- }, onLoad: onLoad }),
12300
+ } }),
12292
12301
  blur && (React.createElement(FormatImage$1, { src: src, style: {
12293
12302
  width: '100%',
12294
12303
  objectFit: 'contain',
12295
12304
  position: 'absolute',
12296
12305
  top: '50%',
12297
- transform: 'translateY(-50%)',
12306
+ transform: translateY,
12298
12307
  left: 0,
12299
12308
  right: 0
12300
12309
  } }))));
@@ -12304,10 +12313,11 @@ Made in Italy` })));
12304
12313
  * @Author: lewinlu@chatlabs.com
12305
12314
  * @Date: 2024-01-03 14:39:09
12306
12315
  * @LastEditors: binruan@chatlabs.com
12307
- * @LastEditTime: 2024-04-17 18:52:45
12316
+ * @LastEditTime: 2024-04-18 19:56:22
12308
12317
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12309
12318
  */
12310
- const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
12319
+ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
12320
+ var _a;
12311
12321
  const ref = React.useRef();
12312
12322
  const { isActive } = useSwiperSlide();
12313
12323
  const { sxpParameter, openHashtag } = useSxpDataSource();
@@ -12330,9 +12340,9 @@ Made in Italy` })));
12330
12340
  // if (!isActive) {
12331
12341
  // return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
12332
12342
  // }
12333
- return (React.createElement(Swiper, { ref: ref, defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, loop: true, autoplay: { delay: 3000 } }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
12343
+ return (React.createElement(Swiper, { ref: ref, defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, loop: true, autoplay: { delay: ((_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.delay) !== null && _a !== void 0 ? _a : 3) * 1000 } }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
12334
12344
  return (React.createElement(SwiperSlide, { key: url },
12335
- React.createElement(Picture, { src: url, width: width, height: height })));
12345
+ React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
12336
12346
  })));
12337
12347
  };
12338
12348
  var PictureGroup$1 = React.memo(PictureGroup);
@@ -12446,7 +12456,7 @@ Made in Italy` })));
12446
12456
  * @Author: binruan@chatlabs.com
12447
12457
  * @Date: 2023-12-26 16:11:34
12448
12458
  * @LastEditors: binruan@chatlabs.com
12449
- * @LastEditTime: 2024-04-11 18:14:05
12459
+ * @LastEditTime: 2024-04-18 14:36:53
12450
12460
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\RenderCard.tsx
12451
12461
  *
12452
12462
  */
@@ -12480,7 +12490,7 @@ Made in Italy` })));
12480
12490
  const Component = withBindDataSource(t);
12481
12491
  const defaulSetting = (_x = t === null || t === void 0 ? void 0 : t.extend) === null || _x === void 0 ? void 0 : _x.defaulSetting;
12482
12492
  const isExternalLink = ((_0 = (_z = (_y = value === null || value === void 0 ? void 0 : value.item) === null || _y === void 0 ? void 0 : _y.event) === null || _z === void 0 ? void 0 : _z.onClick) === null || _0 === void 0 ? void 0 : _0.linkType) === 'externalLink';
12483
- return (React.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_1 = value === null || value === void 0 ? void 0 : value.item) === null || _1 === void 0 ? void 0 : _1.style), { zIndex: 50, marginLeft: '20px', boxSizing: 'border-box' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_2 = value === null || value === void 0 ? void 0 : value.item) === null || _2 === void 0 ? void 0 : _2.textStyle), bindDatas: (_4 = (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.bindDatas) !== null && _4 !== void 0 ? _4 : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_5 = value === null || value === void 0 ? void 0 : value.item) === null || _5 === void 0 ? void 0 : _5.props, { event: ((_6 = value === null || value === void 0 ? void 0 : value.item) === null || _6 === void 0 ? void 0 : _6.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, key: value === null || value === void 0 ? void 0 : value.id, recData: rec, isExternalLink: isExternalLink, index: index })));
12493
+ return (React.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_1 = value === null || value === void 0 ? void 0 : value.item) === null || _1 === void 0 ? void 0 : _1.style), { zIndex: 50, marginLeft: '20px', boxSizing: 'border-box', transform: 'translate3d(0px, 0px, 0px)' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_2 = value === null || value === void 0 ? void 0 : value.item) === null || _2 === void 0 ? void 0 : _2.textStyle), bindDatas: (_4 = (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.bindDatas) !== null && _4 !== void 0 ? _4 : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_5 = value === null || value === void 0 ? void 0 : value.item) === null || _5 === void 0 ? void 0 : _5.props, { event: ((_6 = value === null || value === void 0 ? void 0 : value.item) === null || _6 === void 0 ? void 0 : _6.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, key: value === null || value === void 0 ? void 0 : value.id, recData: rec, isExternalLink: isExternalLink, index: index })));
12484
12494
  }
12485
12495
  else {
12486
12496
  return null;
@@ -12514,7 +12524,7 @@ Made in Italy` })));
12514
12524
  * @Author: binruan@chatlabs.com
12515
12525
  * @Date: 2024-01-15 19:03:09
12516
12526
  * @LastEditors: binruan@chatlabs.com
12517
- * @LastEditTime: 2024-04-18 09:43:19
12527
+ * @LastEditTime: 2024-04-18 19:27:03
12518
12528
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12519
12529
  *
12520
12530
  */
@@ -12675,10 +12685,10 @@ Made in Italy` })));
12675
12685
  const renderContent = React.useCallback((rec, index) => {
12676
12686
  var _a, _b, _c, _d;
12677
12687
  if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
12678
- return (React.createElement(VideoWidget$1, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex }));
12688
+ return (React.createElement(VideoWidget$1, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost }));
12679
12689
  }
12680
12690
  if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
12681
- return (React.createElement(PictureGroup$1, { key: rec.video.itemId, imgUrls: rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onReportViewImageEnd: handleReportViewImageEnd, onViewImageStartEvent: handleViewImageStartEvent }));
12691
+ return (React.createElement(PictureGroup$1, { key: rec.video.itemId, imgUrls: rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onReportViewImageEnd: handleReportViewImageEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
12682
12692
  }
12683
12693
  if (rec.product && Array.isArray(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) && ((_c = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _c === void 0 ? void 0 : _c.length) > 0) {
12684
12694
  return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
@@ -12715,9 +12725,7 @@ Made in Italy` })));
12715
12725
  React.createElement("div", { className: 'clc-sxp-bottom-card' },
12716
12726
  React.createElement(RenderCard$1, { rec: rec, index: index, tempMap: tempMap, resolver: resolver })),
12717
12727
  React.createElement("div", null,
12718
- React.createElement(ExpandableText$1, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_c = (_b = rec.video) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : '', style: Object.assign({}, descStyle
12719
- // textShadow: globalConfig?.isOpenTextShadow ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none'
12720
- ), onChange: onExpandableChange }),
12728
+ React.createElement(ExpandableText$1, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_c = (_b = rec.video) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : '', style: Object.assign(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }), onChange: onExpandableChange }),
12721
12729
  React.createElement(Hashtag$1, { index: activeIndex, tags: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.hashTags) !== null && _e !== void 0 ? _e : [], itemId: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.itemId, itemType: ((_g = rec.video) === null || _g === void 0 ? void 0 : _g.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle })))));
12722
12730
  }
12723
12731
  return null;