@das-fed/utils 1.0.0 → 1.0.2

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 (66) hide show
  1. package/api-services/index.js +6840 -19720
  2. package/api-services/modules/app-manage.js +6966 -6
  3. package/api-services/modules/authentication.js +6966 -6
  4. package/api-services/modules/bems.js +6970 -11
  5. package/api-services/modules/contract.js +6966 -6
  6. package/api-services/modules/duty-manage.js +6970 -10
  7. package/api-services/modules/enterpriseright.js +6966 -6
  8. package/api-services/modules/file.js +7108 -353
  9. package/api-services/modules/gateway-edge.js +6966 -6
  10. package/api-services/modules/index.js +7163 -437
  11. package/api-services/modules/iot.js +6979 -19
  12. package/api-services/modules/justauth.js +6967 -7
  13. package/api-services/modules/knowledge.js +6966 -6
  14. package/api-services/modules/link.js +6966 -6
  15. package/api-services/modules/permission.js +6966 -6
  16. package/api-services/modules/platformManage.js +6974 -14
  17. package/api-services/modules/portal.js +6966 -6
  18. package/api-services/modules/space-manage.js +6966 -6
  19. package/api-services/modules/super-admin.js +6969 -9
  20. package/api-services/modules/supplier.js +6968 -8
  21. package/api-services/modules/supplychain-manage.js +6966 -6
  22. package/api-services/modules/systemConfiguration.js +6966 -6
  23. package/api-services/modules/tool.js +6966 -6
  24. package/api-services/src/create-service.js +6840 -19720
  25. package/api-services/src/sso.js +1711 -157
  26. package/api-services/src/util.js +1466 -19
  27. package/atob/index.js +9 -10
  28. package/common-info/getIframeUrl.js +14 -11
  29. package/common-info/index.js +194 -269
  30. package/common-info/setInfoFromUrl.js +60 -128
  31. package/common-tools/arr-tools.js +6 -13
  32. package/common-tools/date-format.js +18 -21
  33. package/common-tools/get-url-params.js +47 -88
  34. package/common-tools/handle-data.js +3 -4
  35. package/common-tools/index.js +108 -204
  36. package/common-tools/nest-tree-format.js +22 -49
  37. package/common-tools/obj-tools.js +17 -18
  38. package/common-tools/setHtmlMinWH.js +6 -10
  39. package/common-tools/throttled.js +7 -16
  40. package/config/index.js +8 -25
  41. package/curring-http/index.js +5150 -17289
  42. package/directive/auth.js +205 -97
  43. package/directive/clickOutside.js +25 -49
  44. package/directive/hoverInside.js +18 -35
  45. package/directive/index.js +238 -159
  46. package/directive/utils.js +6 -11
  47. package/dom-check-in/index.js +7 -15
  48. package/dom-watcher/index.js +7 -8
  49. package/hooks/popup-manager/use-zindex.js +17 -36
  50. package/index.js +242 -191
  51. package/load-js/index.js +14 -20
  52. package/oss/index.js +15 -15
  53. package/package.json +7 -11
  54. package/pinyin-first-character/index.js +25011 -12217
  55. package/process-engine-info/index.js +8 -10
  56. package/pure-image-src/index.js +3 -29
  57. package/set-personal-info/index.js +1566 -16
  58. package/size-watcher/index.js +17 -24
  59. package/style/index.js +62 -103
  60. package/style/math.js +16 -31
  61. package/style/style.js +49 -72
  62. package/token-tools/index.js +1594 -152
  63. package/vue/hooks/use-model-value.js +9 -10
  64. package/vue/index.js +9 -10
  65. package/webSocket-service/index.js +162 -135
  66. package/with-install/index.js +5 -7
