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.
- package/dist/index.cjs +231 -151
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2 -2
- package/dist/index.js +231 -151
- 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 +231 -151
- 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/LikeButton/index.js +34 -15
- package/es/core/components/SxpPageRender/Popup/index.js +23 -12
- package/es/core/components/SxpPageRender/RenderCard.d.ts +1 -0
- package/es/core/components/SxpPageRender/RenderCard.js +3 -3
- package/es/core/components/SxpPageRender/index.js +2 -2
- package/es/core/components/SxpPageRender/typing.d.ts +1 -0
- package/es/core/context/SxpDataSourceProvider.d.ts +3 -3
- package/es/core/context/SxpDataSourceProvider.js +7 -3
- package/es/materials/sxp/cta/AniLink/index.js +2 -1
- package/es/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
- package/es/materials/sxp/cta/AniLinkPopup/index.js +11 -20
- package/es/materials/sxp/popup/CommodityDetail/index.js +25 -13
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +28 -17
- package/es/materials/sxp/popup/CommodityList/index.js +28 -10
- package/es/materials/sxp/popup/CommodityList/material.js +1 -0
- package/es/materials/sxp/popup/CommodityList/settingRender.js +5 -0
- package/es/materials/sxp/template/MultiCommodity/index.js +3 -3
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +3 -3
- package/es/materials/sxp/template/components/CommodityGroup.d.ts +4 -0
- package/es/materials/sxp/template/components/CommodityGroup.js +12 -15
- package/es/materials/sxp/template/components/Img.d.ts +1 -0
- package/es/materials/sxp/template/components/Img.js +3 -3
- package/es/materials/sxp/template/components/Scroll.d.ts +1 -0
- package/es/materials/sxp/template/components/Scroll.js +5 -4
- package/lib/core/components/SxpPageRender/LikeButton/index.js +34 -15
- package/lib/core/components/SxpPageRender/Popup/index.js +22 -11
- package/lib/core/components/SxpPageRender/RenderCard.d.ts +1 -0
- package/lib/core/components/SxpPageRender/RenderCard.js +3 -3
- package/lib/core/components/SxpPageRender/index.js +2 -2
- package/lib/core/components/SxpPageRender/typing.d.ts +1 -0
- package/lib/core/context/SxpDataSourceProvider.d.ts +3 -3
- package/lib/core/context/SxpDataSourceProvider.js +7 -3
- package/lib/materials/sxp/cta/AniLink/index.js +2 -1
- package/lib/materials/sxp/cta/AniLinkPopup/index.d.ts +1 -0
- package/lib/materials/sxp/cta/AniLinkPopup/index.js +10 -19
- package/lib/materials/sxp/popup/CommodityDetail/index.js +24 -12
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +28 -17
- package/lib/materials/sxp/popup/CommodityList/index.js +27 -9
- package/lib/materials/sxp/popup/CommodityList/material.js +1 -0
- package/lib/materials/sxp/popup/CommodityList/settingRender.js +5 -0
- package/lib/materials/sxp/template/MultiCommodity/index.js +3 -3
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +3 -3
- package/lib/materials/sxp/template/components/CommodityGroup.d.ts +4 -0
- package/lib/materials/sxp/template/components/CommodityGroup.js +11 -14
- package/lib/materials/sxp/template/components/Img.d.ts +1 -0
- package/lib/materials/sxp/template/components/Img.js +3 -3
- package/lib/materials/sxp/template/components/Scroll.d.ts +1 -0
- package/lib/materials/sxp/template/components/Scroll.js +5 -4
- 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
|
12
|
-
|
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: () =>
|
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) ?
|
30
|
-
border: check === index ? '1px solid #000' : '1px solid #f2f2f2'
|
31
|
-
|
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);
|
@@ -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]);
|
@@ -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
|
-
|
17
|
-
|
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);
|