@pnt-team/pnt-component-frontend 0.0.34

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 (78) hide show
  1. package/README.md +34 -0
  2. package/lib/cjs/api/index.d.ts +17 -0
  3. package/lib/cjs/api/index.js +45 -0
  4. package/lib/cjs/assets/css/tdesign-theme.css +584 -0
  5. package/lib/cjs/assets/images/uploadImg.png +0 -0
  6. package/lib/cjs/assets/svg/inputSearch.svg +4 -0
  7. package/lib/cjs/assets/svg/inputTip.svg +5 -0
  8. package/lib/cjs/assets/svg/inputWarnTip.svg +5 -0
  9. package/lib/cjs/components/PntCopyData/index.d.ts +91 -0
  10. package/lib/cjs/components/PntCopyData/index.js +81 -0
  11. package/lib/cjs/components/PntCopyData/index.scss +5 -0
  12. package/lib/cjs/components/PntImagePreview/index.d.ts +75 -0
  13. package/lib/cjs/components/PntImagePreview/index.js +91 -0
  14. package/lib/cjs/components/PntImagePreview/index.scss +54 -0
  15. package/lib/cjs/components/PntSecureBox/index.d.ts +69 -0
  16. package/lib/cjs/components/PntSecureBox/index.js +65 -0
  17. package/lib/cjs/components/PntSecureBox/index.scss +19 -0
  18. package/lib/cjs/configs/host.d.ts +12 -0
  19. package/lib/cjs/configs/host.js +39 -0
  20. package/lib/cjs/configs/token.d.ts +2 -0
  21. package/lib/cjs/configs/token.js +25 -0
  22. package/lib/cjs/global.d.ts +30 -0
  23. package/lib/cjs/hooks/useBtnPermission.d.ts +67 -0
  24. package/lib/cjs/hooks/useBtnPermission.js +57 -0
  25. package/lib/cjs/hooks/useHighSecurity.d.ts +6 -0
  26. package/lib/cjs/hooks/useHighSecurity.js +51 -0
  27. package/lib/cjs/hooks/useOsPlatformList.d.ts +68 -0
  28. package/lib/cjs/hooks/useOsPlatformList.js +104 -0
  29. package/lib/cjs/hooks/usePagination.d.ts +72 -0
  30. package/lib/cjs/hooks/usePagination.js +71 -0
  31. package/lib/cjs/index.d.ts +10 -0
  32. package/lib/cjs/index.js +57 -0
  33. package/lib/cjs/utils/const.d.ts +13 -0
  34. package/lib/cjs/utils/const.js +51 -0
  35. package/lib/cjs/utils/index.d.ts +6 -0
  36. package/lib/cjs/utils/index.js +43 -0
  37. package/lib/cjs/utils/request.d.ts +8 -0
  38. package/lib/cjs/utils/request.js +82 -0
  39. package/lib/esm/api/index.d.ts +17 -0
  40. package/lib/esm/api/index.js +11 -0
  41. package/lib/esm/assets/css/tdesign-theme.css +584 -0
  42. package/lib/esm/assets/images/uploadImg.png +0 -0
  43. package/lib/esm/assets/svg/inputSearch.svg +4 -0
  44. package/lib/esm/assets/svg/inputTip.svg +5 -0
  45. package/lib/esm/assets/svg/inputWarnTip.svg +5 -0
  46. package/lib/esm/components/PntCopyData/index.d.ts +91 -0
  47. package/lib/esm/components/PntCopyData/index.js +51 -0
  48. package/lib/esm/components/PntCopyData/index.scss +5 -0
  49. package/lib/esm/components/PntImagePreview/index.d.ts +75 -0
  50. package/lib/esm/components/PntImagePreview/index.js +61 -0
  51. package/lib/esm/components/PntImagePreview/index.scss +54 -0
  52. package/lib/esm/components/PntSecureBox/index.d.ts +69 -0
  53. package/lib/esm/components/PntSecureBox/index.js +35 -0
  54. package/lib/esm/components/PntSecureBox/index.scss +19 -0
  55. package/lib/esm/configs/host.d.ts +12 -0
  56. package/lib/esm/configs/host.js +19 -0
  57. package/lib/esm/configs/token.d.ts +2 -0
  58. package/lib/esm/configs/token.js +5 -0
  59. package/lib/esm/global.d.ts +30 -0
  60. package/lib/esm/hooks/useBtnPermission.d.ts +67 -0
  61. package/lib/esm/hooks/useBtnPermission.js +31 -0
  62. package/lib/esm/hooks/useHighSecurity.d.ts +6 -0
  63. package/lib/esm/hooks/useHighSecurity.js +27 -0
  64. package/lib/esm/hooks/useOsPlatformList.d.ts +68 -0
  65. package/lib/esm/hooks/useOsPlatformList.js +68 -0
  66. package/lib/esm/hooks/usePagination.d.ts +72 -0
  67. package/lib/esm/hooks/usePagination.js +47 -0
  68. package/lib/esm/index.d.ts +10 -0
  69. package/lib/esm/index.js +17 -0
  70. package/lib/esm/utils/const.d.ts +13 -0
  71. package/lib/esm/utils/const.js +26 -0
  72. package/lib/esm/utils/index.d.ts +6 -0
  73. package/lib/esm/utils/index.js +19 -0
  74. package/lib/esm/utils/request.d.ts +8 -0
  75. package/lib/esm/utils/request.js +52 -0
  76. package/lib/umd/pnt-component-frontend.min.css +1 -0
  77. package/lib/umd/pnt-component-frontend.min.js +1 -0
  78. package/package.json +94 -0
