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/index.js
CHANGED
@@ -8225,7 +8225,7 @@ var Modal$1 = memo(Modal);
|
|
8225
8225
|
* @Author: binruan@chatlabs.com
|
8226
8226
|
* @Date: 2023-12-26 16:11:34
|
8227
8227
|
* @LastEditors: binruan@chatlabs.com
|
8228
|
-
* @LastEditTime: 2024-04-17
|
8228
|
+
* @LastEditTime: 2024-04-17 13:49:29
|
8229
8229
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\ExpandableText.tsx
|
8230
8230
|
*
|
8231
8231
|
*/
|
@@ -8249,9 +8249,10 @@ const limitTextLastWholeWord = (originalText = '', limit) => {
|
|
8249
8249
|
};
|
8250
8250
|
const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost, onChange }) => {
|
8251
8251
|
const [isShowMore, setIsShowMore] = useState(false);
|
8252
|
-
useState(false);
|
8252
|
+
const [isShow, setIsShow] = useState(false);
|
8253
8253
|
const lineClamp = Number((style === null || style === void 0 ? void 0 : style.lineClamp) || 2);
|
8254
8254
|
const multiRow = useRef(null);
|
8255
|
+
const multiRowCopy = useRef(null);
|
8255
8256
|
const handleClick = useCallback(() => {
|
8256
8257
|
setIsShowMore(!isShowMore);
|
8257
8258
|
// onChange?.(!isShowMore);
|
@@ -8260,24 +8261,15 @@ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldTex
|
|
8260
8261
|
return !isShowMore && text.length > maxStr ? limitTextLastWholeWord(text, maxStr) + '...' : text;
|
8261
8262
|
}, [text, maxStr, isShowMore]);
|
8262
8263
|
useEffect(() => {
|
8263
|
-
|
8264
|
-
|
8265
|
-
|
8266
|
-
|
8267
|
-
|
8268
|
-
|
8269
|
-
|
8270
|
-
|
8271
|
-
|
8272
|
-
// const lineHeight = isNaN(lh) ? fs : lh;
|
8273
|
-
// if (text && height > lineHeight * lineClamp) {
|
8274
|
-
// setIsShowMore(false);
|
8275
|
-
// setIsShow(true);
|
8276
|
-
// }
|
8277
|
-
// } catch {}
|
8278
|
-
// }, 100);
|
8279
|
-
// }
|
8280
|
-
}, [multiRow, text, lineClamp, style, isPost]);
|
8264
|
+
var _a, _b;
|
8265
|
+
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) {
|
8266
|
+
setIsShow(true);
|
8267
|
+
}
|
8268
|
+
else {
|
8269
|
+
setIsShow(false);
|
8270
|
+
}
|
8271
|
+
multiRowCopy.current.style.display = 'none';
|
8272
|
+
}, [isPost]);
|
8281
8273
|
return (React.createElement("div", { className: className, style: Object.assign({}, style), hidden: !text || text === '' },
|
8282
8274
|
React.createElement("div", { ref: multiRow, style: {
|
8283
8275
|
overflow: 'hidden',
|
@@ -8287,7 +8279,8 @@ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldTex
|
|
8287
8279
|
WebkitBoxOrient: 'vertical',
|
8288
8280
|
wordBreak: 'break-word'
|
8289
8281
|
}, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
|
8290
|
-
|
8282
|
+
React.createElement("div", { ref: multiRowCopy, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
|
8283
|
+
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'))));
|
8291
8284
|
};
|
8292
8285
|
var ExpandableText$1 = memo(ExpandableText);
|
8293
8286
|
|
@@ -12221,7 +12214,7 @@ const FingerSwipeTip = ({ imageUrl }) => {
|
|
12221
12214
|
* @Author: binruan@chatlabs.com
|
12222
12215
|
* @Date: 2024-03-20 10:27:31
|
12223
12216
|
* @LastEditors: binruan@chatlabs.com
|
12224
|
-
* @LastEditTime: 2024-04-17
|
12217
|
+
* @LastEditTime: 2024-04-17 13:55:13
|
12225
12218
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
|
12226
12219
|
*
|
12227
12220
|
*/
|
@@ -12231,7 +12224,7 @@ const Picture = (props) => {
|
|
12231
12224
|
const imgDom = useRef(null);
|
12232
12225
|
const { sxpParameter } = useSxpDataSource();
|
12233
12226
|
const getAvifToPng = useCallback((src) => {
|
12234
|
-
return src;
|
12227
|
+
return src.indexOf('avif') !== -1 ? `${src}?imageMogr2/format/webp` : src;
|
12235
12228
|
}, []);
|
12236
12229
|
useEffect(() => {
|
12237
12230
|
if (imgDom.current === null || src === '') {
|
@@ -12277,7 +12270,7 @@ const Picture = (props) => {
|
|
12277
12270
|
* @Author: lewinlu@chatlabs.com
|
12278
12271
|
* @Date: 2024-01-03 14:39:09
|
12279
12272
|
* @LastEditors: binruan@chatlabs.com
|
12280
|
-
* @LastEditTime: 2024-04-
|
12273
|
+
* @LastEditTime: 2024-04-17 13:53:34
|
12281
12274
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
|
12282
12275
|
*/
|
12283
12276
|
const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
|
@@ -12300,7 +12293,7 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd
|
|
12300
12293
|
// if (!isActive) {
|
12301
12294
|
// return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
|
12302
12295
|
// }
|
12303
|
-
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) => {
|
12296
|
+
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) => {
|
12304
12297
|
return (React.createElement(SwiperSlide, { key: url },
|
12305
12298
|
React.createElement(Picture, { src: url, width: width, height: height })));
|
12306
12299
|
})));
|
@@ -12484,7 +12477,7 @@ const Nudge = ({ nudge }) => {
|
|
12484
12477
|
* @Author: binruan@chatlabs.com
|
12485
12478
|
* @Date: 2024-01-15 19:03:09
|
12486
12479
|
* @LastEditors: binruan@chatlabs.com
|
12487
|
-
* @LastEditTime: 2024-04-17 10:
|
12480
|
+
* @LastEditTime: 2024-04-17 10:30:08
|
12488
12481
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12489
12482
|
*
|
12490
12483
|
*/
|
@@ -12613,7 +12606,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12613
12606
|
eventDescription: 'Session completed',
|
12614
12607
|
relatedContentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
|
12615
12608
|
relatedProductId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
|
12616
|
-
position: activeIndex,
|
12609
|
+
position: activeIndex + '',
|
12617
12610
|
fromKName,
|
12618
12611
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
12619
12612
|
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 : ''
|