w-web-perm 1.0.19 → 1.0.20

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * w-web-perm v1.0.19
2
+ * w-web-perm v1.0.20
3
3
  * (c) 2018-2021 yuda-lyu(semisphere)
4
4
  * Released under the MIT License.
5
5
  */
@@ -925,7 +925,7 @@
925
925
  <br class="clear">
926
926
 
927
927
  <footer>
928
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Sep 24 2024 19:39:53 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
928
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Sep 24 2024 20:19:15 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
929
929
  </footer>
930
930
 
931
931
  <script>prettyPrint();</script>
@@ -1176,7 +1176,7 @@ export default WWebPerm
1176
1176
  <br class="clear">
1177
1177
 
1178
1178
  <footer>
1179
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Sep 24 2024 19:39:53 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1179
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Sep 24 2024 20:19:15 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1180
1180
  </footer>
1181
1181
 
1182
1182
  <script>prettyPrint();</script>
package/docs/index.html CHANGED
@@ -71,7 +71,7 @@
71
71
  <br class="clear">
72
72
 
73
73
  <footer>
74
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Sep 24 2024 19:39:53 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
74
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Tue Sep 24 2024 20:19:15 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
75
75
  </footer>
76
76
 
77
77
  <script>prettyPrint();</script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-web-perm",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "main": "dist/w-web-perm.umd.js",
5
5
  "dependencies": {
6
6
  "@mdi/js": "^7.4.47",
package/src/perm.mjs CHANGED
@@ -12,6 +12,9 @@ function perm() {
12
12
 
13
13
  //pmd
14
14
  let pmd = null
15
+ let _user = {}
16
+ let _rules = []
17
+ let _kpRule = {}
15
18
 
16
19
  //conn
17
20
  let conn = (url, opt = {}) => {
@@ -43,6 +46,9 @@ function perm() {
43
46
  .then((res) => {
44
47
  // console.log('perm.getPerm then', res)
45
48
  pmd = res
49
+ genUser()
50
+ genRules()
51
+ genKpRule()
46
52
  if (isfun(permSuccess)) {
47
53
  permSuccess(pmd)
48
54
  }
@@ -59,48 +65,52 @@ function perm() {
59
65
  return pm
60
66
  }
61
67
 
62
- //user
63
- let user = get(pmd, `user`, {})
68
+ let genUser = () => {
69
+ _user = get(pmd, `user`, {})
70
+ }
64
71
 
65
- //rules
66
- let rules = get(pmd, `rules`, [])
72
+ let genRules = () => {
73
+ _rules = get(pmd, `rules`, [])
74
+ }
67
75
 
68
- //kpRule
69
- let kpRule = {}
70
- each(rules, (v) => {
76
+ let genKpRule = () => {
77
+ let kpRule = {}
78
+ each(_rules, (v) => {
71
79
 
72
- //name
73
- let name = get(v, 'name', '')
74
- if (!isestr(name)) {
75
- return true //跳出換下一個
76
- }
80
+ //name
81
+ let name = get(v, 'name', '')
82
+ if (!isestr(name)) {
83
+ return true //跳出換下一個
84
+ }
77
85
 
78
- //isActive
79
- let _isActive = get(v, 'isActive', '')
80
- let isActive = _isActive === 'y' ? 'y' : 'n'
86
+ //isActive
87
+ let _isActive = get(v, 'isActive', '')
88
+ let isActive = _isActive === 'y' ? 'y' : 'n'
81
89
 
82
- //save
83
- kpRule[name] = isActive
90
+ //save
91
+ kpRule[name] = isActive
84
92
 
85
- })
93
+ })
94
+ _kpRule = kpRule
95
+ }
86
96
 
87
97
  //kp
88
98
  let kp = {
89
99
  conn,
90
100
  getUser: () => {
91
- return user
101
+ return _user
92
102
  },
93
103
  getRules: () => {
94
- return rules
104
+ return _rules
95
105
  },
96
106
  getKpRule: () => {
97
- return kpRule
107
+ return _kpRule
98
108
  },
99
109
  // rule: (key) => {
100
- // return get(kpRule, key, '')
110
+ // return get(_kpRule, key, '')
101
111
  // },
102
112
  active: (key) => {
103
- let _isActive = get(kpRule, key, '')
113
+ let _isActive = get(_kpRule, key, '')
104
114
  let isActive = _isActive === 'y' ? 'y' : 'n'
105
115
  return isActive
106
116
  },