pb-sxp-ui 1.0.5 → 1.0.7
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 +98 -83
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +98 -84
- 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 +98 -83
- 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/Modal/index.d.ts +2 -2
- package/es/core/components/SxpPageRender/Modal/index.js +12 -11
- package/es/core/components/SxpPageRender/Popup/index.js +12 -12
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +3 -4
- package/es/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/es/core/context/EditorContext.d.ts +7 -5
- package/es/core/context/EditorContext.js +10 -25
- package/es/core/hooks/useEventReport.js +1 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/materials/sxp/HashTag/settingRender.d.ts +4 -1
- package/es/materials/sxp/HashTag/settingRender.js +7 -3
- package/es/materials/sxp/defaultSetting.d.ts +11 -0
- package/es/materials/sxp/defaultSetting.js +7 -0
- package/es/materials/sxp/popup/AppointForm/index.js +1 -2
- package/es/materials/sxp/popup/AppointForm/material.js +0 -1
- package/es/materials/sxp/popup/AppointForm/settingRender.d.ts +3 -0
- package/es/materials/sxp/popup/AppointForm/settingRender.js +4 -1
- package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +4 -1
- package/es/materials/sxp/popup/CommodityDetail/settingRender.js +7 -3
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +4 -1
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +7 -3
- package/es/materials/sxp/popup/Prompt/index.js +0 -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 +2 -2
- package/es/materials/sxp/template/components/EventProvider.js +2 -2
- package/es/materials/sxp/template/components/settingRender.d.ts +6 -0
- package/es/materials/sxp/template/components/settingRender.js +8 -4
- package/lib/core/components/SxpPageRender/Modal/index.d.ts +2 -2
- package/lib/core/components/SxpPageRender/Modal/index.js +11 -10
- package/lib/core/components/SxpPageRender/Popup/index.js +12 -12
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +2 -3
- package/lib/core/components/SxpPageRender/WaterFall/index.js +1 -1
- package/lib/core/context/EditorContext.d.ts +7 -5
- package/lib/core/context/EditorContext.js +10 -25
- package/lib/core/hooks/useEventReport.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/lib/materials/sxp/HashTag/settingRender.d.ts +4 -1
- package/lib/materials/sxp/HashTag/settingRender.js +7 -3
- package/lib/materials/sxp/defaultSetting.d.ts +11 -0
- package/lib/materials/sxp/defaultSetting.js +10 -0
- package/lib/materials/sxp/popup/AppointForm/index.js +0 -1
- package/lib/materials/sxp/popup/AppointForm/material.js +0 -1
- package/lib/materials/sxp/popup/AppointForm/settingRender.d.ts +3 -0
- package/lib/materials/sxp/popup/AppointForm/settingRender.js +4 -1
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +4 -1
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +7 -3
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +4 -1
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +7 -3
- package/lib/materials/sxp/popup/Prompt/index.js +0 -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 +2 -2
- package/lib/materials/sxp/template/components/EventProvider.js +2 -2
- package/lib/materials/sxp/template/components/settingRender.d.ts +6 -0
- package/lib/materials/sxp/template/components/settingRender.js +8 -4
- package/package.json +1 -1
- package/es/core/components/SxpPageRender/ProductInfo/index.d.ts +0 -14
- package/es/core/components/SxpPageRender/ProductInfo/index.js +0 -55
- package/lib/core/components/SxpPageRender/ProductInfo/index.d.ts +0 -14
- package/lib/core/components/SxpPageRender/ProductInfo/index.js +0 -58
@@ -8,7 +8,7 @@ const EventProvider = (_a) => {
|
|
8
8
|
var { rec, children, className, onClick, style, isExternalLink = false } = _a, props = __rest(_a, ["rec", "children", "className", "onClick", "style", "isExternalLink"]);
|
9
9
|
const ref = useRef(null);
|
10
10
|
const isOnScreen = useOnScreen(ref);
|
11
|
-
const {
|
11
|
+
const { popup } = useEditor();
|
12
12
|
const { setPopupDetailData, ctaEvent } = useSxpDataSource();
|
13
13
|
const { jumpToWeb } = useEventReport();
|
14
14
|
useEffect(() => {
|
@@ -40,7 +40,7 @@ const EventProvider = (_a) => {
|
|
40
40
|
else {
|
41
41
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
42
42
|
}
|
43
|
-
},
|
43
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
44
44
|
return (React.createElement("div", { ref: ref, className: className, style: style, onClick: handleClick }, children));
|
45
45
|
};
|
46
46
|
export default memo(EventProvider);
|
@@ -50,6 +50,7 @@ declare const _default: ({
|
|
50
50
|
type: string;
|
51
51
|
name: string[];
|
52
52
|
options?: undefined;
|
53
|
+
initialValue?: undefined;
|
53
54
|
addonAfter?: undefined;
|
54
55
|
} | {
|
55
56
|
type: string;
|
@@ -58,12 +59,14 @@ declare const _default: ({
|
|
58
59
|
value: string;
|
59
60
|
}[];
|
60
61
|
name: string[];
|
62
|
+
initialValue: string;
|
61
63
|
addonAfter?: undefined;
|
62
64
|
} | {
|
63
65
|
type: string;
|
64
66
|
addonAfter: string;
|
65
67
|
name: string[];
|
66
68
|
options?: undefined;
|
69
|
+
initialValue?: undefined;
|
67
70
|
})[];
|
68
71
|
name?: undefined;
|
69
72
|
} | {
|
@@ -101,6 +104,7 @@ declare const _default: ({
|
|
101
104
|
type: string;
|
102
105
|
name: string[];
|
103
106
|
options?: undefined;
|
107
|
+
initialValue?: undefined;
|
104
108
|
addonAfter?: undefined;
|
105
109
|
} | {
|
106
110
|
type: string;
|
@@ -109,12 +113,14 @@ declare const _default: ({
|
|
109
113
|
value: string;
|
110
114
|
}[];
|
111
115
|
name: string[];
|
116
|
+
initialValue: string;
|
112
117
|
addonAfter?: undefined;
|
113
118
|
} | {
|
114
119
|
type: string;
|
115
120
|
addonAfter: string;
|
116
121
|
name: string[];
|
117
122
|
options?: undefined;
|
123
|
+
initialValue?: undefined;
|
118
124
|
})[];
|
119
125
|
name?: undefined;
|
120
126
|
})[];
|
@@ -1,3 +1,5 @@
|
|
1
|
+
var _a, _b;
|
2
|
+
import { fontOptions } from '../../defaultSetting';
|
1
3
|
export default [
|
2
4
|
{
|
3
5
|
title: '主题样式',
|
@@ -112,8 +114,9 @@ export default [
|
|
112
114
|
},
|
113
115
|
{
|
114
116
|
type: 'Select',
|
115
|
-
options:
|
116
|
-
name: ['props', 'ctaTempStyles', 'title', 'fontFamily']
|
117
|
+
options: fontOptions,
|
118
|
+
name: ['props', 'ctaTempStyles', 'title', 'fontFamily'],
|
119
|
+
initialValue: (_a = fontOptions === null || fontOptions === void 0 ? void 0 : fontOptions[0]) === null || _a === void 0 ? void 0 : _a.value
|
117
120
|
},
|
118
121
|
{
|
119
122
|
type: 'Number',
|
@@ -190,8 +193,9 @@ export default [
|
|
190
193
|
},
|
191
194
|
{
|
192
195
|
type: 'Select',
|
193
|
-
options:
|
194
|
-
name: ['props', 'ctaTempStyles', 'ctaTitle', 'fontFamily']
|
196
|
+
options: fontOptions,
|
197
|
+
name: ['props', 'ctaTempStyles', 'ctaTitle', 'fontFamily'],
|
198
|
+
initialValue: (_b = fontOptions === null || fontOptions === void 0 ? void 0 : fontOptions[0]) === null || _b === void 0 ? void 0 : _b.value
|
195
199
|
},
|
196
200
|
{
|
197
201
|
type: 'Number',
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
2
|
-
import {
|
2
|
+
import { IPopupType } from '../../../../core/context/EditorContext';
|
3
3
|
interface IModalProps {
|
4
4
|
visible?: boolean;
|
5
|
+
popup?: IPopupType;
|
5
6
|
padding?: number | string;
|
6
7
|
modalStyle?: CSSProperties;
|
7
|
-
popupAniData?: IPopupAniType;
|
8
8
|
onClose?: () => void;
|
9
9
|
}
|
10
10
|
declare const _default: React.NamedExoticComponent<React.PropsWithChildren<IModalProps>>;
|
@@ -4,11 +4,9 @@ const tslib_1 = require("tslib");
|
|
4
4
|
const lodash_1 = require("lodash");
|
5
5
|
const react_1 = tslib_1.__importStar(require("react"));
|
6
6
|
const ReactDOM = tslib_1.__importStar(require("react-dom"));
|
7
|
-
const hooks_1 = require("../../../../core/hooks");
|
8
7
|
const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
|
9
|
-
const Modal = ({ visible, onClose, children, modalStyle, padding,
|
10
|
-
|
11
|
-
const cssAni = popupAniData !== null && popupAniData !== void 0 ? popupAniData : popupAni;
|
8
|
+
const Modal = ({ visible, onClose, children, modalStyle, padding, popup }) => {
|
9
|
+
var _a;
|
12
10
|
const [isShow, setIsShow] = (0, react_1.useState)(false);
|
13
11
|
const modalEleRef = (0, react_1.useRef)(null);
|
14
12
|
(0, react_1.useEffect)(() => {
|
@@ -23,28 +21,31 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popupAniData }
|
|
23
21
|
parentNode === null || parentNode === void 0 ? void 0 : parentNode.appendChild(modalEleRef.current);
|
24
22
|
}
|
25
23
|
}, []);
|
24
|
+
const isOpen = (0, react_1.useMemo)(() => {
|
25
|
+
return ((popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') || visible;
|
26
|
+
}, [visible, popup]);
|
26
27
|
(0, react_1.useEffect)(() => {
|
27
|
-
if (
|
28
|
+
if (isOpen) {
|
28
29
|
setIsShow(true);
|
29
30
|
}
|
30
31
|
else {
|
31
32
|
setTimeout(() => {
|
32
33
|
setIsShow(false);
|
33
|
-
},
|
34
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
34
35
|
}
|
35
|
-
}, [
|
36
|
+
}, [isOpen, popup]);
|
36
37
|
if (!modalEleRef.current)
|
37
38
|
return null;
|
38
39
|
const handleClose = (0, lodash_1.debounce)(() => {
|
39
40
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
40
41
|
}, 300);
|
41
|
-
return ReactDOM.createPortal(react_1.default.createElement("div", { className: 'modal-bg', style: Object.assign({ display:
|
42
|
-
react_1.default.createElement("div", { className: `modal-container ${
|
42
|
+
return ReactDOM.createPortal(react_1.default.createElement(react_1.default.Fragment, null, isShow && (react_1.default.createElement("div", { className: 'modal-bg', style: Object.assign({ display: 'flex', backgroundColor: isOpen ? 'rgba(0, 0, 0, 0.7)' : 'rgba(0, 0, 0, 0)' }, modalStyle), onClick: handleClose },
|
43
|
+
react_1.default.createElement("div", { className: `modal-container ${isOpen ? 'modal-popIn' : 'modal-popOut'}`, style: { padding, animationDuration: ((_a = popup === null || popup === void 0 ? void 0 : popup.duration) !== null && _a !== void 0 ? _a : 0) / 1000 + 's' }, onClick: (e) => {
|
43
44
|
e.stopPropagation();
|
44
45
|
e.preventDefault();
|
45
46
|
} },
|
46
47
|
react_1.default.createElement("div", { onClick: onClose, className: 'modal-icon-wrapper' },
|
47
48
|
react_1.default.createElement("img", { src: closeIcon, alt: 'close', className: 'modal-icon' })),
|
48
|
-
children)), modalEleRef.current);
|
49
|
+
children)))), modalEleRef.current);
|
49
50
|
};
|
50
51
|
exports.default = (0, react_1.memo)(Modal);
|
@@ -7,10 +7,10 @@ const hooks_1 = require("../../../../core/hooks");
|
|
7
7
|
const withBindDataSource_1 = tslib_1.__importDefault(require("../../../../core/hoc/withBindDataSource"));
|
8
8
|
const useEventReport_1 = require("../../../../core/hooks/useEventReport");
|
9
9
|
const Popup = () => {
|
10
|
-
const { schema, resolver, popup
|
10
|
+
const { schema, resolver, popup } = (0, hooks_1.useEditor)();
|
11
11
|
const { setPopupDetailData, popupDetailData, bffEventReport } = (0, hooks_1.useSxpDataSource)();
|
12
12
|
const { productView } = (0, useEventReport_1.useEventReport)();
|
13
|
-
const [visible, setVisible] = (0, react_1.useState)(
|
13
|
+
const [visible, setVisible] = (0, react_1.useState)();
|
14
14
|
const curTimeRef = (0, react_1.useRef)(null);
|
15
15
|
(0, react_1.useEffect)(() => {
|
16
16
|
const initTime = () => {
|
@@ -23,33 +23,33 @@ const Popup = () => {
|
|
23
23
|
};
|
24
24
|
}, []);
|
25
25
|
(0, react_1.useEffect)(() => {
|
26
|
-
if (popup && popup !== '') {
|
26
|
+
if (popup && (popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') {
|
27
27
|
curTimeRef.current = new Date();
|
28
|
-
setVisible(
|
28
|
+
setVisible(popup);
|
29
29
|
}
|
30
30
|
}, [popup]);
|
31
31
|
const handleClose = () => {
|
32
|
-
var _a, _b, _c;
|
33
|
-
if (!popup || popup === '' || !visible || new Date() - curTimeRef.current < (
|
32
|
+
var _a, _b, _c, _d;
|
33
|
+
if (!popup || (popup === null || popup === void 0 ? void 0 : popup.id) === '' || !visible || new Date() - curTimeRef.current < ((_a = popup === null || popup === void 0 ? void 0 : popup.duration) !== null && _a !== void 0 ? _a : 0)) {
|
34
34
|
return;
|
35
35
|
}
|
36
|
-
setVisible(
|
36
|
+
setVisible(Object.assign(Object.assign({}, popup), { id: '' }));
|
37
37
|
const data = popupDetailData;
|
38
|
-
const product = (
|
39
|
-
const cta = (
|
38
|
+
const product = (_b = data === null || data === void 0 ? void 0 : data.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
|
39
|
+
const cta = (_d = (_c = data === null || data === void 0 ? void 0 : data.video) === null || _c === void 0 ? void 0 : _c.bindProduct) === null || _d === void 0 ? void 0 : _d.bindCta;
|
40
40
|
if (product && cta) {
|
41
41
|
productView(data, product, cta, curTimeRef.current);
|
42
42
|
}
|
43
43
|
setTimeout(() => {
|
44
44
|
window === null || window === void 0 ? void 0 : window.sxpPopup('');
|
45
45
|
setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(null);
|
46
|
-
},
|
46
|
+
}, popup === null || popup === void 0 ? void 0 : popup.duration);
|
47
47
|
};
|
48
48
|
const renderPopupDetail = (0, react_1.useMemo)(() => {
|
49
49
|
var _a, _b, _c;
|
50
50
|
return (_c = (_b = (_a = schema === null || schema === void 0 ? void 0 : schema.sxpPageConf) === null || _a === void 0 ? void 0 : _a.globalConfig) === null || _b === void 0 ? void 0 : _b.popupList) === null || _c === void 0 ? void 0 : _c.map((value, index) => {
|
51
51
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
52
|
-
if ((value === null || value === void 0 ? void 0 : value.id) === popup) {
|
52
|
+
if ((value === null || value === void 0 ? void 0 : value.id) === (popup === null || popup === void 0 ? void 0 : popup.id)) {
|
53
53
|
const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
|
54
54
|
const Component = (0, withBindDataSource_1.default)(t);
|
55
55
|
const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
|
@@ -60,6 +60,6 @@ const Popup = () => {
|
|
60
60
|
}
|
61
61
|
});
|
62
62
|
}, [schema, popup, resolver]);
|
63
|
-
return (react_1.default.createElement(Modal_1.default, {
|
63
|
+
return (react_1.default.createElement(Modal_1.default, { popup: visible, onClose: handleClose, padding: 0, modalStyle: { position: 'fixed' } }, renderPopupDetail));
|
64
64
|
};
|
65
65
|
exports.default = Popup;
|
@@ -147,7 +147,6 @@ const WaterfallFlowItem = (props) => {
|
|
147
147
|
function WaterfallList(_a) {
|
148
148
|
var _b, _c, _d, _e, _f, _g, _h;
|
149
149
|
var { reportTagsView } = _a, props = tslib_1.__rest(_a, ["reportTagsView"]);
|
150
|
-
const { popupAni } = (0, hooks_1.useEditor)();
|
151
150
|
const { waterFallData, getRecommendVideos, loadingImage } = (0, hooks_1.useSxpDataSource)();
|
152
151
|
const scrollParent = (0, react_1.useRef)(null);
|
153
152
|
const [scrollTop, setScrollTop] = (0, react_1.useState)(0);
|
@@ -165,7 +164,7 @@ function WaterfallList(_a) {
|
|
165
164
|
const [frameInfo, setFrameInfoInfo] = (0, react_1.useState)({ width: 0 });
|
166
165
|
const rowsNum = (0, react_1.useMemo)(() => {
|
167
166
|
const width = frameInfo.width || 0;
|
168
|
-
if (width >=
|
167
|
+
if (width >= 1200) {
|
169
168
|
return 6;
|
170
169
|
}
|
171
170
|
else if (width >= 768 && width <= 1199) {
|
@@ -174,7 +173,7 @@ function WaterfallList(_a) {
|
|
174
173
|
else {
|
175
174
|
return 2;
|
176
175
|
}
|
177
|
-
}, [frameInfo
|
176
|
+
}, [frameInfo]);
|
178
177
|
const unitWidth = (0, react_1.useMemo)(() => {
|
179
178
|
return frameInfo.width / rowsNum - 2;
|
180
179
|
}, [rowsNum, frameInfo]);
|
@@ -69,7 +69,7 @@ const WaterFall = (props) => {
|
|
69
69
|
relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
|
70
70
|
position: rec === null || rec === void 0 ? void 0 : rec.position,
|
71
71
|
contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
|
72
|
-
traceInfo:
|
72
|
+
traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
|
73
73
|
hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
|
74
74
|
fromKName,
|
75
75
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
@@ -16,9 +16,12 @@ export interface IPageParams {
|
|
16
16
|
mp_rul?: string;
|
17
17
|
}
|
18
18
|
export type IPopupAniType = {
|
19
|
-
name
|
20
|
-
duration
|
19
|
+
name?: string;
|
20
|
+
duration?: number;
|
21
21
|
};
|
22
|
+
export type IPopupType = {
|
23
|
+
id: string;
|
24
|
+
} & IPopupAniType;
|
22
25
|
export interface IEditorContext {
|
23
26
|
resolver: Record<string, MaterialComponet>;
|
24
27
|
currentNode: any | null;
|
@@ -57,9 +60,8 @@ export interface IEditorContext {
|
|
57
60
|
setUndoStack?: React.Dispatch<React.SetStateAction<any[]>>;
|
58
61
|
setRedoStack?: React.Dispatch<React.SetStateAction<any[]>>;
|
59
62
|
getCurPageConf?: any;
|
60
|
-
popup:
|
61
|
-
setPopup: React.Dispatch<React.SetStateAction<
|
62
|
-
popupAni: IPopupAniType;
|
63
|
+
popup: IPopupType;
|
64
|
+
setPopup: React.Dispatch<React.SetStateAction<IPopupType>>;
|
63
65
|
}
|
64
66
|
export interface IEditorCoreProps {
|
65
67
|
resolver: Record<string, MaterialComponet>;
|
@@ -29,6 +29,11 @@ const item = {
|
|
29
29
|
pathArr: [0],
|
30
30
|
positionY: 0
|
31
31
|
};
|
32
|
+
const popupInit = {
|
33
|
+
id: '',
|
34
|
+
duration: 0,
|
35
|
+
name: 'none'
|
36
|
+
};
|
32
37
|
exports.EditorContext = react_1.default.createContext({
|
33
38
|
resolver: {},
|
34
39
|
currentNode: null,
|
@@ -48,12 +53,8 @@ exports.EditorContext = react_1.default.createContext({
|
|
48
53
|
prePiontData: [],
|
49
54
|
undoStack: [item],
|
50
55
|
redoStack: [],
|
51
|
-
popup:
|
52
|
-
setPopup: () => { }
|
53
|
-
popupAni: {
|
54
|
-
name: 'none',
|
55
|
-
duration: 0
|
56
|
-
}
|
56
|
+
popup: popupInit,
|
57
|
+
setPopup: () => { }
|
57
58
|
});
|
58
59
|
const EditorCore = (0, react_1.forwardRef)(({ children, resolver, isSsr, schema, enableDataSource = true, utmVal }, ref) => {
|
59
60
|
const [currentNode, setCurrentNode] = (0, react_1.useState)(null);
|
@@ -71,25 +72,10 @@ const EditorCore = (0, react_1.forwardRef)(({ children, resolver, isSsr, schema,
|
|
71
72
|
const [prePiontData, setPrePiontData] = (0, react_1.useState)([item]);
|
72
73
|
const [undoStack, setUndoStack] = (0, react_1.useState)([[item]]);
|
73
74
|
const [redoStack, setRedoStack] = (0, react_1.useState)([]);
|
74
|
-
const [popup, setPopup] = (0, react_1.useState)(
|
75
|
-
const [popupAni, setPopupAni] = (0, react_1.useState)({
|
76
|
-
name: 'none',
|
77
|
-
duration: 0
|
78
|
-
});
|
75
|
+
const [popup, setPopup] = (0, react_1.useState)(popupInit);
|
79
76
|
typeof window !== 'undefined' &&
|
80
77
|
(window.sxpPopup = (type, aniType) => {
|
81
|
-
|
82
|
-
setPopupAni(Object.assign(Object.assign({}, popupAni), aniType));
|
83
|
-
}
|
84
|
-
else {
|
85
|
-
setPopupAni({
|
86
|
-
name: 'none',
|
87
|
-
duration: 0
|
88
|
-
});
|
89
|
-
}
|
90
|
-
setTimeout(() => {
|
91
|
-
setPopup(type);
|
92
|
-
});
|
78
|
+
setPopup(Object.assign(Object.assign(Object.assign({}, popupInit), { id: type }), aniType));
|
93
79
|
});
|
94
80
|
typeof window !== 'undefined' &&
|
95
81
|
(window.getJointUtmLink = (url) => {
|
@@ -158,8 +144,7 @@ const EditorCore = (0, react_1.forwardRef)(({ children, resolver, isSsr, schema,
|
|
158
144
|
setUndoStack,
|
159
145
|
getCurPageConf,
|
160
146
|
popup,
|
161
|
-
setPopup
|
162
|
-
popupAni
|
147
|
+
setPopup
|
163
148
|
} },
|
164
149
|
react_1.default.createElement(DataSourceProvider_1.default, { isSsr: isSsr, enable: enableDataSource }, children)));
|
165
150
|
});
|
@@ -54,7 +54,7 @@ function useEventReport() {
|
|
54
54
|
eventInfo: {
|
55
55
|
productId: product === null || product === void 0 ? void 0 : product.itemId,
|
56
56
|
productName: product === null || product === void 0 ? void 0 : product.title,
|
57
|
-
price: (product === null || product === void 0 ? void 0 : product.price) + '',
|
57
|
+
price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
|
58
58
|
productCollection: product === null || product === void 0 ? void 0 : product.collection,
|
59
59
|
fromKName,
|
60
60
|
fromKPage: location === null || location === void 0 ? void 0 : location.href,
|
package/lib/index.d.ts
CHANGED
@@ -7,4 +7,5 @@ export { default as SxpDataSourceProvider } from './core/context/SxpDataSourcePr
|
|
7
7
|
export { default as SxpPageCore } from './core/components/SxpPageCore';
|
8
8
|
export { default as EditorDataProvider } from './core/context/EditorDataProvider';
|
9
9
|
export { useEditorDataProvider } from './core/context/EditorDataProvider';
|
10
|
+
export { default as defaultSetting } from './materials/sxp/defaultSetting';
|
10
11
|
export default Pagebuilder;
|
package/lib/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.useEditorDataProvider = exports.EditorDataProvider = exports.SxpPageCore = exports.SxpDataSourceProvider = exports.Modal = exports.SxpPageRender = exports.materials = exports.core = void 0;
|
3
|
+
exports.defaultSetting = exports.useEditorDataProvider = exports.EditorDataProvider = exports.SxpPageCore = exports.SxpDataSourceProvider = exports.Modal = exports.SxpPageRender = exports.materials = exports.core = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const Pagebuilder_1 = require("./core/Pagebuilder");
|
6
6
|
exports.core = tslib_1.__importStar(require("./core"));
|
@@ -17,4 +17,6 @@ var EditorDataProvider_1 = require("./core/context/EditorDataProvider");
|
|
17
17
|
Object.defineProperty(exports, "EditorDataProvider", { enumerable: true, get: function () { return tslib_1.__importDefault(EditorDataProvider_1).default; } });
|
18
18
|
var EditorDataProvider_2 = require("./core/context/EditorDataProvider");
|
19
19
|
Object.defineProperty(exports, "useEditorDataProvider", { enumerable: true, get: function () { return EditorDataProvider_2.useEditorDataProvider; } });
|
20
|
+
var defaultSetting_1 = require("./materials/sxp/defaultSetting");
|
21
|
+
Object.defineProperty(exports, "defaultSetting", { enumerable: true, get: function () { return tslib_1.__importDefault(defaultSetting_1).default; } });
|
20
22
|
exports.default = Pagebuilder_1.Pagebuilder;
|
@@ -33,6 +33,7 @@ declare const _default: ({
|
|
33
33
|
type: string;
|
34
34
|
name: string[];
|
35
35
|
options?: undefined;
|
36
|
+
initialValue?: undefined;
|
36
37
|
addonAfter?: undefined;
|
37
38
|
} | {
|
38
39
|
type: string;
|
@@ -41,12 +42,14 @@ declare const _default: ({
|
|
41
42
|
value: string;
|
42
43
|
}[];
|
43
44
|
name: string[];
|
45
|
+
initialValue: string;
|
44
46
|
addonAfter?: undefined;
|
45
47
|
} | {
|
46
48
|
type: string;
|
47
49
|
addonAfter: string;
|
48
50
|
name: string[];
|
49
51
|
options?: undefined;
|
52
|
+
initialValue?: undefined;
|
50
53
|
})[];
|
51
54
|
options?: undefined;
|
52
55
|
name?: undefined;
|
@@ -106,7 +109,7 @@ declare const _default: ({
|
|
106
109
|
label: string;
|
107
110
|
value: string;
|
108
111
|
}[];
|
109
|
-
initialValue
|
112
|
+
initialValue: string;
|
110
113
|
addonAfter?: undefined;
|
111
114
|
} | {
|
112
115
|
type: string;
|
@@ -1,5 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
+
var _a, _b;
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
const defaultSetting_1 = require("../defaultSetting");
|
3
5
|
exports.default = [
|
4
6
|
{
|
5
7
|
title: '卡片样式',
|
@@ -58,8 +60,9 @@ exports.default = [
|
|
58
60
|
},
|
59
61
|
{
|
60
62
|
type: 'Select',
|
61
|
-
options:
|
62
|
-
name: ['fontFamily']
|
63
|
+
options: defaultSetting_1.fontOptions,
|
64
|
+
name: ['fontFamily'],
|
65
|
+
initialValue: (_a = defaultSetting_1.fontOptions === null || defaultSetting_1.fontOptions === void 0 ? void 0 : defaultSetting_1.fontOptions[0]) === null || _a === void 0 ? void 0 : _a.value
|
63
66
|
},
|
64
67
|
{
|
65
68
|
type: 'Number',
|
@@ -133,7 +136,8 @@ exports.default = [
|
|
133
136
|
{
|
134
137
|
type: 'Select',
|
135
138
|
name: ['props', 'buttonStyle', 'fontFamily'],
|
136
|
-
options:
|
139
|
+
options: defaultSetting_1.fontOptions,
|
140
|
+
initialValue: (_b = defaultSetting_1.fontOptions === null || defaultSetting_1.fontOptions === void 0 ? void 0 : defaultSetting_1.fontOptions[0]) === null || _b === void 0 ? void 0 : _b.value
|
137
141
|
},
|
138
142
|
{
|
139
143
|
type: 'Number',
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.fontOptions = void 0;
|
4
|
+
exports.fontOptions = [
|
5
|
+
{ label: '应用字体', value: 'appFont' },
|
6
|
+
{ label: '黑体', value: '黑体' }
|
7
|
+
];
|
8
|
+
exports.default = {
|
9
|
+
fontOptions: exports.fontOptions
|
10
|
+
};
|
@@ -9,7 +9,6 @@ const hooks_1 = require("../../../../core/hooks");
|
|
9
9
|
require("./index.less");
|
10
10
|
const AppointForm = (_a) => {
|
11
11
|
var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, onClick } = _a, props = tslib_1.__rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "onClick"]);
|
12
|
-
const { setPopup } = (0, hooks_1.useEditor)();
|
13
12
|
const { submitForm } = (0, hooks_1.useSxpDataSource)();
|
14
13
|
const formRef = (0, react_1.useRef)();
|
15
14
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
@@ -19,6 +19,7 @@ declare const _default: ({
|
|
19
19
|
type: string;
|
20
20
|
name: string[];
|
21
21
|
options?: undefined;
|
22
|
+
initialValue?: undefined;
|
22
23
|
addonAfter?: undefined;
|
23
24
|
} | {
|
24
25
|
type: string;
|
@@ -27,12 +28,14 @@ declare const _default: ({
|
|
27
28
|
label: string;
|
28
29
|
value: string;
|
29
30
|
}[];
|
31
|
+
initialValue: string;
|
30
32
|
addonAfter?: undefined;
|
31
33
|
} | {
|
32
34
|
type: string;
|
33
35
|
name: string[];
|
34
36
|
addonAfter: string;
|
35
37
|
options?: undefined;
|
38
|
+
initialValue?: undefined;
|
36
39
|
})[];
|
37
40
|
name?: undefined;
|
38
41
|
options?: undefined;
|
@@ -1,5 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
+
var _a;
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
const defaultSetting_1 = require("../../defaultSetting");
|
3
5
|
exports.default = [
|
4
6
|
{
|
5
7
|
type: 'Text',
|
@@ -25,7 +27,8 @@ exports.default = [
|
|
25
27
|
{
|
26
28
|
type: 'Select',
|
27
29
|
name: ['textStyle', 'fontFamily'],
|
28
|
-
options:
|
30
|
+
options: defaultSetting_1.fontOptions,
|
31
|
+
initialValue: (_a = defaultSetting_1.fontOptions === null || defaultSetting_1.fontOptions === void 0 ? void 0 : defaultSetting_1.fontOptions[0]) === null || _a === void 0 ? void 0 : _a.value
|
29
32
|
},
|
30
33
|
{
|
31
34
|
type: 'Number',
|
@@ -38,6 +38,7 @@ declare const _default: ({
|
|
38
38
|
type: string;
|
39
39
|
name: string[];
|
40
40
|
options?: undefined;
|
41
|
+
initialValue?: undefined;
|
41
42
|
addonAfter?: undefined;
|
42
43
|
} | {
|
43
44
|
type: string;
|
@@ -46,12 +47,14 @@ declare const _default: ({
|
|
46
47
|
value: string;
|
47
48
|
}[];
|
48
49
|
name: string[];
|
50
|
+
initialValue: string;
|
49
51
|
addonAfter?: undefined;
|
50
52
|
} | {
|
51
53
|
type: string;
|
52
54
|
addonAfter: string;
|
53
55
|
name: string[];
|
54
56
|
options?: undefined;
|
57
|
+
initialValue?: undefined;
|
55
58
|
})[];
|
56
59
|
options?: undefined;
|
57
60
|
name?: undefined;
|
@@ -118,7 +121,7 @@ declare const _default: ({
|
|
118
121
|
label: string;
|
119
122
|
value: string;
|
120
123
|
}[];
|
121
|
-
initialValue
|
124
|
+
initialValue: string;
|
122
125
|
addonAfter?: undefined;
|
123
126
|
} | {
|
124
127
|
type: string;
|
@@ -1,5 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
+
var _a, _b;
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
+
const defaultSetting_1 = require("../../defaultSetting");
|
3
5
|
exports.default = [
|
4
6
|
{
|
5
7
|
title: '商品图片',
|
@@ -67,8 +69,9 @@ exports.default = [
|
|
67
69
|
},
|
68
70
|
{
|
69
71
|
type: 'Select',
|
70
|
-
options:
|
71
|
-
name: ['fontFamily']
|
72
|
+
options: defaultSetting_1.fontOptions,
|
73
|
+
name: ['fontFamily'],
|
74
|
+
initialValue: (_a = defaultSetting_1.fontOptions === null || defaultSetting_1.fontOptions === void 0 ? void 0 : defaultSetting_1.fontOptions[0]) === null || _a === void 0 ? void 0 : _a.value
|
72
75
|
},
|
73
76
|
{
|
74
77
|
type: 'Number',
|
@@ -147,7 +150,8 @@ exports.default = [
|
|
147
150
|
{
|
148
151
|
type: 'Select',
|
149
152
|
name: ['props', 'buttonStyle', 'fontFamily'],
|
150
|
-
options:
|
153
|
+
options: defaultSetting_1.fontOptions,
|
154
|
+
initialValue: (_b = defaultSetting_1.fontOptions === null || defaultSetting_1.fontOptions === void 0 ? void 0 : defaultSetting_1.fontOptions[0]) === null || _b === void 0 ? void 0 : _b.value
|
151
155
|
},
|
152
156
|
{
|
153
157
|
type: 'Number',
|
@@ -38,6 +38,7 @@ declare const _default: ({
|
|
38
38
|
type: string;
|
39
39
|
name: string[];
|
40
40
|
options?: undefined;
|
41
|
+
initialValue?: undefined;
|
41
42
|
addonAfter?: undefined;
|
42
43
|
} | {
|
43
44
|
type: string;
|
@@ -46,12 +47,14 @@ declare const _default: ({
|
|
46
47
|
value: string;
|
47
48
|
}[];
|
48
49
|
name: string[];
|
50
|
+
initialValue: string;
|
49
51
|
addonAfter?: undefined;
|
50
52
|
} | {
|
51
53
|
type: string;
|
52
54
|
addonAfter: string;
|
53
55
|
name: string[];
|
54
56
|
options?: undefined;
|
57
|
+
initialValue?: undefined;
|
55
58
|
})[];
|
56
59
|
options?: undefined;
|
57
60
|
name?: undefined;
|
@@ -118,7 +121,7 @@ declare const _default: ({
|
|
118
121
|
label: string;
|
119
122
|
value: string;
|
120
123
|
}[];
|
121
|
-
initialValue
|
124
|
+
initialValue: string;
|
122
125
|
addonAfter?: undefined;
|
123
126
|
} | {
|
124
127
|
type: string;
|