pb-sxp-ui 1.0.98 → 1.0.100

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 (102) hide show
  1. package/dist/index.cjs +396 -181
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +23 -20
  4. package/dist/index.js +397 -181
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +3 -3
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +3 -3
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +396 -181
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +3 -3
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/components/SxpPageRender/ExpandableText.js +3 -2
  15. package/es/core/components/SxpPageRender/Hashtag/index.js +3 -1
  16. package/es/core/components/SxpPageRender/Navbar.js +4 -1
  17. package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
  18. package/es/core/components/SxpPageRender/VideoWidget/index.js +3 -3
  19. package/es/core/components/SxpPageRender/WaterFall/List.js +21 -10
  20. package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +24 -13
  21. package/es/core/components/SxpPageRender/index.d.ts +1 -0
  22. package/es/core/components/SxpPageRender/index.js +2 -1
  23. package/es/core/context/EditorDataProvider.d.ts +1 -0
  24. package/es/core/context/EditorDataProvider.js +2 -1
  25. package/es/core/utils/tool.d.ts +5 -0
  26. package/es/core/utils/tool.js +43 -0
  27. package/es/index.d.ts +0 -1
  28. package/es/index.js +0 -1
  29. package/es/materials/sxp/HashTag/settingRender.d.ts +19 -22
  30. package/es/materials/sxp/HashTag/settingRender.js +31 -13
  31. package/es/materials/sxp/popup/AppointForm/Form.d.ts +14 -0
  32. package/es/materials/sxp/popup/AppointForm/Form.js +8 -0
  33. package/es/materials/sxp/popup/AppointForm/index.js +25 -20
  34. package/es/materials/sxp/popup/AppointForm/settingRender.d.ts +9 -20
  35. package/es/materials/sxp/popup/AppointForm/settingRender.js +31 -13
  36. package/es/materials/sxp/popup/CommodityDetail/index.js +13 -4
  37. package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +19 -22
  38. package/es/materials/sxp/popup/CommodityDetail/settingRender.js +31 -13
  39. package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +16 -5
  40. package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +19 -22
  41. package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +31 -13
  42. package/es/materials/sxp/popup/Prompt/index.js +4 -1
  43. package/es/materials/sxp/popup/Prompt/settingRender.d.ts +10 -8
  44. package/es/materials/sxp/popup/Prompt/settingRender.js +16 -8
  45. package/es/materials/sxp/template/Appoint/index.js +4 -1
  46. package/es/materials/sxp/template/Commodity/index.js +7 -2
  47. package/es/materials/sxp/template/CommodityDiro/index.js +8 -3
  48. package/es/materials/sxp/template/CommodityDiroNew/index.js +7 -2
  49. package/es/materials/sxp/template/Link/index.js +4 -1
  50. package/es/materials/sxp/template/MultiCommodity/index.js +7 -2
  51. package/es/materials/sxp/template/MultiCommodityDiro/index.js +8 -3
  52. package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +7 -2
  53. package/es/materials/sxp/template/components/Img.js +1 -1
  54. package/es/materials/sxp/template/components/settingRender.d.ts +16 -24
  55. package/es/materials/sxp/template/components/settingRender.js +30 -12
  56. package/lib/core/components/SxpPageRender/ExpandableText.js +3 -2
  57. package/lib/core/components/SxpPageRender/Hashtag/index.js +3 -1
  58. package/lib/core/components/SxpPageRender/Navbar.js +4 -1
  59. package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
  60. package/lib/core/components/SxpPageRender/VideoWidget/index.js +3 -3
  61. package/lib/core/components/SxpPageRender/WaterFall/List.js +21 -10
  62. package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +24 -13
  63. package/lib/core/components/SxpPageRender/index.d.ts +1 -0
  64. package/lib/core/components/SxpPageRender/index.js +2 -1
  65. package/lib/core/context/EditorDataProvider.d.ts +1 -0
  66. package/lib/core/context/EditorDataProvider.js +2 -1
  67. package/lib/core/utils/tool.d.ts +5 -0
  68. package/lib/core/utils/tool.js +45 -1
  69. package/lib/index.d.ts +0 -1
  70. package/lib/index.js +1 -3
  71. package/lib/materials/sxp/HashTag/settingRender.d.ts +19 -22
  72. package/lib/materials/sxp/HashTag/settingRender.js +31 -13
  73. package/lib/materials/sxp/popup/AppointForm/Form.d.ts +14 -0
  74. package/lib/materials/sxp/popup/AppointForm/Form.js +11 -0
  75. package/lib/materials/sxp/popup/AppointForm/index.js +24 -19
  76. package/lib/materials/sxp/popup/AppointForm/settingRender.d.ts +9 -20
  77. package/lib/materials/sxp/popup/AppointForm/settingRender.js +31 -14
  78. package/lib/materials/sxp/popup/CommodityDetail/index.js +13 -4
  79. package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +19 -22
  80. package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +31 -13
  81. package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +16 -5
  82. package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +19 -22
  83. package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +31 -13
  84. package/lib/materials/sxp/popup/Prompt/index.js +4 -1
  85. package/lib/materials/sxp/popup/Prompt/settingRender.d.ts +10 -8
  86. package/lib/materials/sxp/popup/Prompt/settingRender.js +16 -9
  87. package/lib/materials/sxp/template/Appoint/index.js +4 -1
  88. package/lib/materials/sxp/template/Commodity/index.js +7 -2
  89. package/lib/materials/sxp/template/CommodityDiro/index.js +8 -3
  90. package/lib/materials/sxp/template/CommodityDiroNew/index.js +7 -2
  91. package/lib/materials/sxp/template/Link/index.js +4 -1
  92. package/lib/materials/sxp/template/MultiCommodity/index.js +7 -2
  93. package/lib/materials/sxp/template/MultiCommodityDiro/index.js +8 -3
  94. package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +7 -2
  95. package/lib/materials/sxp/template/components/Img.js +1 -1
  96. package/lib/materials/sxp/template/components/settingRender.d.ts +16 -24
  97. package/lib/materials/sxp/template/components/settingRender.js +30 -12
  98. package/package.json +1 -1
  99. package/es/materials/sxp/defaultSetting.d.ts +0 -8
  100. package/es/materials/sxp/defaultSetting.js +0 -6
  101. package/lib/materials/sxp/defaultSetting.d.ts +0 -8
  102. package/lib/materials/sxp/defaultSetting.js +0 -9