package/index.js CHANGED
@@ -1,215 +1,266 @@
1
- import { getUrlParams, flatTree } from '@das-fed/utils/common-tools';
2
- import { getTabInfo, getSubApps, getPageAuth } from '@das-fed/utils/common-info';
3
-
4
- const getConfig = () => {
5
- let windowConfig = window?.config || {};
6
- let config = { ...windowConfig };
7
- if (!config.rootContainer)
8
- config.rootContainer = "#app";
9
- if (!config.baseURL)
10
- config.baseURL = location.origin;
11
- if (!config.ossBaseURL)
12
- config.ossBaseURL = "/oss";
13
- if (config.ossBaseURL.startsWith("/"))
14
- config.ossBaseURL = `${config.baseURL}/oss`;
15
- if (!config.ssoBaseURL)
16
- config.ssoBaseURL = config.baseURL;
17
- let { microAppName, publicPath, mainAppName } = config;
18
- const isPro = import.meta.env.PROD;
19
- if (microAppName && isPro && !publicPath)
20
- publicPath = `/${microAppName}/`.replace(/\/\//g, "/");
21
- if (!publicPath)
22
- publicPath = "/";
23
- config.publicPath = publicPath;
24
- if (!config.autoOssBucket)
25
- config.autoOssBucket = mainAppName || microAppName;
26
- return config;
27
- };
28
-
29
- const getEl = async (el, options) => {
30
- let res = el;
31
- if (options?.target) {
32
- if (typeof options.target === "string")
33
- res = options.target;
34
- if (typeof options.target === "function")
35
- res = await options.target(el);
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
+ );
36
44
  }
37
- return res;
38
45
  };
39
-
40
- const hasBtnAuth = (btnList, code) => {
41
- if (!btnList || !code)
42
- return false;
43
- if (typeof code === "string") {
44
- const currentItem = btnList.find((item) => item.code === code);
45
- return !!currentItem;
46
- } else {
47
- let flag = false;
48
- for (let value of code) {
49
- const currentItem = btnList.find((item) => item.code === value);
50
- if (currentItem) {
51
- flag = true;
52
- break;
53
- }
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
54
  }
55
- return flag;
56
55
  }
57
- };
58
- const hasPermission = (options) => {
59
- const code = options?.code ?? "";
60
- const path = options?.path ?? location.pathname;
61
- const applicationCode = options?.applicationCode ?? "";
62
- let menuCode = "";
63
- if (window.__IN_MICRO_APP__) {
64
- menuCode = options?.menuCode ? options.menuCode : getUrlParams(location.href, "menu");
65
- } else {
66
- menuCode = options?.menuCode ? options.menuCode : getTabInfo().currentTab?.code;
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
+ }
67
69
  }
68
- if (!menuCode) {
69
- const currentMenus = getSubApps().currentSubApp?.menus ?? [];
70
- if (currentMenus && currentMenus.length) {
71
- const flatMenus = flatTree(currentMenus).filter((item) => item?.routeUrl);
72
- if (flatMenus && flatMenus.length) {
73
- const currentMenu = flatMenus.find((item) => {
74
- if (item?.applicationPath) {
75
- return path?.includes("/" + item.applicationPath + item.routeUrl);
76
- } else {
77
- return path?.includes(item.routeUrl);
78
- }
79
- });
80
- if (currentMenu)
81
- menuCode = currentMenu?.code ?? "";
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);
82
88
  }
89
+ },
90
+ {
91
+ attributes: { value: Object.freeze(t) },
92
+ converter: { value: Object.freeze(e) }
83
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);
84
109
  }
85
- let flag = false;
86
- if (code) {
87
- const btnList = getPageAuth(menuCode, applicationCode) ?? [];
88
- flag = hasBtnAuth(btnList, code);
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
+ };
89
147
  } else {
90
- flag = !!getPageAuth(menuCode, applicationCode);
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
+ };
91
154
  }
92
- return flag;
155
+ return t;
93
156
  };
