@pnt-team/pnt-component-frontend 0.0.72 → 0.0.73

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.
@@ -0,0 +1,15 @@
1
+ import type { commonEesType } from "../config";
2
+ import type { AxiosInstance } from 'axios';
3
+ import { BusinessGameInfoHighSecurityDecryptBody, BusinessGameInfoHighSecurityDecryptResponse, BusinessSelectListBody, BusinessSelectListResponse } from './types/index';
4
+ /**
5
+ * 业务下拉选择列表
6
+ * @param http 由 PntProvider 注入的 axios 实例
7
+ * @param data 请求参数
8
+ */
9
+ export declare const businessSelectList: (axios: AxiosInstance, data: BusinessSelectListBody) => Promise<commonEesType<BusinessSelectListResponse>>;
10
+ /**
11
+ * 高敏信息解锁
12
+ * @param http 由 PntProvider 注入的 axios 实例
13
+ * @param data 请求参数
14
+ */
15
+ export declare const businessGameInfoHighSecurityDecrypt: (axios: AxiosInstance, data: BusinessGameInfoHighSecurityDecryptBody) => Promise<commonEesType<BusinessGameInfoHighSecurityDecryptResponse>>;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * 本文件由 yapi-gen 自动生成,请勿手动修改
3
+ * 生成时间: 2026/9/10 11:19:01
4
+ * 数据来源: https://api-pnt.intlgame.com
5
+ */
6
+ export interface BusinessSelectListBody {
7
+ /** 业务接入类型:1-纯SDK,2-LI PASS,3-工作室品牌账号 */
8
+ business_access_method?: number;
9
+ /** 业务类型列表:1-正式业务,2-测试业务;SmartLink业务始终不返回 */
10
+ business_types?: number[];
11
+ /** 需要返回的字段;未传时使用场景默认字段,仅支持服务端白名单字段 */
12
+ fields?: string[];
13
+ /** 指定业务ID列表;与 Keyword 同时传入时取交集 */
14
+ game_ids?: string[];
15
+ /** 业务ID、中文名称或英文名称的模糊匹配关键字 */
16
+ keyword?: string;
17
+ /** 当前页 */
18
+ pageNum?: number;
19
+ /** 每页条数 */
20
+ pageSize?: number;
21
+ /** 下拉场景:default-通用业务,sdk-SDK定制,compliance_age-合规年龄,custom_region-自定义合规地域 */
22
+ scene?: string;
23
+ /** 业务状态列表:3-线上运营,4-接入中,5-中途结项,6-已下线 */
24
+ statuses?: number[];
25
+ /** 总条数 */
26
+ total?: number;
27
+ /** 总页数 */
28
+ totalPage?: number;
29
+ }
30
+ export interface BusinessSelectListResponseListItem {
31
+ /** 业务接入类型:1-纯SDK,2-LI PASS,3-工作室品牌账号 */
32
+ business_access_method?: number;
33
+ /** 业务类型:1-正式业务,2-测试业务 */
34
+ business_type?: number;
35
+ /** 当前场景是否可创建;仅 compliance_age、custom_region 场景有意义 */
36
+ creatable?: boolean;
37
+ /** 业务ID */
38
+ game_id?: string;
39
+ /** 业务接口开发负责人;SDK场景可返回 */
40
+ interface_developer_name?: string;
41
+ /** 业务中文名称 */
42
+ name?: string;
43
+ /** 业务英文名称 */
44
+ name_en?: string;
45
+ /** SDK定制版本通知人;SDK场景可返回 */
46
+ sdk_customize_notifier?: string;
47
+ /** 业务状态:3-线上运营,4-接入中,5-中途结项,6-已下线 */
48
+ state?: number;
49
+ }
50
+ export interface BusinessSelectListResponsePagination {
51
+ /** 当前页 */
52
+ pageNum?: number;
53
+ /** 每页条数 */
54
+ pageSize?: number;
55
+ /** 总条数 */
56
+ total?: number;
57
+ /** 总页数 */
58
+ totalPage?: number;
59
+ }
60
+ export interface BusinessSelectListResponse {
61
+ /** 业务列表;字段由请求 Fields 或场景默认字段决定 */
62
+ list?: BusinessSelectListResponseListItem[];
63
+ /** 分页信息;未分页时统计字段均为零值 */
64
+ pagination?: BusinessSelectListResponsePagination;
65
+ }
66
+ export interface BusinessGameInfoHighSecurityDecryptBodyParamItem {
67
+ /** 参数字段 */
68
+ key: string;
69
+ /** 参数密文 */
70
+ value: string;
71
+ }
72
+ export interface BusinessGameInfoHighSecurityDecryptBody {
73
+ param: BusinessGameInfoHighSecurityDecryptBodyParamItem[];
74
+ /** 页面ID */
75
+ page_id: string;
76
+ /** 请求环境 */
77
+ env: number;
78
+ game_id: number;
79
+ }
80
+ export type BusinessGameInfoHighSecurityDecryptResponse = Record<string, unknown>[];
@@ -0,0 +1,191 @@
1
+ import type { BusinessSelectListResponseListItem } from "../../api/types";
2
+ import React, { FC } from 'react';
3
+ import type { SelectValue, TdSelectProps } from 'tdesign-react/es/select/type';
4
+ import './index.scss';
5
+ /** 下拉场景 */
6
+ type Scene = 'default' | 'sdk' | 'compliance_age' | 'custom_region';
7
+ /** 标签格式 */
8
+ type LabelFormat = 'name' | 'name_en' | 'name_id' | 'name_en_id';
9
+ interface PntBusinessSelectProps {
10
+ /**
11
+ * 当前选中值
12
+ * @description 单选为 string,多选为 string[]
13
+ */
14
+ value?: SelectValue;
15
+ /**
16
+ * 值变化回调
17
+ */
18
+ onChange?: TdSelectProps['onChange'];
19
+ /**
20
+ * 是否多选
21
+ * @default false
22
+ */
23
+ multiple?: boolean;
24
+ /**
25
+ * 下拉场景
26
+ * @description 后端按场景返回默认字段集
27
+ * @default 'default'
28
+ */
29
+ scene?: Scene;
30
+ /**
31
+ * 业务状态筛选
32
+ * @description 3-线上运营,4-接入中,5-中途结项,6-已下线
33
+ */
34
+ statuses?: number[];
35
+ /**
36
+ * 业务类型筛选
37
+ * @description 1-正式业务,2-测试业务
38
+ */
39
+ businessTypes?: number[];
40
+ /**
41
+ * 业务接入类型筛选
42
+ * @description 1-纯SDK,2-LI PASS,3-工作室品牌账号
43
+ */
44
+ businessAccessMethod?: number;
45
+ /**
46
+ * 标签格式
47
+ * @description name-中文名,name_en-英文名,name_id-中文名(ID),name_en_id-英文名(ID)
48
+ * @default 'name'
49
+ */
50
+ labelFormat?: LabelFormat;
51
+ /**
52
+ * 占位提示文案
53
+ */
54
+ placeholder?: string;
55
+ /**
56
+ * 是否禁用整个选择器
57
+ * @default false
58
+ */
59
+ disabled?: boolean;
60
+ /**
61
+ * 是否可清除
62
+ * @default true
63
+ */
64
+ clearable?: boolean;
65
+ /**
66
+ * 是否可远程搜索
67
+ * @default true
68
+ */
69
+ filterable?: boolean;
70
+ /**
71
+ * 多选时最大可选数量
72
+ */
73
+ max?: number;
74
+ /**
75
+ * 每页条数
76
+ * @default 20
77
+ */
78
+ pageSize?: number;
79
+ /**
80
+ * 搜索防抖延迟(毫秒)
81
+ * @default 400
82
+ */
83
+ searchDebounce?: number;
84
+ /**
85
+ * 多选时最少折叠数量
86
+ * @description 超过此数量的选中项将折叠显示,透传至 TDesign Select
87
+ */
88
+ minCollapsedNum?: number;
89
+ /**
90
+ * 折叠项自定义渲染
91
+ * @description 透传至 TDesign Select collapsedItems
92
+ */
93
+ collapsedItems?: TdSelectProps['collapsedItems'];
94
+ /**
95
+ * 弹层属性透传
96
+ * @description 会与组件内部 onScrollToBottom 合并;常用 attach(挂载容器)、overlayClassName 等
97
+ */
98
+ popupProps?: Partial<TdSelectProps['popupProps']>;
99
+ /**
100
+ * 字段白名单
101
+ * @description 传给后端 fields 参数,指定返回字段;未传时后端按 scene 返回默认字段
102
+ */
103
+ fields?: string[];
104
+ /**
105
+ * 自定义 label 字段
106
+ * @description 从响应项的指定字段取 label;默认按 labelFormat 渲染
107
+ * 常用于消费方接口返回字段不是标准 name/name_en 的场景(如 game_name)
108
+ */
109
+ labelField?: string;
110
+ /**
111
+ * 自定义选项 label 渲染
112
+ * @description 返回 ReactNode 作为选项内容;优先级高于 labelFormat/labelField
113
+ * 常用于需要 ellipsis/样式包裹的场景
114
+ */
115
+ optionLabel?: (item: BusinessSelectListResponseListItem) => React.ReactNode;
116
+ /**
117
+ * 是否分页
118
+ * @description false 时一次性加载所有数据(pageNum=1, pageSize=0),不分页不远程搜索
119
+ * @default true
120
+ */
121
+ pagination?: boolean;
122
+ /**
123
+ * 自定义选项禁用逻辑
124
+ * @description 返回 true 时该选项禁用;与合规场景的 creatable 判断叠加(任一为 true 即禁用)
125
+ */
126
+ optionDisabled?: (item: BusinessSelectListResponseListItem) => boolean;
127
+ /**
128
+ * 自定义选项 tooltip 内容
129
+ * @description 返回非空字符串时该选项悬停显示 tooltip;常用于解释禁用原因
130
+ */
131
+ optionTooltip?: (item: BusinessSelectListResponseListItem) => string;
132
+ /**
133
+ * tooltip 位置
134
+ * @default 'top'
135
+ */
136
+ tooltipPlacement?: 'top' | 'bottom' | 'left' | 'right';
137
+ /**
138
+ * 自定义类名
139
+ */
140
+ className?: string;
141
+ /**
142
+ * 自定义样式
143
+ */
144
+ style?: React.CSSProperties;
145
+ }
146
+ /**
147
+ * 业务选择器组件
148
+ * @description 统一业务下拉选择器,内置对接后端通用接口 `/api/business/select/list`,
149
+ * 支持远程搜索、滚动分页加载、多选、场景化禁用(合规场景 creatable 字段)。
150
+ *
151
+ * @param {PntBusinessSelectProps} props - 组件属性
152
+ *
153
+ * @example
154
+ * ```tsx
155
+ * import { PntBusinessSelect } from '@pnt-team/pnt-component-frontend';
156
+ *
157
+ * // 最简用法
158
+ * <PntBusinessSelect
159
+ * value={gameId}
160
+ * onChange={(v) => setGameId(v as string)}
161
+ * />
162
+ *
163
+ * // SDK 定制场景 + 名称带 ID
164
+ * <PntBusinessSelect
165
+ * scene="sdk"
166
+ * labelFormat="name_id"
167
+ * value={gameId}
168
+ * onChange={(v) => setGameId(v as string)}
169
+ * />
170
+ *
171
+ * // 合规年龄场景(自动禁用 creatable=false 的业务)
172
+ * <PntBusinessSelect
173
+ * scene="compliance_age"
174
+ * value={gameId}
175
+ * onChange={(v) => setGameId(v as string)}
176
+ * />
177
+ *
178
+ * // 多选 + 状态过滤
179
+ * <PntBusinessSelect
180
+ * multiple
181
+ * statuses={[3, 4]}
182
+ * labelFormat="name_id"
183
+ * value={gameIds}
184
+ * onChange={(v) => setGameIds(v as string[])}
185
+ * />
186
+ * ```
187
+ *
188
+ * @returns {ReactElement} 业务选择器组件
189
+ */
190
+ declare const PntBusinessSelect: FC<PntBusinessSelectProps>;
191
+ export default PntBusinessSelect;
@@ -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
+ * 通用页面布局组件(L3 布局组件)
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,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,73 @@
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
+ * 通过 PntProvider 注入 http 实例,对接 `/api/v3/business/game_info/high-security-decrypt`。
46
+ *
47
+ * @param {PntSecureBoxProps} props - 组件属性
48
+ * @param {string} props.dataKey - 高敏信息的唯一标识 key
49
+ * @param {string} props.dataValue - 高敏信息的实际值
50
+ * @param {string | number} props.env - 环境标识
51
+ * @param {string | number} props.gameId - 游戏 ID
52
+ * @param {(content: string) => React.ReactNode} props.renderDom - 自定义渲染函数
53
+ * @param {string} [props.viewText] - 自定义查看按钮文案
54
+ * @param {string} [props.pageId] - 页面 ID
55
+ *
56
+ * @example
57
+ * ```tsx
58
+ * import { PntSecureBox } from '@pnt-team/pnt-component-frontend';
59
+ *
60
+ * <PntSecureBox
61
+ * dataKey="userPhone"
62
+ * dataValue="_high_security_:AAAA...:6542"
63
+ * env={2}
64
+ * gameId={12345}
65
+ * renderDom={(content) => <span>{content}</span>}
66
+ * viewText="查看"
67
+ * />
68
+ * ```
69
+ *
70
+ * @returns {ReactElement} 高敏信息展示组件
71
+ */
72
+ declare const PntSecureBox: FC<PntSecureBoxProps>;
73
+ export default PntSecureBox;
@@ -0,0 +1,36 @@
1
+ /// <reference types="react" />
2
+ import type { AxiosInstance } from 'axios';
3
+ /**
4
+ * 统一响应结构(与后端 commonEesType 对齐)
5
+ */
6
+ export interface commonEesType<T> {
7
+ code: number;
8
+ msg: string;
9
+ data: T;
10
+ ret?: number;
11
+ }
12
+ /**
13
+ * 组件库运行时配置:由消费方通过 PntProvider 注入
14
+ */
15
+ export interface PntConfig {
16
+ /** 消费方已配置好的 axios 实例(含拦截器、鉴权、baseURL 等) */
17
+ http: AxiosInstance;
18
+ }
19
+ /**
20
+ * 配置 Provider:消费方在应用根入口包裹一次即可
21
+ * @example
22
+ * ```tsx
23
+ * import { PntProvider } from '@pnt-team/pnt-component-frontend';
24
+ * import http from './utils/request';
25
+ *
26
+ * <PntProvider value={{ http }}>
27
+ * <App />
28
+ * </PntProvider>
29
+ * ```
30
+ */
31
+ export declare const PntProvider: import("react").Provider<PntConfig | null>;
32
+ /**
33
+ * 获取组件库运行时配置(内部使用)
34
+ * @internal
35
+ */
36
+ export declare const usePntConfig: () => PntConfig;
@@ -0,0 +1,22 @@
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
+ /**
16
+ * 高敏数据解锁 Hook(PntSecureBox 内部依赖)
17
+ * @internal 不对外导出,归 PntSecureBox 组件内部使用
18
+ */
19
+ export declare const useHighSecurity: () => {
20
+ securityData: Record<string, string>;
21
+ requestSecurityData: ({ gameId, param, env, pageId, }: HighSecurityRequestParams) => Promise<void>;
22
+ };
@@ -0,0 +1,5 @@
1
+ export { PntProvider, usePntConfig, type PntConfig, type commonEesType, } from './config';
2
+ export { default as PntImagePreview } from './components/PntImagePreview';
3
+ export { default as PntBusinessSelect } from './components/PntBusinessSelect';
4
+ export { default as PntSecureBox } from './components/PntSecureBox';
5
+ export { default as PntGeneralLayout } from './components/PntGeneralLayout';
@@ -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,6 @@
1
+ /**
2
+ * 判断是否是高敏信息逻辑
3
+ * @param {*} val
4
+ * @returns
5
+ */
6
+ export declare const isSecurityData: (val: string | number) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnt-team/pnt-component-frontend",
3
- "version": "0.0.72",
3
+ "version": "0.0.73",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "exports": {