@das-fed/utils 1.0.1 → 1.0.3

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.
Files changed (131) hide show
  1. package/api-services/index.d.ts +1 -0
  2. package/api-services/index.js +3 -19845
  3. package/api-services/modules/app-manage.d.ts +2 -0
  4. package/api-services/modules/app-manage.js +5 -6
  5. package/api-services/modules/authentication.d.ts +2 -0
  6. package/api-services/modules/authentication.js +5 -6
  7. package/api-services/modules/bems.d.ts +6 -0
  8. package/api-services/modules/bems.js +8 -10
  9. package/api-services/modules/contract.d.ts +2 -0
  10. package/api-services/modules/contract.js +5 -6
  11. package/api-services/modules/duty-manage.d.ts +7 -0
  12. package/api-services/modules/duty-manage.js +9 -10
  13. package/api-services/modules/enterpriseright.d.ts +2 -0
  14. package/api-services/modules/enterpriseright.js +5 -6
  15. package/api-services/modules/file.d.ts +36 -0
  16. package/api-services/modules/file.js +449 -354
  17. package/api-services/modules/gateway-edge.d.ts +2 -0
  18. package/api-services/modules/gateway-edge.js +5 -6
  19. package/api-services/modules/index.d.ts +21 -0
  20. package/api-services/modules/index.js +501 -435
  21. package/api-services/modules/iot.d.ts +15 -0
  22. package/api-services/modules/iot.js +17 -18
  23. package/api-services/modules/justauth.d.ts +3 -0
  24. package/api-services/modules/justauth.js +6 -7
  25. package/api-services/modules/knowledge.d.ts +2 -0
  26. package/api-services/modules/knowledge.js +5 -6
  27. package/api-services/modules/link.d.ts +2 -0
  28. package/api-services/modules/link.js +5 -6
  29. package/api-services/modules/permission.d.ts +2 -0
  30. package/api-services/modules/permission.js +5 -6
  31. package/api-services/modules/platformManage.d.ts +14 -0
  32. package/api-services/modules/platformManage.js +12 -13
  33. package/api-services/modules/portal.d.ts +2 -0
  34. package/api-services/modules/portal.js +5 -6
  35. package/api-services/modules/space-manage.d.ts +2 -0
  36. package/api-services/modules/space-manage.js +5 -6
  37. package/api-services/modules/super-admin.d.ts +8 -0
  38. package/api-services/modules/super-admin.js +8 -9
  39. package/api-services/modules/supplier.d.ts +6 -0
  40. package/api-services/modules/supplier.js +7 -8
  41. package/api-services/modules/supplychain-manage.d.ts +2 -0
  42. package/api-services/modules/supplychain-manage.js +5 -6
  43. package/api-services/modules/systemConfiguration.d.ts +2 -0
  44. package/api-services/modules/systemConfiguration.js +5 -6
  45. package/api-services/modules/tool.d.ts +2 -0
  46. package/api-services/modules/tool.js +5 -6
  47. package/api-services/src/create-service.d.ts +2 -0
  48. package/api-services/src/create-service.js +3119 -19726
  49. package/api-services/src/sso.d.ts +29 -0
  50. package/api-services/src/sso.js +1547 -156
  51. package/api-services/src/util.d.ts +1 -0
  52. package/api-services/src/util.js +1462 -19
  53. package/atob/index.d.ts +2 -0
  54. package/atob/index.js +9 -10
  55. package/common-info/getIframeUrl.d.ts +9 -0
  56. package/common-info/getIframeUrl.js +9 -11
  57. package/common-info/index.d.ts +42 -0
  58. package/common-info/index.js +138 -272
  59. package/common-info/setInfoFromUrl.d.ts +8 -0
  60. package/common-info/setInfoFromUrl.js +60 -128
  61. package/common-tools/arr-tools.d.ts +15 -0
  62. package/common-tools/arr-tools.js +6 -13
  63. package/common-tools/date-format.d.ts +7 -0
  64. package/common-tools/date-format.js +18 -21
  65. package/common-tools/get-url-params.d.ts +33 -0
  66. package/common-tools/get-url-params.js +48 -88
  67. package/common-tools/handle-data.d.ts +6 -0
  68. package/common-tools/handle-data.js +3 -4
  69. package/common-tools/index.d.ts +7 -0
  70. package/common-tools/index.js +7 -213
  71. package/common-tools/nest-tree-format.d.ts +30 -0
  72. package/common-tools/nest-tree-format.js +22 -49
  73. package/common-tools/obj-tools.d.ts +7 -0
  74. package/common-tools/obj-tools.js +17 -18
  75. package/common-tools/setHtmlMinWH.d.ts +5 -0
  76. package/common-tools/setHtmlMinWH.js +6 -10
  77. package/common-tools/throttled.d.ts +7 -0
  78. package/common-tools/throttled.js +7 -16
  79. package/config/index.d.ts +2 -0
  80. package/config/index.js +8 -25
  81. package/curring-http/index.d.ts +11 -0
  82. package/curring-http/index.js +5150 -17289
  83. package/directive/auth.d.ts +8 -0
  84. package/directive/auth.js +54 -104
  85. package/directive/clickOutside.d.ts +5 -0
  86. package/directive/clickOutside.js +23 -49
  87. package/directive/hoverInside.d.ts +5 -0
  88. package/directive/hoverInside.js +16 -35
  89. package/directive/index.d.ts +3 -0
  90. package/directive/index.js +7 -182
  91. package/directive/utils.d.ts +7 -0
  92. package/directive/utils.js +6 -11
  93. package/dom-check-in/index.d.ts +6 -0
  94. package/dom-check-in/index.js +7 -15
  95. package/dom-watcher/index.d.ts +25 -0
  96. package/dom-watcher/index.js +7 -8
  97. package/hooks/popup-manager/use-zindex.d.ts +5 -0
  98. package/hooks/popup-manager/use-zindex.js +17 -36
  99. package/index.d.ts +2 -0
  100. package/index.js +2 -215
  101. package/load-js/index.d.ts +3 -0
  102. package/load-js/index.js +10 -20
  103. package/oss/index.d.ts +2 -0
  104. package/oss/index.js +11 -15
  105. package/package.json +8 -13
  106. package/pinyin-first-character/index.d.ts +2 -0
  107. package/pinyin-first-character/index.js +25011 -12217
  108. package/process-engine-info/index.d.ts +10 -0
  109. package/process-engine-info/index.js +8 -10
  110. package/pure-image-src/index.d.ts +2 -0
  111. package/pure-image-src/index.js +3 -29
  112. package/set-personal-info/index.d.ts +5 -0
  113. package/set-personal-info/index.js +1460 -16
  114. package/size-watcher/index.d.ts +6 -0
  115. package/size-watcher/index.js +17 -24
  116. package/style/index.d.ts +2 -0
  117. package/style/index.js +62 -103
  118. package/style/math.d.ts +9 -0
  119. package/style/math.js +16 -31
  120. package/style/style.d.ts +30 -0
  121. package/style/style.js +49 -72
  122. package/token-tools/index.d.ts +18 -0
  123. package/token-tools/index.js +72 -149
  124. package/vue/hooks/use-model-value.d.ts +3 -0
  125. package/vue/hooks/use-model-value.js +9 -10
  126. package/vue/index.d.ts +1 -0
  127. package/vue/index.js +3 -10
  128. package/webSocket-service/index.d.ts +40 -0
  129. package/webSocket-service/index.js +62 -138
  130. package/with-install/index.d.ts +10 -0
  131. package/with-install/index.js +5 -7
