@pnt-team/pnt-component-frontend 0.0.34 → 0.0.36

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 (77) hide show
  1. package/README.md +311 -21
  2. package/package.json +8 -2
  3. package/lib/cjs/api/index.d.ts +0 -17
  4. package/lib/cjs/api/index.js +0 -45
  5. package/lib/cjs/assets/css/tdesign-theme.css +0 -584
  6. package/lib/cjs/assets/images/uploadImg.png +0 -0
  7. package/lib/cjs/assets/svg/inputSearch.svg +0 -4
  8. package/lib/cjs/assets/svg/inputTip.svg +0 -5
  9. package/lib/cjs/assets/svg/inputWarnTip.svg +0 -5
  10. package/lib/cjs/components/PntCopyData/index.d.ts +0 -91
  11. package/lib/cjs/components/PntCopyData/index.js +0 -81
  12. package/lib/cjs/components/PntCopyData/index.scss +0 -5
  13. package/lib/cjs/components/PntImagePreview/index.d.ts +0 -75
  14. package/lib/cjs/components/PntImagePreview/index.js +0 -91
  15. package/lib/cjs/components/PntImagePreview/index.scss +0 -54
  16. package/lib/cjs/components/PntSecureBox/index.d.ts +0 -69
  17. package/lib/cjs/components/PntSecureBox/index.js +0 -65
  18. package/lib/cjs/components/PntSecureBox/index.scss +0 -19
  19. package/lib/cjs/configs/host.d.ts +0 -12
  20. package/lib/cjs/configs/host.js +0 -39
  21. package/lib/cjs/configs/token.d.ts +0 -2
  22. package/lib/cjs/configs/token.js +0 -25
  23. package/lib/cjs/global.d.ts +0 -30
  24. package/lib/cjs/hooks/useBtnPermission.d.ts +0 -67
  25. package/lib/cjs/hooks/useBtnPermission.js +0 -57
  26. package/lib/cjs/hooks/useHighSecurity.d.ts +0 -6
  27. package/lib/cjs/hooks/useHighSecurity.js +0 -51
  28. package/lib/cjs/hooks/useOsPlatformList.d.ts +0 -68
  29. package/lib/cjs/hooks/useOsPlatformList.js +0 -104
  30. package/lib/cjs/hooks/usePagination.d.ts +0 -72
  31. package/lib/cjs/hooks/usePagination.js +0 -71
  32. package/lib/cjs/index.d.ts +0 -10
  33. package/lib/cjs/utils/const.d.ts +0 -13
  34. package/lib/cjs/utils/const.js +0 -51
  35. package/lib/cjs/utils/index.d.ts +0 -6
  36. package/lib/cjs/utils/index.js +0 -43
  37. package/lib/cjs/utils/request.d.ts +0 -8
  38. package/lib/cjs/utils/request.js +0 -82
  39. package/lib/esm/api/index.d.ts +0 -17
  40. package/lib/esm/api/index.js +0 -11
  41. package/lib/esm/assets/css/tdesign-theme.css +0 -584
  42. package/lib/esm/assets/images/uploadImg.png +0 -0
  43. package/lib/esm/assets/svg/inputSearch.svg +0 -4
  44. package/lib/esm/assets/svg/inputTip.svg +0 -5
  45. package/lib/esm/assets/svg/inputWarnTip.svg +0 -5
  46. package/lib/esm/components/PntCopyData/index.d.ts +0 -91
  47. package/lib/esm/components/PntCopyData/index.js +0 -51
  48. package/lib/esm/components/PntCopyData/index.scss +0 -5
  49. package/lib/esm/components/PntImagePreview/index.d.ts +0 -75
  50. package/lib/esm/components/PntImagePreview/index.js +0 -61
  51. package/lib/esm/components/PntImagePreview/index.scss +0 -54
  52. package/lib/esm/components/PntSecureBox/index.d.ts +0 -69
  53. package/lib/esm/components/PntSecureBox/index.js +0 -35
  54. package/lib/esm/components/PntSecureBox/index.scss +0 -19
  55. package/lib/esm/configs/host.d.ts +0 -12
  56. package/lib/esm/configs/host.js +0 -19
  57. package/lib/esm/configs/token.d.ts +0 -2
  58. package/lib/esm/configs/token.js +0 -5
  59. package/lib/esm/global.d.ts +0 -30
  60. package/lib/esm/hooks/useBtnPermission.d.ts +0 -67
  61. package/lib/esm/hooks/useBtnPermission.js +0 -31
  62. package/lib/esm/hooks/useHighSecurity.d.ts +0 -6
  63. package/lib/esm/hooks/useHighSecurity.js +0 -27
  64. package/lib/esm/hooks/useOsPlatformList.d.ts +0 -68
  65. package/lib/esm/hooks/useOsPlatformList.js +0 -68
  66. package/lib/esm/hooks/usePagination.d.ts +0 -72
  67. package/lib/esm/hooks/usePagination.js +0 -47
  68. package/lib/esm/index.d.ts +0 -10
  69. package/lib/esm/index.js +0 -17
  70. package/lib/esm/utils/const.d.ts +0 -13
  71. package/lib/esm/utils/const.js +0 -26
  72. package/lib/esm/utils/index.d.ts +0 -6
  73. package/lib/esm/utils/index.js +0 -19
  74. package/lib/esm/utils/request.d.ts +0 -8
  75. package/lib/esm/utils/request.js +0 -52
  76. package/lib/umd/pnt-component-frontend.min.css +0 -1
  77. package/lib/umd/pnt-component-frontend.min.js +0 -1