@@ -1,3 +1,4 @@
1
+ import { setFontForText } from '../../../core/utils/tool';
1
2
  import React, { memo, useMemo, useState, useCallback, useRef, useEffect } from 'react';
2
3
  const limitTextLastWholeWord = (originalText = '', limit) => {
3
4
  const chineseRegex = /[\u4e00-\u9fa5]+/;
@@ -45,8 +46,8 @@ const ExpandableText = ({ text, maxStr = 108, style, className, onClick, foldTex
45
46
  display: '-webkit-box',
46
47
  WebkitBoxOrient: 'vertical',
47
48
  wordBreak: 'break-word'
48
- }, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
49
- React.createElement("div", { ref: multiRowCopy, dangerouslySetInnerHTML: { __html: text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>') } }),
49
+ }, dangerouslySetInnerHTML: { __html: setFontForText(text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>'), style) } }),
50
+ React.createElement("div", { ref: multiRowCopy, dangerouslySetInnerHTML: { __html: setFontForText(text === null || text === void 0 ? void 0 : text.replace(/\n/g, '</br>'), style) } }),
50
51
  text && isPost && isShow && (React.createElement("span", { style: { textDecoration: 'underline', cursor: 'pointer' }, onClick: onClick !== null && onClick !== void 0 ? onClick : handleClick }, isShowMore ? unfoldText || 'show less' : foldText || 'show more'))));
51
52
  };
52
53
  export default memo(ExpandableText);
@@ -2,6 +2,7 @@ import React, { memo, useMemo, useState } from 'react';
2
2
  import { SwiperSlide } from 'swiper/react';
3
3
  import { useSxpDataSource } from '../../../../core/hooks';
4
4
  import Scroll from '../../../../materials/sxp/template/components/Scroll';
5
+ import { setFontForText } from '../../../../core/utils/tool';
5
6
  const Hashtag = ({ tags, itemId, itemType, index, rec, hashTagStyle }) => {
6
7
  const [isShowMore, setIsShowMore] = useState(false);
7
8
  const { setWaterFallData, setOpenHashtag, setCacheActiveIndex, waterFallData, setIsFromHashtag } = useSxpDataSource();
@@ -35,6 +36,7 @@ const Hashtag = ({ tags, itemId, itemType, index, rec, hashTagStyle }) => {
35
36
  return (React.createElement("span", { style: { textDecoration: 'underline', cursor: 'pointer', color: '#fff' }, onClick: () => setIsShowMore(!isShowMore) }, isShowMore ? 'show less' : 'show more'));
36
37
  }, [isShowMore, tags]);
37
38
  return (React.createElement("div", { className: 'clc-sxp-bottom-hashtag' },
38
- React.createElement(Scroll, null, tags === null || tags === void 0 ? void 0 : tags.map((item, index) => (React.createElement(SwiperSlide, { key: index, hidden: !isShowMore ? index >= 6 : false, className: 'clc-sxp-bottom-hashtag-item', style: hashTagStyle, onClick: () => handleClickTag(item) }, `#${item}`))))));
39
+ React.createElement(Scroll, null, tags === null || tags === void 0 ? void 0 : tags.map((item, index) => (React.createElement(SwiperSlide, { key: index, hidden: !isShowMore ? index >= 6 : false, className: 'clc-sxp-bottom-hashtag-item', style: hashTagStyle, onClick: () => handleClickTag(item) },
40
+ React.createElement("div", { dangerouslySetInnerHTML: { __html: setFontForText(`#${item}`, hashTagStyle) } })))))));
39
41
  };
40
42
  export default memo(Hashtag);
@@ -1,10 +1,13 @@
1
1
  import React, { memo } from 'react';
2
2
  import { useSxpDataSource } from '../../../core/hooks';
3
+ import { setFontForText } from '../../../core/utils/tool';
3
4
  const Navbar = ({ icon, styles, textStyle, onClose }) => {
4
5
  var _a;
5
6
  const { waterFallData, setOpenHashtag } = useSxpDataSource();
6
7
  return (React.createElement("div", { className: 'clc-sxp-nav', style: styles },
7
8
  React.createElement("img", { className: 'clc-sxp-nav-left', src: icon, alt: 'back button', onClick: onClose }),
8
- React.createElement("div", { className: 'clc-sxp-nav-title', style: textStyle }, `#${(_a = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag) !== null && _a !== void 0 ? _a : '标题'}`)));
9
+ React.createElement("div", { className: 'clc-sxp-nav-title', style: textStyle, dangerouslySetInnerHTML: {
10
+ __html: setFontForText(`#${(_a = waterFallData === null || waterFallData === void 0 ? void 0 : waterFallData.hashTag) !== null && _a !== void 0 ? _a : '标题'}`, textStyle)
11
+ } })));
9
12
  };
10
13
  export default memo(Navbar);
@@ -10,6 +10,7 @@ interface IVideoWidgetProps {
10
10
  activeIndex?: number;
11
11
  videoPostConfig?: postConfigType;
12
12
  videoRef?: any;
13
+ videoPlayIcon?: string;
13
14
  }
14
15
  declare const _default: React.NamedExoticComponent<IVideoWidgetProps>;
15
16
  export default _default;
@@ -5,7 +5,7 @@ import FormatImage from '../FormatImage';
5
5
  import { useSxpDataSource } from '../../../../core/hooks';
6
6
  import SXP_EVENT_BUS, { SXP_EVENT_TYPE } from '../../../../core/utils/event';
7
7
  import loading_gif from './loading.gif';
8
- const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef }) => {
8
+ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostConfig, videoRef, videoPlayIcon }) => {
9
9
  const [isPauseVideo, setIsPauseVideo] = useState(false);
10
10
  const { bffEventReport, sxpParameter, waterFallData, openHashtag, bffFbReport } = useSxpDataSource();
11
11
  const videoStartTime = useRef(0);
@@ -329,7 +329,7 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
329
329
  } },
