@das-fed/upf-utils 6.4.0-dev.227 → 6.4.0-dev.229
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/api-services/es5.js +1082 -1077
- package/api-services/index.js +846 -842
- package/api-services/index.js.gz +0 -0
- package/api-services/modules/app-manage/es5.js +1418 -1403
- package/api-services/modules/app-manage/index.js +1198 -1180
- package/api-services/modules/app-manage/index.js.gz +0 -0
- package/api-services/modules/authentication/es5.js +161 -158
- package/api-services/modules/authentication/index.js +138 -138
- package/api-services/modules/authentication/index.js.gz +0 -0
- package/api-services/modules/bems/es5.js +1180 -1165
- package/api-services/modules/bems/index.js +976 -958
- package/api-services/modules/bems/index.js.gz +0 -0
- package/api-services/modules/contract/es5.js +702 -699
- package/api-services/modules/contract/index.js +619 -619
- package/api-services/modules/contract/index.js.gz +0 -0
- package/api-services/modules/duty-manage/es5.js +1389 -1374
- package/api-services/modules/duty-manage/index.js +1180 -1162
- package/api-services/modules/duty-manage/index.js.gz +0 -0
- package/api-services/modules/enterpriseright/es5.js +1174 -1159
- package/api-services/modules/enterpriseright/index.js +971 -953
- package/api-services/modules/enterpriseright/index.js.gz +0 -0
- package/api-services/modules/es5.js +1337 -1346
- package/api-services/modules/file/es5.js +1222 -1231
- package/api-services/modules/file/index.js +987 -1005
- package/api-services/modules/file/index.js.gz +0 -0
- package/api-services/modules/gateway-edge/es5.js +1384 -1391
- package/api-services/modules/gateway-edge/index.js +1165 -1179
- package/api-services/modules/gateway-edge/index.js.gz +0 -0
- package/api-services/modules/index.js +1046 -1064
- package/api-services/modules/index.js.gz +0 -0
- package/api-services/modules/iot/es5.js +1206 -1191
- package/api-services/modules/iot/index.js +1006 -988
- package/api-services/modules/iot/index.js.gz +0 -0
- package/api-services/modules/justauth/es5.js +1148 -1133
- package/api-services/modules/justauth/index.js +954 -936
- package/api-services/modules/justauth/index.js.gz +0 -0
- package/api-services/modules/knowledge/es5.js +1157 -1163
- package/api-services/modules/knowledge/index.js +955 -969
- package/api-services/modules/knowledge/index.js.gz +0 -0
- package/api-services/modules/link/es5.js +1384 -1393
- package/api-services/modules/link/index.js +1165 -1183
- package/api-services/modules/link/index.js.gz +0 -0
- package/api-services/modules/permission/es5.js +1157 -1163
- package/api-services/modules/permission/index.js +955 -969
- package/api-services/modules/permission/index.js.gz +0 -0
- package/api-services/modules/platformManage/es5.js +171 -168
- package/api-services/modules/platformManage/index.js +150 -150
- package/api-services/modules/platformManage/index.js.gz +0 -0
- package/api-services/modules/portal/es5.js +235 -232
- package/api-services/modules/portal/index.js +209 -209
- package/api-services/modules/portal/index.js.gz +0 -0
- package/api-services/modules/space-manage/es5.js +919 -913
- package/api-services/modules/space-manage/index.js +728 -724
- package/api-services/modules/space-manage/index.js.gz +0 -0
- package/api-services/modules/super-admin/es5.js +1117 -1126
- package/api-services/modules/super-admin/index.js +916 -934
- package/api-services/modules/super-admin/index.js.gz +0 -0
- package/api-services/modules/supplier/es5.js +165 -162
- package/api-services/modules/supplier/index.js +141 -141
- package/api-services/modules/supplier/index.js.gz +0 -0
- package/api-services/modules/supplychain-manage/es5.js +1134 -1143
- package/api-services/modules/supplychain-manage/index.js +932 -950
- package/api-services/modules/supplychain-manage/index.js.gz +0 -0
- package/api-services/modules/systemConfiguration/es5.js +1145 -1133
- package/api-services/modules/systemConfiguration/index.js +948 -934
- package/api-services/modules/systemConfiguration/index.js.gz +0 -0
- package/api-services/modules/tool/es5.js +1174 -1159
- package/api-services/modules/tool/index.js +971 -953
- package/api-services/modules/tool/index.js.gz +0 -0
- package/api-services/src/create-service/es5.js +1390 -1397
- package/api-services/src/create-service/index.js +1164 -1178
- package/api-services/src/create-service/index.js.gz +0 -0
- package/common-info/es5.js +1635 -1596
- package/common-info/getPermissionMethod/es5.js +1160 -1148
- package/common-info/getPermissionMethod/index.js +956 -942
- package/common-info/getPermissionMethod/index.js.gz +0 -0
- package/common-info/index.d.ts +9 -2
- package/common-info/index.js +1417 -1397
- package/common-info/index.js.gz +0 -0
- package/create-api-service/es5.js +165 -161
- package/create-api-service/index.d.ts +6 -6
- package/create-api-service/index.js +151 -150
- package/create-api-service/index.js.gz +0 -0
- package/directive/auth/es5.js +49 -56
- package/directive/auth/index.js +33 -41
- package/directive/auth/index.js.gz +0 -0
- package/esm-map.json +4 -1
- package/hooks/use-get-auth/es5.js +57 -191
- package/hooks/use-get-auth/index.d.ts +2 -7
- package/hooks/use-get-auth/index.js +16 -50
- package/package.json +3 -3
- package/hooks/use-get-auth/apis.d.ts +0 -4
- package/hooks/use-get-auth/index.js.gz +0 -0
|
Binary file
|
package/directive/auth/es5.js
CHANGED
|
@@ -2,80 +2,73 @@
|
|
|
2
2
|
|
|
3
3
|
var commonInfo = require('@das-fed/upf-utils/common-info/es5');
|
|
4
4
|
var utils = require('@das-fed/upf-utils/directive/utils/es5');
|
|
5
|
-
var
|
|
6
|
-
var e = /* @__PURE__ */new Set();
|
|
7
|
-
return s.forEach(function (t) {
|
|
8
|
-
var n = String(t !== null && t !== void 0 ? t : "").trim();
|
|
9
|
-
if (!n) return;
|
|
10
|
-
var r = n.lastIndexOf("."),
|
|
11
|
-
o = n.lastIndexOf("_"),
|
|
12
|
-
c = Math.max(r, o),
|
|
13
|
-
d = c >= 0 ? n.slice(c + 1) : n;
|
|
14
|
-
d && e.add(d);
|
|
15
|
-
}), e;
|
|
16
|
-
},
|
|
17
|
-
S = function S(s) {
|
|
5
|
+
var A = function A(e) {
|
|
18
6
|
var _ref;
|
|
19
|
-
var
|
|
7
|
+
var i = (_ref = e == null ? undefined : e.code) !== null && _ref !== void 0 ? _ref : "";
|
|
20
8
|
var t = false;
|
|
21
|
-
if (!
|
|
22
|
-
var
|
|
9
|
+
if (!i) return t;
|
|
10
|
+
var o = Array.isArray(i) ? i : [i],
|
|
23
11
|
r = commonInfo.getCurrentModulePermissionData("all"),
|
|
24
|
-
|
|
12
|
+
a = Array.isArray(r == null ? undefined : r.idList) ? r.idList : commonInfo.getCurrentModulePermissionData("id"),
|
|
25
13
|
c = Array.isArray(r == null ? undefined : r.codeList) ? r.codeList : commonInfo.getCurrentModulePermissionData("code"),
|
|
26
|
-
d = new Set((Array.isArray(
|
|
27
|
-
return String(
|
|
14
|
+
d = new Set((Array.isArray(a) ? a : []).map(function (n) {
|
|
15
|
+
return String(n);
|
|
28
16
|
})),
|
|
29
|
-
|
|
30
|
-
return String(
|
|
17
|
+
u = new Set((Array.isArray(c) ? c : []).map(function (n) {
|
|
18
|
+
return String(n);
|
|
31
19
|
})),
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
return
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
20
|
+
y = o.some(function (n) {
|
|
21
|
+
var s = String(n !== null && n !== void 0 ? n : "").trim();
|
|
22
|
+
return s && !/^[0-9]{3,}$/.test(s) && !s.includes(".") && !s.includes("_");
|
|
23
|
+
}),
|
|
24
|
+
L = commonInfo.getCurrentRouteCode(),
|
|
25
|
+
l = y ? commonInfo.buildActionSuffixSet(u, {
|
|
26
|
+
routeCode: L
|
|
27
|
+
}) : /* @__PURE__ */new Set(),
|
|
28
|
+
v = {
|
|
29
|
+
search: "q",
|
|
30
|
+
add: "a",
|
|
31
|
+
"delete": "d",
|
|
32
|
+
edit: "m",
|
|
33
|
+
view: "v"
|
|
34
|
+
},
|
|
35
|
+
w = function w(n) {
|
|
36
|
+
if (!n) return false;
|
|
37
|
+
var s = String(n || "").trim();
|
|
38
|
+
if (!s) return false;
|
|
39
|
+
if (s.includes(".") || s.includes("_")) return u.has(s);
|
|
40
|
+
var m = v[s] || "";
|
|
41
|
+
return l.has(s) || (m ? l.has(m) : false);
|
|
49
42
|
};
|
|
50
|
-
return (d.size > 0 ||
|
|
51
|
-
var
|
|
52
|
-
return
|
|
43
|
+
return (d.size > 0 || u.size > 0) && (t = o.some(function (n) {
|
|
44
|
+
var s = String(n !== null && n !== void 0 ? n : "").trim();
|
|
45
|
+
return s ? /^[0-9]{3,}$/.test(s) ? d.has(s) : w(s) : false;
|
|
53
46
|
}), t) ? true : t;
|
|
54
47
|
},
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
S = function S(e, i) {
|
|
49
|
+
i === "hide" ? e.classList.add("is-hide") : (e.setAttribute("disabled", ""), e.classList.add("is-disabled"));
|
|
57
50
|
},
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
C = function C(e, i) {
|
|
52
|
+
i === "hide" ? e.classList.remove("is-hide") : (e.removeAttribute("disabled"), e.classList.remove("is-disabled"));
|
|
60
53
|
},
|
|
61
|
-
|
|
54
|
+
E = function E(e, i) {
|
|
62
55
|
var _ref2;
|
|
63
|
-
var t = (
|
|
56
|
+
var t = (e ? i.value : i) || {};
|
|
64
57
|
typeof t == "string" && (t = {
|
|
65
58
|
code: t
|
|
66
59
|
});
|
|
67
|
-
var
|
|
68
|
-
r =
|
|
69
|
-
if (
|
|
70
|
-
|
|
60
|
+
var o = (_ref2 = t == null ? undefined : t.type) !== null && _ref2 !== void 0 ? _ref2 : "hide",
|
|
61
|
+
r = A(t);
|
|
62
|
+
if (e) if (!i.oldValue) r || utils.getEl(e, t).then(function (a) {
|
|
63
|
+
S(a, o);
|
|
71
64
|
});else {
|
|
72
|
-
var
|
|
65
|
+
var a = A(i.oldValue),
|
|
73
66
|
c = r;
|
|
74
|
-
if (
|
|
75
|
-
utils.getEl(
|
|
76
|
-
c ?
|
|
67
|
+
if (a === c) return;
|
|
68
|
+
utils.getEl(e, t).then(function (d) {
|
|
69
|
+
c ? C(d, o) : S(d, o);
|
|
77
70
|
});
|
|
78
71
|
}
|
|
79
72
|
return r;
|
|
80
73
|
};
|
|
81
|
-
exports.vAuth =
|
|
74
|
+
exports.vAuth = E;
|
package/directive/auth/index.js
CHANGED
|
@@ -1,55 +1,47 @@
|
|
|
1
|
-
import { getCurrentModulePermissionData as
|
|
1
|
+
import { getCurrentModulePermissionData as f, getCurrentRouteCode as g, buildActionSuffixSet as P } from "@das-fed/upf-utils/common-info";
|
|
2
2
|
import { getEl as h } from "@das-fed/upf-utils/directive/utils";
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
return s.forEach((t) => {
|
|
6
|
-
const n = String(t ?? "").trim();
|
|
7
|
-
if (!n) return;
|
|
8
|
-
const r = n.lastIndexOf("."), o = n.lastIndexOf("_"), c = Math.max(r, o), d = c >= 0 ? n.slice(c + 1) : n;
|
|
9
|
-
d && e.add(d);
|
|
10
|
-
}), e;
|
|
11
|
-
}, S = (s) => {
|
|
12
|
-
const e = (s == null ? void 0 : s.code) ?? "";
|
|
3
|
+
const A = (e) => {
|
|
4
|
+
const i = (e == null ? void 0 : e.code) ?? "";
|
|
13
5
|
let t = !1;
|
|
14
|
-
if (!
|
|
6
|
+
if (!i)
|
|
15
7
|
return t;
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
}) ?
|
|
20
|
-
if (!
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
23
|
-
if (
|
|
24
|
-
const m =
|
|
25
|
-
return l.has(
|
|
8
|
+
const o = Array.isArray(i) ? i : [i], r = f("all"), a = Array.isArray(r == null ? void 0 : r.idList) ? r.idList : f("id"), c = Array.isArray(r == null ? void 0 : r.codeList) ? r.codeList : f("code"), d = new Set((Array.isArray(a) ? a : []).map((n) => String(n))), u = new Set((Array.isArray(c) ? c : []).map((n) => String(n))), y = o.some((n) => {
|
|
9
|
+
const s = String(n ?? "").trim();
|
|
10
|
+
return s && !/^[0-9]{3,}$/.test(s) && !s.includes(".") && !s.includes("_");
|
|
11
|
+
}), L = g(), l = y ? P(u, { routeCode: L }) : /* @__PURE__ */ new Set(), v = { search: "q", add: "a", delete: "d", edit: "m", view: "v" }, w = (n) => {
|
|
12
|
+
if (!n) return !1;
|
|
13
|
+
const s = String(n || "").trim();
|
|
14
|
+
if (!s) return !1;
|
|
15
|
+
if (s.includes(".") || s.includes("_")) return u.has(s);
|
|
16
|
+
const m = v[s] || "";
|
|
17
|
+
return l.has(s) || (m ? l.has(m) : !1);
|
|
26
18
|
};
|
|
27
|
-
return (d.size > 0 ||
|
|
28
|
-
const
|
|
29
|
-
return
|
|
19
|
+
return (d.size > 0 || u.size > 0) && (t = o.some((n) => {
|
|
20
|
+
const s = String(n ?? "").trim();
|
|
21
|
+
return s ? /^[0-9]{3,}$/.test(s) ? d.has(s) : w(s) : !1;
|
|
30
22
|
}), t) ? !0 : t;
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
let t = (
|
|
23
|
+
}, S = (e, i) => {
|
|
24
|
+
i === "hide" ? e.classList.add("is-hide") : (e.setAttribute("disabled", ""), e.classList.add("is-disabled"));
|
|
25
|
+
}, C = (e, i) => {
|
|
26
|
+
i === "hide" ? e.classList.remove("is-hide") : (e.removeAttribute("disabled"), e.classList.remove("is-disabled"));
|
|
27
|
+
}, E = (e, i) => {
|
|
28
|
+
let t = (e ? i.value : i) || {};
|
|
37
29
|
typeof t == "string" && (t = { code: t });
|
|
38
|
-
const
|
|
39
|
-
if (
|
|
40
|
-
if (!
|
|
41
|
-
r || h(
|
|
42
|
-
|
|
30
|
+
const o = (t == null ? void 0 : t.type) ?? "hide", r = A(t);
|
|
31
|
+
if (e)
|
|
32
|
+
if (!i.oldValue)
|
|
33
|
+
r || h(e, t).then((a) => {
|
|
34
|
+
S(a, o);
|
|
43
35
|
});
|
|
44
36
|
else {
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
h(
|
|
48
|
-
c ?
|
|
37
|
+
const a = A(i.oldValue), c = r;
|
|
38
|
+
if (a === c) return;
|
|
39
|
+
h(e, t).then((d) => {
|
|
40
|
+
c ? C(d, o) : S(d, o);
|
|
49
41
|
});
|
|
50
42
|
}
|
|
51
43
|
return r;
|
|
52
44
|
};
|
|
53
45
|
export {
|
|
54
|
-
|
|
46
|
+
E as vAuth
|
|
55
47
|
};
|
|
Binary file
|
package/esm-map.json
CHANGED
|
@@ -155,5 +155,8 @@
|
|
|
155
155
|
"getGroupedCurrentUserPermissionList": "/common-info/index",
|
|
156
156
|
"getCurrentModulePermissionData": "/common-info/getPermissionMethod/index",
|
|
157
157
|
"getCurrentUserPermissionsList": "/common-info/getPermissionMethod/index",
|
|
158
|
-
"getCurrentUserMenuPermissionsList": "/common-info/getPermissionMethod/index"
|
|
158
|
+
"getCurrentUserMenuPermissionsList": "/common-info/getPermissionMethod/index",
|
|
159
|
+
"handleUnauthorized": "/create-api-service/index",
|
|
160
|
+
"getCurrentRouteCode": "/common-info/index",
|
|
161
|
+
"buildActionSuffixSet": "/common-info/index"
|
|
159
162
|
}
|
|
@@ -1,201 +1,67 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
4
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
6
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
7
3
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
8
4
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
9
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
10
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
5
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
16
6
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
17
7
|
var commonTools = require('@das-fed/upf-utils/common-tools/es5');
|
|
18
8
|
var nextTiken = require('@das-fed/upf-utils/nextTiken/es5');
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
return _context.a(2, null);
|
|
60
|
-
case 3:
|
|
61
|
-
f = l.map(function (p) {
|
|
62
|
-
return p.apps;
|
|
63
|
-
}).flat();
|
|
64
|
-
return _context.a(2, r ? f.find(function (p) {
|
|
65
|
-
return p.code === r;
|
|
66
|
-
}) : f);
|
|
67
|
-
}
|
|
68
|
-
}, _callee);
|
|
69
|
-
}));
|
|
70
|
-
return function d(_x) {
|
|
71
|
-
return _ref.apply(this, arguments);
|
|
72
|
-
};
|
|
73
|
-
}(),
|
|
74
|
-
g = /*#__PURE__*/function () {
|
|
75
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(r, i, t) {
|
|
76
|
-
var s,
|
|
77
|
-
c,
|
|
78
|
-
u,
|
|
79
|
-
l,
|
|
80
|
-
_yield$u,
|
|
81
|
-
_yield$u2,
|
|
82
|
-
f,
|
|
83
|
-
e,
|
|
84
|
-
p,
|
|
85
|
-
m,
|
|
86
|
-
o,
|
|
87
|
-
a,
|
|
88
|
-
_ref3,
|
|
89
|
-
n,
|
|
90
|
-
_args2 = arguments;
|
|
91
|
-
return _regenerator().w(function (_context2) {
|
|
92
|
-
while (1) switch (_context2.n) {
|
|
93
|
-
case 0:
|
|
94
|
-
s = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : "enterpriseadmin";
|
|
95
|
-
_context2.n = 1;
|
|
96
|
-
return nextTiken.projectNextTick();
|
|
97
|
-
case 1:
|
|
98
|
-
u = null, l = {
|
|
99
|
-
code: r,
|
|
100
|
-
showBtn: true
|
|
101
|
-
};
|
|
102
|
-
s === "superadmin" ? u = P().run : (l.userType = 1, u = L().run);
|
|
9
|
+
var l = function l() {
|
|
10
|
+
return {
|
|
11
|
+
getApplication: function () {
|
|
12
|
+
var _getApplication = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(t) {
|
|
13
|
+
var i;
|
|
14
|
+
return _regenerator().w(function (_context) {
|
|
15
|
+
while (1) switch (_context.n) {
|
|
16
|
+
case 0:
|
|
17
|
+
_context.n = 1;
|
|
18
|
+
return nextTiken.projectNextTick();
|
|
19
|
+
case 1:
|
|
20
|
+
i = JSON.parse(sessionStorage.getItem("menuList") || "[]").filter(function (e) {
|
|
21
|
+
return e.type === "application";
|
|
22
|
+
});
|
|
23
|
+
return _context.a(2, t ? i.find(function (e) {
|
|
24
|
+
return e.appId === t;
|
|
25
|
+
}) : i);
|
|
26
|
+
}
|
|
27
|
+
}, _callee);
|
|
28
|
+
}));
|
|
29
|
+
function getApplication(_x) {
|
|
30
|
+
return _getApplication.apply(this, arguments);
|
|
31
|
+
}
|
|
32
|
+
return getApplication;
|
|
33
|
+
}(),
|
|
34
|
+
getMenu: function () {
|
|
35
|
+
var _getMenu = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(t, n) {
|
|
36
|
+
var i, e, a;
|
|
37
|
+
return _regenerator().w(function (_context2) {
|
|
38
|
+
while (1) switch (_context2.n) {
|
|
39
|
+
case 0:
|
|
40
|
+
_context2.n = 1;
|
|
41
|
+
return nextTiken.projectNextTick();
|
|
42
|
+
case 1:
|
|
43
|
+
i = JSON.parse(sessionStorage.getItem("menuList") || "[]"), e = commonTools.flatTree(i).filter(function (r) {
|
|
44
|
+
return r.type === "menu";
|
|
45
|
+
});
|
|
46
|
+
if (!(!t && !n)) {
|
|
103
47
|
_context2.n = 2;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
case 4:
|
|
122
|
-
p = e != null && e.length ? e.filter(function (n) {
|
|
123
|
-
return n.routeUrl;
|
|
124
|
-
}) : [], m = e != null && e.length ? e.filter(function (n) {
|
|
125
|
-
return !n.routeUrl && n.children;
|
|
126
|
-
}).map(function (n) {
|
|
127
|
-
return n.children;
|
|
128
|
-
}).flat() : [], o = [].concat(_toConsumableArray(p), _toConsumableArray(m));
|
|
129
|
-
if (i) a = o.find(function (n) {
|
|
130
|
-
return n.code === i || n.originalCode === i;
|
|
131
|
-
});else if (t) {
|
|
132
|
-
n = t.replace((_ref3 = (c = o[0]) == null ? undefined : c.applicationPath) !== null && _ref3 !== void 0 ? _ref3 : "", "").replace(/\/\//g, "/");
|
|
133
|
-
a = o.find(function (h) {
|
|
134
|
-
return h.routeUrl && h.routeUrl === n;
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
return _context2.a(2, a);
|
|
138
|
-
}
|
|
139
|
-
}, _callee2);
|
|
140
|
-
}));
|
|
141
|
-
return function g(_x2, _x3, _x4) {
|
|
142
|
-
return _ref2.apply(this, arguments);
|
|
143
|
-
};
|
|
144
|
-
}();
|
|
145
|
-
return {
|
|
146
|
-
getApplication: d,
|
|
147
|
-
getMenu: g,
|
|
148
|
-
getAuth: function () {
|
|
149
|
-
var _getAuth = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(r) {
|
|
150
|
-
var _ref4, _ref5, _ref6;
|
|
151
|
-
var i,
|
|
152
|
-
o,
|
|
153
|
-
t,
|
|
154
|
-
s,
|
|
155
|
-
u,
|
|
156
|
-
e,
|
|
157
|
-
_args3 = arguments;
|
|
158
|
-
return _regenerator().w(function (_context3) {
|
|
159
|
-
while (1) switch (_context3.n) {
|
|
160
|
-
case 0:
|
|
161
|
-
i = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : "enterpriseadmin";
|
|
162
|
-
t = (_ref4 = r == null ? undefined : r.applicationCode) !== null && _ref4 !== void 0 ? _ref4 : "", s = (_ref5 = r == null ? undefined : r.menuCode) !== null && _ref5 !== void 0 ? _ref5 : "", u = (_ref6 = r == null ? undefined : r.code) !== null && _ref6 !== void 0 ? _ref6 : "";
|
|
163
|
-
if (!JSON.parse(sessionStorage.getItem("permission-btn") || "{}")[s]) {
|
|
164
|
-
_context3.n = 1;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
return _context3.a(2, auth.vAuth(null, {
|
|
168
|
-
applicationCode: t,
|
|
169
|
-
menuCode: s,
|
|
170
|
-
code: u
|
|
171
|
-
}));
|
|
172
|
-
case 1:
|
|
173
|
-
_context3.n = 2;
|
|
174
|
-
return d(t, i);
|
|
175
|
-
case 2:
|
|
176
|
-
if (_context3.v) {
|
|
177
|
-
_context3.n = 3;
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
return _context3.a(2, false);
|
|
181
|
-
case 3:
|
|
182
|
-
_context3.n = 4;
|
|
183
|
-
return g(t, s, i);
|
|
184
|
-
case 4:
|
|
185
|
-
e = _context3.v;
|
|
186
|
-
return _context3.a(2, !e || !(e != null && e.children) || !((o = e.children) != null && o.length) ? false : !!commonTools.flatTree(e.children).find(function (a) {
|
|
187
|
-
var _ref7;
|
|
188
|
-
var c = (_ref7 = a == null ? undefined : a.originalCode) !== null && _ref7 !== void 0 ? _ref7 : a.code;
|
|
189
|
-
return c.includes(s + ".") && (c = c.replace(s + ".", "").replaceAll(".", "-")), c === u;
|
|
190
|
-
}));
|
|
191
|
-
}
|
|
192
|
-
}, _callee3);
|
|
193
|
-
}));
|
|
194
|
-
function getAuth(_x5) {
|
|
195
|
-
return _getAuth.apply(this, arguments);
|
|
196
|
-
}
|
|
197
|
-
return getAuth;
|
|
198
|
-
}()
|
|
199
|
-
};
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
return _context2.a(2, e);
|
|
51
|
+
case 2:
|
|
52
|
+
return _context2.a(2, (t ? a = e.find(function (r) {
|
|
53
|
+
return r.routeCode === t || r.originalCode === t;
|
|
54
|
+
}) : n && (a = e.find(function (r) {
|
|
55
|
+
return r.routeUrl === n;
|
|
56
|
+
})), a));
|
|
57
|
+
}
|
|
58
|
+
}, _callee2);
|
|
59
|
+
}));
|
|
60
|
+
function getMenu(_x2, _x3) {
|
|
61
|
+
return _getMenu.apply(this, arguments);
|
|
62
|
+
}
|
|
63
|
+
return getMenu;
|
|
64
|
+
}()
|
|
200
65
|
};
|
|
201
|
-
|
|
66
|
+
};
|
|
67
|
+
exports.useGetAuth = l;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
export declare const useGetAuth: () => {
|
|
2
|
-
getApplication: (code?: string
|
|
3
|
-
getMenu: (
|
|
4
|
-
getAuth: (options: {
|
|
5
|
-
applicationCode: string;
|
|
6
|
-
menuCode: string;
|
|
7
|
-
code: string;
|
|
8
|
-
}, appName?: "superadmin" | "enterpriseadmin") => unknown;
|
|
2
|
+
getApplication: (code?: string) => unknown;
|
|
3
|
+
getMenu: (menuCode?: string, path?: string) => unknown;
|
|
9
4
|
};
|
|
@@ -1,53 +1,19 @@
|
|
|
1
|
-
import { flatTree as
|
|
2
|
-
import { projectNextTick as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
}, g = async (r, i, t, s = "enterpriseadmin") => {
|
|
14
|
-
var c;
|
|
15
|
-
await A();
|
|
16
|
-
let u = null, l = {
|
|
17
|
-
code: r,
|
|
18
|
-
showBtn: !0
|
|
19
|
-
};
|
|
20
|
-
s === "superadmin" ? u = P().run : (l.userType = 1, u = L().run);
|
|
21
|
-
const [f, e] = await u(l);
|
|
22
|
-
if (f || !e || !e.length)
|
|
23
|
-
return i || t ? void 0 : [];
|
|
24
|
-
if (!i && !t) return e;
|
|
25
|
-
const p = e != null && e.length ? e.filter((n) => n.routeUrl) : [], m = e != null && e.length ? e.filter((n) => !n.routeUrl && n.children).map((n) => n.children).flat() : [], o = [...p, ...m];
|
|
1
|
+
import { flatTree as o } from "@das-fed/upf-utils/common-tools";
|
|
2
|
+
import { projectNextTick as s } from "@das-fed/upf-utils/nextTiken";
|
|
3
|
+
const l = () => ({
|
|
4
|
+
getApplication: async (t) => {
|
|
5
|
+
await s();
|
|
6
|
+
const i = JSON.parse(sessionStorage.getItem("menuList") || "[]").filter((e) => e.type === "application");
|
|
7
|
+
return t ? i.find((e) => e.appId === t) : i;
|
|
8
|
+
},
|
|
9
|
+
getMenu: async (t, n) => {
|
|
10
|
+
await s();
|
|
11
|
+
const i = JSON.parse(sessionStorage.getItem("menuList") || "[]"), e = o(i).filter((r) => r.type === "menu");
|
|
12
|
+
if (!t && !n) return e;
|
|
26
13
|
let a;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const n = t.replace(((c = o[0]) == null ? void 0 : c.applicationPath) ?? "", "").replace(/\/\//g, "/");
|
|
31
|
-
a = o.find((h) => h.routeUrl && h.routeUrl === n);
|
|
32
|
-
}
|
|
33
|
-
return a;
|
|
34
|
-
};
|
|
35
|
-
return {
|
|
36
|
-
getApplication: d,
|
|
37
|
-
getMenu: g,
|
|
38
|
-
getAuth: async (r, i = "enterpriseadmin") => {
|
|
39
|
-
var o;
|
|
40
|
-
const t = (r == null ? void 0 : r.applicationCode) ?? "", s = (r == null ? void 0 : r.menuCode) ?? "", u = (r == null ? void 0 : r.code) ?? "";
|
|
41
|
-
if (JSON.parse(sessionStorage.getItem("permission-btn") || "{}")[s]) return M(null, { applicationCode: t, menuCode: s, code: u });
|
|
42
|
-
if (!await d(t, i)) return !1;
|
|
43
|
-
const e = await g(t, s, i);
|
|
44
|
-
return !e || !(e != null && e.children) || !((o = e.children) != null && o.length) ? !1 : !!w(e.children).find((a) => {
|
|
45
|
-
let c = (a == null ? void 0 : a.originalCode) ?? a.code;
|
|
46
|
-
return c.includes(s + ".") && (c = c.replace(s + ".", "").replaceAll(".", "-")), c === u;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
};
|
|
14
|
+
return t ? a = e.find((r) => r.routeCode === t || r.originalCode === t) : n && (a = e.find((r) => r.routeUrl === n)), a;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
51
17
|
export {
|
|
52
|
-
|
|
18
|
+
l as useGetAuth
|
|
53
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@das-fed/upf-utils",
|
|
3
|
-
"version": "6.4.0-dev.
|
|
3
|
+
"version": "6.4.0-dev.229",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@babel/preset-env": "7.26.0",
|
|
24
|
-
"@das-fed/upf-cli": "6.4.0-dev.
|
|
25
|
-
"@das-fed/upf-web": "6.4.0-dev.
|
|
24
|
+
"@das-fed/upf-cli": "6.4.0-dev.229",
|
|
25
|
+
"@das-fed/upf-web": "6.4.0-dev.229",
|
|
26
26
|
"@rollup/plugin-babel": "6.0.4",
|
|
27
27
|
"@types/js-cookie": "^3.0.6",
|
|
28
28
|
"@types/lodash-es": "^4.17.12",
|
|
Binary file
|