pb-sxp-ui 1.7.4 → 1.7.5

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 (31) hide show
  1. package/dist/index.cjs +13 -26
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +13 -26
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +3 -3
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +3 -3
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +13 -26
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +3 -3
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/SxpPageRender/Modal/index.d.ts +1 -0
  14. package/es/core/components/SxpPageRender/Modal/index.js +2 -2
  15. package/es/core/components/SxpPageRender/PictureGroup/index.d.ts +0 -1
  16. package/es/core/components/SxpPageRender/PictureGroup/index.js +0 -3
  17. package/es/core/components/SxpPageRender/RenderCard.js +2 -1
  18. package/es/core/components/SxpPageRender/VideoWidget/index.js +8 -9
  19. package/es/core/components/SxpPageRender/index.js +0 -1
  20. package/es/core/utils/tool.d.ts +1 -2
  21. package/es/core/utils/tool.js +1 -11
  22. package/lib/core/components/SxpPageRender/Modal/index.d.ts +1 -0
  23. package/lib/core/components/SxpPageRender/Modal/index.js +2 -2
  24. package/lib/core/components/SxpPageRender/PictureGroup/index.d.ts +0 -1
  25. package/lib/core/components/SxpPageRender/PictureGroup/index.js +0 -3
  26. package/lib/core/components/SxpPageRender/RenderCard.js +2 -1
  27. package/lib/core/components/SxpPageRender/VideoWidget/index.js +8 -9
  28. package/lib/core/components/SxpPageRender/index.js +0 -1
  29. package/lib/core/utils/tool.d.ts +1 -2
  30. package/lib/core/utils/tool.js +1 -12
  31. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -320,16 +320,6 @@ function getCookie(val) {
320
320
  });
321
321
  return value !== null && value !== void 0 ? value : '';
322
322
  }
323
- const getResFileSizeFromSrc = (imageSrc) => {
324
- if (!imageSrc)
325
- return '';
326
- return fetch(imageSrc)
327
- .then((response) => response.blob())
328
- .then((blob) => {
329
- const fileSizeInMB = blob.size / (1024 * 1024); // 将文件大小转换为 MB
330
- return fileSizeInMB.toFixed(2) + '';
331
- });
332
- };
333
323
 
334
324
  function unzip(b64Data) {
335
325
  const strData = atob(b64Data);
@@ -8989,12 +8979,12 @@ SwiperSlide.displayName = 'SwiperSlide';
8989
8979
  * @Author: binruan@chatlabs.com
8990
8980
  * @Date: 2023-11-02 18:34:34
8991
8981
  * @LastEditors: binruan@chatlabs.com
8992
- * @LastEditTime: 2024-10-23 16:44:34
8982
+ * @LastEditTime: 2024-10-30 19:22:59
8993
8983
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\Modal\index.tsx
8994
8984
  *
8995
8985
  */
8996
8986
  const closeIcon$1 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
8997
- const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight = window.innerHeight, isFullScreen = false }) => {
8987
+ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema, fullHeight = window.innerHeight, isFullScreen = false, openState }) => {
8998
8988
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
8999
8989
  const touchRef = React.useRef(null);
9000
8990
  const fTouchRef = React.useRef(null);
@@ -9046,7 +9036,7 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popup, schema,
9046
9036
  }, [isOpen, popup]);
9047
9037
  const child = React.useCallback(() => {
9048
9038
  return children;
9049
- }, [_popup]);
9039
+ }, [_popup, openState]);
9050
9040
  if (!modalEleRef.current)
9051
9041
  return null;
9052
9042
  const handleClose = lodash.debounce(() => {
@@ -15686,6 +15676,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
15686
15676
  const videoEleRef = React.useRef(null);
15687
15677
  const hlsRef = React.useRef(null);
15688
15678
  const initTimeRef = React.useRef();
15679
+ const loadedTimeRef = React.useRef();
15689
15680
  const blur = React.useMemo(() => {
15690
15681
  return (videoPostConfig === null || videoPostConfig === void 0 ? void 0 : videoPostConfig.mode) === '2';
15691
15682
  }, [videoPostConfig]);
@@ -15732,7 +15723,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
15732
15723
  setIsLoadFinish(true);
15733
15724
  }, []);
15734
15725
  const handleStartPlay = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
15735
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
15726
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
15736
15727
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current))
15737
15728
  return;
15738
15729
  setIsPauseVideo(false);