330
330
  React.createElement("div", { style: { position: 'relative', width: '100%', height: '100%' } },
331
331
  React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
332
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', alt: 'pause', src: PAUSE_ICON }))),
332
+ React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', alt: 'pause', src: videoPlayIcon !== null && videoPlayIcon !== void 0 ? videoPlayIcon : PAUSE_ICON }))),
333
333
  renderPoster,
334
334
  renderLoading)) : (React.createElement("div", { className: 'video-container', key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, style: {
335
335
  position: 'relative',
@@ -340,6 +340,6 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
340
340
  React.createElement("div", { className: 'n-full-screen', ref: videoEleRef, id: videoId, style: { width: '100%', height: '100%' } }),
341
341
  renderPoster,
342
342
  renderLoading,
343
- React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: PAUSE_ICON, alt: 'pause' })))));
343
+ React.createElement("img", { hidden: !isPauseVideo, className: 'clc-pb-video-pause', src: videoPlayIcon !== null && videoPlayIcon !== void 0 ? videoPlayIcon : PAUSE_ICON, alt: 'pause' })))));
344
344
  };
345
345
  export default memo(VideoWidget);
@@ -5,6 +5,7 @@ import FormatImage from '../FormatImage';
5
5
  import previewData from './preview.json';
6
6
  import { useSxpDataSource } from '../../../../core/hooks';
7
7
  import { css } from '@emotion/css';
8
+ import { setFontForText } from '../../../../core/utils/tool';
8
9
  const WaterfallFlowItem = (props) => {
9
10
  const { rec, index, list, reportTagsView, textStyles, space } = props;
10
11
  const { swiperRef, setRtcList, setOpenHashtag, bffEventReport, sxpParameter } = useSxpDataSource();
@@ -110,11 +111,15 @@ const WaterfallFlowItem = (props) => {
110
111
  React.createElement("canvas", { ref: canvasRef }))),
111
112
  React.createElement(FormatImage, { loading: 'lazy', className: 'list-content-listItem-picture-img', ref: imgDom })),
112
113
  React.createElement("div", { className: 'list-content-listItem-info' },
113
- React.createElement("div", { className: `${'list-content-listItem-info-title'} ${priceText ? 'list-content-listItem-info-nowrap' : ''}`, style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.title }, title && title),
114
- React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText }, priceText))));
114
+ React.createElement("div", { className: `${'list-content-listItem-info-title'} ${priceText ? 'list-content-listItem-info-nowrap' : ''}`, style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.title, dangerouslySetInnerHTML: {
115
+ __html: setFontForText(title, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title)
116
+ } }),
117
+ React.createElement("div", { className: 'list-content-listItem-info-price', style: textStyles === null || textStyles === void 0 ? void 0 : textStyles.price, hidden: !priceText, dangerouslySetInnerHTML: {
118
+ __html: setFontForText(priceText, textStyles === null || textStyles === void 0 ? void 0 : textStyles.price)
119
+ } }))));
115
120
  };
116
121
  export default function WaterfallList(_a) {
117
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
122
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
118
123
  var { reportTagsView, showBanner } = _a, props = __rest(_a, ["reportTagsView", "showBanner"]);
119
124
  const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
120
125
  const [list, setList] = useState();
@@ -176,16 +181,22 @@ export default function WaterfallList(_a) {
176
181
  objectFit: 'cover',
177
182
  marginBottom: '20px'
178
183
  }), src: (_c = data === null || data === void 0 ? void 0 : data.tag) === null || _c === void 0 ? void 0 : _c.picture }))),
179
- React.createElement("div", { className: 'list-info', style: (_d = props === null || props === void 0 ? void 0 : props.textStyles) === null || _d === void 0 ? void 0 : _d.hashTagDesc }, (_e = data === null || data === void 0 ? void 0 : data.tag) === null || _e === void 0 ? void 0 : _e.info),
180
- React.createElement("div", { hidden: !((_f = data === null || data === void 0 ? void 0 : data.tag) === null || _f === void 0 ? void 0 : _f.link), className: 'list-collection', onClick: handleClickLink, style: Object.assign(Object.assign({}, (_g = props === null || props === void 0 ? void 0 : props.textStyles) === null || _g === void 0 ? void 0 : _g.hashTagLink), { marginBottom: props === null || props === void 0 ? void 0 : props.space }) }, ((_h = data === null || data === void 0 ? void 0 : data.tag) === null || _h === void 0 ? void 0 : _h.linkTitle) || 'Shop the collection'),
184
+ React.createElement("div", { className: 'list-info', style: (_d = props === null || props === void 0 ? void 0 : props.textStyles) === null || _d === void 0 ? void 0 : _d.hashTagDesc, dangerouslySetInnerHTML: {
185
+ __html: setFontForText((_e = data === null || data === void 0 ? void 0 : data.tag) === null || _e === void 0 ? void 0 : _e.info, (_f = props === null || props === void 0 ? void 0 : props.textStyles) === null || _f === void 0 ? void 0 : _f.hashTagDesc)
186
+ } }),
187
+ React.createElement("div", { hidden: !((_g = data === null || data === void 0 ? void 0 : data.tag) === null || _g === void 0 ? void 0 : _g.link), className: 'list-collection', onClick: handleClickLink, style: Object.assign(Object.assign({}, (_h = props === null || props === void 0 ? void 0 : props.textStyles) === null || _h === void 0 ? void 0 : _h.hashTagLink), { marginBottom: props === null || props === void 0 ? void 0 : props.space }), dangerouslySetInnerHTML: {
188
+ __html: setFontForText(((_j = data === null || data === void 0 ? void 0 : data.tag) === null || _j === void 0 ? void 0 : _j.linkTitle) || 'Shop the collection', (_k = props === null || props === void 0 ? void 0 : props.textStyles) === null || _k === void 0 ? void 0 : _k.hashTagLink)
189
+ } }),
181
190
  React.createElement("div", { className: 'list-content' }, list === null || list === void 0 ? void 0 : list.map((item, ind) => {
182
191
  return (React.createElement(WaterfallFlowItem, Object.assign({ key: ind, index: ind, rec: item, list: list, reportTagsView: reportTagsView }, props)));
183
192
  })),
184
193
  React.createElement("div", { hidden: !isLoadMore, style: { textAlign: 'center' } }, "loading..."),
