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/index.cjs CHANGED
@@ -12093,13 +12093,24 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12093
12093
  });
12094
12094
  }
12095
12095
  }, [data, index, bffEventReport]);
12096
+ const blur = React.useMemo(() => {
12097
+ return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12098
+ }, [videoPostConfig]);
12099
+ const translateY = React.useMemo(() => {
12100
+ var _a;
12101
+ return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
12102
+ ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%) translate3d(0px, 0px, 0px)`
12103
+ : 'translateY(-50%)';
12104
+ }, [videoPostConfig]);
12105
+ const blurBgSrc = React.useMemo(() => {
12106
+ var _a;
12107
+ return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
12108
+ }, [firstFrameSrc, rec]);
12096
12109
  const handLoadeddata = React.useCallback(() => {
12097
- const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
12098
- if (!video)
12110
+ if (!canvasRef || !videoRef || !videoRef.current || !canvasRef.current)
12099
12111
  return;
12112
+ const video = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current;
12100
12113
  const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
12101
- if (!canvas)
12102
- return;
12103
12114
  const ctx = canvas.getContext('2d');
12104
12115
  const targetWidth = window === null || window === void 0 ? void 0 : window.innerWidth;
12105
12116
  const targetHeight = window === null || window === void 0 ? void 0 : window.innerHeight;
@@ -12107,10 +12118,9 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12107
12118
  canvas.width = targetWidth;
12108
12119
  ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
12109
12120
  setFirstFrameSrc(canvas.toDataURL());
12110
- canvas.remove();
12111
12121
  }, []);
12112
12122
  React.useEffect(() => {
12113
- var _a, _b, _c;
12123
+ var _a, _b, _c, _d;
12114
12124
  if (!videoRef.current)
12115
12125
  return;
12116
12126
  setIsPauseVideo(false);
@@ -12133,14 +12143,16 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12133
12143
  videoRef.current.setAttribute('x5-playsinline', 'true');
12134
12144
  videoRef.current.setAttribute('webkit-playsinline', 'true');
12135
12145
  }
12136
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('canplay', handleLoadedMetadata);
12137
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('playing', handlePlaying);
12138
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('loadeddata', handLoadeddata);
12146
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('loadedmetadata', handleLoadedMetadata);
12147
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
12148
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
12149
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('loadeddata', handLoadeddata);
12139
12150
  return () => {
12140
- var _a, _b, _c;
12141
- (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
12142
- (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('playing', handlePlaying);
12143
- (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('loadeddata', handLoadeddata);
12151
+ var _a, _b, _c, _d;
12152
+ (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedMetadata);
12153
+ (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('canplay', handleLoadedMetadata);
12154
+ (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('playing', handlePlaying);
12155
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('loadeddata', handLoadeddata);
12144
12156
  };
12145
12157
  }, [handleLoadedMetadata, handlePlaying, rec.video, handLoadeddata]);
12146
12158
  React.useEffect(() => {
@@ -12199,19 +12211,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12199
12211
  window.removeEventListener('beforeunload', handleBeforeUnload);
12200
12212
  };
12201
12213
  }, [activeIndex, index, rec, videoRef, handleClickVideo, isPauseVideo]);
12202
- const blur = React.useMemo(() => {
12203
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
12204
- }, [videoPostConfig]);
12205
- const translateY = React.useMemo(() => {
12206
- var _a;
12207
- return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
12208
- ? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
12209
- : 'translateY(-50%)';
12210
- }, [videoPostConfig]);
12211
- const blurBgSrc = React.useMemo(() => {
12212
- var _a;
12213
- return ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) || firstFrameSrc;
12214
- }, [firstFrameSrc, rec]);
12214
+ const blurStyle = React.useMemo(() => {
12215
+ return blur
12216
+ ? {
12217
+ filter: 'blur(10px)',
12218
+ transform: 'translate3d(0px, 0px, 0px) scale(1.2)'
12219
+ }
12220
+ : {};
12221
+ }, [blur]);
12215
12222
  if (!rec.video) {
12216
12223
  return null;
12217
12224
  }
@@ -12221,13 +12228,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12221
12228
  height,
12222
12229
  overflow: 'hidden'
12223
12230
  } },
12224
- React.createElement(FormatImage$1, { src: blurBgSrc, style: {
12225
- height: '100%',
12226
- width: '100%',
12227
- objectFit: 'cover',
12228
- filter: blur ? 'blur(10px)' : 'none',
12229
- transform: blur ? 'scale(1.2)' : 'none'
12230
- } }),
12231
+ React.createElement(FormatImage$1, { src: blurBgSrc, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) }),
12231
12232
  React.createElement("canvas", { ref: canvasRef, style: { display: 'none' } }),
12232
12233
  React.createElement("div", { style: {
12233
12234
  position: 'absolute',
@@ -12239,7 +12240,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12239
12240
  right: 0
12240
12241
  } },
12241
12242
  React.createElement("div", { style: { position: 'relative' } },
12242
- 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: {
12243
+ 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: {
12243
12244
  width: '100%',
12244
12245
  height: 'auto',
12245
12246
  objectFit: 'contain'
@@ -12251,7 +12252,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
12251
12252
  height,
12252
12253
  overflow: 'hidden'
12253
12254
  } },
12254
- 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 }),
12255
+ 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 }),
12255
12256
  renderPoster,
12256
12257
  React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
12257
12258
  };
@@ -12306,7 +12307,7 @@ const FingerSwipeTip = ({ imageUrl }) => {
12306
12307
  * @Author: binruan@chatlabs.com
12307
12308
  * @Date: 2024-03-20 10:27:31
12308
12309
  * @LastEditors: binruan@chatlabs.com
12309
- * @LastEditTime: 2024-04-18 19:27:35
12310
+ * @LastEditTime: 2024-04-22 14:04:00
12310
12311
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
12311
12312
  *
12312
12313
  */
@@ -12318,22 +12319,24 @@ const Picture = (props) => {
12318
12319
  const translateY = React.useMemo(() => {
12319
12320
  var _a;
12320
12321
  return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2'
12321
- ? `translateY(-${50 + ((_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
12322
+ ? `translateY(-${50 + ((_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%) translate3d(0px, 0px, 0px)`
12322
12323
  : 'translateY(-50%)';
12323
12324
  }, [imgUrlsPostConfig]);
12325
+ const blurStyle = React.useMemo(() => {
12326
+ return blur
12327
+ ? {
12328
+ filter: 'blur(10px)',
12329
+ transform: 'translate3d(0px, 0px, 0px) scale(1.2)'
12330
+ }
12331
+ : {};
12332
+ }, [blur]);
12324
12333
  return (React.createElement("div", { style: {
12325
12334
  overflow: 'hidden',
12326
12335
  height,
12327
12336
  width: '100%',
12328
12337
  position: 'relative'
12329
12338
  } },
12330
- React.createElement(FormatImage$1, { src: src, style: {
12331
- height: '100%',
12332
- width: '100%',
12333
- objectFit: 'cover',
12334
- filter: blur ? 'blur(10px)' : 'none',
12335
- transform: blur ? 'scale(1.2)' : 'none'
12336
- } }),
12339
+ React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) }),
12337
12340
  blur && (React.createElement(FormatImage$1, { src: src, style: {
12338
12341
  width: '100%',
12339
12342
  objectFit: 'contain',
@@ -13113,3 +13116,4 @@ exports.default = Pagebuilder;
13113
13116
  exports.defaultSetting = defaultSetting;
13114
13117
  exports.materials = _materials_;
13115
13118
  exports.useEditorDataProvider = useEditorDataProvider;
13119
+ //# sourceMappingURL=index.cjs.map