pb-sxp-ui 1.0.21 → 1.0.23
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 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +61 -44
- 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 -44
- 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 +12 -27
- package/es/core/components/SxpPageRender/WaterFall/List.js +9 -7
- package/es/core/components/SxpPageRender/index.js +1 -1
- 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 +11 -26
- package/lib/core/components/SxpPageRender/WaterFall/List.js +9 -7
- package/lib/core/components/SxpPageRender/index.js +1 -1
- 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,50 +12269,35 @@ 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-
|
12272
|
+
* @LastEditTime: 2024-04-18 10:30:17
|
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
|
-
const { sxpParameter } = useSxpDataSource();
|
12248
12279
|
const onLoad = (img) => {
|
12249
|
-
const aspectRatio = img.
|
12280
|
+
const aspectRatio = img.naturalHeight / img.naturalWidth;
|
12250
12281
|
const targetAspectRatio = 16 / 9;
|
12251
12282
|
const tolerance = 0.05; // 允许的宽高比误差范围
|
12252
12283
|
if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
|
12253
12284
|
setBlur(true);
|
12254
12285
|
}
|
12255
12286
|
};
|
12256
|
-
const getImg = React.useCallback((src, style) => {
|
12257
|
-
if (src === '' || !src)
|
12258
|
-
return;
|
12259
|
-
return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? (React.createElement("picture", null,
|
12260
|
-
React.createElement("source", { type: 'image/avif', srcSet: src }),
|
12261
|
-
React.createElement("source", { type: 'image/webp', srcSet: `${src}?imageMogr2/format/webp` }),
|
12262
|
-
React.createElement("source", { type: 'image/jpeg', srcSet: `${src}?imageMogr2/format/jpg` }),
|
12263
|
-
React.createElement("img", { src: src, style: style, onLoad: (e) => {
|
12264
|
-
onLoad(e.target);
|
12265
|
-
} }))) : (React.createElement("img", { src: src, style: style, onLoad: (e) => {
|
12266
|
-
onLoad(e.target);
|
12267
|
-
} }));
|
12268
|
-
}, []);
|
12269
12287
|
return (React.createElement("div", { style: {
|
12270
12288
|
overflow: 'hidden',
|
12271
12289
|
height,
|
12272
12290
|
width: '100%',
|
12273
12291
|
position: 'relative'
|
12274
12292
|
} },
|
12275
|
-
|
12276
|
-
|
12277
|
-
|
12278
|
-
|
12279
|
-
|
12280
|
-
|
12281
|
-
|
12282
|
-
blur &&
|
12283
|
-
getImg(src, {
|
12293
|
+
React.createElement(FormatImage$1, { src: src, style: {
|
12294
|
+
height: '100%',
|
12295
|
+
width: '100%',
|
12296
|
+
objectFit: 'cover',
|
12297
|
+
filter: blur ? 'blur(10px)' : 'none',
|
12298
|
+
transform: blur ? 'scale(1.2)' : 'none'
|
12299
|
+
}, onLoad: onLoad }),
|
12300
|
+
blur && (React.createElement(FormatImage$1, { src: src, style: {
|
12284
12301
|
width: '100%',
|
12285
12302
|
objectFit: 'contain',
|
12286
12303
|
position: 'absolute',
|
@@ -12288,14 +12305,14 @@ const Picture = (props) => {
|
|
12288
12305
|
transform: 'translateY(-50%)',
|
12289
12306
|
left: 0,
|
12290
12307
|
right: 0
|
12291
|
-
})));
|
12308
|
+
} }))));
|
12292
12309
|
};
|
12293
12310
|
|
12294
12311
|
/*
|
12295
12312
|
* @Author: lewinlu@chatlabs.com
|
12296
12313
|
* @Date: 2024-01-03 14:39:09
|
12297
12314
|
* @LastEditors: binruan@chatlabs.com
|
12298
|
-
* @LastEditTime: 2024-04-17
|
12315
|
+
* @LastEditTime: 2024-04-17 18:52:45
|
12299
12316
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
|
12300
12317
|
*/
|
12301
12318
|
const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
|
@@ -12505,7 +12522,7 @@ const Nudge = ({ nudge }) => {
|
|
12505
12522
|
* @Author: binruan@chatlabs.com
|
12506
12523
|
* @Date: 2024-01-15 19:03:09
|
12507
12524
|
* @LastEditors: binruan@chatlabs.com
|
12508
|
-
* @LastEditTime: 2024-04-
|
12525
|
+
* @LastEditTime: 2024-04-18 09:43:19
|
12509
12526
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12510
12527
|
*
|
12511
12528
|
*/
|
@@ -12709,7 +12726,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12709
12726
|
React.createElement(ExpandableText$1, { className: 'clc-sxp-bottom-text', isPost: true, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (_c = (_b = rec.video) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : '', style: Object.assign({}, descStyle
|
12710
12727
|
// textShadow: globalConfig?.isOpenTextShadow ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none'
|
12711
12728
|
), onChange: onExpandableChange }),
|
12712
|
-
React.createElement(Hashtag$1, { index: activeIndex, tags: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.hashTags) !== null && _e !== void 0 ? _e : [], itemId: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.itemId, itemType: ((_g = rec.video) === null || _g === void 0 ? void 0 : _g.
|
12729
|
+
React.createElement(Hashtag$1, { index: activeIndex, tags: (_e = (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.hashTags) !== null && _e !== void 0 ? _e : [], itemId: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.itemId, itemType: ((_g = rec.video) === null || _g === void 0 ? void 0 : _g.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle })))));
|
12713
12730
|
}
|
12714
12731
|
return null;
|
12715
12732
|
}, [
|