185
- React.createElement("div", { hidden: !((_j = data === null || data === void 0 ? void 0 : data.tag) === null || _j === void 0 ? void 0 : _j.link), style: {
186
- height: ((_k = data === null || data === void 0 ? void 0 : data.tag) === null || _k === void 0 ? void 0 : _k.link) ? ((_l = props === null || props === void 0 ? void 0 : props.buttonBgStyle) === null || _l === void 0 ? void 0 : _l.height) || ((_m = props === null || props === void 0 ? void 0 : props.buttonStyle) === null || _m === void 0 ? void 0 : _m.height) || '100px' : 0
194
+ React.createElement("div", { hidden: !((_l = data === null || data === void 0 ? void 0 : data.tag) === null || _l === void 0 ? void 0 : _l.link), style: {
195
+ height: ((_m = data === null || data === void 0 ? void 0 : data.tag) === null || _m === void 0 ? void 0 : _m.link) ? ((_o = props === null || props === void 0 ? void 0 : props.buttonBgStyle) === null || _o === void 0 ? void 0 : _o.height) || ((_p = props === null || props === void 0 ? void 0 : props.buttonStyle) === null || _p === void 0 ? void 0 : _p.height) || '100px' : 0
187
196
  } })),
188
- React.createElement("div", { className: 'list-bottom', hidden: !((_o = data === null || data === void 0 ? void 0 : data.tag) === null || _o === void 0 ? void 0 : _o.link), style: props === null || props === void 0 ? void 0 : props.buttonBgStyle }),
189
- React.createElement("div", { hidden: !((_p = data === null || data === void 0 ? void 0 : data.tag) === null || _p === void 0 ? void 0 : _p.link), className: 'list-btn-wrap', style: Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props.buttonBgStyle), { height: 'auto', backgroundColor: 'transparent' }) },
190
- React.createElement("button", { "aria-label": ((_q = data === null || data === void 0 ? void 0 : data.tag) === null || _q === void 0 ? void 0 : _q.linkTitle) || 'Shop the collection', className: 'list-btn', style: props === null || props === void 0 ? void 0 : props.buttonStyle, onClick: handleClickLink }, ((_r = data === null || data === void 0 ? void 0 : data.tag) === null || _r === void 0 ? void 0 : _r.linkTitle) || 'Shop the collection'))))));
197
+ React.createElement("div", { className: 'list-bottom', hidden: !((_q = data === null || data === void 0 ? void 0 : data.tag) === null || _q === void 0 ? void 0 : _q.link), style: props === null || props === void 0 ? void 0 : props.buttonBgStyle }),
198
+ React.createElement("div", { hidden: !((_r = data === null || data === void 0 ? void 0 : data.tag) === null || _r === void 0 ? void 0 : _r.link), className: 'list-btn-wrap', style: Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props.buttonBgStyle), { height: 'auto', backgroundColor: 'transparent' }) },
199
+ React.createElement("button", { "aria-label": ((_s = data === null || data === void 0 ? void 0 : data.tag) === null || _s === void 0 ? void 0 : _s.linkTitle) || 'Shop the collection', className: 'list-btn', style: props === null || props === void 0 ? void 0 : props.buttonStyle, onClick: handleClickLink, dangerouslySetInnerHTML: {
200
+ __html: setFontForText(((_t = data === null || data === void 0 ? void 0 : data.tag) === null || _t === void 0 ? void 0 : _t.linkTitle) || 'Shop the collection', props === null || props === void 0 ? void 0 : props.buttonStyle)
201
+ } }))))));
191
202
  }
@@ -5,6 +5,7 @@ import './WaterfallList.less';
5
5
  import previewData from './preview.json';
6
6
  import FormatImage from '../FormatImage';
7
7
  import { css } from '@emotion/css';
8
+ import { setFontForText } from '../../../../core/utils/tool';
8
9
  const WaterfallFlowItem = (props) => {
9
10
  const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
10
11
  const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = useSxpDataSource();
@@ -102,11 +103,15 @@ const WaterfallFlowItem = (props) => {
102
103
  React.createElement("div", { className: 'waterFallList-content-listItem-picture', ref: pictRef },
103
104
  React.createElement(FormatImage, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', onLoad: imgLoad, ref: imgDom })),
104
105
  React.createElement("div", { className: 'waterFallList-content-listItem-info' },
105
- React.createElement("div", { className: `${'waterFallList-content-listItem-info-title'} ${priceText ? 'waterFallList-content-listItem-info-nowrap' : ''}`, style: Object.assign({}, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title) }, title && title),
106
- React.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price }, priceText))));
106
+ React.createElement("div", { className: `${'waterFallList-content-listItem-info-title'} ${priceText ? 'waterFallList-content-listItem-info-nowrap' : ''}`, style: Object.assign({}, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title), dangerouslySetInnerHTML: {
107
+ __html: setFontForText(title, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title)
108
+ } }),
109
+ React.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price, dangerouslySetInnerHTML: {
110
+ __html: setFontForText(priceText, textStyles === null || textStyles === void 0 ? void 0 : textStyles.price)
111
+ } }))));
107
112
  };
108
113
  export default function WaterfallList(_a) {
109
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
114
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
110
115
  var { reportTagsView, showBanner } = _a, props = __rest(_a, ["reportTagsView", "showBanner"]);
111
116
  const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = useSxpDataSource();
112
117
  const scrollParent = useRef(null);
@@ -284,23 +289,29 @@ export default function WaterfallList(_a) {
284
289
  objectFit: 'cover',
285
290
  marginBottom: '20px'
286
291
  }), src: (_c = data === null || data === void 0 ? void 0 : data.tag) === null || _c === void 0 ? void 0 : _c.picture }))),
