@yqg/permission 1.2.0 → 1.3.0-alpha.0
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 +50 -38
- package/dist/apply-modal-CpmDDWWV.js +12865 -0
- package/dist/category-selector-BQ0-kg3o.js +1275 -0
- package/dist/index-D_0ZQip-.js +2972 -0
- package/dist/index-wLkVeDMW.js +5040 -0
- package/dist/index.js +2 -2
- package/dist/permission-item-Df_aagL1.js +1266 -0
- package/dist/{yqg-permission-Bxzu3bMl.js → yqg-permission-BjVCs5lN.js} +3483 -3538
- package/dist/yqg-permission.umd.js +250 -0
- package/package.json +13 -3
- package/plugins/alioss.ts +237 -0
- package/src/App.vue +7 -8
- package/src/assets/category.png +0 -0
- package/src/axios/index.ts +6 -1
- package/src/components/apply-modal.vue +254 -157
- package/src/components/category-selector.vue +130 -0
- package/src/components/permission-item.vue +230 -0
- package/src/components/success-modal.vue +4 -4
- package/src/components/yqg-permission.vue +23 -110
- package/src/hooks/useAttributesCache.ts +21 -0
- package/src/hooks/useCategory.ts +21 -0
- package/src/hooks/useDragable.ts +9 -10
- package/src/hooks/useFormat.ts +50 -0
- package/src/hooks/useStatus.ts +82 -0
- package/src/i18n/zh-CH.ts +9 -2
- package/src/main.ts +2 -0
- package/src/typings/index.d.ts +40 -7
- package/src/utils/index.ts +9 -0
- package/src/yqg-permission/index.ts +13 -1
- package/vite.config.ts +18 -2
- package/dist/apply-modal-BBqMmKS2.js +0 -8742
- package/dist/checkbox-item-CFWhXmMU.js +0 -4991
- package/dist/index-BAGvIeoy.js +0 -6164
- package/dist/index.umd.cjs +0 -259
- package/dist_/345/211/257/346/234/254/apply-modal-Bgd3UWf-.js +0 -8739
- package/dist_/345/211/257/346/234/254/card.png +0 -0
- package/dist_/345/211/257/346/234/254/checkbox-item-DiIgFuBE.js +0 -4988
- package/dist_/345/211/257/346/234/254/dialog.png +0 -0
- package/dist_/345/211/257/346/234/254/image.png +0 -0
- package/dist_/345/211/257/346/234/254/index-CUS1Jydp.js +0 -6164
- package/dist_/345/211/257/346/234/254/index.js +0 -5
- package/dist_/345/211/257/346/234/254/index.umd.cjs +0 -259
- package/dist_/345/211/257/346/234/254/yqg-permission-ChMRXqi6.js +0 -14944
- package/src/assets/apply.png +0 -0
- package/src/components/checkbox-item.vue +0 -201
package/README.md
CHANGED
|
@@ -6,21 +6,20 @@
|
|
|
6
6
|

|
|
7
7
|

