pb-sxp-ui 1.15.3 → 1.15.5

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 (36) hide show
  1. package/dist/index.cjs +108 -61
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +13 -1
  4. package/dist/index.js +108 -61
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.min.cjs +6 -6
  7. package/dist/index.min.cjs.map +1 -1
  8. package/dist/index.min.js +6 -6
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/pb-ui.js +108 -61
  11. package/dist/pb-ui.js.map +1 -1
  12. package/dist/pb-ui.min.js +6 -6
  13. package/dist/pb-ui.min.js.map +1 -1
  14. package/es/core/components/Consent/index.js +0 -1
  15. package/es/core/components/SxpPageCore/index.js +1 -1
  16. package/es/core/components/SxpPageRender/ConsentPopup.js +2 -2
  17. package/es/core/components/SxpPageRender/index.d.ts +1 -0
  18. package/es/core/components/SxpPageRender/index.js +11 -10
  19. package/es/core/context/SxpDataSourceProvider.d.ts +2 -0
  20. package/es/core/context/SxpDataSourceProvider.js +24 -17
  21. package/es/materials/sxp/consentPopup/Click/index.d.ts +1 -0
  22. package/es/materials/sxp/consentPopup/Click/index.js +33 -11
  23. package/es/materials/sxp/consentPopup/Click/settingRender.js +6 -1
  24. package/es/materials/sxp/consentPopup/Swipe/index.js +25 -12
  25. package/lib/core/components/Consent/index.js +0 -1
  26. package/lib/core/components/SxpPageCore/index.js +1 -1
  27. package/lib/core/components/SxpPageRender/ConsentPopup.js +2 -2
  28. package/lib/core/components/SxpPageRender/index.d.ts +1 -0
  29. package/lib/core/components/SxpPageRender/index.js +11 -10
  30. package/lib/core/context/SxpDataSourceProvider.d.ts +2 -0
  31. package/lib/core/context/SxpDataSourceProvider.js +24 -17
  32. package/lib/materials/sxp/consentPopup/Click/index.d.ts +1 -0
  33. package/lib/materials/sxp/consentPopup/Click/index.js +31 -9
  34. package/lib/materials/sxp/consentPopup/Click/settingRender.js +6 -1
  35. package/lib/materials/sxp/consentPopup/Swipe/index.js +23 -10
  36. package/package.json +1 -1
@@ -3,19 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  require("./index.less");
6
- const tel_png_1 = tslib_1.__importDefault(require("./tel.png"));
7
6
  const ConsentDetail_1 = tslib_1.__importDefault(require("../../popup/ConsentDetail"));