287
- React.createElement("div", { className: 'waterFallList-info', style: (_d = props === null || props === void 0 ? void 0 : props.textStyles) === null || _d === void 0 ? void 0 : _d.hashTagDesc }, (_e = data === null || data === void 0 ? void 0 : data.tag) === null || _e === void 0 ? void 0 : _e.info),
288
- React.createElement("div", { hidden: !((_f = data === null || data === void 0 ? void 0 : data.tag) === null || _f === void 0 ? void 0 : _f.link), className: 'waterFallList-collection', style: Object.assign({}, (_g = props === null || props === void 0 ? void 0 : props.textStyles) === null || _g === void 0 ? void 0 : _g.hashTagLink), onClick: handleClickLink }, ((_h = data === null || data === void 0 ? void 0 : data.tag) === null || _h === void 0 ? void 0 : _h.linkTitle) || 'Shop the collection'),
292
+ React.createElement("div", { className: 'waterFallList-info', style: (_d = props === null || props === void 0 ? void 0 : props.textStyles) === null || _d === void 0 ? void 0 : _d.hashTagDesc, dangerouslySetInnerHTML: {
293
+ __html: setFontForText((_e = data === null || data === void 0 ? void 0 : data.tag) === null || _e === void 0 ? void 0 : _e.info, (_f = props === null || props === void 0 ? void 0 : props.textStyles) === null || _f === void 0 ? void 0 : _f.hashTagDesc)
294
+ } }),
295
+ React.createElement("div", { hidden: !((_g = data === null || data === void 0 ? void 0 : data.tag) === null || _g === void 0 ? void 0 : _g.link), className: 'waterFallList-collection', style: Object.assign({}, (_h = props === null || props === void 0 ? void 0 : props.textStyles) === null || _h === void 0 ? void 0 : _h.hashTagLink), onClick: handleClickLink, dangerouslySetInnerHTML: {
296
+ __html: setFontForText(((_j = data === null || data === void 0 ? void 0 : data.tag) === null || _j === void 0 ? void 0 : _j.linkTitle) || 'Shop the collection', (_k = props === null || props === void 0 ? void 0 : props.textStyles) === null || _k === void 0 ? void 0 : _k.hashTagLink)
297
+ } }),
289
298
  React.createElement("div", { className: 'waterFallList-content' }, list === null || list === void 0 ? void 0 :
290
299
  list.map((item, ind) => {
291
300
  var _a;
292
301
  return (React.createElement(WaterfallFlowItem, Object.assign({ key: ind, index: ind, rec: item, list: list, showBorder: scrollTop + ((_a = scrollParent === null || scrollParent === void 0 ? void 0 : scrollParent.current) === null || _a === void 0 ? void 0 : _a.clientHeight), style: styleList[ind], sizeChange: onSizeChange, unitWidth: unitWidth, reportTagsView: reportTagsView }, props)));
293
302
  }),
294
- React.createElement("div", { hidden: !((_j = data === null || data === void 0 ? void 0 : data.tag) === null || _j === void 0 ? void 0 : _j.link), style: {
303
+ React.createElement("div", { hidden: !((_l = data === null || data === void 0 ? void 0 : data.tag) === null || _l === void 0 ? void 0 : _l.link), style: {
295
304
  position: 'absolute',
296
305
  width: '100%',
297
- transform: `translate(0px,${(_p = ((_l = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current[((_k = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current) === null || _k === void 0 ? void 0 : _k.length) - 1]) === null || _l === void 0 ? void 0 : _l.top) +
298
- ((_o = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current[((_m = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current) === null || _m === void 0 ? void 0 : _m.length) - 1]) === null || _o === void 0 ? void 0 : _o.height)) !== null && _p !== void 0 ? _p : 0}px)`,
299
- height: ((_q = data === null || data === void 0 ? void 0 : data.tag) === null || _q === void 0 ? void 0 : _q.link)
300
- ? ((_r = buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) === null || _r === void 0 ? void 0 : _r.offsetHeight) || ((_s = props === null || props === void 0 ? void 0 : props.buttonBgStyle) === null || _s === void 0 ? void 0 : _s.height) || '100px'
306
+ transform: `translate(0px,${(_r = ((_o = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current[((_m = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current) === null || _m === void 0 ? void 0 : _m.length) - 1]) === null || _o === void 0 ? void 0 : _o.top) +
307
+ ((_q = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current[((_p = waterfallFlowListInfo === null || waterfallFlowListInfo === void 0 ? void 0 : waterfallFlowListInfo.current) === null || _p === void 0 ? void 0 : _p.length) - 1]) === null || _q === void 0 ? void 0 : _q.height)) !== null && _r !== void 0 ? _r : 0}px)`,
308
+ height: ((_s = data === null || data === void 0 ? void 0 : data.tag) === null || _s === void 0 ? void 0 : _s.link)
309
+ ? ((_t = buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) === null || _t === void 0 ? void 0 : _t.offsetHeight) || ((_u = props === null || props === void 0 ? void 0 : props.buttonBgStyle) === null || _u === void 0 ? void 0 : _u.height) || '100px'
301
310
  : 0
302
311
  } }))),
303
- React.createElement("div", { className: 'waterFallList-bottom', hidden: !((_t = data === null || data === void 0 ? void 0 : data.tag) === null || _t === void 0 ? void 0 : _t.link), style: props === null || props === void 0 ? void 0 : props.buttonBgStyle }),
304
- React.createElement("div", { ref: buttonRef, hidden: !((_u = data === null || data === void 0 ? void 0 : data.tag) === null || _u === void 0 ? void 0 : _u.link), className: 'waterFallList-btn-wrap', style: Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props.buttonBgStyle), { height: 'auto', backgroundColor: 'transparent' }) },
305
- React.createElement("button", { "aria-label": ((_v = data === null || data === void 0 ? void 0 : data.tag) === null || _v === void 0 ? void 0 : _v.linkTitle) || 'Shop the collection', className: 'waterFallList-btn', style: props === null || props === void 0 ? void 0 : props.buttonStyle, onClick: handleClickLink }, ((_w = data === null || data === void 0 ? void 0 : data.tag) === null || _w === void 0 ? void 0 : _w.linkTitle) || 'Shop the collection'))))));
312
+ React.createElement("div", { className: 'waterFallList-bottom', hidden: !((_v = data === null || data === void 0 ? void 0 : data.tag) === null || _v === void 0 ? void 0 : _v.link), style: props === null || props === void 0 ? void 0 : props.buttonBgStyle }),
313
+ React.createElement("div", { ref: buttonRef, hidden: !((_w = data === null || data === void 0 ? void 0 : data.tag) === null || _w === void 0 ? void 0 : _w.link), className: 'waterFallList-btn-wrap', style: Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props.buttonBgStyle), { height: 'auto', backgroundColor: 'transparent' }) },
314
+ React.createElement("button", { "aria-label": ((_x = data === null || data === void 0 ? void 0 : data.tag) === null || _x === void 0 ? void 0 : _x.linkTitle) || 'Shop the collection', className: 'waterFallList-btn', style: props === null || props === void 0 ? void 0 : props.buttonStyle, onClick: handleClickLink, dangerouslySetInnerHTML: {
315
+ __html: setFontForText(((_y = data === null || data === void 0 ? void 0 : data.tag) === null || _y === void 0 ? void 0 : _y.linkTitle) || 'Shop the collection', props === null || props === void 0 ? void 0 : props.buttonStyle)
316
+ } }))))));
306
317
  }
