pb-sxp-ui 1.0.55 → 1.0.57

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.
@@ -9,6 +9,6 @@ const Nudge = ({ nudge }) => {
9
9
  borderRadius: (_f = nudge === null || nudge === void 0 ? void 0 : nudge.borderRadius) !== null && _f !== void 0 ? _f : 4
10
10
  } },
11
11
  (nudge === null || nudge === void 0 ? void 0 : nudge.icon) ? React.createElement("img", { src: nudge.icon, style: { height: '100%', objectFit: 'cover' } }) : null,
12
- React.createElement("p", { style: Object.assign({}, nudge === null || nudge === void 0 ? void 0 : nudge.textStyle) }, (_g = nudge === null || nudge === void 0 ? void 0 : nudge.content) !== null && _g !== void 0 ? _g : '')))));
12
+ React.createElement("p", { style: Object.assign(Object.assign({}, nudge === null || nudge === void 0 ? void 0 : nudge.textStyle), { textWrap: 'nowrap', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }) }, (_g = nudge === null || nudge === void 0 ? void 0 : nudge.content) !== null && _g !== void 0 ? _g : '')))));
13
13
  };
14
14
  export default Nudge;
@@ -45,18 +45,19 @@ const Popup = () => {
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
- var _a, _b, _c, _d, _e, _f, _g, _h;
48
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
49
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
- const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
53
- return (React.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.style), { width: '100%', height: '80vh', overflow: 'auto' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_d = value === null || value === void 0 ? void 0 : value.item) === null || _d === void 0 ? void 0 : _d.textStyle), bindDatas: (_f = (_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.bindDatas) !== null && _f !== void 0 ? _f : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.props, { event: ((_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, onClose: handleClose })));
52
+ const isExternalLink = ((_d = (_c = (_b = value === null || value === void 0 ? void 0 : value.item) === null || _b === void 0 ? void 0 : _b.event) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.linkType) === 'externalLink';
53
+ const defaulSetting = (_e = t === null || t === void 0 ? void 0 : t.extend) === null || _e === void 0 ? void 0 : _e.defaulSetting;
54
+ return (React.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_f = value === null || value === void 0 ? void 0 : value.item) === null || _f === void 0 ? void 0 : _f.style), { width: '100%', height: '80vh', overflow: 'auto' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.textStyle), bindDatas: (_j = (_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.bindDatas) !== null && _j !== void 0 ? _j : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_k = value === null || value === void 0 ? void 0 : value.item) === null || _k === void 0 ? void 0 : _k.props, { event: ((_l = value === null || value === void 0 ? void 0 : value.item) === null || _l === void 0 ? void 0 : _l.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, isExternalLink: isExternalLink, onClose: handleClose })));
54
55
  }
55
56
  else {
56
57
  return React.createElement(React.Fragment, null);
57
58
  }
58
59
  });
59
- }, [schema, popup, resolver]);
60
+ }, [schema, popup, resolver, handleClose]);
60
61
  return (React.createElement(Modal, { popup: visible, onClose: handleClose, padding: 0, modalStyle: { position: 'fixed' } }, renderPopupDetail));
61
62
  };
62
63
  export default Popup;
@@ -12,6 +12,7 @@ export interface IAppointFormProps {
12
12
  submitApiUrl?: string;
13
13
  submitEmail?: string;
14
14
  layoutType?: 'horizontal' | 'vertical' | 'inline';
15
+ isExternalLink?: boolean;
15
16
  onClick?: () => void;
16
17
  onClose?: () => void;
17
18
  }
@@ -5,9 +5,11 @@ import { BetaSchemaForm } from '@ant-design/pro-components';
5
5
  import { cloneDeep, debounce } from 'lodash';
6
6
  import { useSxpDataSource } from '../../../../core/hooks';
7
7
  import './index.less';
8
+ import { useEventReport } from '../../../../core/hooks/useEventReport';
8
9
  const AppointForm = (_a) => {
9
- var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, onClick, onClose } = _a, props = __rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "onClick", "onClose"]);
10
- const { submitForm } = useSxpDataSource();
10
+ var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, isExternalLink, onClick, onClose } = _a, props = __rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "isExternalLink", "onClick", "onClose"]);
11
+ const { submitForm, popupDetailData } = useSxpDataSource();
12
+ const { jumpToWeb } = useEventReport();
11
13
  const formRef = useRef();
12
14
  const [loading, setLoading] = useState(false);
13
15
  const defaultColumns = useMemo(() => [
@@ -46,7 +48,7 @@ const AppointForm = (_a) => {
46
48
  }
47
49
  }, [layoutType, columns, defaultColumns]);
