pb-sxp-ui 1.0.78 → 1.0.80
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 +430 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +187 -1
- package/dist/index.js +430 -60
- 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 +430 -60
- 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 +52 -37
- package/es/core/components/SxpPageRender/WaterFall/index.js +3 -2
- package/es/core/components/SxpPageRender/index.js +1 -21
- package/es/core/context/SxpDataSourceProvider.js +30 -0
- package/es/materials/sxp/HashTag/index.d.ts +2 -0
- package/es/materials/sxp/HashTag/settingRender.d.ts +15 -1
- package/es/materials/sxp/HashTag/settingRender.js +16 -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 +52 -37
- package/lib/core/components/SxpPageRender/WaterFall/index.js +3 -2
- package/lib/core/components/SxpPageRender/index.js +1 -21
- package/lib/core/context/SxpDataSourceProvider.js +30 -0
- package/lib/materials/sxp/HashTag/index.d.ts +2 -0
- package/lib/materials/sxp/HashTag/settingRender.d.ts +15 -1
- package/lib/materials/sxp/HashTag/settingRender.js +16 -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);
|
@@ -2,8 +2,10 @@ import { __rest } from "tslib";
|
|
2
2
|
import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
3
3
|
import { useSxpDataSource } from '../../../../core/hooks';
|
4
4
|
import './WaterfallList.less';
|
5
|
+
import previewData from './preview.json';
|
6
|
+
import FormatImage from '../FormatImage';
|
5
7
|
const WaterfallFlowItem = (props) => {
|
6
|
-
const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles,
|
8
|
+
const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
|
7
9
|
const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
|
8
10
|
const [showVideo, setShowVideo] = useState(false);
|
9
11
|
const [isLoading, setIsLoading] = useState(false);
|
@@ -12,23 +14,20 @@ const WaterfallFlowItem = (props) => {
|
|
12
14
|
width: 1
|
13
15
|
});
|
14
16
|
const imgDom = useRef(null);
|
17
|
+
const ref = useRef(null);
|
15
18
|
const videoDom = useRef(null);
|
16
19
|
const canvasRef = useRef(null);
|
17
20
|
const [firstFrameSrc, setFirstFrameSrc] = useState('');
|
18
21
|
const src = useMemo(() => {
|
19
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
20
23
|
if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) {
|
21
24
|
return (_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.cover;
|
22
25
|
}
|
23
|
-
else if ((_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.
|
24
|
-
|
25
|
-
return (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.url;
|
26
|
+
else if ((_d = (_c = rec === null || rec === void 0 ? void 0 : rec.video) === null || _c === void 0 ? void 0 : _c.imgUrls) === null || _d === void 0 ? void 0 : _d.length) {
|
27
|
+
return (_f = (_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.imgUrls) === null || _f === void 0 ? void 0 : _f[0];
|
26
28
|
}
|
27
|
-
else if ((
|
28
|
-
return (
|
29
|
-
}
|
30
|
-
else if ((_k = (_j = rec === null || rec === void 0 ? void 0 : rec.product) === null || _j === void 0 ? void 0 : _j.homePage) === null || _k === void 0 ? void 0 : _k.length) {
|
31
|
-
return (_m = (_l = rec === null || rec === void 0 ? void 0 : rec.product) === null || _l === void 0 ? void 0 : _l.homePage) === null || _m === void 0 ? void 0 : _m[0];
|
29
|
+
else if ((_h = (_g = rec === null || rec === void 0 ? void 0 : rec.product) === null || _g === void 0 ? void 0 : _g.homePage) === null || _h === void 0 ? void 0 : _h.length) {
|
30
|
+
return (_k = (_j = rec === null || rec === void 0 ? void 0 : rec.product) === null || _j === void 0 ? void 0 : _j.homePage) === null || _k === void 0 ? void 0 : _k[0];
|
32
31
|
}
|
33
32
|
else {
|
34
33
|
return (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) || '';
|
@@ -68,7 +67,7 @@ const WaterfallFlowItem = (props) => {
|
|
68
67
|
}
|
69
68
|
}, [rec]);
|
70
69
|
useEffect(() => {
|
71
|
-
if (imgDom.current === null || src === ''
|
70
|
+
if (imgDom.current === null || src === '') {
|
72
71
|
return;
|
73
72
|
}
|
74
73
|
const img = new Image();
|
@@ -85,14 +84,14 @@ const WaterfallFlowItem = (props) => {
|
|
85
84
|
});
|
86
85
|
setIsLoading(true);
|
87
86
|
};
|
88
|
-
imgDom.current.
|
87
|
+
imgDom.current.setSrc(img.src);
|
89
88
|
}, [src, showVideo, firstFrameSrc, isImgShow]);
|
90
89
|
useEffect(() => {
|
91
90
|
const height = imgInfo.height * (unitWidth / imgInfo.width);
|
92
91
|
if (isLoading) {
|
93
|
-
sizeChange(height + 76, index);
|
92
|
+
sizeChange(height + 76 + space, index);
|
94
93
|
}
|
95
|
-
}, [imgInfo, index, unitWidth, isLoading]);
|
94
|
+
}, [imgInfo, index, unitWidth, isLoading, space]);
|
96
95
|
const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
|
97
96
|
const aspectRatio = videoWidth / videoHeight;
|
98
97
|
const targetHeight = targetWidth / aspectRatio;
|
@@ -130,22 +129,20 @@ const WaterfallFlowItem = (props) => {
|
|
130
129
|
setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(false);
|
131
130
|
}, 0);
|
132
131
|
};
|
133
|
-
return (React.createElement("div", { style: Object.assign({}, style), className: 'waterFallList-content-listItem', key: index, onClick: handleClickToDetail },
|
132
|
+
return (React.createElement("div", { ref: ref, style: Object.assign({}, style), className: 'waterFallList-content-listItem', key: index, onClick: handleClickToDetail },
|
134
133
|
React.createElement("div", { className: 'waterFallList-content-listItem-picture' },
|
135
134
|
showVideo && (React.createElement("div", { style: { display: 'none' } },
|
136
135
|
React.createElement("video", { ref: videoDom, src: src, crossOrigin: 'anonymous', className: 'waterFallList-content-listItem-picture-img' }),
|
137
136
|
React.createElement("canvas", { ref: canvasRef }))),
|
138
|
-
React.createElement(
|
139
|
-
visibility: isLoading ? 'visible' : 'hidden'
|
140
|
-
} })),
|
137
|
+
React.createElement(FormatImage, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', ref: imgDom })),
|
141
138
|
React.createElement("div", { className: 'waterFallList-content-listItem-info' },
|
142
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),
|
143
140
|
React.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price }, priceText))));
|
144
141
|
};
|
145
142
|
export default function WaterfallList(_a) {
|
146
|
-
var _b, _c, _d, _e, _f, _g, _h;
|
143
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
147
144
|
var { reportTagsView } = _a, props = __rest(_a, ["reportTagsView"]);
|
148
|
-
const { waterFallData, getRecommendVideos, loadingImage } = useSxpDataSource();
|
145
|
+
const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
|
149
146
|
const scrollParent = useRef(null);
|
150
147
|
const [scrollTop, setScrollTop] = useState(0);
|
151
148
|
const [data, setData] = useState();
|
@@ -155,6 +152,7 @@ export default function WaterfallList(_a) {
|
|
155
152
|
const heightList = [170, 230, 300];
|
156
153
|
const [isLoadingData, setIsLoadingData] = useState(false);
|
157
154
|
const [list, setList] = useState([]);
|
155
|
+
const buttonRef = useRef();
|
158
156
|
const createRandomNum = useCallback((min, max) => {
|
159
157
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
160
158
|
}, []);
|
@@ -238,19 +236,28 @@ export default function WaterfallList(_a) {
|
|
238
236
|
styleListRef.current = getStyleList();
|
239
237
|
}, [unitWidth, rowsNum, list]);
|
240
238
|
useEffect(() => {
|
239
|
+
var _a, _b;
|
241
240
|
setIsLoadingData(true);
|
242
241
|
waterFallData &&
|
243
242
|
(getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
|
244
243
|
hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
|
245
244
|
'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
|
246
|
-
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
|
245
|
+
'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
|
246
|
+
defaultSize: hashTagSize,
|
247
|
+
maxSize: hashTagSize
|
247
248
|
}).then((res) => {
|
248
249
|
var _a, _b;
|
249
250
|
setData(res);
|
250
251
|
setList((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => (item === null || item === void 0 ? void 0 : item.video) !== null || (item === null || item === void 0 ? void 0 : item.product) !== null)) !== null && _b !== void 0 ? _b : []);
|
251
252
|
setIsLoadingData(false);
|
252
253
|
}));
|
253
|
-
|
254
|
+
if (isOpenHashTag) {
|
255
|
+
const res = previewData;
|
256
|
+
setData(res);
|
257
|
+
setList((_b = (_a = res === null || res === void 0 ? void 0 : res.recList) === null || _a === void 0 ? void 0 : _a.filter((item) => (item === null || item === void 0 ? void 0 : item.video) !== null || (item === null || item === void 0 ? void 0 : item.product) !== null)) !== null && _b !== void 0 ? _b : []);
|
258
|
+
setIsLoadingData(false);
|
259
|
+
}
|
260
|
+
}, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
|
254
261
|
const onResize = useCallback(() => {
|
255
262
|
if (waterfallFlowDom.current === null) {
|
256
263
|
return;
|
@@ -270,7 +277,7 @@ export default function WaterfallList(_a) {
|
|
270
277
|
return () => {
|
271
278
|
resizeObserver.disconnect();
|
272
279
|
};
|
273
|
-
}, []);
|
280
|
+
}, [onResize]);
|
274
281
|
const loadMoreData = useCallback(() => {
|
275
282
|
setIsLoadingData(true);
|
276
283
|
waterFallData &&
|
@@ -302,18 +309,26 @@ export default function WaterfallList(_a) {
|
|
302
309
|
window.location.href = (_b = data === null || data === void 0 ? void 0 : data.tag) === null || _b === void 0 ? void 0 : _b.link;
|
303
310
|
}
|
304
311
|
};
|
305
|
-
return (React.createElement(React.Fragment, null,
|
306
|
-
React.createElement("
|
307
|
-
|
308
|
-
|
309
|
-
React.createElement("div", { className: 'waterFallList-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
312
|
+
return (React.createElement(React.Fragment, null, isLoadingData ? (React.createElement("div", { style: { height: '100%', width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' } },
|
313
|
+
React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement("div", { className: 'waterFallList', ref: waterfallFlowDom },
|
314
|
+
React.createElement("div", { className: 'waterFallList-scroll', ref: scrollParent },
|
315
|
+
React.createElement("div", { className: 'waterFallList-info', style: (_b = props === null || props === void 0 ? void 0 : props.textStyles) === null || _b === void 0 ? void 0 : _b.hashTagDesc }, (_c = data === null || data === void 0 ? void 0 : data.tag) === null || _c === void 0 ? void 0 : _c.info),
|
316
|
+
React.createElement("div", { hidden: !((_d = data === null || data === void 0 ? void 0 : data.tag) === null || _d === void 0 ? void 0 : _d.link), className: 'waterFallList-collection', style: Object.assign({}, (_e = props === null || props === void 0 ? void 0 : props.textStyles) === null || _e === void 0 ? void 0 : _e.hashTagLink), onClick: handleClickLink }, ((_f = data === null || data === void 0 ? void 0 : data.tag) === null || _f === void 0 ? void 0 : _f.linkTitle) || 'Shop the collection'),
|
317
|
+
React.createElement("div", { className: 'waterFallList-content' }, list === null || list === void 0 ? void 0 :
|
318
|
+
list.map((item, ind) => {
|
319
|
+
var _a;
|
320
|
+
return (React.createElement(WaterfallFlowItem, Object.assign({ key: ind, index: ind, rec: item, list: list, showBorder: scrollTop + ((_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.clientHeight), style: styleList[ind], sizeChange: onSizeChange, unitWidth: unitWidth, reportTagsView: reportTagsView }, props)));
|
321
|
+
}),
|
322
|
+
React.createElement("div", { hidden: !((_g = data === null || data === void 0 ? void 0 : data.tag) === null || _g === void 0 ? void 0 : _g.link), style: {
|
323
|
+
position: 'absolute',
|
324
|
+
width: '100%',
|
325
|
+
transform: `translate(0px,${(_m = ((_j = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current[((_h = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current) === null || _h === void 0 ? void 0 : _h.length) - 1]) === null || _j === void 0 ? void 0 : _j.top) +
|
326
|
+
((_l = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current[((_k = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current) === null || _k === void 0 ? void 0 : _k.length) - 1]) === null || _l === void 0 ? void 0 : _l.height)) !== null && _m !== void 0 ? _m : 0}px)`,
|
327
|
+
height: ((_o = data === null || data === void 0 ? void 0 : data.tag) === null || _o === void 0 ? void 0 : _o.link)
|
328
|
+
? ((_p = buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) === null || _p === void 0 ? void 0 : _p.offsetHeight) || ((_q = props === null || props === void 0 ? void 0 : props.buttonBgStyle) === null || _q === void 0 ? void 0 : _q.height) || '100px'
|
329
|
+
: 0
|
330
|
+
} }))),
|
331
|
+
React.createElement("div", { className: 'waterFallList-bottom', hidden: !((_r = data === null || data === void 0 ? void 0 : data.tag) === null || _r === void 0 ? void 0 : _r.link), style: props === null || props === void 0 ? void 0 : props.buttonBgStyle }),
|
332
|
+
React.createElement("div", { ref: buttonRef, hidden: !((_s = data === null || data === void 0 ? void 0 : data.tag) === null || _s === void 0 ? void 0 : _s.link), className: 'waterFallList-btn-wrap', style: Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props.buttonBgStyle), { height: 'auto', backgroundColor: 'transparent' }) },
|
333
|
+
React.createElement("button", { className: 'waterFallList-btn', style: props === null || props === void 0 ? void 0 : props.buttonStyle, onClick: handleClickLink }, ((_t = data === null || data === void 0 ? void 0 : data.tag) === null || _t === void 0 ? void 0 : _t.linkTitle) || 'Shop the collection'))))));
|
319
334
|
}
|
@@ -3,8 +3,9 @@ import * as ReactDOM from 'react-dom';
|
|
3
3
|
import './index.less';
|
4
4
|
import { isEqual } from 'lodash';
|
5
5
|
import Navbar from '../Navbar';
|
6
|
-
import WaterfallList from './
|
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) === true || (props === null || props === void 0 ? void 0 : props.isWaterfallFlow) === undefined ? (React.createElement(List, Object.assign({ reportTagsView: reportTagsView }, props))) : (React.createElement(WaterfallList, Object.assign({ reportTagsView: reportTagsView }, props)))), modalEleRef.current);
|
100
101
|
};
|
101
102
|
export default memo(WaterFall);
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import React, { useMemo, useEffect, useState, useRef, useCallback } from 'react';
|
2
2
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
3
|
-
import qs from 'qs';
|
4
3
|
import ExpandableText from './ExpandableText';
|
5
4
|
import LikeButton from './LikeButton';
|
6
5
|
import VideoWidget from './VideoWidget';
|
@@ -45,30 +44,11 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
45
44
|
return;
|
46
45
|
}
|
47
46
|
initTime();
|
48
|
-
const queryString = location.search.slice(1);
|
49
|
-
const params = qs.parse(queryString.replace(/\+/g, '%2B'));
|
50
|
-
for (const key in params) {
|
51
|
-
params[key] = params[key].replace(/%2B/g, '+');
|
52
|
-
}
|
53
|
-
const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
|
54
|
-
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
55
|
-
eventInfo: {
|
56
|
-
eventSubject: 'h5LinkEnterFeed',
|
57
|
-
eventDescription: 'User enter h5 link',
|
58
|
-
utmSource: getVal('utm_source'),
|
59
|
-
utmMedium: getVal('utm_medium'),
|
60
|
-
utmCampaign: getVal('utm_campaign'),
|
61
|
-
utmId: getVal('utm_id'),
|
62
|
-
utmContent: getVal('utm_content'),
|
63
|
-
enterTime: `${Date.now()}`,
|
64
|
-
requestId: null
|
65
|
-
}
|
66
|
-
});
|
67
47
|
bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
|
68
48
|
eventName: 'PageView'
|
69
49
|
});
|
70
50
|
setIsInit(true);
|
71
|
-
}, [
|
51
|
+
}, [data.length, bffFbReport]);
|
72
52
|
const initTime = () => {
|
73
53
|
curTime.current = new Date();
|
74
54
|
viewTime.current = new Date();
|
@@ -196,6 +196,30 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
196
196
|
eventInfo: Object.assign(Object.assign({}, eventInfo), { ctaId: (_h = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _h !== void 0 ? _h : '', ctaName: (_j = cta === null || cta === void 0 ? void 0 : cta.title) !== null && _j !== void 0 ? _j : '', contentTags: JSON.stringify(cta === null || cta === void 0 ? void 0 : cta.tags), position: position + '', contentId: (_l = (_k = rec === null || rec === void 0 ? void 0 : rec.video) === null || _k === void 0 ? void 0 : _k.itemId) !== null && _l !== void 0 ? _l : '', productId: isProd ? product === null || product === void 0 ? void 0 : product.itemId : '', traceInfo: (_m = cta === null || cta === void 0 ? void 0 : cta.traceInfo) !== null && _m !== void 0 ? _m : '', fromKName })
|
197
197
|
});
|
198
198
|
}, [bffEventReport, isFromHashtag]);
|
199
|
+
useEffect(() => {
|
200
|
+
var _a, _b;
|
201
|
+
const queryString = location.search.slice(1);
|
202
|
+
const params = qs.parse(queryString.replace(/\+/g, '%2B'));
|
203
|
+
for (const key in params) {
|
204
|
+
params[key] = params[key].replace(/%2B/g, '+');
|
205
|
+
}
|
206
|
+
const getVal = (key) => { var _a; return (_a = params[key]) !== null && _a !== void 0 ? _a : ''; };
|
207
|
+
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
208
|
+
eventInfo: {
|
209
|
+
eventSubject: 'h5LinkEnterFeed',
|
210
|
+
eventDescription: 'User enter h5 link',
|
211
|
+
utmSource: getVal('utm_source'),
|
212
|
+
utmMedium: getVal('utm_medium'),
|
213
|
+
utmCampaign: getVal('utm_campaign'),
|
214
|
+
utmId: getVal('utm_id'),
|
215
|
+
utmContent: getVal('utm_content'),
|
216
|
+
enterTime: `${Date.now()}`,
|
217
|
+
requestId: null,
|
218
|
+
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 : '',
|
219
|
+
clSource: getVal('cl_sourc')
|
220
|
+
}
|
221
|
+
});
|
222
|
+
}, []);
|
199
223
|
useEffect(() => {
|
200
224
|
setLoading(true);
|
201
225
|
bffGetTagList();
|
@@ -206,6 +230,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
|
|
206
230
|
setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
|
207
231
|
})
|
208
232
|
.finally(() => {
|
233
|
+
bffEventReport({
|
234
|
+
eventInfo: {
|
235
|
+
eventSubject: 'apiRequest',
|
236
|
+
eventDescription: 'api request succeed'
|
237
|
+
}
|
238
|
+
});
|
209
239
|
setLoading(false);
|
210
240
|
isInit.current = true;
|
211
241
|
});
|
@@ -4,8 +4,22 @@ declare const _default: ({
|
|
4
4
|
type: string;
|
5
5
|
label: string;
|
6
6
|
name: string[];
|
7
|
-
addonAfter: string;
|
8
7
|
}[];
|
8
|
+
} | {
|
9
|
+
title: string;
|
10
|
+
child: ({
|
11
|
+
type: string;
|
12
|
+
label: string;
|
13
|
+
name: string[];
|
14
|
+
addonAfter: string;
|
15
|
+
initialValue?: undefined;
|
16
|
+
} | {
|
17
|
+
type: string;
|
18
|
+
label: string;
|
19
|
+
name: string[];
|
20
|
+
initialValue: boolean;
|
21
|
+
addonAfter?: undefined;
|
22
|
+
})[];
|
9
23
|
} | {
|
10
24
|
title: string;
|
11
25
|
child: {
|
@@ -1,6 +1,16 @@
|
|
1
1
|
var _a, _b;
|
2
2
|
import { fontOptions } from '../defaultSetting';
|
3
3
|
export default [
|
4
|
+
{
|
5
|
+
title: 'Banner',
|
6
|
+
child: [
|
7
|
+
{
|
8
|
+
type: 'Switch',
|
9
|
+
label: 'Banner图开关',
|
10
|
+
name: ['props', 'showBanner']
|
11
|
+
}
|
12
|
+
]
|
13
|
+
},
|
4
14
|
{
|
5
15
|
title: '卡片样式',
|
6
16
|
child: [
|
@@ -9,6 +19,12 @@ export default [
|
|
9
19
|
label: '上下边距',
|
10
20
|
name: ['props', 'space'],
|
11
21
|
addonAfter: 'px'
|
22
|
+
},
|
23
|
+
{
|
24
|
+
type: 'Switch',
|
25
|
+
label: '固定宽高',
|
26
|
+
name: ['props', 'isWaterfallFlow'],
|
27
|
+
initialValue: true
|
12
28
|
}
|
13
29
|
]
|
14
30
|
},
|
@@ -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);
|