@@ -35,6 +35,7 @@ export interface ISxpPageRenderProps {
35
35
  likeIconXPosit?: string;
36
36
  swipeTipOffset?: number;
37
37
  consent?: any[];
38
+ videoPlayIcon?: string;
38
39
  };
39
40
  descStyle?: CSSProperties;
40
41
  tipText?: {
@@ -185,7 +185,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
185
185
  const renderContent = useCallback((rec, index) => {
186
186
  var _a, _b, _c, _d;
187
187
  if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) {
188
- return (React.createElement(VideoWidget, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoRef: videoRef.current }));
188
+ return (React.createElement(VideoWidget, { rec: rec, index: index, muted: isMuted, data: data, height: height, activeIndex: activeIndex, videoPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPost, videoRef: videoRef.current, videoPlayIcon: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon }));
189
189
  }
190
190
  if ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
191
191
  return (React.createElement(PictureGroup, { key: rec === null || rec === void 0 ? void 0 : rec.video.itemId, imgUrls: rec === null || rec === void 0 ? void 0 : rec.video.imgUrls, width: containerWidth, height: height, rec: rec, index: index, onReportViewImageEnd: handleReportViewImageEnd, onViewImageStartEvent: handleViewImageStartEvent, imgUrlsPostConfig: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.imgUrlsPost }));
@@ -207,6 +207,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
207
207
  isMuted,
208
208
  activeIndex,
209
209
  globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost,
210
+ globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon,
210
211
  viewTime,
211
212
  tipText,
212
213
  resolver,
@@ -20,6 +20,7 @@ interface IEditorDataContext {
20
20
  setOpenHashtag?: React.Dispatch<React.SetStateAction<boolean>>;
21
21
  openConsent?: boolean;
22
22
  setOpenConsent?: React.Dispatch<React.SetStateAction<boolean>>;
23
+ sxpFontLinks?: any[];
23
24
  }
24
25
  interface IEditorProviderProps {
25
26
  data?: any;
@@ -24,7 +24,8 @@ const EditorDataProvider = ({ children, data }) => {
24
24
  openHashtag,
25
25
  setOpenHashtag,
26
26
  openConsent,
27
- setOpenConsent
27
+ setOpenConsent,
28
+ sxpFontLinks: data === null || data === void 0 ? void 0 : data.sxpFontLinks
28
29
  } }, children));
29
30
  };
