@das-fed/utils 1.0.2 → 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 (107) hide show
  1. package/api-services/index.d.ts +1 -0
  2. package/api-services/index.js +2 -6964
  3. package/api-services/modules/app-manage.d.ts +2 -0
  4. package/api-services/modules/app-manage.js +3 -6964
  5. package/api-services/modules/authentication.d.ts +2 -0
  6. package/api-services/modules/authentication.js +3 -6964
  7. package/api-services/modules/bems.d.ts +6 -0
  8. package/api-services/modules/bems.js +6 -6967
  9. package/api-services/modules/contract.d.ts +2 -0
  10. package/api-services/modules/contract.js +3 -6964
  11. package/api-services/modules/duty-manage.d.ts +7 -0
  12. package/api-services/modules/duty-manage.js +7 -6968
  13. package/api-services/modules/enterpriseright.d.ts +2 -0
  14. package/api-services/modules/enterpriseright.js +3 -6964
  15. package/api-services/modules/file.d.ts +36 -0
  16. package/api-services/modules/file.js +380 -7040
  17. package/api-services/modules/gateway-edge.d.ts +2 -0
  18. package/api-services/modules/gateway-edge.js +3 -6964
  19. package/api-services/modules/index.d.ts +21 -0
  20. package/api-services/modules/index.js +445 -7105
  21. package/api-services/modules/iot.d.ts +15 -0
  22. package/api-services/modules/iot.js +16 -6977
  23. package/api-services/modules/justauth.d.ts +3 -0
  24. package/api-services/modules/justauth.js +4 -6965
  25. package/api-services/modules/knowledge.d.ts +2 -0
  26. package/api-services/modules/knowledge.js +3 -6964
  27. package/api-services/modules/link.d.ts +2 -0
  28. package/api-services/modules/link.js +3 -6964
  29. package/api-services/modules/permission.d.ts +2 -0
  30. package/api-services/modules/permission.js +3 -6964
  31. package/api-services/modules/platformManage.d.ts +14 -0
  32. package/api-services/modules/platformManage.js +10 -6971
  33. package/api-services/modules/portal.d.ts +2 -0
  34. package/api-services/modules/portal.js +3 -6964
  35. package/api-services/modules/space-manage.d.ts +2 -0
  36. package/api-services/modules/space-manage.js +3 -6964
  37. package/api-services/modules/super-admin.d.ts +8 -0
  38. package/api-services/modules/super-admin.js +6 -6967
  39. package/api-services/modules/supplier.d.ts +6 -0
  40. package/api-services/modules/supplier.js +5 -6966
  41. package/api-services/modules/supplychain-manage.d.ts +2 -0
  42. package/api-services/modules/supplychain-manage.js +3 -6964
  43. package/api-services/modules/systemConfiguration.d.ts +2 -0
  44. package/api-services/modules/systemConfiguration.js +3 -6964
  45. package/api-services/modules/tool.d.ts +2 -0
  46. package/api-services/modules/tool.js +3 -6964
  47. package/api-services/src/create-service.d.ts +2 -0
  48. package/api-services/src/create-service.js +2286 -6013
  49. package/api-services/src/sso.d.ts +29 -0
  50. package/api-services/src/sso.js +506 -669
  51. package/api-services/src/util.d.ts +1 -0
  52. package/api-services/src/util.js +243 -247
  53. package/atob/index.d.ts +2 -0
  54. package/common-info/getIframeUrl.d.ts +9 -0
  55. package/common-info/getIframeUrl.js +6 -11
  56. package/common-info/index.d.ts +42 -0
  57. package/common-info/index.js +104 -163
  58. package/common-info/setInfoFromUrl.d.ts +8 -0
  59. package/common-tools/arr-tools.d.ts +15 -0
  60. package/common-tools/date-format.d.ts +7 -0
  61. package/common-tools/get-url-params.d.ts +33 -0
  62. package/common-tools/get-url-params.js +1 -0
  63. package/common-tools/handle-data.d.ts +6 -0
  64. package/common-tools/index.d.ts +7 -0
  65. package/common-tools/index.js +7 -117
  66. package/common-tools/nest-tree-format.d.ts +30 -0
  67. package/common-tools/obj-tools.d.ts +7 -0
  68. package/common-tools/setHtmlMinWH.d.ts +5 -0
  69. package/common-tools/throttled.d.ts +7 -0
  70. package/config/index.d.ts +2 -0
  71. package/curring-http/index.d.ts +11 -0
  72. package/directive/auth.d.ts +8 -0
  73. package/directive/auth.js +32 -190
  74. package/directive/clickOutside.d.ts +5 -0
  75. package/directive/clickOutside.js +19 -21
  76. package/directive/hoverInside.d.ts +5 -0
  77. package/directive/hoverInside.js +13 -15
  78. package/directive/index.d.ts +3 -0
  79. package/directive/index.js +6 -260
  80. package/directive/utils.d.ts +7 -0
  81. package/dom-check-in/index.d.ts +6 -0
  82. package/dom-watcher/index.d.ts +25 -0
  83. package/hooks/popup-manager/use-zindex.d.ts +5 -0
  84. package/index.d.ts +2 -0
  85. package/index.js +2 -266
  86. package/load-js/index.d.ts +3 -0
  87. package/load-js/index.js +8 -12
  88. package/oss/index.d.ts +2 -0
  89. package/oss/index.js +8 -12
  90. package/package.json +5 -6
  91. package/pinyin-first-character/index.d.ts +2 -0
  92. package/process-engine-info/index.d.ts +10 -0
  93. package/pure-image-src/index.d.ts +2 -0
  94. package/set-personal-info/index.d.ts +5 -0
  95. package/set-personal-info/index.js +516 -622
  96. package/size-watcher/index.d.ts +6 -0
  97. package/style/index.d.ts +2 -0
  98. package/style/math.d.ts +9 -0
  99. package/style/style.d.ts +30 -0
  100. package/token-tools/index.d.ts +18 -0
  101. package/token-tools/index.js +60 -1579
  102. package/vue/hooks/use-model-value.d.ts +3 -0
  103. package/vue/index.d.ts +1 -0
  104. package/vue/index.js +2 -8
  105. package/webSocket-service/index.d.ts +40 -0
  106. package/webSocket-service/index.js +35 -138
  107. package/with-install/index.d.ts +10 -0