94
- const removeEl = (el, type) => {
95
- if (type === "hide") {
96
- el.classList.add("is-hide");
97
- } else {
98
- el.setAttribute("disabled", "");
99
- el.classList.add("is-disabled");
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;
100
175
  }
101
- };
102
- const addEl = (el, type) => {
103
- if (type === "hide") {
104
- el.classList.remove("is-hide");
105
- } else {
106
- el.removeAttribute("disabled");
107
- el.classList.remove("is-disabled");
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
+ }
108
189
  }
109
- };
110
- const vAuth = (el, binding) => {
111
- let options = (el ? binding.value : binding) || {};
112
- if (typeof options === "string")
113
- options = { code: options };
114
- const type = options?.type ?? "hide";
115
- const isPermission = hasPermission(options);
116
- if (el) {
117
- if (!binding.oldValue) {
118
- if (!isPermission)
119
- getEl(el, options).then((element) => {
120
- removeEl(element, type);
121
- });
122
- } else {
123
- const oldHasPermission = hasPermission(binding.oldValue);
124
- const newHasPermission = isPermission;
125
- if (oldHasPermission === newHasPermission)
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)
126
213
  return;
127
- getEl(el, options).then((element) => {
128
- if (newHasPermission) {
129
- addEl(element, type);
130
- } else {
131
- removeEl(element, type);
132
- }
214
+ d(e, n).then((a) => {
215
+ o ? O(a, s) : b(a, s);
133
216
  });
134
217
  }
135
- }
136
- return isPermission;
137
- };
138
-
139
- const vClickOutside = {
140
- mounted: async (el, binding) => {
141
- const options = binding.value;
142
- const targetEl = await getEl(el, options);
143
- function eventHandler(e) {
144
- let flag = true;
145
- if (Array.isArray(targetEl)) {
146
- for (let dom of targetEl) {
147
- dom.__click_outside__ = eventHandler;
148
- if (dom.contains(e.target))
149
- flag = false;
150
- }
151
- } else {
152
- if (targetEl.contains(e.target)) {
153
- flag = false;
154
- }
155
- targetEl.__click_outside__ = eventHandler;
156
- }
157
- if (flag) {
158
- if (options?.fn && typeof options?.fn === "function") {
159
- options?.fn(e);
160
- }
161
- }
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));
162
230
  }
163
- document.addEventListener("click", eventHandler);
231
+ document.addEventListener("click", r);
164
232
  },
165
- beforeUnmount: async (el, binding) => {
166
- const options = binding.value;
167
- const targetEl = await getEl(el, options);
168
- if (Array.isArray(targetEl)) {
169
- for (let dom of targetEl) {
170
- document.removeEventListener("click", dom.__click_outside__);
171
- delete dom.__click_outside__;
172
- }
173
- } else {
174
- document.removeEventListener("click", targetEl.__click_outside__);
175
- delete targetEl.__click_outside__;
176
- }
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__;
177
240
  }
178
- };
179
-
180
- const vHoverInside = {
181
- mounted: async (el, binding) => {
182
- const options = binding.value;
183
- const targetEl = await getEl(el, options);
184
- function eventHandler(flag, e) {
185
- targetEl._inside_event = eventHandler;
186
- if (typeof options === "function") {
187
- options(flag, e);
188
- } else if (options?.fn && typeof options?.fn === "function") {
189
- options?.fn(flag, e);
190
- }
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));
191
246
  }