30
31
  export function useEditorDataProvider() {
@@ -2,4 +2,9 @@ declare function uuid(len: number, radix: number): string;
2
2
  declare const getIndexByblockType: (type: string, index: number) => number | "initial";
3
3
  export declare const generateRandomString: (length: number) => string;
4
4
  export declare const getUid: () => string;
5
+ interface IfontType {
6
+ 'fontFamily-cn': string;
7
+ 'fontFamily-en': string;
8
+ }
9
+ export declare const setFontForText: (textContent?: string | null, style?: IfontType | any) => string;
5
10
  export { uuid, getIndexByblockType };
@@ -45,4 +45,47 @@ export const getUid = () => {
45
45
  const uid = (originalUid === null || originalUid === void 0 ? void 0 : originalUid.replaceAll) ? originalUid.replaceAll('-', '') : generateRandomString(32);
46
46
  return uid;
47
47
  };
48
+ export const setFontForText = (textContent, style) => {
49
+ if (!textContent)
50
+ return '';
51
+ let content = '';
52
+ const cn = style === null || style === void 0 ? void 0 : style['fontFamily-cn'];
53
+ const en = style === null || style === void 0 ? void 0 : style['fontFamily-en'];
54
+ if (!cn && !en) {
55
+ return textContent;
56
+ }
57
+ let text = textContent;
58
+ const chineseRegex = /[\u4e00-\u9fa5]/g;
59
+ const englishRegex = /[^\u4e00-\u9fa5]/g;
60
+ const cnStyle = `font-family:${cn !== null && cn !== void 0 ? cn : 'inherit'}`;
61
+ const enStyle = `font-family:${en !== null && en !== void 0 ? en : 'inherit'}`;
62
+ const fn = (str) => {
63
+ let chineseStartIndex = str.search(chineseRegex);
64
+ let englishStartIndex = str.search(englishRegex);
65
+ if (chineseStartIndex !== -1 && englishStartIndex !== -1 && chineseStartIndex < englishStartIndex) {
66
+ content += `<span style="${cnStyle}">${str.substring(chineseStartIndex, englishStartIndex)}</span>`;
67
+ text = str.substring(englishStartIndex, str === null || str === void 0 ? void 0 : str.length);
68
+ }
69
+ if (chineseStartIndex !== -1 && englishStartIndex !== -1 && chineseStartIndex > englishStartIndex) {
70
+ content += `<span style="${enStyle}">${str.substring(englishStartIndex, chineseStartIndex)}</span>`;
71
+ text = str.substring(chineseStartIndex, str === null || str === void 0 ? void 0 : str.length);
72
+ }
73
+ if (chineseStartIndex === -1) {
74
+ content += `<span style="${enStyle}">${str.substring(englishStartIndex, str === null || str === void 0 ? void 0 : str.length)}</span>`;
75
+ text = '';
76
+ return false;
77
+ }
78
+ if (englishStartIndex === -1) {
79
+ content += `<span style="${cnStyle}">${str.substring(chineseStartIndex, str === null || str === void 0 ? void 0 : str.length)}</span>`;
80
+ text = '';
81
+ return false;
82
+ }
83
+ return true;
84
+ };
85
+ let w = true;
86
+ while (w) {
87
+ w = fn(text);
88
+ }
89
+ return content;
90
+ };
48
91
  export { uuid, getIndexByblockType };
package/es/index.d.ts CHANGED
@@ -8,5 +8,4 @@ export { default as SxpDataSourceProvider } from './core/context/SxpDataSourcePr
8
8
  export { default as SxpPageCore } from './core/components/SxpPageCore';
9
9
  export { default as EditorDataProvider } from './core/context/EditorDataProvider';
10
10
  export { useEditorDataProvider } from './core/context/EditorDataProvider';
11
- export { default as defaultSetting } from './materials/sxp/defaultSetting';
12
11
  export default Pagebuilder;
package/es/index.js CHANGED
@@ -10,5 +10,4 @@ export { default as SxpDataSourceProvider } from './core/context/SxpDataSourcePr
10
10
  export { default as SxpPageCore } from './core/components/SxpPageCore';
11
11
  export { default as EditorDataProvider } from './core/context/EditorDataProvider';
12
12
  export { useEditorDataProvider } from './core/context/EditorDataProvider';
13
- export { default as defaultSetting } from './materials/sxp/defaultSetting';
14
13
  export default Pagebuilder;
@@ -38,27 +38,25 @@ declare const _default: ({
38
38
  } | {
39
39
  type: string;
40
40
  label: string;
41
- child: ({
41
+ child: {
42
42
  type: string;
43
43
  name: string[];
44
- options?: undefined;
45
- initialValue?: undefined;
46
- addonAfter?: undefined;
47
- } | {
44
+ bottomText: string;
45
+ }[];
46
+ options?: undefined;
47
+ name?: undefined;
48
+ initialValue?: undefined;
49
+ } | {
50
+ type: string;
51
+ label: string;
52
+ child: ({
48
53
  type: string;
49
- options: {
50
- label: string;
51
- value: string;
52
- }[];
53
54
  name: string[];
54
- initialValue: string;
55
55
  addonAfter?: undefined;
56
56
  } | {
57
57
  type: string;
58
58
  addonAfter: string;
59
59
  name: string[];
60
- options?: undefined;
61
- initialValue?: undefined;
62
60
  })[];
63
61
  options?: undefined;
64
62
  name?: undefined;
@@ -105,19 +103,19 @@ declare const _default: ({
105
103
  } | {
106
104
  type: string;
107
105
  label: string;
108
- child: ({
106
+ child: {
109
107
  type: string;
110
108
  name: string[];
111
- initialValue: string;
112
- options?: undefined;
113
- addonAfter?: undefined;
114
- } | {
109
+ bottomText: string;
110
+ }[];
111
+ name?: undefined;
112
+ initialValue?: undefined;
113
+ } | {
114
+ type: string;
115
+ label: string;
116
+ child: ({
115
117
  type: string;
116
118
  name: string[];
117
- options: {
118
- label: string;
119
- value: string;
120
- }[];
121
119
  initialValue: string;
122
120
  addonAfter?: undefined;
123
121
  } | {
@@ -125,7 +123,6 @@ declare const _default: ({
125
123
  name: string[];
126
124
  addonAfter: string;
127
125
  initialValue?: undefined;
128
- options?: undefined;
129
126
  })[];
130
127
  name?: undefined;
131
128
  initialValue?: undefined;
@@ -1,5 +1,3 @@
1
- var _a, _b;
2
- import { fontOptions } from '../defaultSetting';
3
1
  export default [
4
2
  {
5
3
  title: 'Banner',
@@ -68,14 +66,24 @@ export default [
68
66
  label: '标题字体',
69
67
  child: [
70
68
  {
71
- type: 'Color',
72
- name: ['color']
69
+ type: 'Select',
70
+ name: ['fontFamily-cn'],
71
+ bottomText: '中文字体'
73
72
  },
74
73
  {
75
74
  type: 'Select',
76
- options: fontOptions,
77
- name: ['fontFamily'],
78
- initialValue: (_a = fontOptions === null || fontOptions === void 0 ? void 0 : fontOptions[0]) === null || _a === void 0 ? void 0 : _a.value
75
+ name: ['fontFamily-en'],
76
+ bottomText: '英文/其他字体'
77
+ }
78
+ ]
79
+ },
80
+ {
81
+ type: 'Group',
82
+ label: '',
83
+ child: [
84
+ {
85
+ type: 'Color',
86
+ name: ['color']
79
87
  },
80
88
  {
81
89
  type: 'Number',
@@ -142,15 +150,25 @@ export default [
142
150
  label: '字体',
143
151
  child: [
144
152
  {
145
- type: 'Color',
146
- name: ['props', 'buttonStyle', 'color'],
147
- initialValue: '#fff'
153
+ type: 'Select',
154
+ name: ['props', 'buttonStyle', 'fontFamily-cn'],
155
+ bottomText: '中文字体'
148
156
  },
149
157
  {
150
158
  type: 'Select',
151
- name: ['props', 'buttonStyle', 'fontFamily'],
152
- options: fontOptions,
153
- initialValue: (_b = fontOptions === null || fontOptions === void 0 ? void 0 : fontOptions[0]) === null || _b === void 0 ? void 0 : _b.value
159
+ name: ['props', 'buttonStyle', 'fontFamily-en'],
160
+ bottomText: '英文/其他字体'
161
+ }
162
+ ]
163
+ },
164
+ {
165
+ type: 'Group',
166
+ label: '',
167
+ child: [
168
+ {
169
+ type: 'Color',
170
+ name: ['props', 'buttonStyle', 'color'],
171
+ initialValue: '#fff'
154
172
  },
155
173
  {
156
174
  type: 'Number',
@@ -0,0 +1,14 @@
1
+ import { IAppointFormProps } from '.';
2
+ import React from 'react';
3
+ interface IFormProps {
4
+ columns?: {
5
+ title?: string;
6
+ dataIndex?: string;
7
+ valueType?: string;
8
+ key?: string;
9
+ }[];
10
+ layout?: IAppointFormProps['layoutType'];
11
+ onChange?: (data: Record<string, any>) => void;
12
+ }
13
+ declare const _default: React.NamedExoticComponent<IFormProps>;
14
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { memo } from 'react';
2
+ import React from 'react';
3
+ const Form = ({ layout, columns, onChange }) => {
4
+ return (React.createElement(React.Fragment, null, columns === null || columns === void 0 ? void 0 : columns.map((item, index) => (React.createElement("div", { key: index, className: 'pb-appoint-form-container-item', style: { flexDirection: layout === 'horizontal' ? 'row' : 'column' } },
5
+ layout !== 'inline' && React.createElement("label", { className: 'pb-appoint-form-container-label' }, item === null || item === void 0 ? void 0 : item.title),
6
+ (item === null || item === void 0 ? void 0 : item.valueType) === 'text' && (React.createElement("input", { className: 'pb-appoint-form-container-input', type: 'text', placeholder: layout === 'inline' ? item === null || item === void 0 ? void 0 : item.title : '请输入', name: item === null || item === void 0 ? void 0 : item.dataIndex, onChange: onChange })))))));
7
+ };
8
+ export default memo(Form);
@@ -1,15 +1,16 @@
1
1
  import { __awaiter, __rest } from "tslib";
2
2
  import { css } from '@emotion/css';
3
- import React, { memo, useMemo, useRef, useState } from 'react';
3
+ import React, { memo, useCallback, useMemo, useState } from 'react';
4
4
  import { cloneDeep, debounce } from 'lodash';
5
5
  import { useSxpDataSource } from '../../../../core/hooks';
6
6
  import './index.less';
7
7
  import { useEventReport } from '../../../../core/hooks/useEventReport';
8
+ import { setFontForText } from '../../../../core/utils/tool';
9
+ import Form from './Form';
8
10
  const AppointForm = (_a) => {
9
- var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, isExternalLink, isPopup, onClick, onClose, submitButtonStyle } = _a, props = __rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "isExternalLink", "isPopup", "onClick", "onClose", "submitButtonStyle"]);
11
+ var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType = 'inline', isExternalLink, isPopup, onClick, onClose, submitButtonStyle } = _a, props = __rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "isExternalLink", "isPopup", "onClick", "onClose", "submitButtonStyle"]);
10
12
  const { submitForm, popupDetailData } = useSxpDataSource();
11
13
  const { jumpToWeb } = useEventReport();
12
- const formRef = useRef();
13
14
  const [loading, setLoading] = useState(false);
14
15
  const defaultColumns = useMemo(() => [
15
16
  {
@@ -37,27 +38,26 @@ const AppointForm = (_a) => {
37
38
  key: '4'
38
39
  }
39
40
  ], []);
41
+ const [formData, setFormData] = useState({});
40
42
  const columnsData = useMemo(() => {
41
- if (layoutType === undefined) {
42
- const list = cloneDeep(columns) || defaultColumns;
43
- return list === null || list === void 0 ? void 0 : list.map((obj) => (Object.assign(Object.assign({}, obj), { title: undefined, fieldProps: { placeholder: obj === null || obj === void 0 ? void 0 : obj.title } })));
44
- }
45
- else {
46
- return cloneDeep(columns) || defaultColumns;
47
- }
48
- }, [layoutType, columns, defaultColumns]);
43
+ return cloneDeep(columns) || defaultColumns;
44
+ }, [columns, defaultColumns]);
45
+ const handleChange = useCallback((e) => {
46
+ const { name, value } = e.target;
47
+ setFormData(Object.assign(Object.assign({}, formData), { [name]: value }));
48
+ }, [formData]);
49
49
  const handleSubmit = debounce(() => __awaiter(void 0, void 0, void 0, function* () {
50
- var _b, _c, _d, _e, _f, _g;
51
- const vals = yield ((_b = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _b === void 0 ? void 0 : _b.getFieldsValue());
50
+ var _b, _c, _d, _e, _f;
51
+ const vals = formData;
52
52
  if (!vals)
53
53
  return;
54
- const arr = (_d = (_c = Object.keys(vals)) === null || _c === void 0 ? void 0 : _c.map((key) => {
54
+ const arr = (_c = (_b = Object.keys(vals)) === null || _b === void 0 ? void 0 : _b.map((key) => {
55
55
  var _a;
56
56
  return ({
57
57
  name: key,
58
58
  value: (_a = vals[key]) !== null && _a !== void 0 ? _a : ''
59
59
  });
60
- })) === null || _d === void 0 ? void 0 : _d.filter((item) => item === null || item === void 0 ? void 0 : item.value);
60
+ })) === null || _c === void 0 ? void 0 : _c.filter((item) => item === null || item === void 0 ? void 0 : item.value);
61
61
  if (!arr || !(arr === null || arr === void 0 ? void 0 : arr.length))
62
62
  return;
63
63
  setLoading(true);
@@ -66,8 +66,8 @@ const AppointForm = (_a) => {
66
66
  if (res) {
67
67
  if (isExternalLink) {
68
68
  const data = popupDetailData;
69
- const product = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.bindProduct;
70
- const cta = (_g = (_f = data === null || data === void 0 ? void 0 : data.video) === null || _f === void 0 ? void 0 : _f.bindProduct) === null || _g === void 0 ? void 0 : _g.bindCta;
69
+ const product = (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.bindProduct;
70
+ const cta = (_f = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.bindProduct) === null || _f === void 0 ? void 0 : _f.bindCta;
71
71
  const position = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
72
72
  jumpToWeb(data, product, cta, position);
73
73
  }
@@ -78,10 +78,15 @@ const AppointForm = (_a) => {
78
78
  }
79
79
  }), 1000);
80
80
  return (React.createElement("div", { className: 'pb-appoint-form' },
81
- React.createElement("div", { className: `pb-appoint-form-title ${css(Object.assign({}, textStyle))}` }, title),
81
+ React.createElement("div", { className: `pb-appoint-form-title ${css(Object.assign({}, textStyle))}`, dangerouslySetInnerHTML: {
82
+ __html: setFontForText(title, textStyle)
83
+ } }),
82
84
  React.createElement("div", Object.assign({ className: css(Object.assign({}, style)) }, props),
83
- React.createElement("div", { className: 'pb-appoint-form-container' })),
85
+ React.createElement("div", { className: 'pb-appoint-form-container' },
86
+ React.createElement(Form, { columns: columnsData, layout: layoutType, onChange: handleChange }))),
84
87
  React.createElement("div", { className: 'pb-appoint-form-btn-wrapper' },
85
- React.createElement("button", { "aria-label": submitText, onClick: handleSubmit, className: 'pb-appoint-form-btn', style: Object.assign({ color: submitColor, background: submitBgColor }, submitButtonStyle) }, loading ? React.createElement(React.Fragment, null, "loading...") : submitText))));
88
+ React.createElement("button", { "aria-label": submitText, onClick: handleSubmit, className: 'pb-appoint-form-btn', style: Object.assign({ color: submitColor, background: submitBgColor }, submitButtonStyle), dangerouslySetInnerHTML: {
89
+ __html: setFontForText(loading ? 'loading...' : submitText, submitButtonStyle)
90
+ } }))));
86
91
  };
87
92
  export default memo(AppointForm);