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.cjs
CHANGED
@@ -8248,7 +8248,7 @@ var Modal$1 = React.memo(Modal);
|
|
8248
8248
|
* @Author: binruan@chatlabs.com
|
8249
8249
|
* @Date: 2023-12-26 16:11:34
|
8250
8250
|
* @LastEditors: binruan@chatlabs.com
|
8251
|
-
* @LastEditTime: 2024-04-17
|
8251
|
+
* @LastEditTime: 2024-04-17 13:49:29
|
8252
8252
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\ExpandableText.tsx
|
8253
8253
|
*
|
8254
8254
|
*/
|
@@ -8272,9 +8272,10 @@ const limitTextLastWholeWord = (originalText = '', limit) => {
|
|
8272
8272
|
};
|
8273
8273
|
const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldText, unfoldText, isPost, onChange }) => {
|
8274
8274
|
const [isShowMore, setIsShowMore] = React.useState(false);
|
8275
|
-
React.useState(false);
|
8275
|
+
const [isShow, setIsShow] = React.useState(false);
|
8276
8276
|
const lineClamp = Number((style === null || style === void 0 ? void 0 : style.lineClamp) || 2);
|
8277
8277
|
const multiRow = React.useRef(null);
|
8278
|
+
const multiRowCopy = React.useRef(null);
|
8278
8279
|
const handleClick = React.useCallback(() => {
|
8279
8280
|
setIsShowMore(!isShowMore);
|
8280
8281
|
// onChange?.(!isShowMore);
|
@@ -8283,24 +8284,15 @@ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldTex
|
|
8283
8284
|
return !isShowMore && text.length > maxStr ? limitTextLastWholeWord(text, maxStr) + '...' : text;
|
8284
8285
|
}, [text, maxStr, isShowMore]);
|
8285
8286
|
React.useEffect(() => {
|
8286
|
-
|
8287
|
-
|
8288
|
-
|
8289
|
-
|
8290
|
-
|
8291
|
-
|
8292
|
-
|
8293
|
-
|
8294
|
-
|
8295
|
-
// const lineHeight = isNaN(lh) ? fs : lh;
|
8296
|
-
// if (text && height > lineHeight * lineClamp) {
|
8297
|
-
// setIsShowMore(false);
|
8298
|
-
// setIsShow(true);
|
8299
|
-
// }
|
8300
|
-
// } catch {}
|
8301
|
-
// }, 100);
|
8302
|
-
// }
|
8303
|
-
}, [multiRow, text, lineClamp, style, isPost]);
|
8287
|
+
var _a, _b;
|
8288
|
+
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) {
|
8289
|
+
setIsShow(true);
|
8290
|
+
}
|
8291
|
+
else {
|
8292
|
+
setIsShow(false);
|
8293
|
+
}
|
8294
|
+
multiRowCopy.current.style.display = 'none';
|
8295
|
+
}, [isPost]);
|
8304
8296
|
return (React.createElement("div", { className: className, style: Object.assign({}, style), hidden: !text || text === '' },
|
8305
8297
|
React.createElement("div", { ref: multiRow, style: {
|
8306
8298
|
overflow: 'hidden',
|
@@ -8310,7 +8302,8 @@ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldTex
|
|
8310
8302
|
WebkitBoxOrient: 'vertical',
|
8311
8303
|
wordBreak: 'break-word'
|
8312
8304
|
}, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
|
8313
|
-
|
8305
|
+
React.createElement("div", { ref: multiRowCopy, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
|
8306
|
+
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'))));
|
8314
8307
|
};
|
8315
8308
|
var ExpandableText$1 = React.memo(ExpandableText);
|
8316
8309
|
|
@@ -12244,7 +12237,7 @@ const FingerSwipeTip = ({ imageUrl }) => {
|
|
12244
12237
|
* @Author: binruan@chatlabs.com
|
12245
12238
|
* @Date: 2024-03-20 10:27:31
|
12246
12239
|
* @LastEditors: binruan@chatlabs.com
|
12247
|
-
* @LastEditTime: 2024-04-17
|
12240
|
+
* @LastEditTime: 2024-04-17 13:55:13
|
12248
12241
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
|
12249
12242
|
*
|
12250
12243
|
*/
|
@@ -12254,7 +12247,7 @@ const Picture = (props) => {
|
|
12254
12247
|
const imgDom = React.useRef(null);
|
12255
12248
|
const { sxpParameter } = useSxpDataSource();
|
12256
12249
|
const getAvifToPng = React.useCallback((src) => {
|
12257
|
-
return src;
|
12250
|
+
return src.indexOf('avif') !== -1 ? `${src}?imageMogr2/format/webp` : src;
|
12258
12251
|
}, []);
|
12259
12252
|
React.useEffect(() => {
|
12260
12253
|
if (imgDom.current === null || src === '') {
|
@@ -12300,7 +12293,7 @@ const Picture = (props) => {
|
|
12300
12293
|
* @Author: lewinlu@chatlabs.com
|
12301
12294
|
* @Date: 2024-01-03 14:39:09
|
12302
12295
|
* @LastEditors: binruan@chatlabs.com
|
12303
|
-
* @LastEditTime: 2024-04-
|
12296
|
+
* @LastEditTime: 2024-04-17 13:53:34
|
12304
12297
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
|
12305
12298
|
*/
|
12306
12299
|
const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent }) => {
|
@@ -12323,7 +12316,7 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd
|
|
12323
12316
|
// if (!isActive) {
|
12324
12317
|
// return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
|
12325
12318
|
// }
|
12326
|
-
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) => {
|
12319
|
+
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) => {
|
12327
12320
|
return (React.createElement(SwiperSlide, { key: url },
|
12328
12321
|
React.createElement(Picture, { src: url, width: width, height: height })));
|
12329
12322
|
})));
|
@@ -12507,7 +12500,7 @@ const Nudge = ({ nudge }) => {
|
|
12507
12500
|
* @Author: binruan@chatlabs.com
|
12508
12501
|
* @Date: 2024-01-15 19:03:09
|
12509
12502
|
* @LastEditors: binruan@chatlabs.com
|
12510
|
-
* @LastEditTime: 2024-04-17 10:
|
12503
|
+
* @LastEditTime: 2024-04-17 10:30:08
|
12511
12504
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12512
12505
|
*
|
12513
12506
|
*/
|
@@ -12636,7 +12629,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
12636
12629
|
eventDescription: 'Session completed',
|
12637
12630
|
relatedContentId: (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.itemId,
|
12638
12631
|
relatedProductId: (_m = item === null || item === void 0 ? void 0 : item.product) === null || _m === void 0 ? void 0 : _m.itemId,
|
12639
|
-
position: activeIndex,
|
12632
|
+
position: activeIndex + '',
|
12640
12633
|
fromKName,
|
12641
12634
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
12642
12635
|
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 : ''
|