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.
Files changed (75) hide show
  1. package/dist/index.cjs +98 -83
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.js +98 -84
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.cjs +3 -3
  6. package/dist/index.min.cjs.map +1 -1
  7. package/dist/index.min.js +3 -3
  8. package/dist/index.min.js.map +1 -1
  9. package/dist/pb-ui.js +98 -83
  10. package/dist/pb-ui.js.map +1 -1
  11. package/dist/pb-ui.min.js +3 -3
  12. package/dist/pb-ui.min.js.map +1 -1
  13. package/es/core/components/SxpPageRender/Modal/index.d.ts +2 -2
  14. package/es/core/components/SxpPageRender/Modal/index.js +12 -11
  15. package/es/core/components/SxpPageRender/Popup/index.js +12 -12
  16. package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +3 -4
  17. package/es/core/components/SxpPageRender/WaterFall/index.js +1 -1
  18. package/es/core/context/EditorContext.d.ts +7 -5
  19. package/es/core/context/EditorContext.js +10 -25
  20. package/es/core/hooks/useEventReport.js +1 -1
  21. package/es/index.d.ts +1 -0
  22. package/es/index.js +1 -0
  23. package/es/materials/sxp/HashTag/settingRender.d.ts +4 -1
  24. package/es/materials/sxp/HashTag/settingRender.js +7 -3
  25. package/es/materials/sxp/defaultSetting.d.ts +11 -0
  26. package/es/materials/sxp/defaultSetting.js +7 -0
  27. package/es/materials/sxp/popup/AppointForm/index.js +1 -2
  28. package/es/materials/sxp/popup/AppointForm/material.js +0 -1
  29. package/es/materials/sxp/popup/AppointForm/settingRender.d.ts +3 -0
  30. package/es/materials/sxp/popup/AppointForm/settingRender.js +4 -1
  31. package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +4 -1
  32. package/es/materials/sxp/popup/CommodityDetail/settingRender.js +7 -3
  33. package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +4 -1
  34. package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +7 -3
  35. package/es/materials/sxp/popup/Prompt/index.js +0 -2
  36. package/es/materials/sxp/template/MultiCommodity/index.js +2 -2
  37. package/es/materials/sxp/template/MultiCommodityDiro/index.js +2 -2
  38. package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +2 -2
  39. package/es/materials/sxp/template/components/EventProvider.js +2 -2
  40. package/es/materials/sxp/template/components/settingRender.d.ts +6 -0
  41. package/es/materials/sxp/template/components/settingRender.js +8 -4
  42. package/lib/core/components/SxpPageRender/Modal/index.d.ts +2 -2
  43. package/lib/core/components/SxpPageRender/Modal/index.js +11 -10
  44. package/lib/core/components/SxpPageRender/Popup/index.js +12 -12
  45. package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +2 -3
  46. package/lib/core/components/SxpPageRender/WaterFall/index.js +1 -1
  47. package/lib/core/context/EditorContext.d.ts +7 -5
  48. package/lib/core/context/EditorContext.js +10 -25
  49. package/lib/core/hooks/useEventReport.js +1 -1
  50. package/lib/index.d.ts +1 -0
  51. package/lib/index.js +3 -1
  52. package/lib/materials/sxp/HashTag/settingRender.d.ts +4 -1
  53. package/lib/materials/sxp/HashTag/settingRender.js +7 -3
  54. package/lib/materials/sxp/defaultSetting.d.ts +11 -0
  55. package/lib/materials/sxp/defaultSetting.js +10 -0
  56. package/lib/materials/sxp/popup/AppointForm/index.js +0 -1
  57. package/lib/materials/sxp/popup/AppointForm/material.js +0 -1
  58. package/lib/materials/sxp/popup/AppointForm/settingRender.d.ts +3 -0
  59. package/lib/materials/sxp/popup/AppointForm/settingRender.js +4 -1
  60. package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +4 -1
  61. package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +7 -3
  62. package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +4 -1
  63. package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +7 -3
  64. package/lib/materials/sxp/popup/Prompt/index.js +0 -2
  65. package/lib/materials/sxp/template/MultiCommodity/index.js +2 -2
  66. package/lib/materials/sxp/template/MultiCommodityDiro/index.js +2 -2
  67. package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +2 -2
  68. package/lib/materials/sxp/template/components/EventProvider.js +2 -2
  69. package/lib/materials/sxp/template/components/settingRender.d.ts +6 -0
  70. package/lib/materials/sxp/template/components/settingRender.js +8 -4
  71. package/package.json +1 -1
  72. package/es/core/components/SxpPageRender/ProductInfo/index.d.ts +0 -14
  73. package/es/core/components/SxpPageRender/ProductInfo/index.js +0 -55
  74. package/lib/core/components/SxpPageRender/ProductInfo/index.d.ts +0 -14
  75. package/lib/core/components/SxpPageRender/ProductInfo/index.js +0 -58
