@pnt-team/pnt-component-frontend 0.0.73 → 0.0.75
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/README.md +51 -10
- package/lib/cjs/components/PntBusinessSelect/index.js +5 -0
- package/lib/cjs/components/PntBusinessSelect/index.scss +19 -0
- package/lib/esm/api/index.js +13 -10
- package/lib/esm/api/types/index.js +1 -0
- package/lib/esm/components/PntBusinessSelect/index.js +252 -195
- package/lib/esm/components/PntBusinessSelect/index.scss +19 -0
- package/lib/esm/components/PntGeneralLayout/index.js +74 -40
- package/lib/esm/components/PntImagePreview/index.js +111 -59
- package/lib/esm/components/PntSecureBox/index.js +63 -26
- package/lib/esm/config.js +33 -13
- package/lib/esm/hooks/useHighSecurity.js +29 -25
- package/lib/esm/index.js +18 -17
- package/lib/esm/utils/const.js +14 -17
- package/lib/esm/utils/index.js +15 -12
- package/lib/umd/pnt-component-frontend.min.css +1 -1
- package/lib/umd/pnt-component-frontend.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,11 +22,23 @@ yarn add @pnt-team/pnt-component-frontend
|
|
|
22
22
|
|
|
23
23
|
## 快速开始
|
|
24
24
|
|
|
25
|
+
使用前需在应用根入口用 `PntProvider` 注入 http 实例(消费方已配置好的 axios):
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { PntProvider } from '@pnt-team/pnt-component-frontend';
|
|
29
|
+
import http from '你的项目中的 axios 实例';
|
|
30
|
+
|
|
31
|
+
<PntProvider value={{ http }}>
|
|
32
|
+
<App />
|
|
33
|
+
</PntProvider>;
|
|
34
|
+
```
|
|
35
|
+
|
|
25
36
|
```tsx
|
|
26
37
|
import {
|
|
27
38
|
// L1 基础展示组件
|
|
28
39
|
PntImagePreview,
|
|
29
40
|
// L2 业务复合组件
|
|
41
|
+
PntBusinessSelect,
|
|
30
42
|
PntSecureBox,
|
|
31
43
|
// L3 布局组件
|
|
32
44
|
PntGeneralLayout,
|
|
@@ -67,9 +79,45 @@ import {
|
|
|
67
79
|
|
|
68
80
|
### L2 业务复合组件
|
|
69
81
|
|
|
82
|
+
#### PntBusinessSelect — 业务选择器组件
|
|
83
|
+
|
|
84
|
+
统一业务下拉选择器,内置对接后端通用接口 `/api/business/select/list`,支持远程搜索、滚动分页加载、多选、场景化禁用。
|
|
85
|
+
|
|
86
|
+
**Props:**
|
|
87
|
+
|
|
88
|
+
| 属性 | 类型 | 必填 | 默认值 | 说明 |
|
|
89
|
+
| ------------- | ----------------------------------------------------------- | :--: | ----------- | -------------- |
|
|
90
|
+
| `value` | `SelectValue` | ❌ | - | 当前选中值 |
|
|
91
|
+
| `onChange` | `TdSelectProps['onChange']` | ❌ | - | 值变化回调 |
|
|
92
|
+
| `multiple` | `boolean` | ❌ | `false` | 是否多选 |
|
|
93
|
+
| `scene` | `'default' \| 'sdk' \| 'compliance_age' \| 'custom_region'` | ❌ | `'default'` | 下拉场景 |
|
|
94
|
+
| `statuses` | `number[]` | ❌ | - | 业务状态筛选 |
|
|
95
|
+
| `labelFormat` | `'name' \| 'name_en' \| 'name_id' \| 'name_en_id'` | ❌ | `'name'` | 标签格式 |
|
|
96
|
+
| `filterable` | `boolean` | ❌ | `true` | 是否可远程搜索 |
|
|
97
|
+
| `pagination` | `boolean` | ❌ | `true` | 是否分页 |
|
|
98
|
+
| `placeholder` | `string` | ❌ | - | 占位提示文案 |
|
|
99
|
+
| `disabled` | `boolean` | ❌ | `false` | 是否禁用 |
|
|
100
|
+
| `popupProps` | `Partial<TdSelectProps['popupProps']>` | ❌ | - | 弹层属性透传 |
|
|
101
|
+
|
|
102
|
+
**示例:**
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import { PntBusinessSelect } from '@pnt-team/pnt-component-frontend';
|
|
106
|
+
|
|
107
|
+
<PntBusinessSelect
|
|
108
|
+
scene="compliance_age"
|
|
109
|
+
labelFormat="name_id"
|
|
110
|
+
placeholder="请选择业务"
|
|
111
|
+
value={gameId}
|
|
112
|
+
onChange={(v) => setGameId(v as string)}
|
|
113
|
+
/>;
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
70
118
|
#### PntSecureBox — 高敏信息展示组件
|
|
71
119
|
|
|
72
|
-
|
|
120
|
+
统一处理和展示高敏信息,支持脱敏显示和按需获取真实数据。通过 `PntProvider` 注入的 http 实例请求解锁敏感数据。
|
|
73
121
|
|
|
74
122
|
**Props:**
|
|
75
123
|
|
|
@@ -80,26 +128,19 @@ import {
|
|
|
80
128
|
| `env` | `string \| number` | ✅ | 环境标识(如 dev / test / production) |
|
|
81
129
|
| `gameId` | `string \| number` | ✅ | 游戏 ID |
|
|
82
130
|
| `renderDom` | `(content: string) => React.ReactNode` | ✅ | 自定义渲染函数 |
|
|
83
|
-
| `fetcher` | `HighSecurityFetcher` | ✅ | 高敏数据请求函数(外部注入) |
|
|
84
131
|
| `viewText` | `string` | ❌ | 查看按钮文案,默认 `'View'` |
|
|
85
132
|
| `pageId` | `string` | ❌ | 页面 ID(用于操作日志和权限验证) |
|
|
86
133
|
|
|
87
134
|
**示例:**
|
|
88
135
|
|
|
89
136
|
```tsx
|
|
90
|
-
import http from '@/utils/request';
|
|
91
137
|
import { PntSecureBox } from '@pnt-team/pnt-component-frontend';
|
|
92
138
|
|
|
93
139
|
<PntSecureBox
|
|
94
140
|
dataKey="userPhone"
|
|
95
|
-
dataValue="
|
|
96
|
-
env=
|
|
141
|
+
dataValue="_high_security_:AAAA...:6542"
|
|
142
|
+
env={2}
|
|
97
143
|
gameId={12345}
|
|
98
|
-
fetcher={(params) =>
|
|
99
|
-
http
|
|
100
|
-
.post('/api/v3/business/game_info/high-security-decrypt', params)
|
|
101
|
-
.then((r) => r.data)
|
|
102
|
-
}
|
|
103
144
|
renderDom={(content) => <span>{content}</span>}
|
|
104
145
|
viewText="查看"
|
|
105
146
|
/>;
|
|
@@ -273,6 +273,11 @@ var PntBusinessSelect = (props) => {
|
|
|
273
273
|
panelBottomContent: options.length > 0 && loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tdesign_react.Loading, { loading: true, size: "small" }) : null,
|
|
274
274
|
popupProps: {
|
|
275
275
|
...popupProps,
|
|
276
|
+
// 自动注入弹层样式类,消费方无需重复定义 overlayClassName
|
|
277
|
+
overlayClassName: [
|
|
278
|
+
"pnt-business-select-popup",
|
|
279
|
+
popupProps == null ? void 0 : popupProps.overlayClassName
|
|
280
|
+
].filter(Boolean).join(" "),
|
|
276
281
|
onScrollToBottom: enableScrollBottom ? handleScrollToBottom : void 0
|
|
277
282
|
},
|
|
278
283
|
className: className ? `pnt-business-select ${className}` : "pnt-business-select",
|
|
@@ -6,3 +6,22 @@
|
|
|
6
6
|
display: block;
|
|
7
7
|
width: 100%;
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
/* 弹层内容样式:loading / total-wrapper 统一高度与排版 */
|
|
11
|
+
.pnt-business-select-popup {
|
|
12
|
+
.t-popup__content {
|
|
13
|
+
.total-wrapper,
|
|
14
|
+
.t-loading {
|
|
15
|
+
height: 36px;
|
|
16
|
+
font-weight: 400;
|
|
17
|
+
line-height: 20px;
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
padding: 0 14px;
|
|
21
|
+
}
|
|
22
|
+
.total-wrapper {
|
|
23
|
+
color: #808191;
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
package/lib/esm/api/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 业务下拉选择列表
|
|
3
|
+
* @param http 由 PntProvider 注入的 axios 实例
|
|
4
|
+
* @param data 请求参数
|
|
5
|
+
*/
|
|
6
|
+
export const businessSelectList = (axios, data) => axios.post('/business/select/list?audience=/player-network', data);
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 高敏信息解锁
|
|
10
|
+
* @param http 由 PntProvider 注入的 axios 实例
|
|
11
|
+
* @param data 请求参数
|
|
12
|
+
*/
|
|
13
|
+
export const businessGameInfoHighSecurityDecrypt = (axios, data) => axios.post('/v3/business/game_info/high-security-decrypt?audience=/laas-pnt', data);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|