48
50
  const handleSubmit = debounce(() => __awaiter(void 0, void 0, void 0, function* () {
49
- var _b, _c, _d;
51
+ var _b, _c, _d, _e, _f, _g;
50
52
  const vals = yield ((_b = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _b === void 0 ? void 0 : _b.getFieldsValue());
51
53
  if (!vals)
52
54
  return;
@@ -63,6 +65,13 @@ const AppointForm = (_a) => {
63
65
  const res = (yield (submitForm === null || submitForm === void 0 ? void 0 : submitForm({ attributes: arr })));
64
66
  setLoading(false);
65
67
  if (res) {
68
+ if (isExternalLink) {
69
+ const data = popupDetailData;
70
+ const product = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.bindProduct;
71
+ 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;
72
+ const position = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
73
+ jumpToWeb(data, product, cta, position);
74
+ }
66
75
  onClose === null || onClose === void 0 ? void 0 : onClose();
67
76
  onClick === null || onClick === void 0 ? void 0 : onClick();
68
77
  }
@@ -23,7 +23,7 @@ const CommodityDetail = (_a) => {
23
23
  const position = isPost ? index : popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
24
24
  const handleLink = () => {
25
25
  if (product === null || product === void 0 ? void 0 : product.link) {
26
- jumpToWeb(popupDetailData, product, cta, position);
26
+ jumpToWeb(data, product, cta, position);
27
27
  if (!isPost) {
28
28
  productView(data, product, cta, viewTime || curTimeRef.current, position);
29
29
  }
@@ -12,6 +12,6 @@ const Nudge = ({ nudge }) => {
12
12
  borderRadius: (_f = nudge === null || nudge === void 0 ? void 0 : nudge.borderRadius) !== null && _f !== void 0 ? _f : 4
13
13
  } },
14
14
  (nudge === null || nudge === void 0 ? void 0 : nudge.icon) ? react_1.default.createElement("img", { src: nudge.icon, style: { height: '100%', objectFit: 'cover' } }) : null,
15
- react_1.default.createElement("p", { style: Object.assign({}, nudge === null || nudge === void 0 ? void 0 : nudge.textStyle) }, (_g = nudge === null || nudge === void 0 ? void 0 : nudge.content) !== null && _g !== void 0 ? _g : '')))));
15
+ react_1.default.createElement("p", { style: Object.assign(Object.assign({}, nudge === null || nudge === void 0 ? void 0 : nudge.textStyle), { textWrap: 'nowrap', textOverflow: 'ellipsis', overflow: 'hidden', whiteSpace: 'nowrap' }) }, (_g = nudge === null || nudge === void 0 ? void 0 : nudge.content) !== null && _g !== void 0 ? _g : '')))));
16
16
  };
17
17
  exports.default = Nudge;
@@ -48,18 +48,19 @@ const Popup = () => {
48
48
  const renderPopupDetail = (0, react_1.useMemo)(() => {
49
49
  var _a, _b, _c;
50
50
  return (_c = (_b = (_a = schema === null || schema === void 0 ? void 0 : schema.sxpPageConf) === null || _a === void 0 ? void 0 : _a.globalConfig) === null || _b === void 0 ? void 0 : _b.popupList) === null || _c === void 0 ? void 0 : _c.map((value, index) => {
51
- var _a, _b, _c, _d, _e, _f, _g, _h;
51
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
52
52
  if ((value === null || value === void 0 ? void 0 : value.id) === (popup === null || popup === void 0 ? void 0 : popup.id)) {
53
53
  const t = resolver[(_a = value === null || value === void 0 ? void 0 : value.item) === null || _a === void 0 ? void 0 : _a.type];
54
54
  const Component = (0, withBindDataSource_1.default)(t);
55
- const defaulSetting = (_b = t === null || t === void 0 ? void 0 : t.extend) === null || _b === void 0 ? void 0 : _b.defaulSetting;
56
- return (react_1.default.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_c = value === null || value === void 0 ? void 0 : value.item) === null || _c === void 0 ? void 0 : _c.style), { width: '100%', height: '80vh', overflow: 'auto' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_d = value === null || value === void 0 ? void 0 : value.item) === null || _d === void 0 ? void 0 : _d.textStyle), bindDatas: (_f = (_e = value === null || value === void 0 ? void 0 : value.item) === null || _e === void 0 ? void 0 : _e.bindDatas) !== null && _f !== void 0 ? _f : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.props, { event: ((_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, onClose: handleClose })));
55
+ const isExternalLink = ((_d = (_c = (_b = value === null || value === void 0 ? void 0 : value.item) === null || _b === void 0 ? void 0 : _b.event) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.linkType) === 'externalLink';
56
+ const defaulSetting = (_e = t === null || t === void 0 ? void 0 : t.extend) === null || _e === void 0 ? void 0 : _e.defaulSetting;
57
+ return (react_1.default.createElement(Component, Object.assign({ key: index, style: Object.assign(Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.style), (_f = value === null || value === void 0 ? void 0 : value.item) === null || _f === void 0 ? void 0 : _f.style), { width: '100%', height: '80vh', overflow: 'auto' }), textStyle: Object.assign(Object.assign({}, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.textStyle), (_g = value === null || value === void 0 ? void 0 : value.item) === null || _g === void 0 ? void 0 : _g.textStyle), bindDatas: (_j = (_h = value === null || value === void 0 ? void 0 : value.item) === null || _h === void 0 ? void 0 : _h.bindDatas) !== null && _j !== void 0 ? _j : [] }, defaulSetting === null || defaulSetting === void 0 ? void 0 : defaulSetting.props, (_k = value === null || value === void 0 ? void 0 : value.item) === null || _k === void 0 ? void 0 : _k.props, { event: ((_l = value === null || value === void 0 ? void 0 : value.item) === null || _l === void 0 ? void 0 : _l.event) || {}, schema: schema, id: value === null || value === void 0 ? void 0 : value.id, isExternalLink: isExternalLink, onClose: handleClose })));
57
58
  }
58
59
  else {
59
60
  return react_1.default.createElement(react_1.default.Fragment, null);
60
61
  }
61
62
  });
