pb-sxp-ui 1.0.13 → 1.0.14
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 +63 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -1
- package/dist/index.js +63 -32
- 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 +63 -32
- 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.d.ts +1 -0
- package/es/core/components/SxpPageRender/ExpandableText.js +6 -24
- package/es/core/components/SxpPageRender/index.js +34 -5
- package/es/core/utils/localStore.d.ts +1 -0
- package/es/core/utils/localStore.js +4 -0
- package/lib/core/components/SxpPageRender/ExpandableText.d.ts +1 -0
- package/lib/core/components/SxpPageRender/ExpandableText.js +6 -24
- package/lib/core/components/SxpPageRender/index.js +34 -5
- package/lib/core/utils/localStore.d.ts +1 -0
- package/lib/core/utils/localStore.js +6 -1
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
@@ -392,6 +392,10 @@
|
|
392
392
|
}
|
393
393
|
return fakeUserId;
|
394
394
|
};
|
395
|
+
const getFeUserId = () => {
|
396
|
+
const fakeUserId = window.localStorage.getItem(FAKE_USER_KEY);
|
397
|
+
return lodash.isEmpty(fakeUserId);
|
398
|
+
};
|
395
399
|
|
396
400
|
/*
|
397
401
|
* @Author: binruan@chatlabs.com
|
@@ -8232,7 +8236,7 @@
|
|
8232
8236
|
* @Author: binruan@chatlabs.com
|
8233
8237
|
* @Date: 2023-12-26 16:11:34
|
8234
8238
|
* @LastEditors: binruan@chatlabs.com
|
8235
|
-
* @LastEditTime: 2024-04-
|
8239
|
+
* @LastEditTime: 2024-04-16 19:27:48
|
8236
8240
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\ExpandableText.tsx
|
8237
8241
|
*
|
8238
8242
|
*/
|
@@ -8254,48 +8258,47 @@
|
|
8254
8258
|
const _words = newWords.length > 1 && newWords.length < words.length ? newWords.slice(0, newWords.length - 1) : newWords;
|
8255
8259
|
return _words.join(' ') + ' ';
|
8256
8260
|
};
|
8257
|
-
const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost }) => {
|
8258
|
-
const [isShowMore, setIsShowMore] = React.useState(
|
8259
|
-
|
8261
|
+
const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost, onChange }) => {
|
8262
|
+
const [isShowMore, setIsShowMore] = React.useState(false);
|
8263
|
+
React.useState(false);
|
8260
8264
|
const lineClamp = Number((style === null || style === void 0 ? void 0 : style.lineClamp) || 2);
|
8261
8265
|
const multiRow = React.useRef(null);
|
8262
8266
|
const handleClick = React.useCallback(() => {
|
8263
8267
|
setIsShowMore(!isShowMore);
|
8264
|
-
|
8268
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(!isShowMore);
|
8269
|
+
}, [isShowMore, onChange]);
|
8265
8270
|
React.useMemo(() => {
|
8266
8271
|
return !isShowMore && text.length > maxStr ? limitTextLastWholeWord(text, maxStr) + '...' : text;
|
8267
8272
|
}, [text, maxStr, isShowMore]);
|
8268
8273
|
React.useEffect(() => {
|
8269
|
-
if (multiRow.current && isPost) {
|
8270
|
-
|
8271
|
-
|
8272
|
-
|
8273
|
-
|
8274
|
-
|
8275
|
-
|
8276
|
-
|
8277
|
-
|
8278
|
-
|
8279
|
-
|
8280
|
-
|
8281
|
-
|
8282
|
-
|
8283
|
-
|
8284
|
-
|
8285
|
-
|
8286
|
-
}, 100);
|
8287
|
-
}
|
8274
|
+
// if (multiRow.current && isPost) {
|
8275
|
+
// setIsShowMore(true);
|
8276
|
+
// setTimeout(() => {
|
8277
|
+
// setIsShow(false);
|
8278
|
+
// try {
|
8279
|
+
// const cs = window?.getComputedStyle?.(multiRow.current);
|
8280
|
+
// const height = parseFloat(cs?.height);
|
8281
|
+
// const lh = parseFloat(cs?.lineHeight);
|
8282
|
+
// const fs = parseFloat(cs?.fontSize) + 6;
|
8283
|
+
// const lineHeight = isNaN(lh) ? fs : lh;
|
8284
|
+
// if (text && height > lineHeight * lineClamp) {
|
8285
|
+
// setIsShowMore(false);
|
8286
|
+
// setIsShow(true);
|
8287
|
+
// }
|
8288
|
+
// } catch {}
|
8289
|
+
// }, 100);
|
8290
|
+
// }
|
8288
8291
|
}, [multiRow, text, lineClamp, style, isPost]);
|
8289
8292
|
return (React.createElement("div", { className: className, style: Object.assign({}, style), hidden: !text || text === '' },
|
8290
8293
|
React.createElement("div", { ref: multiRow, style: {
|
8291
8294
|
overflow: 'hidden',
|
8292
|
-
WebkitLineClamp:
|
8295
|
+
WebkitLineClamp: isShowMore ? '' : lineClamp,
|
8293
8296
|
textOverflow: 'ellipsis',
|
8294
8297
|
display: '-webkit-box',
|
8295
8298
|
WebkitBoxOrient: 'vertical',
|
8296
8299
|
wordBreak: 'break-word'
|
8297
8300
|
}, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
|
8298
|
-
|
8301
|
+
text && isPost && (React.createElement("span", { style: { textDecoration: 'underline', cursor: 'pointer' }, onClick: onClick !== null && onClick !== void 0 ? onClick : handleClick }, isShowMore ? unfoldText || 'show less' : foldText || 'show more'))));
|
8299
8302
|
};
|
8300
8303
|
var ExpandableText$1 = React.memo(ExpandableText);
|
8301
8304
|
|
@@ -12489,7 +12492,7 @@ Made in Italy` })));
|
|
12489
12492
|
* @Author: binruan@chatlabs.com
|
12490
12493
|
* @Date: 2024-01-15 19:03:09
|
12491
12494
|
* @LastEditors: binruan@chatlabs.com
|
12492
|
-
* @LastEditTime: 2024-04-
|
12495
|
+
* @LastEditTime: 2024-04-16 18:26:41
|
12493
12496
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12494
12497
|
*
|
12495
12498
|
*/
|
@@ -12503,10 +12506,11 @@ Made in Italy` })));
|
|
12503
12506
|
const curTime = React.useRef();
|
12504
12507
|
const viewTime = React.useRef();
|
12505
12508
|
const [isLoadMore, setIsLoadMore] = React.useState(false);
|
12509
|
+
const [isShowMore, setIsShowMore] = React.useState(false);
|
12506
12510
|
const { loadVideos, bffEventReport, loading, setPopupDetailData, ctaEvent, swiperRef, waterFallData, setOpenHashtag, appDomain, openHashtag, loadingImage, isFromHashtag, popupDetailData } = useSxpDataSource();
|
12507
12511
|
const { productView } = useEventReport();
|
12508
12512
|
const isShowFingerTip = React.useMemo(() => {
|
12509
|
-
return data.length > 0 && !loading;
|
12513
|
+
return data.length > 0 && !loading && !getFeUserId;
|
12510
12514
|
}, [data, loading]);
|
12511
12515
|
const handleH5EnterLink = React.useCallback(() => {
|
12512
12516
|
if (data.length <= 0) {
|
@@ -12665,20 +12669,47 @@ Made in Italy` })));
|
|
12665
12669
|
}
|
12666
12670
|
return null;
|
12667
12671
|
}, [containerWidth, data, height, isMuted, activeIndex, globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost, viewTime, tipText, resolver, schema]);
|
12672
|
+
const onExpandableChange = React.useCallback((v) => {
|
12673
|
+
setIsShowMore(v);
|
12674
|
+
}, []);
|
12675
|
+
const lineGradStyle = React.useMemo(() => {
|
12676
|
+
return !isShowMore
|
12677
|
+
? {
|
12678
|
+
padding: '20px 0'
|
12679
|
+
}
|
12680
|
+
: {
|
12681
|
+
background: 'linear-gradient( 180deg, rgba(129,129,129,0) 0%, rgba(121,121,121,0.5) 5%, #616161 100%)',
|
12682
|
+
paddingTop: 20,
|
12683
|
+
paddingBottom: 20
|
12684
|
+
};
|
12685
|
+
}, [isShowMore]);
|
12668
12686
|
const renderBottom = React.useCallback((rec, index) => {
|
12669
12687
|
var _a, _b, _c, _d, _e, _f, _g;
|
12670
12688
|
if (rec.video) {
|
12671
12689
|
return (React.createElement(React.Fragment, null,
|
12672
|
-
((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
12690
|
+
((_a = rec.video) === null || _a === void 0 ? void 0 : _a.title) && !isShowMore && React.createElement("div", { className: 'clc-sxp-bottom-shadow' }),
|
12673
12691
|
React.createElement("div", { className: 'clc-sxp-bottom' },
|
12674
12692
|
React.createElement(Nudge, { nudge: nudge }),
|
12675
12693
|
React.createElement("div", { className: 'clc-sxp-bottom-card' },
|
12676
12694
|
React.createElement(RenderCard$1, { rec: rec, index: index, tempMap: tempMap, resolver: resolver })),
|
12677
|
-
React.createElement(
|
12678
|
-
|
12695
|
+
React.createElement("div", { style: lineGradStyle },
|
12696
|
+
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(Object.assign({}, descStyle), { textShadow: (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isOpenTextShadow) ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none' }), onChange: onExpandableChange }),
|
12697
|
+
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.url) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle })))));
|
12679
12698
|
}
|
12680
12699
|
return null;
|
12681
|
-
}, [
|
12700
|
+
}, [
|
12701
|
+
descStyle,
|
12702
|
+
activeIndex,
|
12703
|
+
tempMap,
|
12704
|
+
resolver,
|
12705
|
+
tipText,
|
12706
|
+
nudge,
|
12707
|
+
hashTagStyle,
|
12708
|
+
globalConfig,
|
12709
|
+
onExpandableChange,
|
12710
|
+
isShowMore,
|
12711
|
+
lineGradStyle
|
12712
|
+
]);
|
12682
12713
|
const renderLikeButton = React.useCallback((rec, index) => {
|
12683
12714
|
var _a, _b;
|
12684
12715
|
if (!(globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLike))
|