@pnt-team/pnt-component-frontend 0.0.36 → 0.0.38
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/assets/css/tdesign-theme.css +584 -0
- package/lib/cjs/assets/images/uploadImg.png +0 -0
- package/lib/cjs/assets/svg/inputSearch.svg +4 -0
- package/lib/cjs/assets/svg/inputTip.svg +5 -0
- package/lib/cjs/assets/svg/inputWarnTip.svg +5 -0
- package/lib/cjs/components/PntCopyData/index.d.ts +91 -0
- package/lib/cjs/components/PntCopyData/index.js +81 -0
- package/lib/cjs/components/PntCopyData/index.scss +5 -0
- package/lib/cjs/components/PntImagePreview/index.d.ts +75 -0
- package/lib/cjs/components/PntImagePreview/index.js +91 -0
- package/lib/cjs/components/PntImagePreview/index.scss +54 -0
- package/lib/cjs/components/PntSecureBox/index.d.ts +80 -0
- package/lib/cjs/components/PntSecureBox/index.js +74 -0
- package/lib/cjs/components/PntSecureBox/index.scss +19 -0
- package/lib/cjs/global.d.ts +30 -0
- package/lib/cjs/hooks/useBtnPermission.d.ts +67 -0
- package/lib/cjs/hooks/useBtnPermission.js +57 -0
- package/lib/cjs/hooks/useHighSecurity.d.ts +48 -0
- package/lib/cjs/hooks/useHighSecurity.js +64 -0
- package/lib/cjs/hooks/useOsPlatformList.d.ts +66 -0
- package/lib/cjs/hooks/useOsPlatformList.js +88 -0
- package/lib/cjs/hooks/usePagination.d.ts +72 -0
- package/lib/cjs/hooks/usePagination.js +71 -0
- package/lib/cjs/index.d.ts +10 -0
- package/lib/cjs/utils/const.d.ts +13 -0
- package/lib/cjs/utils/const.js +51 -0
- package/lib/cjs/utils/index.d.ts +6 -0
- package/lib/cjs/utils/index.js +43 -0
- package/lib/cjs/utils/request.d.ts +8 -0
- package/lib/cjs/utils/request.js +82 -0
- package/lib/esm/assets/css/tdesign-theme.css +584 -0
- package/lib/esm/assets/images/uploadImg.png +0 -0
- package/lib/esm/assets/svg/inputSearch.svg +4 -0
- package/lib/esm/assets/svg/inputTip.svg +5 -0
- package/lib/esm/assets/svg/inputWarnTip.svg +5 -0
- package/lib/esm/components/PntCopyData/index.d.ts +91 -0
- package/lib/esm/components/PntCopyData/index.js +51 -0
- package/lib/esm/components/PntCopyData/index.scss +5 -0
- package/lib/esm/components/PntImagePreview/index.d.ts +75 -0
- package/lib/esm/components/PntImagePreview/index.js +61 -0
- package/lib/esm/components/PntImagePreview/index.scss +54 -0
- package/lib/esm/components/PntSecureBox/index.d.ts +80 -0
- package/lib/esm/components/PntSecureBox/index.js +46 -0
- package/lib/esm/components/PntSecureBox/index.scss +19 -0
- package/lib/esm/global.d.ts +30 -0
- package/lib/esm/hooks/useBtnPermission.d.ts +67 -0
- package/lib/esm/hooks/useBtnPermission.js +31 -0
- package/lib/esm/hooks/useHighSecurity.d.ts +48 -0
- package/lib/esm/hooks/useHighSecurity.js +40 -0
- package/lib/esm/hooks/useOsPlatformList.d.ts +66 -0
- package/lib/esm/hooks/useOsPlatformList.js +63 -0
- package/lib/esm/hooks/usePagination.d.ts +72 -0
- package/lib/esm/hooks/usePagination.js +47 -0
- package/lib/esm/index.d.ts +10 -0
- package/lib/esm/index.js +17 -0
- package/lib/esm/utils/const.d.ts +13 -0
- package/lib/esm/utils/const.js +26 -0
- package/lib/esm/utils/index.d.ts +6 -0
- package/lib/esm/utils/index.js +19 -0
- package/lib/esm/utils/request.d.ts +8 -0
- package/lib/esm/utils/request.js +52 -0
- package/lib/umd/pnt-component-frontend.min.css +1 -0
- package/lib/umd/pnt-component-frontend.min.js +1 -0
- package/package.json +2 -8
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** 高敏数据请求参数 */
|
|
2
|
+
export interface HighSecurityRequestParams {
|
|
3
|
+
/** 游戏 ID */
|
|
4
|
+
gameId: string | number;
|
|
5
|
+
/** 环境标识 */
|
|
6
|
+
env: string | number;
|
|
7
|
+
/** 页面 ID(不传则默认取 location.pathname) */
|
|
8
|
+
pageId?: string;
|
|
9
|
+
/** 需要解锁的参数列表 */
|
|
10
|
+
param: Array<{
|
|
11
|
+
key: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
/** 高敏数据请求函数:返回 { ret, data } 结构且 ret === 0 视为成功 */
|
|
16
|
+
export type HighSecurityFetcher = (params: HighSecurityRequestParams) => Promise<{
|
|
17
|
+
ret: number;
|
|
18
|
+
data?: Array<{
|
|
19
|
+
key: string;
|
|
20
|
+
value: string;
|
|
21
|
+
}>;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* 高敏数据解锁 Hook(L3 业务 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
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare const useHighSecurity: (fetcher: HighSecurityFetcher) => {
|
|
46
|
+
securityData: Record<string, string>;
|
|
47
|
+
requestSecurityData: ({ gameId, param, env, pageId, }: HighSecurityRequestParams) => Promise<void>;
|
|
48
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
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/hooks/useHighSecurity.ts
|
|
20
|
+
var useHighSecurity_exports = {};
|
|
21
|
+
__export(useHighSecurity_exports, {
|
|
22
|
+
useHighSecurity: () => useHighSecurity
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useHighSecurity_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var securityCache = /* @__PURE__ */ new Map();
|
|
27
|
+
var useHighSecurity = (fetcher) => {
|
|
28
|
+
const [securityData, setSecurityData] = (0, import_react.useState)(
|
|
29
|
+
() => {
|
|
30
|
+
const cached = {};
|
|
31
|
+
securityCache.forEach((value, key) => {
|
|
32
|
+
cached[key] = value;
|
|
33
|
+
});
|
|
34
|
+
return cached;
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
const requestSecurityData = async ({
|
|
38
|
+
gameId,
|
|
39
|
+
param,
|
|
40
|
+
env,
|
|
41
|
+
pageId
|
|
42
|
+
}) => {
|
|
43
|
+
const result = await fetcher({
|
|
44
|
+
gameId,
|
|
45
|
+
env: Number(env),
|
|
46
|
+
pageId: pageId || location.pathname,
|
|
47
|
+
param
|
|
48
|
+
});
|
|
49
|
+
if (result.ret === 0 && result.data) {
|
|
50
|
+
result.data.forEach((item) => {
|
|
51
|
+
securityCache.set(item.key, item.value);
|
|
52
|
+
});
|
|
53
|
+
setSecurityData(Object.fromEntries(securityCache));
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
securityData,
|
|
58
|
+
requestSecurityData
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
useHighSecurity
|
|
64
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/** OS 平台数据类型定义 */
|
|
2
|
+
export interface OsItem {
|
|
3
|
+
id: number;
|
|
4
|
+
os_name: string;
|
|
5
|
+
sdk_name: string;
|
|
6
|
+
status: number;
|
|
7
|
+
platform_id: number;
|
|
8
|
+
}
|
|
9
|
+
export interface PlatformItem {
|
|
10
|
+
id: number;
|
|
11
|
+
platform_name_zh: string;
|
|
12
|
+
platform_name_en: string;
|
|
13
|
+
status: number;
|
|
14
|
+
}
|
|
15
|
+
export interface OsPlatformData {
|
|
16
|
+
os_list: OsItem[];
|
|
17
|
+
platform_list: PlatformItem[];
|
|
18
|
+
}
|
|
19
|
+
/** OS/平台列表请求函数:返回 { code, msg, data } 结构且 code === 0 视为成功 */
|
|
20
|
+
export type OsPlatformFetcher = () => Promise<{
|
|
21
|
+
code: number;
|
|
22
|
+
msg: string;
|
|
23
|
+
data: OsPlatformData;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* 清除缓存(用于极少数需要强制刷新的场景,如后台更新了平台列表后)。
|
|
27
|
+
* @param fetcher 指定要清除的 fetcher;不传则清除全部缓存
|
|
28
|
+
*/
|
|
29
|
+
export declare const clearOsPlatformListCache: (fetcher?: OsPlatformFetcher) => void;
|
|
30
|
+
/**
|
|
31
|
+
* OS/平台列表 Hook(L3 业务 Hook)
|
|
32
|
+
*
|
|
33
|
+
* 拉取 OS 与平台枚举数据并做模块级缓存,整个会话只请求一次;
|
|
34
|
+
* 并发调用共享同一个进行中的请求。
|
|
35
|
+
*
|
|
36
|
+
* 零业务侵入:数据接口通过 fetcher 注入,不再依赖内部 request/configs,
|
|
37
|
+
* 避免将敏感配置打包进发布产物。
|
|
38
|
+
*
|
|
39
|
+
* @param fetcher 自定义请求函数,需返回 { code, msg, data } 结构且 code === 0 视为成功
|
|
40
|
+
* @returns osPlatformList OS/平台数据,请求完成或命中缓存前为 undefined
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* import http from '@/utils/request';
|
|
45
|
+
* import { useOsPlatformList } from '@pnt-team/pnt-component-frontend';
|
|
46
|
+
*
|
|
47
|
+
* const Demo = () => {
|
|
48
|
+
* const { osPlatformList } = useOsPlatformList(() =>
|
|
49
|
+
* http.get('/api/internal/business/manage/osPlatformList').then(r => r.data)
|
|
50
|
+
* );
|
|
51
|
+
*
|
|
52
|
+
* return (
|
|
53
|
+
* <Select
|
|
54
|
+
* options={osPlatformList?.platform_list.map((p) => ({
|
|
55
|
+
* label: p.platform_name_zh,
|
|
56
|
+
* value: p.id,
|
|
57
|
+
* }))}
|
|
58
|
+
* />
|
|
59
|
+
* );
|
|
60
|
+
* };
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare const useOsPlatformList: (fetcher: OsPlatformFetcher) => {
|
|
64
|
+
osPlatformList: OsPlatformData | undefined;
|
|
65
|
+
};
|
|
66
|
+
export default useOsPlatformList;
|
|
@@ -0,0 +1,88 @@
|
|
|
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/hooks/useOsPlatformList.ts
|
|
20
|
+
var useOsPlatformList_exports = {};
|
|
21
|
+
__export(useOsPlatformList_exports, {
|
|
22
|
+
clearOsPlatformListCache: () => clearOsPlatformListCache,
|
|
23
|
+
default: () => useOsPlatformList_default,
|
|
24
|
+
useOsPlatformList: () => useOsPlatformList
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(useOsPlatformList_exports);
|
|
27
|
+
var import_react = require("react");
|
|
28
|
+
var cacheMap = /* @__PURE__ */ new Map();
|
|
29
|
+
var fetchOsPlatformList = async (fetcher) => {
|
|
30
|
+
const cached = cacheMap.get(fetcher);
|
|
31
|
+
if (cached == null ? void 0 : cached.data)
|
|
32
|
+
return cached.data;
|
|
33
|
+
if (cached == null ? void 0 : cached.pending)
|
|
34
|
+
return cached.pending;
|
|
35
|
+
const pending = (async () => {
|
|
36
|
+
try {
|
|
37
|
+
const res = await fetcher();
|
|
38
|
+
if (res.code === 0) {
|
|
39
|
+
cacheMap.set(fetcher, { data: res.data });
|
|
40
|
+
return res.data;
|
|
41
|
+
}
|
|
42
|
+
return void 0;
|
|
43
|
+
} finally {
|
|
44
|
+
const entry = cacheMap.get(fetcher);
|
|
45
|
+
cacheMap.set(fetcher, { data: entry == null ? void 0 : entry.data });
|
|
46
|
+
}
|
|
47
|
+
})();
|
|
48
|
+
cacheMap.set(fetcher, { data: cached == null ? void 0 : cached.data, pending });
|
|
49
|
+
return pending;
|
|
50
|
+
};
|
|
51
|
+
var clearOsPlatformListCache = (fetcher) => {
|
|
52
|
+
if (fetcher) {
|
|
53
|
+
cacheMap.delete(fetcher);
|
|
54
|
+
} else {
|
|
55
|
+
cacheMap.clear();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var useOsPlatformList = (fetcher) => {
|
|
59
|
+
const [osPlatformList, setOsPlatformList] = (0, import_react.useState)(() => {
|
|
60
|
+
var _a;
|
|
61
|
+
return (_a = cacheMap.get(fetcher)) == null ? void 0 : _a.data;
|
|
62
|
+
});
|
|
63
|
+
(0, import_react.useEffect)(() => {
|
|
64
|
+
var _a;
|
|
65
|
+
const cached = (_a = cacheMap.get(fetcher)) == null ? void 0 : _a.data;
|
|
66
|
+
if (cached) {
|
|
67
|
+
setOsPlatformList(cached);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
let mounted = true;
|
|
71
|
+
fetchOsPlatformList(fetcher).then((data) => {
|
|
72
|
+
if (mounted && data)
|
|
73
|
+
setOsPlatformList(data);
|
|
74
|
+
});
|
|
75
|
+
return () => {
|
|
76
|
+
mounted = false;
|
|
77
|
+
};
|
|
78
|
+
}, [fetcher]);
|
|
79
|
+
return {
|
|
80
|
+
osPlatformList
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
var useOsPlatformList_default = useOsPlatformList;
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
clearOsPlatformListCache,
|
|
87
|
+
useOsPlatformList
|
|
88
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PaginationProps } from 'tdesign-react';
|
|
3
|
+
/** 分页内部状态 */
|
|
4
|
+
export interface PaginationData {
|
|
5
|
+
/** 当前页码(从 1 开始) */
|
|
6
|
+
currentPage: number;
|
|
7
|
+
/** 数据总条数 */
|
|
8
|
+
totalCount: number;
|
|
9
|
+
/** 总页数 */
|
|
10
|
+
totalPage: number;
|
|
11
|
+
/** 每页条数 */
|
|
12
|
+
pageSize: number;
|
|
13
|
+
}
|
|
14
|
+
/** 分页变化时回传给外部请求的参数 */
|
|
15
|
+
export interface PaginationRequestParams {
|
|
16
|
+
/** 页码(从 1 开始) */
|
|
17
|
+
pageNumber: number;
|
|
18
|
+
/** 每页条数 */
|
|
19
|
+
pageSize: number;
|
|
20
|
+
}
|
|
21
|
+
/** 分页变化回调 */
|
|
22
|
+
export type OnPaginationRequest = (params: PaginationRequestParams) => void;
|
|
23
|
+
/**
|
|
24
|
+
* 分页 Hook(L3 业务 Hook)
|
|
25
|
+
*
|
|
26
|
+
* 维护分页状态,并在页码 / 每页条数变化时通过 onPaginationRequest 回调通知外部发起请求。
|
|
27
|
+
* 请求完成后由外部调用 setPaginationData 回写最新分页数据。
|
|
28
|
+
*
|
|
29
|
+
* 特性:
|
|
30
|
+
* - totalCount 为 0 时 paginationProps 返回 undefined,可直接透传给 tdesign-react 的 Pagination 组件(不渲染分页器);
|
|
31
|
+
* - 切换每页条数时自动回到第 1 页;
|
|
32
|
+
* - 返回的 paginationProps 可直接展开到 <Pagination {...paginationProps} />。
|
|
33
|
+
*
|
|
34
|
+
* @param onPaginationRequest 页码或每页条数变化时的回调,外部在此发起列表请求
|
|
35
|
+
* @returns paginationData 分页数据;setPaginationData 回写分页数据;paginationProps tdesign-react Pagination 组件属性(totalCount 为 0 时为 undefined)
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* import { Pagination } from 'tdesign-react';
|
|
40
|
+
* import { usePagination } from '@pnt/business-components';
|
|
41
|
+
*
|
|
42
|
+
* const Demo = () => {
|
|
43
|
+
* const [list, setList] = useState<Item[]>([]);
|
|
44
|
+
* const { paginationData, setPaginationData, paginationProps } = usePagination(
|
|
45
|
+
* async ({ pageNumber, pageSize }) => {
|
|
46
|
+
* const res = await fetchList({ page: pageNumber, size: pageSize });
|
|
47
|
+
* setList(res.data.list);
|
|
48
|
+
* setPaginationData((prev) => ({
|
|
49
|
+
* ...prev,
|
|
50
|
+
* currentPage: pageNumber,
|
|
51
|
+
* pageSize,
|
|
52
|
+
* totalCount: res.data.total,
|
|
53
|
+
* totalPage: Math.ceil(res.data.total / pageSize),
|
|
54
|
+
* }));
|
|
55
|
+
* },
|
|
56
|
+
* );
|
|
57
|
+
*
|
|
58
|
+
* return (
|
|
59
|
+
* <>
|
|
60
|
+
* <Table data={list} />
|
|
61
|
+
* {paginationProps && <Pagination {...paginationProps} />}
|
|
62
|
+
* </>
|
|
63
|
+
* );
|
|
64
|
+
* };
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare const usePagination: (onPaginationRequest: OnPaginationRequest) => {
|
|
68
|
+
paginationData: PaginationData;
|
|
69
|
+
setPaginationData: import("react").Dispatch<import("react").SetStateAction<PaginationData>>;
|
|
70
|
+
paginationProps: PaginationProps | undefined;
|
|
71
|
+
};
|
|
72
|
+
export default usePagination;
|
|
@@ -0,0 +1,71 @@
|
|
|
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/hooks/usePagination.ts
|
|
20
|
+
var usePagination_exports = {};
|
|
21
|
+
__export(usePagination_exports, {
|
|
22
|
+
default: () => usePagination_default,
|
|
23
|
+
usePagination: () => usePagination
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(usePagination_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var usePagination = (onPaginationRequest) => {
|
|
28
|
+
const [paginationData, setPaginationData] = (0, import_react.useState)({
|
|
29
|
+
currentPage: 1,
|
|
30
|
+
totalCount: 0,
|
|
31
|
+
totalPage: 0,
|
|
32
|
+
pageSize: 10
|
|
33
|
+
});
|
|
34
|
+
const handleCurrentChange = (0, import_react.useCallback)(
|
|
35
|
+
(current, pageInfo) => {
|
|
36
|
+
onPaginationRequest({
|
|
37
|
+
pageNumber: current,
|
|
38
|
+
pageSize: pageInfo.pageSize
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
[onPaginationRequest]
|
|
42
|
+
);
|
|
43
|
+
const handlePageSizeChange = (0, import_react.useCallback)(
|
|
44
|
+
(pageSize) => {
|
|
45
|
+
onPaginationRequest({ pageNumber: 1, pageSize });
|
|
46
|
+
},
|
|
47
|
+
[onPaginationRequest]
|
|
48
|
+
);
|
|
49
|
+
const paginationProps = (0, import_react.useMemo)(() => {
|
|
50
|
+
if (paginationData.totalCount === 0)
|
|
51
|
+
return void 0;
|
|
52
|
+
return {
|
|
53
|
+
pageSizeOptions: [10, 20, 30, 50, 100],
|
|
54
|
+
pageSize: paginationData.pageSize,
|
|
55
|
+
current: paginationData.currentPage,
|
|
56
|
+
total: paginationData.totalCount,
|
|
57
|
+
onCurrentChange: handleCurrentChange,
|
|
58
|
+
onPageSizeChange: handlePageSizeChange
|
|
59
|
+
};
|
|
60
|
+
}, [paginationData, handleCurrentChange, handlePageSizeChange]);
|
|
61
|
+
return {
|
|
62
|
+
paginationData,
|
|
63
|
+
setPaginationData,
|
|
64
|
+
paginationProps
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
var usePagination_default = usePagination;
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
usePagination
|
|
71
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as PntCopyData } from './components/PntCopyData';
|
|
2
|
+
export { default as PntImagePreview } from './components/PntImagePreview';
|
|
3
|
+
export { default as PntSecureBox } from './components/PntSecureBox';
|
|
4
|
+
export { default as useBtnPermission } from './hooks/useBtnPermission';
|
|
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';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const SUB_APP_PATHNAME: {
|
|
2
|
+
ACCOUNT: string;
|
|
3
|
+
SDK: string;
|
|
4
|
+
NOTICE: string;
|
|
5
|
+
CONFIGFROM: string;
|
|
6
|
+
CONFIGTHEME: string;
|
|
7
|
+
REVIEWLIST: string;
|
|
8
|
+
INTERNALTOOLS: string;
|
|
9
|
+
REPORTS: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const AUDIENCE_MAPPING: {
|
|
12
|
+
[x: string]: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
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/utils/const.ts
|
|
20
|
+
var const_exports = {};
|
|
21
|
+
__export(const_exports, {
|
|
22
|
+
AUDIENCE_MAPPING: () => AUDIENCE_MAPPING,
|
|
23
|
+
SUB_APP_PATHNAME: () => SUB_APP_PATHNAME
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(const_exports);
|
|
26
|
+
var SUB_APP_PATHNAME = {
|
|
27
|
+
ACCOUNT: "/laas",
|
|
28
|
+
SDK: "/intlsdk",
|
|
29
|
+
NOTICE: "/notice",
|
|
30
|
+
CONFIGFROM: "/configform",
|
|
31
|
+
CONFIGTHEME: "/configtheme",
|
|
32
|
+
REVIEWLIST: "/approvalservices",
|
|
33
|
+
INTERNALTOOLS: "/internaltools",
|
|
34
|
+
REPORTS: "/reports"
|
|
35
|
+
};
|
|
36
|
+
var audienceSuffix = "-pnt";
|
|
37
|
+
var AUDIENCE_MAPPING = {
|
|
38
|
+
[SUB_APP_PATHNAME.ACCOUNT]: `/laas${audienceSuffix}`,
|
|
39
|
+
[SUB_APP_PATHNAME.SDK]: `/intl-sdk${audienceSuffix}`,
|
|
40
|
+
[SUB_APP_PATHNAME.NOTICE]: `/notice${audienceSuffix}`,
|
|
41
|
+
[SUB_APP_PATHNAME.CONFIGFROM]: `/configform${audienceSuffix}`,
|
|
42
|
+
[SUB_APP_PATHNAME.CONFIGTHEME]: `/configtheme${audienceSuffix}`,
|
|
43
|
+
[SUB_APP_PATHNAME.REVIEWLIST]: `/approval-services${audienceSuffix}`,
|
|
44
|
+
[SUB_APP_PATHNAME.INTERNALTOOLS]: `/internaltools${audienceSuffix}`,
|
|
45
|
+
[SUB_APP_PATHNAME.REPORTS]: `/reports${audienceSuffix}`
|
|
46
|
+
};
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
AUDIENCE_MAPPING,
|
|
50
|
+
SUB_APP_PATHNAME
|
|
51
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
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/utils/index.ts
|
|
20
|
+
var utils_exports = {};
|
|
21
|
+
__export(utils_exports, {
|
|
22
|
+
isSecurityData: () => isSecurityData
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(utils_exports);
|
|
25
|
+
var isSecurityData = (val) => {
|
|
26
|
+
const str = String(val);
|
|
27
|
+
if (!str.includes("_high_security_:"))
|
|
28
|
+
return false;
|
|
29
|
+
const rsp = str.split(":");
|
|
30
|
+
const calcStr = rsp.slice(0, -1).join(":");
|
|
31
|
+
const calcNum = parseInt(rsp[rsp.length - 1], 10);
|
|
32
|
+
if (isNaN(calcNum))
|
|
33
|
+
return false;
|
|
34
|
+
let num = 0;
|
|
35
|
+
for (const item of calcStr) {
|
|
36
|
+
num += item.charCodeAt(0);
|
|
37
|
+
}
|
|
38
|
+
return num === calcNum;
|
|
39
|
+
};
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
isSecurityData
|
|
43
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
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/utils/request.ts
|
|
30
|
+
var request_exports = {};
|
|
31
|
+
__export(request_exports, {
|
|
32
|
+
default: () => request_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(request_exports);
|
|
35
|
+
var import_axios = __toESM(require("axios"));
|
|
36
|
+
var import_host = __toESM(require("../configs/host"));
|
|
37
|
+
var import_token = __toESM(require("../configs/token"));
|
|
38
|
+
var import_const = require("./const");
|
|
39
|
+
var env = process.env.MODE || "development";
|
|
40
|
+
var API_HOST = import_host.default[env].API;
|
|
41
|
+
var http = import_axios.default.create({
|
|
42
|
+
baseURL: API_HOST,
|
|
43
|
+
timeout: 100 * 1e3,
|
|
44
|
+
withCredentials: true
|
|
45
|
+
});
|
|
46
|
+
http.interceptors.request.use(
|
|
47
|
+
(config) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const conf = { ...config };
|
|
50
|
+
const matchPath = Object.values(import_const.SUB_APP_PATHNAME).filter(
|
|
51
|
+
(path) => window.location.pathname.includes(path)
|
|
52
|
+
)[0] || "";
|
|
53
|
+
if (process.env.NODE_ENV === "development") {
|
|
54
|
+
conf.baseURL = matchPath ? "/subapi" : conf.baseURL;
|
|
55
|
+
conf.headers["X-Service-Type"] = ((_a = conf.headers) == null ? void 0 : _a["x-service-type"]) || "11";
|
|
56
|
+
conf.headers["X-User-Id"] = "us-104fe9b46fdf4534be663ec9eaa9ea2e";
|
|
57
|
+
conf.headers["X-User-Name"] = "v_bwweiwang";
|
|
58
|
+
conf.headers.authorization = import_token.default;
|
|
59
|
+
} else {
|
|
60
|
+
conf.baseURL = "/";
|
|
61
|
+
}
|
|
62
|
+
if (!conf.url.includes("audience=")) {
|
|
63
|
+
conf.url = `${conf.url}?audience=${matchPath ? import_const.AUDIENCE_MAPPING[matchPath] : "/player-network"}`;
|
|
64
|
+
}
|
|
65
|
+
return conf;
|
|
66
|
+
},
|
|
67
|
+
(err) => Promise.reject(err)
|
|
68
|
+
);
|
|
69
|
+
http.interceptors.response.use(
|
|
70
|
+
(response) => {
|
|
71
|
+
if (response.status === 200) {
|
|
72
|
+
const { data } = response;
|
|
73
|
+
if (data.code === 0) {
|
|
74
|
+
return Promise.resolve(data);
|
|
75
|
+
}
|
|
76
|
+
return Promise.resolve(data);
|
|
77
|
+
}
|
|
78
|
+
return Promise.reject(response == null ? void 0 : response.data);
|
|
79
|
+
},
|
|
80
|
+
(e) => Promise.reject(e)
|
|
81
|
+
);
|
|
82
|
+
var request_default = http;
|