pb-sxp-ui 1.2.4 → 1.2.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 (62) hide show
  1. package/dist/index.cjs +231 -151
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +2 -2
  4. package/dist/index.js +231 -151
  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 +231 -151
  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/LikeButton/index.js +34 -15
  15. package/es/core/components/SxpPageRender/Popup/index.js +23 -12
  16. package/es/core/components/SxpPageRender/RenderCard.d.ts +1 -0
  17. package/es/core/components/SxpPageRender/RenderCard.js +3 -3
  18. package/es/core/components/SxpPageRender/index.js +2 -2
  19. package/es/core/components/SxpPageRender/typing.d.ts +1 -0
  20. package/es/core/context/SxpDataSourceProvider.d.ts +3 -3
  21. package/es/core/context/SxpDataSourceProvider.js +7 -3
  22. package/es/materials/sxp/cta/AniLink/index.js +2 -1
  23. package/es/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
  24. package/es/materials/sxp/cta/AniLinkPopup/index.js +11 -20
  25. package/es/materials/sxp/popup/CommodityDetail/index.js +25 -13
  26. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +28 -17
  27. package/es/materials/sxp/popup/CommodityList/index.js +28 -10
  28. package/es/materials/sxp/popup/CommodityList/material.js +1 -0
  29. package/es/materials/sxp/popup/CommodityList/settingRender.js +5 -0
  30. package/es/materials/sxp/template/MultiCommodity/index.js +3 -3
  31. package/es/materials/sxp/template/MultiCommodityDiro/index.js +3 -3
  32. package/es/materials/sxp/template/components/CommodityGroup.d.ts +4 -0
  33. package/es/materials/sxp/template/components/CommodityGroup.js +12 -15
  34. package/es/materials/sxp/template/components/Img.d.ts +1 -0
  35. package/es/materials/sxp/template/components/Img.js +3 -3
  36. package/es/materials/sxp/template/components/Scroll.d.ts +1 -0
  37. package/es/materials/sxp/template/components/Scroll.js +5 -4
  38. package/lib/core/components/SxpPageRender/LikeButton/index.js +34 -15
  39. package/lib/core/components/SxpPageRender/Popup/index.js +22 -11
  40. package/lib/core/components/SxpPageRender/RenderCard.d.ts +1 -0
  41. package/lib/core/components/SxpPageRender/RenderCard.js +3 -3
  42. package/lib/core/components/SxpPageRender/index.js +2 -2
  43. package/lib/core/components/SxpPageRender/typing.d.ts +1 -0
  44. package/lib/core/context/SxpDataSourceProvider.d.ts +3 -3
  45. package/lib/core/context/SxpDataSourceProvider.js +7 -3
  46. package/lib/materials/sxp/cta/AniLink/index.js +2 -1
  47. package/lib/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
  48. package/lib/materials/sxp/cta/AniLinkPopup/index.js +10 -19
  49. package/lib/materials/sxp/popup/CommodityDetail/index.js +24 -12
  50. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +28 -17
  51. package/lib/materials/sxp/popup/CommodityList/index.js +27 -9
  52. package/lib/materials/sxp/popup/CommodityList/material.js +1 -0
  53. package/lib/materials/sxp/popup/CommodityList/settingRender.js +5 -0
  54. package/lib/materials/sxp/template/MultiCommodity/index.js +3 -3
  55. package/lib/materials/sxp/template/MultiCommodityDiro/index.js +3 -3
  56. package/lib/materials/sxp/template/components/CommodityGroup.d.ts +4 -0
  57. package/lib/materials/sxp/template/components/CommodityGroup.js +11 -14
  58. package/lib/materials/sxp/template/components/Img.d.ts +1 -0
  59. package/lib/materials/sxp/template/components/Img.js +3 -3
  60. package/lib/materials/sxp/template/components/Scroll.d.ts +1 -0
  61. package/lib/materials/sxp/template/components/Scroll.js +5 -4
  62. package/package.json +1 -1
@@ -4,31 +4,28 @@ const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const Scroll_1 = tslib_1.__importDefault(require("./Scroll"));
6
6
  const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