@@ -1,10 +1,10 @@
1
1
  import React, { CSSProperties } from 'react';
2
- import { IPopupAniType } from '../../../../core/context/EditorContext';
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>>;
@@ -1,11 +1,9 @@
1
1
  import { debounce } from 'lodash';
2
- import React, { memo, useEffect, useRef, useState } from 'react';
2
+ import React, { memo, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import * as ReactDOM from 'react-dom';
4
- import { useEditor } from '../../../../core/hooks';
5
4
  const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
6
- const Modal = ({ visible, onClose, children, modalStyle, padding, popupAniData }) => {
7
- const { popupAni } = useEditor();
8
- const cssAni = popupAniData !== null && popupAniData !== void 0 ? popupAniData : popupAni;
5
+ const Modal = ({ visible, onClose, children, modalStyle, padding, popup }) => {
6
+ var _a;
9
7
  const [isShow, setIsShow] = useState(false);
10
8
  const modalEleRef = useRef(null);
11
9
  useEffect(() => {
@@ -20,28 +18,31 @@ const Modal = ({ visible, onClose, children, modalStyle, padding, popupAniData }
20
18
  parentNode === null || parentNode === void 0 ? void 0 : parentNode.appendChild(modalEleRef.current);
21
19
  }
22
20
  }, []);
21
+ const isOpen = useMemo(() => {
22
+ return ((popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') || visible;
23
+ }, [visible, popup]);
23
24
  useEffect(() => {
24
- if (visible) {
25
+ if (isOpen) {
25
26
  setIsShow(true);
26
27
  }
27
28
  else {
28
29
  setTimeout(() => {
29
30
  setIsShow(false);
30
- }, cssAni === null || cssAni === void 0 ? void 0 : cssAni.duration);
31
+ }, popup === null || popup === void 0 ? void 0 : popup.duration);
31
32
  }
32
- }, [visible, cssAni]);
33
+ }, [isOpen, popup]);
33
34
  if (!modalEleRef.current)
34
35
  return null;
35
36
  const handleClose = debounce(() => {
36
37
  onClose === null || onClose === void 0 ? void 0 : onClose();
37
38
  }, 300);
38
- return ReactDOM.createPortal(React.createElement("div", { className: 'modal-bg', style: Object.assign({ display: isShow ? 'flex' : 'none', backgroundColor: visible ? 'rgba(0, 0, 0, 0.7)' : 'rgba(0, 0, 0, 0)' }, modalStyle), onClick: handleClose },
39
- React.createElement("div", { className: `modal-container ${visible ? 'modal-popIn' : 'modal-popOut'}`, style: { padding, animationDuration: (cssAni === null || cssAni === void 0 ? void 0 : cssAni.duration) / 1000 + 's' }, onClick: (e) => {
39
+ return ReactDOM.createPortal(React.createElement(React.Fragment, null, isShow && (React.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 },
40
+ React.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) => {
40
41
  e.stopPropagation();
41
42
  e.preventDefault();
42
43
  } },
43
44
  React.createElement("div", { onClick: onClose, className: 'modal-icon-wrapper' },
44
45
  React.createElement("img", { src: closeIcon, alt: 'close', className: 'modal-icon' })),
45
- children)), modalEleRef.current);
46
+ children)))), modalEleRef.current);
46
47
  };
47
48
  export default memo(Modal);
@@ -4,10 +4,10 @@ import { useEditor, useSxpDataSource } from '../../../../core/hooks';
4
4
  import withBindDataSource from '../../../../core/hoc/withBindDataSource';
5
5
  import { useEventReport } from '../../../../core/hooks/useEventReport';
