pb-sxp-ui 1.0.99 → 1.0.101
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 +408 -184
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +23 -20
- package/dist/index.js +409 -184
- 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 +408 -184
- 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/ExpandableText.js +6 -3
- package/es/core/components/SxpPageRender/Hashtag/index.js +3 -1
- package/es/core/components/SxpPageRender/Navbar.js +4 -1
- package/es/core/components/SxpPageRender/Tagbar.d.ts +1 -0
- package/es/core/components/SxpPageRender/Tagbar.js +2 -2
- package/es/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/VideoWidget/index.js +3 -3
- package/es/core/components/SxpPageRender/WaterFall/List.js +21 -10
- package/es/core/components/SxpPageRender/WaterFall/WaterfallList.js +24 -13
- package/es/core/components/SxpPageRender/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/index.js +9 -3
- package/es/core/context/EditorDataProvider.d.ts +1 -0
- package/es/core/context/EditorDataProvider.js +2 -1
- package/es/core/utils/tool.d.ts +5 -0
- package/es/core/utils/tool.js +43 -0
- package/es/index.d.ts +0 -1
- package/es/index.js +0 -1
- package/es/materials/sxp/HashTag/settingRender.d.ts +19 -22
- package/es/materials/sxp/HashTag/settingRender.js +31 -13
- package/es/materials/sxp/popup/AppointForm/Form.d.ts +14 -0
- package/es/materials/sxp/popup/AppointForm/Form.js +8 -0
- package/es/materials/sxp/popup/AppointForm/index.js +25 -20
- package/es/materials/sxp/popup/AppointForm/settingRender.d.ts +9 -20
- package/es/materials/sxp/popup/AppointForm/settingRender.js +31 -13
- package/es/materials/sxp/popup/CommodityDetail/index.js +14 -4
- package/es/materials/sxp/popup/CommodityDetail/settingRender.d.ts +19 -22
- package/es/materials/sxp/popup/CommodityDetail/settingRender.js +31 -13
- package/es/materials/sxp/popup/CommodityDetailDiroNew/index.js +17 -5
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +19 -22
- package/es/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +31 -13
- package/es/materials/sxp/popup/Prompt/index.js +4 -1
- package/es/materials/sxp/popup/Prompt/settingRender.d.ts +10 -8
- package/es/materials/sxp/popup/Prompt/settingRender.js +16 -8
- package/es/materials/sxp/template/Appoint/index.js +4 -1
- package/es/materials/sxp/template/Commodity/index.js +7 -2
- package/es/materials/sxp/template/CommodityDiro/index.js +8 -3
- package/es/materials/sxp/template/CommodityDiroNew/index.js +7 -2
- package/es/materials/sxp/template/Link/index.js +4 -1
- package/es/materials/sxp/template/MultiCommodity/index.js +7 -2
- package/es/materials/sxp/template/MultiCommodityDiro/index.js +8 -3
- package/es/materials/sxp/template/MultiCommodityDiroNew/index.js +7 -2
- package/es/materials/sxp/template/components/settingRender.d.ts +16 -24
- package/es/materials/sxp/template/components/settingRender.js +30 -12
- package/lib/core/components/SxpPageRender/ExpandableText.js +6 -3
- package/lib/core/components/SxpPageRender/Hashtag/index.js +3 -1
- package/lib/core/components/SxpPageRender/Navbar.js +4 -1
- package/lib/core/components/SxpPageRender/Tagbar.d.ts +1 -0
- package/lib/core/components/SxpPageRender/Tagbar.js +2 -2
- package/lib/core/components/SxpPageRender/VideoWidget/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +3 -3
- package/lib/core/components/SxpPageRender/WaterFall/List.js +21 -10
- package/lib/core/components/SxpPageRender/WaterFall/WaterfallList.js +24 -13
- package/lib/core/components/SxpPageRender/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/index.js +9 -3
- package/lib/core/context/EditorDataProvider.d.ts +1 -0
- package/lib/core/context/EditorDataProvider.js +2 -1
- package/lib/core/utils/tool.d.ts +5 -0
- package/lib/core/utils/tool.js +45 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +1 -3
- package/lib/materials/sxp/HashTag/settingRender.d.ts +19 -22
- package/lib/materials/sxp/HashTag/settingRender.js +31 -13
- package/lib/materials/sxp/popup/AppointForm/Form.d.ts +14 -0
- package/lib/materials/sxp/popup/AppointForm/Form.js +11 -0
- package/lib/materials/sxp/popup/AppointForm/index.js +24 -19
- package/lib/materials/sxp/popup/AppointForm/settingRender.d.ts +9 -20
- package/lib/materials/sxp/popup/AppointForm/settingRender.js +31 -14
- package/lib/materials/sxp/popup/CommodityDetail/index.js +14 -4
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.d.ts +19 -22
- package/lib/materials/sxp/popup/CommodityDetail/settingRender.js +31 -13
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/index.js +17 -5
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.d.ts +19 -22
- package/lib/materials/sxp/popup/CommodityDetailDiroNew/settingRender.js +31 -13
- package/lib/materials/sxp/popup/Prompt/index.js +4 -1
- package/lib/materials/sxp/popup/Prompt/settingRender.d.ts +10 -8
- package/lib/materials/sxp/popup/Prompt/settingRender.js +16 -9
- package/lib/materials/sxp/template/Appoint/index.js +4 -1
- package/lib/materials/sxp/template/Commodity/index.js +7 -2
- package/lib/materials/sxp/template/CommodityDiro/index.js +8 -3
- package/lib/materials/sxp/template/CommodityDiroNew/index.js +7 -2
- package/lib/materials/sxp/template/Link/index.js +4 -1
- package/lib/materials/sxp/template/MultiCommodity/index.js +7 -2
- package/lib/materials/sxp/template/MultiCommodityDiro/index.js +8 -3
- package/lib/materials/sxp/template/MultiCommodityDiroNew/index.js +7 -2
- package/lib/materials/sxp/template/components/settingRender.d.ts +16 -24
- package/lib/materials/sxp/template/components/settingRender.js +30 -12
- package/package.json +1 -1
- package/es/materials/sxp/defaultSetting.d.ts +0 -8
- package/es/materials/sxp/defaultSetting.js +0 -6
- package/lib/materials/sxp/defaultSetting.d.ts +0 -8
- package/lib/materials/sxp/defaultSetting.js +0 -9
@@ -7,6 +7,7 @@ require("./WaterfallList.less");
|
|
7
7
|
const preview_json_1 = tslib_1.__importDefault(require("./preview.json"));
|
8
8
|
const FormatImage_1 = tslib_1.__importDefault(require("../FormatImage"));
|
9
9
|
const css_1 = require("@emotion/css");
|
10
|
+
const tool_1 = require("../../../../core/utils/tool");
|
10
11
|
const WaterfallFlowItem = (props) => {
|
11
12
|
const { rec, style = {}, sizeChange = () => { }, unitWidth, index, showBorder, list, reportTagsView, textStyles, space } = props;
|
12
13
|
const { swiperRef, setRtcList, setOpenHashtag, sxpParameter } = (0, hooks_1.useSxpDataSource)();
|
@@ -104,11 +105,15 @@ const WaterfallFlowItem = (props) => {
|
|
104
105
|
react_1.default.createElement("div", { className: 'waterFallList-content-listItem-picture', ref: pictRef },
|
105
106
|
react_1.default.createElement(FormatImage_1.default, { loading: 'lazy', className: 'waterFallList-content-listItem-picture-img', onLoad: imgLoad, ref: imgDom })),
|
106
107
|
react_1.default.createElement("div", { className: 'waterFallList-content-listItem-info' },
|
107
|
-
react_1.default.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)
|
108
|
-
|
108
|
+
react_1.default.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: {
|
109
|
+
__html: (0, tool_1.setFontForText)(title, textStyles === null || textStyles === void 0 ? void 0 : textStyles.title)
|
110
|
+
} }),
|
111
|
+
react_1.default.createElement("div", { className: 'waterFallList-content-listItem-info-price', hidden: !priceText, style: textStyles.price, dangerouslySetInnerHTML: {
|
112
|
+
__html: (0, tool_1.setFontForText)(priceText, textStyles === null || textStyles === void 0 ? void 0 : textStyles.price)
|
113
|
+
} }))));
|
109
114
|
};
|
110
115
|
function WaterfallList(_a) {
|
111
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
116
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
112
117
|
var { reportTagsView, showBanner } = _a, props = tslib_1.__rest(_a, ["reportTagsView", "showBanner"]);
|
113
118
|
const { waterFallData, getRecommendVideos, hashTagSize, loadingImage, isOpenHashTag } = (0, hooks_1.useSxpDataSource)();
|
114
119
|
const scrollParent = (0, react_1.useRef)(null);
|
@@ -286,24 +291,30 @@ function WaterfallList(_a) {
|
|
286
291
|
objectFit: 'cover',
|
287
292
|
marginBottom: '20px'
|
288
293
|
}), src: (_c = data === null || data === void 0 ? void 0 : data.tag) === null || _c === void 0 ? void 0 : _c.picture }))),
|
289
|
-
react_1.default.createElement("div", { className: 'waterFallList-info', style: (_d = props === null || props === void 0 ? void 0 : props.textStyles) === null || _d === void 0 ? void 0 : _d.hashTagDesc
|
290
|
-
|
294
|
+
react_1.default.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: {
|
295
|
+
__html: (0, tool_1.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)
|
296
|
+
} }),
|
297
|
+
react_1.default.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: {
|
298
|
+
__html: (0, tool_1.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)
|
299
|
+
} }),
|
291
300
|
react_1.default.createElement("div", { className: 'waterFallList-content' }, list === null || list === void 0 ? void 0 :
|
292
301
|
list.map((item, ind) => {
|
293
302
|
var _a;
|
294
303
|
return (react_1.default.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)));
|
295
304
|
}),
|
296
|
-
react_1.default.createElement("div", { hidden: !((
|
305
|
+
react_1.default.createElement("div", { hidden: !((_l = data === null || data === void 0 ? void 0 : data.tag) === null || _l === void 0 ? void 0 : _l.link), style: {
|
297
306
|
position: 'absolute',
|
298
307
|
width: '100%',
|
299
|
-
transform: `translate(0px,${(
|
300
|
-
((
|
301
|
-
height: ((
|
302
|
-
? ((
|
308
|
+
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) +
|
309
|
+
((_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)`,
|
310
|
+
height: ((_s = data === null || data === void 0 ? void 0 : data.tag) === null || _s === void 0 ? void 0 : _s.link)
|
311
|
+
? ((_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'
|
303
312
|
: 0
|
304
313
|
} }))),
|
305
|
-
react_1.default.createElement("div", { className: 'waterFallList-bottom', hidden: !((
|
306
|
-
react_1.default.createElement("div", { ref: buttonRef, hidden: !((
|
307
|
-
react_1.default.createElement("button", { "aria-label": ((
|
314
|
+
react_1.default.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 }),
|
315
|
+
react_1.default.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' }) },
|
316
|
+
react_1.default.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: {
|
317
|
+
__html: (0, tool_1.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)
|
318
|
+
} }))))));
|
308
319
|
}
|
309
320
|
exports.default = WaterfallList;
|
@@ -171,11 +171,14 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
171
171
|
}
|
172
172
|
return h;
|
173
173
|
}, [tagList, waterFallData]);
|
174
|
-
const
|
174
|
+
const minusHeight = (0, react_1.useMemo)(() => {
|
175
175
|
let minusHeight = 0;
|
176
176
|
if ((globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.logoUrl) && (globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.isShowLogo)) {
|
177
177
|
minusHeight += 45;
|
178
178
|
}
|
179
|
+
return minusHeight;
|
180
|
+
}, []);
|
181
|
+
const height = (0, react_1.useMemo)(() => {
|
179
182
|
return containerHeight - minusHeight - tagHeight;
|
180
183
|
}, [globalConfig, containerHeight, tagHeight]);
|
181
184
|
const renderLogo = (0, react_1.useMemo)(() => {
|
@@ -188,7 +191,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
188
191
|
const renderContent = (0, react_1.useCallback)((rec, index) => {
|
189
192
|
var _a, _b, _c, _d;
|
190
193
|
if ((_a = rec === null || rec === void 0 ? void 0 : rec.video) === null || _a === void 0 ? void 0 : _a.url) {
|
191
|
-
return (react_1.default.createElement(VideoWidget_1.default, { 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 }));
|
194
|
+
return (react_1.default.createElement(VideoWidget_1.default, { 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 }));
|
192
195
|
}
|
193
196
|
if ((_b = rec === null || rec === void 0 ? void 0 : rec.video) === null || _b === void 0 ? void 0 : _b.imgUrls) {
|
194
197
|
return (react_1.default.createElement(PictureGroup_1.default, { 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 }));
|
@@ -210,6 +213,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
210
213
|
isMuted,
|
211
214
|
activeIndex,
|
212
215
|
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.productPost,
|
216
|
+
globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.videoPlayIcon,
|
213
217
|
viewTime,
|
214
218
|
tipText,
|
215
219
|
resolver,
|
@@ -407,7 +411,9 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
|
|
407
411
|
setOpenHashtag === null || setOpenHashtag === void 0 ? void 0 : setOpenHashtag(true);
|
408
412
|
} })),
|
409
413
|
renderLogo,
|
410
|
-
react_1.default.createElement(Tagbar_1.default, { tagList: tagList, setActiveIndex: setActiveIndex
|
414
|
+
react_1.default.createElement(Tagbar_1.default, { tagList: tagList, setActiveIndex: setActiveIndex, style: {
|
415
|
+
top: minusHeight
|
416
|
+
} }),
|
411
417
|
isShowFingerTip ? (react_1.default.createElement(FingerSwipeTip_1.default, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 + ((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipOffset) !== null && _a !== void 0 ? _a : 0)}%` } })) : null,
|
412
418
|
react_1.default.createElement(react_2.Swiper, { style: {
|
413
419
|
marginTop: tagHeight
|
@@ -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;
|
@@ -28,7 +28,8 @@ const EditorDataProvider = ({ children, data }) => {
|
|
28
28
|
openHashtag,
|
29
29
|
setOpenHashtag,
|
30
30
|
openConsent,
|
31
|
-
setOpenConsent
|
31
|
+
setOpenConsent,
|
32
|
+
sxpFontLinks: data === null || data === void 0 ? void 0 : data.sxpFontLinks
|
32
33
|
} }, children));
|
33
34
|
};
|
34
35
|
function useEditorDataProvider() {
|
package/lib/core/utils/tool.d.ts
CHANGED
@@ -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 };
|
package/lib/core/utils/tool.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getIndexByblockType = exports.uuid = exports.getUid = exports.generateRandomString = void 0;
|
3
|
+
exports.getIndexByblockType = exports.uuid = exports.setFontForText = exports.getUid = exports.generateRandomString = void 0;
|
4
4
|
const uuid_1 = require("uuid");
|
5
5
|
function uuid(len, radix) {
|
6
6
|
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
|
@@ -52,3 +52,47 @@ const getUid = () => {
|
|
52
52
|
return uid;
|
53
53
|
};
|
54
54
|
exports.getUid = getUid;
|
55
|
+
const setFontForText = (textContent, style) => {
|
56
|
+
if (!textContent)
|
57
|
+
return '';
|
58
|
+
let content = '';
|
59
|
+
const cn = style === null || style === void 0 ? void 0 : style['fontFamily-cn'];
|
60
|
+
const en = style === null || style === void 0 ? void 0 : style['fontFamily-en'];
|
61
|
+
if (!cn && !en) {
|
62
|
+
return textContent;
|
63
|
+
}
|
64
|
+
let text = textContent;
|
65
|
+
const chineseRegex = /[\u4e00-\u9fa5]/g;
|
66
|
+
const englishRegex = /[^\u4e00-\u9fa5]/g;
|
67
|
+
const cnStyle = `font-family:${cn !== null && cn !== void 0 ? cn : 'inherit'}`;
|
68
|
+
const enStyle = `font-family:${en !== null && en !== void 0 ? en : 'inherit'}`;
|
69
|
+
const fn = (str) => {
|
70
|
+
let chineseStartIndex = str.search(chineseRegex);
|
71
|
+
let englishStartIndex = str.search(englishRegex);
|
72
|
+
if (chineseStartIndex !== -1 && englishStartIndex !== -1 && chineseStartIndex < englishStartIndex) {
|
73
|
+
content += `<span style="${cnStyle}">${str.substring(chineseStartIndex, englishStartIndex)}</span>`;
|
74
|
+
text = str.substring(englishStartIndex, str === null || str === void 0 ? void 0 : str.length);
|
75
|
+
}
|
76
|
+
if (chineseStartIndex !== -1 && englishStartIndex !== -1 && chineseStartIndex > englishStartIndex) {
|
77
|
+
content += `<span style="${enStyle}">${str.substring(englishStartIndex, chineseStartIndex)}</span>`;
|
78
|
+
text = str.substring(chineseStartIndex, str === null || str === void 0 ? void 0 : str.length);
|
79
|
+
}
|
80
|
+
if (chineseStartIndex === -1) {
|
81
|
+
content += `<span style="${enStyle}">${str.substring(englishStartIndex, str === null || str === void 0 ? void 0 : str.length)}</span>`;
|
82
|
+
text = '';
|
83
|
+
return false;
|
84
|
+
}
|
85
|
+
if (englishStartIndex === -1) {
|
86
|
+
content += `<span style="${cnStyle}">${str.substring(chineseStartIndex, str === null || str === void 0 ? void 0 : str.length)}</span>`;
|
87
|
+
text = '';
|
88
|
+
return false;
|
89
|
+
}
|
90
|
+
return true;
|
91
|
+
};
|
92
|
+
let w = true;
|
93
|
+
while (w) {
|
94
|
+
w = fn(text);
|
95
|
+
}
|
96
|
+
return content;
|
97
|
+
};
|
98
|
+
exports.setFontForText = setFontForText;
|
package/lib/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/lib/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.useEditorDataProvider = exports.EditorDataProvider = exports.SxpPageCore = exports.SxpDataSourceProvider = exports.Modal = exports.DiyPortalPreview = 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"));
|
@@ -19,6 +19,4 @@ var EditorDataProvider_1 = require("./core/context/EditorDataProvider");
|
|
19
19
|
Object.defineProperty(exports, "EditorDataProvider", { enumerable: true, get: function () { return tslib_1.__importDefault(EditorDataProvider_1).default; } });
|
20
20
|
var EditorDataProvider_2 = require("./core/context/EditorDataProvider");
|
21
21
|
Object.defineProperty(exports, "useEditorDataProvider", { enumerable: true, get: function () { return EditorDataProvider_2.useEditorDataProvider; } });
|
22
|
-
var defaultSetting_1 = require("./materials/sxp/defaultSetting");
|
23
|
-
Object.defineProperty(exports, "defaultSetting", { enumerable: true, get: function () { return tslib_1.__importDefault(defaultSetting_1).default; } });
|
24
22
|
exports.default = Pagebuilder_1.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
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
112
|
-
|
113
|
-
|
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,7 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
-
var _a, _b;
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
const defaultSetting_1 = require("../defaultSetting");
|
5
3
|
exports.default = [
|
6
4
|
{
|
7
5
|
title: 'Banner',
|
@@ -70,14 +68,24 @@ exports.default = [
|
|
70
68
|
label: '标题字体',
|
71
69
|
child: [
|
72
70
|
{
|
73
|
-
type: '
|
74
|
-
name: ['
|
71
|
+
type: 'Select',
|
72
|
+
name: ['fontFamily-cn'],
|
73
|
+
bottomText: '中文字体'
|
75
74
|
},
|
76
75
|
{
|
77
76
|
type: 'Select',
|
78
|
-
|
79
|
-
|
80
|
-
|
77
|
+
name: ['fontFamily-en'],
|
78
|
+
bottomText: '英文/其他字体'
|
79
|
+
}
|
80
|
+
]
|
81
|
+
},
|
82
|
+
{
|
83
|
+
type: 'Group',
|
84
|
+
label: '',
|
85
|
+
child: [
|
86
|
+
{
|
87
|
+
type: 'Color',
|
88
|
+
name: ['color']
|
81
89
|
},
|
82
90
|
{
|
83
91
|
type: 'Number',
|
@@ -144,15 +152,25 @@ exports.default = [
|
|
144
152
|
label: '字体',
|
145
153
|
child: [
|
146
154
|
{
|
147
|
-
type: '
|
148
|
-
name: ['props', 'buttonStyle', '
|
149
|
-
|
155
|
+
type: 'Select',
|
156
|
+
name: ['props', 'buttonStyle', 'fontFamily-cn'],
|
157
|
+
bottomText: '中文字体'
|
150
158
|
},
|
151
159
|
{
|
152
160
|
type: 'Select',
|
153
|
-
name: ['props', 'buttonStyle', 'fontFamily'],
|
154
|
-
|
155
|
-
|
161
|
+
name: ['props', 'buttonStyle', 'fontFamily-en'],
|
162
|
+
bottomText: '英文/其他字体'
|
163
|
+
}
|
164
|
+
]
|
165
|
+
},
|
166
|
+
{
|
167
|
+
type: 'Group',
|
168
|
+
label: '',
|
169
|
+
child: [
|
170
|
+
{
|
171
|
+
type: 'Color',
|
172
|
+
name: ['props', 'buttonStyle', 'color'],
|
173
|
+
initialValue: '#fff'
|
156
174
|
},
|
157
175
|
{
|
158
176
|
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,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
const react_1 = require("react");
|
5
|
+
const react_2 = tslib_1.__importDefault(require("react"));
|
6
|
+
const Form = ({ layout, columns, onChange }) => {
|
7
|
+
return (react_2.default.createElement(react_2.default.Fragment, null, columns === null || columns === void 0 ? void 0 : columns.map((item, index) => (react_2.default.createElement("div", { key: index, className: 'pb-appoint-form-container-item', style: { flexDirection: layout === 'horizontal' ? 'row' : 'column' } },
|
8
|
+
layout !== 'inline' && react_2.default.createElement("label", { className: 'pb-appoint-form-container-label' }, item === null || item === void 0 ? void 0 : item.title),
|
9
|
+
(item === null || item === void 0 ? void 0 : item.valueType) === 'text' && (react_2.default.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 })))))));
|
10
|
+
};
|
11
|
+
exports.default = (0, react_1.memo)(Form);
|
@@ -7,11 +7,12 @@ const lodash_1 = require("lodash");
|
|
7
7
|
const hooks_1 = require("../../../../core/hooks");
|
8
8
|
require("./index.less");
|
9
9
|
const useEventReport_1 = require("../../../../core/hooks/useEventReport");
|
10
|
+
const tool_1 = require("../../../../core/utils/tool");
|
11
|
+
const Form_1 = tslib_1.__importDefault(require("./Form"));
|
10
12
|
const AppointForm = (_a) => {
|
11
|
-
var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, isExternalLink, isPopup, onClick, onClose, submitButtonStyle } = _a, props = tslib_1.__rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "isExternalLink", "isPopup", "onClick", "onClose", "submitButtonStyle"]);
|
13
|
+
var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType = 'inline', isExternalLink, isPopup, onClick, onClose, submitButtonStyle } = _a, props = tslib_1.__rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "isExternalLink", "isPopup", "onClick", "onClose", "submitButtonStyle"]);
|
12
14
|
const { submitForm, popupDetailData } = (0, hooks_1.useSxpDataSource)();
|
13
15
|
const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
|
14
|
-
const formRef = (0, react_1.useRef)();
|
15
16
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
16
17
|
const defaultColumns = (0, react_1.useMemo)(() => [
|
17
18
|
{
|
@@ -39,27 +40,26 @@ const AppointForm = (_a) => {
|
|
39
40
|
key: '4'
|
40
41
|
}
|
41
42
|
], []);
|
43
|
+
const [formData, setFormData] = (0, react_1.useState)({});
|
42
44
|
const columnsData = (0, react_1.useMemo)(() => {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
}
|
47
|
-
|
48
|
-
|
49
|
-
}
|
50
|
-
}, [layoutType, columns, defaultColumns]);
|
45
|
+
return (0, lodash_1.cloneDeep)(columns) || defaultColumns;
|
46
|
+
}, [columns, defaultColumns]);
|
47
|
+
const handleChange = (0, react_1.useCallback)((e) => {
|
48
|
+
const { name, value } = e.target;
|
49
|
+
setFormData(Object.assign(Object.assign({}, formData), { [name]: value }));
|
50
|
+
}, [formData]);
|
51
51
|
const handleSubmit = (0, lodash_1.debounce)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
52
|
-
var _b, _c, _d, _e, _f
|
53
|
-
const vals =
|
52
|
+
var _b, _c, _d, _e, _f;
|
53
|
+
const vals = formData;
|
54
54
|
if (!vals)
|
55
55
|
return;
|
56
|
-
const arr = (
|
56
|
+
const arr = (_c = (_b = Object.keys(vals)) === null || _b === void 0 ? void 0 : _b.map((key) => {
|
57
57
|
var _a;
|
58
58
|
return ({
|
59
59
|
name: key,
|
60
60
|
value: (_a = vals[key]) !== null && _a !== void 0 ? _a : ''
|
61
61
|
});
|
62
|
-
})) === null ||
|
62
|
+
})) === null || _c === void 0 ? void 0 : _c.filter((item) => item === null || item === void 0 ? void 0 : item.value);
|
63
63
|
if (!arr || !(arr === null || arr === void 0 ? void 0 : arr.length))
|
64
64
|
return;
|
65
65
|
setLoading(true);
|
@@ -68,8 +68,8 @@ const AppointForm = (_a) => {
|
|
68
68
|
if (res) {
|
69
69
|
if (isExternalLink) {
|
70
70
|
const data = popupDetailData;
|
71
|
-
const product = (
|
72
|
-
const cta = (
|
71
|
+
const product = (_d = data === null || data === void 0 ? void 0 : data.video) === null || _d === void 0 ? void 0 : _d.bindProduct;
|
72
|
+
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;
|
73
73
|
const position = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
|
74
74
|
jumpToWeb(data, product, cta, position);
|
75
75
|
}
|
@@ -80,10 +80,15 @@ const AppointForm = (_a) => {
|
|
80
80
|
}
|
81
81
|
}), 1000);
|
82
82
|
return (react_1.default.createElement("div", { className: 'pb-appoint-form' },
|
83
|
-
react_1.default.createElement("div", { className: `pb-appoint-form-title ${(0, css_1.css)(Object.assign({}, textStyle))}
|
83
|
+
react_1.default.createElement("div", { className: `pb-appoint-form-title ${(0, css_1.css)(Object.assign({}, textStyle))}`, dangerouslySetInnerHTML: {
|
84
|
+
__html: (0, tool_1.setFontForText)(title, textStyle)
|
85
|
+
} }),
|
84
86
|
react_1.default.createElement("div", Object.assign({ className: (0, css_1.css)(Object.assign({}, style)) }, props),
|
85
|
-
react_1.default.createElement("div", { className: 'pb-appoint-form-container' }
|
87
|
+
react_1.default.createElement("div", { className: 'pb-appoint-form-container' },
|
88
|
+
react_1.default.createElement(Form_1.default, { columns: columnsData, layout: layoutType, onChange: handleChange }))),
|
86
89
|
react_1.default.createElement("div", { className: 'pb-appoint-form-btn-wrapper' },
|
87
|
-
react_1.default.createElement("button", { "aria-label": submitText, onClick: handleSubmit, className: 'pb-appoint-form-btn', style: Object.assign({ color: submitColor, background: submitBgColor }, submitButtonStyle)
|
90
|
+
react_1.default.createElement("button", { "aria-label": submitText, onClick: handleSubmit, className: 'pb-appoint-form-btn', style: Object.assign({ color: submitColor, background: submitBgColor }, submitButtonStyle), dangerouslySetInnerHTML: {
|
91
|
+
__html: (0, tool_1.setFontForText)(loading ? 'loading...' : submitText, submitButtonStyle)
|
92
|
+
} }))));
|
88
93
|
};
|
89
94
|
exports.default = (0, react_1.memo)(AppointForm);
|
@@ -15,27 +15,24 @@ declare const _default: ({
|
|
15
15
|
} | {
|
16
16
|
type: string;
|
17
17
|
label: string;
|
18
|
-
child:
|
18
|
+
child: {
|
19
19
|
type: string;
|
20
20
|
name: string[];
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
bottomText: string;
|
22
|
+
}[];
|
23
|
+
name?: undefined;
|
24
|
+
options?: undefined;
|
25
|
+
} | {
|
26
|
+
type: string;
|
27
|
+
label: string;
|
28
|
+
child: ({
|
25
29
|
type: string;
|
26
30
|
name: string[];
|
27
|
-
options: {
|
28
|
-
label: string;
|
29
|
-
value: string;
|
30
|
-
}[];
|
31
|
-
initialValue: string;
|
32
31
|
addonAfter?: undefined;
|
33
32
|
} | {
|
34
33
|
type: string;
|
35
34
|
name: string[];
|
36
35
|
addonAfter: string;
|
37
|
-
options?: undefined;
|
38
|
-
initialValue?: undefined;
|
39
36
|
})[];
|
40
37
|
name?: undefined;
|
41
38
|
options?: undefined;
|
@@ -58,20 +55,12 @@ declare const _default: ({
|
|
58
55
|
type: string;
|
59
56
|
name: string[];
|
60
57
|
initialValue: string;
|
61
|
-
options?: undefined;
|
62
|
-
addonAfter?: undefined;
|
63
|
-
} | {
|
64
|
-
type: string;
|
65
|
-
name: string[];
|
66
|
-
options: any[];
|
67
|
-
initialValue: any;
|
68
58
|
addonAfter?: undefined;
|
69
59
|
} | {
|
70
60
|
type: string;
|
71
61
|
name: string[];
|
72
62
|
addonAfter: string;
|
73
63
|
initialValue: number;
|
74
|
-
options?: undefined;
|
75
64
|
})[];
|
76
65
|
name?: undefined;
|
77
66
|
options?: undefined;
|
@@ -1,8 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
-
var _a, _b, _c;
|
3
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
4
|
-
const tslib_1 = require("tslib");
|
5
|
-
const defaultSetting_1 = tslib_1.__importStar(require("../../defaultSetting"));
|
6
3
|
exports.default = [
|
7
4
|
{
|
8
5
|
type: 'Text',
|
@@ -22,14 +19,24 @@ exports.default = [
|
|
22
19
|
label: '标题字体',
|
23
20
|
child: [
|
24
21
|
{
|
25
|
-
type: '
|
26
|
-
name: ['
|
22
|
+
type: 'Select',
|
23
|
+
name: ['testStyle', 'fontFamily-cn'],
|
24
|
+
bottomText: '中文字体'
|
27
25
|
},
|
28
26
|
{
|
29
27
|
type: 'Select',
|
30
|
-
name: ['
|
31
|
-
|
32
|
-
|
28
|
+
name: ['testStyle', 'fontFamily-en'],
|
29
|
+
bottomText: '英文/其他字体'
|
30
|
+
}
|
31
|
+
]
|
32
|
+
},
|
33
|
+
{
|
34
|
+
type: 'Group',
|
35
|
+
label: '',
|
36
|
+
child: [
|
37
|
+
{
|
38
|
+
type: 'Color',
|
39
|
+
name: ['textStyle', 'color']
|
33
40
|
},
|
34
41
|
{
|
35
42
|
type: 'Number',
|
@@ -77,15 +84,25 @@ exports.default = [
|
|
77
84
|
label: '提交按钮字体',
|
78
85
|
child: [
|
79
86
|
{
|
80
|
-
type: '
|
81
|
-
name: ['props', 'submitButtonStyle', '
|
82
|
-
|
87
|
+
type: 'Select',
|
88
|
+
name: ['props', 'submitButtonStyle', 'fontFamily-cn'],
|
89
|
+
bottomText: '中文字体'
|
83
90
|
},
|
84
91
|
{
|
85
92
|
type: 'Select',
|
86
|
-
name: ['props', 'submitButtonStyle', 'fontFamily'],
|
87
|
-
|
88
|
-
|
93
|
+
name: ['props', 'submitButtonStyle', 'fontFamily-en'],
|
94
|
+
bottomText: '英文/其他字体'
|
95
|
+
}
|
96
|
+
]
|
97
|
+
},
|
98
|
+
{
|
99
|
+
type: 'Group',
|
100
|
+
label: '',
|
101
|
+
child: [
|
102
|
+
{
|
103
|
+
type: 'Color',
|
104
|
+
name: ['props', 'submitButtonStyle', 'color'],
|
105
|
+
initialValue: '#fff'
|
89
106
|
},
|
90
107
|
{
|
91
108
|
type: 'Number',
|