7
- const hooks_1 = require("../../../../core/hooks");
8
7
  const react_2 = require("swiper/react");
9
8
  const css_1 = require("@emotion/css");
10
- const CommodityGroup = ({ products, data, defImg, style }) => {
11
- var _a, _b;
12
- const { setPopupDetailData, popupDetailData } = (0, hooks_1.useSxpDataSource)();
13
- const [check, setCheck] = (0, react_1.useState)((_a = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _a !== void 0 ? _a : 0);
14
- const handleClick = (0, react_1.useCallback)((index) => {
15
- setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData((val) => (Object.assign(Object.assign({}, val), { video: Object.assign(Object.assign({}, val === null || val === void 0 ? void 0 : val.video), { bindProduct: products === null || products === void 0 ? void 0 : products[index] }), multiCheckIndex: index })));
16
- }, []);
17
- return (react_1.default.createElement(react_1.default.Fragment, null, (data === null || data === void 0 ? void 0 : data.open) && ((products && (products === null || products === void 0 ? void 0 : products.length) > 0) || !popupDetailData) && (react_1.default.createElement(Scroll_1.default, { isPadding: false, style: Object.assign(Object.assign({}, style), data === null || data === void 0 ? void 0 : data.style) }, (_b = (popupDetailData ? products : [0, 1, 2, 3])) === null || _b === void 0 ? void 0 : _b.map((item, index) => {
9
+ const CommodityGroup = ({ products, data, defImg, style, onCLick, popupDetailData, check }) => {
10
+ var _a;
11
+ return (react_1.default.createElement(react_1.default.Fragment, null, (data === null || data === void 0 ? void 0 : data.open) && ((products && (products === null || products === void 0 ? void 0 : products.length) > 1) || !popupDetailData) && (react_1.default.createElement(Scroll_1.default, { enableSlideActive: true, isPadding: false, style: Object.assign(Object.assign({}, style), data === null || data === void 0 ? void 0 : data.style) }, (_a = (popupDetailData ? products : [0, 1, 2, 3])) === null || _a === void 0 ? void 0 : _a.map((item, index) => {
18
12
  var _a, _b, _c;
19
- return (react_1.default.createElement(react_2.SwiperSlide, { className: (0, css_1.css)({
13
+ return (react_1.default.createElement(react_1.default.Fragment, null, (item === null || item === void 0 ? void 0 : item.bindCta) ? (react_1.default.createElement(react_2.SwiperSlide, { className: (0, css_1.css)({
20
14
  width: '50px',
21
15
  height: '50px',
22
16
  marginRight: '10px'
23
- }), onClick: () => handleClick(index), key: index },
17
+ }), onClick: () => {
18
+ onCLick === null || onCLick === void 0 ? void 0 : onCLick(index);
19
+ }, key: index },
24
20
  react_1.default.createElement(FormatImage_1.default, { style: {
25
21
  height: '100%',
26
22
  width: '100%',
27
23
  objectFit: 'cover',
28
24
  display: 'block',
29
- objectPosition: `50% ${(data === null || data === void 0 ? void 0 : data.translateY) ? -(data === null || data === void 0 ? void 0 : data.translateY) + 50 : 50}%`,
30
- border: check === index ? '1px solid #000' : '1px solid #f2f2f2'
31
- }, src: (_c = (_a = item === null || item === void 0 ? void 0 : item.cover) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.homePage) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : defImg })));
25
+ objectPosition: `50% ${(data === null || data === void 0 ? void 0 : data.translateY) ? (data === null || data === void 0 ? void 0 : data.translateY) + 50 : 50}%`,
26
+ border: check === index ? '1px solid #000' : '1px solid #f2f2f2',
27
+ boxSizing: 'border-box'
28
+ }, src: (_c = (_a = item === null || item === void 0 ? void 0 : item.cover) !== null && _a !== void 0 ? _a : (_b = item === null || item === void 0 ? void 0 : item.homePage) === null || _b === void 0 ? void 0 : _b[0]) !== null && _c !== void 0 ? _c : defImg }))) : null));
32
29
  })))));
33
30
  };
34
31
  exports.default = (0, react_1.memo)(CommodityGroup);
@@ -8,6 +8,7 @@ export interface IImgProps {
8
8
  style?: CSSProperties;
9
9
  translateY?: number;
10
10
  imgStyle?: CSSProperties;
11
+ enableEventReport?: boolean;
11
12
  }
12
13
  declare const _default: React.NamedExoticComponent<IImgProps>;
13
14
  export default _default;
@@ -6,18 +6,18 @@ const react_1 = tslib_1.__importStar(require("react"));
6
6
  const useOnScreen_1 = tslib_1.__importDefault(require("../../../../core/hooks/useOnScreen"));
7
7
  const hooks_1 = require("../../../../core/hooks");
8
8
  const FormatImage_1 = tslib_1.__importDefault(require("../../../../core/components/SxpPageRender/FormatImage"));
9
- const Img = ({ src, rec, item, index, style, translateY, imgStyle }) => {
9
+ const Img = ({ src, rec, item, index, style, translateY, imgStyle, enableEventReport = true }) => {
10
10
  const ref = (0, react_1.useRef)(null);
11
11
  const isOnScreen = (0, useOnScreen_1.default)(ref);
12
12
  const { ctaEvent } = (0, hooks_1.useSxpDataSource)();
13
13
  (0, react_1.useEffect)(() => {
14
- if (isOnScreen && src && (ref === null || ref === void 0 ? void 0 : ref.current)) {
14
+ if (isOnScreen && src && (ref === null || ref === void 0 ? void 0 : ref.current) && enableEventReport) {
15
15
  ctaEvent === null || ctaEvent === void 0 ? void 0 : ctaEvent({
16
16
  eventSubject: 'ctaExposure',
17
17
  eventDescription: 'The cta was shown to the user'
18
18
  }, rec, item, index);
19
19
  }
20
- }, [isOnScreen, src, ref, rec, ctaEvent, item, index]);
20
+ }, [isOnScreen, src, ref, rec, ctaEvent, item, index, enableEventReport]);
21
21
  const imgSrc = (0, react_1.useMemo)(() => {
22
22
  return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? src : `${src}?imrquality/rquality/20`;
23
23
  }, [src]);
@@ -6,6 +6,7 @@ interface IScrollProps {
6
6
  children: any;
7
7
  isPadding?: boolean;
8
8
  style?: CSSProperties;
9
+ enableSlideActive?: boolean;
9
10
  }
10
11
  declare const _default: React.NamedExoticComponent<IScrollProps>;
11
12
  export default _default;
@@ -8,13 +8,14 @@ require("swiper/css/free-mode");
8
8
  require("swiper/css/scrollbar");
9
9
  const modules_1 = require("swiper/modules");
10
10
  const hooks_1 = require("../../../../core/hooks");
11
- const Scroll = ({ children, isPadding = true, style }) => {
11
+ const Scroll = ({ children, isPadding = true, style, enableSlideActive = false }) => {
12
12
  const ref = (0, react_1.useRef)();
13
13
  const { popupDetailData } = (0, hooks_1.useSxpDataSource)();
14
14
  (0, react_1.useEffect)(() => {
15
- var _a;
16
- (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo(popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex);
17
- }, [popupDetailData]);
15
+ var _a, _b;
16
+ if (enableSlideActive)
17
+ (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.swiper.slideTo((_b = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.multiCheckIndex) !== null && _b !== void 0 ? _b : 0);
18
+ }, [popupDetailData, enableSlideActive]);
18
19
  return (react_1.default.createElement(react_2.Swiper, { ref: ref, direction: 'horizontal', slidesPerView: 'auto', freeMode: true, mousewheel: true, modules: [modules_1.FreeMode, modules_1.Scrollbar, modules_1.Mousewheel], style: Object.assign({ padding: isPadding ? '0 12px 0 20px' : 0 }, style) }, children));
19
20
  };
20
21
  exports.default = (0, react_1.memo)(Scroll);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",