pb-sxp-ui 1.0.3-alpha.2 → 1.0.3-alpha.4
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 +77 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +7 -4
- package/dist/index.js +77 -48
- 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 +77 -48
- 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/ExpandableText.js +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/CommodityDetail/index.js +9 -8
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +6 -5
- package/lib/core/components/SxpPageRender/ExpandableText.js +1 -1
- 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/CommodityDetail/index.js +9 -8
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +6 -5
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
@@ -8224,7 +8224,7 @@
|
|
8224
8224
|
* @Author: binruan@chatlabs.com
|
8225
8225
|
* @Date: 2023-12-26 16:11:34
|
8226
8226
|
* @LastEditors: binruan@chatlabs.com
|
8227
|
-
* @LastEditTime: 2024-04-
|
8227
|
+
* @LastEditTime: 2024-04-09 11:00:07
|
8228
8228
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\ExpandableText.tsx
|
8229
8229
|
*
|
8230
8230
|
*/
|
@@ -8267,7 +8267,7 @@
|
|
8267
8267
|
const cs = (_a = window === null || window === void 0 ? void 0 : window.getComputedStyle) === null || _a === void 0 ? void 0 : _a.call(window, multiRow.current);
|
8268
8268
|
const height = parseFloat(cs === null || cs === void 0 ? void 0 : cs.height);
|
8269
8269
|
const lh = parseFloat(cs === null || cs === void 0 ? void 0 : cs.lineHeight);
|
8270
|
-
const fs = parseFloat(cs === null || cs === void 0 ? void 0 : cs.fontSize) +
|
8270
|
+
const fs = parseFloat(cs === null || cs === void 0 ? void 0 : cs.fontSize) + 6;
|
8271
8271
|
const lineHeight = isNaN(lh) ? fs : lh;
|
8272
8272
|
if (text && height > lineHeight * lineClamp) {
|
8273
8273
|
setIsShowMore(false);
|
@@ -8335,15 +8335,16 @@
|
|
8335
8335
|
const width = isPreview ? 375 : window.innerWidth;
|
8336
8336
|
const renderContent = ({ isPost }) => {
|
8337
8337
|
var _a, _b, _c;
|
8338
|
-
return (React.createElement("div",
|
8339
|
-
React.createElement("div", { className: 'pb-commondity-content-collection', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection }, (_a = product === null || product === void 0 ? void 0 : product.collection) !== null && _a !== void 0 ? _a : 'Tiffany Lock'),
|
8340
|
-
React.createElement("div", { className: 'pb-commondity-content-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title }, (_b = product === null || product === void 0 ? void 0 : product.title) !== null && _b !== void 0 ? _b : 'Pendant in Yellow Gold with Diamonds, Medium'),
|
8341
|
-
React.createElement("div", { className: 'pb-commondity-content-price', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price }, priceText),
|
8342
|
-
React.createElement(
|
8338
|
+
return (React.createElement("div", null,
|
8339
|
+
React.createElement("div", { className: 'pb-commondity-content-collection', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection, hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.collection) || (product === null || product === void 0 ? void 0 : product.collection) === '') }, (_a = product === null || product === void 0 ? void 0 : product.collection) !== null && _a !== void 0 ? _a : 'Tiffany Lock'),
|
8340
|
+
React.createElement("div", { className: 'pb-commondity-content-title', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title, hidden: !!product && !(product === null || product === void 0 ? void 0 : product.title) }, (_b = product === null || product === void 0 ? void 0 : product.title) !== null && _b !== void 0 ? _b : 'Pendant in Yellow Gold with Diamonds, Medium'),
|
8341
|
+
React.createElement("div", { className: 'pb-commondity-content-price', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price) }, priceText),
|
8342
|
+
React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
8343
|
+
React.createElement(ExpandableText$1, { foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, onClick: () => setShowModal(true), isPost: isPost, text: (_c = product === null || product === void 0 ? void 0 : product.info) !== null && _c !== void 0 ? _c : `The design inspiration of Tiffany Lock series comes from the power of connection and inclusiveness, and the
|
8343
8344
|
bold and avant-garde visual design interprets the emotional bond connecting my heart. The Tiffany Lock
|
8344
8345
|
collection is unisex and is inspired by the padlock pattern found in the Tiffany Antique Collection. This
|
8345
8346
|
necklace features a stylish and eye-catching oval clasp chain decorated with a lock pattern. Crafted from
|
8346
|
-
18-karat gold, this necklace is embellished with hand-set diamonds.`, maxStr: 79, className: 'pb-commondity-content-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info })));
|
8347
|
+
18-karat gold, this necklace is embellished with hand-set diamonds.`, maxStr: 79, className: 'pb-commondity-content-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info }))));
|
8347
8348
|
};
|
8348
8349
|
const renderBtn = () => {
|
8349
8350
|
var _a;
|
@@ -8382,10 +8383,10 @@
|
|
8382
8383
|
objectFit: 'cover',
|
8383
8384
|
width: '100%'
|
8384
8385
|
}), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
|
8385
|
-
renderContent({ isPost })),
|
8386
|
+
React.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
|
8386
8387
|
renderBtn(),
|
8387
8388
|
React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) },
|
8388
|
-
renderContent({ isPost: false }),
|
8389
|
+
React.createElement("div", { style: { paddingBottom: '80px' } }, renderContent({ isPost: false })),
|
8389
8390
|
renderBtn())));
|
8390
8391
|
};
|
8391
8392
|
var CommodityDetailComponent = React.memo(CommodityDetail$1);
|
@@ -8828,11 +8829,12 @@ Made in Italy` })));
|
|
8828
8829
|
}), src: (_j = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _j !== void 0 ? _j : bottom_image, alt: '' }))),
|
8829
8830
|
React.createElement("div", { className: 'pb-commondityDiroNew-content' },
|
8830
8831
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
|
8831
|
-
React.createElement("div",
|
8832
|
-
|
8833
|
-
React.createElement("div", { className: 'pb-commondityDiroNew-content-
|
8834
|
-
|
8835
|
-
|
8832
|
+
React.createElement("div", null,
|
8833
|
+
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'),
|
8834
|
+
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')),
|
8835
|
+
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right' },
|
8836
|
+
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-price', hidden: !!product && !(product === null || product === void 0 ? void 0 : product.price), style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price }, priceText),
|
8837
|
+
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-right-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 : '税费'))),
|
8836
8838
|
(!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')),
|
8837
8839
|
productInfoText({ isPost }))),
|
8838
8840
|
React.createElement(Modal$1, { visible: showModal, onClose: () => setShowModal(false) }, productInfoText({ isPost: false }))));
|
@@ -11533,7 +11535,7 @@ Made in Italy` })));
|
|
11533
11535
|
React.createElement("img", { className: 'list-content-listItem-picture-img', loading: 'lazy', ref: imgDom })),
|
11534
11536
|
React.createElement("div", { className: 'list-content-listItem-info' },
|
11535
11537
|
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),
|
11536
|
-
React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles.price, hidden: !priceText }, priceText))));
|
11538
|
+
React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText }, priceText))));
|
11537
11539
|
};
|
11538
11540
|
function WaterfallList(_a) {
|
11539
11541
|
var _b, _c, _d, _e, _f, _g, _h;
|
@@ -11895,10 +11897,8 @@ Made in Italy` })));
|
|
11895
11897
|
videoRef.current.muted = muted;
|
11896
11898
|
}, [muted]);
|
11897
11899
|
const handleVideoStart = React.useCallback(() => {
|
11898
|
-
var _a
|
11899
|
-
|
11900
|
-
return;
|
11901
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
|
11900
|
+
var _a;
|
11901
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
11902
11902
|
}, []);
|
11903
11903
|
const PAUSE_ICON = useIconLink('/pb_static/06f28a2025c74c1cb49be6767316d827.png');
|
11904
11904
|
const handlePlaying = React.useCallback(() => {
|
@@ -11955,38 +11955,37 @@ Made in Italy` })));
|
|
11955
11955
|
});
|
11956
11956
|
}
|
11957
11957
|
setTimeout(() => {
|
11958
|
-
var _a
|
11959
|
-
|
11960
|
-
return;
|
11961
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
|
11958
|
+
var _a;
|
11959
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
11962
11960
|
}, 0);
|
11963
11961
|
}, [index, bffEventReport, data, isLoad]);
|
11964
11962
|
const handleClickVideo = React.useCallback((type) => () => {
|
11965
|
-
var _a, _b, _c, _d, _e, _f;
|
11966
|
-
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)
|
11967
|
-
return;
|
11963
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
11968
11964
|
if (!isLoad)
|
11969
11965
|
return;
|
11970
|
-
|
11966
|
+
data[index];
|
11967
|
+
((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
11968
|
+
((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
11969
|
+
const isPause = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.paused;
|
11971
11970
|
switch (type) {
|
11972
11971
|
case 'start':
|
11973
11972
|
if (!isPause)
|
11974
11973
|
return;
|
11975
|
-
(
|
11974
|
+
(_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.play();
|
11976
11975
|
setIsPauseVideo(false);
|
11977
11976
|
break;
|
11978
11977
|
case 'pause':
|
11979
11978
|
if (isPause)
|
11980
11979
|
return;
|
11981
|
-
(
|
11980
|
+
(_g = videoRef.current) === null || _g === void 0 ? void 0 : _g.pause();
|
11982
11981
|
setIsPauseVideo(true);
|
11983
11982
|
break;
|
11984
11983
|
default:
|
11985
11984
|
if (isPause) {
|
11986
|
-
(
|
11985
|
+
(_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.play();
|
11987
11986
|
}
|
11988
11987
|
else {
|
11989
|
-
(
|
11988
|
+
(_j = videoRef.current) === null || _j === void 0 ? void 0 : _j.pause();
|
11990
11989
|
}
|
11991
11990
|
setIsPauseVideo(!isPause);
|
11992
11991
|
break;
|
@@ -12017,16 +12016,14 @@ Made in Italy` })));
|
|
12017
12016
|
}
|
12018
12017
|
}, [data, index, bffEventReport]);
|
12019
12018
|
React.useEffect(() => {
|
12020
|
-
var _a, _b, _c
|
12019
|
+
var _a, _b, _c;
|
12021
12020
|
if (data.length <= 0)
|
12022
12021
|
return;
|
12023
12022
|
if (!videoRef.current)
|
12024
12023
|
return;
|
12025
|
-
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
12026
12024
|
setIsPauseVideo(false);
|
12027
12025
|
if (!isActive) {
|
12028
|
-
|
12029
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
|
12026
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
|
12030
12027
|
return;
|
12031
12028
|
}
|
12032
12029
|
if (!videoRef.current.src) {
|
@@ -12049,12 +12046,10 @@ Made in Italy` })));
|
|
12049
12046
|
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
12050
12047
|
}
|
12051
12048
|
else {
|
12052
|
-
if (((_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.readyState) < 2)
|
12053
|
-
return;
|
12054
12049
|
videoRef.current.play();
|
12055
12050
|
}
|
12056
|
-
(
|
12057
|
-
(
|
12051
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
|
12052
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
|
12058
12053
|
return () => {
|
12059
12054
|
var _a, _b;
|
12060
12055
|
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
|
@@ -12065,17 +12060,15 @@ Made in Italy` })));
|
|
12065
12060
|
打开/关闭hashtag暂停/播放视频
|
12066
12061
|
*/
|
12067
12062
|
React.useEffect(() => {
|
12068
|
-
var _a, _b, _c
|
12069
|
-
|
12070
|
-
return;
|
12071
|
-
const isPause = (_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.paused;
|
12063
|
+
var _a, _b, _c;
|
12064
|
+
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
12072
12065
|
if (!isActive)
|
12073
12066
|
return;
|
12074
12067
|
if (!isPause && openHashtag) {
|
12075
|
-
(
|
12068
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
|
12076
12069
|
}
|
12077
12070
|
else if (!openHashtag) {
|
12078
|
-
(
|
12071
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.play();
|
12079
12072
|
}
|
12080
12073
|
}, [openHashtag, isActive]);
|
12081
12074
|
React.useEffect(() => {
|
@@ -12167,10 +12160,35 @@ Made in Italy` })));
|
|
12167
12160
|
React.createElement("img", { src: imageUrl || FINGER_SWIPE_ICON })));
|
12168
12161
|
};
|
12169
12162
|
|
12163
|
+
/*
|
12164
|
+
* @Author: binruan@chatlabs.com
|
12165
|
+
* @Date: 2024-03-20 10:27:31
|
12166
|
+
* @LastEditors: binruan@chatlabs.com
|
12167
|
+
* @LastEditTime: 2024-04-08 18:44:58
|
12168
|
+
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
|
12169
|
+
*
|
12170
|
+
*/
|
12170
12171
|
const Picture = (props) => {
|
12171
12172
|
const { src, height, width } = props;
|
12173
|
+
const [blur, setBlur] = React.useState(false);
|
12172
12174
|
const imgDom = React.useRef(null);
|
12173
12175
|
const { sxpParameter } = useSxpDataSource();
|
12176
|
+
React.useEffect(() => {
|
12177
|
+
if (imgDom.current === null || src === '') {
|
12178
|
+
return;
|
12179
|
+
}
|
12180
|
+
const img = new Image();
|
12181
|
+
img.src = src;
|
12182
|
+
img.onload = () => {
|
12183
|
+
const aspectRatio = img.height / img.width;
|
12184
|
+
const targetAspectRatio = 16 / 9;
|
12185
|
+
const tolerance = 0.05; // 允许的宽高比误差范围
|
12186
|
+
if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
|
12187
|
+
setBlur(true);
|
12188
|
+
}
|
12189
|
+
};
|
12190
|
+
imgDom.current.src = src;
|
12191
|
+
}, [src]);
|
12174
12192
|
return (React.createElement("div", { style: {
|
12175
12193
|
overflow: 'hidden',
|
12176
12194
|
height,
|
@@ -12180,8 +12198,19 @@ Made in Italy` })));
|
|
12180
12198
|
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: {
|
12181
12199
|
height: '100%',
|
12182
12200
|
width: '100%',
|
12183
|
-
objectFit: 'cover'
|
12184
|
-
|
12201
|
+
objectFit: 'cover',
|
12202
|
+
filter: blur ? 'blur(10px)' : 'none',
|
12203
|
+
transform: blur ? 'scale(1.2)' : 'none'
|
12204
|
+
} }),
|
12205
|
+
blur && (React.createElement("img", { ref: imgDom, src: src, loading: 'lazy', style: {
|
12206
|
+
width: '100%',
|
12207
|
+
objectFit: 'contain',
|
12208
|
+
position: 'absolute',
|
12209
|
+
top: '50%',
|
12210
|
+
transform: 'translateY(-50%)',
|
12211
|
+
left: 0,
|
12212
|
+
right: 0
|
12213
|
+
} }))));
|
12185
12214
|
};
|
12186
12215
|
|
12187
12216
|
/*
|