pb-sxp-ui 1.1.1 → 1.2.0
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 +2257 -857
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +356 -175
- package/dist/index.js +2257 -857
- package/dist/index.js.map +1 -0
- package/dist/index.min.cjs +4 -3
- package/dist/index.min.cjs.map +1 -0
- package/dist/index.min.js +4 -3
- package/dist/index.min.js.map +1 -0
- package/dist/pb-ui.js +2257 -857
- package/dist/pb-ui.js.map +1 -0
- package/dist/pb-ui.min.js +4 -3
- package/dist/pb-ui.min.js.map +1 -0
- package/es/core/Pagebuilder/type.d.ts +1 -0
- package/es/core/components/SxpPageRender/Hashtag/index.js +1 -3
- package/es/core/components/SxpPageRender/Modal/index.d.ts +3 -0
- package/es/core/components/SxpPageRender/Modal/index.js +70 -6
- package/es/core/components/SxpPageRender/Navbar.js +1 -1
- package/es/core/components/SxpPageRender/Popup/index.js +1 -1
- package/es/core/components/SxpPageRender/RenderCard.d.ts +1 -0
- package/es/core/components/SxpPageRender/RenderCard.js +16 -12
- package/es/core/components/SxpPageRender/VideoWidget/index.js +11 -10
- package/es/core/components/SxpPageRender/WaterFall/List.js +1 -1
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +1 -1
- package/es/core/components/SxpPageRender/index.d.ts +3 -2
- package/es/core/components/SxpPageRender/index.js +51 -17
- package/es/core/components/SxpPageRender/typing.d.ts +1 -0
- package/es/core/context/SxpDataSourceProvider.d.ts +1 -0
- package/es/core/context/SxpDataSourceProvider.js +6 -3
- package/es/core/utils/localStore.d.ts +3 -0
- package/es/core/utils/localStore.js +8 -0
- package/es/materials/sxp/HashTag/material.js +1 -2
- package/es/materials/sxp/cta/AniLink/index.d.ts +14 -0
- package/es/materials/sxp/cta/AniLink/index.js +58 -0
- package/es/materials/sxp/cta/AniLink/interactionRender.d.ts +42 -0
- package/es/materials/sxp/cta/AniLink/interactionRender.js +50 -0
- package/es/materials/sxp/cta/AniLink/material.d.ts +2 -0
- package/es/materials/sxp/cta/AniLink/material.js +38 -0
- package/es/materials/sxp/cta/AniLink/settingRender.d.ts +73 -0
- package/es/materials/sxp/cta/AniLink/settingRender.js +103 -0
- package/es/materials/sxp/cta/AniLinkPopup/index.d.ts +17 -0
- package/es/materials/sxp/cta/AniLinkPopup/index.js +65 -0
- package/es/materials/sxp/cta/AniLinkPopup/interactionRender.d.ts +42 -0
- package/es/materials/sxp/cta/AniLinkPopup/interactionRender.js +50 -0
- package/es/materials/sxp/cta/AniLinkPopup/material.d.ts +2 -0
- package/es/materials/sxp/cta/AniLinkPopup/material.js +52 -0
- package/es/materials/sxp/cta/AniLinkPopup/settingRender.d.ts +176 -0
- package/es/materials/sxp/cta/AniLinkPopup/settingRender.js +249 -0
- package/es/materials/sxp/cta/index.d.ts +2 -0
- package/es/materials/sxp/cta/index.js +2 -0
- package/es/materials/sxp/index.d.ts +1 -0
- package/es/materials/sxp/index.js +1 -0
- package/es/materials/sxp/popup/AppointForm/Form.js +1 -1
- package/es/materials/sxp/popup/CommodityDetail/index.d.ts +5 -0
- package/es/materials/sxp/popup/CommodityDetail/index.js +43 -26
- package/es/materials/sxp/popup/CommodityDetail/interactionRender.d.ts +9 -0
- package/es/materials/sxp/popup/CommodityDetail/interactionRender.js +12 -0
- package/es/materials/sxp/popup/CommodityDetail/material.js +3 -1
- package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +37 -0
- package/es/materials/sxp/popup/CommodityDetail/settingRender.js +41 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +5 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +11 -25
- package/es/materials/sxp/popup/CommodityDetailDiroNew/interactionRender.d.ts +9 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/interactionRender.js +12 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/material.js +3 -1
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +37 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +41 -0
- package/es/materials/sxp/popup/CommodityList/index.d.ts +28 -0
- package/es/materials/sxp/popup/CommodityList/index.js +56 -0
- package/es/materials/sxp/popup/CommodityList/interactionRender.d.ts +8 -0
- package/es/materials/sxp/popup/CommodityList/interactionRender.js +11 -0
- package/es/materials/sxp/popup/CommodityList/material.d.ts +2 -0
- package/es/materials/sxp/popup/CommodityList/material.js +51 -0
- package/es/materials/sxp/popup/CommodityList/settingRender.d.ts +151 -0
- package/es/materials/sxp/popup/CommodityList/settingRender.js +207 -0
- package/es/materials/sxp/popup/index.d.ts +1 -0
- package/es/materials/sxp/popup/index.js +1 -0
- package/es/materials/sxp/template/Link/index.js +2 -2
- package/es/materials/sxp/template/MultiCommodity/index.js +2 -2
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +2 -2
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +5 -4
- package/es/materials/sxp/template/components/CommodityGroup.d.ts +14 -0
- package/es/materials/sxp/template/components/CommodityGroup.js +31 -0
- package/es/materials/sxp/template/components/Img.js +1 -1
- package/es/materials/sxp/template/components/Scroll.d.ts +2 -1
- package/es/materials/sxp/template/components/Scroll.js +10 -3
- package/es/materials/sxp/template/components/settingRender.js +0 -5
- package/lib/core/Pagebuilder/type.d.ts +1 -0
- package/lib/core/components/SxpPageRender/Hashtag/index.js +1 -3
- package/lib/core/components/SxpPageRender/Modal/index.d.ts +3 -0
- package/lib/core/components/SxpPageRender/Modal/index.js +70 -6
- package/lib/core/components/SxpPageRender/Navbar.js +1 -1
- package/lib/core/components/SxpPageRender/Popup/index.js +1 -1
- package/lib/core/components/SxpPageRender/RenderCard.d.ts +1 -0
- package/lib/core/components/SxpPageRender/RenderCard.js +16 -12
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +11 -10
- package/lib/core/components/SxpPageRender/WaterFall/List.js +1 -1
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +1 -1
- package/lib/core/components/SxpPageRender/index.d.ts +3 -2
- package/lib/core/components/SxpPageRender/index.js +50 -16
- package/lib/core/components/SxpPageRender/typing.d.ts +1 -0
- package/lib/core/context/SxpDataSourceProvider.d.ts +1 -0
- package/lib/core/context/SxpDataSourceProvider.js +6 -3
- package/lib/core/utils/localStore.d.ts +3 -0
- package/lib/core/utils/localStore.js +11 -1
- package/lib/materials/sxp/HashTag/material.js +1 -2
- package/lib/materials/sxp/cta/AniLink/index.d.ts +14 -0
- package/lib/materials/sxp/cta/AniLink/index.js +60 -0
- package/lib/materials/sxp/cta/AniLink/interactionRender.d.ts +42 -0
- package/lib/materials/sxp/cta/AniLink/interactionRender.js +52 -0
- package/lib/materials/sxp/cta/AniLink/material.d.ts +2 -0
- package/lib/materials/sxp/cta/AniLink/material.js +42 -0
- package/lib/materials/sxp/cta/AniLink/settingRender.d.ts +73 -0
- package/lib/materials/sxp/cta/AniLink/settingRender.js +105 -0
- package/lib/materials/sxp/cta/AniLinkPopup/index.d.ts +17 -0
- package/lib/materials/sxp/cta/AniLinkPopup/index.js +67 -0
- package/lib/materials/sxp/cta/AniLinkPopup/interactionRender.d.ts +42 -0
- package/lib/materials/sxp/cta/AniLinkPopup/interactionRender.js +52 -0
- package/lib/materials/sxp/cta/AniLinkPopup/material.d.ts +2 -0
- package/lib/materials/sxp/cta/AniLinkPopup/material.js +56 -0
- package/lib/materials/sxp/cta/AniLinkPopup/settingRender.d.ts +176 -0
- package/lib/materials/sxp/cta/AniLinkPopup/settingRender.js +251 -0
- package/lib/materials/sxp/cta/index.d.ts +2 -0
- package/lib/materials/sxp/cta/index.js +5 -0
- package/lib/materials/sxp/index.d.ts +1 -0
- package/lib/materials/sxp/index.js +1 -0
- package/lib/materials/sxp/popup/AppointForm/Form.js +1 -1
- package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +5 -0
- package/lib/materials/sxp/popup/CommodityDetail/index.js +43 -26
- package/lib/materials/sxp/popup/CommodityDetail/interactionRender.d.ts +9 -0
- package/lib/materials/sxp/popup/CommodityDetail/interactionRender.js +14 -0
- package/lib/materials/sxp/popup/CommodityDetail/material.js +3 -1
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +37 -0
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +41 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +5 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +11 -25
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/interactionRender.d.ts +9 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/interactionRender.js +14 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/material.js +3 -1
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +37 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +41 -0
- package/lib/materials/sxp/popup/CommodityList/index.d.ts +28 -0
- package/lib/materials/sxp/popup/CommodityList/index.js +58 -0
- package/lib/materials/sxp/popup/CommodityList/interactionRender.d.ts +8 -0
- package/lib/materials/sxp/popup/CommodityList/interactionRender.js +13 -0
- package/lib/materials/sxp/popup/CommodityList/material.d.ts +2 -0
- package/lib/materials/sxp/popup/CommodityList/material.js +55 -0
- package/lib/materials/sxp/popup/CommodityList/settingRender.d.ts +151 -0
- package/lib/materials/sxp/popup/CommodityList/settingRender.js +209 -0
- package/lib/materials/sxp/popup/index.d.ts +1 -0
- package/lib/materials/sxp/popup/index.js +1 -0
- package/lib/materials/sxp/template/Link/index.js +2 -2
- package/lib/materials/sxp/template/MultiCommodity/index.js +2 -2
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +2 -2
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +5 -4
- package/lib/materials/sxp/template/components/CommodityGroup.d.ts +14 -0
- package/lib/materials/sxp/template/components/CommodityGroup.js +34 -0
- package/lib/materials/sxp/template/components/Img.js +1 -1
- package/lib/materials/sxp/template/components/Scroll.d.ts +2 -1
- package/lib/materials/sxp/template/components/Scroll.js +9 -2
- package/lib/materials/sxp/template/components/settingRender.js +0 -5
- package/package.json +1 -1
@@ -37,6 +37,47 @@ export default [
|
|
37
37
|
}
|
38
38
|
]
|
39
39
|
},
|
40
|
+
{
|
41
|
+
title: '多商品切换器',
|
42
|
+
child: [
|
43
|
+
{
|
44
|
+
type: 'Switch',
|
45
|
+
name: ['props', 'commodityGroup', 'open'],
|
46
|
+
label: '快速切换开关'
|
47
|
+
},
|
48
|
+
{
|
49
|
+
type: 'Group',
|
50
|
+
child: [
|
51
|
+
{
|
52
|
+
label: '居中垂直偏移',
|
53
|
+
type: 'Number',
|
54
|
+
name: ['props', 'commodityGroup', 'translateY'],
|
55
|
+
min: -1000,
|
56
|
+
addonAfter: '%',
|
57
|
+
initialValue: 0
|
58
|
+
}
|
59
|
+
]
|
60
|
+
},
|
61
|
+
{
|
62
|
+
type: 'Group',
|
63
|
+
child: [
|
64
|
+
{
|
65
|
+
label: '上边距',
|
66
|
+
name: ['props', 'commodityGroup', 'style', 'marginTop'],
|
67
|
+
type: 'Number',
|
68
|
+
addonAfter: 'px',
|
69
|
+
initialValue: 20
|
70
|
+
},
|
71
|
+
{
|
72
|
+
label: '下边距',
|
73
|
+
name: ['props', 'commodityGroup', 'style', 'marginBottom'],
|
74
|
+
type: 'Number',
|
75
|
+
addonAfter: 'px'
|
76
|
+
}
|
77
|
+
]
|
78
|
+
}
|
79
|
+
]
|
80
|
+
},
|
40
81
|
{
|
41
82
|
title: '商品文本',
|
42
83
|
child: [
|
@@ -31,6 +31,11 @@ export interface ICommodityDetailDiroNewProps {
|
|
31
31
|
};
|
32
32
|
buttonStyle?: CSSProperties;
|
33
33
|
index?: number;
|
34
|
+
commodityGroup?: {
|
35
|
+
open?: boolean;
|
36
|
+
translateY?: number;
|
37
|
+
style?: CSSProperties;
|
38
|
+
};
|
34
39
|
}
|
35
40
|
declare const _default: React.NamedExoticComponent<ICommodityDetailDiroNewProps>;
|
36
41
|
export default _default;
|
@@ -10,16 +10,14 @@ import ExpandableText from '../../../../core/components/SxpPageRender/Expandable
|
|
10
10
|
import { useEventReport } from '../../../../core/hooks/useEventReport';
|
11
11
|
import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
|
12
12
|
import { setFontForText } from '../../../../core/utils/tool';
|
13
|
+
import CommodityGroup from '../../template/components/CommodityGroup';
|
13
14
|
const CommodityDetailDiroNew = (_a) => {
|
14
15
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
15
|
-
var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index"]);
|
16
|
+
var { style, isDefault, rec, viewTime, isPost, bottom_image, tipText, swiper, commodityStyles, buttonStyle, index, commodityGroup } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "tipText", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup"]);
|
16
17
|
const [spread, setSpread] = useState(true);
|
17
18
|
const { sxpParameter } = useSxpDataSource();
|
18
19
|
const { popupDetailData, bffEventReport, isPreview, swiperRef, bffFbReport } = useSxpDataSource();
|
19
20
|
const { jumpToWeb, productView } = useEventReport();
|
20
|
-
const scrollRef = useRef(null);
|
21
|
-
const touchRef = useRef(null);
|
22
|
-
const touchMoveRef = useRef(null);
|
23
21
|
const [stopSlide, setStopSlide] = useState(false);
|
24
22
|
const [isBottom, setIsBottom] = useState(false);
|
25
23
|
const [isTop, setIsTop] = useState(true);
|
@@ -70,25 +68,6 @@ const CommodityDetailDiroNew = (_a) => {
|
|
70
68
|
const handleClickCollapse = () => {
|
71
69
|
setSpread(!spread);
|
72
70
|
};
|
73
|
-
const handleTouchStart = (event) => {
|
74
|
-
event.stopPropagation();
|
75
|
-
touchRef.current = event.touches[0].clientY;
|
76
|
-
touchMoveRef.current = true;
|
77
|
-
};
|
78
|
-
const handleTouchMove = (event) => {
|
79
|
-
var _a, _b, _c, _d;
|
80
|
-
if (touchMoveRef.current) {
|
81
|
-
touchMoveRef.current = false;
|
82
|
-
const currentY = event.touches[0].clientY;
|
83
|
-
const diff = touchRef.current - currentY;
|
84
|
-
if (diff > 0 && (isBottom || !stopSlide)) {
|
85
|
-
(_b = (_a = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _a === void 0 ? void 0 : _a.swiper) === null || _b === void 0 ? void 0 : _b.slideNext();
|
86
|
-
}
|
87
|
-
else if (diff < 0 && (isTop || !stopSlide)) {
|
88
|
-
(_d = (_c = swiperRef === null || swiperRef === void 0 ? void 0 : swiperRef.current) === null || _c === void 0 ? void 0 : _c.swiper) === null || _d === void 0 ? void 0 : _d.slidePrev();
|
89
|
-
}
|
90
|
-
}
|
91
|
-
};
|
92
71
|
const productInfoText = ({ isPost }) => {
|
93
72
|
return (React.createElement("div", { hidden: !!product && (!(product === null || product === void 0 ? void 0 : product.info) || (product === null || product === void 0 ? void 0 : product.info) === '') },
|
94
73
|
React.createElement(ExpandableText, { isPost: isPost, onClick: () => setShowModal(true), className: 'pb-commondityDiroNew-info', style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.info, foldText: tipText === null || tipText === void 0 ? void 0 : tipText.foldText, unfoldText: tipText === null || tipText === void 0 ? void 0 : tipText.unfoldText, text: (product === null || product === void 0 ? void 0 : product.info) ||
|
@@ -101,8 +80,14 @@ Made in Italy` })));
|
|
101
80
|
}
|
102
81
|
return style;
|
103
82
|
}, []);
|
83
|
+
const renderCommodityGroup = useCallback(() => {
|
84
|
+
var _a, _b, _c;
|
85
|
+
if (isPost)
|
86
|
+
return;
|
87
|
+
return (React.createElement(CommodityGroup, { products: (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts, data: commodityGroup, defImg: (_c = (_b = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _b !== void 0 ? _b : bottom_image) !== null && _c !== void 0 ? _c : '', style: { padding: '0 19px' } }));
|
88
|
+
}, []);
|
104
89
|
return (React.createElement("div", { className: 'pb-commondityDiroNew' },
|
105
|
-
React.createElement("div", Object.assign({
|
90
|
+
React.createElement("div", Object.assign({ className: css(Object.assign({}, style)) }, props),
|
106
91
|
product && ((_g = product === null || product === void 0 ? void 0 : product.homePage) === null || _g === void 0 ? void 0 : _g.length) > 0 && (React.createElement(Swiper, { height: width, modules: [Pagination, Autoplay], pagination: {
|
107
92
|
clickable: true,
|
108
93
|
bulletActiveClass: 'commondityDiroNew-swipe-item-active-bullet',
|
@@ -123,7 +108,7 @@ Made in Italy` })));
|
|
123
108
|
width: '100%',
|
124
109
|
objectFit: 'cover',
|
125
110
|
display: 'block',
|
126
|
-
objectPosition: `50% ${(swiper === null || swiper === void 0 ? void 0 : swiper.translateY) ? (swiper === null || swiper === void 0 ? void 0 : swiper.translateY) + 50 : 50}%`
|
111
|
+
objectPosition: `50% ${(swiper === null || swiper === void 0 ? void 0 : swiper.translateY) ? -(swiper === null || swiper === void 0 ? void 0 : swiper.translateY) + 50 : 50}%`
|
127
112
|
}, src: src }))));
|
128
113
|
}))),
|
129
114
|
!((_j = product === null || product === void 0 ? void 0 : product.homePage) === null || _j === void 0 ? void 0 : _j.length) && (React.createElement("div", { className: css({
|
@@ -140,6 +125,7 @@ Made in Italy` })));
|
|
140
125
|
objectFit: 'cover',
|
141
126
|
width: '100%'
|
142
127
|
}), src: (_k = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _k !== void 0 ? _k : bottom_image, alt: 'pdp image' }))),
|
128
|
+
renderCommodityGroup(),
|
143
129
|
React.createElement("div", { className: 'pb-commondityDiroNew-content' },
|
144
130
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top' },
|
145
131
|
React.createElement("div", { className: 'pb-commondityDiroNew-content-top-left' },
|
@@ -1,13 +1,15 @@
|
|
1
1
|
import settingRender from './settingRender';
|
2
2
|
import CommodityDetailDiroNewComponent from '.';
|
3
3
|
import { createMaterial } from '../../../../core/create';
|
4
|
+
import interactionRender from './interactionRender';
|
4
5
|
const CommodityDetailDiroNew = createMaterial(CommodityDetailDiroNewComponent, {
|
5
6
|
displayName: '商品详情',
|
6
7
|
icon: '',
|
7
8
|
category: 'popup',
|
8
9
|
type: 'CommodityDetailDiroNew',
|
9
10
|
related: {
|
10
|
-
settingRender
|
11
|
+
settingRender,
|
12
|
+
interactionRender
|
11
13
|
},
|
12
14
|
defaulSetting: {
|
13
15
|
props: {
|
@@ -32,6 +32,43 @@ declare const _default: ({
|
|
32
32
|
name?: undefined;
|
33
33
|
addonAfter?: undefined;
|
34
34
|
})[];
|
35
|
+
} | {
|
36
|
+
title: string;
|
37
|
+
child: ({
|
38
|
+
type: string;
|
39
|
+
name: string[];
|
40
|
+
label: string;
|
41
|
+
child?: undefined;
|
42
|
+
} | {
|
43
|
+
type: string;
|
44
|
+
child: {
|
45
|
+
label: string;
|
46
|
+
type: string;
|
47
|
+
name: string[];
|
48
|
+
min: number;
|
49
|
+
addonAfter: string;
|
50
|
+
initialValue: number;
|
51
|
+
}[];
|
52
|
+
name?: undefined;
|
53
|
+
label?: undefined;
|
54
|
+
} | {
|
55
|
+
type: string;
|
56
|
+
child: ({
|
57
|
+
label: string;
|
58
|
+
name: string[];
|
59
|
+
type: string;
|
60
|
+
addonAfter: string;
|
61
|
+
initialValue: number;
|
62
|
+
} | {
|
63
|
+
label: string;
|
64
|
+
name: string[];
|
65
|
+
type: string;
|
66
|
+
addonAfter: string;
|
67
|
+
initialValue?: undefined;
|
68
|
+
})[];
|
69
|
+
name?: undefined;
|
70
|
+
label?: undefined;
|
71
|
+
})[];
|
35
72
|
} | {
|
36
73
|
title: string;
|
37
74
|
child: {
|
@@ -37,6 +37,47 @@ export default [
|
|
37
37
|
}
|
38
38
|
]
|
39
39
|
},
|
40
|
+
{
|
41
|
+
title: '多商品切换器',
|
42
|
+
child: [
|
43
|
+
{
|
44
|
+
type: 'Switch',
|
45
|
+
name: ['props', 'commodityGroup', 'open'],
|
46
|
+
label: '快速切换开关'
|
47
|
+
},
|
48
|
+
{
|
49
|
+
type: 'Group',
|
50
|
+
child: [
|
51
|
+
{
|
52
|
+
label: '居中垂直偏移',
|
53
|
+
type: 'Number',
|
54
|
+
name: ['props', 'commodityGroup', 'translateY'],
|
55
|
+
min: -1000,
|
56
|
+
addonAfter: '%',
|
57
|
+
initialValue: 0
|
58
|
+
}
|
59
|
+
]
|
60
|
+
},
|
61
|
+
{
|
62
|
+
type: 'Group',
|
63
|
+
child: [
|
64
|
+
{
|
65
|
+
label: '上边距',
|
66
|
+
name: ['props', 'commodityGroup', 'style', 'marginTop'],
|
67
|
+
type: 'Number',
|
68
|
+
addonAfter: 'px',
|
69
|
+
initialValue: 20
|
70
|
+
},
|
71
|
+
{
|
72
|
+
label: '下边距',
|
73
|
+
name: ['props', 'commodityGroup', 'style', 'marginBottom'],
|
74
|
+
type: 'Number',
|
75
|
+
addonAfter: 'px'
|
76
|
+
}
|
77
|
+
]
|
78
|
+
}
|
79
|
+
]
|
80
|
+
},
|
40
81
|
{
|
41
82
|
title: '商品文本',
|
42
83
|
child: [
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
2
|
+
import { IEditorContext } from '../../../../core/context/EditorContext';
|
3
|
+
import { RecItemType } from '../../../../core/components/SxpPageRender/typing';
|
4
|
+
import './index.less';
|
5
|
+
export interface ICommodityListProps {
|
6
|
+
content?: string;
|
7
|
+
style?: Record<string, any>;
|
8
|
+
bgImg?: Record<string, any> | string;
|
9
|
+
onClick?: () => void;
|
10
|
+
schema?: IEditorContext['schema'];
|
11
|
+
isDefault?: boolean;
|
12
|
+
rec?: RecItemType;
|
13
|
+
viewTime?: any;
|
14
|
+
isPost?: boolean;
|
15
|
+
bottom_image?: string;
|
16
|
+
commodityStyles?: {
|
17
|
+
title: CSSProperties;
|
18
|
+
collection: CSSProperties;
|
19
|
+
price: CSSProperties;
|
20
|
+
};
|
21
|
+
buttonStyle?: CSSProperties;
|
22
|
+
index?: number;
|
23
|
+
translateY?: number;
|
24
|
+
commodityPicture?: CSSProperties;
|
25
|
+
isExternalLink?: boolean;
|
26
|
+
}
|
27
|
+
declare const _default: React.NamedExoticComponent<ICommodityListProps>;
|
28
|
+
export default _default;
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import { __rest } from "tslib";
|
2
|
+
import { css } from '@emotion/css';
|
3
|
+
import React, { memo, useCallback, useRef } from 'react';
|
4
|
+
import { useSxpDataSource } from '../../../../core/hooks';
|
5
|
+
import './index.less';
|
6
|
+
import { setFontForText } from '../../../../core/utils/tool';
|
7
|
+
import Img from '../../template/components/Img';
|
8
|
+
import EventProvider from '../../template/components/EventProvider';
|
9
|
+
const CommodityList = (_a) => {
|
10
|
+
var _b, _c;
|
11
|
+
var { style, isDefault, rec, viewTime, isPost, bottom_image, commodityStyles, buttonStyle, index, translateY = 0, commodityPicture, isExternalLink } = _a, props = __rest(_a, ["style", "isDefault", "rec", "viewTime", "isPost", "bottom_image", "commodityStyles", "buttonStyle", "index", "translateY", "commodityPicture", "isExternalLink"]);
|
12
|
+
const { sxpParameter } = useSxpDataSource();
|
13
|
+
const { popupDetailData, bffEventReport, isPreview, swiperRef, bffFbReport } = useSxpDataSource();
|
14
|
+
const curTimeRef = useRef(null);
|
15
|
+
const recData = isPost ? rec : popupDetailData;
|
16
|
+
const product = (_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [null, null, null, null];
|
17
|
+
const priceText = useCallback((product) => {
|
18
|
+
var _a, _b, _c, _d, _e;
|
19
|
+
if ((product === null || product === void 0 ? void 0 : product.currency) && (product === null || product === void 0 ? void 0 : product.price)) {
|
20
|
+
return `${(_c = (_b = (_a = product === null || product === void 0 ? void 0 : product.currency) === null || _a === void 0 ? void 0 : _a.split('-')[1]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : ''}${(_e = (_d = product === null || product === void 0 ? void 0 : product.price) === null || _d === void 0 ? void 0 : _d.toLocaleString('zh', {
|
21
|
+
minimumFractionDigits: 0
|
22
|
+
})) !== null && _e !== void 0 ? _e : ''}`;
|
23
|
+
}
|
24
|
+
else {
|
25
|
+
return '$7,000';
|
26
|
+
}
|
27
|
+
}, []);
|
28
|
+
return (React.createElement("div", { className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexDirection: 'column', gap: '10px', padding: '0 20px', marginTop: '50px' })) }, product === null || product === void 0 ? void 0 : product.map((item, index) => {
|
29
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
30
|
+
return (React.createElement(EventProvider, Object.assign({ key: index, isExternalLink: isExternalLink, rec: recData, index: index }, props, { className: css({
|
31
|
+
display: 'flex'
|
32
|
+
}) }),
|
33
|
+
React.createElement(Img, { src: (_d = (_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 : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _d !== void 0 ? _d : bottom_image, rec: recData, item: item, index: index, translateY: translateY, imgStyle: commodityPicture }),
|
34
|
+
React.createElement("div", null,
|
35
|
+
React.createElement("div", { style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title, hidden: !!item && !(item === null || item === void 0 ? void 0 : item.title), dangerouslySetInnerHTML: {
|
36
|
+
__html: setFontForText((_e = item === null || item === void 0 ? void 0 : item.title) !== null && _e !== void 0 ? _e : 'Pendant in Yellow Gold with Diamonds, Medium', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.title)
|
37
|
+
} }),
|
38
|
+
React.createElement("div", { style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection, hidden: !!item && (!(item === null || item === void 0 ? void 0 : item.collection) || (item === null || item === void 0 ? void 0 : item.collection) === ''), dangerouslySetInnerHTML: {
|
39
|
+
__html: setFontForText((_f = item === null || item === void 0 ? void 0 : item.collection) !== null && _f !== void 0 ? _f : 'Tiffany Lock', commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.collection)
|
40
|
+
} }),
|
41
|
+
React.createElement("div", { className: css({
|
42
|
+
display: 'flex',
|
43
|
+
alignItems: 'flex-end',
|
44
|
+
justifyContent: 'space-between',
|
45
|
+
width: '100%',
|
46
|
+
overflow: 'hidden'
|
47
|
+
}) },
|
48
|
+
React.createElement("div", { style: commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price, hidden: !!item && !(item === null || item === void 0 ? void 0 : item.price), dangerouslySetInnerHTML: {
|
49
|
+
__html: setFontForText(priceText(item), commodityStyles === null || commodityStyles === void 0 ? void 0 : commodityStyles.price)
|
50
|
+
} }),
|
51
|
+
React.createElement("div", { style: Object.assign(Object.assign({}, buttonStyle), { padding: '0 15px' }), dangerouslySetInnerHTML: {
|
52
|
+
__html: setFontForText((_h = (_g = item === null || item === void 0 ? void 0 : item.bindCta) === null || _g === void 0 ? void 0 : _g.enTitle) !== null && _h !== void 0 ? _h : 'Shop Now', buttonStyle)
|
53
|
+
} })))));
|
54
|
+
})));
|
55
|
+
};
|
56
|
+
export default memo(CommodityList);
|
@@ -0,0 +1,51 @@
|
|
1
|
+
import settingRender from './settingRender';
|
2
|
+
import CommodityListComponent from '.';
|
3
|
+
import { createMaterial } from '../../../../core/create';
|
4
|
+
import interactionRender from './interactionRender';
|
5
|
+
const CommodityList = createMaterial(CommodityListComponent, {
|
6
|
+
displayName: '商品列表',
|
7
|
+
icon: '',
|
8
|
+
category: 'popup',
|
9
|
+
type: 'CommodityList',
|
10
|
+
related: {
|
11
|
+
settingRender,
|
12
|
+
interactionRender
|
13
|
+
},
|
14
|
+
defaulSetting: {
|
15
|
+
props: {
|
16
|
+
commodityPicture: {
|
17
|
+
width: 100,
|
18
|
+
height: 100,
|
19
|
+
marginRight: 10
|
20
|
+
},
|
21
|
+
commodityStyles: {
|
22
|
+
price: {
|
23
|
+
color: '#000',
|
24
|
+
fontWeight: 'bold',
|
25
|
+
fontSize: 14
|
26
|
+
},
|
27
|
+
title: {
|
28
|
+
color: '#000',
|
29
|
+
fontSize: 14
|
30
|
+
},
|
31
|
+
collection: {
|
32
|
+
color: '#757575',
|
33
|
+
fontSize: 12
|
34
|
+
}
|
35
|
+
},
|
36
|
+
buttonStyle: {
|
37
|
+
backgroundColor: '#000',
|
38
|
+
fontSize: 12,
|
39
|
+
height: 30,
|
40
|
+
textAlign: 'center',
|
41
|
+
color: '#fff',
|
42
|
+
lineHeight: 2.5
|
43
|
+
}
|
44
|
+
},
|
45
|
+
style: {}
|
46
|
+
},
|
47
|
+
w: 100,
|
48
|
+
h: 40,
|
49
|
+
sort: 1
|
50
|
+
});
|
51
|
+
export { CommodityList };
|
@@ -0,0 +1,151 @@
|
|
1
|
+
declare const _default: ({
|
2
|
+
title: string;
|
3
|
+
child: ({
|
4
|
+
type: string;
|
5
|
+
label: string;
|
6
|
+
child: {
|
7
|
+
type: string;
|
8
|
+
name: string[];
|
9
|
+
addonAfter: string;
|
10
|
+
}[];
|
11
|
+
addonAfter?: undefined;
|
12
|
+
name?: undefined;
|
13
|
+
min?: undefined;
|
14
|
+
initialValue?: undefined;
|
15
|
+
} | {
|
16
|
+
type: string;
|
17
|
+
label: string;
|
18
|
+
child: ({
|
19
|
+
type: string;
|
20
|
+
name: string[];
|
21
|
+
max: number;
|
22
|
+
addonAfter?: undefined;
|
23
|
+
} | {
|
24
|
+
type: string;
|
25
|
+
name: string[];
|
26
|
+
addonAfter: string;
|
27
|
+
max: number;
|
28
|
+
})[];
|
29
|
+
addonAfter?: undefined;
|
30
|
+
name?: undefined;
|
31
|
+
min?: undefined;
|
32
|
+
initialValue?: undefined;
|
33
|
+
} | {
|
34
|
+
type: string;
|
35
|
+
label: string;
|
36
|
+
addonAfter: string;
|
37
|
+
name: string[];
|
38
|
+
child?: undefined;
|
39
|
+
min?: undefined;
|
40
|
+
initialValue?: undefined;
|
41
|
+
} | {
|
42
|
+
label: string;
|
43
|
+
type: string;
|
44
|
+
name: string[];
|
45
|
+
min: number;
|
46
|
+
addonAfter: string;
|
47
|
+
initialValue: number;
|
48
|
+
child?: undefined;
|
49
|
+
})[];
|
50
|
+
} | {
|
51
|
+
title: string;
|
52
|
+
child: {
|
53
|
+
name: string[];
|
54
|
+
type: string;
|
55
|
+
child: ({
|
56
|
+
label: string;
|
57
|
+
type: string;
|
58
|
+
options: {
|
59
|
+
label: string;
|
60
|
+
value: string;
|
61
|
+
}[];
|
62
|
+
name: string[];
|
63
|
+
initialValue: string;
|
64
|
+
child?: undefined;
|
65
|
+
} | {
|
66
|
+
type: string;
|
67
|
+
label: string;
|
68
|
+
child: {
|
69
|
+
type: string;
|
70
|
+
name: string[];
|
71
|
+
bottomText: string;
|
72
|
+
}[];
|
73
|
+
options?: undefined;
|
74
|
+
name?: undefined;
|
75
|
+
initialValue?: undefined;
|
76
|
+
} | {
|
77
|
+
type: string;
|
78
|
+
label: string;
|
79
|
+
child: ({
|
80
|
+
type: string;
|
81
|
+
name: string[];
|
82
|
+
addonAfter?: undefined;
|
83
|
+
} | {
|
84
|
+
type: string;
|
85
|
+
addonAfter: string;
|
86
|
+
name: string[];
|
87
|
+
})[];
|
88
|
+
options?: undefined;
|
89
|
+
name?: undefined;
|
90
|
+
initialValue?: undefined;
|
91
|
+
} | {
|
92
|
+
label: string;
|
93
|
+
type: string;
|
94
|
+
options?: undefined;
|
95
|
+
name?: undefined;
|
96
|
+
initialValue?: undefined;
|
97
|
+
child?: undefined;
|
98
|
+
})[];
|
99
|
+
}[];
|
100
|
+
} | {
|
101
|
+
title: string;
|
102
|
+
child: ({
|
103
|
+
type: string;
|
104
|
+
label: string;
|
105
|
+
name: string[];
|
106
|
+
child?: undefined;
|
107
|
+
} | {
|
108
|
+
type: string;
|
109
|
+
label: string;
|
110
|
+
child: ({
|
111
|
+
type: string;
|
112
|
+
name: string[];
|
113
|
+
max: number;
|
114
|
+
addonAfter?: undefined;
|
115
|
+
} | {
|
116
|
+
type: string;
|
117
|
+
name: string[];
|
118
|
+
addonAfter: string;
|
119
|
+
max: number;
|
120
|
+
})[];
|
121
|
+
name?: undefined;
|
122
|
+
} | {
|
123
|
+
type: string;
|
124
|
+
name: string[];
|
125
|
+
label?: undefined;
|
126
|
+
child?: undefined;
|
127
|
+
} | {
|
128
|
+
type: string;
|
129
|
+
label: string;
|
130
|
+
child: {
|
131
|
+
type: string;
|
132
|
+
name: string[];
|
133
|
+
bottomText: string;
|
134
|
+
}[];
|
135
|
+
name?: undefined;
|
136
|
+
} | {
|
137
|
+
type: string;
|
138
|
+
label: string;
|
139
|
+
child: ({
|
140
|
+
type: string;
|
141
|
+
name: string[];
|
142
|
+
addonAfter?: undefined;
|
143
|
+
} | {
|
144
|
+
type: string;
|
145
|
+
addonAfter: string;
|
146
|
+
name: string[];
|
147
|
+
})[];
|
148
|
+
name?: undefined;
|
149
|
+
})[];
|
150
|
+
})[];
|
151
|
+
export default _default;
|