pb-sxp-ui 1.0.23 → 1.0.24
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 +44 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -74
- 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 +44 -74
- 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/RenderCard.js +1 -1
- package/es/core/components/SxpPageRender/VideoWidget/index.js +36 -64
- package/es/core/components/SxpPageRender/index.js +1 -1
- package/es/materials/sxp/template/components/Img.js +1 -1
- package/lib/core/components/SxpPageRender/ExpandableText.js +1 -1
- package/lib/core/components/SxpPageRender/RenderCard.js +1 -1
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +36 -64
- package/lib/core/components/SxpPageRender/index.js +1 -1
- package/lib/materials/sxp/template/components/Img.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-
|
8243
|
+
* @LastEditTime: 2024-04-18 14:33:15
|
8244
8244
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\ExpandableText.tsx
|
8245
8245
|
*
|
8246
8246
|
*/
|
@@ -8285,7 +8285,7 @@
|
|
8285
8285
|
}
|
8286
8286
|
multiRowCopy.current.style.display = 'none';
|
8287
8287
|
}, [isPost]);
|
8288
|
-
return (React.createElement("div", { className: className, style: Object.assign({}, style), hidden: !text || text === '' },
|
8288
|
+
return (React.createElement("div", { className: className, style: Object.assign(Object.assign({}, style), { transform: 'translate3d(0px, 0px, 0px)' }), hidden: !text || text === '' },
|
8289
8289
|
React.createElement("div", { ref: multiRow, style: {
|
8290
8290
|
overflow: 'hidden',
|
8291
8291
|
WebkitLineClamp: !isPost || isShowMore ? '' : lineClamp,
|
@@ -9694,7 +9694,7 @@ Made in Italy` })));
|
|
9694
9694
|
* @Author: binruan@chatlabs.com
|
9695
9695
|
* @Date: 2024-01-16 14:50:13
|
9696
9696
|
* @LastEditors: binruan@chatlabs.com
|
9697
|
-
* @LastEditTime: 2024-04-
|
9697
|
+
* @LastEditTime: 2024-04-18 12:32:49
|
9698
9698
|
* @FilePath: \pb-sxp-ui\src\materials\sxp\template\components\Img.tsx
|
9699
9699
|
*
|
9700
9700
|
*/
|
@@ -9710,7 +9710,7 @@ Made in Italy` })));
|
|
9710
9710
|
}, rec, item, index);
|
9711
9711
|
}
|
9712
9712
|
}, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
|
9713
|
-
return (React.createElement("div", { ref: ref, hidden: !src },
|
9713
|
+
return (React.createElement("div", { ref: ref, hidden: !src, className: css.css({ width: '100%', height: '100%' }) },
|
9714
9714
|
React.createElement(FormatImage$1, { className: css.css({ width: '100%', objectFit: 'cover', height: '100%', display: 'block' }), src: src })));
|
9715
9715
|
};
|
9716
9716
|
var Img$1 = React.memo(Img);
|
@@ -11986,7 +11986,8 @@ Made in Italy` })));
|
|
11986
11986
|
const videoRef = React.useRef(null);
|
11987
11987
|
const { bffEventReport, sxpParameter, waterFallData, openHashtag } = useSxpDataSource();
|
11988
11988
|
const videoStartTime = React.useRef(0);
|
11989
|
-
const [
|
11989
|
+
const [isLoadFinish, setIsLoadFinish] = React.useState(false);
|
11990
|
+
const [isFirstPlay, setIsFirstPlay] = React.useState(true);
|
11990
11991
|
const { isActive } = useSwiperSlide();
|
11991
11992
|
React.useEffect(() => {
|
11992
11993
|
if (!videoRef.current)
|
@@ -12002,11 +12003,11 @@ Made in Italy` })));
|
|
12002
12003
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
12003
12004
|
setIsPauseVideo(false);
|
12004
12005
|
const item = data[index];
|
12005
|
-
if (item &&
|
12006
|
+
if (item && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
12006
12007
|
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
12007
12008
|
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
12008
12009
|
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
12009
|
-
const playType = '1';
|
12010
|
+
const playType = isFirstPlay ? '0' : '1';
|
12010
12011
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
12011
12012
|
eventInfo: {
|
12012
12013
|
eventSubject: 'playVideo',
|
@@ -12022,72 +12023,41 @@ Made in Italy` })));
|
|
12022
12023
|
traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
12023
12024
|
}
|
12024
12025
|
});
|
12026
|
+
setIsFirstPlay(false);
|
12025
12027
|
}
|
12026
|
-
|
12027
|
-
setIsLoad(true);
|
12028
|
-
}
|
12029
|
-
}, [bffEventReport, data, index, isLoad]);
|
12028
|
+
}, [bffEventReport, data, index, isFirstPlay]);
|
12030
12029
|
const handleLoadedMetadata = React.useCallback(() => {
|
12031
|
-
|
12032
|
-
|
12033
|
-
if (item && !isLoad && ((_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.duration)) {
|
12034
|
-
videoStartTime.current = ((_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.currentTime) || 0;
|
12035
|
-
const videoDuration = ((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
12036
|
-
const videoCurrentTime = ((_f = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
|
12037
|
-
const playType = '0';
|
12038
|
-
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
12039
|
-
eventInfo: {
|
12040
|
-
eventSubject: 'playVideo',
|
12041
|
-
eventDescription: 'User played the video',
|
12042
|
-
contentId: (_h = (_g = item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
|
12043
|
-
contentName: (_k = (_j = item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
|
12044
|
-
playType,
|
12045
|
-
startTime: videoCurrentTime,
|
12046
|
-
videoDuration,
|
12047
|
-
contentTags: JSON.stringify((_m = (_l = item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
|
12048
|
-
position: index + '',
|
12049
|
-
contentFormat: 'video',
|
12050
|
-
traceInfo: (_o = item.video) === null || _o === void 0 ? void 0 : _o.traceInfo
|
12051
|
-
}
|
12052
|
-
});
|
12053
|
-
}
|
12054
|
-
setTimeout(() => {
|
12055
|
-
var _a;
|
12056
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.play();
|
12057
|
-
}, 0);
|
12058
|
-
}, [index, bffEventReport, data, isLoad]);
|
12030
|
+
setIsLoadFinish(true);
|
12031
|
+
}, []);
|
12059
12032
|
const handleClickVideo = React.useCallback((type) => () => {
|
12060
|
-
var _a, _b, _c, _d, _e
|
12061
|
-
if (!
|
12033
|
+
var _a, _b, _c, _d, _e;
|
12034
|
+
if (!isLoadFinish)
|
12062
12035
|
return;
|
12063
|
-
|
12064
|
-
((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.duration) !== null && _b !== void 0 ? _b : 0).toFixed(2);
|
12065
|
-
((_d = (_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.currentTime) !== null && _d !== void 0 ? _d : 0).toFixed(2);
|
12066
|
-
const isPause = (_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.paused;
|
12036
|
+
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
12067
12037
|
switch (type) {
|
12068
12038
|
case 'start':
|
12069
12039
|
if (!isPause)
|
12070
12040
|
return;
|
12071
|
-
(
|
12041
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.play();
|
12072
12042
|
setIsPauseVideo(false);
|
12073
12043
|
break;
|
12074
12044
|
case 'pause':
|
12075
12045
|
if (isPause)
|
12076
12046
|
return;
|
12077
|
-
(
|
12047
|
+
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.pause();
|
12078
12048
|
setIsPauseVideo(true);
|
12079
12049
|
break;
|
12080
12050
|
default:
|
12081
12051
|
if (isPause) {
|
12082
|
-
(
|
12052
|
+
(_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.play();
|
12083
12053
|
}
|
12084
12054
|
else {
|
12085
|
-
(
|
12055
|
+
(_e = videoRef.current) === null || _e === void 0 ? void 0 : _e.pause();
|
12086
12056
|
}
|
12087
12057
|
setIsPauseVideo(!isPause);
|
12088
12058
|
break;
|
12089
12059
|
}
|
12090
|
-
}, [
|
12060
|
+
}, [isLoadFinish]);
|
12091
12061
|
const onPause = React.useCallback(() => {
|
12092
12062
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
12093
12063
|
const item = data[index];
|
@@ -12113,16 +12083,10 @@ Made in Italy` })));
|
|
12113
12083
|
}
|
12114
12084
|
}, [data, index, bffEventReport]);
|
12115
12085
|
React.useEffect(() => {
|
12116
|
-
var _a, _b
|
12117
|
-
if (data.length <= 0)
|
12118
|
-
return;
|
12086
|
+
var _a, _b;
|
12119
12087
|
if (!videoRef.current)
|
12120
12088
|
return;
|
12121
12089
|
setIsPauseVideo(false);
|
12122
|
-
if (!isActive) {
|
12123
|
-
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
|
12124
|
-
return;
|
12125
|
-
}
|
12126
12090
|
if (!videoRef.current.src) {
|
12127
12091
|
const videoSrc = rec.video.url;
|
12128
12092
|
// if (videoSrc.includes('.m3u8')) {
|
@@ -12142,25 +12106,33 @@ Made in Italy` })));
|
|
12142
12106
|
videoRef.current.setAttribute('x5-playsinline', 'true');
|
12143
12107
|
videoRef.current.setAttribute('webkit-playsinline', 'true');
|
12144
12108
|
}
|
12145
|
-
|
12146
|
-
|
12147
|
-
}
|
12148
|
-
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('canplay', handleLoadedMetadata);
|
12149
|
-
(_c = videoRef.current) === null || _c === void 0 ? void 0 : _c.addEventListener('playing', handlePlaying);
|
12109
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('canplay', handleLoadedMetadata);
|
12110
|
+
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.addEventListener('playing', handlePlaying);
|
12150
12111
|
return () => {
|
12151
12112
|
var _a, _b;
|
12152
12113
|
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('canplay', handleLoadedMetadata);
|
12153
12114
|
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('playing', handlePlaying);
|
12154
12115
|
};
|
12155
|
-
}, [
|
12116
|
+
}, [handleLoadedMetadata, handlePlaying, rec.video]);
|
12117
|
+
React.useEffect(() => {
|
12118
|
+
var _a;
|
12119
|
+
if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
|
12120
|
+
return;
|
12121
|
+
if (isActive) {
|
12122
|
+
videoRef.current.play();
|
12123
|
+
}
|
12124
|
+
else {
|
12125
|
+
(_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.pause();
|
12126
|
+
}
|
12127
|
+
}, [isActive, isLoadFinish]);
|
12156
12128
|
/*
|
12157
12129
|
打开/关闭hashtag暂停/播放视频
|
12158
12130
|
*/
|
12159
12131
|
React.useEffect(() => {
|
12160
12132
|
var _a, _b, _c;
|
12161
|
-
|
12162
|
-
if (!isActive)
|
12133
|
+
if (!isActive || !(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
|
12163
12134
|
return;
|
12135
|
+
const isPause = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
|
12164
12136
|
if (!isPause && openHashtag) {
|
12165
12137
|
(_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.pause();
|
12166
12138
|
}
|
@@ -12181,11 +12153,11 @@ Made in Italy` })));
|
|
12181
12153
|
};
|
12182
12154
|
}, [handleClickVideo, isActive]);
|
12183
12155
|
const renderPoster = React.useMemo(() => {
|
12184
|
-
if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image)) {
|
12156
|
+
if (!(sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image) || isLoadFinish) {
|
12185
12157
|
return null;
|
12186
12158
|
}
|
12187
|
-
return (React.createElement("img", {
|
12188
|
-
}, [
|
12159
|
+
return (React.createElement("img", { style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', objectFit: 'cover' }, src: sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image }));
|
12160
|
+
}, [isLoadFinish, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.placeholder_image]);
|
12189
12161
|
React.useEffect(() => {
|
12190
12162
|
const handleBeforeUnload = () => {
|
12191
12163
|
var _a, _b;
|
@@ -12446,7 +12418,7 @@ Made in Italy` })));
|
|
12446
12418
|
* @Author: binruan@chatlabs.com
|
12447
12419
|
* @Date: 2023-12-26 16:11:34
|
12448
12420
|
* @LastEditors: binruan@chatlabs.com
|
12449
|
-
* @LastEditTime: 2024-04-
|
12421
|
+
* @LastEditTime: 2024-04-18 14:36:53
|
12450
12422
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\RenderCard.tsx
|
12451
12423
|
*
|
12452
12424
|
*/
|
@@ -12480,7 +12452,7 @@ Made in Italy` })));
|
|
12480
12452
|
const Component = withBindDataSource(t);
|
12481
12453
|
const defaulSetting = (_x = t === null || t === void 0 ? void 0 : t.extend) === null || _x === void 0 ? void 0 : _x.defaulSetting;
|
12482
12454
|
const isExternalLink = ((_0 = (_z = (_y = value === null || value === void 0 ? void 0 : value.item) === null || _y === void 0 ? void 0 : _y.event) === null || _z === void 0 ? void 0 : _z.onClick) === null || _0 === void 0 ? void 0 : _0.linkType) === 'externalLink';
|
12483
|
-
return (React.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_1 = value === null || value === void 0 ? void 0 : value.item) === null || _1 === void 0 ? void 0 : _1.style), { zIndex: 50, marginLeft: '20px', boxSizing: 'border-box' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_2 = value === null || value === void 0 ? void 0 : value.item) === null || _2 === void 0 ? void 0 : _2.textStyle), bindDatas: (_4 = (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.bindDatas) !== null && _4 !== void 0 ? _4 : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_5 = value === null || value === void 0 ? void 0 : value.item) === null || _5 === void 0 ? void 0 : _5.props, { event: ((_6 = value === null || value === void 0 ? void 0 : value.item) === null || _6 === void 0 ? void 0 : _6.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, key: value === null || value === void 0 ? void 0 : value.id, recData: rec, isExternalLink: isExternalLink, index: index })));
|
12455
|
+
return (React.createElement(Component, Object.assign({ style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_1 = value === null || value === void 0 ? void 0 : value.item) === null || _1 === void 0 ? void 0 : _1.style), { zIndex: 50, marginLeft: '20px', boxSizing: 'border-box', transform: 'translate3d(0px, 0px, 0px)' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_2 = value === null || value === void 0 ? void 0 : value.item) === null || _2 === void 0 ? void 0 : _2.textStyle), bindDatas: (_4 = (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.bindDatas) !== null && _4 !== void 0 ? _4 : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_5 = value === null || value === void 0 ? void 0 : value.item) === null || _5 === void 0 ? void 0 : _5.props, { event: ((_6 = value === null || value === void 0 ? void 0 : value.item) === null || _6 === void 0 ? void 0 : _6.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, key: value === null || value === void 0 ? void 0 : value.id, recData: rec, isExternalLink: isExternalLink, index: index })));
|
12484
12456
|
}
|
12485
12457
|
else {
|
12486
12458
|
return null;
|
@@ -12514,7 +12486,7 @@ Made in Italy` })));
|
|
12514
12486
|
* @Author: binruan@chatlabs.com
|
12515
12487
|
* @Date: 2024-01-15 19:03:09
|
12516
12488
|
* @LastEditors: binruan@chatlabs.com
|
12517
|
-
* @LastEditTime: 2024-04-18
|
12489
|
+
* @LastEditTime: 2024-04-18 16:49:34
|
12518
12490
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
|
12519
12491
|
*
|
12520
12492
|
*/
|
@@ -12715,9 +12687,7 @@ Made in Italy` })));
|
|
12715
12687
|
React.createElement("div", { className: 'clc-sxp-bottom-card' },
|
12716
12688
|
React.createElement(RenderCard$1, { rec: rec, index: index, tempMap: tempMap, resolver: resolver })),
|
12717
12689
|
React.createElement("div", null,
|
12718
|
-
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({}, descStyle
|
12719
|
-
// textShadow: globalConfig?.isOpenTextShadow ? '2px 2px 4px rgba(0, 0, 0, 0.5)' : 'none'
|
12720
|
-
), onChange: onExpandableChange }),
|
12690
|
+
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 }),
|
12721
12691
|
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.itemId) ? 'VIDEO' : null, rec: rec, hashTagStyle: hashTagStyle })))));
|
12722
12692
|
}
|
12723
12693
|
return null;
|