7
+ const tel_png_1 = tslib_1.__importDefault(require("./tel.png"));
8
+ const tool_1 = require("../../../../core/utils/tool");
9
+ const hooks_1 = require("../../../../core/hooks");
8
10
  const Click = (_a) => {
9
- var { isTel, open, content, style, consentPopupCate, acceptButton, rejectButton } = _a, props = tslib_1.__rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "acceptButton", "rejectButton"]);
11
+ var { isTel, open, content, style, consentPopupCate, acceptButton, rejectButton, showRejectButton } = _a, props = tslib_1.__rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "acceptButton", "rejectButton", "showRejectButton"]);
12
+ const { getAccount, accountSonsent } = (0, hooks_1.useSxpDataSource)();
13
+ const [consentResult, setConsentResult] = (0, react_1.useState)(true);
14
+ const handleGetAccount = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
15
+ const res = yield (getAccount === null || getAccount === void 0 ? void 0 : getAccount());
16
+ setConsentResult(res);
17
+ });
10
18
  const visivle = (0, react_1.useMemo)(() => {
11
- return consentPopupCate || (open && style);
12
- }, [consentPopupCate, open]);
13
- const handleClickAccept = () => { };
14
- const handleClickReject = () => { };
19
+ return consentPopupCate || (open && style && !consentResult);
20
+ }, [consentPopupCate, open, style, consentResult]);
21
+ (0, react_1.useEffect)(() => {
22
+ !consentPopupCate && open && style && handleGetAccount();
23
+ }, []);
24
+ const handleClickAccept = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
25
+ const res = yield (accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(true));
26
+ if (res)
27
+ setConsentResult(true);
28
+ });
29
+ const handleClickReject = () => {
30
+ history === null || history === void 0 ? void 0 : history.back();
31
+ };
15
32
  return (react_1.default.createElement(react_1.default.Fragment, null, isTel ? (react_1.default.createElement("img", { src: tel_png_1.default, style: { objectFit: 'cover', width: '100%', height: '100%' } })) : (react_1.default.createElement(react_1.default.Fragment, null, visivle && (react_1.default.createElement("div", { className: 'consentPopupClick' },
16
33
  react_1.default.createElement("div", { className: 'consentPopupClick-container', style: style },
17
- react_1.default.createElement(ConsentDetail_1.default, { content: content, style: { padding: 0 } }),
18
- react_1.default.createElement("button", { style: acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.style, onClick: handleClickAccept }, acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.text),
19
- react_1.default.createElement("button", { style: rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.style, onClick: handleClickReject }, rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.text))))))));
34
+ react_1.default.createElement("div", { className: 'consentPopupClick-container-content' },
35
+ react_1.default.createElement(ConsentDetail_1.default, { content: content, style: { padding: 0 } })),
36
+ react_1.default.createElement("button", { style: acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.style, onClick: handleClickAccept, dangerouslySetInnerHTML: {
37
+ __html: (0, tool_1.setFontForText)(acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.text, acceptButton === null || acceptButton === void 0 ? void 0 : acceptButton.style)
38
+ } }),
39
+ react_1.default.createElement("button", { hidden: !showRejectButton, style: rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.style, onClick: handleClickReject, dangerouslySetInnerHTML: {
40
+ __html: (0, tool_1.setFontForText)(rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.text, rejectButton === null || rejectButton === void 0 ? void 0 : rejectButton.style)
41
+ } }))))))));
20
42
  };
21
43
  exports.default = (0, react_1.memo)(Click);