@@ -1,81 +0,0 @@
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;
@@ -1,5 +0,0 @@
1
- .pnt-copy-data-popup {
2
- .t-popup__content {
3
- white-space: pre-wrap;
4
- }
5
- }
@@ -1,75 +0,0 @@
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;
@@ -1,91 +0,0 @@
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;
@@ -1,54 +0,0 @@
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
- }
@@ -1,69 +0,0 @@
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;
@@ -1,65 +0,0 @@
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;
@@ -1,19 +0,0 @@
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
- }
@@ -1,12 +0,0 @@
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;
@@ -1,39 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- declare const _default: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50SWQiOiJ1cy0xMDRmZTliNDZmZGY0NTM0YmU2NjNlYzllYWE5ZWEyZSIsImFjY291bnROYW1lIjoidl9id3dlaXdhbmciLCJleHAiOjE3NTcwNjczMzUsImV4cFRva2VuIjoxNzU3MDY2NTM1LCJqdGkiOiI2OWY3Njc3My1lMDk0LTQwZTYtYTNlMS00NWI3ZjQyN2Q2OTMifQ.X81cdIwj3nothPmY6dfJLPNKLKKvnLU3vkNlHFITsRs";
2
- export default _default;
@@ -1,25 +0,0 @@
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";
@@ -1,30 +0,0 @@
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
- }
@@ -1,67 +0,0 @@
1
- /** 按钮权限值:1 有权限,-1 隐藏,-2 禁用 */
2
- export type BtnPermissionValue = number;
3
- /** 按钮权限映射:外层 key 为业务类型(全局为 'global' / 演示游戏为 '0' / 业务为具体 gameId / 兜底为 'no_permission_manner'),内层 key 为按钮标识符 */
4
- export type BtnPermissionMap = Record<string, Record<string, BtnPermissionValue>>;
5
- /** 演示游戏信息(来自用户信息,用于演示游戏判定) */
6
- export interface DemoGameInfo {
7
- id: number | string;
8
- name: string;
9
- }
10
- /** 当前服务信息(与 demoGame 比对判断是否演示游戏) */
11
- export interface ServiceInfo {
12
- serviceType?: number | string;
13
- serviceName?: string;
14
- }
15
- export interface UseBtnPermissionOptions {
16
- /**
17
- * 按钮权限映射(原从全局 store 注入,现改为入参注入)。
18
- * 未传或取不到值时按有权限(1)处理。
19
- */
20
- permissions?: BtnPermissionMap;
21
- /** 演示游戏信息;与 serviceInfo 同时传入才启用演示游戏判定 */
22
- demoGame?: DemoGameInfo;
23
- /** 当前服务信息 */
24
- serviceInfo?: ServiceInfo;
25
- }
26
- /** 演示游戏在权限映射中的业务类型 key */
27
- export declare const DEMO_GAME_TYPE_KEY = "0";
28
- /** 无权限兜底配置的业务类型 key */
29
- export declare const NO_PERMISSION_MANNER_KEY = "no_permission_manner";
30
- /**
31
- * 按钮权限 Hook(L3 业务 Hook)
32
- *
33
- * 融合 account-business-frontend 与 pnt-internal-tools-frontend 两版实现:
34
- * - getBtnPermission(type, key):获取按钮处理方式,1 有权限 / -1 隐藏 / -2 禁用,
35
- * 取不到值时依次回退到 no_permission_manner 兜底配置、defaultValue(默认 1);
36
- * - 演示游戏(当前服务命中 demoGame)时固定使用 key '0' 的权限配置(account 版行为);
37
- * - 零业务侵入:权限列表与演示游戏信息均通过入参注入,不再依赖 redux / umi / dva。
38
- *
39
- * @param options.permissions 按钮权限映射
40
- * @param options.demoGame 演示游戏信息
41
- * @param options.serviceInfo 当前服务信息
42
- * @returns btnPermission 权限映射原文;isDemoGame 是否为演示游戏;getBtnPermission 获取按钮权限
43
- *
44
- * @example
45
- * ```tsx
46
- * import { useBtnPermission } from '@pnt/business-components';
47
- *
48
- * const Demo = ({ btnPermission, userInfo }) => {
49
- * const { isDemoGame, getBtnPermission } = useBtnPermission({
50
- * permissions: btnPermission, // 例如 { global: { create: 1 }, no_permission_manner: { create: -2 } }
51
- * demoGame: userInfo?.demoGame, // 例如 { id: 11, name: 'DemoGame' }
52
- * serviceInfo: { serviceType: userInfo?.serviceType, serviceName: userInfo?.serviceName },
53
- * });
54
- *
55
- * const createPerm = getBtnPermission('global', 'create'); // 1 | -1 | -2
56
- *
57
- * if (createPerm === -1) return null; // 隐藏
58
- * return <Button disabled={createPerm === -2}>新建{isDemoGame ? '(演示)' : ''}</Button>;
59
- * };
60
- * ```
61
- */
62
- export declare const useBtnPermission: (options?: UseBtnPermissionOptions) => {
63
- btnPermission: BtnPermissionMap | undefined;
64
- isDemoGame: boolean;
65
- getBtnPermission: (type: string, key: string, defaultValue?: BtnPermissionValue) => BtnPermissionValue;
66
- };
67
- export default useBtnPermission;