pb-sxp-ui 1.0.78 → 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.
Files changed (34) hide show
  1. package/dist/index.cjs +407 -38
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +187 -1
  4. package/dist/index.js +407 -38
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +3 -3
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +3 -3
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +407 -38
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +3 -3
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/components/SxpPageRender/PictureGroup/Picture.d.ts +1 -0
  15. package/es/core/components/SxpPageRender/PictureGroup/Picture.js +2 -2
  16. package/es/core/components/SxpPageRender/PictureGroup/index.js +9 -5
  17. package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +52 -37
  18. package/es/core/components/SxpPageRender/WaterFall/index.js +3 -2
  19. package/es/core/components/SxpPageRender/index.js +4 -1
  20. package/es/core/context/SxpDataSourceProvider.js +6 -0
  21. package/es/materials/sxp/HashTag/index.d.ts +2 -0
  22. package/es/materials/sxp/HashTag/settingRender.d.ts +7 -2
  23. package/es/materials/sxp/HashTag/settingRender.js +15 -0
  24. package/lib/core/components/SxpPageRender/PictureGroup/Picture.d.ts +1 -0
  25. package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +2 -2
  26. package/lib/core/components/SxpPageRender/PictureGroup/index.js +8 -4
  27. package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +52 -37
  28. package/lib/core/components/SxpPageRender/WaterFall/index.js +3 -2
  29. package/lib/core/components/SxpPageRender/index.js +4 -1
  30. package/lib/core/context/SxpDataSourceProvider.js +6 -0
  31. package/lib/materials/sxp/HashTag/index.d.ts +2 -0
  32. package/lib/materials/sxp/HashTag/settingRender.d.ts +7 -2
  33. package/lib/materials/sxp/HashTag/settingRender.js +15 -0
  34. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -627,6 +627,12 @@ const SxpDataSourceProvider = ({ render, dataSources, utmVal, enableReportEvent
627
627
  setCacheRtcList((_b = data === null || data === void 0 ? void 0 : data.recList) !== null && _b !== void 0 ? _b : []);
628
628
  })
629
629
  .finally(() => {
630
+ bffEventReport({
631
+ eventInfo: {
632
+ eventSubject: 'apiRequest',
633
+ eventDescription: 'api request succeed'
634
+ }
635
+ });
630
636
  setLoading(false);
631
637
  isInit.current = true;
632
638
  });
@@ -10338,19 +10344,29 @@ var _a, _b;
10338
10344
  *
10339
10345
  */
