pb-sxp-ui 1.0.3-alpha.2 → 1.0.3-alpha.3
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 +64 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -1
- package/dist/index.js +64 -36
- 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 +64 -36
- 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.js +31 -3
- package/es/core/components/SxpPageRender/VideoWidget/index.js +21 -30
- package/es/core/components/SxpPageRender/WaterFall/List.js +1 -1
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +4 -3
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +30 -2
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +21 -30
- package/lib/core/components/SxpPageRender/WaterFall/List.js +1 -1
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +4 -3
- package/package.json +1 -1
package/dist/index.css
CHANGED
package/dist/index.js
CHANGED
@@ -8813,11 +8813,12 @@ Made in Italy` })));
|
|
8813
8813
|
}), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
|
8814
8814
|
React.createElement("div", { className: 'pb-commondityDiroNew-content' },
|
8815
8815
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
|
8816
|
-
React.createElement("div",
|
8817
|
-
|
8816
|
+
React.createElement("div", null,
|
8817
|
+
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (_k = product === null || product === void 0 ? void 0 : product.title) !== null && _k !== void 0 ? _k : 'Large Dior Toujours Bag'),
|
8818
|
+
React.createElement("div", { className: 'pb-commondityDiroNew-content-collection', hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === ''), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection }, (product === null || product === void 0 ? void 0 : product.collection) || 'Black Macrocannage Calfskin')),
|
8819
|
+
React.createElement("div", null,
|
8818
8820
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price }, priceText),
|
8819
8821
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.taxInfo), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.taxInfo }, (_l = product === null || product === void 0 ? void 0 : product.taxInfo) !== null && _l !== void 0 ? _l : '税费'))),
|
8820
|
-
React.createElement("div", { className: 'pb-commondityDiroNew-content-collection', hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === ''), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection }, (product === null || product === void 0 ? void 0 : product.collection) || 'Black Macrocannage Calfskin'),
|
8821
8822
|
(!product || (product === null || product === void 0 ? void 0 : product.link)) && (React.createElement("button", { onClick: handleLink, className: 'pb-commondityDiroNew-btn', style: buttonStyle }, (_m = cta === null || cta === void 0 ? void 0 : cta.enTitle) !== null && _m !== void 0 ? _m : 'Shop now')),
|
8822
8823
|
productInfoText({ isPost }))),
|
8823
8824
|
React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
|
@@ -11518,7 +11519,7 @@ const WaterfallFlowItem = (props) => {
|
|
11518
11519
|
React.createElement("img", { className: 'list-content-listItem-picture-img', loading: 'lazy', ref: imgDom })),
|
11519
11520
|
React.createElement("div", { className: 'list-content-listItem-info' },
|
11520
11521
|
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),
|
11521
|
-
React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles.price, hidden: !priceText }, priceText))));
|
11522
|
+
React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText }, priceText))));
|
11522
11523
|
};
|
11523
11524
|
function WaterfallList(_a) {
|
11524
11525
|
var _b, _c, _d, _e, _f, _g, _h;
|
@@ -11880,10 +11881,8 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
|
|
11880
11881
|
videoRef.current.muted = muted;
|
11881
11882
|
}, [muted]);
|
11882
11883
|
const handleVideoStart = useCallback(() => {
|
11883
|
-
var _a
|
11884
|
-
|
11885
|
-
return;
|
11886
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
|
11884
|
+
var _a;
|
11885
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
11887
11886
|
}, []);
|
11888
11887
|
const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
11889
11888
|
const handlePlaying = useCallback(() => {
|
@@ -11940,38 +11939,37 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
|
|
11940
11939
|
});
|
11941
11940
|
}
|
11942
11941
|
setTimeout(() => {
|
11943
|
-
var _a
|
11944
|
-
|
11945
|
-
return;
|
11946
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
|
11942
|
+
var _a;
|
11943
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
11947
11944
|
}, 0);
|
11948
11945
|
}, [index, bffEventReport, data, isLoad]);
|
11949
11946
|
const handleClickVideo = useCallback((type) => () => {
|
11950
|
-
var _a, _b, _c, _d, _e, _f;
|
11951
|
-
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) < 2)
|
11952
|
-
return;
|
11947
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
11953
11948
|
if (!isLoad)
|
11954
11949
|
return;
|
11955
|
-
|
11950
|
+
data[index];
|
11951
|
+
((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
11952
|
+
((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
11953
|
+
const isPause = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.paused;
|
11956
11954
|
switch (type) {
|
11957
11955
|
case 'start':
|
11958
11956
|
if (!isPause)
|
11959
11957
|
return;
|
11960
|
-
(
|
11958
|
+
(_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.play();
|
11961
11959
|
setIsPauseVideo(false);
|
11962
11960
|
break;
|
11963
11961
|
case 'pause':
|
11964
11962
|
if (isPause)
|
11965
11963
|
return;
|
11966
|
-
(
|
11964
|
+
(_g = videoRef.current) === null || _g === void 0 ? void 0 : _g.pause();
|
11967
11965
|
setIsPauseVideo(true);
|
11968
11966
|
break;
|
11969
11967
|
default:
|
11970
11968
|
if (isPause) {
|
11971
|
-
(
|
11969
|
+
(_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
|
11972
11970
|
}
|
11973
11971
|
else {
|
11974
|
-
(
|
11972
|
+
(_j = videoRef.current) === null || _j === void 0 ? void 0 : _j.pause();
|
11975
11973
|
}
|
11976
11974
|
setIsPauseVideo(!isPause);
|
11977
11975
|
break;
|
@@ -12002,16 +12000,14 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
|
|
12002
12000
|
}
|
12003
12001
|
}, [data, index, bffEventReport]);
|
12004
12002
|
useEffect(() => {
|
12005
|
-
var _a, _b, _c
|
12003
|
+
var _a, _b, _c;
|
12006
12004
|
if (data.length <= 0)
|
12007
12005
|
return;
|
12008
12006
|
if (!videoRef.current)
|
12009
12007
|
return;
|
12010
|
-
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
12011
12008
|
setIsPauseVideo(false);
|
12012
12009
|
if (!isActive) {
|
12013
|
-
|
12014
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
|
12010
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
|
12015
12011
|
return;
|
12016
12012
|
}
|
12017
12013
|
if (!videoRef.current.src) {
|
@@ -12034,12 +12030,10 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
|
|
12034
12030
|
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
12035
12031
|
}
|
12036
12032
|
else {
|
12037
|
-
if (((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.readyState) < 2)
|
12038
|
-
return;
|
12039
12033
|
videoRef.current.play();
|
12040
12034
|
}
|
12041
|
-
(
|
12042
|
-
(
|
12035
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
|
12036
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
|
12043
12037
|
return () => {
|
12044
12038
|
var _a, _b;
|
12045
12039
|
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
|
@@ -12050,17 +12044,15 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex }) => {
|
|
12050
12044
|
打开/关闭hashtag暂停/播放视频
|
12051
12045
|
*/
|
12052
12046
|
useEffect(() => {
|
12053
|
-
var _a, _b, _c
|
12054
|
-
|
12055
|
-
return;
|
12056
|
-
const isPause = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.paused;
|
12047
|
+
var _a, _b, _c;
|
12048
|
+
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
12057
12049
|
if (!isActive)
|
12058
12050
|
return;
|
12059
12051
|
if (!isPause && openHashtag) {
|
12060
|
-
(
|
12052
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
|
12061
12053
|
}
|
12062
12054
|
else if (!openHashtag) {
|
12063
|
-
(
|
12055
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
|
12064
12056
|
}
|
12065
12057
|
}, [openHashtag, isActive]);
|
12066
12058
|
useEffect(() => {
|
@@ -12152,10 +12144,35 @@ const FingerSwipeTip = ({ imageUrl }) => {
|
|
12152
12144
|
React.createElement("img", { src: imageUrl || FINGER_SWIPE_ICON })));
|
12153
12145
|
};
|
12154
12146
|
|
12147
|
+
/*
|
12148
|
+
* @Author: binruan@chatlabs.com
|
12149
|
+
* @Date: 2024-03-20 10:27:31
|
12150
|
+
* @LastEditors: binruan@chatlabs.com
|
12151
|
+
* @LastEditTime: 2024-04-08 18:44:58
|
12152
|
+
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
|
12153
|
+
*
|
12154
|
+
*/
|
12155
12155
|
const Picture = (props) => {
|
12156
12156
|
const { src, height, width } = props;
|
12157
|
+
const [blur, setBlur] = useState(false);
|
12157
12158
|
const imgDom = useRef(null);
|
12158
12159
|
const { sxpParameter } = useSxpDataSource();
|
12160
|
+
useEffect(() => {
|
12161
|
+
if (imgDom.current === null || src === '') {
|
12162
|
+
return;
|
12163
|
+
}
|
12164
|
+
const img = new Image();
|
12165
|
+
img.src = src;
|
12166
|
+
img.onload = () => {
|
12167
|
+
const aspectRatio = img.height / img.width;
|
12168
|
+
const targetAspectRatio = 16 / 9;
|
12169
|
+
const tolerance = 0.05; // 允许的宽高比误差范围
|
12170
|
+
if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
|
12171
|
+
setBlur(true);
|
12172
|
+
}
|
12173
|
+
};
|
12174
|
+
imgDom.current.src = src;
|
12175
|
+
}, [src]);
|
12159
12176
|
return (React.createElement("div", { style: {
|
12160
12177
|
overflow: 'hidden',
|
12161
12178
|
height,
|
@@ -12165,8 +12182,19 @@ const Picture = (props) => {
|
|
12165
12182
|
React.createElement("img", { ref: imgDom, loading: 'lazy', src: src !== null && src !== void 0 ? src : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image, style: {
|
12166
12183
|
height: '100%',
|
12167
12184
|
width: '100%',
|
12168
|
-
objectFit: 'cover'
|
12169
|
-
|
12185
|
+
objectFit: 'cover',
|
12186
|
+
filter: blur ? 'blur(10px)' : 'none',
|
12187
|
+
transform: blur ? 'scale(1.2)' : 'none'
|
12188
|
+
} }),
|
12189
|
+
blur && (React.createElement("img", { ref: imgDom, src: src, loading: 'lazy', style: {
|
12190
|
+
width: '100%',
|
12191
|
+
objectFit: 'contain',
|
12192
|
+
position: 'absolute',
|
12193
|
+
top: '50%',
|
12194
|
+
transform: 'translateY(-50%)',
|
12195
|
+
left: 0,
|
12196
|
+
right: 0
|
12197
|
+
} }))));
|
12170
12198
|
};
|
12171
12199
|
|
12172
12200
|
/*
|