pb-sxp-ui 1.0.16 → 1.0.18
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 +20 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -27
- 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 +20 -27
- 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 +12 -2
- package/es/core/components/SxpPageRender/PictureGroup/Picture.js +1 -2
- package/es/core/components/SxpPageRender/PictureGroup/index.js +1 -1
- package/es/core/components/SxpPageRender/index.js +1 -1
- package/lib/core/components/SxpPageRender/ExpandableText.js +12 -2
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +1 -2
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +1 -1
- package/lib/core/components/SxpPageRender/index.js +1 -1
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
@@ -8240,7 +8240,7 @@
|
|
8240
8240
|
* @Author: binruan@chatlabs.com
|
8241
8241
|
* @Date: 2023-12-26 16:11:34
|
8242
8242
|
* @LastEditors: binruan@chatlabs.com
|
8243
|
-
* @LastEditTime: 2024-04-17
|
8243
|
+
* @LastEditTime: 2024-04-17 13:49:29
|
8244
8244
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\ExpandableText.tsx
|
8245
8245
|
*
|
8246
8246
|
*/
|
@@ -8264,9 +8264,10 @@
|
|
8264
8264
|
};
|
8265
8265
|
const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost, onChange }) => {
|
8266
8266
|
const [isShowMore, setIsShowMore] = React.useState(false);
|
8267
|
-
React.useState(false);
|
8267
|
+
const [isShow, setIsShow] = React.useState(false);
|
8268
8268
|
const lineClamp = Number((style === null || style === void 0 ? void 0 : style.lineClamp) || 2);
|
8269
8269
|
const multiRow = React.useRef(null);
|
8270
|
+
const multiRowCopy = React.useRef(null);
|
8270
8271
|
const handleClick = React.useCallback(() => {
|
8271
8272
|
setIsShowMore(!isShowMore);
|
8272
8273
|
// onChange?.(!isShowMore);
|
@@ -8275,24 +8276,15 @@
|
|
8275
8276
|
return !isShowMore && text.length > maxStr ? limitTextLastWholeWord(text, maxStr) + '...' : text;
|
8276
8277
|
}, [text, maxStr, isShowMore]);
|
8277
8278
|
React.useEffect(() => {
|
8278
|
-
|
8279
|
-
|
8280
|
-
|
8281
|
-
|
8282
|
-
|
8283
|
-
|
8284
|
-
|
8285
|
-
|
8286
|
-
|
8287
|
-
// const lineHeight = isNaN(lh) ? fs : lh;
|
8288
|
-
// if (text && height > lineHeight * lineClamp) {
|
8289
|
-
// setIsShowMore(false);
|
8290
|
-
// setIsShow(true);
|
8291
|
-
// }
|
8292
|
-
// } catch {}
|
8293
|
-
// }, 100);
|
8294
|
-
// }
|
8295
|
-
}, [multiRow, text, lineClamp, style, isPost]);
|
8279
|
+
var _a, _b;
|
8280
|
+
if (((_a = multiRowCopy === null || multiRowCopy === void 0 ? void 0 : multiRowCopy.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) > ((_b = multiRow === null || multiRow === void 0 ? void 0 : multiRow.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) && isPost) {
|
8281
|
+
setIsShow(true);
|
8282
|
+
}
|
8283
|
+
else {
|
8284
|
+
setIsShow(false);
|
8285
|
+
}
|
8286
|
+
multiRowCopy.current.style.display = 'none';
|
8287
|
+
}, [isPost]);
|
8296
8288
|
return (React.createElement("div", { className: className, style: Object.assign({}, style), hidden: !text || text === '' },
|
8297
8289
|
React.createElement("div", { ref: multiRow, style: {
|
8298
8290
|
overflow: 'hidden',
|
@@ -8302,7 +8294,8 @@
|
|
8302
8294
|
WebkitBoxOrient: 'vertical',
|
8303
8295
|
wordBreak: 'break-word'
|
8304
8296
|
}, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
|
8305
|
-
|
8297
|
+
React.createElement("div", { ref: multiRowCopy, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
|
8298
|
+
text && isPost && isShow && (React.createElement("span", { style: { textDecoration: 'underline', cursor: 'pointer' }, onClick: onClick !== null && onClick !== void 0 ? onClick : handleClick }, isShowMore ? unfoldText || 'show less' : foldText || 'show more'))));
|
8306
8299
|
};
|
8307
8300
|
var ExpandableText$1 = React.memo(ExpandableText);
|
8308
8301
|
|
@@ -12236,7 +12229,7 @@ Made in Italy` })));
|
|
12236
12229
|
* @Author: binruan@chatlabs.com
|
12237
12230
|
* @Date: 2024-03-20 10:27:31
|
12238
12231
|
* @LastEditors: binruan@chatlabs.com
|
12239
|
-
* @LastEditTime: 2024-04-17
|
12232
|
+
* @LastEditTime: 2024-04-17 13:55:13
|
12240
12233
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
|
12241
12234
|
*
|
12242
12235
|
*/
|
@@ -12246,7 +12239,7 @@ Made in Italy` })));
|
|
12246
12239
|
const imgDom = React.useRef(null);
|
12247
12240
|
const { sxpParameter } = useSxpDataSource();
|
12248
12241
|
const getAvifToPng = React.useCallback((src) => {
|
12249
|
-
return src;
|
12242
|
+
return src.indexOf('avif') !== -1 ? `${src}?imageMogr2/format/webp` : src;
|
12250
12243
|
}, []);
|
12251
12244
|
React.useEffect(() => {
|
12252
12245
|
if (imgDom.current === null || src === '') {
|
@@ -12292,7 +12285,7 @@ Made in Italy` })));
|
|
12292
12285
|
* @Author: lewinlu@chatlabs.com
|
12293
12286
|
* @Date: 2024-01-03 14:39:09
|
12294
12287
|
* @LastEditors: binruan@chatlabs.com
|
12295
|
-
* @LastEditTime: 2024-04-
|
12288
|
+
* @LastEditTime: 2024-04-17 13:53:34
|
12296
12289
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
|
12297
12290
|
*/
|
12298
12291
|
const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
|
@@ -12315,7 +12308,7 @@ Made in Italy` })));
|
|
12315
12308
|
// if (!isActive) {
|
12316
12309
|
// return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
|
12317
12310
|
// }
|
12318
|
-
return (React.createElement(Swiper, { defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, loop: true, autoplay: { delay: 3000 } }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
|
12311
|
+
return (React.createElement(Swiper, { defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, loop: true, autoplay: isActive ? { delay: 3000 } : false }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url) => {
|
12319
12312
|
return (React.createElement(SwiperSlide, { key: url },
|
12320
12313
|
React.createElement(Picture, { src: url, width: width, height: height })));
|
12321
12314
|
})));
|
@@ -12499,7 +12492,7 @@ Made in Italy` })));
|
|
12499
12492
|
* @Author: binruan@chatlabs.com
|
12500
12493
|
* @Date: 2024-01-15 19:03:09
|
12501
12494
|
* @LastEditors: binruan@chatlabs.com
|
12502
|
-
* @LastEditTime: 2024-04-17 10:
|
12495
|
+
* @LastEditTime: 2024-04-17 10:30:08
|
12503
12496
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12504
12497
|
*
|
12505
12498
|
*/
|
@@ -12628,7 +12621,7 @@ Made in Italy` })));
|
|
12628
12621
|
eventDescription: 'Session completed',
|
12629
12622
|
relatedContentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
|
12630
12623
|
relatedProductId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
|
12631
|
-
position: activeIndex,
|
12624
|
+
position: activeIndex + '',
|
12632
12625
|
fromKName,
|
12633
12626
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
12634
12627
|
relatedCtatId: (_q = (_p = (_o = item.video) === null || _o === void 0 ? void 0 : _o.bindCta) === null || _p === void 0 ? void 0 : _p.itemId) !== null && _q !== void 0 ? _q : ''
|