@@ -0,0 +1,2 @@
1
+ export declare const encryption: (str: string) => string;
2
+ export declare const decrypt: (str: string) => string;
package/atob/index.js CHANGED
@@ -1,12 +1,11 @@
1
- const encryption = (str) => {
2
- var encStr = encodeURIComponent(str);
3
- encStr = btoa(encStr);
4
- return encStr;
1
+ const n = (t) => {
2
+ var e = encodeURIComponent(t);
3
+ return e = btoa(e), e;
4
+ }, o = (t) => {
5
+ var e = atob(t);
6
+ return e = decodeURIComponent(e), e;
5
7
  };
6
- const decrypt = (str) => {
7
- var decStr = atob(str);
8
- decStr = decodeURIComponent(decStr);
9
- return decStr;
8
+ export {
9
+ o as decrypt,
10
+ n as encryption
10
11
  };
11
-
12
- export { decrypt, encryption };
@@ -0,0 +1,9 @@
1
+ type pageType = 'editor' | 'editor3d' | 'editor2d3d' | 'preview' | 'preview3d';
2
+ /**
3
+ * 编辑器的路径和预览图纸的路径
4
+ * @param page 'editor' | 'editor3d' | 'editor2d3d' | 'preview' | 'preview3d'
5
+ * @param query 路由参数location.search
6
+ * @returns
7
+ */
8
+ export declare const getIframeUrl: (page: pageType, query?: Record<any, any>) => any;
9
+ export {};
@@ -1,13 +1,11 @@
1
- import { getFullPath } from '@das-fed/utils/common-tools';
2
-
3
- const getIframeUrl = (page, query) => {
4
- if (!page)
1
+ import { getFullPath as n } from "@das-fed/utils/common-tools";
2
+ const l = (r, t) => {
3
+ if (!r)
5
4
  return;
6
- let innerQuery = {};
7
- const applicationPath = "enterpriseadmin/iocvisual";
8
- if (page === "preview" || page === "preview3d")
9
- innerQuery = { showLayout: false };
10
- return getFullPath("/" + applicationPath + "/" + page, { ...innerQuery, ...query });
5
+ let e = {};
6
+ const i = "enterpriseadmin/iocvisual";
7
+ return (r === "preview" || r === "preview3d") && (e = { showLayout: !1 }), n("/" + i + "/" + r, { ...e, ...t });
8
+ };
9
+ export {
10
+ l as getIframeUrl
11
11
  };
12
-
13
- export { getIframeUrl };
@@ -0,0 +1,42 @@
1
+ import type { UserInfo, PersonalInfo, TenantInfo, ProjectInfo, SubAppsInfo, TabInfo, permissionBtnInfo } from './type';
2
+ /** 获取token */
3
+ export declare const getToken: () => string;
4
+ /** 获取token详情 */
5
+ export declare const getUserInfo: () => UserInfo;
6
+ /** 获取用户详情 */
7
+ export declare const getPersonalInfo: () => PersonalInfo;
8
+ /** 获取当前租户详情 */
9
+ export declare const getTenantInfo: () => TenantInfo;
10
+ /**
11
+ * 获取项目信息
12
+ * @returns 项目信息
13
+ */
14
+ export declare const getProjectInfo: () => ProjectInfo;
15
+ /**
16
+ * 可用于判断菜单或者按钮权限
17
+ * @param menuCode 菜单编码
18
+ * @param applicationCode 应用编码
19
+ * @returns undefined(无菜单权限);空数组(无按钮权限)
20
+ */
21
+ export declare const getPageAuth: (menuCode?: string, applicationCode?: string) => any;
22
+ /**
23
+ * 获取指定菜单的按钮权限数据
24
+ * @param menuCode 菜单编码
25
+ * @param applicationCode 应用编码
26
+ * @returns
27
+ */
28
+ export declare const getPageAuthBtn: (menuCode?: string, applicationCode?: string) => permissionBtnInfo;
29
+ /**
30
+ * 获取应用信息(独立打开子应用不可用)
31
+ * @returns 应用信息
32
+ */
33
+ export declare const getSubApps: () => SubAppsInfo;
34
+ /**
35
+ * 获取菜单
36
+ * @param appCode 应用编码
37
+ */
38
+ export declare const getMenus: (appCode?: string) => any;
39
+ /** 获取tabs标签页信息 */
40
+ export declare const getTabInfo: () => TabInfo;
41
+ /** 获取minio地址 */
42
+ export declare const getMinioAddress: () => any;
@@ -1,311 +1,177 @@
1
- import { tokenStorage } from '@das-fed/utils/api-services/src/sso';
2
- import { getConfig } from '@das-fed/utils/config';
3
- import { getUrlParams } from '@das-fed/utils/common-tools';
4
-
1
+ import { tokenStorage as l } from "@das-fed/utils/api-services/src/sso";
2
+ import { getConfig as f } from "@das-fed/utils/config";
3
+ import { getUrlParams as d } from "@das-fed/utils/common-tools";
4
+ import { getUrlToken as m, getProjectInfoFromQuery as S } from "@das-fed/utils/common-info/setInfoFromUrl";
5
5
  /*! js-cookie v3.0.5 | MIT */
6
- /* eslint-disable no-var */
7
- function assign (target) {
8
- for (var i = 1; i < arguments.length; i++) {
9
- var source = arguments[i];
10
- for (var key in source) {
11
- target[key] = source[key];
12
- }
6
+ function g(e) {
7
+ for (var n = 1; n < arguments.length; n++) {
8
+ var t = arguments[n];
9
+ for (var s in t)
10
+ e[s] = t[s];
13
11
  }
14
- return target
12
+ return e;
15
13
  }
16
- /* eslint-enable no-var */
17
-
18
- /* eslint-disable no-var */
19
- var defaultConverter = {
20
- read: function (value) {
21
- if (value[0] === '"') {
22
- value = value.slice(1, -1);
23
- }
24
- return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
14
+ var b = {
15
+ read: function(e) {
16
+ return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
25
17
  },
26
- write: function (value) {
27
- return encodeURIComponent(value).replace(
18
+ write: function(e) {
19
+ return encodeURIComponent(e).replace(
28
20
  /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
29
21
  decodeURIComponent
30
- )
22
+ );
31
23
  }
32
24
  };
33
- /* eslint-enable no-var */
34
-
35
- /* eslint-disable no-var */
36
-
37
- function init (converter, defaultAttributes) {
38
- function set (name, value, attributes) {
39
- if (typeof document === 'undefined') {
40
- return
41
- }
42
-
43
- attributes = assign({}, defaultAttributes, attributes);
44
-
45
- if (typeof attributes.expires === 'number') {
46
- attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
47
- }
48
- if (attributes.expires) {
49
- attributes.expires = attributes.expires.toUTCString();
25
+ function I(e, n) {
26
+ function t(o, a, r) {
27
+ if (!(typeof document > "u")) {
28
+ r = g({}, n, r), typeof r.expires == "number" && (r.expires = new Date(Date.now() + r.expires * 864e5)), r.expires && (r.expires = r.expires.toUTCString()), o = encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
29
+ var i = "";
30
+ for (var c in r)
31
+ r[c] && (i += "; " + c, r[c] !== !0 && (i += "=" + r[c].split(";")[0]));
32
+ return document.cookie = o + "=" + e.write(a, o) + i;
50
33
  }
51
-
52
- name = encodeURIComponent(name)
53
- .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
54
- .replace(/[()]/g, escape);
55
-
56
- var stringifiedAttributes = '';
57
- for (var attributeName in attributes) {
58
- if (!attributes[attributeName]) {
59
- continue
60
- }
61
-
62
- stringifiedAttributes += '; ' + attributeName;
63
-
64
- if (attributes[attributeName] === true) {
65
- continue
66
- }
67
-
68
- // Considers RFC 6265 section 5.2:
69
- // ...
70
- // 3. If the remaining unparsed-attributes contains a %x3B (";")
71
- // character:
72
- // Consume the characters of the unparsed-attributes up to,
73
- // not including, the first %x3B (";") character.
74
- // ...
75
- stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
76
- }
77
-
78
- return (document.cookie =
79
- name + '=' + converter.write(value, name) + stringifiedAttributes)
80
34
  }
81
-
82
- function get (name) {
83
- if (typeof document === 'undefined' || (arguments.length && !name)) {
84
- return
85
- }
86
-
87
- // To prevent the for loop in the first place assign an empty array
88
- // in case there are no cookies at all.
89
- var cookies = document.cookie ? document.cookie.split('; ') : [];
90
- var jar = {};
91
- for (var i = 0; i < cookies.length; i++) {
92
- var parts = cookies[i].split('=');
93
- var value = parts.slice(1).join('=');
94
-
95
- try {
96
- var found = decodeURIComponent(parts[0]);
97
- jar[found] = converter.read(value, found);
98
-
99
- if (name === found) {
100
- break
35
+ function s(o) {
36
+ if (!(typeof document > "u" || arguments.length && !o)) {
37
+ for (var a = document.cookie ? document.cookie.split("; ") : [], r = {}, i = 0; i < a.length; i++) {
38
+ var c = a[i].split("="), p = c.slice(1).join("=");
39
+ try {
40
+ var u = decodeURIComponent(c[0]);
41
+ if (r[u] = e.read(p, u), o === u)
42
+ break;
43
+ } catch {
101
44
  }
102
- } catch (e) {}
45
+ }
46
+ return o ? r[o] : r;
103
47
  }
104
-
105
- return name ? jar[name] : jar
106
48
  }
107
-
108
49
  return Object.create(
109
50
  {
110
- set,
111
- get,
112
- remove: function (name, attributes) {
113
- set(
114
- name,
115
- '',
116
- assign({}, attributes, {
51
+ set: t,
52
+ get: s,
53
+ remove: function(o, a) {
54
+ t(
55
+ o,
56
+ "",
57
+ g({}, a, {
117
58
  expires: -1
118
59
  })
119
60
  );
120
61
  },
121
- withAttributes: function (attributes) {
122
- return init(this.converter, assign({}, this.attributes, attributes))
62
+ withAttributes: function(o) {
63
+ return I(this.converter, g({}, this.attributes, o));
123
64
  },
124
- withConverter: function (converter) {
125
- return init(assign({}, this.converter, converter), this.attributes)
65
+ withConverter: function(o) {
66
+ return I(g({}, this.converter, o), this.attributes);
126
67
  }
127
68
  },
128
69
  {
129
- attributes: { value: Object.freeze(defaultAttributes) },
130
- converter: { value: Object.freeze(converter) }
70
+ attributes: { value: Object.freeze(n) },
71
+ converter: { value: Object.freeze(e) }
131
72
  }
132
- )
73
+ );
133
74
  }
134
-
135
- var api = init(defaultConverter, { path: '/' });
136
-
137
- const getUrlToken = () => {
138
- const search = new URL(location.href).searchParams;
139
- const token = search.get("token") || search.get("accessToken") || search.get("accesstoken") || "";
140
- if (token) {
141
- const tokenInfo = JSON.stringify({ access_token: token });
142
- sessionStorage.setItem("accessToken", token);
143
- sessionStorage.setItem("tokenInfo", tokenInfo);
144
- api.set("accessToken", token);
145
- api.set("accessTokenInfo", tokenInfo);
146
- }
147
- };
148
- const getProjectInfoFromQuery = () => {
149
- const preProject = JSON.parse(sessionStorage.getItem("projectInfo") || "{}");
150
- const search = new URL(location.href).searchParams;
151
- const id = search.get("project") || search.get("projectId") || "";
152
- if (!id)
153
- return;
154
- const parentId = search.get("projectParent") || search.get("projectParentId") || preProject?.parentId || "";
155
- const name = search.get("projectName") || preProject?.name || "";
156
- sessionStorage.setItem("project", id);
157
- sessionStorage.setItem("projectInfo", JSON.stringify({ ...preProject, id, name, parentId }));
158
- };
159
-
160
- const isDev = import.meta.env.DEV;
161
- const getToken = () => {
162
- return api.get("accessToken") ?? "";
163
- };
164
- const getUserInfo = () => {
165
- const config = getConfig();
166
- const infoStrict = config?.infoStrict ?? true;
167
- let info = tokenStorage().getData().info;
168
- if (infoStrict) {
169
- if (isDev && config.userInfo)
170
- info = config.userInfo;
171
- } else {
172
- if (config.userInfo)
173
- info = config.userInfo;
174
- }
175
- const userInfo = {
176
- id: info.sub ?? "",
177
- name: info.name ?? "",
178
- flag: info.flag,
179
- tenantId: info?.tenant ?? info?.tenantId ?? ""
75
+ var A = I(b, { path: "/" });
76
+ const h = () => A.get("accessToken") ?? "", j = () => {
77
+ const e = f(), n = (e == null ? void 0 : e.infoStrict) ?? !0;
78
+ let t = l().getData().info;
79
+ return n || e.userInfo && (t = e.userInfo), {
80
+ id: t.sub ?? "",
81
+ name: t.name ?? "",
82
+ flag: t.flag,
83
+ tenantId: (t == null ? void 0 : t.tenant) ?? (t == null ? void 0 : t.tenantId) ?? ""
180
84
  };
181
- return userInfo;
182
- };
183
- const getPersonalInfo = () => {
184
- const config = getConfig();
185
- const infoStrict = config?.infoStrict ?? true;
186
- let info = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
187
- if (infoStrict) {
188
- if (isDev && config.personalInfo)
189
- info = config.personalInfo;
190
- } else {
191
- if (config.personalInfo)
192
- info = config.personalInfo;
193
- }
194
- const personalInfo = {
195
- id: info.id ?? "",
196
- name: info.name ?? "",
197
- phone: info.phone ?? "",
198
- userName: info.userName ?? "",
199
- email: info.email ?? "",
200
- headPicture: info.headPicture ?? ""
85
+ }, y = () => {
86
+ const e = f(), n = (e == null ? void 0 : e.infoStrict) ?? !0;
87
+ let t = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
88
+ return n || e.personalInfo && (t = e.personalInfo), {
89
+ id: t.id ?? "",
90
+ name: t.name ?? "",
91
+ phone: t.phone ?? "",
92
+ userName: t.userName ?? "",
93
+ email: t.email ?? "",
94
+ headPicture: t.headPicture ?? ""
201
95
  };
202
- return personalInfo;
203
- };
204
- const getTenantInfo = () => {
205
- let info = JSON.parse(sessionStorage.getItem("tenantInfo") || "{}");
206
- const tenantInfo = {
207
- userId: info.id ?? "",
208
- userName: info.userName ?? "",
209
- name: info.name ?? "",
210
- areaCode: info.areaCode ?? "",
211
- phone: info.phone ?? "",
212
- flag: info.flag ?? null,
213
- tenant: info.tenant ?? {}
96
+ }, R = () => {
97
+ let e = JSON.parse(sessionStorage.getItem("tenantInfo") || "{}");
98
+ return {
99
+ userId: e.id ?? "",
100
+ userName: e.userName ?? "",
101
+ name: e.name ?? "",
102
+ areaCode: e.areaCode ?? "",
103
+ phone: e.phone ?? "",
104
+ flag: e.flag ?? null,
105
+ tenant: e.tenant ?? {}
214
106
  };
215
- return tenantInfo;
216
- };
217
- const getProjectInfo = () => {
218
- const config = getConfig();
219
- const infoStrict = config?.infoStrict ?? true;
220
- let info = JSON.parse(sessionStorage.getItem("projectInfo") || "{}");
221
- if (infoStrict) {
222
- if (isDev && config.projectInfo)
223
- info = config.projectInfo;
224
- } else {
225
- if (config.projectInfo)
226
- info = config.projectInfo;
227
- }
228
- const projectInfo = {
229
- id: info?.id ?? "",
230
- parentId: info?.parentId ?? "",
231
- name: info?.name ?? "",
232
- tenantId: info?.tenant ?? ""
107
+ }, U = () => {
108
+ const e = f(), n = (e == null ? void 0 : e.infoStrict) ?? !0;
109
+ let t = JSON.parse(sessionStorage.getItem("projectInfo") || "{}");
110
+ return n || e.projectInfo && (t = e.projectInfo), {
111
+ id: (t == null ? void 0 : t.id) ?? "",
112
+ parentId: (t == null ? void 0 : t.parentId) ?? "",
113
+ name: (t == null ? void 0 : t.name) ?? "",
114
+ tenantId: (t == null ? void 0 : t.tenant) ?? ""
233
115
  };
234
- return projectInfo;
235
- };
236
- const getPageAuth = (menuCode, applicationCode) => {
237
- const KEY = "permission-btn";
238
- const config = getConfig();
239
- const subApps = getSubApps();
240
- const urlApp = getUrlParams(location.href, "app") || "";
241
- const realApplicationCode = applicationCode ? applicationCode : urlApp ? urlApp : window.__IN_MICRO_APP__ ? subApps.currentSubAppCode : config.title;
242
- if (!realApplicationCode)
243
- return void 0;
244
- const urlMenu = getUrlParams(location.href, "menu") || "";
245
- const realMenuCode = menuCode ? menuCode : urlMenu ? urlMenu : window.__IN_MICRO_APP__ ? subApps.currentSubApp.currentMenuCode : JSON.parse(sessionStorage.getItem(`${config.title}-tabs`) || "{}").currentTab.code;
246
- const btnInfo = JSON.parse(sessionStorage.getItem(KEY) || "{}");
247
- if (!btnInfo || JSON.stringify(btnInfo) === "{}")
248
- return void 0;
249
- const btnList = btnInfo[realApplicationCode][realMenuCode];
250
- if (btnList && btnList.length)
251
- return btnList;
252
- if (!btnInfo[realApplicationCode]["origin-auth"])
253
- return [];
254
- return btnInfo[realApplicationCode]["origin-auth"][realMenuCode] ?? [];
255
- };
256
- const getPageAuthBtn = (menuCode, applicationCode) => {
257
- const result = getPageAuth(menuCode, applicationCode);
258
- return result ?? [];
259
- };
260
- const getSubApps = () => {
116
+ }, _ = (e, n) => {
117
+ const t = "permission-btn", s = f(), o = v(), a = d(location.href, "app") || "", r = n || a || (window.__IN_MICRO_APP__ ? o.currentSubAppCode : s.title);
118
+ if (!r)
119
+ return;
120
+ const i = d(location.href, "menu") || "", c = e || i || (window.__IN_MICRO_APP__ ? o.currentSubApp.currentMenuCode : JSON.parse(sessionStorage.getItem(`${s.title}-tabs`) || "{}").currentTab.code), p = JSON.parse(sessionStorage.getItem(t) || "{}");
121
+ if (!p || JSON.stringify(p) === "{}")
122
+ return;
123
+ const u = p[r][c];
124
+ return u && u.length ? u : p[r]["origin-auth"] ? p[r]["origin-auth"][c] ?? [] : [];
125
+ }, M = (e, n) => _(e, n) ?? [], v = () => {
126
+ var s;
261
127
  if (!window.__IN_MICRO_APP__)
262
128
  return {};
263
- const info = JSON.parse(sessionStorage.getItem("subApps") || "{}");
264
- const flatSubAppList = info.appcategorys?.map((item) => item.apps).flat() ?? [];
265
- const subApps = {
266
- appcategorys: info.appcategorys ?? [],
267
- currentSubApp: info.currentSubApp ?? {},
268
- currentSubAppCode: info.currentSubAppCode ?? "",
269
- flatSubAppList,
270
- subAppList: info.subAppList ?? []
129
+ const e = JSON.parse(sessionStorage.getItem("subApps") || "{}"), n = ((s = e.appcategorys) == null ? void 0 : s.map((o) => o.apps).flat()) ?? [];
130
+ return {
131
+ appcategorys: e.appcategorys ?? [],
132
+ currentSubApp: e.currentSubApp ?? {},
133
+ currentSubAppCode: e.currentSubAppCode ?? "",
134
+ flatSubAppList: n,
135
+ subAppList: e.subAppList ?? []
271
136
  };
272
- return subApps;
273
- };
274
- const getMenus = (appCode) => {
275
- const info = JSON.parse(sessionStorage.getItem("menus") || "{}");
276
- if (appCode) {
277
- return info[appCode] ?? [];
278
- } else {
279
- return info;
280
- }
281
- };
282
- const getTabInfo = () => {
283
- const config = getConfig();
284
- let result = {};
137
+ }, T = (e) => {
138
+ const n = JSON.parse(sessionStorage.getItem("menus") || "{}");
139
+ return e ? n[e] ?? [] : n;
140
+ }, J = () => {
141
+ const e = f();
142
+ let n = {};
285
143
  if (window.__IN_MICRO_APP__) {
286
- const info = JSON.parse(sessionStorage.getItem("tabs") || "{}");
287
- result = {
288
- activeKey: info.activeKey ?? "",
289
- currentTab: info.currentTab ?? {},
290
- tabMap: info.tabMap ?? {}
144
+ const t = JSON.parse(sessionStorage.getItem("tabs") || "{}");
145
+ n = {
146
+ activeKey: t.activeKey ?? "",
147
+ currentTab: t.currentTab ?? {},
148
+ tabMap: t.tabMap ?? {}
291
149
  };
292
150
  } else {
293
- const info = JSON.parse(sessionStorage.getItem(`${config.title}-tabs`) || "{}");
294
- result = {
295
- activeKey: info.activeKey ?? "",
296
- currentTab: info.currentTab ?? {},
297
- tabList: info.tabList ?? []
151
+ const t = JSON.parse(sessionStorage.getItem(`${e.title}-tabs`) || "{}");
152
+ n = {
153
+ activeKey: t.activeKey ?? "",
154
+ currentTab: t.currentTab ?? {},
155
+ tabList: t.tabList ?? []
298
156
  };
299
157
  }
300
- return result;
158
+ return n;
159
+ }, k = () => {
160
+ const e = f(), n = sessionStorage.getItem("minioAddress");
161
+ return n || (e.baseURL ? e.baseURL : location.origin);
301
162
  };
302
- const getMinioAddress = () => {
303
- const config = getConfig();
304
- const minioAddress = sessionStorage.getItem("minioAddress");
305
- return minioAddress ? minioAddress : config.baseURL ? config.baseURL : location.origin;
163
+ h() || m();
164
+ S();
165
+ export {
166
+ T as getMenus,
167
+ k as getMinioAddress,
168
+ _ as getPageAuth,
169
+ M as getPageAuthBtn,
170
+ y as getPersonalInfo,
171
+ U as getProjectInfo,
172
+ v as getSubApps,
173
+ J as getTabInfo,
174
+ R as getTenantInfo,
175
+ h as getToken,
176
+ j as getUserInfo
306
177
  };
307
- if (!getToken())
308
- getUrlToken();
309
- getProjectInfoFromQuery();
310
-
311
- export { getMenus, getMinioAddress, getPageAuth, getPageAuthBtn, getPersonalInfo, getProjectInfo, getSubApps, getTabInfo, getTenantInfo, getToken, getUserInfo };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 从url获取token
3
+ */
4
+ export declare const getUrlToken: () => void;
5
+ /**
6
+ * 从url上获取project
7
+ */
8
+ export declare const getProjectInfoFromQuery: () => void;