62
- }, [schema, popup, resolver]);
63
+ }, [schema, popup, resolver, handleClose]);
63
64
  return (react_1.default.createElement(Modal_1.default, { popup: visible, onClose: handleClose, padding: 0, modalStyle: { position: 'fixed' } }, renderPopupDetail));
64
65
  };
65
66
  exports.default = Popup;
@@ -12,6 +12,7 @@ export interface IAppointFormProps {
12
12
  submitApiUrl?: string;
13
13
  submitEmail?: string;
14
14
  layoutType?: 'horizontal' | 'vertical' | 'inline';
15
+ isExternalLink?: boolean;
15
16
  onClick?: () => void;
16
17
  onClose?: () => void;
17
18
  }
@@ -7,9 +7,11 @@ const pro_components_1 = require("@ant-design/pro-components");
7
7
  const lodash_1 = require("lodash");
8
8
  const hooks_1 = require("../../../../core/hooks");
9
9
  require("./index.less");
10
+ const useEventReport_1 = require("../../../../core/hooks/useEventReport");
10
11
  const AppointForm = (_a) => {
11
- var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, onClick, onClose } = _a, props = tslib_1.__rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "onClick", "onClose"]);
12
- const { submitForm } = (0, hooks_1.useSxpDataSource)();
12
+ var { columns, style, title, textStyle, submitBgColor, submitColor, submitText, layoutType, isExternalLink, onClick, onClose } = _a, props = tslib_1.__rest(_a, ["columns", "style", "title", "textStyle", "submitBgColor", "submitColor", "submitText", "layoutType", "isExternalLink", "onClick", "onClose"]);
13
+ const { submitForm, popupDetailData } = (0, hooks_1.useSxpDataSource)();
14
+ const { jumpToWeb } = (0, useEventReport_1.useEventReport)();
13
15
  const formRef = (0, react_1.useRef)();
14
16
  const [loading, setLoading] = (0, react_1.useState)(false);
15
17
  const defaultColumns = (0, react_1.useMemo)(() => [
@@ -48,7 +50,7 @@ const AppointForm = (_a) => {
48
50
  }
49
51
  }, [layoutType, columns, defaultColumns]);
50
52
  const handleSubmit = (0, lodash_1.debounce)(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
51
- var _b, _c, _d;
53
+ var _b, _c, _d, _e, _f, _g;
52
54
  const vals = yield ((_b = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _b === void 0 ? void 0 : _b.getFieldsValue());
53
55
  if (!vals)
54
56
  return;
@@ -65,6 +67,13 @@ const AppointForm = (_a) => {
65
67
  const res = (yield (submitForm === null || submitForm === void 0 ? void 0 : submitForm({ attributes: arr })));
66
68
  setLoading(false);
67
69
  if (res) {
70
+ if (isExternalLink) {
71
+ const data = popupDetailData;
72
+ const product = (_e = data === null || data === void 0 ? void 0 : data.video) === null || _e === void 0 ? void 0 : _e.bindProduct;
73
+ 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;
74
+ const position = popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
75
+ jumpToWeb(data, product, cta, position);
76
+ }
68
77
  onClose === null || onClose === void 0 ? void 0 : onClose();
69
78
  onClick === null || onClick === void 0 ? void 0 : onClick();
70
79
  }
@@ -25,7 +25,7 @@ const CommodityDetail = (_a) => {
25
25
  const position = isPost ? index : popupDetailData === null || popupDetailData === void 0 ? void 0 : popupDetailData.index;
26
26
  const handleLink = () => {
27
27
  if (product === null || product === void 0 ? void 0 : product.link) {
28
- jumpToWeb(popupDetailData, product, cta, position);
28
+ jumpToWeb(data, product, cta, position);
29
29
  if (!isPost) {
30
30
  productView(data, product, cta, viewTime || curTimeRef.current, position);
31
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.0.55",
3
+ "version": "1.0.57",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",