@@ -0,0 +1,91 @@
1
+ import { FunctionComponent, ReactNode } from 'react';
2
+ import { PopupPlacement } from 'tdesign-react';
3
+ import './index.scss';
4
+ /**
5
+ * 复制触发元素的渲染属性
6
+ * @description 由组件内部构造,需绑定到触发元素上
7
+ */
8
+ interface CopyTriggerProps {
9
+ /**
10
+ * 触发复制
11
+ * @description 绑定到触发元素的点击事件,点击后执行复制逻辑
12
+ */
13
+ onClick: () => void;
14
+ /**
15
+ * 鼠标移出回调
16
+ * @description 绑定到触发元素的 mouseleave 事件,用于延迟关闭提示气泡
17
+ */
18
+ onMouseLeave: () => void;
19
+ }
20
+ interface PntCopyDataProps {
21
+ /**
22
+ * 自定义类名
23
+ * @description 用于添加额外的样式类名到 Popup 弹层根元素
24
+ */
25
+ className?: string;
26
+ /**
27
+ * 需要复制的数据
28
+ * @description 支持直接传入字符串,或传入异步函数返回字符串(如需请求接口获取)
29
+ */
30
+ data: string | (() => Promise<string>);
31
+ /**
32
+ * Popup 弹出位置
33
+ * @description 提示气泡弹出的方位,如 top / bottom / left / right 等,默认值由 tdesign Popup 决定
34
+ */
35
+ placement?: PopupPlacement;
36
+ /**
37
+ * 提示内容渲染函数
38
+ * @description 根据复制状态渲染气泡提示内容
39
+ * @param isCopy - 是否复制成功
40
+ * @param isFail - 是否复制失败
41
+ */
42
+ tips: (isCopy: boolean, isFail: boolean) => ReactNode;
43
+ /**
44
+ * 触发元素渲染函数
45
+ * @description 渲染点击触发复制的元素,入参为需要绑定到触发元素的事件回调
46
+ */
47
+ contentFn: (props: CopyTriggerProps) => ReactNode;
48
+ }
49
+ /**
50
+ * 数据复制组件
51
+ * @description 点击触发元素后将数据复制到剪贴板,并通过 Popup 气泡提示复制结果。
52
+ * 优先使用 navigator.clipboard 写入剪贴板,非安全上下文自动降级为
53
+ * document.execCommand('copy') 兜底,无额外第三方依赖。
54
+ * 注意:本组件为受控可见的 Popup,触发元素的鼠标移出后约 200ms 自动关闭提示
55
+ * @param {PntCopyDataProps} props - 组件属性
56
+ * @param {string} [props.className] - 自定义类名
57
+ * @param {string | (() => Promise<string>)} props.data - 需要复制的数据,支持字符串或异步函数
58
+ * @param {PopupPlacement} [props.placement] - Popup 弹出位置
59
+ * @param {function} props.tips - 提示内容渲染函数 (isCopy, isFail) => ReactNode
60
+ * @param {function} props.contentFn - 触发元素渲染函数,入参为 { onClick, onMouseLeave }
61
+ *
62
+ * @example
63
+ * ```tsx
64
+ * // 基础用法
65
+ * <PntCopyData
66
+ * data="这是一段需要复制的文本"
67
+ * tips={(isCopy, isFail) => (isFail ? '复制失败' : '复制成功')}
68
+ * contentFn={({ onClick, onMouseLeave }) => (
69
+ * <Button onClick={onClick} onMouseLeave={onMouseLeave}>
70
+ * 复制
71
+ * </Button>
72
+ * )}
73
+ * />
74
+ *
75
+ * // 异步获取数据(如从接口获取密码)
76
+ * <PntCopyData
77
+ * data={async () => await fetchSecret()}
78
+ * placement="top"
79
+ * tips={(isCopy, isFail) => (isFail ? '获取失败' : '已复制到剪贴板')}
80
+ * contentFn={({ onClick, onMouseLeave }) => (
81
+ * <Link onClick={onClick} onMouseLeave={onMouseLeave}>
82
+ * 查看密码
83
+ * </Link>
84
+ * )}
85
+ * />
86
+ * ```
87
+ *
88
+ * @returns {ReactElement} 数据复制组件
89
+ */
90
+ declare const PntCopyData: FunctionComponent<PntCopyDataProps>;
91
+ export default PntCopyData;
@@ -0,0 +1,81 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
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
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/PntCopyData/index.tsx
30
+ var PntCopyData_exports = {};
31
+ __export(PntCopyData_exports, {
32
+ default: () => PntCopyData_default
33
+ });
34
+ module.exports = __toCommonJS(PntCopyData_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_tdesign_react = require("tdesign-react");
37
+ var import_index = require("./index.scss");
38
+ var PntCopyData = (props) => {
39
+ const { data, className, contentFn, placement, tips } = props;
40
+ const [isCopy, setIsCopy] = (0, import_react.useState)(false);
41
+ const [isFail, setIsFail] = (0, import_react.useState)(false);
42
+ const copyDataToClipboard = async () => {
43
+ const text = typeof data === "string" ? data : await data();
44
+ if (!text) {
45
+ return setIsFail(true);
46
+ }
47
+ if (navigator.clipboard && window.isSecureContext) {
48
+ navigator.clipboard.writeText(text);
49
+ setIsCopy(true);
50
+ } else {
51
+ const textArea = document.createElement("textarea");
52
+ textArea.value = text;
53
+ document.body.appendChild(textArea);
54
+ textArea.focus();
55
+ textArea.select();
56
+ document.execCommand("copy") && setIsCopy(true);
57
+ textArea.remove();
58
+ }
59
+ };
60
+ return /* @__PURE__ */ import_react.default.createElement(
61
+ import_tdesign_react.Popup,
62
+ {
63
+ overlayClassName: `pnt-copy-data-popup${className ? " " + className : ""}`,
64
+ placement,
65
+ content: tips(isCopy, isFail),
66
+ visible: isCopy || isFail
67
+ },
68
+ contentFn({
69
+ onClick: () => {
70
+ copyDataToClipboard();
71
+ },
72
+ onMouseLeave: () => {
73
+ setTimeout(() => {
74
+ setIsCopy(false);
75
+ setIsFail(false);
76
+ }, 200);
77
+ }
78
+ })
79
+ );
80
+ };
81
+ var PntCopyData_default = PntCopyData;
@@ -0,0 +1,5 @@
1
+ .pnt-copy-data-popup {
2
+ .t-popup__content {
3
+ white-space: pre-wrap;
4
+ }
5
+ }
@@ -0,0 +1,75 @@
1
+ import React, { FC } from 'react';
2
+ import './index.scss';
3
+ interface PntImagePreviewProps {
4
+ /**
5
+ * 当前图片组件 URL
6
+ * @description 图片的完整 URL 地址,用于显示已上传的图片
7
+ */
8
+ iconUrl: string | undefined;
9
+ /**
10
+ * 上传加载状态
11
+ * @description 当为 true 时显示上传加载状态,阻止其他操作
12
+ */
13
+ loading: boolean;
14
+ /**
15
+ * 默认图片
16
+ * @description 支持传入默认封面图片,不传入则使用默认的 uploadImg 作为默认图片
17
+ */
18
+ defaultImg?: string;
19
+ /**
20
+ * 自定义扩展参数
21
+ * @description 用于传递额外的配置选项,如样式等
22
+ */
23
+ params?: {
24
+ /** 自定义样式 */
25
+ style?: React.CSSProperties;
26
+ /** 其他可扩展配置 */
27
+ [key: string]: any;
28
+ };
29
+ /**
30
+ * 删除回调函数
31
+ * @description 当点击删除图标时触发的回调函数
32
+ * @param e - 事件对象
33
+ */
34
+ onRemove?: (e: any) => void;
35
+ }
36
+ /**
37
+ * 上传图片查看器组件
38
+ * @description 用于展示上传的图片,支持预览、删除功能和上传状态显示
39
+ * @param {PntImagePreviewProps} props - 组件属性
40
+ * @param {string | undefined} props.iconUrl - 当前图片组件 URL
41
+ * @param {boolean} props.loading - 上传加载状态
42
+ * @param {string} [props.defaultImg] - 默认图片
43
+ * @param {object} [props.params] - 自定义扩展参数
44
+ * @param {function} [props.onRemove] - 删除回调函数
45
+ *
46
+ * @example
47
+ * ```tsx
48
+ * // 基础用法
49
+ * <UploadImageViewer
50
+ * iconUrl={imageUrl}
51
+ * loading={uploading}
52
+ * onRemove={handleRemove}
53
+ * />
54
+ *
55
+ * // 带默认图片
56
+ * <UploadImageViewer
57
+ * iconUrl={imageUrl}
58
+ * loading={false}
59
+ * defaultImg="/path/to/default.png"
60
+ * onRemove={handleRemove}
61
+ * />
62
+ *
63
+ * // 自定义样式
64
+ * <UploadImageViewer
65
+ * iconUrl={imageUrl}
66
+ * loading={uploading}
67
+ * params={{ style: { width: '200px', height: '200px' } }}
68
+ * onRemove={handleRemove}
69
+ * />
70
+ * ```
71
+ *
72
+ * @returns {ReactElement} 上传图片查看器组件
73
+ */
74
+ declare const PntImagePreview: FC<PntImagePreviewProps>;
75
+ export default PntImagePreview;
@@ -0,0 +1,91 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
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
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/PntImagePreview/index.tsx
30
+ var PntImagePreview_exports = {};
31
+ __export(PntImagePreview_exports, {
32
+ default: () => PntImagePreview_default
33
+ });
34
+ module.exports = __toCommonJS(PntImagePreview_exports);
35
+ var import_uploadImg = __toESM(require("../../assets/images/uploadImg.png"));
36
+ var import_react = __toESM(require("react"));
37
+ var import_tdesign_icons_react = require("tdesign-icons-react");
38
+ var import_tdesign_react = require("tdesign-react");
39
+ var import_index = require("./index.scss");
40
+ var PntImagePreview = ({
41
+ iconUrl,
42
+ loading,
43
+ defaultImg,
44
+ params,
45
+ onRemove
46
+ }) => {
47
+ const src = (iconUrl == null ? void 0 : iconUrl.length) ? iconUrl : defaultImg || import_uploadImg.default;
48
+ const LoadingContent = (isImageLoading) => /* @__PURE__ */ import_react.default.createElement(
49
+ "div",
50
+ {
51
+ className: isImageLoading ? "pnt-image-preview-progress" : "pnt-image-preview-upload-progress",
52
+ style: params == null ? void 0 : params.style
53
+ },
54
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "pnt-image-preview-loading" }, /* @__PURE__ */ import_react.default.createElement(import_tdesign_icons_react.LoadingIcon, { size: "18px", name: "loading" }), /* @__PURE__ */ import_react.default.createElement("p", null, "上传中"))
55
+ );
56
+ return /* @__PURE__ */ import_react.default.createElement(
57
+ "div",
58
+ {
59
+ className: "pnt-image-preview-wrapper",
60
+ onClick: (e) => {
61
+ if ((iconUrl == null ? void 0 : iconUrl.length) || loading) {
62
+ e.stopPropagation();
63
+ }
64
+ }
65
+ },
66
+ loading ? LoadingContent(false) : /* @__PURE__ */ import_react.default.createElement(
67
+ import_tdesign_react.ImageViewer,
68
+ {
69
+ images: [src],
70
+ closeOnOverlay: true,
71
+ trigger: ({ open }) => {
72
+ const mask = /* @__PURE__ */ import_react.default.createElement("div", { className: "pnt-image-preview-mask" }, /* @__PURE__ */ import_react.default.createElement("span", null, /* @__PURE__ */ import_react.default.createElement(import_tdesign_icons_react.BrowseIcon, { onClick: open, size: "16px", name: "browse" })), /* @__PURE__ */ import_react.default.createElement("span", { className: "pnt-image-preview-divider" }), /* @__PURE__ */ import_react.default.createElement("span", null, /* @__PURE__ */ import_react.default.createElement(import_tdesign_icons_react.DeleteIcon, { onClick: onRemove, size: "16px", name: "delete" })));
73
+ return /* @__PURE__ */ import_react.default.createElement(
74
+ import_tdesign_react.Image,
75
+ {
76
+ alt: "",
77
+ src,
78
+ loading: LoadingContent(true),
79
+ overlayContent: iconUrl ? mask : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null),
80
+ overlayTrigger: "hover",
81
+ fit: "contain",
82
+ className: "pnt-image-preview",
83
+ style: params == null ? void 0 : params.style
84
+ }
85
+ );
86
+ }
87
+ }
88
+ )
89
+ );
90
+ };
91
+ var PntImagePreview_default = PntImagePreview;
@@ -0,0 +1,54 @@
1
+ .pnt-image-preview-wrapper {
2
+ position: relative;
3
+
4
+ .pnt-image-preview-progress,
5
+ .pnt-image-preview-upload-progress {
6
+ width: 136px;
7
+ height: 136px;
8
+ display: flex;
9
+ align-items: center;
10
+ justify-content: center;
11
+
12
+ .pnt-image-preview-loading {
13
+ width: 100%;
14
+ height: 100%;
15
+ text-align: center;
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: center;
19
+ flex-direction: column;
20
+ border-radius: 4px;
21
+ background-color: #f7f8fa;
22
+
23
+ svg {
24
+ color: var(--td-brand-color);
25
+ font-size: 24px;
26
+ }
27
+
28
+ p {
29
+ margin-top: 4px;
30
+ color: #808191;
31
+ font-size: 12px;
32
+ }
33
+ }
34
+ }
35
+
36
+ .pnt-image-preview {
37
+ width: 136px;
38
+ height: 136px;
39
+
40
+ .pnt-image-preview-mask {
41
+ background: rgba(0, 0, 0, 60%);
42
+ color: #fff;
43
+ height: 100%;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ .pnt-image-preview-divider {
48
+ margin: 0 var(--td-comp-margin-l);
49
+ border-left: 1px var(--td-text-color-anti) solid;
50
+ height: var(--td-comp-size-xxxs);
51
+ }
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,69 @@
1
+ import React, { FC } from 'react';
2
+ import './index.scss';
3
+ interface PntSecureBoxProps {
4
+ /**
5
+ * 高敏信息的唯一标识 key
6
+ * @description 用于标识和存储特定的高敏数据项
7
+ */
8
+ dataKey: string;
9
+ /**
10
+ * 高敏信息的实际值
11
+ * @description 初始显示的值,通常为脱敏后的数据
12
+ */
13
+ dataValue: string;
14
+ /**
15
+ * 环境标识
16
+ * @description 用于区分不同环境(如:dev, test, production)
17
+ */
18
+ env: string | number;
19
+ /**
20
+ * 游戏 ID
21
+ * @description 标识具体的游戏项目
22
+ */
23
+ gameId: string | number;
24
+ /**
25
+ * 自定义渲染函数
26
+ * @description 接收处理后的数据作为参数,返回需要渲染的 React 元素
27
+ * @param content - 处理后的数据内容(真实数据或脱敏数据)
28
+ * @returns React 元素
29
+ */
30
+ renderDom: (content: string) => React.ReactNode;
31
+ /**
32
+ * 自定义查看按钮文案
33
+ * @description 用于适配多语言场景,默认为 'View'
34
+ */
35
+ viewText?: string;
36
+ /**
37
+ * 页面 ID
38
+ * @description 用于记录操作日志和权限验证
39
+ */
40
+ pageId?: string;
41
+ }
42
+ /**
43
+ * 高敏信息展示统一组件
44
+ * @description 用于统一处理和展示高敏信息,支持脱敏显示和按需获取真实数据
45
+ * @param {PntSecureBoxProps} props - 组件属性
46
+ * @param {string} props.dataKey - 高敏信息的唯一标识 key
47
+ * @param {string} props.dataValue - 高敏信息的实际值
48
+ * @param {string | number} props.env - 环境标识
49
+ * @param {string | number} props.gameId - 游戏 ID
50
+ * @param {(content: string) => React.ReactNode} props.renderDom - 自定义渲染函数
51
+ * @param {string} [props.viewText] - 自定义查看按钮文案
52
+ * @param {string} [props.pageId] - 页面 ID
53
+ *
54
+ * @example
55
+ * ```tsx
56
+ * <PntSecureBox
57
+ * dataKey="userPhone"
58
+ * dataValue="138****8888"
59
+ * env="production"
60
+ * gameId={12345}
61
+ * renderDom={(content) => <span>{content}</span>}
62
+ * viewText="查看"
63
+ * />
64
+ * ```
65
+ *
66
+ * @returns {ReactElement} 高敏信息展示组件
67
+ */
68
+ declare const PntSecureBox: FC<PntSecureBoxProps>;
69
+ export default PntSecureBox;
@@ -0,0 +1,65 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
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
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/PntSecureBox/index.tsx
30
+ var PntSecureBox_exports = {};
31
+ __export(PntSecureBox_exports, {
32
+ default: () => PntSecureBox_default
33
+ });
34
+ module.exports = __toCommonJS(PntSecureBox_exports);
35
+ var import_useHighSecurity = require("../../hooks/useHighSecurity");
36
+ var import_utils = require("../../utils");
37
+ var import_react = __toESM(require("react"));
38
+ var import_index = require("./index.scss");
39
+ var PntSecureBox = (prop) => {
40
+ const { dataKey, dataValue, env, gameId, renderDom, viewText, pageId } = prop;
41
+ const { securityData, requestSecurityData } = (0, import_useHighSecurity.useHighSecurity)();
42
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: "pnt-secure-box" }, /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, renderDom(
43
+ (0, import_utils.isSecurityData)(dataValue) ? securityData[dataKey] || "******" : dataValue
44
+ ), (0, import_utils.isSecurityData)(dataValue) && !securityData.hasOwnProperty(dataKey) && /* @__PURE__ */ import_react.default.createElement(
45
+ "span",
46
+ {
47
+ className: "view-icon",
48
+ onClick: () => {
49
+ requestSecurityData({
50
+ env,
51
+ gameId,
52
+ pageId,
53
+ param: [
54
+ {
55
+ key: dataKey,
56
+ value: dataValue
57
+ }
58
+ ]
59
+ });
60
+ }
61
+ },
62
+ viewText || "View"
63
+ )));
64
+ };
65
+ var PntSecureBox_default = PntSecureBox;
@@ -0,0 +1,19 @@
1
+ .pnt-secure-box {
2
+ position: relative;
3
+ color: #333;
4
+ max-width: fit-content;
5
+
6
+ .view-icon {
7
+ position: absolute;
8
+ top: 1px;
9
+ right: -30px;
10
+ color: #3f8cff !important;
11
+ cursor: pointer;
12
+ font-size: small;
13
+ }
14
+
15
+ .security-value {
16
+ position: relative;
17
+ top: 3px;
18
+ }
19
+ }
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ development: {
3
+ API: string;
4
+ };
5
+ test: {
6
+ API: string;
7
+ };
8
+ production: {
9
+ API: string;
10
+ };
11
+ };
12
+ export default _default;
@@ -0,0 +1,39 @@
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/configs/host.ts
20
+ var host_exports = {};
21
+ __export(host_exports, {
22
+ default: () => host_default
23
+ });
24
+ module.exports = __toCommonJS(host_exports);
25
+ var host_default = {
26
+ development: {
27
+ // 开发环境接口请求
28
+ API: "/api"
29
+ },
30
+ test: {
31
+ // 测试环境接口地址
32
+ API: "http://43.134.150.67"
33
+ },
34
+ production: {
35
+ // 正式环境接口地址
36
+ API: "http://43.134.150.67"
37
+ // 任意ip即可, pnt主应用会自动替换,
38
+ }
39
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50SWQiOiJ1cy0xMDRmZTliNDZmZGY0NTM0YmU2NjNlYzllYWE5ZWEyZSIsImFjY291bnROYW1lIjoidl9id3dlaXdhbmciLCJleHAiOjE3NTcwNjczMzUsImV4cFRva2VuIjoxNzU3MDY2NTM1LCJqdGkiOiI2OWY3Njc3My1lMDk0LTQwZTYtYTNlMS00NWI3ZjQyN2Q2OTMifQ.X81cdIwj3nothPmY6dfJLPNKLKKvnLU3vkNlHFITsRs";
2
+ export default _default;
@@ -0,0 +1,25 @@
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/configs/token.ts
20
+ var token_exports = {};
21
+ __export(token_exports, {
22
+ default: () => token_default
23
+ });
24
+ module.exports = __toCommonJS(token_exports);
25
+ var token_default = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50SWQiOiJ1cy0xMDRmZTliNDZmZGY0NTM0YmU2NjNlYzllYWE5ZWEyZSIsImFjY291bnROYW1lIjoidl9id3dlaXdhbmciLCJleHAiOjE3NTcwNjczMzUsImV4cFRva2VuIjoxNzU3MDY2NTM1LCJqdGkiOiI2OWY3Njc3My1lMDk0LTQwZTYtYTNlMS00NWI3ZjQyN2Q2OTMifQ.X81cdIwj3nothPmY6dfJLPNKLKKvnLU3vkNlHFITsRs";
@@ -0,0 +1,30 @@
1
+ // src/global.d.ts
2
+ declare module '*.png' {
3
+ const src: string;
4
+ export default src;
5
+ }
6
+
7
+ declare module '*.jpg' {
8
+ const src: string;
9
+ export default src;
10
+ }
11
+
12
+ declare module '*.svg' {
13
+ const src: string;
14
+ export default src;
15
+ }
16
+
17
+ // 字体文件
18
+ declare module '*.woff' {
19
+ const src: string;
20
+ export default src;
21
+ }
22
+ declare module '*.woff2' {
23
+ const src: string;
24
+ export default src;
25
+ }
26
+
27
+ declare module '*.json' {
28
+ const value: any;
29
+ export default value;
30
+ }