6
6
  const Popup = () => {
7
- const { schema, resolver, popup, popupAni } = useEditor();
7
+ const { schema, resolver, popup } = useEditor();
8
8
  const { setPopupDetailData, popupDetailData, bffEventReport } = useSxpDataSource();
9
9
  const { productView } = useEventReport();
10
- const [visible, setVisible] = useState(false);
10
+ const [visible, setVisible] = useState();
11
11
  const curTimeRef = useRef(null);
12
12
  useEffect(() => {
13
13
  const initTime = () => {
@@ -20,33 +20,33 @@ const Popup = () => {
20
20
  };
21
21
  }, []);
22
22
  useEffect(() => {
23
- if (popup && popup !== '') {
23
+ if (popup && (popup === null || popup === void 0 ? void 0 : popup.id) && (popup === null || popup === void 0 ? void 0 : popup.id) !== '') {
24
24
  curTimeRef.current = new Date();
25
- setVisible(true);
25
+ setVisible(popup);
26
26
  }
27
27
  }, [popup]);
28
28
  const handleClose = () => {
29
- var _a, _b, _c;
30
- if (!popup || popup === '' || !visible || new Date() - curTimeRef.current < (popupAni === null || popupAni === void 0 ? void 0 : popupAni.duration)) {
29
+ var _a, _b, _c, _d;
30
+ 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)) {
31
31
  return;
32
32
  }
33
- setVisible(false);
33
+ setVisible(Object.assign(Object.assign({}, popup), { id: '' }));
34
34
  const data = popupDetailData;
35
- const product = (_a = data === null || data === void 0 ? void 0 : data.video) === null || _a === void 0 ? void 0 : _a.bindProduct;
36
- const cta = (_c = (_b = data === null || data === void 0 ? void 0 : data.video) === null || _b === void 0 ? void 0 : _b.bindProduct) === null || _c === void 0 ? void 0 : _c.bindCta;
35
+ const product = (_b = data === null || data === void 0 ? void 0 : data.video) === null || _b === void 0 ? void 0 : _b.bindProduct;
36
+ 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;
37
37
  if (product && cta) {
38
38
  productView(data, product, cta, curTimeRef.current);
39
39
  }
40
40
  setTimeout(() => {
41
41
  window === null || window === void 0 ? void 0 : window.sxpPopup('');
42
42
  setPopupDetailData === null || setPopupDetailData === void 0 ? void 0 : setPopupDetailData(null);
43
- }, popupAni === null || popupAni === void 0 ? void 0 : popupAni.duration);
43
+ }, popup === null || popup === void 0 ? void 0 : popup.duration);
44
44
  };
45
45
  const renderPopupDetail = useMemo(() => {
46
46
  var _a, _b, _c;
47
47
  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) => {
48
48
  var _a, _b, _c, _d, _e, _f, _g, _h;
49
- if ((value === null || value === void 0 ? void 0 : value.id) === popup) {
49
+ if ((value === null || value === void 0 ? void 0 : value.id) === (popup === null || popup === void 0 ? void 0 : popup.id)) {
50
50
  const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
51
51
  const Component = withBindDataSource(t);
52
52
  const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
@@ -57,6 +57,6 @@ const Popup = () => {
57
57
  }
58
58
  });
59
59
  }, [schema, popup, resolver]);
60
- return (React.createElement(Modal, { visible: !!visible, onClose: handleClose, padding: 0, modalStyle: { position: 'fixed' } }, renderPopupDetail));
60
+ return (React.createElement(Modal, { popup: visible, onClose: handleClose, padding: 0, modalStyle: { position: 'fixed' } }, renderPopupDetail));
61
61
  };
62
62
  export default Popup;
@@ -1,6 +1,6 @@
1
1
  import { __rest } from "tslib";
2
2
  import React, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
3
- import { useEditor, useSxpDataSource } from '../../../../core/hooks';
3
+ import { useSxpDataSource } from '../../../../core/hooks';
4
4
  import './WaterfallList.less';
5
5
  const WaterfallFlowItem = (props) => {
6
6
  const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, lineClamp } = props;
