pb-sxp-ui 1.2.10 → 1.3.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 +595 -308
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +62 -2
- package/dist/index.js +595 -308
- 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 +595 -308
- 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/FormatImage.js +1 -1
- package/es/core/components/SxpPageRender/Modal/index.js +33 -20
- package/es/core/components/SxpPageRender/Popup/index.js +2 -2
- package/es/core/components/SxpPageRender/ToggleButton/index.js +4 -1
- package/es/core/components/SxpPageRender/WaterFall/List.js +5 -14
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +5 -14
- package/es/core/components/SxpPageRender/index.d.ts +6 -1
- package/es/core/components/SxpPageRender/index.js +46 -23
- package/es/core/components/SxpPageRender/typing.d.ts +2 -0
- package/es/core/context/SxpDataSourceProvider.d.ts +3 -2
- package/es/core/context/SxpDataSourceProvider.js +27 -30
- package/es/core/hooks/useEventReport.js +9 -8
- package/es/core/utils/tool.d.ts +5 -1
- package/es/core/utils/tool.js +69 -1
- package/es/materials/sxp/HashTag/settingRender.d.ts +7 -6
- package/es/materials/sxp/HashTag/settingRender.js +0 -9
- package/es/materials/sxp/cta/AniLink/settingRender.d.ts +0 -5
- package/es/materials/sxp/cta/AniLink/settingRender.js +0 -4
- package/es/materials/sxp/popup/AppointForm/settingRender.d.ts +5 -8
- package/es/materials/sxp/popup/AppointForm/settingRender.js +15 -12
- package/es/materials/sxp/popup/CommodityDetail/index.d.ts +10 -1
- package/es/materials/sxp/popup/CommodityDetail/index.js +46 -28
- package/es/materials/sxp/popup/CommodityDetail/material.js +4 -0
- package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +19 -6
- package/es/materials/sxp/popup/CommodityDetail/settingRender.js +45 -8
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +10 -1
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +72 -46
- package/es/materials/sxp/popup/CommodityDetailDiroNew/material.js +4 -0
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +19 -6
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +45 -8
- package/es/materials/sxp/popup/CommodityList/settingRender.js +15 -4
- package/es/materials/sxp/popup/Iframe/index.d.ts +16 -0
- package/es/materials/sxp/popup/Iframe/index.js +18 -0
- package/es/materials/sxp/popup/Iframe/material.d.ts +2 -0
- package/es/materials/sxp/popup/Iframe/material.js +21 -0
- package/es/materials/sxp/popup/Iframe/settingRender.d.ts +9 -0
- package/es/materials/sxp/popup/Iframe/settingRender.js +12 -0
- package/es/materials/sxp/popup/Prompt/settingRender.js +16 -11
- 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 +5 -11
- package/es/materials/sxp/template/Link/interactionRender.d.ts +8 -0
- package/es/materials/sxp/template/Link/interactionRender.js +11 -0
- package/es/materials/sxp/template/Link/material.js +3 -1
- package/es/materials/sxp/template/Link/settingRender.js +0 -5
- package/es/materials/sxp/template/components/EventProvider.d.ts +3 -2
- package/es/materials/sxp/template/components/EventProvider.js +3 -3
- package/lib/core/components/SxpPageRender/FormatImage.js +1 -1
- package/lib/core/components/SxpPageRender/Modal/index.js +33 -20
- package/lib/core/components/SxpPageRender/Popup/index.js +2 -2
- package/lib/core/components/SxpPageRender/ToggleButton/index.js +3 -0
- package/lib/core/components/SxpPageRender/WaterFall/List.js +5 -14
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +5 -14
- package/lib/core/components/SxpPageRender/index.d.ts +6 -1
- package/lib/core/components/SxpPageRender/index.js +46 -23
- package/lib/core/components/SxpPageRender/typing.d.ts +2 -0
- package/lib/core/context/SxpDataSourceProvider.d.ts +3 -2
- package/lib/core/context/SxpDataSourceProvider.js +27 -30
- package/lib/core/hooks/useEventReport.js +9 -8
- package/lib/core/utils/tool.d.ts +5 -1
- package/lib/core/utils/tool.js +73 -1
- package/lib/materials/sxp/HashTag/settingRender.d.ts +7 -6
- package/lib/materials/sxp/HashTag/settingRender.js +0 -9
- package/lib/materials/sxp/cta/AniLink/settingRender.d.ts +0 -5
- package/lib/materials/sxp/cta/AniLink/settingRender.js +0 -4
- package/lib/materials/sxp/popup/AppointForm/settingRender.d.ts +5 -8
- package/lib/materials/sxp/popup/AppointForm/settingRender.js +15 -12
- package/lib/materials/sxp/popup/CommodityDetail/index.d.ts +10 -1
- package/lib/materials/sxp/popup/CommodityDetail/index.js +46 -28
- package/lib/materials/sxp/popup/CommodityDetail/material.js +4 -0
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +19 -6
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +45 -8
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.d.ts +10 -1
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +72 -46
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/material.js +4 -0
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +19 -6
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +45 -8
- package/lib/materials/sxp/popup/CommodityList/settingRender.js +15 -4
- package/lib/materials/sxp/popup/Iframe/index.d.ts +16 -0
- package/lib/materials/sxp/popup/Iframe/index.js +20 -0
- package/lib/materials/sxp/popup/Iframe/material.d.ts +2 -0
- package/lib/materials/sxp/popup/Iframe/material.js +25 -0
- package/lib/materials/sxp/popup/Iframe/settingRender.d.ts +9 -0
- package/lib/materials/sxp/popup/Iframe/settingRender.js +14 -0
- package/lib/materials/sxp/popup/Prompt/settingRender.js +16 -11
- 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 +5 -11
- package/lib/materials/sxp/template/Link/interactionRender.d.ts +8 -0
- package/lib/materials/sxp/template/Link/interactionRender.js +13 -0
- package/lib/materials/sxp/template/Link/material.js +3 -1
- package/lib/materials/sxp/template/Link/settingRender.js +0 -5
- package/lib/materials/sxp/template/components/EventProvider.d.ts +3 -2
- package/lib/materials/sxp/template/components/EventProvider.js +3 -3
- package/package.json +1 -1
@@ -4,7 +4,7 @@ import { DEFAULT_TAG } from '../context/SxpDataSourceProvider';
|
|
4
4
|
export function useEventReport() {
|
5
5
|
const { bffEventReport, popupDetailData, waterFallData, isFromHashtag } = useSxpDataSource();
|
6
6
|
const jumpToWeb = useCallback((data, product, cta, position) => {
|
7
|
-
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, _1;
|
7
|
+
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, _1, _2, _3, _4, _5, _6, _7, _8, _9;
|
8
8
|
let fromKName = '';
|
9
9
|
if (popupDetailData && (((_b = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProducts) === null || _b === void 0 ? void 0 : _b.length) || ((_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct))) {
|
10
10
|
fromKName = 'pdpPage';
|
@@ -21,21 +21,22 @@ export function useEventReport() {
|
|
21
21
|
else if (data === null || data === void 0 ? void 0 : data.product) {
|
22
22
|
fromKName = 'productPage';
|
23
23
|
}
|
24
|
+
const contentTags = (_p = (_m = (_h = product === null || product === void 0 ? void 0 : product.tags) !== null && _h !== void 0 ? _h : (_l = (_k = (_j = data === null || data === void 0 ? void 0 : data.video) === null || _j === void 0 ? void 0 : _j.bindProducts) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.tags) !== null && _m !== void 0 ? _m : (_o = data === null || data === void 0 ? void 0 : data.video) === null || _o === void 0 ? void 0 : _o.tags) !== null && _p !== void 0 ? _p : (_q = data === null || data === void 0 ? void 0 : data.product) === null || _q === void 0 ? void 0 : _q.tags;
|
24
25
|
bffEventReport === null || bffEventReport === void 0 ? void 0 : bffEventReport({
|
25
26
|
eventInfo: {
|
26
27
|
eventSubject: 'jumpToWeb',
|
27
28
|
eventDescription: 'User jumped to website',
|
28
|
-
productId: (
|
29
|
-
productName: (
|
29
|
+
productId: (_r = product === null || product === void 0 ? void 0 : product.itemId) !== null && _r !== void 0 ? _r : '',
|
30
|
+
productName: (_s = product === null || product === void 0 ? void 0 : product.title) !== null && _s !== void 0 ? _s : '',
|
30
31
|
price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
|
31
|
-
productCollection: (
|
32
|
+
productCollection: (_t = product === null || product === void 0 ? void 0 : product.collection) !== null && _t !== void 0 ? _t : '',
|
32
33
|
fromKName,
|
33
34
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
34
|
-
contentTags:
|
35
|
+
contentTags: contentTags ? JSON.stringify(contentTags) : '',
|
35
36
|
position: position + '',
|
36
|
-
contentId: (
|
37
|
-
ctatId: (
|
38
|
-
traceInfo: (
|
37
|
+
contentId: (_v = (_u = data === null || data === void 0 ? void 0 : data.video) === null || _u === void 0 ? void 0 : _u.itemId) !== null && _v !== void 0 ? _v : '',
|
38
|
+
ctatId: (_w = cta === null || cta === void 0 ? void 0 : cta.itemId) !== null && _w !== void 0 ? _w : '',
|
39
|
+
traceInfo: (_9 = (_6 = (_4 = (_0 = (_x = product === null || product === void 0 ? void 0 : product.traceInfo) !== null && _x !== void 0 ? _x : (_z = (_y = data === null || data === void 0 ? void 0 : data.video) === null || _y === void 0 ? void 0 : _y.bindProduct) === null || _z === void 0 ? void 0 : _z.traceInfo) !== null && _0 !== void 0 ? _0 : (_3 = (_2 = (_1 = data === null || data === void 0 ? void 0 : data.video) === null || _1 === void 0 ? void 0 : _1.bindProducts) === null || _2 === void 0 ? void 0 : _2[0]) === null || _3 === void 0 ? void 0 : _3.traceInfo) !== null && _4 !== void 0 ? _4 : (_5 = data === null || data === void 0 ? void 0 : data.product) === null || _5 === void 0 ? void 0 : _5.traceInfo) !== null && _6 !== void 0 ? _6 : (_8 = (_7 = data === null || data === void 0 ? void 0 : data.video) === null || _7 === void 0 ? void 0 : _7.bindCta) === null || _8 === void 0 ? void 0 : _8.traceInfo) !== null && _9 !== void 0 ? _9 : ''
|
39
40
|
}
|
40
41
|
});
|
41
42
|
}, [bffEventReport, popupDetailData, isFromHashtag]);
|
package/es/core/utils/tool.d.ts
CHANGED
@@ -7,4 +7,8 @@ interface IfontType {
|
|
7
7
|
'fontFamily-en': string;
|
8
8
|
}
|
9
9
|
export declare const setFontForText: (textContent?: string | null, style?: IfontType | any) => string;
|
10
|
-
|
10
|
+
declare function getBrowserInfo(): string;
|
11
|
+
declare function getSystem(): string;
|
12
|
+
declare function getDevice(): string;
|
13
|
+
declare function getCookie(val: string): string;
|
14
|
+
export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie };
|
package/es/core/utils/tool.js
CHANGED
@@ -88,4 +88,72 @@ export const setFontForText = (textContent, style) => {
|
|
88
88
|
}
|
89
89
|
return content;
|
90
90
|
};
|
91
|
-
|
91
|
+
function getBrowserInfo() {
|
92
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
93
|
+
let userAgent = self.navigator.userAgent;
|
94
|
+
if (!userAgent)
|
95
|
+
return 'Unknown';
|
96
|
+
if (/edge\/([\d\.]+)/i.exec(userAgent))
|
97
|
+
return `Edge ${(_a = /edge\/([\d\.]+)/i.exec(userAgent)) === null || _a === void 0 ? void 0 : _a[1]}`;
|
98
|
+
if (/edg\/([\d\.]+)/i.exec(userAgent))
|
99
|
+
return `Edge(Chromium) ${(_b = /edge\/([\d\.]+)/i.exec(userAgent)) === null || _b === void 0 ? void 0 : _b[1]}`;
|
100
|
+
if (/msie/i.test(userAgent))
|
101
|
+
return `Internet Explorer ${(_c = /msie ([\d\.]+)/i.exec(userAgent)) === null || _c === void 0 ? void 0 : _c[1]}`;
|
102
|
+
if (/Trident/i.test(userAgent))
|
103
|
+
return `Internet Explorer ${(_d = /rv:([\d\.]+)/i.exec(userAgent)) === null || _d === void 0 ? void 0 : _d[1]}`;
|
104
|
+
if (/chrome/i.test(userAgent))
|
105
|
+
return `Chrome ${(_e = /chrome\/([\d\.]+)/i.exec(userAgent)) === null || _e === void 0 ? void 0 : _e[1]}`;
|
106
|
+
if (/firefox/i.test(userAgent))
|
107
|
+
return `Firefox ${(_f = /firefox\/([\d\.]+)/i.exec(userAgent)) === null || _f === void 0 ? void 0 : _f[1]}`;
|
108
|
+
if (/safari/i.test(userAgent))
|
109
|
+
return `Safari ${(_g = /version\/([\d\.]+)/i.exec(userAgent)) === null || _g === void 0 ? void 0 : _g[1]}`;
|
110
|
+
return 'Unknown';
|
111
|
+
}
|
112
|
+
function getSystem() {
|
113
|
+
var _a, _b, _c;
|
114
|
+
let userAgent = self.navigator.userAgent;
|
115
|
+
if (!userAgent)
|
116
|
+
return 'Unknown';
|
117
|
+
if (/iphone/i.test(userAgent))
|
118
|
+
return `IOS ${(_a = userAgent.match(/OS\s(.*?)\slike/)) === null || _a === void 0 ? void 0 : _a[1]}`;
|
119
|
+
if (/android/i.test(userAgent))
|
120
|
+
return `Android ${(_b = userAgent.match(/Android\s(.*?)\;/)) === null || _b === void 0 ? void 0 : _b[1]}`;
|
121
|
+
if (/windows/i.test(userAgent))
|
122
|
+
return `Windows ${(_c = userAgent.match(/Windows\s(.*?)\;/)) === null || _c === void 0 ? void 0 : _c[1]}`;
|
123
|
+
if (/mac/i.test(userAgent))
|
124
|
+
return `Mac OS`;
|
125
|
+
return 'Unknown';
|
126
|
+
}
|
127
|
+
function getDevice() {
|
128
|
+
let userAgent = self.navigator.userAgent;
|
129
|
+
if (!userAgent)
|
130
|
+
return 'Unknown';
|
131
|
+
if (/iphone/i.test(userAgent))
|
132
|
+
return `iPhone`;
|
133
|
+
if (/android/i.test(userAgent)) {
|
134
|
+
var index1 = userAgent.indexOf('(');
|
135
|
+
var index2 = userAgent.indexOf(')');
|
136
|
+
if (index1 !== -1 && index2 !== -1) {
|
137
|
+
var value = userAgent.substring(index1 + 1, index2);
|
138
|
+
return `${value}`;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
if (/windows/i.test(userAgent))
|
142
|
+
return `Windows`;
|
143
|
+
if (/mac/i.test(userAgent))
|
144
|
+
return `Mac`;
|
145
|
+
return 'Unknown';
|
146
|
+
}
|
147
|
+
function getCookie(val) {
|
148
|
+
const cookies = document.cookie;
|
149
|
+
const cookieArray = cookies.split(';');
|
150
|
+
let value = null;
|
151
|
+
cookieArray.forEach((cookie) => {
|
152
|
+
const [cookieName, cookieValue] = cookie.trim().split('=');
|
153
|
+
if (cookieName === val) {
|
154
|
+
value = cookieValue;
|
155
|
+
}
|
156
|
+
});
|
157
|
+
return value !== null && value !== void 0 ? value : '';
|
158
|
+
}
|
159
|
+
export { uuid, getIndexByblockType, getBrowserInfo, getDevice, getSystem, getCookie };
|
@@ -1,4 +1,11 @@
|
|
1
1
|
declare const _default: ({
|
2
|
+
title: string;
|
3
|
+
child: {
|
4
|
+
type: string;
|
5
|
+
label: string;
|
6
|
+
name: string[];
|
7
|
+
}[];
|
8
|
+
} | {
|
2
9
|
title: string;
|
3
10
|
child: ({
|
4
11
|
type: string;
|
@@ -119,12 +126,6 @@ declare const _default: ({
|
|
119
126
|
})[];
|
120
127
|
name?: undefined;
|
121
128
|
initialValue?: undefined;
|
122
|
-
} | {
|
123
|
-
label: string;
|
124
|
-
type: string;
|
125
|
-
name: string[];
|
126
|
-
initialValue?: undefined;
|
127
|
-
child?: undefined;
|
128
129
|
})[];
|
129
130
|
})[];
|
130
131
|
export default _default;
|
@@ -99,10 +99,6 @@ export default [
|
|
99
99
|
{
|
100
100
|
label: '标题对齐',
|
101
101
|
type: 'TextAlign'
|
102
|
-
},
|
103
|
-
{
|
104
|
-
label: '间距',
|
105
|
-
type: 'TextSpace'
|
106
102
|
}
|
107
103
|
]
|
108
104
|
}
|
@@ -188,11 +184,6 @@ export default [
|
|
188
184
|
{
|
189
185
|
type: 'TextAlign',
|
190
186
|
name: ['props', 'buttonStyle']
|
191
|
-
},
|
192
|
-
{
|
193
|
-
label: '间距',
|
194
|
-
type: 'TextSpace',
|
195
|
-
name: ['props', 'buttonStyle']
|
196
187
|
}
|
197
188
|
]
|
198
189
|
},
|
@@ -64,16 +64,13 @@ declare const _default: ({
|
|
64
64
|
})[];
|
65
65
|
name?: undefined;
|
66
66
|
options?: undefined;
|
67
|
-
}
|
68
|
-
type?: undefined;
|
69
|
-
label?: undefined;
|
70
|
-
name?: undefined;
|
71
|
-
} | {
|
72
|
-
title: string;
|
73
|
-
child: {
|
67
|
+
} | {
|
74
68
|
type: string;
|
75
69
|
name: string[];
|
76
|
-
|
70
|
+
label?: undefined;
|
71
|
+
child?: undefined;
|
72
|
+
options?: undefined;
|
73
|
+
})[];
|
77
74
|
type?: undefined;
|
78
75
|
label?: undefined;
|
79
76
|
name?: undefined;
|
@@ -1,4 +1,19 @@
|
|
1
1
|
export default [
|
2
|
+
{
|
3
|
+
title: '弹窗背景',
|
4
|
+
child: [
|
5
|
+
{
|
6
|
+
type: 'Number',
|
7
|
+
label: '左右边距',
|
8
|
+
name: ['props', 'popupBg', 'horizontalMargin']
|
9
|
+
},
|
10
|
+
{
|
11
|
+
type: 'Number',
|
12
|
+
label: '下边距',
|
13
|
+
name: ['props', 'popupBg', 'bottomMargin']
|
14
|
+
}
|
15
|
+
]
|
16
|
+
},
|
2
17
|
{
|
3
18
|
type: 'Text',
|
4
19
|
label: '组件名称',
|
@@ -53,11 +68,6 @@ export default [
|
|
53
68
|
type: 'TextAlign',
|
54
69
|
name: ['textStyle']
|
55
70
|
},
|
56
|
-
{
|
57
|
-
label: '标题间距',
|
58
|
-
type: 'TextSpace',
|
59
|
-
name: ['textStyle']
|
60
|
-
},
|
61
71
|
{
|
62
72
|
label: '表单布局',
|
63
73
|
type: 'Radius',
|
@@ -116,12 +126,10 @@ export default [
|
|
116
126
|
]
|
117
127
|
},
|
118
128
|
{
|
119
|
-
label: '提交按钮文本样式',
|
120
129
|
type: 'TextStyle',
|
121
130
|
name: ['props', 'submitButtonStyle']
|
122
131
|
},
|
123
132
|
{
|
124
|
-
label: '提交按钮对齐',
|
125
133
|
type: 'TextAlign',
|
126
134
|
name: ['props', 'submitButtonStyle']
|
127
135
|
},
|
@@ -129,11 +137,6 @@ export default [
|
|
129
137
|
label: '提交按钮颜色',
|
130
138
|
type: 'Color',
|
131
139
|
name: ['props', 'submitBgColor']
|
132
|
-
},
|
133
|
-
{
|
134
|
-
label: '提交按钮间距',
|
135
|
-
type: 'TextSpace',
|
136
|
-
name: ['props', 'submitButtonStyle']
|
137
140
|
}
|
138
141
|
]
|
139
142
|
},
|
@@ -18,7 +18,7 @@ export interface ICommodityDetailProps {
|
|
18
18
|
viewTime?: any;
|
19
19
|
rec?: RecItemType;
|
20
20
|
swiper: {
|
21
|
-
dotsAlign: 'left' | 'center';
|
21
|
+
dotsAlign: 'left' | 'center' | 'right';
|
22
22
|
delay: number;
|
23
23
|
translateY?: number;
|
24
24
|
};
|
@@ -36,6 +36,15 @@ export interface ICommodityDetailProps {
|
|
36
36
|
translateY?: number;
|
37
37
|
style?: CSSProperties;
|
38
38
|
};
|
39
|
+
popupBg?: {
|
40
|
+
horizontalMargin?: number;
|
41
|
+
bottomMargin?: number;
|
42
|
+
};
|
43
|
+
iframeIcon?: string;
|
44
|
+
commodityImgRatio?: {
|
45
|
+
w: number;
|
46
|
+
h: number;
|
47
|
+
};
|
39
48
|
}
|
40
49
|
declare const _default: React.NamedExoticComponent<ICommodityDetailProps>;
|
41
50
|
export default _default;
|
@@ -12,8 +12,8 @@ import FormatImage from '../../../../core/components/SxpPageRender/FormatImage';
|
|
12
12
|
import { setFontForText } from '../../../../core/utils/tool';
|
13
13
|
import CommodityGroup from '../../template/components/CommodityGroup';
|
14
14
|
const CommodityDetail = (_a) => {
|
15
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
16
|
-
var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index, commodityGroup } = _a, props = __rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup"]);
|
15
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
16
|
+
var { content, style, bgImg, onClick, schema, isDefault, bottom_image, tipText, isPost, viewTime, rec, swiper, commodityStyles, buttonStyle, index, commodityGroup, popupBg, iframeIcon, commodityImgRatio } = _a, props = __rest(_a, ["content", "style", "bgImg", "onClick", "schema", "isDefault", "bottom_image", "tipText", "isPost", "viewTime", "rec", "swiper", "commodityStyles", "buttonStyle", "index", "commodityGroup", "popupBg", "iframeIcon", "commodityImgRatio"]);
|
17
17
|
const { sxpParameter, popupDetailData, isPreview, bffFbReport, popupCurTimeRef, checkCommodityIndexRef } = useSxpDataSource();
|
18
18
|
const { jumpToWeb, productView } = useEventReport();
|
19
19
|
const curTimeRef = useRef(null);
|
@@ -69,7 +69,8 @@ const CommodityDetail = (_a) => {
|
|
69
69
|
return '$7,000';
|
70
70
|
}
|
71
71
|
}, [product === null || product === void 0 ? void 0 : product.price, product === null || product === void 0 ? void 0 : product.currency]);
|
72
|
-
const width = isPreview ? 375 : (_t = style === null || style === void 0 ? void 0 : style.width) !== null && _t !== void 0 ? _t : window.innerWidth;
|
72
|
+
const width = (isPreview ? 375 : (_t = style === null || style === void 0 ? void 0 : style.width) !== null && _t !== void 0 ? _t : window.innerWidth) - ((_u = popupBg === null || popupBg === void 0 ? void 0 : popupBg.horizontalMargin) !== null && _u !== void 0 ? _u : 0) * 2;
|
73
|
+
const height = commodityImgRatio ? width * (commodityImgRatio.h / commodityImgRatio.w) : width;
|
73
74
|
const renderContent = ({ isPost }) => {
|
74
75
|
var _a, _b, _c, _d;
|
75
76
|
return (React.createElement("div", null,
|
@@ -116,25 +117,32 @@ const CommodityDetail = (_a) => {
|
|
116
117
|
return;
|
117
118
|
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' }, onCLick: handleClick, popupDetailData: popupDetailData, check: checkCommodityIndex }));
|
118
119
|
}, [checkCommodityIndex]);
|
120
|
+
const getDotsAlign = useMemo(() => {
|
121
|
+
const dotsAlignClass = {
|
122
|
+
left: 'commondityDetail-swiper-clickable-left',
|
123
|
+
center: 'commondityDetail-swiper-clickable-center',
|
124
|
+
right: 'commondityDetail-swiper-clickable-right'
|
125
|
+
};
|
126
|
+
return dotsAlignClass === null || dotsAlignClass === void 0 ? void 0 : dotsAlignClass[swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign];
|
127
|
+
}, [swiper === null || swiper === void 0 ? void 0 : swiper.dotsAlign]);
|
128
|
+
const iframeUrl = ((_w = (_v = data === null || data === void 0 ? void 0 : data.video) === null || _v === void 0 ? void 0 : _v.bindProduct) === null || _w === void 0 ? void 0 : _w.remark) || ((_z = (_y = (_x = data === null || data === void 0 ? void 0 : data.video) === null || _x === void 0 ? void 0 : _x.bindProducts) === null || _y === void 0 ? void 0 : _y[0]) === null || _z === void 0 ? void 0 : _z.remark) || ((_0 = data === null || data === void 0 ? void 0 : data.product) === null || _0 === void 0 ? void 0 : _0.remark);
|
119
129
|
return (React.createElement(React.Fragment, null,
|
120
130
|
React.createElement("div", Object.assign({ className: css(Object.assign({}, style)) }, props),
|
121
|
-
|
122
|
-
React.createElement(Swiper, { height:
|
131
|
+
React.createElement("div", { style: { position: 'relative' } },
|
132
|
+
product && ((_1 = product === null || product === void 0 ? void 0 : product.homePage) === null || _1 === void 0 ? void 0 : _1.length) > 0 && (React.createElement(Swiper, { height: height, modules: [Pagination, Autoplay], pagination: {
|
123
133
|
clickable: true,
|
124
134
|
bulletActiveClass: 'swipe-item-active-bullet',
|
125
|
-
clickableClass:
|
126
|
-
? 'commondityDetail-swiper-clickable-left'
|
127
|
-
: 'commondityDetail-swiper-clickable-center'
|
135
|
+
clickableClass: getDotsAlign
|
128
136
|
}, loop: true, autoplay: {
|
129
137
|
delay: (swiper === null || swiper === void 0 ? void 0 : swiper.delay) * 1000
|
130
138
|
} },
|
131
|
-
React.createElement(React.Fragment, null, (
|
139
|
+
React.createElement(React.Fragment, null, (_2 = product === null || product === void 0 ? void 0 : product.homePage) === null || _2 === void 0 ? void 0 : _2.map((src) => {
|
132
140
|
var _a;
|
133
141
|
return (React.createElement(SwiperSlide, { key: src },
|
134
142
|
React.createElement("div", { style: {
|
135
143
|
overflow: 'hidden',
|
136
144
|
width,
|
137
|
-
height
|
145
|
+
height
|
138
146
|
} },
|
139
147
|
React.createElement(FormatImage, { style: {
|
140
148
|
height: '100%',
|
@@ -143,21 +151,30 @@ const CommodityDetail = (_a) => {
|
|
143
151
|
display: 'block',
|
144
152
|
objectPosition: `50% ${(swiper === null || swiper === void 0 ? void 0 : swiper.translateY) ? (swiper === null || swiper === void 0 ? void 0 : swiper.translateY) + 50 : 50}%`
|
145
153
|
}, src: (_a = src !== null && src !== void 0 ? src : sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _a !== void 0 ? _a : bottom_image }))));
|
146
|
-
}))))
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
154
|
+
})))),
|
155
|
+
!((_3 = product === null || product === void 0 ? void 0 : product.homePage) === null || _3 === void 0 ? void 0 : _3.length) && (React.createElement("div", { className: css({
|
156
|
+
height,
|
157
|
+
width
|
158
|
+
}) },
|
159
|
+
React.createElement("img", { className: css({
|
160
|
+
objectFit: 'cover',
|
161
|
+
width: '100%',
|
162
|
+
height: '100%'
|
163
|
+
}), src: (_4 = sxpParameter === null || sxpParameter === void 0 ? void 0 : sxpParameter.bottom_image) !== null && _4 !== void 0 ? _4 : bottom_image, alt: 'pdp image' }))),
|
164
|
+
(iframeUrl && iframeIcon) ||
|
165
|
+
(!product && iframeIcon && (React.createElement("div", { style: {
|
166
|
+
padding: '5px 10px',
|
167
|
+
display: 'flex',
|
168
|
+
alignItems: 'center',
|
169
|
+
position: 'absolute',
|
170
|
+
right: '10px',
|
171
|
+
bottom: '10px',
|
172
|
+
zIndex: 1,
|
173
|
+
background: '#fff',
|
174
|
+
borderRadius: '3px'
|
175
|
+
}, onClick: () => setShow3DModal(true) },
|
176
|
+
React.createElement("img", { src: iframeIcon, alt: '3d', width: '20px', height: '20px', style: { marginRight: '5px' } }),
|
177
|
+
React.createElement("span", { style: { fontSize: '12px' } }, "Try in 3D"))))),
|
161
178
|
renderCommodityGroup(),
|
162
179
|
React.createElement("div", { className: 'pb-commondity-content' }, renderContent({ isPost }))),
|
163
180
|
renderBtn(),
|
@@ -165,10 +182,11 @@ const CommodityDetail = (_a) => {
|
|
165
182
|
React.createElement("div", { style: { paddingBottom: '80px' } }, renderContent({ isPost: false })),
|
166
183
|
renderBtn()),
|
167
184
|
React.createElement(Modal, { visible: show3DModal, padding: 0, isFullScreen: true, onClose: () => setShow3DModal(false) },
|
168
|
-
React.createElement("iframe", { src:
|
185
|
+
React.createElement("iframe", { src: iframeUrl, style: {
|
169
186
|
width: '100%',
|
170
|
-
height: 'calc(100% -
|
171
|
-
marginTop: '40px'
|
187
|
+
height: 'calc(100% - 50px)',
|
188
|
+
marginTop: '40px',
|
189
|
+
border: 'none'
|
172
190
|
} }))));
|
173
191
|
};
|
174
192
|
export default memo(CommodityDetail);
|
@@ -1,6 +1,17 @@
|
|
1
1
|
declare const _default: ({
|
2
2
|
title: string;
|
3
3
|
child: ({
|
4
|
+
type: string;
|
5
|
+
label: string;
|
6
|
+
child: {
|
7
|
+
type: string;
|
8
|
+
name: string[];
|
9
|
+
addonAfter: string;
|
10
|
+
}[];
|
11
|
+
options?: undefined;
|
12
|
+
name?: undefined;
|
13
|
+
addonAfter?: undefined;
|
14
|
+
} | {
|
4
15
|
type: string;
|
5
16
|
label: string;
|
6
17
|
options: {
|
@@ -8,15 +19,15 @@ declare const _default: ({
|
|
8
19
|
value: string;
|
9
20
|
}[];
|
10
21
|
name: string[];
|
11
|
-
addonAfter?: undefined;
|
12
22
|
child?: undefined;
|
23
|
+
addonAfter?: undefined;
|
13
24
|
} | {
|
14
25
|
type: string;
|
15
26
|
name: string[];
|
16
27
|
addonAfter: string;
|
17
28
|
label?: undefined;
|
18
|
-
options?: undefined;
|
19
29
|
child?: undefined;
|
30
|
+
options?: undefined;
|
20
31
|
} | {
|
21
32
|
type: string;
|
22
33
|
child: {
|
@@ -194,12 +205,14 @@ declare const _default: ({
|
|
194
205
|
})[];
|
195
206
|
name?: undefined;
|
196
207
|
initialValue?: undefined;
|
197
|
-
}
|
208
|
+
})[];
|
209
|
+
} | {
|
210
|
+
title: string;
|
211
|
+
child: {
|
198
212
|
label: string;
|
199
213
|
type: string;
|
200
214
|
name: string[];
|
201
|
-
|
202
|
-
|
203
|
-
})[];
|
215
|
+
text: string;
|
216
|
+
}[];
|
204
217
|
})[];
|
205
218
|
export default _default;
|
@@ -1,7 +1,38 @@
|
|
1
1
|
export default [
|
2
|
+
{
|
3
|
+
title: '弹窗背景',
|
4
|
+
child: [
|
5
|
+
{
|
6
|
+
type: 'Number',
|
7
|
+
label: '左右边距',
|
8
|
+
name: ['props', 'popupBg', 'horizontalMargin']
|
9
|
+
},
|
10
|
+
{
|
11
|
+
type: 'Number',
|
12
|
+
label: '下边距',
|
13
|
+
name: ['props', 'popupBg', 'bottomMargin']
|
14
|
+
}
|
15
|
+
]
|
16
|
+
},
|
2
17
|
{
|
3
18
|
title: '商品图片',
|
4
19
|
child: [
|
20
|
+
{
|
21
|
+
type: 'Group',
|
22
|
+
label: '宽高比',
|
23
|
+
child: [
|
24
|
+
{
|
25
|
+
type: 'Number',
|
26
|
+
name: ['props', 'commodityImgRatio', 'w'],
|
27
|
+
addonAfter: 'w'
|
28
|
+
},
|
29
|
+
{
|
30
|
+
type: 'Number',
|
31
|
+
name: ['props', 'commodityImgRatio', 'h'],
|
32
|
+
addonAfter: 'h'
|
33
|
+
}
|
34
|
+
]
|
35
|
+
},
|
5
36
|
{
|
6
37
|
type: 'Radius',
|
7
38
|
label: '轮播指示器',
|
@@ -13,6 +44,10 @@ export default [
|
|
13
44
|
{
|
14
45
|
label: '居中',
|
15
46
|
value: 'center'
|
47
|
+
},
|
48
|
+
{
|
49
|
+
label: '居右',
|
50
|
+
value: 'right'
|
16
51
|
}
|
17
52
|
],
|
18
53
|
name: ['props', 'swiper', 'dotsAlign']
|
@@ -173,10 +208,6 @@ export default [
|
|
173
208
|
label: '默认行数',
|
174
209
|
type: 'Number',
|
175
210
|
name: ['lineClamp']
|
176
|
-
},
|
177
|
-
{
|
178
|
-
label: '间距',
|
179
|
-
type: 'TextSpace'
|
180
211
|
}
|
181
212
|
]
|
182
213
|
}
|
@@ -262,11 +293,17 @@ export default [
|
|
262
293
|
{
|
263
294
|
type: 'TextAlign',
|
264
295
|
name: ['props', 'buttonStyle']
|
265
|
-
}
|
296
|
+
}
|
297
|
+
]
|
298
|
+
},
|
299
|
+
{
|
300
|
+
title: 'Iframe商品弹窗',
|
301
|
+
child: [
|
266
302
|
{
|
267
|
-
label: '
|
268
|
-
type: '
|
269
|
-
name: ['props', '
|
303
|
+
label: '弹窗按钮',
|
304
|
+
type: 'Upload',
|
305
|
+
name: ['props', 'iframeIcon'],
|
306
|
+
text: '建议尺寸:106 * 41'
|
270
307
|
}
|
271
308
|
]
|
272
309
|
}
|
@@ -18,7 +18,7 @@ export interface ICommodityDetailDiroNewProps {
|
|
18
18
|
unfoldText?: string;
|
19
19
|
};
|
20
20
|
swiper: {
|
21
|
-
dotsAlign: 'left' | 'center';
|
21
|
+
dotsAlign: 'left' | 'center' | 'right';
|
22
22
|
delay: number;
|
23
23
|
translateY?: number;
|
24
24
|
};
|
@@ -36,6 +36,15 @@ export interface ICommodityDetailDiroNewProps {
|
|
36
36
|
translateY?: number;
|
37
37
|
style?: CSSProperties;
|
38
38
|
};
|
39
|
+
popupBg?: {
|
40
|
+
horizontalMargin?: number;
|
41
|
+
bottomMargin?: number;
|
42
|
+
};
|
43
|
+
iframeIcon?: string;
|
44
|
+
commodityImgRatio?: {
|
45
|
+
w: number;
|
46
|
+
h: number;
|
47
|
+
};
|
39
48
|
}
|
40
49
|
declare const _default: React.NamedExoticComponent<ICommodityDetailDiroNewProps>;
|
41
50
|
export default _default;
|