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.
- package/dist/index.cjs +108 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +13 -1
- package/dist/index.js +108 -61
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +6 -6
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +6 -6
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +108 -61
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +6 -6
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/Consent/index.js +0 -1
- package/es/core/components/SxpPageCore/index.js +1 -1
- package/es/core/components/SxpPageRender/ConsentPopup.js +2 -2
- package/es/core/components/SxpPageRender/index.d.ts +1 -0
- package/es/core/components/SxpPageRender/index.js +11 -10
- package/es/core/context/SxpDataSourceProvider.d.ts +2 -0
- package/es/core/context/SxpDataSourceProvider.js +24 -17
- package/es/materials/sxp/consentPopup/Click/index.d.ts +1 -0
- package/es/materials/sxp/consentPopup/Click/index.js +33 -11
- package/es/materials/sxp/consentPopup/Click/settingRender.js +6 -1
- package/es/materials/sxp/consentPopup/Swipe/index.js +25 -12
- package/lib/core/components/Consent/index.js +0 -1
- package/lib/core/components/SxpPageCore/index.js +1 -1
- package/lib/core/components/SxpPageRender/ConsentPopup.js +2 -2
- package/lib/core/components/SxpPageRender/index.d.ts +1 -0
- package/lib/core/components/SxpPageRender/index.js +11 -10
- package/lib/core/context/SxpDataSourceProvider.d.ts +2 -0
- package/lib/core/context/SxpDataSourceProvider.js +24 -17
- package/lib/materials/sxp/consentPopup/Click/index.d.ts +1 -0
- package/lib/materials/sxp/consentPopup/Click/index.js +31 -9
- package/lib/materials/sxp/consentPopup/Click/settingRender.js +6 -1
- package/lib/materials/sxp/consentPopup/Swipe/index.js +23 -10
- 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
|
-
|
14
|
-
|
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(
|
18
|
-
|
19
|
-
react_1.default.createElement("button", { style:
|
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', '
|
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
|
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(
|
41
|
-
|
42
|
-
|
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);
|