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.js
CHANGED
@@ -8284,6 +8284,36 @@ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldTex
|
|
8284
8284
|
};
|
8285
8285
|
var ExpandableText$1 = memo(ExpandableText);
|
8286
8286
|
|
8287
|
+
/*
|
8288
|
+
* @Author: binruan@chatlabs.com
|
8289
|
+
* @Date: 2024-03-20 10:27:31
|
8290
|
+
* @LastEditors: binruan@chatlabs.com
|
8291
|
+
* @LastEditTime: 2024-04-17 20:45:55
|
8292
|
+
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\FormatImage.tsx
|
8293
|
+
*
|
8294
|
+
*/
|
8295
|
+
const FormatImage = forwardRef((props, ref) => {
|
8296
|
+
const { src, onLoad, style, className, loading } = props;
|
8297
|
+
const [imgSrc, setImgSrc] = useState(src);
|
8298
|
+
useImperativeHandle(ref, () => ({
|
8299
|
+
setSrc: (v) => {
|
8300
|
+
setImgSrc(v);
|
8301
|
+
}
|
8302
|
+
}));
|
8303
|
+
if (imgSrc === '' || !imgSrc)
|
8304
|
+
return null;
|
8305
|
+
return (imgSrc === null || imgSrc === void 0 ? void 0 : imgSrc.includes('.avif')) ? (React.createElement("picture", null,
|
8306
|
+
React.createElement("source", { type: 'image/avif', srcSet: imgSrc }),
|
8307
|
+
React.createElement("source", { type: 'image/webp', srcSet: `${imgSrc}?imageMogr2/format/webp` }),
|
8308
|
+
React.createElement("source", { type: 'image/jpeg', srcSet: `${imgSrc}?imageMogr2/format/jpg` }),
|
8309
|
+
React.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
|
8310
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
|
8311
|
+
} }))) : (React.createElement("img", { className: className, src: imgSrc, style: style, loading: loading, onLoad: (e) => {
|
8312
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e.target);
|
8313
|
+
} }));
|
8314
|
+
});
|
8315
|
+
var FormatImage$1 = memo(FormatImage);
|
8316
|
+
|
8287
8317
|
const CommodityDetail$1 = (_a) => {
|
8288
8318
|
var _b, _c, _d, _e, _f, _g, _h, _j;
|
8289
8319
|
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"]);
|
@@ -8361,7 +8391,7 @@ const CommodityDetail$1 = (_a) => {
|
|
8361
8391
|
width,
|
8362
8392
|
height: width
|
8363
8393
|
} },
|
8364
|
-
React.createElement(
|
8394
|
+
React.createElement(FormatImage$1, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
|
8365
8395
|
}))),
|
8366
8396
|
!((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (React.createElement("div", { className: css({
|
8367
8397
|
position: 'relative',
|
@@ -8808,7 +8838,7 @@ Made in Italy` })));
|
|
8808
8838
|
width,
|
8809
8839
|
height: width
|
8810
8840
|
} },
|
8811
|
-
React.createElement(
|
8841
|
+
React.createElement(FormatImage$1, { style: { height: '100%', width: '100%', objectFit: 'cover', display: 'block' }, src: src }))));
|
8812
8842
|
}))),
|
8813
8843
|
!((_h = product === null || product === void 0 ? void 0 : product.homePage) === null || _h === void 0 ? void 0 : _h.length) && (React.createElement("div", { className: css({
|
8814
8844
|
position: 'relative',
|
@@ -9222,7 +9252,7 @@ const Commodity$1 = (_a) => {
|
|
9222
9252
|
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;
|
9223
9253
|
return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' } }, props),
|
9224
9254
|
React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
|
9225
|
-
React.createElement(
|
9255
|
+
React.createElement(FormatImage$1, { className: css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: src })),
|
9226
9256
|
React.createElement("div", { className: css({
|
9227
9257
|
color: '#fff',
|
9228
9258
|
display: 'flex',
|
@@ -9383,7 +9413,7 @@ const Link$1 = (_a) => {
|
|
9383
9413
|
};
|
9384
9414
|
return (React.createElement(EventProvider$1, Object.assign({ index: index, rec: recData, className: css(Object.assign({ alignItems: 'center' }, style)), style: { display: 'flex' } }, props, { onClick: handleTo }),
|
9385
9415
|
React.createElement("div", { className: css(Object.assign({ backgroundColor: '#f2f2f2', overflow: 'hidden', flexShrink: 0 }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
|
9386
|
-
React.createElement(
|
9416
|
+
React.createElement(FormatImage$1, { className: 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 })),
|
9387
9417
|
React.createElement("div", { className: css({
|
9388
9418
|
display: 'flex',
|
9389
9419
|
alignItems: 'center',
|
@@ -9465,7 +9495,7 @@ const CommodityDiro$1 = (_a) => {
|
|
9465
9495
|
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;
|
9466
9496
|
return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' } }, props),
|
9467
9497
|
React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
|
9468
|
-
React.createElement(
|
9498
|
+
React.createElement(FormatImage$1, { className: css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: src })),
|
9469
9499
|
React.createElement("div", { className: css({
|
9470
9500
|
color: '#fff',
|
9471
9501
|
display: 'flex',
|
@@ -9557,7 +9587,7 @@ const CommodityDiroNew$1 = (_a) => {
|
|
9557
9587
|
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;
|
9558
9588
|
return (React.createElement(EventProvider$1, Object.assign({ isExternalLink: isExternalLink, rec: recData, className: css(Object.assign({}, style)), style: { display: 'flex' } }, props),
|
9559
9589
|
React.createElement("div", { className: css(Object.assign({ overflow: 'hidden', flexShrink: 0, backgroundColor: '#f2f2f2' }, ctaTempStyles === null || ctaTempStyles === void 0 ? void 0 : ctaTempStyles.img)) },
|
9560
|
-
React.createElement(
|
9590
|
+
React.createElement(FormatImage$1, { className: css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: src })),
|
9561
9591
|
React.createElement("div", { className: css({
|
9562
9592
|
color: '#fff',
|
9563
9593
|
display: 'flex',
|
@@ -9649,7 +9679,7 @@ var Scroll$1 = memo(Scroll);
|
|
9649
9679
|
* @Author: binruan@chatlabs.com
|
9650
9680
|
* @Date: 2024-01-16 14:50:13
|
9651
9681
|
* @LastEditors: binruan@chatlabs.com
|
9652
|
-
* @LastEditTime: 2024-04-
|
9682
|
+
* @LastEditTime: 2024-04-17 19:03:01
|
9653
9683
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\template\components\Img.tsx
|
9654
9684
|
*
|
9655
9685
|
*/
|
@@ -9665,7 +9695,8 @@ const Img = ({ src, rec, item, index }) => {
|
|
9665
9695
|
}, rec, item, index);
|
9666
9696
|
}
|
9667
9697
|
}, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
|
9668
|
-
return (React.createElement("
|
9698
|
+
return (React.createElement("div", { ref: ref, hidden: !src },
|
9699
|
+
React.createElement(FormatImage$1, { className: css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: src })));
|
9669
9700
|
};
|
9670
9701
|
var Img$1 = memo(Img);
|
9671
9702
|
|
@@ -11466,6 +11497,7 @@ const WaterfallFlowItem = (props) => {
|
|
11466
11497
|
const { swiperRef, setRtcList, setOpenHashtag, bffEventReport, sxpParameter } = useSxpDataSource();
|
11467
11498
|
const [showVideo, setShowVideo] = useState(false);
|
11468
11499
|
const imgDom = useRef(null);
|
11500
|
+
const ref = useRef(null);
|
11469
11501
|
const videoDom = useRef(null);
|
11470
11502
|
const canvasRef = useRef(null);
|
11471
11503
|
const [firstFrameSrc, setFirstFrameSrc] = useState('');
|
@@ -11522,20 +11554,20 @@ const WaterfallFlowItem = (props) => {
|
|
11522
11554
|
const observer = new IntersectionObserver((entries) => {
|
11523
11555
|
entries.forEach((entry) => {
|
11524
11556
|
if (entry.isIntersecting) {
|
11525
|
-
if (
|
11557
|
+
if (ref.current === null || src === '') {
|
11526
11558
|
return;
|
11527
11559
|
}
|
11528
11560
|
if (showVideo && firstFrameSrc) {
|
11529
|
-
imgDom.current.
|
11561
|
+
imgDom.current.setSrc(firstFrameSrc);
|
11530
11562
|
}
|
11531
11563
|
else {
|
11532
|
-
imgDom.current.src
|
11564
|
+
imgDom.current.setSrc(src);
|
11533
11565
|
}
|
11534
|
-
observer.unobserve(
|
11566
|
+
observer.unobserve(ref.current);
|
11535
11567
|
}
|
11536
11568
|
});
|
11537
11569
|
});
|
11538
|
-
observer.observe(
|
11570
|
+
observer.observe(ref.current);
|
11539
11571
|
return () => {
|
11540
11572
|
observer.disconnect();
|
11541
11573
|
};
|
@@ -11577,12 +11609,12 @@ const WaterfallFlowItem = (props) => {
|
|
11577
11609
|
setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(false);
|
11578
11610
|
}, 0);
|
11579
11611
|
};
|
11580
|
-
return (React.createElement("div", { className: 'list-content-listItem', key: index, onClick: handleClickToDetail, style: { marginBottom: space } },
|
11612
|
+
return (React.createElement("div", { ref: ref, className: 'list-content-listItem', key: index, onClick: handleClickToDetail, style: { marginBottom: space } },
|
11581
11613
|
React.createElement("div", { className: 'list-content-listItem-picture' },
|
11582
11614
|
showVideo && (React.createElement("div", { style: { display: 'none' } },
|
11583
11615
|
React.createElement("video", { ref: videoDom, crossOrigin: 'anonymous', className: 'list-content-listItem-picture-img' }),
|
11584
11616
|
React.createElement("canvas", { ref: canvasRef }))),
|
11585
|
-
React.createElement(
|
11617
|
+
React.createElement(FormatImage$1, { loading: 'lazy', className: 'list-content-listItem-picture-img', ref: imgDom })),
|
11586
11618
|
React.createElement("div", { className: 'list-content-listItem-info' },
|
11587
11619
|
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),
|
11588
11620
|
React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText }, priceText))));
|
@@ -12214,50 +12246,35 @@ const FingerSwipeTip = ({ imageUrl }) => {
|
|
12214
12246
|
* @Author: binruan@chatlabs.com
|
12215
12247
|
* @Date: 2024-03-20 10:27:31
|
12216
12248
|
* @LastEditors: binruan@chatlabs.com
|
12217
|
-
* @LastEditTime: 2024-04-
|
12249
|
+
* @LastEditTime: 2024-04-18 10:30:17
|
12218
12250
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
|
12219
12251
|
*
|
12220
12252
|
*/
|
12221
12253
|
const Picture = (props) => {
|
12222
12254
|
const { src, height, width } = props;
|
12223
12255
|
const [blur, setBlur] = useState(false);
|
12224
|
-
const { sxpParameter } = useSxpDataSource();
|
12225
12256
|
const onLoad = (img) => {
|
12226
|
-
const aspectRatio = img.
|
12257
|
+
const aspectRatio = img.naturalHeight / img.naturalWidth;
|
12227
12258
|
const targetAspectRatio = 16 / 9;
|
12228
12259
|
const tolerance = 0.05; // 允许的宽高比误差范围
|
12229
12260
|
if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
|
12230
12261
|
setBlur(true);
|
12231
12262
|
}
|
12232
12263
|
};
|
12233
|
-
const getImg = useCallback((src, style) => {
|
12234
|
-
if (src === '' || !src)
|
12235
|
-
return;
|
12236
|
-
return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? (React.createElement("picture", null,
|
12237
|
-
React.createElement("source", { type: 'image/avif', srcSet: src }),
|
12238
|
-
React.createElement("source", { type: 'image/webp', srcSet: `${src}?imageMogr2/format/webp` }),
|
12239
|
-
React.createElement("source", { type: 'image/jpeg', srcSet: `${src}?imageMogr2/format/jpg` }),
|
12240
|
-
React.createElement("img", { src: src, style: style, onLoad: (e) => {
|
12241
|
-
onLoad(e.target);
|
12242
|
-
} }))) : (React.createElement("img", { src: src, style: style, onLoad: (e) => {
|
12243
|
-
onLoad(e.target);
|
12244
|
-
} }));
|
12245
|
-
}, []);
|
12246
12264
|
return (React.createElement("div", { style: {
|
12247
12265
|
overflow: 'hidden',
|
12248
12266
|
height,
|
12249
12267
|
width: '100%',
|
12250
12268
|
position: 'relative'
|
12251
12269
|
} },
|
12252
|
-
|
12253
|
-
|
12254
|
-
|
12255
|
-
|
12256
|
-
|
12257
|
-
|
12258
|
-
|
12259
|
-
blur &&
|
12260
|
-
getImg(src, {
|
12270
|
+
React.createElement(FormatImage$1, { src: src, style: {
|
12271
|
+
height: '100%',
|
12272
|
+
width: '100%',
|
12273
|
+
objectFit: 'cover',
|
12274
|
+
filter: blur ? 'blur(10px)' : 'none',
|
12275
|
+
transform: blur ? 'scale(1.2)' : 'none'
|
12276
|
+
}, onLoad: onLoad }),
|
12277
|
+
blur && (React.createElement(FormatImage$1, { src: src, style: {
|
12261
12278
|
width: '100%',
|
12262
12279
|
objectFit: 'contain',
|
12263
12280
|
position: 'absolute',
|
@@ -12265,14 +12282,14 @@ const Picture = (props) => {
|
|
12265
12282
|
transform: 'translateY(-50%)',
|
12266
12283
|
left: 0,
|
12267
12284
|
right: 0
|
12268
|
-
})));
|
12285
|
+
} }))));
|
12269
12286
|
};
|
12270
12287
|
|
12271
12288
|
/*
|
12272
12289
|
* @Author: lewinlu@chatlabs.com
|
12273
12290
|
* @Date: 2024-01-03 14:39:09
|
12274
12291
|
* @LastEditors: binruan@chatlabs.com
|
12275
|
-
* @LastEditTime: 2024-04-17
|
12292
|
+
* @LastEditTime: 2024-04-17 18:52:45
|
12276
12293
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
|
12277
12294
|
*/
|
12278
12295
|
const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
|
@@ -12482,7 +12499,7 @@ const Nudge = ({ nudge }) => {
|
|
12482
12499
|
* @Author: binruan@chatlabs.com
|
12483
12500
|
* @Date: 2024-01-15 19:03:09
|
12484
12501
|
* @LastEditors: binruan@chatlabs.com
|
12485
|
-
* @LastEditTime: 2024-04-
|
12502
|
+
* @LastEditTime: 2024-04-18 09:43:19
|
12486
12503
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12487
12504
|
*
|
12488
12505
|
*/
|
@@ -12686,7 +12703,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12686
12703
|
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
|
12687
12704
|
// textShadow: globalConfig?.isOpenTextShadow ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none'
|
12688
12705
|
), onChange: onExpandableChange }),
|
12689
|
-
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.
|
12706
|
+
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 })))));
|
12690
12707
|
}
|
12691
12708
|
return null;
|
12692
12709
|
}, [
|