pb-sxp-ui 1.0.18 → 1.0.20
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 +28 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -22
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +1 -2
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +3 -4
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +28 -22
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +1 -2
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/PictureGroup/Picture.js +23 -19
- package/es/core/components/SxpPageRender/PictureGroup/index.js +5 -2
- package/es/core/components/SxpPageRender/VideoWidget/index.js +1 -2
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +22 -18
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +4 -1
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +1 -2
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
@@ -12229,24 +12229,19 @@ Made in Italy` })));
|
|
12229
12229
|
* @Author: binruan@chatlabs.com
|
12230
12230
|
* @Date: 2024-03-20 10:27:31
|
12231
12231
|
* @LastEditors: binruan@chatlabs.com
|
12232
|
-
* @LastEditTime: 2024-04-17
|
12232
|
+
* @LastEditTime: 2024-04-17 16:46:54
|
12233
12233
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
|
12234
12234
|
*
|
12235
12235
|
*/
|
12236
12236
|
const Picture = (props) => {
|
12237
12237
|
const { src, height, width } = props;
|
12238
12238
|
const [blur, setBlur] = React.useState(false);
|
12239
|
-
const imgDom = React.useRef(null);
|
12240
12239
|
const { sxpParameter } = useSxpDataSource();
|
12241
|
-
const getAvifToPng = React.useCallback((src) => {
|
12242
|
-
return src.indexOf('avif') !== -1 ? `${src}?imageMogr2/format/webp` : src;
|
12243
|
-
}, []);
|
12244
12240
|
React.useEffect(() => {
|
12245
|
-
if (
|
12241
|
+
if (src === '' || !src)
|
12246
12242
|
return;
|
12247
|
-
}
|
12248
12243
|
const img = new Image();
|
12249
|
-
img.src = src
|
12244
|
+
img.src = `${src}?imageMogr2/format/jpg`;
|
12250
12245
|
img.onload = () => {
|
12251
12246
|
const aspectRatio = img.height / img.width;
|
12252
12247
|
const targetAspectRatio = 16 / 9;
|
@@ -12255,22 +12250,31 @@ Made in Italy` })));
|
|
12255
12250
|
setBlur(true);
|
12256
12251
|
}
|
12257
12252
|
};
|
12258
|
-
|
12259
|
-
|
12253
|
+
}, [src]);
|
12254
|
+
const getImg = React.useCallback((src, style) => {
|
12255
|
+
if (src === '' || !src)
|
12256
|
+
return;
|
12257
|
+
return (src === null || src === void 0 ? void 0 : src.indexOf('.avif')) !== -1 ? (React.createElement("picture", null,
|
12258
|
+
React.createElement("source", { type: 'image/avif', srcSet: src }),
|
12259
|
+
React.createElement("source", { type: 'image/webp', srcSet: `${src}?imageMogr2/format/webp` }),
|
12260
|
+
React.createElement("source", { type: 'image/jpeg', srcSet: `${src}?imageMogr2/format/jpg` }),
|
12261
|
+
React.createElement("img", { loading: 'lazy', src: src, style: style }))) : (React.createElement("img", { loading: 'lazy', src: src, style: style }));
|
12262
|
+
}, []);
|
12260
12263
|
return (React.createElement("div", { style: {
|
12261
12264
|
overflow: 'hidden',
|
12262
12265
|
height,
|
12263
12266
|
width: '100%',
|
12264
12267
|
position: 'relative'
|
12265
12268
|
} },
|
12266
|
-
|
12267
|
-
|
12268
|
-
|
12269
|
-
|
12270
|
-
|
12271
|
-
|
12272
|
-
|
12273
|
-
blur &&
|
12269
|
+
getImg(src !== null && src !== void 0 ? src : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, {
|
12270
|
+
height: '100%',
|
12271
|
+
width: '100%',
|
12272
|
+
objectFit: 'cover',
|
12273
|
+
filter: blur ? 'blur(10px)' : 'none',
|
12274
|
+
transform: blur ? 'scale(1.2)' : 'none'
|
12275
|
+
}),
|
12276
|
+
blur &&
|
12277
|
+
getImg(src, {
|
12274
12278
|
width: '100%',
|
12275
12279
|
objectFit: 'contain',
|
12276
12280
|
position: 'absolute',
|
@@ -12278,22 +12282,24 @@ Made in Italy` })));
|
|
12278
12282
|
transform: 'translateY(-50%)',
|
12279
12283
|
left: 0,
|
12280
12284
|
right: 0
|
12281
|
-
}
|
12285
|
+
})));
|
12282
12286
|
};
|
12283
12287
|
|
12284
12288
|
/*
|
12285
12289
|
* @Author: lewinlu@chatlabs.com
|
12286
12290
|
* @Date: 2024-01-03 14:39:09
|
12287
12291
|
* @LastEditors: binruan@chatlabs.com
|
12288
|
-
* @LastEditTime: 2024-04-17
|
12292
|
+
* @LastEditTime: 2024-04-17 15:15:33
|
12289
12293
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
|
12290
12294
|
*/
|
12291
12295
|
const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
|
12296
|
+
const ref = React.useRef();
|
12292
12297
|
const { isActive } = useSwiperSlide();
|
12293
12298
|
const { sxpParameter, openHashtag } = useSxpDataSource();
|
12294
12299
|
const [isLoad, setIsLoad] = React.useState(false);
|
12295
12300
|
React.useEffect(() => {
|
12296
12301
|
if (isLoad && isActive) {
|
12302
|
+
(ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.start();
|
12297
12303
|
if (openHashtag) {
|
12298
12304
|
onReportViewImageEnd(rec);
|
12299
12305
|
}
|
@@ -12303,12 +12309,13 @@ Made in Italy` })));
|
|
12303
12309
|
}
|
12304
12310
|
else {
|
12305
12311
|
setIsLoad(true);
|
12312
|
+
(ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.stop();
|
12306
12313
|
}
|
12307
12314
|
}, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
|
12308
12315
|
// if (!isActive) {
|
12309
12316
|
// return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
|
12310
12317
|
// }
|
12311
|
-
return (React.createElement(Swiper, { defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, loop: true, autoplay:
|
12318
|
+
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) => {
|
12312
12319
|
return (React.createElement(SwiperSlide, { key: url },
|
12313
12320
|
React.createElement(Picture, { src: url, width: width, height: height })));
|
12314
12321
|
})));
|
@@ -13051,4 +13058,3 @@ Made in Italy` })));
|
|
13051
13058
|
Object.defineProperty(exports, '__esModule', { value: true });
|
13052
13059
|
|
13053
13060
|
}));
|
13054
|
-
//# sourceMappingURL=pb-ui.js.map
|