@pnt-team/pnt-component-frontend 0.0.38 → 0.0.40
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/lib/cjs/components/PntGeneralLayout/index.d.ts +82 -0
- package/lib/cjs/components/PntGeneralLayout/index.js +74 -0
- package/lib/cjs/components/PntGeneralLayout/index.scss +90 -0
- package/lib/cjs/components/PntImagePreview/index.js +37 -30
- package/lib/cjs/components/PntSecureBox/index.js +25 -32
- package/lib/cjs/global.css +2 -0
- package/lib/cjs/hooks/useHighSecurity.d.ts +2 -20
- package/lib/cjs/index.d.ts +1 -8
- package/lib/cjs/index.js +5 -17
- package/lib/esm/components/PntGeneralLayout/index.d.ts +82 -0
- package/lib/esm/components/PntGeneralLayout/index.js +54 -0
- package/lib/esm/components/PntGeneralLayout/index.scss +90 -0
- package/lib/esm/components/PntImagePreview/index.js +37 -30
- package/lib/esm/components/PntSecureBox/index.js +25 -22
- package/lib/esm/global.css +2 -0
- package/lib/esm/hooks/useHighSecurity.d.ts +2 -20
- package/lib/esm/index.d.ts +1 -8
- package/lib/esm/index.js +6 -14
- package/lib/umd/pnt-component-frontend.min.css +1 -1
- package/lib/umd/pnt-component-frontend.min.js +1 -1
- package/package.json +16 -4
- package/lib/cjs/components/PntCopyData/index.d.ts +0 -91
- package/lib/cjs/components/PntCopyData/index.js +0 -81
- package/lib/cjs/components/PntCopyData/index.scss +0 -5
- package/lib/cjs/hooks/useBtnPermission.d.ts +0 -67
- package/lib/cjs/hooks/useBtnPermission.js +0 -57
- package/lib/cjs/hooks/useOsPlatformList.d.ts +0 -66
- package/lib/cjs/hooks/useOsPlatformList.js +0 -88
- package/lib/cjs/hooks/usePagination.d.ts +0 -72
- package/lib/cjs/hooks/usePagination.js +0 -71
- package/lib/cjs/utils/request.d.ts +0 -8
- package/lib/cjs/utils/request.js +0 -82
- package/lib/esm/components/PntCopyData/index.d.ts +0 -91
- package/lib/esm/components/PntCopyData/index.js +0 -51
- package/lib/esm/components/PntCopyData/index.scss +0 -5
- package/lib/esm/hooks/useBtnPermission.d.ts +0 -67
- package/lib/esm/hooks/useBtnPermission.js +0 -31
- package/lib/esm/hooks/useOsPlatformList.d.ts +0 -66
- package/lib/esm/hooks/useOsPlatformList.js +0 -63
- package/lib/esm/hooks/usePagination.d.ts +0 -72
- package/lib/esm/hooks/usePagination.js +0 -47
- package/lib/esm/utils/request.d.ts +0 -8
- package/lib/esm/utils/request.js +0 -52
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { FunctionComponent, ReactNode, Ref } from 'react';
|
|
2
|
+
import './index.scss';
|
|
3
|
+
interface PntGeneralLayoutProps {
|
|
4
|
+
/**
|
|
5
|
+
* 自定义类名
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* 头部标题内容
|
|
10
|
+
* @description 传入后将渲染 Layout Header 区域
|
|
11
|
+
*/
|
|
12
|
+
headerTitle?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* 是否显示返回按钮
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
showBackButton?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 返回按钮点击回调
|
|
20
|
+
*/
|
|
21
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* 子头部内容
|
|
24
|
+
* @description 位于 Header 下方,常用于放置面包屑、Tab 等
|
|
25
|
+
*/
|
|
26
|
+
subHeaderContent?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* 头部右侧操作区
|
|
29
|
+
* @description 常用于放置按钮组
|
|
30
|
+
*/
|
|
31
|
+
operation?: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* 内容区 ref
|
|
34
|
+
*/
|
|
35
|
+
bodyRef?: Ref<HTMLDivElement>;
|
|
36
|
+
/**
|
|
37
|
+
* 页面主体内容
|
|
38
|
+
*/
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* 内容区自定义样式
|
|
42
|
+
*/
|
|
43
|
+
bodyStyle?: React.CSSProperties;
|
|
44
|
+
/**
|
|
45
|
+
* 底部内容
|
|
46
|
+
* @description 传入后将渲染 Layout Footer 区域,常用于放置操作按钮
|
|
47
|
+
*/
|
|
48
|
+
footer?: ReactNode;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 通用页面布局组件(L4 布局组件)
|
|
52
|
+
* @description 提供标准的「头部 + 子头部 + 内容区 + 底部」页面布局结构,
|
|
53
|
+
* 基于 TDesign Layout 封装,适用于后台管理系统的详情页、表单页等场景。
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* // 基础用法:仅内容区
|
|
58
|
+
* <PntGeneralLayout>
|
|
59
|
+
* <div>页面内容</div>
|
|
60
|
+
* </PntGeneralLayout>
|
|
61
|
+
*
|
|
62
|
+
* // 带标题和操作按钮
|
|
63
|
+
* <PntGeneralLayout
|
|
64
|
+
* headerTitle="页面标题"
|
|
65
|
+
* operation={<><Button>保存</Button><Button>取消</Button></>}
|
|
66
|
+
* >
|
|
67
|
+
* <Form />
|
|
68
|
+
* </PntGeneralLayout>
|
|
69
|
+
*
|
|
70
|
+
* // 带返回按钮和底部
|
|
71
|
+
* <PntGeneralLayout
|
|
72
|
+
* headerTitle="详情页"
|
|
73
|
+
* showBackButton
|
|
74
|
+
* onBackButtonClick={() => history.back()}
|
|
75
|
+
* footer={<><Button>提交</Button><Button>重置</Button></>}
|
|
76
|
+
* >
|
|
77
|
+
* <Detail />
|
|
78
|
+
* </PntGeneralLayout>
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
declare const PntGeneralLayout: FunctionComponent<PntGeneralLayoutProps>;
|
|
82
|
+
export default PntGeneralLayout;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/PntGeneralLayout/index.tsx
|
|
20
|
+
var PntGeneralLayout_exports = {};
|
|
21
|
+
__export(PntGeneralLayout_exports, {
|
|
22
|
+
default: () => PntGeneralLayout_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(PntGeneralLayout_exports);
|
|
25
|
+
var import_tdesign_icons_react = require("tdesign-icons-react");
|
|
26
|
+
var import_tdesign_react = require("tdesign-react");
|
|
27
|
+
var import_index = require("./index.scss");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var PntGeneralLayout = (prop) => {
|
|
30
|
+
const {
|
|
31
|
+
className,
|
|
32
|
+
headerTitle,
|
|
33
|
+
showBackButton = false,
|
|
34
|
+
onBackButtonClick,
|
|
35
|
+
subHeaderContent,
|
|
36
|
+
operation,
|
|
37
|
+
bodyRef,
|
|
38
|
+
children,
|
|
39
|
+
bodyStyle,
|
|
40
|
+
footer
|
|
41
|
+
} = prop;
|
|
42
|
+
const { Header, Footer } = import_tdesign_react.Layout;
|
|
43
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tdesign_react.Layout, { className: `pnt-general-layout${className ? " " + className : ""}`, children: [
|
|
44
|
+
headerTitle && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Header, { children: [
|
|
45
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "header-title", children: [
|
|
46
|
+
showBackButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
47
|
+
import_tdesign_icons_react.ArrowLeftIcon,
|
|
48
|
+
{
|
|
49
|
+
className: "goback-icon",
|
|
50
|
+
size: "24px",
|
|
51
|
+
onClick: onBackButtonClick
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "title", children: headerTitle })
|
|
55
|
+
] }),
|
|
56
|
+
operation && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "header-operation", children: operation })
|
|
57
|
+
] }),
|
|
58
|
+
subHeaderContent && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "general-layout-sub-header", children: subHeaderContent }),
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: "general-layout-body",
|
|
63
|
+
ref: bodyRef,
|
|
64
|
+
style: {
|
|
65
|
+
height: `calc(100%${headerTitle && " - 72px"}${footer && " - 72px"})`,
|
|
66
|
+
...bodyStyle
|
|
67
|
+
},
|
|
68
|
+
children
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Footer, { children: footer })
|
|
72
|
+
] });
|
|
73
|
+
};
|
|
74
|
+
var PntGeneralLayout_default = PntGeneralLayout;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
.pnt-general-layout {
|
|
2
|
+
height: 100%;
|
|
3
|
+
background-color: rgba(0, 0, 0, 0);
|
|
4
|
+
|
|
5
|
+
.t-layout__header {
|
|
6
|
+
height: auto;
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
border-bottom: 1px solid #f0f3f6;
|
|
10
|
+
|
|
11
|
+
.header-title {
|
|
12
|
+
display: inline-block;
|
|
13
|
+
vertical-align: top;
|
|
14
|
+
padding: 24px;
|
|
15
|
+
|
|
16
|
+
.goback-icon {
|
|
17
|
+
margin-right: 12px;
|
|
18
|
+
vertical-align: top;
|
|
19
|
+
color: #3f8cff;
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.title {
|
|
24
|
+
display: inline-block;
|
|
25
|
+
vertical-align: top;
|
|
26
|
+
font-weight: 600;
|
|
27
|
+
font-size: 20px;
|
|
28
|
+
height: 24px;
|
|
29
|
+
line-height: 24px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.header-operation {
|
|
34
|
+
height: 72px;
|
|
35
|
+
line-height: 72px;
|
|
36
|
+
padding-right: 24px;
|
|
37
|
+
|
|
38
|
+
.t-button + .t-button {
|
|
39
|
+
margin-left: 12px;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.general-layout-sub-header {
|
|
45
|
+
border-bottom: 1px solid #f0f3f6;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.general-layout-body {
|
|
49
|
+
height: 100%;
|
|
50
|
+
padding: 24px;
|
|
51
|
+
overflow-y: auto;
|
|
52
|
+
background: #fafafa;
|
|
53
|
+
|
|
54
|
+
> div.tea-card,
|
|
55
|
+
> div.t-card,
|
|
56
|
+
> div.t-loading__parent > div.t-card,
|
|
57
|
+
> div[class*='-wrapper'],
|
|
58
|
+
> div[class*='-block'] {
|
|
59
|
+
box-shadow: none;
|
|
60
|
+
margin-bottom: 24px;
|
|
61
|
+
border-radius: 4px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
> div:last-child,
|
|
65
|
+
> div:last-child.t-card,
|
|
66
|
+
> div:last-child.tea-card,
|
|
67
|
+
> div.t-loading__parent > div:last-child.t-card,
|
|
68
|
+
> div:last-child[class*='-wrapper'],
|
|
69
|
+
> div:last-child[class*='-block'] {
|
|
70
|
+
margin-bottom: 0;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.t-layout__footer {
|
|
75
|
+
padding: 18px 24px;
|
|
76
|
+
background: #fff;
|
|
77
|
+
border-top: 1px solid #f0f3f6;
|
|
78
|
+
|
|
79
|
+
.t-button {
|
|
80
|
+
font-size: 14px;
|
|
81
|
+
min-width: 92px;
|
|
82
|
+
height: 36px;
|
|
83
|
+
font-weight: 600;
|
|
84
|
+
|
|
85
|
+
& + .t-button {
|
|
86
|
+
margin-left: 12px;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -33,10 +33,10 @@ __export(PntImagePreview_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(PntImagePreview_exports);
|
|
35
35
|
var import_uploadImg = __toESM(require("../../assets/images/uploadImg.png"));
|
|
36
|
-
var import_react = __toESM(require("react"));
|
|
37
36
|
var import_tdesign_icons_react = require("tdesign-icons-react");
|
|
38
37
|
var import_tdesign_react = require("tdesign-react");
|
|
39
38
|
var import_index = require("./index.scss");
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
40
|
var PntImagePreview = ({
|
|
41
41
|
iconUrl,
|
|
42
42
|
loading,
|
|
@@ -45,15 +45,18 @@ var PntImagePreview = ({
|
|
|
45
45
|
onRemove
|
|
46
46
|
}) => {
|
|
47
47
|
const src = (iconUrl == null ? void 0 : iconUrl.length) ? iconUrl : defaultImg || import_uploadImg.default;
|
|
48
|
-
const LoadingContent = (isImageLoading) => /* @__PURE__ */
|
|
48
|
+
const LoadingContent = (isImageLoading) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
49
49
|
"div",
|
|
50
50
|
{
|
|
51
51
|
className: isImageLoading ? "pnt-image-preview-progress" : "pnt-image-preview-upload-progress",
|
|
52
|
-
style: params == null ? void 0 : params.style
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
style: params == null ? void 0 : params.style,
|
|
53
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pnt-image-preview-loading", children: [
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tdesign_icons_react.LoadingIcon, { size: "18px", name: "loading" }),
|
|
55
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "上传中" })
|
|
56
|
+
] })
|
|
57
|
+
}
|
|
55
58
|
);
|
|
56
|
-
return /* @__PURE__ */
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
60
|
"div",
|
|
58
61
|
{
|
|
59
62
|
className: "pnt-image-preview-wrapper",
|
|
@@ -61,31 +64,35 @@ var PntImagePreview = ({
|
|
|
61
64
|
if ((iconUrl == null ? void 0 : iconUrl.length) || loading) {
|
|
62
65
|
e.stopPropagation();
|
|
63
66
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
67
|
+
},
|
|
68
|
+
children: loading ? LoadingContent(false) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
+
import_tdesign_react.ImageViewer,
|
|
70
|
+
{
|
|
71
|
+
images: [src],
|
|
72
|
+
closeOnOverlay: true,
|
|
73
|
+
trigger: ({ open }) => {
|
|
74
|
+
const mask = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pnt-image-preview-mask", children: [
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tdesign_icons_react.BrowseIcon, { onClick: open, size: "16px", name: "browse" }) }),
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "pnt-image-preview-divider" }),
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tdesign_icons_react.DeleteIcon, { onClick: onRemove, size: "16px", name: "delete" }) })
|
|
78
|
+
] });
|
|
79
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
import_tdesign_react.Image,
|
|
81
|
+
{
|
|
82
|
+
alt: "",
|
|
83
|
+
src,
|
|
84
|
+
loading: LoadingContent(true),
|
|
85
|
+
overlayContent: iconUrl ? mask : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {}),
|
|
86
|
+
overlayTrigger: "hover",
|
|
87
|
+
fit: "contain",
|
|
88
|
+
className: "pnt-image-preview",
|
|
89
|
+
style: params == null ? void 0 : params.style
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
86
93
|
}
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
)
|
|
95
|
+
}
|
|
89
96
|
);
|
|
90
97
|
};
|
|
91
98
|
var PntImagePreview_default = PntImagePreview;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
|
|
29
19
|
// src/components/PntSecureBox/index.tsx
|
|
@@ -34,8 +24,8 @@ __export(PntSecureBox_exports, {
|
|
|
34
24
|
module.exports = __toCommonJS(PntSecureBox_exports);
|
|
35
25
|
var import_useHighSecurity = require("../../hooks/useHighSecurity");
|
|
36
26
|
var import_utils = require("../../utils");
|
|
37
|
-
var import_react = __toESM(require("react"));
|
|
38
27
|
var import_index = require("./index.scss");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
29
|
var PntSecureBox = (prop) => {
|
|
40
30
|
const {
|
|
41
31
|
dataKey,
|
|
@@ -48,27 +38,30 @@ var PntSecureBox = (prop) => {
|
|
|
48
38
|
fetcher
|
|
49
39
|
} = prop;
|
|
50
40
|
const { securityData, requestSecurityData } = (0, import_useHighSecurity.useHighSecurity)(fetcher);
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
41
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "pnt-secure-box", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
42
|
+
renderDom(
|
|
43
|
+
(0, import_utils.isSecurityData)(dataValue) ? securityData[dataKey] || "******" : dataValue
|
|
44
|
+
),
|
|
45
|
+
(0, import_utils.isSecurityData)(dataValue) && !securityData.hasOwnProperty(dataKey) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
46
|
+
"span",
|
|
47
|
+
{
|
|
48
|
+
className: "view-icon",
|
|
49
|
+
onClick: () => {
|
|
50
|
+
requestSecurityData({
|
|
51
|
+
env,
|
|
52
|
+
gameId,
|
|
53
|
+
pageId,
|
|
54
|
+
param: [
|
|
55
|
+
{
|
|
56
|
+
key: dataKey,
|
|
57
|
+
value: dataValue
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
children: viewText || "View"
|
|
69
63
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
)));
|
|
64
|
+
)
|
|
65
|
+
] }) });
|
|
73
66
|
};
|
|
74
67
|
var PntSecureBox_default = PntSecureBox;
|
|
@@ -21,26 +21,8 @@ export type HighSecurityFetcher = (params: HighSecurityRequestParams) => Promise
|
|
|
21
21
|
}>;
|
|
22
22
|
}>;
|
|
23
23
|
/**
|
|
24
|
-
* 高敏数据解锁 Hook(
|
|
25
|
-
*
|
|
26
|
-
* 管理高敏数据的解锁状态。零业务侵入:请求函数通过 fetcher 注入,
|
|
27
|
-
* 不再依赖内部 api/configs,避免将敏感配置打包进发布产物。
|
|
28
|
-
*
|
|
29
|
-
* @param fetcher 自定义高敏数据请求函数,需返回 { ret, data } 结构且 ret === 0 视为成功
|
|
30
|
-
* @returns securityData 已解锁的高敏数据映射;requestSecurityData 请求解锁指定数据
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```tsx
|
|
34
|
-
* import http from '@/utils/request';
|
|
35
|
-
* import { useHighSecurity } from '@pnt-team/pnt-component-frontend';
|
|
36
|
-
*
|
|
37
|
-
* const Demo = () => {
|
|
38
|
-
* const { securityData, requestSecurityData } = useHighSecurity((params) =>
|
|
39
|
-
* http.post('/api/v3/business/game_info/high-security-decrypt', params).then(r => r.data)
|
|
40
|
-
* );
|
|
41
|
-
* // ...
|
|
42
|
-
* };
|
|
43
|
-
* ```
|
|
24
|
+
* 高敏数据解锁 Hook(PntSecureBox 内部依赖)
|
|
25
|
+
* @internal 不对外导出,归 PntSecureBox 组件内部使用
|
|
44
26
|
*/
|
|
45
27
|
export declare const useHighSecurity: (fetcher: HighSecurityFetcher) => {
|
|
46
28
|
securityData: Record<string, string>;
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export { default as PntCopyData } from './components/PntCopyData';
|
|
2
1
|
export { default as PntImagePreview } from './components/PntImagePreview';
|
|
3
2
|
export { default as PntSecureBox } from './components/PntSecureBox';
|
|
4
|
-
export { default as
|
|
5
|
-
export { useHighSecurity } from './hooks/useHighSecurity';
|
|
6
|
-
export { default as useOsPlatformList } from './hooks/useOsPlatformList';
|
|
7
|
-
export { default as usePagination } from './hooks/usePagination';
|
|
8
|
-
export type { BtnPermissionMap, UseBtnPermissionOptions } from './hooks/useBtnPermission';
|
|
9
|
-
export type { OsPlatformData, OsPlatformFetcher } from './hooks/useOsPlatformList';
|
|
10
|
-
export type { PaginationData, PaginationRequestParams, OnPaginationRequest } from './hooks/usePagination';
|
|
3
|
+
export { default as PntGeneralLayout } from './components/PntGeneralLayout';
|
package/lib/cjs/index.js
CHANGED
|
@@ -29,29 +29,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// src/index.ts
|
|
30
30
|
var src_exports = {};
|
|
31
31
|
__export(src_exports, {
|
|
32
|
-
|
|
32
|
+
PntGeneralLayout: () => import_PntGeneralLayout.default,
|
|
33
33
|
PntImagePreview: () => import_PntImagePreview.default,
|
|
34
|
-
PntSecureBox: () => import_PntSecureBox.default
|
|
35
|
-
useBtnPermission: () => import_useBtnPermission.default,
|
|
36
|
-
useHighSecurity: () => import_useHighSecurity.useHighSecurity,
|
|
37
|
-
useOsPlatformList: () => import_useOsPlatformList.default,
|
|
38
|
-
usePagination: () => import_usePagination.default
|
|
34
|
+
PntSecureBox: () => import_PntSecureBox.default
|
|
39
35
|
});
|
|
40
36
|
module.exports = __toCommonJS(src_exports);
|
|
41
|
-
var import_PntCopyData = __toESM(require("./components/PntCopyData"));
|
|
42
37
|
var import_PntImagePreview = __toESM(require("./components/PntImagePreview"));
|
|
43
38
|
var import_PntSecureBox = __toESM(require("./components/PntSecureBox"));
|
|
44
|
-
var
|
|
45
|
-
var import_useHighSecurity = require("./hooks/useHighSecurity");
|
|
46
|
-
var import_useOsPlatformList = __toESM(require("./hooks/useOsPlatformList"));
|
|
47
|
-
var import_usePagination = __toESM(require("./hooks/usePagination"));
|
|
39
|
+
var import_PntGeneralLayout = __toESM(require("./components/PntGeneralLayout"));
|
|
48
40
|
// Annotate the CommonJS export names for ESM import in node:
|
|
49
41
|
0 && (module.exports = {
|
|
50
|
-
|
|
42
|
+
PntGeneralLayout,
|
|
51
43
|
PntImagePreview,
|
|
52
|
-
PntSecureBox
|
|
53
|
-
useBtnPermission,
|
|
54
|
-
useHighSecurity,
|
|
55
|
-
useOsPlatformList,
|
|
56
|
-
usePagination
|
|
44
|
+
PntSecureBox
|
|
57
45
|
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { FunctionComponent, ReactNode, Ref } from 'react';
|
|
2
|
+
import './index.scss';
|
|
3
|
+
interface PntGeneralLayoutProps {
|
|
4
|
+
/**
|
|
5
|
+
* 自定义类名
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* 头部标题内容
|
|
10
|
+
* @description 传入后将渲染 Layout Header 区域
|
|
11
|
+
*/
|
|
12
|
+
headerTitle?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* 是否显示返回按钮
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
showBackButton?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 返回按钮点击回调
|
|
20
|
+
*/
|
|
21
|
+
onBackButtonClick?: (() => void) | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* 子头部内容
|
|
24
|
+
* @description 位于 Header 下方,常用于放置面包屑、Tab 等
|
|
25
|
+
*/
|
|
26
|
+
subHeaderContent?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* 头部右侧操作区
|
|
29
|
+
* @description 常用于放置按钮组
|
|
30
|
+
*/
|
|
31
|
+
operation?: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* 内容区 ref
|
|
34
|
+
*/
|
|
35
|
+
bodyRef?: Ref<HTMLDivElement>;
|
|
36
|
+
/**
|
|
37
|
+
* 页面主体内容
|
|
38
|
+
*/
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* 内容区自定义样式
|
|
42
|
+
*/
|
|
43
|
+
bodyStyle?: React.CSSProperties;
|
|
44
|
+
/**
|
|
45
|
+
* 底部内容
|
|
46
|
+
* @description 传入后将渲染 Layout Footer 区域,常用于放置操作按钮
|
|
47
|
+
*/
|
|
48
|
+
footer?: ReactNode;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 通用页面布局组件(L4 布局组件)
|
|
52
|
+
* @description 提供标准的「头部 + 子头部 + 内容区 + 底部」页面布局结构,
|
|
53
|
+
* 基于 TDesign Layout 封装,适用于后台管理系统的详情页、表单页等场景。
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* // 基础用法:仅内容区
|
|
58
|
+
* <PntGeneralLayout>
|
|
59
|
+
* <div>页面内容</div>
|
|
60
|
+
* </PntGeneralLayout>
|
|
61
|
+
*
|
|
62
|
+
* // 带标题和操作按钮
|
|
63
|
+
* <PntGeneralLayout
|
|
64
|
+
* headerTitle="页面标题"
|
|
65
|
+
* operation={<><Button>保存</Button><Button>取消</Button></>}
|
|
66
|
+
* >
|
|
67
|
+
* <Form />
|
|
68
|
+
* </PntGeneralLayout>
|
|
69
|
+
*
|
|
70
|
+
* // 带返回按钮和底部
|
|
71
|
+
* <PntGeneralLayout
|
|
72
|
+
* headerTitle="详情页"
|
|
73
|
+
* showBackButton
|
|
74
|
+
* onBackButtonClick={() => history.back()}
|
|
75
|
+
* footer={<><Button>提交</Button><Button>重置</Button></>}
|
|
76
|
+
* >
|
|
77
|
+
* <Detail />
|
|
78
|
+
* </PntGeneralLayout>
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
declare const PntGeneralLayout: FunctionComponent<PntGeneralLayoutProps>;
|
|
82
|
+
export default PntGeneralLayout;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// src/components/PntGeneralLayout/index.tsx
|
|
2
|
+
import { ArrowLeftIcon } from "tdesign-icons-react";
|
|
3
|
+
import { Layout } from "tdesign-react";
|
|
4
|
+
import "./index.scss";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var PntGeneralLayout = (prop) => {
|
|
7
|
+
const {
|
|
8
|
+
className,
|
|
9
|
+
headerTitle,
|
|
10
|
+
showBackButton = false,
|
|
11
|
+
onBackButtonClick,
|
|
12
|
+
subHeaderContent,
|
|
13
|
+
operation,
|
|
14
|
+
bodyRef,
|
|
15
|
+
children,
|
|
16
|
+
bodyStyle,
|
|
17
|
+
footer
|
|
18
|
+
} = prop;
|
|
19
|
+
const { Header, Footer } = Layout;
|
|
20
|
+
return /* @__PURE__ */ jsxs(Layout, { className: `pnt-general-layout${className ? " " + className : ""}`, children: [
|
|
21
|
+
headerTitle && /* @__PURE__ */ jsxs(Header, { children: [
|
|
22
|
+
/* @__PURE__ */ jsxs("span", { className: "header-title", children: [
|
|
23
|
+
showBackButton && /* @__PURE__ */ jsx(
|
|
24
|
+
ArrowLeftIcon,
|
|
25
|
+
{
|
|
26
|
+
className: "goback-icon",
|
|
27
|
+
size: "24px",
|
|
28
|
+
onClick: onBackButtonClick
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
/* @__PURE__ */ jsx("span", { className: "title", children: headerTitle })
|
|
32
|
+
] }),
|
|
33
|
+
operation && /* @__PURE__ */ jsx("span", { className: "header-operation", children: operation })
|
|
34
|
+
] }),
|
|
35
|
+
subHeaderContent && /* @__PURE__ */ jsx("div", { className: "general-layout-sub-header", children: subHeaderContent }),
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
className: "general-layout-body",
|
|
40
|
+
ref: bodyRef,
|
|
41
|
+
style: {
|
|
42
|
+
height: `calc(100%${headerTitle && " - 72px"}${footer && " - 72px"})`,
|
|
43
|
+
...bodyStyle
|
|
44
|
+
},
|
|
45
|
+
children
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
footer && /* @__PURE__ */ jsx(Footer, { children: footer })
|
|
49
|
+
] });
|
|
50
|
+
};
|
|
51
|
+
var PntGeneralLayout_default = PntGeneralLayout;
|
|
52
|
+
export {
|
|
53
|
+
PntGeneralLayout_default as default
|
|
54
|
+
};
|