pb-sxp-ui 1.0.21 → 1.0.22
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 +60 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +60 -29
- 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 +60 -29
- 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/FormatImage.d.ts +13 -0
- package/es/core/components/SxpPageRender/FormatImage.js +22 -0
- package/es/core/components/SxpPageRender/PictureGroup/Picture.js +10 -10
- package/es/core/components/SxpPageRender/WaterFall/List.js +9 -7
- package/es/materials/sxp/popup/CommodityDetail/index.js +2 -1
- package/es/materials/sxp/popup/CommodityDetailDiro/index.js +2 -1
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +2 -1
- package/es/materials/sxp/template/Commodity/index.js +2 -1
- package/es/materials/sxp/template/CommodityDiro/index.js +2 -1
- package/es/materials/sxp/template/CommodityDiroNew/index.js +2 -1
- package/es/materials/sxp/template/Link/index.js +2 -1
- package/es/materials/sxp/template/components/Img.js +3 -1
- package/lib/core/components/SxpPageRender/FormatImage.d.ts +13 -0
- package/lib/core/components/SxpPageRender/FormatImage.js +25 -0
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +10 -10
- package/lib/core/components/SxpPageRender/WaterFall/List.js +9 -7
- package/lib/materials/sxp/popup/CommodityDetail/index.js +2 -1
- package/lib/materials/sxp/popup/CommodityDetailDiro/index.js +2 -1
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +2 -1
- package/lib/materials/sxp/template/Commodity/index.js +2 -1
- package/lib/materials/sxp/template/CommodityDiro/index.js +2 -1
- package/lib/materials/sxp/template/CommodityDiroNew/index.js +2 -1
- package/lib/materials/sxp/template/Link/index.js +2 -1
- package/lib/materials/sxp/template/components/Img.js +3 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -8307,6 +8307,36 @@ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldTex
|
|
8307
8307
|
};
|
8308
8308
|
var ExpandableText$1 = React.memo(ExpandableText);
|
8309
8309
|
|
8310
|
+
/*
|
8311
|
+
* @Author: binruan@chatlabs.com
|
8312
|
+
* @Date: 2024-03-20 10:27:31
|
8313
|
+
* @LastEditors: binruan@chatlabs.com
|
8314
|
+
* @LastEditTime: 2024-04-17 20:45:55
|
8315
|
+
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\FormatImage.tsx
|
8316
|
+
*
|
8317
|
+
*/
|
8318
|
+
const FormatImage = React.forwardRef((props, ref) => {
|
8319
|
+
const { src, onLoad, style, className, loading } = props;
|
8320
|
+
const [imgSrc, setImgSrc] = React.useState(src);
|
8321
|
+
React.useImperativeHandle(ref, () => ({
|
8322
|
+
setSrc: (v) => {
|
8323
|
+
setImgSrc(v);
|
8324
|
+
}
|
8325
|
+
}));
|
8326
|
+
if (imgSrc === '' || !imgSrc)
|
8327
|
+
return null;
|
8328
|
+
return (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
|
8329
|
+
React.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
|
8330
|
+
React.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}?imageMogr2/format/webp` }),
|
8331
|
+
React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
|
8332
|
+
React.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
|
8333
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
|
8334
|
+
} }))) : (React.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
|
8335
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
|
8336
|
+
} }));
|
8337
|
+
});
|
8338
|
+
var FormatImage$1 = React.memo(FormatImage);
|
8339
|
+
|
8310
8340
|
const CommodityDetail$1 = (_a) => {
|
8311
8341
|
var _b, _c, _d, _e, _f, _g, _h, _j;
|
8312
8342
|
var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index } = _a, props = __rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index"]);
|
@@ -8384,7 +8414,7 @@ const CommodityDetail$1 = (_a) => {
|
|
8384
8414
|
width,
|
8385
8415
|
height: width
|
8386
8416
|
} },
|
8387
|
-
React.createElement(
|
8417
|
+
React.createElement(FormatImage$1, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
|
8388
8418
|
}))),
|
8389
8419
|
!((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (React.createElement("div", { className: css.css({
|
8390
8420
|
position: 'relative',
|
@@ -8831,7 +8861,7 @@ Made in Italy` })));
|
|
8831
8861
|
width,
|
8832
8862
|
height: width
|
8833
8863
|
} },
|
8834
|
-
React.createElement(
|
8864
|
+
React.createElement(FormatImage$1, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
|
8835
8865
|
}))),
|
8836
8866
|
!((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (React.createElement("div", { className: css.css({
|
8837
8867
|
position: 'relative',
|
@@ -9245,7 +9275,7 @@ const Commodity$1 = (_a) => {
|
|
9245
9275
|
const src = (_e = (_d = (_c = product === null || product === void 0 ? void 0 : product.homePage) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _e !== void 0 ? _e : bottom_image;
|
9246
9276
|
return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css.css(Object.assign({}, style)), style: { display: 'flex' } }, props),
|
9247
9277
|
React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
|
9248
|
-
React.createElement(
|
9278
|
+
React.createElement(FormatImage$1, { className: css.css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: src })),
|
9249
9279
|
React.createElement("div", { className: css.css({
|
9250
9280
|
color: '#fff',
|
9251
9281
|
display: 'flex',
|
@@ -9406,7 +9436,7 @@ const Link$1 = (_a) => {
|
|
9406
9436
|
};
|
9407
9437
|
return (React.createElement(EventProvider$1, Object.assign({ index: index, rec: recData, className: css.css(Object.assign({ alignItems: 'center' }, style)), style: { display: 'flex' } }, props, { onClick: handleTo }),
|
9408
9438
|
React.createElement("div", { className: css.css(Object.assign({ backgroundColor: '#f2f2f2', overflow: 'hidden', flexShrink: 0 }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
|
9409
|
-
React.createElement(
|
9439
|
+
React.createElement(FormatImage$1, { className: css.css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: (_e = (_d = cta === null || cta === void 0 ? void 0 : cta.icon) !== null && _d !== void 0 ? _d : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _e !== void 0 ? _e : bottom_image })),
|
9410
9440
|
React.createElement("div", { className: css.css({
|
9411
9441
|
display: 'flex',
|
9412
9442
|
alignItems: 'center',
|
@@ -9488,7 +9518,7 @@ const CommodityDiro$1 = (_a) => {
|
|
9488
9518
|
const src = (_e = (_d = (_c = product === null || product === void 0 ? void 0 : product.homePage) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _e !== void 0 ? _e : bottom_image;
|
9489
9519
|
return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css.css(Object.assign({}, style)), style: { display: 'flex' } }, props),
|
9490
9520
|
React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
|
9491
|
-
React.createElement(
|
9521
|
+
React.createElement(FormatImage$1, { className: css.css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: src })),
|
9492
9522
|
React.createElement("div", { className: css.css({
|
9493
9523
|
color: '#fff',
|
9494
9524
|
display: 'flex',
|
@@ -9580,7 +9610,7 @@ const CommodityDiroNew$1 = (_a) => {
|
|
9580
9610
|
const src = (_e = (_d = (_c = product === null || product === void 0 ? void 0 : product.homePage) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _e !== void 0 ? _e : bottom_image;
|
9581
9611
|
return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css.css(Object.assign({}, style)), style: { display: 'flex' } }, props),
|
9582
9612
|
React.createElement("div", { className: css.css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
|
9583
|
-
React.createElement(
|
9613
|
+
React.createElement(FormatImage$1, { className: css.css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: src })),
|
9584
9614
|
React.createElement("div", { className: css.css({
|
9585
9615
|
color: '#fff',
|
9586
9616
|
display: 'flex',
|
@@ -9672,7 +9702,7 @@ var Scroll$1 = React.memo(Scroll);
|
|
9672
9702
|
* @Author: binruan@chatlabs.com
|
9673
9703
|
* @Date: 2024-01-16 14:50:13
|
9674
9704
|
* @LastEditors: binruan@chatlabs.com
|
9675
|
-
* @LastEditTime: 2024-04-
|
9705
|
+
* @LastEditTime: 2024-04-17 19:03:01
|
9676
9706
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\template\components\Img.tsx
|
9677
9707
|
*
|
9678
9708
|
*/
|
@@ -9688,7 +9718,8 @@ const Img = ({ src, rec, item, index }) => {
|
|
9688
9718
|
}, rec, item, index);
|
9689
9719
|
}
|
9690
9720
|
}, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
|
9691
|
-
return (React.createElement("
|
9721
|
+
return (React.createElement("div", { ref: ref, hidden: !src },
|
9722
|
+
React.createElement(FormatImage$1, { className: css.css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: src })));
|
9692
9723
|
};
|
9693
9724
|
var Img$1 = React.memo(Img);
|
9694
9725
|
|
@@ -11489,6 +11520,7 @@ const WaterfallFlowItem = (props) => {
|
|
11489
11520
|
const { swiperRef, setRtcList, setOpenHashtag, bffEventReport, sxpParameter } = useSxpDataSource();
|
11490
11521
|
const [showVideo, setShowVideo] = React.useState(false);
|
11491
11522
|
const imgDom = React.useRef(null);
|
11523
|
+
const ref = React.useRef(null);
|
11492
11524
|
const videoDom = React.useRef(null);
|
11493
11525
|
const canvasRef = React.useRef(null);
|
11494
11526
|
const [firstFrameSrc, setFirstFrameSrc] = React.useState('');
|
@@ -11545,20 +11577,20 @@ const WaterfallFlowItem = (props) => {
|
|
11545
11577
|
const observer = new IntersectionObserver((entries) => {
|
11546
11578
|
entries.forEach((entry) => {
|
11547
11579
|
if (entry.isIntersecting) {
|
11548
|
-
if (
|
11580
|
+
if (ref.current === null || src === '') {
|
11549
11581
|
return;
|
11550
11582
|
}
|
11551
11583
|
if (showVideo && firstFrameSrc) {
|
11552
|
-
imgDom.current.
|
11584
|
+
imgDom.current.setSrc(firstFrameSrc);
|
11553
11585
|
}
|
11554
11586
|
else {
|
11555
|
-
imgDom.current.src
|
11587
|
+
imgDom.current.setSrc(src);
|
11556
11588
|
}
|
11557
|
-
observer.unobserve(
|
11589
|
+
observer.unobserve(ref.current);
|
11558
11590
|
}
|
11559
11591
|
});
|
11560
11592
|
});
|
11561
|
-
observer.observe(
|
11593
|
+
observer.observe(ref.current);
|
11562
11594
|
return () => {
|
11563
11595
|
observer.disconnect();
|
11564
11596
|
};
|
@@ -11600,12 +11632,12 @@ const WaterfallFlowItem = (props) => {
|
|
11600
11632
|
setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(false);
|
11601
11633
|
}, 0);
|
11602
11634
|
};
|
11603
|
-
return (React.createElement("div", { className: 'list-content-listItem', key: index, onClick: handleClickToDetail, style: { marginBottom: space } },
|
11635
|
+
return (React.createElement("div", { ref: ref, className: 'list-content-listItem', key: index, onClick: handleClickToDetail, style: { marginBottom: space } },
|
11604
11636
|
React.createElement("div", { className: 'list-content-listItem-picture' },
|
11605
11637
|
showVideo && (React.createElement("div", { style: { display: 'none' } },
|
11606
11638
|
React.createElement("video", { ref: videoDom, crossOrigin: 'anonymous', className: 'list-content-listItem-picture-img' }),
|
11607
11639
|
React.createElement("canvas", { ref: canvasRef }))),
|
11608
|
-
React.createElement(
|
11640
|
+
React.createElement(FormatImage$1, { loading: 'lazy', className: 'list-content-listItem-picture-img', ref: imgDom })),
|
11609
11641
|
React.createElement("div", { className: 'list-content-listItem-info' },
|
11610
11642
|
React.createElement("div", { className: `${'list-content-listItem-info-title'} ${priceText ? 'list-content-listItem-info-nowrap' : ''}`, style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.title }, title && title),
|
11611
11643
|
React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText }, priceText))));
|
@@ -12237,14 +12269,14 @@ const FingerSwipeTip = ({ imageUrl }) => {
|
|
12237
12269
|
* @Author: binruan@chatlabs.com
|
12238
12270
|
* @Date: 2024-03-20 10:27:31
|
12239
12271
|
* @LastEditors: binruan@chatlabs.com
|
12240
|
-
* @LastEditTime: 2024-04-17 18:
|
12272
|
+
* @LastEditTime: 2024-04-17 18:59:40
|
12241
12273
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
|
12242
12274
|
*
|
12243
12275
|
*/
|
12244
12276
|
const Picture = (props) => {
|
12245
12277
|
const { src, height, width } = props;
|
12246
12278
|
const [blur, setBlur] = React.useState(false);
|
12247
|
-
|
12279
|
+
useSxpDataSource();
|
12248
12280
|
const onLoad = (img) => {
|
12249
12281
|
const aspectRatio = img.height / img.width;
|
12250
12282
|
const targetAspectRatio = 16 / 9;
|
@@ -12253,7 +12285,7 @@ const Picture = (props) => {
|
|
12253
12285
|
setBlur(true);
|
12254
12286
|
}
|
12255
12287
|
};
|
12256
|
-
|
12288
|
+
React.useCallback((src, style) => {
|
12257
12289
|
if (src === '' || !src)
|
12258
12290
|
return;
|
12259
12291
|
return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? (React.createElement("picture", null,
|
@@ -12272,15 +12304,14 @@ const Picture = (props) => {
|
|
12272
12304
|
width: '100%',
|
12273
12305
|
position: 'relative'
|
12274
12306
|
} },
|
12275
|
-
|
12276
|
-
|
12277
|
-
|
12278
|
-
|
12279
|
-
|
12280
|
-
|
12281
|
-
|
12282
|
-
blur &&
|
12283
|
-
getImg(src, {
|
12307
|
+
React.createElement(FormatImage$1, { src: src, style: {
|
12308
|
+
height: '100%',
|
12309
|
+
width: '100%',
|
12310
|
+
objectFit: 'cover',
|
12311
|
+
filter: blur ? 'blur(10px)' : 'none',
|
12312
|
+
transform: blur ? 'scale(1.2)' : 'none'
|
12313
|
+
}, onLoad: onLoad }),
|
12314
|
+
blur && (React.createElement(FormatImage$1, { src: src, style: {
|
12284
12315
|
width: '100%',
|
12285
12316
|
objectFit: 'contain',
|
12286
12317
|
position: 'absolute',
|
@@ -12288,14 +12319,14 @@ const Picture = (props) => {
|
|
12288
12319
|
transform: 'translateY(-50%)',
|
12289
12320
|
left: 0,
|
12290
12321
|
right: 0
|
12291
|
-
})));
|
12322
|
+
} }))));
|
12292
12323
|
};
|
12293
12324
|
|
12294
12325
|
/*
|
12295
12326
|
* @Author: lewinlu@chatlabs.com
|
12296
12327
|
* @Date: 2024-01-03 14:39:09
|
12297
12328
|
* @LastEditors: binruan@chatlabs.com
|
12298
|
-
* @LastEditTime: 2024-04-17
|
12329
|
+
* @LastEditTime: 2024-04-17 18:52:45
|
12299
12330
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
|
12300
12331
|
*/
|
12301
12332
|
const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
|