|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
### [Demo URL](https://crane-test.yangqianguan.com/role)
|
|
11
10
|
|
|
12
11
|
### [接入文档](https://wiki.fintopia.tech/pages/viewpage.action?pageId=117280979)
|
|
13
12
|
|
|
14
13
|
## Table of Contents
|
|
15
14
|
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
15
|
+
- [Installation](#installation)
|
|
16
|
+
- [Install with npm](#install-with-npm)
|
|
17
|
+
- [Use inline script directly](#use-inline-script-directly)
|
|
18
|
+
- [Usage](#usage)
|
|
19
|
+
- [Config](#config)
|
|
20
|
+
- [FAQ](#FAQ)
|
|
21
|
+
- [Browser Support](#browser-support)
|
|
22
|
+
- [Acknowledgement](#acknowledgement)
|
|
24
23
|
|
|
25
24
|
### Installation
|
|
26
25
|
|
|
@@ -42,25 +41,25 @@ $ yarn add @yqg/permission
|
|
|
42
41
|
$ pnpm install @yqg/permission
|
|
43
42
|
```
|
|
44
43
|
|
|
45
|
-
|
|
46
44
|
### Usage
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
方式一
|
|
47
|
+
|
|
48
|
+
step1: 在入口文件(main.js/index.js/app.ts/)引入@yag/permission,并调用 start 方法注册。
|
|
49
49
|
[See example](./src/main.ts)
|
|
50
50
|
|
|
51
51
|
```js
|
|
52
|
-
import yqgPermission from
|
|
52
|
+
import yqgPermission from "./yqg-permission";
|
|
53
53
|
yqgPermission.start();
|
|
54
54
|
//支持定义组件标签名,默认为‘<yqg-permission></yqg-permission>’
|
|
55
|
-
yqgPermission.start({tagName:
|
|
56
|
-
|
|
55
|
+
yqgPermission.start({ tagName: "my-element" });
|
|
57
56
|
```
|
|
58
57
|
|
|
59
58
|
step2: 像原生标签一样进行使用
|
|
60
59
|
[See example](./src/App.ts)
|
|
61
60
|
|
|
62
61
|
```js
|
|
63
|
-
<yqg-permission
|
|
62
|
+
<yqg-permission
|
|
64
63
|
workNumber="05184"
|
|
65
64
|
businessCode="PPDL"
|
|
66
65
|
:permissions="['permissionCode1, permissionCode2']"
|
|
@@ -71,31 +70,41 @@ step2: 像原生标签一样进行使用
|
|
|
71
70
|
</yqg-permission>
|
|
72
71
|
|
|
73
72
|
```
|
|
73
|
+
|
|
74
|
+
方式二
|
|
75
|
+
|
|
76
|
+
````html
|
|
77
|
+
<!-- 测试环境 -->
|
|
78
|
+
script src="https://static-ali-test.yangqianguan.com/cdn/yqg-feedback-sdk/1.2.1/feedback-sdk.umd.js"></script>`
|
|
79
|
+
|
|
80
|
+
<!-- 生产环境 -->
|
|
81
|
+
<script async src="https://static-ali.yangqianguan.com/cdn/yqg-feedback-sdk/1.2.1/feedback-sdk.umd.js" />
|
|
82
|
+
|
|
74
83
|
### 配置说明
|
|
75
84
|
|
|
76
85
|
支持自定义标签:yqgPermission.start({tagName: 'my-element'});
|
|
77
86
|
|
|
78
87
|
### yqg-permission 组件参数说明
|
|
79
88
|
|
|
80
|
-
| 参数项
|
|
81
|
-
|
|
|
82
|
-
| `work-number` |
|
|
83
|
-
| `business-code`
|
|
84
|
-
| `permissions` |
|
|
85
|
-
| `color` |
|
|
86
|
-
| `locale` |
|
|
87
|
-
| `success` |
|
|
88
|
-
| `type` |
|
|
89
|
-
| `top`
|
|
90
|
-
|
|
89
|
+
| 参数项 | 是否必传 | 说明 | 类型 | 默认值 |
|
|
90
|
+
| --------------- | ---------------- | ------------------------------- | ----------------- | ------- |
|
|
91
|
+
| `work-number` | 是 | 当前登陆人工号 | string | '' |
|
|
92
|
+
| `business-code` | 是 | 系统的权限 code | string | '' |
|
|
93
|
+
| `permissions` | 是 | 当前页面下所有权限点 | string[]或 string | [] |
|
|
94
|
+
| `color` | 否 | 主题色(同 antd) | string | #1677ff |
|
|
95
|
+
| `locale` | 否 | 当前语言类型(同 i18n) | string | zn-CH |
|
|
96
|
+
| `success` | 否 | 申请成功时回调函数(vue) | Function | ()=> {} |
|
|
97
|
+
| `type` | 否 | 组件类型 | string | default |
|
|
98
|
+
| `top` | 否 | 当组件 type=“dragElement”时生效 | string | 100px |
|
|
91
99
|
|
|
92
100
|
### type 参数说明
|
|
93
101
|
|
|
94
102
|
type = "default": 默认展示图+按钮组件,点击可弹出弹窗
|
|
95
103
|
type = "dragElement": 展示‘申请权限’文案,点击可弹出弹窗
|
|
96
|
-
type = "custom": 支持自定义组件,以slot的方式添加自定义组件,点击自定义组件可弹出弹窗,例如:
|
|
104
|
+
type = "custom": 支持自定义组件,以 slot 的方式添加自定义组件,点击自定义组件可弹出弹窗,例如:
|
|
105
|
+
|
|
97
106
|
```js
|
|
98
|
-
<yqg-permission
|
|
107
|
+
<yqg-permission
|
|
99
108
|
workNumber="05184"
|
|
100
109
|
businessCode="PPDL"
|
|
101
110
|
:permissions="['permissionCode1, permissionCode2']"
|
|
@@ -107,23 +116,26 @@ type = "custom": 支持自定义组件,以slot的方式添加自定义组件
|
|
|
107
116
|
<div>自定义按钮</div>
|
|
108
117
|
</yqg-permission>
|
|
109
118
|
|
|
110
|
-
|
|
111
|
-
|
|
119
|
+
````
|
|
112
120
|
|
|
113
121
|
### Browser Support
|
|
114
122
|
|
|
115
|
-
因为该npm包底层使用webComponent中customElements.define,所以仅支持customElements.define的浏览器
|
|
123
|
+
因为该 npm 包底层使用 webComponent 中 customElements.define,所以仅支持 customElements.define 的浏览器
|
|
116
124
|

|
|
117
125
|
|
|
118
126
|
### NPM scripts
|
|
119
127
|
|
|
120
|
-
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
128
|
+
- `pnpm install`: 安装依赖
|
|
129
|
+
- `pnpm dev`: 启动项目
|
|
130
|
+
- `pnpm build`: 编译项目
|
|
131
|
+
- `npm publish`: 发布项目
|
|
132
|
+
- `pnpm demo:build`: 构建,并上传 umd 到测试 CDN
|
|
133
|
+
- `pnpm prod:build`: 构建,并上传 umd 到生产 CDN
|
|
134
|
+
|
|
135
|
+
### todo
|
|
124
136
|
|
|
125
|
-
|
|
126
|
-
todo:优化项 react中成功回调、多语言
|
|
137
|
+
todo:优化项 react 中成功回调、多语言
|
|
127
138
|
|
|
128
139
|
### 问题反馈
|
|
129
|
-
|
|
140
|
+
|
|
141
|
+
---
|