pb-sxp-ui 1.0.27 → 1.0.29

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
@@ -12085,13 +12085,24 @@ Made in Italy` })));
12085
12085
  });
12086
12086
  }
12087
12087
  }, [data, index, bffEventReport]);
12088
+ const blur = React.useMemo(() => {
12089
+ return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12090
+ }, [videoPostConfig]);
12091
+ const translateY = React.useMemo(() => {
12092
+ var _a;
12093
+ return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
12094
+ ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%) translate3d(0px, 0px, 0px)`
12095
+ : 'translateY(-50%)';
12096
+ }, [videoPostConfig]);
12097
+ const blurBgSrc = React.useMemo(() => {
12098
+ var _a;
12099
+ return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
12100
+ }, [firstFrameSrc, rec]);
12088
12101
  const handLoadeddata = React.useCallback(() => {
12089
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
12090
- if (!video)
12102
+ if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
12091
12103
  return;
12104
+ const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
12092
12105
  const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12093
- if (!canvas)
12094
- return;
12095
12106
  const ctx = canvas.getContext('2d');
12096
12107
  const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
12097
12108
  const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
@@ -12099,10 +12110,9 @@ Made in Italy` })));
12099
12110
  canvas.width = targetWidth;
12100
12111
  ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12101
12112
  setFirstFrameSrc(canvas.toDataURL());
12102
- canvas.remove();
12103
12113
  }, []);
12104
12114
  React.useEffect(() => {
12105
- var _a, _b, _c;
12115
+ var _a, _b, _c, _d;
12106
12116
  if (!videoRef.current)
12107
12117
  return;
12108
12118
  setIsPauseVideo(false);
@@ -12125,14 +12135,16 @@ Made in Italy` })));
12125
12135
  videoRef.current.setAttribute('x5-playsinline', 'true');
12126
12136
  videoRef.current.setAttribute('webkit-playsinline', 'true');
12127
12137
  }
12128
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('canplay', handleLoadedMetadata);
12129
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('playing', handlePlaying);
12130
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('loadeddata', handLoadeddata);
12138
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
12139
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
12140
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
12141
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
12131
12142
  return () => {
12132
- var _a, _b, _c;
12133
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
12134
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('playing', handlePlaying);
12135
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('loadeddata', handLoadeddata);
12143
+ var _a, _b, _c, _d;
12144
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
12145
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
12146
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
12147
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
12136
12148
  };
12137
12149
  }, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
12138
12150
  React.useEffect(() => {
@@ -12191,19 +12203,14 @@ Made in Italy` })));
12191
12203
  window.removeEventListener('beforeunload', handleBeforeUnload);
12192
12204
  };
12193
12205
  }, [activeIndex, index, rec, videoRef, handleClickVideo, isPauseVideo]);
12194
- const blur = React.useMemo(() => {
12195
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12196
- }, [videoPostConfig]);
12197
- const translateY = React.useMemo(() => {
12198
- var _a;
12199
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
12200
- ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
12201
- : 'translateY(-50%)';
12202
- }, [videoPostConfig]);
12203
- const blurBgSrc = React.useMemo(() => {
12204
- var _a;
12205
- return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
12206
- }, [firstFrameSrc, rec]);
12206
+ const blurStyle = React.useMemo(() => {
12207
+ return blur
12208
+ ? {
12209
+ filter: 'blur(10px)',
12210
+ transform: 'translate3d(0px, 0px, 0px) scale(1.2)'
12211
+ }
12212
+ : {};
12213
+ }, [blur]);
12207
12214
  if (!rec.video) {
12208
12215
  return null;
12209
12216
  }
@@ -12213,13 +12220,7 @@ Made in Italy` })));
12213
12220
  height,
12214
12221
  overflow: 'hidden'
12215
12222
  } },
12216
- React.createElement(FormatImage$1, { src: blurBgSrc, style: {
12217
- height: '100%',
12218
- width: '100%',
12219
- objectFit: 'cover',
12220
- filter: blur ? 'blur(10px)' : 'none',
12221
- transform: blur ? 'scale(1.2)' : 'none'
12222
- } }),
12223
+ React.createElement(FormatImage$1, { src: blurBgSrc, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) }),
12223
12224
  React.createElement("canvas", { ref: canvasRef, style: { display: 'none' } }),
12224
12225
  React.createElement("div", { style: {
12225
12226
  position: 'absolute',
@@ -12231,7 +12232,7 @@ Made in Italy` })));
12231
12232
  right: 0
12232
12233
  } },
12233
12234
  React.createElement("div", { style: { position: 'relative' } },
12234
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', poster: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
12235
+ React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart, style: {
12235
12236
  width: '100%',
12236
12237
  height: 'auto',
12237
12238
  objectFit: 'contain'
@@ -12243,7 +12244,7 @@ Made in Italy` })));
12243
12244
  height,
12244
12245
  overflow: 'hidden'
12245
12246
  } },
12246
- React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', poster: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
12247
+ React.createElement("video", { id: `pb-video-${index}`, className: 'clc-pb-video', ref: videoRef, crossOrigin: 'anonymous', muted: true, controls: false, playsInline: true, preload: 'auto', onPause: onPause, onEnded: handleVideoStart }),
12247
12248
  renderPoster,
12248
12249
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
12249
12250
  };
@@ -12298,7 +12299,7 @@ Made in Italy` })));
12298
12299
  * @Author: binruan@chatlabs.com
12299
12300
  * @Date: 2024-03-20 10:27:31
12300
12301
  * @LastEditors: binruan@chatlabs.com
12301
- * @LastEditTime: 2024-04-18 19:27:35
12302
+ * @LastEditTime: 2024-04-22 14:04:00
12302
12303
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
12303
12304
  *
12304
12305
  */
@@ -12310,22 +12311,24 @@ Made in Italy` })));
12310
12311
  const translateY = React.useMemo(() => {
12311
12312
  var _a;
12312
12313
  return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2'
12313
- ? `translateY(-${50 + ((_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
12314
+ ? `translateY(-${50 + ((_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%) translate3d(0px, 0px, 0px)`
12314
12315
  : 'translateY(-50%)';
12315
12316
  }, [imgUrlsPostConfig]);
12317
+ const blurStyle = React.useMemo(() => {
12318
+ return blur
12319
+ ? {
12320
+ filter: 'blur(10px)',
12321
+ transform: 'translate3d(0px, 0px, 0px) scale(1.2)'
12322
+ }
12323
+ : {};
12324
+ }, [blur]);
12316
12325
  return (React.createElement("div", { style: {
12317
12326
  overflow: 'hidden',
12318
12327
  height,
12319
12328
  width: '100%',
12320
12329
  position: 'relative'
12321
12330
  } },
12322
- React.createElement(FormatImage$1, { src: src, style: {
12323
- height: '100%',
12324
- width: '100%',
12325
- objectFit: 'cover',
12326
- filter: blur ? 'blur(10px)' : 'none',
12327
- transform: blur ? 'scale(1.2)' : 'none'
12328
- } }),
12331
+ React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) }),
12329
12332
  blur && (React.createElement(FormatImage$1, { src: src, style: {
12330
12333
  width: '100%',
12331
12334
  objectFit: 'contain',
@@ -13109,3 +13112,4 @@ Made in Italy` })));
13109
13112
  Object.defineProperty(exports, '__esModule', { value: true });
13110
13113
 
13111
13114
  }));
13115
+ //# sourceMappingURL=pb-ui.js.map