192
- targetEl.addEventListener("mouseenter", (e) => {
193
- eventHandler(true, e);
194
- });
195
- targetEl.addEventListener("mouseleave", (e) => {
196
- eventHandler(false, e);
247
+ s.addEventListener("mouseenter", (c) => {
248
+ r(!0, c);
249
+ }), s.addEventListener("mouseleave", (c) => {
250
+ r(!1, c);
197
251
  });
198
252
  },
199
- beforeUnmount: async (el, binding) => {
200
- const options = binding.value;
201
- const targetEl = await getEl(el, options);
202
- targetEl.addEventListener("mouseenter", targetEl._inside_event);
203
- targetEl.addEventListener("mouseleave", targetEl._inside_event);
204
- delete targetEl._inside_event;
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;
205
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
206
266
  };
207
-
208
- const withInstall = (comp) => {
209
- comp.install = function(app) {
210
- app.component(comp.name, comp);
211
- };
212
- return comp;
213
- };
214
-
215
- export { getConfig, vAuth, vClickOutside, vHoverInside, withInstall };
package/load-js/index.js CHANGED
@@ -1,23 +1,17 @@
1
- import { getConfig } from '@das-fed/utils/config';
2
-
3
- const loadJs = (src) => {
4
- let { baseURL, publicPath = "" } = getConfig();
5
- const existingScript = document.getElementById(src);
6
- if (existingScript)
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))
7
9
  return;
8
- const script = document.createElement("script");
9
- if (import.meta.env.PROD) {
10
- if (src.startsWith("/"))
11
- src = `${baseURL}/${publicPath}/${src}`;
12
- src = src.replace(/\/\//g, "/").replace(/\/\//g, "/").replace("http:/", "http://").replace("https:/", "https://");
13
- }
14
- script.src = src;
15
- script.id = src;
16
- document.body.appendChild(script);
17
- return new Promise((resolve, reject) => {
18
- script.onload = resolve;
19
- script.onerror = reject;
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;
20
13
  });
21
14
  };
22
-
23
- export { loadJs };
15
+ export {
16
+ p as loadJs
17
+ };
package/oss/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { getConfig } from '@das-fed/utils/config';
2
-
3
- const oss = (urlName) => {
4
- let url = urlName;
5
- if (!url)
6
- return url;
7
- if (!url.startsWith("/"))
8
- url = `/${url}`;
9
- const fileURL = new URL(url, import.meta.url);
10
- if (import.meta.env.DEV)
11
- return fileURL.pathname;
12
- let { baseURL } = getConfig();
13
- return `${baseURL}/oss/resource/front-end/auto-upload/pc${url}`;
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}`;
13
+ };
14
+ export {
15
+ n as oss
14
16
  };
15
-
16
- export { oss };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@das-fed/utils",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -8,8 +8,8 @@
8
8
  "author": "",
9
9
  "license": "ISC",
10
10
  "dependencies": {
11
- "@das-fed/ui": "0.1.0",
12
- "@das-fed/utils": "1.0.0",
11
+ "@das-fed/ui": "1.1.2",
12
+ "@das-fed/utils": "1.0.2",
13
13
  "@vue/shared": "^3.4.21",
14
14
  "axios": "^1.6.7",
15
15
  "dayjs": "^1.11.10",
@@ -19,8 +19,7 @@
19
19
  "vue": "^3.4.21"
20
20
  },
21
21
  "devDependencies": {
22
- "@rollup/plugin-commonjs": "^25.0.7",
23
- "@rollup/plugin-node-resolve": "^15.2.3",
22
+ "@vitejs/plugin-vue": "^5.0.4",
24
23
  "ant-design-vue": "^4.1.2",
25
24
  "consola": "^3.2.3",
26
25
  "element-plus": "^2.5.6",
@@ -28,14 +27,11 @@
28
27
  "fs-extra": "^11.2.0",
29
28
  "js-cookie": "^3.0.5",
30
29
  "qs": "^6.11.2",
31
- "rollup": "^4.12.0",
32
- "rollup-plugin-esbuild": "^6.1.1",
33
- "rollup-plugin-vue": "^6.0.0",
34
- "sass": "^1.70.0"
30
+ "sass": "^1.70.0",
31
+ "vite": "^5.1.6"
35
32
  },
36
33
  "peerDependencies": {
37
- "@das-fed/ui": "^1.0.0",
38
- "axios": "^1.6.7"
34
+ "@das-fed/ui": "^1.0.0"
39
35
  },
40
36
  "publishConfig": {
41
37
  "access": "public",