@@ -15742,22 +15733,20 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
15742
15733
  const videoDuration = ((_d = (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.duration) !== null && _d !== void 0 ? _d : 0).toFixed(2);
15743
15734
  const videoCurrentTime = ((_f = (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.currentTime) !== null && _f !== void 0 ? _f : 0).toFixed(2);
15744
15735
  const playType = isFirstPlay ? '0' : '1';
15745
- const contentSize = yield getResFileSizeFromSrc((_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.url);
15746
15736
  bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
15747
15737
  eventInfo: {
15748
15738
  eventSubject: 'playVideo',
15749
15739
  eventDescription: 'User played the video',
15750
- contentId: (_j = (_h = item === null || item === void 0 ? void 0 : item.video) === null || _h === void 0 ? void 0 : _h.itemId) !== null && _j !== void 0 ? _j : '',
15751
- contentName: (_l = (_k = item === null || item === void 0 ? void 0 : item.video) === null || _k === void 0 ? void 0 : _k.title) !== null && _l !== void 0 ? _l : '',
15740
+ contentId: (_h = (_g = item === null || item === void 0 ? void 0 : item.video) === null || _g === void 0 ? void 0 : _g.itemId) !== null && _h !== void 0 ? _h : '',
15741
+ contentName: (_k = (_j = item === null || item === void 0 ? void 0 : item.video) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : '',
15752
15742
  playType,
15753
15743
  startTime: videoCurrentTime,
15754
15744
  videoDuration,
15755
- contentTags: JSON.stringify((_o = (_m = item === null || item === void 0 ? void 0 : item.video) === null || _m === void 0 ? void 0 : _m.tags) !== null && _o !== void 0 ? _o : []),
15745
+ contentTags: JSON.stringify((_m = (_l = item === null || item === void 0 ? void 0 : item.video) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : []),
15756
15746
  position: index + '',
15757
15747
  contentFormat: 'video',
15758
- traceInfo: (_p = item === null || item === void 0 ? void 0 : item.video) === null || _p === void 0 ? void 0 : _p.traceInfo,
15759
- contentSize,
15760
- loadTime: (new Date() - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current)).toFixed(2) + ''
15748
+ traceInfo: (_o = item === null || item === void 0 ? void 0 : item.video) === null || _o === void 0 ? void 0 : _o.traceInfo,
15749
+ loadTime: ((loadedTimeRef === null || loadedTimeRef === void 0 ? void 0 : loadedTimeRef.current) - (initTimeRef === null || initTimeRef === void 0 ? void 0 : initTimeRef.current)).toFixed(2) + ''
15761
15750
  }
15762
15751
  });
15763
15752
  setIsFirstPlay(false);
@@ -15788,6 +15777,7 @@ const VideoWidget$2 = ({ rec, index, height, data, muted, activeIndex, videoPost
15788
15777
  const handleLoadedmetadata = React.useCallback(() => {
15789
15778
  if (!videoRef.current)
15790
15779
  return;
15780
+ loadedTimeRef.current = new Date();
15791
15781
  handleStartPlay();
15792
15782
  handLoadeddata();
15793
15783
  }, [videoRef.current, handLoadeddata, handleStartPlay]);
@@ -16142,9 +16132,7 @@ const PictureGroup$2 = ({ imgUrls, width, height, rec, index, onViewImageEndEven
16142
16132
  }, [rec, isActive, onViewImageEndEvent, openHashtag, index, onViewImageStartEvent, isLoad, imgInfo]);
16143
16133
  const showFirstImageFn = React.useCallback((e) => __awaiter(void 0, void 0, void 0, function* () {
16144
16134
  if (!isLoad) {
16145
- const contentSize = yield getResFileSizeFromSrc(e.src);
16146
16135
  setImgInfo({
16147
- contentSize,
16148
16136
  loadTime: (new Date() - initTime).toFixed(2) + ''
16149
16137
  });
16150
16138
  setIsLoad(true);
@@ -16301,7 +16289,7 @@ function withBindDataSource(Component) {
16301
16289
  * @Author: binruan@chatlabs.com
16302
16290
  * @Date: 2023-12-26 16:11:34
16303
16291
  * @LastEditors: binruan@chatlabs.com
16304
- * @LastEditTime: 2024-10-29 14:07:29
16292
+ * @LastEditTime: 2024-10-30 14:51:19
16305
16293
  * @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\RenderCard.tsx
16306
16294
  *
16307
16295
  */
@@ -16350,7 +16338,7 @@ const RenderCard = ({ rec, index, tempMap, resolver, includesCtaType, isActive }
16350
16338
  const Component = withBindDataSource(t);
16351
16339
  const defaulSetting = (_z = t === null || t === void 0 ? void 0 : t.extend) === null || _z === void 0 ? void 0 : _z.defaulSetting;
16352
16340
  const isExternalLink = ((_2 = (_1 = (_0 = value === null || value === void 0 ? void 0 : value.item) === null || _0 === void 0 ? void 0 : _0.event) === null || _1 === void 0 ? void 0 : _1.onClick) === null || _2 === void 0 ? void 0 : _2.linkType) === 'externalLink';
16353
- let style = (_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.style;
16341
+ let style = lodash.cloneDeep((_3 = value === null || value === void 0 ? void 0 : value.item) === null || _3 === void 0 ? void 0 : _3.style);
16354
16342
  if (style.hasOwnProperty('backdropFilter')) {
16355
16343
  let sbf = style['backdropFilter'];
16356
16344
  style['backdropFilter'] = `blur(${sbf !== null && sbf !== void 0 ? sbf : 0}px)`;
@@ -16871,7 +16859,6 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
16871
16859
  position: activeIndex + '',
16872
16860
  contentFormat: 'image',
16873
16861
  traceInfo: item === null || item === void 0 ? void 0 : item.video.traceInfo,
16874
- contentSize: imgInfo === null || imgInfo === void 0 ? void 0 : imgInfo.contentSize,
16875
16862
  loadTime: imgInfo === null || imgInfo === void 0 ? void 0 : imgInfo.loadTime
16876
16863
  }
16877
16864
  });