@@ -1,262 +1,8 @@
1
- import { ref as w } from "vue";
2
- const p = (e, t) => {
3
- let n = window.location.search || "";
4
- if (e && e !== location.href) {
5
- const r = e.indexOf("?");
6
- r !== -1 ? n = e.slice(r) : n = "";
7
- }
8
- const s = new URLSearchParams(n);
9
- if (t)
10
- return s.get(t);
11
- {
12
- let r = {};
13
- for (let [o, c] of s.entries())
14
- r[o] = c;
15
- return r;
16
- }
17
- }, y = (e, t = "children", n = !0) => Array.isArray(e) && e.length ? e.reduce((s, r) => {
18
- let o = r[t], c = { ...r };
19
- return n && delete c[t], o && o.length ? s.concat(c, y(o, t, n)) : s.concat(c);
20
- }, []) : [];
21
- /*! js-cookie v3.0.5 | MIT */
22
- function g(e) {
23
- for (var t = 1; t < arguments.length; t++) {
24
- var n = arguments[t];
25
- for (var s in n)
26
- e[s] = n[s];
27
- }
28
- return e;
29
- }
30
- var C = {
31
- read: function(e) {
32
- return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
33
- },
34
- write: function(e) {
35
- return encodeURIComponent(e).replace(
36
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
37
- decodeURIComponent
38
- );
39
- }
40
- };
41
- function _(e, t) {
42
- function n(r, o, c) {
43
- if (!(typeof document > "u")) {
44
- c = g({}, t, c), typeof c.expires == "number" && (c.expires = new Date(Date.now() + c.expires * 864e5)), c.expires && (c.expires = c.expires.toUTCString()), r = encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
45
- var a = "";
46
- for (var i in c)
47
- c[i] && (a += "; " + i, c[i] !== !0 && (a += "=" + c[i].split(";")[0]));
48
- return document.cookie = r + "=" + e.write(o, r) + a;
49
- }
50
- }
51
- function s(r) {
52
- if (!(typeof document > "u" || arguments.length && !r)) {
53
- for (var o = document.cookie ? document.cookie.split("; ") : [], c = {}, a = 0; a < o.length; a++) {
54
- var i = o[a].split("="), u = i.slice(1).join("=");
55
- try {
56
- var f = decodeURIComponent(i[0]);
57
- if (c[f] = e.read(u, f), r === f)
58
- break;
59
- } catch {
60
- }
61
- }
62
- return r ? c[r] : c;
63
- }
64
- }
65
- return Object.create(
66
- {
67
- set: n,
68
- get: s,
69
- remove: function(r, o) {
70
- n(
71
- r,
72
- "",
73
- g({}, o, {
74
- expires: -1
75
- })
76
- );
77
- },
78
- withAttributes: function(r) {
79
- return _(this.converter, g({}, this.attributes, r));
80
- },
81
- withConverter: function(r) {
82
- return _(g({}, this.converter, r), this.attributes);
83
- }
84
- },
85
- {
86
- attributes: { value: Object.freeze(t) },
87
- converter: { value: Object.freeze(e) }
88
- }
89
- );
90
- }
91
- var m = _(C, { path: "/" });
92
- const k = (e) => {
93
- var t = encodeURIComponent(e);
94
- return t = btoa(t), t;
95
- }, v = () => {
96
- let t = { ...(window == null ? void 0 : window.config) || {} };
97
- t.rootContainer || (t.rootContainer = "#app"), t.baseURL || (t.baseURL = location.origin), t.ossBaseURL || (t.ossBaseURL = "/oss"), t.ossBaseURL.startsWith("/") && (t.ossBaseURL = `${t.baseURL}/oss`), t.ssoBaseURL || (t.ssoBaseURL = t.baseURL);
98
- let { microAppName: n, publicPath: s, mainAppName: r } = t;
99
- return n && !0 && !s && (s = `/${n}/`.replace(/\/\//g, "/")), s || (s = "/"), t.publicPath = s, t.autoOssBucket || (t.autoOssBucket = r || n), t;
100
- };
101
- w(!1);
102
- v();
103
- k("das123"), +/* @__PURE__ */ new Date();
104
- const S = () => {
105
- const e = new URL(location.href).searchParams, t = e.get("token") || e.get("accessToken") || e.get("accesstoken") || "";
106
- if (t) {
107
- const n = JSON.stringify({ access_token: t });
108
- sessionStorage.setItem("accessToken", t), sessionStorage.setItem("tokenInfo", n), m.set("accessToken", t), m.set("accessTokenInfo", n);
109
- }
110
- }, L = () => {
111
- const e = JSON.parse(sessionStorage.getItem("projectInfo") || "{}"), t = new URL(location.href).searchParams, n = t.get("project") || t.get("projectId") || "";
112
- if (!n)
113
- return;
114
- const s = t.get("projectParent") || t.get("projectParentId") || (e == null ? void 0 : e.parentId) || "", r = t.get("projectName") || (e == null ? void 0 : e.name) || "";
115
- sessionStorage.setItem("project", n), sessionStorage.setItem("projectInfo", JSON.stringify({ ...e, id: n, name: r, parentId: s }));
116
- }, P = () => m.get("accessToken") ?? "", h = (e, t) => {
117
- const n = "permission-btn", s = v(), r = A(), o = p(location.href, "app") || "", c = t || o || (window.__IN_MICRO_APP__ ? r.currentSubAppCode : s.title);
118
- if (!c)
119
- return;
120
- const a = p(location.href, "menu") || "", i = e || a || (window.__IN_MICRO_APP__ ? r.currentSubApp.currentMenuCode : JSON.parse(sessionStorage.getItem(`${s.title}-tabs`) || "{}").currentTab.code), u = JSON.parse(sessionStorage.getItem(n) || "{}");
121
- if (!u || JSON.stringify(u) === "{}")
122
- return;
123
- const f = u[c][i];
124
- return f && f.length ? f : u[c]["origin-auth"] ? u[c]["origin-auth"][i] ?? [] : [];
125
- }, A = () => {
126
- var s;
127
- if (!window.__IN_MICRO_APP__)
128
- return {};
129
- const e = JSON.parse(sessionStorage.getItem("subApps") || "{}"), t = ((s = e.appcategorys) == null ? void 0 : s.map((r) => r.apps).flat()) ?? [];
130
- return {
131
- appcategorys: e.appcategorys ?? [],
132
- currentSubApp: e.currentSubApp ?? {},
133
- currentSubAppCode: e.currentSubAppCode ?? "",
134
- flatSubAppList: t,
135
- subAppList: e.subAppList ?? []
136
- };
137
- }, R = () => {
138
- const e = v();
139
- let t = {};
140
- if (window.__IN_MICRO_APP__) {
141
- const n = JSON.parse(sessionStorage.getItem("tabs") || "{}");
142
- t = {
143
- activeKey: n.activeKey ?? "",
144
- currentTab: n.currentTab ?? {},
145
- tabMap: n.tabMap ?? {}
146
- };
147
- } else {
148
- const n = JSON.parse(sessionStorage.getItem(`${e.title}-tabs`) || "{}");
149
- t = {
150
- activeKey: n.activeKey ?? "",
151
- currentTab: n.currentTab ?? {},
152
- tabList: n.tabList ?? []
153
- };
154
- }
155
- return t;
156
- };
157
- P() || S();
158
- L();
159
- const d = async (e, t) => {
160
- let n = e;
161
- return t != null && t.target && (typeof t.target == "string" && (n = t.target), typeof t.target == "function" && (n = await t.target(e))), n;
162
- }, U = (e, t) => {
163
- if (!e || !t)
164
- return !1;
165
- if (typeof t == "string")
166
- return !!e.find((s) => s.code === t);
167
- {
168
- let n = !1;
169
- for (let s of t)
170
- if (e.find((o) => o.code === s)) {
171
- n = !0;
172
- break;
173
- }
174
- return n;
175
- }
176
- }, I = (e) => {
177
- var c, a;
178
- const t = (e == null ? void 0 : e.code) ?? "", n = (e == null ? void 0 : e.path) ?? location.pathname, s = (e == null ? void 0 : e.applicationCode) ?? "";
179
- let r = "";
180
- if (window.__IN_MICRO_APP__ ? r = e != null && e.menuCode ? e.menuCode : p(location.href, "menu") : r = e != null && e.menuCode ? e.menuCode : (c = R().currentTab) == null ? void 0 : c.code, !r) {
181
- const i = ((a = A().currentSubApp) == null ? void 0 : a.menus) ?? [];
182
- if (i && i.length) {
183
- const u = y(i).filter((f) => f == null ? void 0 : f.routeUrl);
184
- if (u && u.length) {
185
- const f = u.find((l) => l != null && l.applicationPath ? n == null ? void 0 : n.includes("/" + l.applicationPath + l.routeUrl) : n == null ? void 0 : n.includes(l.routeUrl));
186
- f && (r = (f == null ? void 0 : f.code) ?? "");
187
- }
188
- }
189
- }
190
- let o = !1;
191
- if (t) {
192
- const i = h(r, s) ?? [];
193
- o = U(i, t);
194
- } else
195
- o = !!h(r, s);
196
- return o;
197
- }, b = (e, t) => {
198
- t === "hide" ? e.classList.add("is-hide") : (e.setAttribute("disabled", ""), e.classList.add("is-disabled"));
199
- }, O = (e, t) => {
200
- t === "hide" ? e.classList.remove("is-hide") : (e.removeAttribute("disabled"), e.classList.remove("is-disabled"));
201
- }, T = (e, t) => {
202
- let n = (e ? t.value : t) || {};
203
- typeof n == "string" && (n = { code: n });
204
- const s = (n == null ? void 0 : n.type) ?? "hide", r = I(n);
205
- if (e)
206
- if (!t.oldValue)
207
- r || d(e, n).then((o) => {
208
- b(o, s);
209
- });
210
- else {
211
- const o = I(t.oldValue), c = r;
212
- if (o === c)
213
- return;
214
- d(e, n).then((a) => {
215
- c ? O(a, s) : b(a, s);
216
- });
217
- }
218
- return r;
219
- }, N = {
220
- mounted: async (e, t) => {
221
- const n = t.value, s = await d(e, n);
222
- function r(o) {
223
- let c = !0;
224
- if (Array.isArray(s))
225
- for (let a of s)
226
- a.__click_outside__ = r, a.contains(o.target) && (c = !1);
227
- else
228
- s.contains(o.target) && (c = !1), s.__click_outside__ = r;
229
- c && n != null && n.fn && typeof (n == null ? void 0 : n.fn) == "function" && (n == null || n.fn(o));
230
- }
231
- document.addEventListener("click", r);
232
- },
233
- beforeUnmount: async (e, t) => {
234
- const n = t.value, s = await d(e, n);
235
- if (Array.isArray(s))
236
- for (let r of s)
237
- document.removeEventListener("click", r.__click_outside__), delete r.__click_outside__;
238
- else
239
- document.removeEventListener("click", s.__click_outside__), delete s.__click_outside__;
240
- }
241
- }, B = {
242
- mounted: async (e, t) => {
243
- const n = t.value, s = await d(e, n);
244
- function r(o, c) {
245
- s._inside_event = r, typeof n == "function" ? n(o, c) : n != null && n.fn && typeof (n == null ? void 0 : n.fn) == "function" && (n == null || n.fn(o, c));
246
- }
247
- s.addEventListener("mouseenter", (o) => {
248
- r(!0, o);
249
- }), s.addEventListener("mouseleave", (o) => {
250
- r(!1, o);
251
- });
252
- },
253
- beforeUnmount: async (e, t) => {
254
- const n = t.value, s = await d(e, n);
255
- s.addEventListener("mouseenter", s._inside_event), s.addEventListener("mouseleave", s._inside_event), delete s._inside_event;
256
- }
257
- };
1
+ import { vAuth as e } from "@das-fed/utils/directive/auth";
2
+ import { vClickOutside as v } from "@das-fed/utils/directive/clickOutside";
3
+ import { vHoverInside as i } from "@das-fed/utils/directive/hoverInside";
258
4
  export {
259
- T as vAuth,
260
- N as vClickOutside,
261
- B as vHoverInside
5
+ e as vAuth,
6
+ v as vClickOutside,
7
+ i as vHoverInside
262
8
  };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 获取指定dom
3
+ * @param el
4
+ * @param options
5
+ * @returns
6
+ */
7
+ export declare const getEl: (el: HTMLElement, options: any) => Promise<HTMLElement>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 判断鼠标是否落在一个块级元素内部
3
+ * @param {*} dom 块级元素
4
+ * @returns
5
+ */
6
+ export declare const domCheckIn: (dom: HTMLElement) => boolean;
@@ -0,0 +1,25 @@
1
+ interface Config {
2
+ /** 观察目标节点的子节点的新增和删除;*/
3
+ childList?: boolean;
4
+ /** 观察目标节点的属性节点(新增或删除了某个属性,以及某个属性的属性值发生了变化); */
5
+ attributes?: boolean;
6
+ /** 要监视的特定属性名称的数组,如果未包含此属性,则对所有属性的更改都会触发变动通知; */
7
+ attributeFilter?: any[];
8
+ /** 在attributes属性已经设为true的前提下, 将发生变化的属性节点之前的属性值记录下来(记录在MutationRecord对象的oldValue属性中); */
9
+ attributeOldValue?: boolean;
10
+ /** 在characterData属性已经设为true的前提下,将发生变化characterData节点之前的文本内容记录下来(记录在MutationRecord对象的oldValue属性中); */
11
+ characterDataOldValue?: boolean;
12
+ /** 如果目标节点为characterData节点(一种抽象接口,具体可以为文本节点、注释节点,以及处理指令节点)时,也要观察该节点的文本内容是否发生变化; */
13
+ characterData?: boolean;
14
+ /** 观察目标节点的所有后代节点(观察目标节点所包含的整棵DOM树上的上述三种节点变化); */
15
+ subtree?: boolean;
16
+ }
17
+ /**
18
+ * dom监听器
19
+ * @param cb 回调函数
20
+ * @param dom 目标dom
21
+ * @param config 配置
22
+ * @returns
23
+ */
24
+ declare const DomWatcher: (cb: (list: MutationRecord[]) => void, dom: HTMLElement, config?: Config) => MutationObserver;
25
+ export { DomWatcher };
@@ -0,0 +1,5 @@
1
+ export declare const useZIndex: () => {
2
+ initialZIndex: any;
3
+ currentZIndex: any;
4
+ nextZIndex: () => any;
5
+ };
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from '@das-fed/utils/directive';
2
+ export * from '@das-fed/utils/with-install';
package/index.js CHANGED
@@ -1,266 +1,2 @@
1
- import { ref as w } from "vue";
2
- const v = () => {
3
- let t = { ...(window == null ? void 0 : window.config) || {} };
4
- t.rootContainer || (t.rootContainer = "#app"), t.baseURL || (t.baseURL = location.origin), t.ossBaseURL || (t.ossBaseURL = "/oss"), t.ossBaseURL.startsWith("/") && (t.ossBaseURL = `${t.baseURL}/oss`), t.ssoBaseURL || (t.ssoBaseURL = t.baseURL);
5
- let { microAppName: n, publicPath: s, mainAppName: r } = t;
6
- return n && !0 && !s && (s = `/${n}/`.replace(/\/\//g, "/")), s || (s = "/"), t.publicPath = s, t.autoOssBucket || (t.autoOssBucket = r || n), t;
7
- }, p = (e, t) => {
8
- let n = window.location.search || "";
9
- if (e && e !== location.href) {
10
- const r = e.indexOf("?");
11
- r !== -1 ? n = e.slice(r) : n = "";
12
- }
13
- const s = new URLSearchParams(n);
14
- if (t)
15
- return s.get(t);
16
- {
17
- let r = {};
18
- for (let [c, o] of s.entries())
19
- r[c] = o;
20
- return r;
21
- }
22
- }, y = (e, t = "children", n = !0) => Array.isArray(e) && e.length ? e.reduce((s, r) => {
23
- let c = r[t], o = { ...r };
24
- return n && delete o[t], c && c.length ? s.concat(o, y(c, t, n)) : s.concat(o);
25
- }, []) : [];
26
- /*! js-cookie v3.0.5 | MIT */
27
- function g(e) {
28
- for (var t = 1; t < arguments.length; t++) {
29
- var n = arguments[t];
30
- for (var s in n)
31
- e[s] = n[s];
32
- }
33
- return e;
34
- }
35
- var C = {
36
- read: function(e) {
37
- return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
38
- },
39
- write: function(e) {
40
- return encodeURIComponent(e).replace(
41
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
42
- decodeURIComponent
43
- );
44
- }
45
- };
46
- function _(e, t) {
47
- function n(r, c, o) {
48
- if (!(typeof document > "u")) {
49
- o = g({}, t, o), typeof o.expires == "number" && (o.expires = new Date(Date.now() + o.expires * 864e5)), o.expires && (o.expires = o.expires.toUTCString()), r = encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
50
- var a = "";
51
- for (var i in o)
52
- o[i] && (a += "; " + i, o[i] !== !0 && (a += "=" + o[i].split(";")[0]));
53
- return document.cookie = r + "=" + e.write(c, r) + a;
54
- }
55
- }
56
- function s(r) {
57
- if (!(typeof document > "u" || arguments.length && !r)) {
58
- for (var c = document.cookie ? document.cookie.split("; ") : [], o = {}, a = 0; a < c.length; a++) {
59
- var i = c[a].split("="), u = i.slice(1).join("=");
60
- try {
61
- var f = decodeURIComponent(i[0]);
62
- if (o[f] = e.read(u, f), r === f)
63
- break;
64
- } catch {
65
- }
66
- }
67
- return r ? o[r] : o;
68
- }
69
- }
70
- return Object.create(
71
- {
72
- set: n,
73
- get: s,
74
- remove: function(r, c) {
75
- n(
76
- r,
77
- "",
78
- g({}, c, {
79
- expires: -1
80
- })
81
- );
82
- },
83
- withAttributes: function(r) {
84
- return _(this.converter, g({}, this.attributes, r));
85
- },
86
- withConverter: function(r) {
87
- return _(g({}, this.converter, r), this.attributes);
88
- }
89
- },
90
- {
91
- attributes: { value: Object.freeze(t) },
92
- converter: { value: Object.freeze(e) }
93
- }
94
- );
95
- }
96
- var m = _(C, { path: "/" });
97
- const k = (e) => {
98
- var t = encodeURIComponent(e);
99
- return t = btoa(t), t;
100
- };
101
- w(!1);
102
- v();
103
- k("das123"), +/* @__PURE__ */ new Date();
104
- const S = () => {
105
- const e = new URL(location.href).searchParams, t = e.get("token") || e.get("accessToken") || e.get("accesstoken") || "";
106
- if (t) {
107
- const n = JSON.stringify({ access_token: t });
108
- sessionStorage.setItem("accessToken", t), sessionStorage.setItem("tokenInfo", n), m.set("accessToken", t), m.set("accessTokenInfo", n);
109
- }
110
- }, L = () => {
111
- const e = JSON.parse(sessionStorage.getItem("projectInfo") || "{}"), t = new URL(location.href).searchParams, n = t.get("project") || t.get("projectId") || "";
112
- if (!n)
113
- return;
114
- const s = t.get("projectParent") || t.get("projectParentId") || (e == null ? void 0 : e.parentId) || "", r = t.get("projectName") || (e == null ? void 0 : e.name) || "";
115
- sessionStorage.setItem("project", n), sessionStorage.setItem("projectInfo", JSON.stringify({ ...e, id: n, name: r, parentId: s }));
116
- }, P = () => m.get("accessToken") ?? "", h = (e, t) => {
117
- const n = "permission-btn", s = v(), r = A(), c = p(location.href, "app") || "", o = t || c || (window.__IN_MICRO_APP__ ? r.currentSubAppCode : s.title);
118
- if (!o)
119
- return;
120
- const a = p(location.href, "menu") || "", i = e || a || (window.__IN_MICRO_APP__ ? r.currentSubApp.currentMenuCode : JSON.parse(sessionStorage.getItem(`${s.title}-tabs`) || "{}").currentTab.code), u = JSON.parse(sessionStorage.getItem(n) || "{}");
121
- if (!u || JSON.stringify(u) === "{}")
122
- return;
123
- const f = u[o][i];
124
- return f && f.length ? f : u[o]["origin-auth"] ? u[o]["origin-auth"][i] ?? [] : [];
125
- }, A = () => {
126
- var s;
127
- if (!window.__IN_MICRO_APP__)
128
- return {};
129
- const e = JSON.parse(sessionStorage.getItem("subApps") || "{}"), t = ((s = e.appcategorys) == null ? void 0 : s.map((r) => r.apps).flat()) ?? [];
130
- return {
131
- appcategorys: e.appcategorys ?? [],
132
- currentSubApp: e.currentSubApp ?? {},
133
- currentSubAppCode: e.currentSubAppCode ?? "",
134
- flatSubAppList: t,
135
- subAppList: e.subAppList ?? []
136
- };
137
- }, R = () => {
138
- const e = v();
139
- let t = {};
140
- if (window.__IN_MICRO_APP__) {
141
- const n = JSON.parse(sessionStorage.getItem("tabs") || "{}");
142
- t = {
143
- activeKey: n.activeKey ?? "",
144
- currentTab: n.currentTab ?? {},
145
- tabMap: n.tabMap ?? {}
146
- };
147
- } else {
148
- const n = JSON.parse(sessionStorage.getItem(`${e.title}-tabs`) || "{}");
149
- t = {
150
- activeKey: n.activeKey ?? "",
151
- currentTab: n.currentTab ?? {},
152
- tabList: n.tabList ?? []
153
- };
154
- }
155
- return t;
156
- };
157
- P() || S();
158
- L();
159
- const d = async (e, t) => {
160
- let n = e;
161
- return t != null && t.target && (typeof t.target == "string" && (n = t.target), typeof t.target == "function" && (n = await t.target(e))), n;
162
- }, U = (e, t) => {
163
- if (!e || !t)
164
- return !1;
165
- if (typeof t == "string")
166
- return !!e.find((s) => s.code === t);
167
- {
168
- let n = !1;
169
- for (let s of t)
170
- if (e.find((c) => c.code === s)) {
171
- n = !0;
172
- break;
173
- }
174
- return n;
175
- }
176
- }, I = (e) => {
177
- var o, a;
178
- const t = (e == null ? void 0 : e.code) ?? "", n = (e == null ? void 0 : e.path) ?? location.pathname, s = (e == null ? void 0 : e.applicationCode) ?? "";
179
- let r = "";
180
- if (window.__IN_MICRO_APP__ ? r = e != null && e.menuCode ? e.menuCode : p(location.href, "menu") : r = e != null && e.menuCode ? e.menuCode : (o = R().currentTab) == null ? void 0 : o.code, !r) {
181
- const i = ((a = A().currentSubApp) == null ? void 0 : a.menus) ?? [];
182
- if (i && i.length) {
183
- const u = y(i).filter((f) => f == null ? void 0 : f.routeUrl);
184
- if (u && u.length) {
185
- const f = u.find((l) => l != null && l.applicationPath ? n == null ? void 0 : n.includes("/" + l.applicationPath + l.routeUrl) : n == null ? void 0 : n.includes(l.routeUrl));
186
- f && (r = (f == null ? void 0 : f.code) ?? "");
187
- }
188
- }
189
- }
190
- let c = !1;
191
- if (t) {
192
- const i = h(r, s) ?? [];
193
- c = U(i, t);
194
- } else
195
- c = !!h(r, s);
196
- return c;
197
- }, b = (e, t) => {
198
- t === "hide" ? e.classList.add("is-hide") : (e.setAttribute("disabled", ""), e.classList.add("is-disabled"));
199
- }, O = (e, t) => {
200
- t === "hide" ? e.classList.remove("is-hide") : (e.removeAttribute("disabled"), e.classList.remove("is-disabled"));
201
- }, T = (e, t) => {
202
- let n = (e ? t.value : t) || {};
203
- typeof n == "string" && (n = { code: n });
204
- const s = (n == null ? void 0 : n.type) ?? "hide", r = I(n);
205
- if (e)
206
- if (!t.oldValue)
207
- r || d(e, n).then((c) => {
208
- b(c, s);
209
- });
210
- else {
211
- const c = I(t.oldValue), o = r;
212
- if (c === o)
213
- return;
214
- d(e, n).then((a) => {
215
- o ? O(a, s) : b(a, s);
216
- });
217
- }
218
- return r;
219
- }, N = {
220
- mounted: async (e, t) => {
221
- const n = t.value, s = await d(e, n);
222
- function r(c) {
223
- let o = !0;
224
- if (Array.isArray(s))
225
- for (let a of s)
226
- a.__click_outside__ = r, a.contains(c.target) && (o = !1);
227
- else
228
- s.contains(c.target) && (o = !1), s.__click_outside__ = r;
229
- o && n != null && n.fn && typeof (n == null ? void 0 : n.fn) == "function" && (n == null || n.fn(c));
230
- }
231
- document.addEventListener("click", r);
232
- },
233
- beforeUnmount: async (e, t) => {
234
- const n = t.value, s = await d(e, n);
235
- if (Array.isArray(s))
236
- for (let r of s)
237
- document.removeEventListener("click", r.__click_outside__), delete r.__click_outside__;
238
- else
239
- document.removeEventListener("click", s.__click_outside__), delete s.__click_outside__;
240
- }
241
- }, B = {
242
- mounted: async (e, t) => {
243
- const n = t.value, s = await d(e, n);
244
- function r(c, o) {
245
- s._inside_event = r, typeof n == "function" ? n(c, o) : n != null && n.fn && typeof (n == null ? void 0 : n.fn) == "function" && (n == null || n.fn(c, o));
246
- }
247
- s.addEventListener("mouseenter", (c) => {
248
- r(!0, c);
249
- }), s.addEventListener("mouseleave", (c) => {
250
- r(!1, c);
251
- });
252
- },
253
- beforeUnmount: async (e, t) => {
254
- const n = t.value, s = await d(e, n);
255
- s.addEventListener("mouseenter", s._inside_event), s.addEventListener("mouseleave", s._inside_event), delete s._inside_event;
256
- }
257
- }, j = (e) => (e.install = function(t) {
258
- t.component(e.name, e);
259
- }, e);
260
- export {
261
- v as getConfig,
262
- T as vAuth,
263
- N as vClickOutside,
264
- B as vHoverInside,
265
- j as withInstall
266
- };
1
+ export * from "@das-fed/utils/directive";
2
+ export * from "@das-fed/utils/with-install";
@@ -0,0 +1,3 @@
1
+ /** 使用promise加载js的工具 */
2
+ declare const loadJs: (src: string) => Promise<unknown>;
3
+ export { loadJs };
package/load-js/index.js CHANGED
@@ -1,17 +1,13 @@
1
- const r = () => {
2
- let t = { ...(window == null ? void 0 : window.config) || {} };
3
- t.rootContainer || (t.rootContainer = "#app"), t.baseURL || (t.baseURL = location.origin), t.ossBaseURL || (t.ossBaseURL = "/oss"), t.ossBaseURL.startsWith("/") && (t.ossBaseURL = `${t.baseURL}/oss`), t.ssoBaseURL || (t.ssoBaseURL = t.baseURL);
4
- let { microAppName: i, publicPath: s, mainAppName: o } = t;
5
- return i && !0 && !s && (s = `/${i}/`.replace(/\/\//g, "/")), s || (s = "/"), t.publicPath = s, t.autoOssBucket || (t.autoOssBucket = o || i), t;
6
- }, p = (e) => {
7
- let { baseURL: t, publicPath: i = "" } = r();
8
- if (document.getElementById(e))
1
+ import { getConfig as r } from "@das-fed/utils/config";
2
+ const c = (t) => {
3
+ let { baseURL: i, publicPath: n = "" } = r();
4
+ if (document.getElementById(t))
9
5
  return;
10
- const o = document.createElement("script");
11
- return e.startsWith("/") && (e = `${t}/${i}/${e}`), e = e.replace(/\/\//g, "/").replace(/\/\//g, "/").replace("http:/", "http://").replace("https:/", "https://"), o.src = e, o.id = e, document.body.appendChild(o), new Promise((a, n) => {
12
- o.onload = a, o.onerror = n;
6
+ const e = document.createElement("script");
7
+ return t.startsWith("/") && (t = `${i}/${n}/${t}`), t = t.replace(/\/\//g, "/").replace(/\/\//g, "/").replace("http:/", "http://").replace("https:/", "https://"), e.src = t, e.id = t, document.body.appendChild(e), new Promise((o, p) => {
8
+ e.onload = o, e.onerror = p;
13
9
  });
14
10
  };
15
11
  export {
16
- p as loadJs
12
+ c as loadJs
17
13
  };
package/oss/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const oss: (urlName: any) => string;
2
+ export { oss };
package/oss/index.js CHANGED
@@ -1,15 +1,11 @@
1
- const a = () => {
2
- let s = { ...(window == null ? void 0 : window.config) || {} };
3
- s.rootContainer || (s.rootContainer = "#app"), s.baseURL || (s.baseURL = location.origin), s.ossBaseURL || (s.ossBaseURL = "/oss"), s.ossBaseURL.startsWith("/") && (s.ossBaseURL = `${s.baseURL}/oss`), s.ssoBaseURL || (s.ssoBaseURL = s.baseURL);
4
- let { microAppName: o, publicPath: e, mainAppName: i } = s;
5
- return o && !0 && !e && (e = `/${o}/`.replace(/\/\//g, "/")), e || (e = "/"), s.publicPath = e, s.autoOssBucket || (s.autoOssBucket = i || o), s;
6
- }, n = (t) => {
7
- let s = t;
8
- if (!s)
9
- return s;
10
- s.startsWith("/") || (s = `/${s}`), new URL(s, import.meta.url);
11
- let { baseURL: o } = a();
12
- return `${o}/oss/resource/front-end/auto-upload/pc${s}`;
1
+ import { getConfig as o } from "@das-fed/utils/config";
2
+ const n = (r) => {
3
+ let t = r;
4
+ if (!t)
5
+ return t;
6
+ t.startsWith("/") || (t = `/${t}`), new URL(t, import.meta.url);
7
+ let { baseURL: e } = o();
8
+ return `${e}/oss/resource/front-end/auto-upload/pc${t}`;
13
9
  };
14
10
  export {
15
11
  n as oss