@@ -145,7 +145,6 @@ const WaterfallFlowItem = (props) => {
145
145
  export default function WaterfallList(_a) {
146
146
  var _b, _c, _d, _e, _f, _g, _h;
147
147
  var { reportTagsView } = _a, props = __rest(_a, ["reportTagsView"]);
148
- const { popupAni } = useEditor();
149
148
  const { waterFallData, getRecommendVideos, loadingImage } = useSxpDataSource();
150
149
  const scrollParent = useRef(null);
151
150
  const [scrollTop, setScrollTop] = useState(0);
@@ -163,7 +162,7 @@ export default function WaterfallList(_a) {
163
162
  const [frameInfo, setFrameInfoInfo] = useState({ width: 0 });
164
163
  const rowsNum = useMemo(() => {
165
164
  const width = frameInfo.width || 0;
166
- if (width >= (popupAni === null || popupAni === void 0 ? void 0 : popupAni.duration)) {
165
+ if (width >= 1200) {
167
166
  return 6;
168
167
  }
169
168
  else if (width >= 768 && width <= 1199) {
@@ -172,7 +171,7 @@ export default function WaterfallList(_a) {
172
171
  else {
173
172
  return 2;
174
173
  }
175
- }, [frameInfo, popupAni]);
174
+ }, [frameInfo]);
176
175
  const unitWidth = useMemo(() => {
177
176
  return frameInfo.width / rowsNum - 2;
178
177
  }, [rowsNum, frameInfo]);
@@ -66,7 +66,7 @@ const WaterFall = (props) => {
66
66
  relatedContentId: (_d = rec === null || rec === void 0 ? void 0 : rec.video) === null || _d === void 0 ? void 0 : _d.itemId,
67
67
  position: rec === null || rec === void 0 ? void 0 : rec.position,
68
68
  contentTags: JSON.stringify((_e = rec === null || rec === void 0 ? void 0 : rec.video) === null || _e === void 0 ? void 0 : _e.tags),
69
- traceInfo: JSON.stringify((_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo),
69
+ traceInfo: (_f = rec === null || rec === void 0 ? void 0 : rec.video) === null || _f === void 0 ? void 0 : _f.traceInfo,
70
70
  hashTags: JSON.stringify([recData === null || recData === void 0 ? void 0 : recData.hashTag]),
71
71
  fromKName,
72
72
  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: string;
20
- duration: number;
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: string;
61
- setPopup: React.Dispatch<React.SetStateAction<string>>;
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>;
@@ -25,6 +25,11 @@ const item = {
25
25
  pathArr: [0],
26
26
  positionY: 0
27
27
  };
28
+ const popupInit = {
29
+ id: '',
30
+ duration: 0,
31
+ name: 'none'
32
+ };
28
33
  export const EditorContext = React.createContext({
29
34
  resolver: {},
30
35
  currentNode: null,
@@ -44,12 +49,8 @@ export const EditorContext = React.createContext({
44
49
  prePiontData: [],
45
50
  undoStack: [item],
46
51
  redoStack: [],
47
- popup: '',
48
- setPopup: () => { },
49
- popupAni: {
50
- name: 'none',
51
- duration: 0
52
- }
52
+ popup: popupInit,
53
+ setPopup: () => { }
53
54
  });
54
55
  const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSource = true, utmVal }, ref) => {
55
56
  const [currentNode, setCurrentNode] = useState(null);
@@ -67,25 +68,10 @@ const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSo
67
68
  const [prePiontData, setPrePiontData] = useState([item]);
68
69
  const [undoStack, setUndoStack] = useState([[item]]);
69
70
  const [redoStack, setRedoStack] = useState([]);
70
- const [popup, setPopup] = useState('');
71
- const [popupAni, setPopupAni] = useState({
72
- name: 'none',
73
- duration: 0
74
- });
71
+ const [popup, setPopup] = useState(popupInit);
75
72
  typeof window !== 'undefined' &&
76
73
  (window.sxpPopup = (type, aniType) => {
77
- if (aniType && (aniType === null || aniType === void 0 ? void 0 : aniType.name) !== 'none') {
78
- setPopupAni(Object.assign(Object.assign({}, popupAni), aniType));
79
- }
80
- else {
81
- setPopupAni({
82
- name: 'none',
83
- duration: 0
84
- });
85
- }
86
- setTimeout(() => {
87
- setPopup(type);
88
- });
74
+ setPopup(Object.assign(Object.assign(Object.assign({}, popupInit), { id: type }), aniType));
89
75
  });
90
76
  typeof window !== 'undefined' &&
91
77
  (window.getJointUtmLink = (url) => {
@@ -154,8 +140,7 @@ const EditorCore = forwardRef(({ children, resolver, isSsr, schema, enableDataSo
154
140
  setUndoStack,
155
141
  getCurPageConf,
156
142
  popup,
157
- setPopup,
158
- popupAni
143
+ setPopup
159
144
  } },
160
145
  React.createElement(DataSourceProvider, { isSsr: isSsr, enable: enableDataSource }, children)));
161
146
  });
@@ -51,7 +51,7 @@ export function useEventReport() {
51
51
  eventInfo: {
52
52
  productId: product === null || product === void 0 ? void 0 : product.itemId,
53
53
  productName: product === null || product === void 0 ? void 0 : product.title,
54
- price: (product === null || product === void 0 ? void 0 : product.price) + '',
54
+ price: (product === null || product === void 0 ? void 0 : product.price) ? (product === null || product === void 0 ? void 0 : product.price) + '' : '0',
55
55
  productCollection: product === null || product === void 0 ? void 0 : product.collection,
56
56
  fromKName,
57
57
  fromKPage: location === null || location === void 0 ? void 0 : location.href,
package/es/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/es/index.js CHANGED
@@ -9,4 +9,5 @@ export { default as SxpDataSourceProvider } from './core/context/SxpDataSourcePr
9
9
  export { default as SxpPageCore } from './core/components/SxpPageCore';
10
10
  export { default as EditorDataProvider } from './core/context/EditorDataProvider';
11
11
  export { useEditorDataProvider } from './core/context/EditorDataProvider';
12
+ export { default as defaultSetting } from './materials/sxp/defaultSetting';
12
13
  export default 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?: undefined;
112
+ initialValue: string;
110
113
  addonAfter?: undefined;
111
114
  } | {
112
115
  type: string;
@@ -1,3 +1,5 @@
1
+ var _a, _b;
2
+ import { fontOptions } from '../defaultSetting';
1
3
  export default [
2
4
  {
3
5
  title: '卡片样式',
@@ -56,8 +58,9 @@ export default [
56
58
  },
57
59
  {
58
60
  type: 'Select',
59
- options: [{ label: '黑体', value: '黑体' }],
60
- name: ['fontFamily']
61
+ options: fontOptions,
62
+ name: ['fontFamily'],
63
+ initialValue: (_a = fontOptions === null || fontOptions === void 0 ? void 0 : fontOptions[0]) === null || _a === void 0 ? void 0 : _a.value
61
64
  },
62
65
  {
63
66
  type: 'Number',
@@ -131,7 +134,8 @@ export default [
131
134
  {
132
135
  type: 'Select',
133
136
  name: ['props', 'buttonStyle', 'fontFamily'],
134
- options: [{ label: '黑体', value: '黑体' }]
137
+ options: fontOptions,
138
+ initialValue: (_b = fontOptions === null || fontOptions === void 0 ? void 0 : fontOptions[0]) === null || _b === void 0 ? void 0 : _b.value
135
139
  },
136
140
  {
137
141
  type: 'Number',
@@ -0,0 +1,11 @@
1
+ export declare const fontOptions: {
2
+ label: string;
3
+ value: string;
4
+ }[];
5
+ declare const _default: {
6
+ fontOptions: {
7
+ label: string;
8
+ value: string;
9
+ }[];
10
+ };
11
+ export default _default;
@@ -0,0 +1,7 @@
1
+ export const fontOptions = [
2
+ { label: '应用字体', value: 'appFont' },
3
+ { label: '黑体', value: '黑体' }
4
+ ];
5
+ export default {
6
+ fontOptions
7
+ };
@@ -3,11 +3,10 @@ import { css } from '@emotion/css';
3
3
  import React, { memo, useMemo, useRef, useState } from 'react';
4
4
  import { BetaSchemaForm } from '@ant-design/pro-components';
5
5
  import { cloneDeep, debounce } from 'lodash';
6
- import { useEditor, useSxpDataSource } from '../../../../core/hooks';
6
+ import { useSxpDataSource } from '../../../../core/hooks';
7
7
  import './index.less';
8
8
  const AppointForm = (_a) => {
9
9
  var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, onClick } = _a, props = __rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "onClick"]);
10
- const { setPopup } = useEditor();
11
10
  const { submitForm } = useSxpDataSource();
12
11
  const formRef = useRef();
13
12
  const [loading, setLoading] = useState(false);
@@ -25,7 +25,6 @@ const AppointForm = createMaterial(AppointFormComponent, {
25
25
  textStyle: {
26
26
  fontSize: 14,
27
27
  color: '#000',
28
- fontFamily: '黑体',
29
28
  textAlign: 'center'
30
29
  }
31
30
  },
@@ -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,3 +1,5 @@
1
+ var _a;
2
+ import { fontOptions } from '../../defaultSetting';
1
3
  export default [
2
4
  {
3
5
  type: 'Text',
@@ -23,7 +25,8 @@ export default [
23
25
  {
24
26
  type: 'Select',
25
27
  name: ['textStyle', 'fontFamily'],
26
- options: [{ label: '黑体', value: '黑体' }]
28
+ options: fontOptions,
29
+ initialValue: (_a = fontOptions === null || fontOptions === void 0 ? void 0 : fontOptions[0]) === null || _a === void 0 ? void 0 : _a.value
27
30
  },
28
31
  {
29
32
  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?: undefined;
124
+ initialValue: string;
122
125
  addonAfter?: undefined;
123
126
  } | {
124
127
  type: string;
@@ -1,3 +1,5 @@
1
+ var _a, _b;
2
+ import { fontOptions } from '../../defaultSetting';
1
3
  export default [
2
4
  {
3
5
  title: '商品图片',
@@ -65,8 +67,9 @@ export default [
65
67
  },
66
68
  {
67
69
  type: 'Select',
68
- options: [{ label: '黑体', value: '黑体' }],
69
- name: ['fontFamily']
70
+ options: fontOptions,
71
+ name: ['fontFamily'],
72
+ initialValue: (_a = fontOptions === null || fontOptions === void 0 ? void 0 : fontOptions[0]) === null || _a === void 0 ? void 0 : _a.value
70
73
  },
71
74
  {
72
75
  type: 'Number',
@@ -145,7 +148,8 @@ export default [
145
148
  {
146
149
  type: 'Select',
147
150
  name: ['props', 'buttonStyle', 'fontFamily'],
148
- options: [{ label: '黑体', value: '黑体' }]
151
+ options: fontOptions,
152
+ initialValue: (_b = fontOptions === null || fontOptions === void 0 ? void 0 : fontOptions[0]) === null || _b === void 0 ? void 0 : _b.value
149
153
  },
150
154
  {
151
155
  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?: undefined;
124
+ initialValue: string;
122
125
  addonAfter?: undefined;
123
126
  } | {
124
127
  type: string;
@@ -1,3 +1,5 @@
1
+ var _a, _b;
2
+ import { fontOptions } from '../../defaultSetting';
1
3
  export default [
2
4
  {
3
5
  title: '商品图片',
@@ -69,8 +71,9 @@ export default [
69
71
  },
70
72
  {
71
73
  type: 'Select',
72
- options: [{ label: '黑体', value: '黑体' }],
73
- name: ['fontFamily']
74
+ options: fontOptions,
75
+ name: ['fontFamily'],
76
+ initialValue: (_a = fontOptions === null || fontOptions === void 0 ? void 0 : fontOptions[0]) === null || _a === void 0 ? void 0 : _a.value
74
77
  },
75
78
  {
76
79
  type: 'Number',
@@ -149,7 +152,8 @@ export default [
149
152
  {
150
153
  type: 'Select',
151
154
  name: ['props', 'buttonStyle', 'fontFamily'],
152
- options: [{ label: '黑体', value: '黑体' }]
155
+ options: fontOptions,
156
+ initialValue: (_b = fontOptions === null || fontOptions === void 0 ? void 0 : fontOptions[0]) === null || _b === void 0 ? void 0 : _b.value
153
157
  },
154
158
  {
155
159
  type: 'Number',
@@ -3,11 +3,9 @@ import { css } from '@emotion/css';
3
3
  import React, { memo } from 'react';
4
4
  import success from './success.png';
5
5
  import { getMediaValueByMode } from '../../../../core/utils/materials';
6
- import { useEditor } from '../../../../core/hooks';
7
6
  import './index.less';
8
7
  const Prompt = (_a) => {
9
8
  var { content, btnText, style, icon, onClick } = _a, props = __rest(_a, ["content", "btnText", "style", "icon", "onClick"]);
10
- const { setPopup } = useEditor();
11
9
  const iconSrc = typeof icon === 'string' ? icon : getMediaValueByMode(icon);
12
10
  const handleOk = () => {
13
11
  window === null || window === void 0 ? void 0 : window.sxpPopup('');
@@ -13,7 +13,7 @@ const MultiCommodity = (_a) => {
13
13
  var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
14
14
  const { sxpParameter } = useSxpDataSource();
15
15
  const { ctaEvent, setPopupDetailData } = useSxpDataSource();
16
- const { popupAni } = useEditor();
16
+ const { popup } = useEditor();
17
17
  const [products, setProducts] = useState((_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [1, 2]);
18
18
  const { jumpToWeb } = useEventReport();
19
19
  const handleClick = throttle((item) => {
@@ -31,7 +31,7 @@ const MultiCommodity = (_a) => {
31
31
  else {
32
32
  onClick === null || onClick === void 0 ? void 0 : onClick();
33
33
  }
34
- }, popupAni === null || popupAni === void 0 ? void 0 : popupAni.duration);
34
+ }, popup === null || popup === void 0 ? void 0 : popup.duration);
35
35
  return (React.createElement(Scroll, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
36
36
  var _a, _b, _c, _d, _e, _f;
37
37
  return (React.createElement(SwiperSlide, Object.assign({ hidden: recData && !(item === null || item === void 0 ? void 0 : item.bindCta), key: item.itemId, className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
@@ -12,7 +12,7 @@ const MultiCommodityDiro = (_a) => {
12
12
  var _b, _c;
13
13
  var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
14
14
  const { ctaEvent, setPopupDetailData, sxpParameter } = useSxpDataSource();
15
- const { popupAni } = useEditor();
15
+ const { popup } = useEditor();
16
16
  const { jumpToWeb } = useEventReport();
17
17
  const [products, setProducts] = useState((_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [1, 2]);
18
18
  const handleClick = throttle((item) => {
@@ -30,7 +30,7 @@ const MultiCommodityDiro = (_a) => {
30
30
  else {
31
31
  onClick === null || onClick === void 0 ? void 0 : onClick();
32
32
  }
33
- }, popupAni === null || popupAni === void 0 ? void 0 : popupAni.duration);
33
+ }, popup === null || popup === void 0 ? void 0 : popup.duration);
34
34
  return (React.createElement(Scroll, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
35
35
  var _a, _b, _c, _d, _e, _f;
36
36
  return (React.createElement(SwiperSlide, Object.assign({ hidden: recData && !(item === null || item === void 0 ? void 0 : item.bindCta), key: item === null || item === void 0 ? void 0 : item.itemId, className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),
@@ -12,7 +12,7 @@ const MultiCommodityDiroNew = (_a) => {
12
12
  var _b, _c;
13
13
  var { content, style, bgImg, recData, onClick, bottom_image, ctaTempStyles, isExternalLink } = _a, props = __rest(_a, ["content", "style", "bgImg", "recData", "onClick", "bottom_image", "ctaTempStyles", "isExternalLink"]);
14
14
  const { ctaEvent, setPopupDetailData, sxpParameter } = useSxpDataSource();
15
- const { popupAni } = useEditor();
15
+ const { popup } = useEditor();
16
16
  const { jumpToWeb } = useEventReport();
17
17
  const [products, setProducts] = useState((_c = (_b = recData === null || recData === void 0 ? void 0 : recData.video) === null || _b === void 0 ? void 0 : _b.bindProducts) !== null && _c !== void 0 ? _c : [1, 2]);
18
18
  const handleClick = throttle((item) => {
@@ -30,7 +30,7 @@ const MultiCommodityDiroNew = (_a) => {
30
30
  else {
31
31
  onClick === null || onClick === void 0 ? void 0 : onClick();
32
32
  }
33
- }, popupAni === null || popupAni === void 0 ? void 0 : popupAni.duration);
33
+ }, popup === null || popup === void 0 ? void 0 : popup.duration);
34
34
  return (React.createElement(Scroll, { isPadding: !!recData }, products === null || products === void 0 ? void 0 : products.map((item) => {
35
35
  var _a, _b, _c, _d, _e, _f;
36
36
  return (React.createElement(SwiperSlide, Object.assign({ hidden: recData && !(item === null || item === void 0 ? void 0 : item.bindCta), key: item === null || item === void 0 ? void 0 : item.itemId, className: css(Object.assign(Object.assign({}, style), { display: 'flex', flexShrink: 0, marginLeft: 0, marginRight: '8px' })) }, props, { onClick: () => handleClick(item) }),