@@ -123,6 +123,11 @@ exports.default = [
123
123
  {
124
124
  title: '拒绝按钮样式',
125
125
  child: [
126
+ {
127
+ type: 'Switch',
128
+ label: '开启',
129
+ name: ['props', 'showRejectButton']
130
+ },
126
131
  {
127
132
  type: 'Color',
128
133
  label: '背景色',
@@ -154,7 +159,7 @@ exports.default = [
154
159
  {
155
160
  type: 'TextMargin',
156
161
  label: '边距',
157
- name: ['props', 'acceptButton', 'style']
162
+ name: ['props', 'rejectButton', 'style']
158
163
  },
159
164
  {
160
165
  type: 'Group',
@@ -3,13 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  require("./index.less");
6
- const tel_png_1 = tslib_1.__importDefault(require("./tel.png"));
7
6
  const ConsentDetail_1 = tslib_1.__importDefault(require("../../popup/ConsentDetail"));
8
- const closeIcon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAjhJREFUWEfFlztOw0AQhmeWiJ4CCmpQ5DiRQsIJyAWg5A0lR0AIChDiCJS8ER0cADgBeRSxt4CCDgkaKiq8i+zYeWx2413HEWmiJJv9v535Z2aN8M8vFPT9z3zETD0aAUChUJjwvPFHAJhBhB3Hqd6OAsK2yyucwykAvP38eJX398Z3AJDLlVYR8ToU9Rhj25TWr9KEsKy5dULIGQCMtfZly45TvwsAstm56UwG6wA4FUFwzrdctxZBDcWSy5XWEPG8I84/GcMipdWPtgcsaz5PCHtKG0IuTiqUvjT9U/WYMG2IOPE+AP+LtCB0xKUAAyA2Xbd2o2OG0NQXvTnvhL17D7EPtH9TRCIWwkRcGYGIQgYBABuqPuHXOQBc6pw80lBGwBQiiXhsBHQhkoprA6iM6acjhDQKu5YJZW6XeOI3XJdpvfsdTu52VfXEekD8owQiXGIubpSCbhDbLu8DwKEAd+A41SOdPpE4BS0viFOtvV2iKWqUgn5x/tmS70xR01GuDSCKc86/OCcLgTyyZ0ScDGNhFAktAJV4NFJ9YyaFiAWIE+9uVkkgBgLoig8DMWAa9ro9ynkUdlW5maZDCmB6clmz0k1HH4Cs1Ezbq2p2yEpUuBOKTSZZex00RUWIrltxuuK6EOGDSbGIOPZicpMx6fny650377qNRgBgWeVFQuA+6UjVgREhGIMlSqsPUQqIbZdOOIdZQmCv2axRnU1N1+TzJYsxOEaEV8ep7frPZ7Gd0FTEdP0ft0/kMNdg0eoAAAAASUVORK5CYII=';
7
+ const tel_png_1 = tslib_1.__importDefault(require("./tel.png"));
8
+ const hooks_1 = require("../../../../core/hooks");
9
9
  const Swipe = (_a) => {
10
10
  var { isTel, open, content, style, consentPopupCate, swipeIcon } = _a, props = tslib_1.__rest(_a, ["isTel", "open", "content", "style", "consentPopupCate", "swipeIcon"]);
11
11
  const touchInfo = (0, react_1.useRef)();
12
12
  const threshold = 50;
13
+ const { getAccount, accountSonsent } = (0, hooks_1.useSxpDataSource)();
14
+ const [consentResult, setConsentResult] = (0, react_1.useState)(true);
15
+ const handleGetAccount = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
16
+ const res = yield (getAccount === null || getAccount === void 0 ? void 0 : getAccount());
17
+ setConsentResult(res);
18
+ });
19
+ const visivle = (0, react_1.useMemo)(() => {
20
+ return consentPopupCate || (open && style && !consentResult);
21
+ }, [consentPopupCate, open, style, consentResult]);
22
+ (0, react_1.useEffect)(() => {
23
+ !consentPopupCate && open && style && handleGetAccount();
24
+ }, []);
25
+ const handleClickAccept = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
26
+ const res = yield (accountSonsent === null || accountSonsent === void 0 ? void 0 : accountSonsent(true));
27
+ if (res)
28
+ setConsentResult(true);
29
+ });
13
30
  const handleTouchStart = (event) => {
14
31
  const touch = event.touches[0];
15
32
  touchInfo.current = { y: touch.clientY, d: 0 };
@@ -28,19 +45,15 @@ const Swipe = (_a) => {
28
45
  return;
29
46
  const { d } = touchInfo.current || {};
30
47
  if (d > threshold) {
48
+ handleClickAccept();
31
49
  }
32
50
  touchInfo.current = {};
33
51
  };
34
- const handleClickReject = () => { };
35
- const visivle = (0, react_1.useMemo)(() => {
36
- return consentPopupCate || (open && style);
37
- }, [consentPopupCate, open]);
38
52
  return (react_1.default.createElement(react_1.default.Fragment, null, isTel ? (react_1.default.createElement("img", { src: tel_png_1.default, style: { objectFit: 'cover', width: '100%', height: '100%' } })) : (react_1.default.createElement(react_1.default.Fragment, null, visivle && (react_1.default.createElement("div", { className: 'consentPopupSwipe', onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd },
39
53
  react_1.default.createElement("div", { className: 'consentPopupSwipe-container', style: style },
40
- react_1.default.createElement(ConsentDetail_1.default, { content: content, style: { padding: 0 } }),
41
- react_1.default.createElement("button", { "aria-label": 'close', className: 'consentPopupSwipe-container-close', onClick: handleClickReject },
42
- react_1.default.createElement("img", { src: closeIcon, alt: 'close' })),
43
- swipeIcon && (react_1.default.createElement("div", { className: 'consentPopupSwipe-container-swipeIcon', onClick: handleClickReject },
54
+ react_1.default.createElement("div", { className: 'consentPopupSwipe-container-content' },
55
+ react_1.default.createElement(ConsentDetail_1.default, { content: content, style: { padding: 0 } })),
56
+ swipeIcon && (react_1.default.createElement("div", { className: 'consentPopupSwipe-container-swipeIcon' },
44
57
  react_1.default.createElement("img", { src: swipeIcon, alt: 'Swipe Icon' }))))))))));
45
58
  };
46
59
  exports.default = (0, react_1.memo)(Swipe);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.15.3",
3
+ "version": "1.15.5",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",