10340
10346
  var settingRender = [
10347
+ {
10348
+ title: 'Banner',
10349
+ child: [
10350
+ {
10351
+ type: 'Switch',
10352
+ label: 'Banner图开关',
10353
+ name: ['props', 'showBanner']
10354
+ }
10355
+ ]
10356
+ },
10341
10357
  {
10342
10358
  title: '卡片样式',
10343
10359
  child: [
10344
- // {
10345
- // type: 'Number',
10346
- // label: '文本行数',
10347
- // name: ['props', 'lineClamp']
10348
- // },
10349
10360
  {
10350
10361
  type: 'Number',
10351
10362
  label: '上下边距',
10352
10363
  name: ['props', 'space'],
10353
10364
  addonAfter: 'px'
10365
+ },
10366
+ {
10367
+ type: 'Switch',
10368
+ label: '固定宽高',
10369
+ name: ['props', 'isWaterfallFlow']
10354
10370
  }
10355
10371
  ]
10356
10372
  },
@@ -11819,6 +11835,374 @@ var previewData = {
11819
11835
  hashTag: hashTag
11820
11836
  };
11821
11837
 
11838
+ const WaterfallFlowItem$1 = (props) => {
11839
+ const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
11840
+ const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
11841
+ const [showVideo, setShowVideo] = useState(false);
11842
+ const [isLoading, setIsLoading] = useState(false);
11843
+ const [imgInfo, setImgInfo] = useState({
11844
+ height: 1,
11845
+ width: 1
11846
+ });
11847
+ const imgDom = useRef(null);
11848
+ const ref = useRef(null);
11849
+ const videoDom = useRef(null);
11850
+ const canvasRef = useRef(null);
11851
+ const [firstFrameSrc, setFirstFrameSrc] = useState('');
11852
+ const src = useMemo(() => {
11853
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
11854
+ if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.cover) {
11855
+ return (_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.cover;
11856
+ }
11857
+ 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) {
11858
+ 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];
11859
+ }
11860
+ 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) {
11861
+ 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];
11862
+ }
11863
+ else {
11864
+ return (sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) || '';
11865
+ }
11866
+ }, [rec, sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image]);
11867
+ const title = useMemo(() => {
11868
+ var _a, _b;
11869
+ return ((_a = rec === null || rec === void 0 ? void 0 : rec.product) === null || _a === void 0 ? void 0 : _a.title) || ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.title) || null;
11870
+ }, [rec]);
11871
+ /** 离父亲上边框的距离 */
11872
+ const top = useMemo(() => {
11873
+ var _a;
11874
+ const y = style.transform
11875
+ ? Number((_a = style.transform) === null || _a === void 0 ? void 0 : _a.substring(style.transform.indexOf(',', 0) + 1, style.transform.length - 3))
11876
+ : undefined;
11877
+ return y;
11878
+ }, [style]);
11879
+ /** 是否加载图片 */
11880
+ const isImgShow = useMemo(() => {
11881
+ if (top === undefined) {
11882
+ return false;
11883
+ }
11884
+ if (top <= showBorder) {
11885
+ return true;
11886
+ }
11887
+ else {
11888
+ return false;
11889
+ }
11890
+ }, [top, showBorder]);
11891
+ const priceText = useMemo(() => {
11892
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11893
+ if (((_a = rec === null || rec === void 0 ? void 0 : rec.product) === null || _a === void 0 ? void 0 : _a.currency) && ((_b = rec === null || rec === void 0 ? void 0 : rec.product) === null || _b === void 0 ? void 0 : _b.price)) {
11894
+ return `${(_f = (_e = (_d = (_c = rec === null || rec === void 0 ? void 0 : rec.product) === null || _c === void 0 ? void 0 : _c.currency) === null || _d === void 0 ? void 0 : _d.split('-')[1]) === null || _e === void 0 ? void 0 : _e.toUpperCase()) !== null && _f !== void 0 ? _f : ''}${(_j = (_h = (_g = rec === null || rec === void 0 ? void 0 : rec.product) === null || _g === void 0 ? void 0 : _g.price) === null || _h === void 0 ? void 0 : _h.toLocaleString('zh', {
11895
+ minimumFractionDigits: 0
11896
+ })) !== null && _j !== void 0 ? _j : ''}`;
11897
+ }
11898
+ else {
11899
+ return null;
11900
+ }
11901
+ }, [rec]);
11902
+ useEffect(() => {
11903
+ if (imgDom.current === null || src === '') {
11904
+ return;
11905
+ }
11906
+ const img = new Image();
11907
+ if (showVideo && firstFrameSrc) {
11908
+ img.src = firstFrameSrc;
11909
+ }
11910
+ else {
11911
+ img.src = src;
11912
+ }
11913
+ img.onload = () => {
11914
+ setImgInfo({
11915
+ height: img.height,
11916
+ width: img.width
11917
+ });
11918
+ setIsLoading(true);
11919
+ };
11920
+ imgDom.current.setSrc(img.src);
11921
+ }, [src, showVideo, firstFrameSrc, isImgShow]);
11922
+ useEffect(() => {
11923
+ // 通过宽度比例获取图片高度
11924
+ const height = imgInfo.height * (unitWidth / imgInfo.width);
11925
+ if (isLoading) {
11926
+ // 加40是因为下方文字部分高度为40,可以自己设置
11927
+ sizeChange(height + 76 + space, index);
11928
+ }
11929
+ }, [imgInfo, index, unitWidth, isLoading, space]); /* 增加sizeChange依赖项会导致在admin预览编辑时无限刷新 */
11930
+ const calculateHeightForWidth = (videoWidth, videoHeight, targetWidth) => {
11931
+ const aspectRatio = videoWidth / videoHeight;
11932
+ const targetHeight = targetWidth / aspectRatio;
11933
+ return targetHeight;
11934
+ };
11935
+ useEffect(() => {
11936
+ const video = videoDom === null || videoDom === void 0 ? void 0 : videoDom.current;
11937
+ if (video === null || src === '' || !showVideo) {
11938
+ return;
11939
+ }
11940
+ video.src = src;
11941
+ video.currentTime = 1;
11942
+ video.crossOrigin = 'anonymous';
11943
+ video.onloadeddata = () => {
11944
+ const canvas = canvasRef === null || canvasRef === void 0 ? void 0 : canvasRef.current;
11945
+ if (!canvas)
11946
+ return;
11947
+ const ctx = canvas.getContext('2d');
11948
+ const targetWidth = (window === null || window === void 0 ? void 0 : window.innerWidth) / 2;
11949
+ const targetHeight = calculateHeightForWidth(video.videoWidth, video.videoHeight, targetWidth);
11950
+ canvas.height = targetHeight;
11951
+ canvas.width = targetWidth;
11952
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
11953
+ setFirstFrameSrc(canvas.toDataURL());
11954
+ video.remove();
11955
+ canvas.remove();
11956
+ };
11957
+ }, [src, showVideo]);
11958
+ const handleClickToDetail = () => {
11959
+ reportTagsView();
11960
+ setRtcList === null || setRtcList === void 0 ? void 0 : setRtcList(list);
11961
+ setTimeout(() => {
11962
+ var _a;
11963
+ (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index, 0, false);
11964
+ setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(false);
11965
+ }, 0);
11966
+ };
11967
+ return (React.createElement("div", { ref: ref, style: Object.assign({}, style), className: 'waterFallList-content-listItem', key: index, onClick: handleClickToDetail },
11968
+ React.createElement("div", { className: 'waterFallList-content-listItem-picture' },
11969
+ showVideo && (React.createElement("div", { style: { display: 'none' } },
11970
+ React.createElement("video", { ref: videoDom, src: src, crossOrigin: 'anonymous', className: 'waterFallList-content-listItem-picture-img' }),
11971
+ React.createElement("canvas", { ref: canvasRef }))),
11972
+ React.createElement(FormatImage$1, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', ref: imgDom })),
11973
+ React.createElement("div", { className: 'waterFallList-content-listItem-info' },
11974
+ 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),
11975
+ React.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price }, priceText))));
11976
+ };
11977
+ function WaterfallList$1(_a) {
11978
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
11979
+ var { reportTagsView } = _a, props = __rest(_a, ["reportTagsView"]);
11980
+ const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
11981
+ /** 滚动的父元素 */
11982
+ const scrollParent = useRef(null);
11983
+ /** 向上滚动的距离 */
11984
+ const [scrollTop, setScrollTop] = useState(0);
11985
+ /** 数据列表 */
11986
+ const [data, setData] = useState();
11987
+ const waterfallFlowDom = useRef(null);
11988
+ /** 样式列表 */
11989
+ const [styleList, setStyleList] = useState([]);
11990
+ const styleListRef = useRef();
11991
+ /** 自定义骨架屏高度 */
11992
+ const heightList = [170, 230, 300];
11993
+ /** 到达底部 */
11994
+ const [isLoadingData, setIsLoadingData] = useState(false);
11995
+ const [list, setList] = useState([]);
11996
+ const buttonRef = useRef();
11997
+ /** 生成随机数 */
11998
+ const createRandomNum = useCallback((min, max) => {
11999
+ return Math.floor(Math.random() * (max - min + 1)) + min;
12000
+ }, []);
12001
+ const waterfallFlowListInfo = useRef([]);
12002
+ /** 当前容器信息 */
12003
+ const [frameInfo, setFrameInfoInfo] = useState({ width: 0 });
12004
+ /** 每行个数 */
12005
+ const rowsNum = useMemo(() => {
12006
+ const width = frameInfo.width || 0;
12007
+ if (width >= 1200) {
12008
+ return 6;
12009
+ }
12010
+ else if (width >= 768 && width <= 1199) {
12011
+ return 4;
12012
+ }
12013
+ else {
12014
+ return 2;
12015
+ }
12016
+ }, [frameInfo]);
12017
+ /** 每一个的宽度 */
12018
+ const unitWidth = useMemo(() => {
12019
+ return frameInfo.width / rowsNum - 2;
12020
+ }, [rowsNum, frameInfo]);
12021
+ /** 获取位置 */
12022
+ const getStyleList = useCallback(() => {
12023
+ var _a;
12024
+ const temporaryStyleList = (_a = styleListRef.current) !== null && _a !== void 0 ? _a : [];
12025
+ /** 目前最下一行的index */
12026
+ const bottomItemIndex = [];
12027
+ for (let i = 0; i < (list === null || list === void 0 ? void 0 : list.length); i++) {
12028
+ // 原本应对应的行数
12029
+ const currentRow = Math.floor(i / rowsNum);
12030
+ //
12031
+ const remainder = (i % rowsNum) + 1;
12032
+ // 最低item下标
12033
+ let minHeightInd = 0;
12034
+ // 最低高度
12035
+ let minHeight = 9999999999;
12036
+ // 寻找最低高度的下标
12037
+ if (currentRow === 0) {
12038
+ bottomItemIndex[i] = i;
12039
+ }
12040
+ else {
12041
+ for (let j = 0; j < bottomItemIndex.length; j++) {
12042
+ if (waterfallFlowListInfo.current[bottomItemIndex[j]].top +
12043
+ waterfallFlowListInfo.current[bottomItemIndex[j]].height <
12044
+ minHeight) {
12045
+ minHeightInd = j;
12046
+ minHeight =
12047
+ waterfallFlowListInfo.current[bottomItemIndex[j]].top +
12048
+ waterfallFlowListInfo.current[bottomItemIndex[j]].height;
12049
+ }
12050
+ }
12051
+ bottomItemIndex[minHeightInd] = i;
12052
+ }
12053
+ if (waterfallFlowListInfo.current[i] === undefined) {
12054
+ waterfallFlowListInfo.current[i] = {};
12055
+ }
12056
+ // 第一行特殊处理,一定是从左到右铺的
12057
+ if (currentRow === 0) {
12058
+ if (remainder === 1) {
12059
+ waterfallFlowListInfo.current[i].left = 0;
12060
+ }
12061
+ else {
12062
+ waterfallFlowListInfo.current[i].left = waterfallFlowListInfo.current[i - 1].left + unitWidth + 4;
12063
+ }
12064
+ waterfallFlowListInfo.current[i].top = 0;
12065
+ }
12066
+ // 剩下的行数,铺在当前最低高度下面
12067
+ else {
12068
+ waterfallFlowListInfo.current[i].left = waterfallFlowListInfo.current[minHeightInd].left;
12069
+ waterfallFlowListInfo.current[i].top = minHeight;
12070
+ }
12071
+ // 是否已经有高度,有高度使用已有高度,否则随机生成
12072
+ waterfallFlowListInfo.current[i].height =
12073
+ waterfallFlowListInfo.current[i].height || heightList[createRandomNum(0, 2)];
12074
+ temporaryStyleList[i] = {
12075
+ transform: `translate(${waterfallFlowListInfo.current[i].left}px,${waterfallFlowListInfo.current[i].top}px)`,
12076
+ width: `${unitWidth}px`,
12077
+ height: waterfallFlowListInfo.current[i].height
12078
+ };
12079
+ }
12080
+ setStyleList([...temporaryStyleList]);
12081
+ return [...temporaryStyleList];
12082
+ }, [unitWidth, rowsNum, heightList, createRandomNum, list]);
12083
+ /** 图片加载完更新高度 */
12084
+ const onSizeChange = useCallback((height, index) => {
12085
+ if (waterfallFlowListInfo.current[index] === undefined) {
12086
+ waterfallFlowListInfo.current[index] = {};
12087
+ }
12088
+ waterfallFlowListInfo.current[index].height = height;
12089
+ styleListRef.current = getStyleList();
12090
+ }, [getStyleList]);
12091
+ /** 大小、数量发生变化时触发 */
12092
+ useEffect(() => {
12093
+ styleListRef.current = getStyleList();
12094
+ }, [unitWidth, rowsNum, list]); /* 增加getStyleList依赖项会导致在admin预览编辑时无限刷新 */
12095
+ /** 初始化请求数据 */
12096
+ useEffect(() => {
12097
+ var _a, _b;
12098
+ setIsLoadingData(true);
12099
+ waterFallData &&
12100
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
12101
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
12102
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
12103
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType,
12104
+ defaultSize: hashTagSize,
12105
+ maxSize: hashTagSize
12106
+ }).then((res) => {
12107
+ var _a, _b;
12108
+ setData(res);
12109
+ 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 : []);
12110
+ setIsLoadingData(false);
12111
+ }));
12112
+ if (isOpenHashTag) {
12113
+ const res = previewData;
12114
+ setData(res);
12115
+ 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 : []);
12116
+ setIsLoadingData(false);
12117
+ }
12118
+ }, [waterFallData, getRecommendVideos, hashTagSize, isOpenHashTag]);
12119
+ const onResize = useCallback(() => {
12120
+ if (waterfallFlowDom.current === null) {
12121
+ return;
12122
+ }
12123
+ setFrameInfoInfo({
12124
+ width: waterfallFlowDom.current.getBoundingClientRect().width
12125
+ });
12126
+ }, []);
12127
+ /** 监听列表容器大小变化 */
12128
+ useEffect(() => {
12129
+ if (waterfallFlowDom.current === null) {
12130
+ return;
12131
+ }
12132
+ const resizeObserver = new ResizeObserver((entries) => {
12133
+ onResize();
12134
+ });
12135
+ resizeObserver.observe(waterfallFlowDom.current);
12136
+ return () => {
12137
+ resizeObserver.disconnect();
12138
+ };
12139
+ }, [onResize]);
12140
+ useCallback(() => {
12141
+ setIsLoadingData(true);
12142
+ waterFallData &&
12143
+ (getRecommendVideos === null || getRecommendVideos === void 0 ? void 0 : getRecommendVideos({
12144
+ hashTag: waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag,
12145
+ 'itemFilter.itemId': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemId,
12146
+ 'itemFilter.itemType': waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.itemType
12147
+ }).then((res) => {
12148
+ var _a, _b;
12149
+ setList(list === null || list === void 0 ? void 0 : list.concat((_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 && _b !== void 0 ? _b : []));
12150
+ setIsLoadingData(false);
12151
+ }));
12152
+ }, [waterFallData, getRecommendVideos, list]);
12153
+ const onScroll = useCallback(() => {
12154
+ // 记录滚动值
12155
+ setScrollTop(scrollParent.current.scrollTop);
12156
+ // const top = (scrollParent.current as any).scrollTop;
12157
+ // const clientHeight = (scrollParent.current as any).clientHeight;
12158
+ // const scrollHeight = (scrollParent.current as any).scrollHeight;
12159
+ // // 做底部加载
12160
+ // if (scrollHeight <= top + clientHeight && !isLoadingData) {
12161
+ // loadMoreData();
12162
+ // }
12163
+ }, []);
12164
+ /** 监听滚动 */
12165
+ useEffect(() => {
12166
+ var _a;
12167
+ (_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.addEventListener('scroll', onScroll);
12168
+ return () => {
12169
+ var _a;
12170
+ (_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('scroll', onScroll);
12171
+ };
12172
+ }, [onScroll, scrollParent]);
12173
+ const handleClickLink = () => {
12174
+ var _a, _b;
12175
+ if ((_a = data === null || data === void 0 ? void 0 : data.tag) === null || _a === void 0 ? void 0 : _a.link) {
12176
+ reportTagsView();
12177
+ window.location.href = (_b = data === null || data === void 0 ? void 0 : data.tag) === null || _b === void 0 ? void 0 : _b.link;
12178
+ }
12179
+ };
12180
+ return (React.createElement(React.Fragment, null, isLoadingData ? (React.createElement("div", { style: { height: '100%', width: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center' } },
12181
+ React.createElement("img", { width: 64, height: 64, src: loadingImage, alt: 'loading...', style: { objectFit: 'contain' } }))) : (React.createElement("div", { className: 'waterFallList', ref: waterfallFlowDom },
12182
+ React.createElement("div", { className: 'waterFallList-scroll', ref: scrollParent },
12183
+ 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),
12184
+ 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'),
12185
+ React.createElement("div", { className: 'waterFallList-content' }, list === null || list === void 0 ? void 0 :
12186
+ list.map((item, ind) => {
12187
+ var _a;
12188
+ return (React.createElement(WaterfallFlowItem$1, 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)));
12189
+ }),
12190
+ React.createElement("div", { hidden: !((_g = data === null || data === void 0 ? void 0 : data.tag) === null || _g === void 0 ? void 0 : _g.link), style: {
12191
+ position: 'absolute',
12192
+ width: '100%',
12193
+ 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) +
12194
+ ((_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)`,
12195
+ height: ((_o = data === null || data === void 0 ? void 0 : data.tag) === null || _o === void 0 ? void 0 : _o.link)
12196
+ ? ((_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'
12197
+ : 0
12198
+ } }))),
12199
+ 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 }),
12200
+ 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' }) },
12201
+ 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'))))));
12202
+ }
12203
+
12204
+ var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAaZJREFUeF7t2jFKBEEQRuG3mSJeQTARURDMTL2EqXfwAnoKD6FHMDEzNVIw2tzQC2gFggyDrExX1V92T7wz9PumFnqbXdH5teq8nwEwJqBzgfEVKDYAW8Ae8NZq3ZUm4Aa4AnaBR+C8BUIVAIu/ngSfAs9LESoAWLgB/LzWwP7SeLtfHWAu3tZ9Adz/dwD3eOUJCIlXBQiLVwQIjVcDCI9XAkiJVwFIi1cASI3PBpjb3jbd5GyyUcraCUrEZ02ATHwGgFR8NIBcfCSAZHwUgGx8BIB0vDeAfLwnQIl4L4Ay8R4ApeJbA2wD78DOZA/e7ABzk739Xz/T8rfAIfA6WYCd3BqA7NUSwCKfgLNKCK0BjoC7rzP74yoIrQGsuxSCB0ApBC+AMgieACUQvAHkESIApBGiAGQRIgEkEaIB5BAyAKQQsgBkEDIBJBCyAdIRFABSEVQA0hCUAFIQ1ADCERQBQhFUAcIQlAFCENQBfkOwg9eXpeftFQDmEOzv8ifARy8A3wiXwAHwANwujbf7q0xAi9bZZwwAN9oiDx4TUORFuS2z+wn4BAiAaEHnKChjAAAAAElFTkSuQmCC";
12205
+
11822
12206
  const WaterfallFlowItem = (props) => {
11823
12207
  const { rec, index, list, reportTagsView, textStyles, space } = props;
11824
12208
  const { swiperRef, setRtcList, setOpenHashtag, bffEventReport, sxpParameter } = useSxpDataSource();
@@ -12029,13 +12413,11 @@ function WaterfallList(_a) {
12029
12413
  React.createElement("button", { className: 'list-btn', style: props === null || props === void 0 ? void 0 : props.buttonStyle, onClick: handleClickLink }, ((_o = data === null || data === void 0 ? void 0 : data.tag) === null || _o === void 0 ? void 0 : _o.linkTitle) || 'Shop the collection'))))));
12030
12414
  }
12031
12415
 
12032
- var img$1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAaZJREFUeF7t2jFKBEEQRuG3mSJeQTARURDMTL2EqXfwAnoKD6FHMDEzNVIw2tzQC2gFggyDrExX1V92T7wz9PumFnqbXdH5teq8nwEwJqBzgfEVKDYAW8Ae8NZq3ZUm4Aa4AnaBR+C8BUIVAIu/ngSfAs9LESoAWLgB/LzWwP7SeLtfHWAu3tZ9Adz/dwD3eOUJCIlXBQiLVwQIjVcDCI9XAkiJVwFIi1cASI3PBpjb3jbd5GyyUcraCUrEZ02ATHwGgFR8NIBcfCSAZHwUgGx8BIB0vDeAfLwnQIl4L4Ay8R4ApeJbA2wD78DOZA/e7ABzk739Xz/T8rfAIfA6WYCd3BqA7NUSwCKfgLNKCK0BjoC7rzP74yoIrQGsuxSCB0ApBC+AMgieACUQvAHkESIApBGiAGQRIgEkEaIB5BAyAKQQsgBkEDIBJBCyAdIRFABSEVQA0hCUAFIQ1ADCERQBQhFUAcIQlAFCENQBfkOwg9eXpeftFQDmEOzv8ifARy8A3wiXwAHwANwujbf7q0xAi9bZZwwAN9oiDx4TUORFuS2z+wn4BAiAaEHnKChjAAAAAElFTkSuQmCC";
12033
-
12034
12416
  /*
12035
12417
  * @Author: binruan@chatlabs.com
12036
12418
  * @Date: 2024-01-10 10:58:24
12037
12419
  * @LastEditors: binruan@chatlabs.com
12038
- * @LastEditTime: 2024-04-15 17:57:59
12420
+ * @LastEditTime: 2024-06-07 10:35:35
12039
12421
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\WaterFall\index.tsx
12040
12422
  *
12041
12423
  */
@@ -12129,7 +12511,7 @@ const WaterFall = (props) => {
12129
12511
  display: openHashtag ? 'block' : 'none'
12130
12512
  } },
12131
12513
  React.createElement(Navbar$1, { icon: img$1, styles: { top: '32px' }, textStyle: (_a = props === null || props === void 0 ? void 0 : props.textStyles) === null || _a === void 0 ? void 0 : _a.hashTagTitle, onClose: handleClose }),
12132
- React.createElement(WaterfallList, Object.assign({ reportTagsView: reportTagsView }, props))), modalEleRef.current);
12514
+ (props === null || props === void 0 ? void 0 : props.isWaterfallFlow) ? (React.createElement(WaterfallList$1, Object.assign({ reportTagsView: reportTagsView }, props))) : (React.createElement(WaterfallList, Object.assign({ reportTagsView: reportTagsView }, props)))), modalEleRef.current);
12133
12515
  };
12134
12516
  var WaterFall$1 = memo(WaterFall);
12135
12517
 
@@ -12653,7 +13035,7 @@ const FingerSwipeTip = ({ imageUrl, style }) => {
12653
13035
  *
12654
13036
  */
12655
13037
  const Picture = (props) => {
12656
- const { src, height, imgUrlsPostConfig } = props;
13038
+ const { src, height, imgUrlsPostConfig, onShowFirstImage } = props;
12657
13039
  const blur = useMemo(() => {
12658
13040
  return (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.mode) === '2';
12659
13041
  }, [imgUrlsPostConfig]);
@@ -12678,7 +13060,7 @@ const Picture = (props) => {
12678
13060
  return isBgColor && (imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor) ? { backgroundColor: imgUrlsPostConfig === null || imgUrlsPostConfig === void 0 ? void 0 : imgUrlsPostConfig.bgColor } : {};
12679
13061
  }, [imgUrlsPostConfig, isBgColor]);
12680
13062
  return (React.createElement("div", { style: Object.assign({ overflow: 'hidden', height, width: '100%', position: 'relative' }, bgStyle) },
12681
- (!blur || !isBgColor) && (React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle) })),
13063
+ (!blur || !isBgColor) && (React.createElement(FormatImage$1, { src: src, style: Object.assign({ height: '100%', width: '100%', objectFit: 'cover' }, blurStyle), onLoad: onShowFirstImage })),
12682
13064
  blur && (React.createElement(FormatImage$1, { src: src, style: {
12683
13065
  width: '100%',
12684
13066
  height: '100%',
@@ -12695,7 +13077,7 @@ const Picture = (props) => {
12695
13077
  * @Author: lewinlu@chatlabs.com
12696
13078
  * @Date: 2024-01-03 14:39:09
12697
13079
  * @LastEditors: binruan@chatlabs.com
12698
- * @LastEditTime: 2024-04-18 19:56:22
13080
+ * @LastEditTime: 2024-06-07 14:05:08
12699
13081
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\index.tsx
12700
13082
  */
12701
13083
  const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageEnd, onViewImageStartEvent, imgUrlsPostConfig }) => {
@@ -12715,16 +13097,20 @@ const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onReportViewImageE
12715
13097
  }
12716
13098
  }
12717
13099
  else {
12718
- setIsLoad(true);
12719
13100
  (ref === null || ref === void 0 ? void 0 : ref.current) && ref.current.swiper.autoplay.stop();
12720
13101
  }
12721
13102
  }, [rec, isActive, onReportViewImageEnd, openHashtag, index, onViewImageStartEvent, isLoad]);
13103
+ const showFirstImageFn = useCallback(() => {
13104
+ if (!isLoad) {
13105
+ setIsLoad(true);
13106
+ }
13107
+ }, [isLoad]);
12722
13108
  // if (!isActive) {
12723
13109
  // return <img src={sxpParameter?.placeholder_image} style={{ width, height, objectFit: 'cover' }} />;
12724
13110
  // }
12725
- 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) => {
12726
- return (React.createElement(SwiperSlide, { key: url },
12727
- React.createElement(Picture, { src: url, height: height, imgUrlsPostConfig: imgUrlsPostConfig })));
13111
+ 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) => {
13112
+ return (React.createElement(SwiperSlide, { key: index },
13113
+ React.createElement(Picture, { src: !isLoad && index > 0 ? '' : url, height: height, imgUrlsPostConfig: imgUrlsPostConfig, onShowFirstImage: showFirstImageFn })));
12728
13114
  })));
12729
13115
  };
12730
13116
  var PictureGroup$3 = memo(PictureGroup$2);
@@ -12944,7 +13330,7 @@ var Tagbar$1 = memo(Tagbar);
12944
13330
  * @Author: binruan@chatlabs.com
12945
13331
  * @Date: 2024-01-15 19:03:09
12946
13332
  * @LastEditors: binruan@chatlabs.com
12947
- * @LastEditTime: 2024-06-06 18:42:24
13333
+ * @LastEditTime: 2024-06-07 11:10:42
12948
13334
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\index.tsx
12949
13335
  *
12950
13336
  */
@@ -12967,6 +13353,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12967
13353
  return data.length > 0 && !loading && getFeUserId();
12968
13354
  }, [data, loading]);
12969
13355
  const handleH5EnterLink = useCallback(() => {
13356
+ var _a, _b;
12970
13357
  if (data.length <= 0) {
12971
13358
  return;
12972
13359
  }
@@ -12989,7 +13376,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
12989
13376
  utmId: getVal('utm_id'),
12990
13377
  utmContent: getVal('utm_content'),
12991
13378
  enterTime: `${Date.now()}`,
12992
- requestId: null
13379
+ requestId: null,
13380
+ 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 : '',
13381
+ clSource: getVal('cl_sourc')
12993
13382
  }
12994
13383
  });
12995
13384
  bffFbReport === null || bffFbReport === void 0 ? void 0 : bffFbReport({
@@ -13049,26 +13438,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
13049
13438
  })) || 0;
13050
13439
  (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(index);
13051
13440
  }, [ctaType, swiperRef]);
13052
- // useEffect(() => {
13053
- // const handleBeforeUnload = (event: any) => {
13054
- // event.preventDefault();
13055
- // const item = data?.[activeIndex];
13056
- // bffEventReport?.({
13057
- // eventInfo: {
13058
- // sessionDuration: Math.floor(((new Date() as any) - curTime) / 1000) + '',
13059
- // eventSubject: 'sessionCompleted',
13060
- // eventDescription: 'Session completed',
13061
- // contentId: item?.video?.itemId,
13062
- // productId: item?.product?.itemId,
13063
- // position: item?.position
13064
- // }
13065
- // });
13066
- // };
13067
- // window.addEventListener('beforeunload', handleBeforeUnload);
13068
- // return () => {
13069
- // window.removeEventListener('beforeunload', handleBeforeUnload);
13070
- // };
13071
- // }, [activeIndex, data, bffEventReport, curTime]);
13072
13441
  useEffect(() => {
13073
13442
  const item = data === null || data === void 0 ? void 0 : data[activeIndex];
13074
13443
  const visibleChange = () => {