pb-sxp-ui 1.0.24 → 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.
- package/dist/index.cjs +61 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +61 -23
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +3 -3
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -3
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +61 -23
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +3 -3
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/PictureGroup/Picture.d.ts +3 -2
- package/es/core/components/SxpPageRender/PictureGroup/Picture.js +13 -13
- package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +2 -0
- package/es/core/components/SxpPageRender/PictureGroup/index.js +4 -3
- package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +2 -0
- package/es/core/components/SxpPageRender/VideoWidget/index.js +41 -3
- package/es/core/components/SxpPageRender/index.d.ts +8 -1
- package/es/core/components/SxpPageRender/index.js +2 -2
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.d.ts +3 -2
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +12 -12
- package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +2 -0
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +4 -3
- package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +2 -0
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +41 -3
- package/lib/core/components/SxpPageRender/index.d.ts +8 -1
- package/lib/core/components/SxpPageRender/index.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -11989,7 +11989,7 @@ var SXP_EVENT_TYPE;
|
|
11989
11989
|
SXP_EVENT_TYPE["PAGE_DID_HIDE"] = "pageDidHide";
|
11990
11990
|
})(SXP_EVENT_TYPE || (SXP_EVENT_TYPE = {}));
|
11991
11991
|
|
11992
|
-
const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
|
11992
|
+
const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig }) => {
|
11993
11993
|
const [isPauseVideo, setIsPauseVideo] = React.useState(false);
|
11994
11994
|
const videoRef = React.useRef(null);
|
11995
11995
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
|
@@ -12178,17 +12178,54 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
|
|
12178
12178
|
window.removeEventListener('beforeunload', handleBeforeUnload);
|
12179
12179
|
};
|
12180
12180
|
}, [activeIndex, index, rec, videoRef, handleClickVideo, isPauseVideo]);
|
12181
|
+
const blur = React.useMemo(() => {
|
12182
|
+
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
|
12183
|
+
}, [videoPostConfig]);
|
12184
|
+
const translateY = React.useMemo(() => {
|
12185
|
+
var _a;
|
12186
|
+
return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2'
|
12187
|
+
? `translateY(-${50 + ((_a = videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
|
12188
|
+
: 'translateY(-50%)';
|
12189
|
+
}, [videoPostConfig]);
|
12181
12190
|
if (!rec.video) {
|
12182
12191
|
return null;
|
12183
12192
|
}
|
12184
|
-
return (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
|
12193
|
+
return (React.createElement(React.Fragment, null, blur ? (React.createElement("div", { className: 'video-container', key: rec.video.itemId, onClick: handleClickVideo(), style: {
|
12194
|
+
position: 'relative',
|
12195
|
+
width: '100%',
|
12196
|
+
height
|
12197
|
+
} },
|
12198
|
+
React.createElement(FormatImage$1, { src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, style: {
|
12199
|
+
height: '100%',
|
12200
|
+
width: '100%',
|
12201
|
+
objectFit: 'cover',
|
12202
|
+
filter: blur ? 'blur(10px)' : 'none',
|
12203
|
+
transform: blur ? 'scale(1.2)' : 'none'
|
12204
|
+
} }),
|
12205
|
+
React.createElement("div", { style: {
|
12206
|
+
position: 'absolute',
|
12207
|
+
width: '100%',
|
12208
|
+
height: 'auto',
|
12209
|
+
top: '50%',
|
12210
|
+
transform: translateY,
|
12211
|
+
left: 0,
|
12212
|
+
right: 0
|
12213
|
+
} },
|
12214
|
+
React.createElement("div", { style: { position: 'relative' } },
|
12215
|
+
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: {
|
12216
|
+
width: '100%',
|
12217
|
+
height: 'auto',
|
12218
|
+
objectFit: 'contain'
|
12219
|
+
} }),
|
12220
|
+
renderPoster,
|
12221
|
+
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: {
|
12185
12222
|
position: 'relative',
|
12186
12223
|
width: '100%',
|
12187
12224
|
height
|
12188
12225
|
} },
|
12189
12226
|
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 }),
|
12190
12227
|
renderPoster,
|
12191
|
-
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })));
|
12228
|
+
React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON })))));
|
12192
12229
|
};
|
12193
12230
|
var VideoWidget$1 = React.memo(VideoWidget);
|
12194
12231
|
|
@@ -12241,21 +12278,21 @@ const FingerSwipeTip = ({ imageUrl }) => {
|
|
12241
12278
|
* @Author: binruan@chatlabs.com
|
12242
12279
|
* @Date: 2024-03-20 10:27:31
|
12243
12280
|
* @LastEditors: binruan@chatlabs.com
|
12244
|
-
* @LastEditTime: 2024-04-18
|
12281
|
+
* @LastEditTime: 2024-04-18 19:27:35
|
12245
12282
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
|
12246
12283
|
*
|
12247
12284
|
*/
|
12248
12285
|
const Picture = (props) => {
|
12249
|
-
const { src, height,
|
12250
|
-
const
|
12251
|
-
|
12252
|
-
|
12253
|
-
|
12254
|
-
|
12255
|
-
|
12256
|
-
|
12257
|
-
|
12258
|
-
};
|
12286
|
+
const { src, height, imgUrlsPostConfig } = props;
|
12287
|
+
const blur = React.useMemo(() => {
|
12288
|
+
return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2';
|
12289
|
+
}, [imgUrlsPostConfig]);
|
12290
|
+
const translateY = React.useMemo(() => {
|
12291
|
+
var _a;
|
12292
|
+
return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2'
|
12293
|
+
? `translateY(-${50 + ((_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.offsetTop) !== null && _a !== void 0 ? _a : 0)}%)`
|
12294
|
+
: 'translateY(-50%)';
|
12295
|
+
}, [imgUrlsPostConfig]);
|
12259
12296
|
return (React.createElement("div", { style: {
|
12260
12297
|
overflow: 'hidden',
|
12261
12298
|
height,
|
@@ -12268,13 +12305,13 @@ const Picture = (props) => {
|
|
12268
12305
|
objectFit: 'cover',
|
12269
12306
|
filter: blur ? 'blur(10px)' : 'none',
|
12270
12307
|
transform: blur ? 'scale(1.2)' : 'none'
|
12271
|
-
}
|
12308
|
+
} }),
|
12272
12309
|
blur && (React.createElement(FormatImage$1, { src: src, style: {
|
12273
12310
|
width: '100%',
|
12274
12311
|
objectFit: 'contain',
|
12275
12312
|
position: 'absolute',
|
12276
12313
|
top: '50%',
|
12277
|
-
transform:
|
12314
|
+
transform: translateY,
|
12278
12315
|
left: 0,
|
12279
12316
|
right: 0
|
12280
12317
|
} }))));
|
@@ -12284,10 +12321,11 @@ const Picture = (props) => {
|
|
12284
12321
|
* @Author: lewinlu@chatlabs.com
|
12285
12322
|
* @Date: 2024-01-03 14:39:09
|
12286
12323
|
* @LastEditors: binruan@chatlabs.com
|
12287
|
-
* @LastEditTime: 2024-04-
|
12324
|
+
* @LastEditTime: 2024-04-18 19:56:22
|
12288
12325
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
|
12289
12326
|
*/
|
12290
|
-
const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
|
12327
|
+
const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
|
12328
|
+
var _a;
|
12291
12329
|
const ref = React.useRef();
|
12292
12330
|
const { isActive } = useSwiperSlide();
|
12293
12331
|
const { sxpParameter, openHashtag } = useSxpDataSource();
|
@@ -12310,9 +12348,9 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd
|
|
12310
12348
|
// if (!isActive) {
|
12311
12349
|
// return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
|
12312
12350
|
// }
|
12313
|
-
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:
|
12351
|
+
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) => {
|
12314
12352
|
return (React.createElement(SwiperSlide, { key: url },
|
12315
|
-
React.createElement(Picture, { src: url,
|
12353
|
+
React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
|
12316
12354
|
})));
|
12317
12355
|
};
|
12318
12356
|
var PictureGroup$1 = React.memo(PictureGroup);
|
@@ -12494,7 +12532,7 @@ const Nudge = ({ nudge }) => {
|
|
12494
12532
|
* @Author: binruan@chatlabs.com
|
12495
12533
|
* @Date: 2024-01-15 19:03:09
|
12496
12534
|
* @LastEditors: binruan@chatlabs.com
|
12497
|
-
* @LastEditTime: 2024-04-18
|
12535
|
+
* @LastEditTime: 2024-04-18 19:27:03
|
12498
12536
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12499
12537
|
*
|
12500
12538
|
*/
|
@@ -12655,10 +12693,10 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12655
12693
|
const renderContent = React.useCallback((rec, index) => {
|
12656
12694
|
var _a, _b, _c, _d;
|
12657
12695
|
if ((_a = rec.video) === null || _a === void 0 ? void 0 : _a.url) {
|
12658
|
-
return (React.createElement(VideoWidget$1, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex }));
|
12696
|
+
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 }));
|
12659
12697
|
}
|
12660
12698
|
if ((_b = rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
|
12661
|
-
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 }));
|
12699
|
+
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 }));
|
12662
12700
|
}
|
12663
12701
|
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) {
|
12664
12702
|
return (_d = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost) === null || _d === void 0 ? void 0 : _d.map((value, idx) => {
|