pb-sxp-ui 1.0.77 → 1.0.79
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 +240 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +118 -0
- package/dist/index.js +240 -59
- 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 +240 -59
- 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/PictureGroup/Picture.d.ts +1 -0
- package/es/core/components/SxpPageRender/PictureGroup/Picture.js +2 -2
- package/es/core/components/SxpPageRender/PictureGroup/index.js +9 -5
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +4 -3
- package/es/core/components/SxpPageRender/WaterFall/index.js +2 -1
- package/es/core/components/SxpPageRender/index.js +4 -1
- package/es/core/context/SxpDataSourceProvider.js +6 -0
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.d.ts +1 -0
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +2 -2
- package/lib/core/components/SxpPageRender/PictureGroup/index.js +8 -4
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +4 -3
- package/lib/core/components/SxpPageRender/WaterFall/index.js +2 -1
- package/lib/core/components/SxpPageRender/index.js +4 -1
- package/lib/core/context/SxpDataSourceProvider.js +6 -0
- package/package.json +1 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
import React, { useMemo } from 'react';
|
2
2
|
import FormatImage from '../FormatImage';
|
3
3
|
const Picture = (props) => {
|
4
|
-
const { src, height, imgUrlsPostConfig } = props;
|
4
|
+
const { src, height, imgUrlsPostConfig, onShowFirstImage } = props;
|
5
5
|
const blur = useMemo(() => {
|
6
6
|
return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2';
|
7
7
|
}, [imgUrlsPostConfig]);
|
@@ -26,7 +26,7 @@ const Picture = (props) => {
|
|
26
26
|
return isBgColor && (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor) ? { backgroundColor: imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor } : {};
|
27
27
|
}, [imgUrlsPostConfig, isBgColor]);
|
28
28
|
return (React.createElement("div", { style: Object.assign({ overflow: 'hidden', height, width: '100%', position: 'relative' }, bgStyle) },
|
29
|
-
(!blur || !isBgColor) && (React.createElement(FormatImage, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) })),
|
29
|
+
(!blur || !isBgColor) && (React.createElement(FormatImage, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle), onLoad: onShowFirstImage })),
|
30
30
|
blur && (React.createElement(FormatImage, { src: src, style: {
|
31
31
|
width: '100%',
|
32
32
|
height: '100%',
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { memo, useEffect, useRef, useState } from 'react';
|
1
|
+
import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
|
2
2
|
import { Autoplay, Pagination } from 'swiper/modules';
|
3
3
|
import { Swiper, SwiperSlide, useSwiperSlide } from 'swiper/react';
|
4
4
|
import Picture from './Picture';
|
@@ -20,13 +20,17 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd
|
|
20
20
|
}
|
21
21
|
}
|
22
22
|
else {
|
23
|
-
setIsLoad(true);
|
24
23
|
(ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.stop();
|
25
24
|
}
|
26
25
|
}, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
const showFirstImageFn = useCallback(() => {
|
27
|
+
if (!isLoad) {
|
28
|
+
setIsLoad(true);
|
29
|
+
}
|
30
|
+
}, [isLoad]);
|
31
|
+
return (React.createElement(Swiper, { ref: ref, defaultValue: 0, direction: 'horizontal', modules: [Pagination, Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, loop: true, autoplay: { delay: ((_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.delay) !== null && _a !== void 0 ? _a : 3) * 1000 } }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url, index) => {
|
32
|
+
return (React.createElement(SwiperSlide, { key: index },
|
33
|
+
React.createElement(Picture, { src: !isLoad && index > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
|
30
34
|
})));
|
31
35
|
};
|
32
36
|
export default memo(PictureGroup);
|
@@ -3,6 +3,7 @@ import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react'
|
|
3
3
|
import { useSxpDataSource } from '../../../../core/hooks';
|
4
4
|
import './WaterfallList.less';
|
5
5
|
import previewData from './preview.json';
|
6
|
+
import FormatImage from '../FormatImage';
|
6
7
|
const WaterfallFlowItem = (props) => {
|
7
8
|
const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
|
8
9
|
const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
|
@@ -66,7 +67,7 @@ const WaterfallFlowItem = (props) => {
|
|
66
67
|
}
|
67
68
|
}, [rec]);
|
68
69
|
useEffect(() => {
|
69
|
-
if (imgDom.current === null || src === ''
|
70
|
+
if (imgDom.current === null || src === '') {
|
70
71
|
return;
|
71
72
|
}
|
72
73
|
const img = new Image();
|
@@ -83,7 +84,7 @@ const WaterfallFlowItem = (props) => {
|
|
83
84
|
});
|
84
85
|
setIsLoading(true);
|
85
86
|
};
|
86
|
-
imgDom.current.
|
87
|
+
imgDom.current.setSrc(img.src);
|
87
88
|
}, [src, showVideo, firstFrameSrc, isImgShow]);
|
88
89
|
useEffect(() => {
|
89
90
|
const height = imgInfo.height * (unitWidth / imgInfo.width);
|
@@ -133,7 +134,7 @@ const WaterfallFlowItem = (props) => {
|
|
133
134
|
showVideo && (React.createElement("div", { style: { display: 'none' } },
|
134
135
|
React.createElement("video", { ref: videoDom, src: src, crossOrigin: 'anonymous', className: 'waterFallList-content-listItem-picture-img' }),
|
135
136
|
React.createElement("canvas", { ref: canvasRef }))),
|
136
|
-
React.createElement(
|
137
|
+
React.createElement(FormatImage, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', ref: imgDom })),
|
137
138
|
React.createElement("div", { className: 'waterFallList-content-listItem-info' },
|
138
139
|
React.createElement("div", { className: `${'waterFallList-content-listItem-info-title'} ${priceText ? 'waterFallList-content-listItem-info-nowrap' : ''}`, style: Object.assign({}, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title) }, title && title),
|
139
140
|
React.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price }, priceText))));
|
@@ -5,6 +5,7 @@ import { isEqual } from 'lodash';
|
|
5
5
|
import Navbar from '../Navbar';
|
6
6
|
import WaterfallList from './WaterfallList';
|
7
7
|
import left from './left.png';
|
8
|
+
import List from './List';
|
8
9
|
import { useSxpDataSource } from '../../../../core/hooks';
|
9
10
|
const WaterFall = (props) => {
|
10
11
|
var _a;
|
@@ -96,6 +97,6 @@ const WaterFall = (props) => {
|
|
96
97
|
display: openHashtag ? 'block' : 'none'
|
97
98
|
} },
|
98
99
|
React.createElement(Navbar, { icon: left, styles: { top: '32px' }, textStyle: (_a = props === null || props === void 0 ? void 0 : props.textStyles) === null || _a === void 0 ? void 0 : _a.hashTagTitle, onClose: handleClose }),
|
99
|
-
React.createElement(WaterfallList, Object.assign({ reportTagsView: reportTagsView }, props))), modalEleRef.current);
|
100
|
+
(props === null || props === void 0 ? void 0 : props.isWaterfallFlow) ? (React.createElement(WaterfallList, Object.assign({ reportTagsView: reportTagsView }, props))) : (React.createElement(List, Object.assign({ reportTagsView: reportTagsView }, props)))), modalEleRef.current);
|
100
101
|
};
|
101
102
|
export default memo(WaterFall);
|
@@ -41,6 +41,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
41
41
|
return data.length > 0 && !loading && getFeUserId();
|
42
42
|
}, [data, loading]);
|
43
43
|
const handleH5EnterLink = useCallback(() => {
|
44
|
+
var _a, _b;
|
44
45
|
if (data.length <= 0) {
|
45
46
|
return;
|
46
47
|
}
|
@@ -61,7 +62,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
61
62
|
utmId: getVal('utm_id'),
|
62
63
|
utmContent: getVal('utm_content'),
|
63
64
|
enterTime: `${Date.now()}`,
|
64
|
-
requestId: null
|
65
|
+
requestId: null,
|
66
|
+
enterUrl: (_b = (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : '',
|
67
|
+
clSource: getVal('cl_sourc')
|
65
68
|
}
|
66
69
|
});
|
67
70
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
@@ -206,6 +206,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
206
206
|
setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
|
207
207
|
})
|
208
208
|
.finally(() => {
|
209
|
+
bffEventReport({
|
210
|
+
eventInfo: {
|
211
|
+
eventSubject: 'apiRequest',
|
212
|
+
eventDescription: 'api request succeed'
|
213
|
+
}
|
214
|
+
});
|
209
215
|
setLoading(false);
|
210
216
|
isInit.current = true;
|
211
217
|
});
|
@@ -4,7 +4,7 @@ const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importStar(require("react"));
|
5
5
|
const FormatImage_1 = tslib_1.__importDefault(require("../FormatImage"));
|
6
6
|
const Picture = (props) => {
|
7
|
-
const { src, height, imgUrlsPostConfig } = props;
|
7
|
+
const { src, height, imgUrlsPostConfig, onShowFirstImage } = props;
|
8
8
|
const blur = (0, react_1.useMemo)(() => {
|
9
9
|
return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2';
|
10
10
|
}, [imgUrlsPostConfig]);
|
@@ -29,7 +29,7 @@ const Picture = (props) => {
|
|
29
29
|
return isBgColor && (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor) ? { backgroundColor: imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor } : {};
|
30
30
|
}, [imgUrlsPostConfig, isBgColor]);
|
31
31
|
return (react_1.default.createElement("div", { style: Object.assign({ overflow: 'hidden', height, width: '100%', position: 'relative' }, bgStyle) },
|
32
|
-
(!blur || !isBgColor) && (react_1.default.createElement(FormatImage_1.default, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) })),
|
32
|
+
(!blur || !isBgColor) && (react_1.default.createElement(FormatImage_1.default, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle), onLoad: onShowFirstImage })),
|
33
33
|
blur && (react_1.default.createElement(FormatImage_1.default, { src: src, style: {
|
34
34
|
width: '100%',
|
35
35
|
height: '100%',
|
@@ -23,13 +23,17 @@ const PictureGroup = ({ imgUrls, width, height, rec, index, onReportViewImageEnd
|
|
23
23
|
}
|
24
24
|
}
|
25
25
|
else {
|
26
|
-
setIsLoad(true);
|
27
26
|
(ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.stop();
|
28
27
|
}
|
29
28
|
}, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
const showFirstImageFn = (0, react_1.useCallback)(() => {
|
30
|
+
if (!isLoad) {
|
31
|
+
setIsLoad(true);
|
32
|
+
}
|
33
|
+
}, [isLoad]);
|
34
|
+
return (react_1.default.createElement(react_2.Swiper, { ref: ref, defaultValue: 0, direction: 'horizontal', modules: [modules_1.Pagination, modules_1.Autoplay], pagination: { clickable: true, bulletActiveClass: 'swipe-item-active-bullet' }, height: height, loop: true, autoplay: { delay: ((_a = imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.delay) !== null && _a !== void 0 ? _a : 3) * 1000 } }, imgUrls === null || imgUrls === void 0 ? void 0 : imgUrls.map((url, index) => {
|
35
|
+
return (react_1.default.createElement(react_2.SwiperSlide, { key: index },
|
36
|
+
react_1.default.createElement(Picture_1.default, { src: !isLoad && index > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
|
33
37
|
})));
|
34
38
|
};
|
35
39
|
exports.default = (0, react_1.memo)(PictureGroup);
|
@@ -5,6 +5,7 @@ const react_1 = tslib_1.__importStar(require("react"));
|
|
5
5
|
const hooks_1 = require("../../../../core/hooks");
|
6
6
|
require("./WaterfallList.less");
|
7
7
|
const preview_json_1 = tslib_1.__importDefault(require("./preview.json"));
|
8
|
+
const FormatImage_1 = tslib_1.__importDefault(require("../FormatImage"));
|
8
9
|
const WaterfallFlowItem = (props) => {
|
9
10
|
const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
|
10
11
|
const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = (0, hooks_1.useSxpDataSource)();
|
@@ -68,7 +69,7 @@ const WaterfallFlowItem = (props) => {
|
|
68
69
|
}
|
69
70
|
}, [rec]);
|
70
71
|
(0, react_1.useEffect)(() => {
|
71
|
-
if (imgDom.current === null || src === ''
|
72
|
+
if (imgDom.current === null || src === '') {
|
72
73
|
return;
|
73
74
|
}
|
74
75
|
const img = new Image();
|
@@ -85,7 +86,7 @@ const WaterfallFlowItem = (props) => {
|
|
85
86
|
});
|
86
87
|
setIsLoading(true);
|
87
88
|
};
|
88
|
-
imgDom.current.
|
89
|
+
imgDom.current.setSrc(img.src);
|
89
90
|
}, [src, showVideo, firstFrameSrc, isImgShow]);
|
90
91
|
(0, react_1.useEffect)(() => {
|
91
92
|
const height = imgInfo.height * (unitWidth / imgInfo.width);
|
@@ -135,7 +136,7 @@ const WaterfallFlowItem = (props) => {
|
|
135
136
|
showVideo && (react_1.default.createElement("div", { style: { display: 'none' } },
|
136
137
|
react_1.default.createElement("video", { ref: videoDom, src: src, crossOrigin: 'anonymous', className: 'waterFallList-content-listItem-picture-img' }),
|
137
138
|
react_1.default.createElement("canvas", { ref: canvasRef }))),
|
138
|
-
react_1.default.createElement(
|
139
|
+
react_1.default.createElement(FormatImage_1.default, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', ref: imgDom })),
|
139
140
|
react_1.default.createElement("div", { className: 'waterFallList-content-listItem-info' },
|
140
141
|
react_1.default.createElement("div", { className: `${'waterFallList-content-listItem-info-title'} ${priceText ? 'waterFallList-content-listItem-info-nowrap' : ''}`, style: Object.assign({}, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title) }, title && title),
|
141
142
|
react_1.default.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price }, priceText))));
|
@@ -8,6 +8,7 @@ const lodash_1 = require("lodash");
|
|
8
8
|
const Navbar_1 = tslib_1.__importDefault(require("../Navbar"));
|
9
9
|
const WaterfallList_1 = tslib_1.__importDefault(require("./WaterfallList"));
|
10
10
|
const left_png_1 = tslib_1.__importDefault(require("./left.png"));
|
11
|
+
const List_1 = tslib_1.__importDefault(require("./List"));
|
11
12
|
const hooks_1 = require("../../../../core/hooks");
|
12
13
|
const WaterFall = (props) => {
|
13
14
|
var _a;
|
@@ -99,6 +100,6 @@ const WaterFall = (props) => {
|
|
99
100
|
display: openHashtag ? 'block' : 'none'
|
100
101
|
} },
|
101
102
|
react_1.default.createElement(Navbar_1.default, { icon: left_png_1.default, styles: { top: '32px' }, textStyle: (_a = props === null || props === void 0 ? void 0 : props.textStyles) === null || _a === void 0 ? void 0 : _a.hashTagTitle, onClose: handleClose }),
|
102
|
-
react_1.default.createElement(WaterfallList_1.default, Object.assign({ reportTagsView: reportTagsView }, props))), modalEleRef.current);
|
103
|
+
(props === null || props === void 0 ? void 0 : props.isWaterfallFlow) ? (react_1.default.createElement(WaterfallList_1.default, Object.assign({ reportTagsView: reportTagsView }, props))) : (react_1.default.createElement(List_1.default, Object.assign({ reportTagsView: reportTagsView }, props)))), modalEleRef.current);
|
103
104
|
};
|
104
105
|
exports.default = (0, react_1.memo)(WaterFall);
|
@@ -44,6 +44,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
44
44
|
return data.length > 0 && !loading && (0, localStore_1.getFeUserId)();
|
45
45
|
}, [data, loading]);
|
46
46
|
const handleH5EnterLink = (0, react_1.useCallback)(() => {
|
47
|
+
var _a, _b;
|
47
48
|
if (data.length <= 0) {
|
48
49
|
return;
|
49
50
|
}
|
@@ -64,7 +65,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
64
65
|
utmId: getVal('utm_id'),
|
65
66
|
utmContent: getVal('utm_content'),
|
66
67
|
enterTime: `${Date.now()}`,
|
67
|
-
requestId: null
|
68
|
+
requestId: null,
|
69
|
+
enterUrl: (_b = (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.href) !== null && _b !== void 0 ? _b : '',
|
70
|
+
clSource: getVal('cl_sourc')
|
68
71
|
}
|
69
72
|
});
|
70
73
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
@@ -209,6 +209,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
209
209
|
setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
|
210
210
|
})
|
211
211
|
.finally(() => {
|
212
|
+
bffEventReport({
|
213
|
+
eventInfo: {
|
214
|
+
eventSubject: 'apiRequest',
|
215
|
+
eventDescription: 'api request succeed'
|
216
|
+
}
|
217
|
+
});
|
212
218
|
setLoading(false);
|
213
219
|
isInit.current = true;
|
214
220
|
});
|