@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
@@ -1,213 +1,7 @@
1
- const dateFormat = (value, fmt = "yyyy-MM-dd HH:mm:ss") => {
2
- let date = value ? new Date(value) : /* @__PURE__ */ new Date();
3
- var o = {
4
- "M+": date.getMonth() + 1,
5
- "d+": date.getDate(),
6
- "H+": date.getHours(),
7
- "m+": date.getMinutes(),
8
- "s+": date.getSeconds(),
9
- "q+": Math.floor((date.getMonth() + 3) / 3),
10
- S: date.getMilliseconds()
11
- };
12
- var year = date.getFullYear().toString();
13
- year = year.length >= 4 ? year : "0000".substr(0, 4 - year.length) + year;
14
- if (/(y+)/.test(fmt))
15
- fmt = fmt.replace(RegExp.$1, (year + "").substr(4 - RegExp.$1.length));
16
- for (var k in o)
17
- if (new RegExp("(" + k + ")").test(fmt))
18
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
19
- return fmt;
20
- };
21
-
22
- const getUrlParams = (allUrl, name) => {
23
- let search = window.location.search || "";
24
- if (allUrl && allUrl !== location.href) {
25
- const index = allUrl.indexOf("?");
26
- if (index !== -1) {
27
- search = allUrl.slice(index);
28
- } else {
29
- search = "";
30
- }
31
- }
32
- const params = new URLSearchParams(search);
33
- if (name) {
34
- return params.get(name);
35
- } else {
36
- let allParams = {};
37
- for (let [key, value] of params.entries()) {
38
- allParams[key] = value;
39
- }
40
- return allParams;
41
- }
42
- };
43
- const getFullPath = (url, params = {}) => {
44
- let result = "";
45
- let query = "";
46
- const keys = Object.keys(params);
47
- if (keys && keys.length) {
48
- keys.forEach((key, index) => {
49
- if (index === keys.length - 1) {
50
- query += `${key}=${params[key]}`;
51
- } else {
52
- query += `${key}=${params[key]}&`;
53
- }
54
- });
55
- }
56
- if (query) {
57
- result = location.origin + url + `?${query}`;
58
- } else {
59
- result = location.origin + url;
60
- }
61
- return result;
62
- };
63
- const funcUrlDel = (names, url) => {
64
- const preUrl = url ? url : location.href;
65
- const params = getUrlParams(preUrl);
66
- const keys = Object.keys(params) || [];
67
- if (!keys || !keys.length)
68
- return preUrl.includes("?") ? preUrl.split("?")[0] : preUrl.split("&")[0];
69
- let paramsResult = keys.filter((item) => !names.includes(item));
70
- if (!paramsResult || !paramsResult.length)
71
- return preUrl.includes("?") ? preUrl.split("?")[0] : preUrl.split("&")[0];
72
- let query = "";
73
- paramsResult.forEach((key, index) => {
74
- if (index === keys.length - 1) {
75
- query += `${key}=${params[key]}`;
76
- } else {
77
- query += `${key}=${params[key]}&`;
78
- }
79
- });
80
- return preUrl.includes("?") ? preUrl.split("?")[0] + `?${query}` : preUrl.split("&")[0] + `?${query}`;
81
- };
82
- const urlParamsToObject = (url) => {
83
- const searchParams = new URLSearchParams(url.split("?")[1]);
84
- const params = {};
85
- for (const [key, value] of searchParams) {
86
- if (params.hasOwnProperty(key)) {
87
- if (Array.isArray(params[key])) {
88
- params[key].push(value);
89
- } else {
90
- params[key] = [params[key], value];
91
- }
92
- } else {
93
- params[key] = value;
94
- }
95
- }
96
- return params;
97
- };
98
- const objectToUrlparams = (params) => {
99
- let query = "";
100
- const keys = Object.keys(params);
101
- if (keys && keys.length) {
102
- keys.forEach((key, index) => {
103
- if (index === keys.length - 1) {
104
- query += `${key}=${params[key]}`;
105
- } else {
106
- query += `${key}=${params[key]}&`;
107
- }
108
- });
109
- }
110
- return query;
111
- };
112
-
113
- const findNonEmptyChildrenItems = (arr, children = "children") => {
114
- let result = [];
115
- for (let i = 0; i < arr.length; i++) {
116
- if (arr[i][children] && arr[i][children].length > 0) {
117
- result.push(arr[i]);
118
- result = result.concat(findNonEmptyChildrenItems(arr[i][children]));
119
- }
120
- }
121
- return result;
122
- };
123
- const flatTree = (list, child = "children", deleteChild = true) => {
124
- if (Array.isArray(list) && list.length) {
125
- return list.reduce((ls, item) => {
126
- let children = item[child];
127
- let res = { ...item };
128
- if (deleteChild) {
129
- delete res[child];
130
- }
131
- if (children && children.length) {
132
- return ls.concat(res, flatTree(children, child, deleteChild));
133
- } else {
134
- return ls.concat(res);
135
- }
136
- }, []);
137
- } else {
138
- return [];
139
- }
140
- };
141
- const filterTreeArray = (tree, predicate, children = "children") => {
142
- return tree.filter((item) => {
143
- return predicate(item);
144
- }).map((item) => {
145
- item = Object.assign({}, item);
146
- if (item[children]) {
147
- item[children] = filterTreeArray(item[children], predicate);
148
- }
149
- return item;
150
- });
151
- };
152
- const treeFind = (tree, func) => {
153
- for (const data of tree) {
154
- if (func(data))
155
- return data;
156
- if (data?.children && data.children.length) {
157
- const res = treeFind(data.children, func);
158
- if (res)
159
- return res;
160
- }
161
- }
162
- return null;
163
- };
164
-
165
- const objEqual = (a, b) => {
166
- if (!a || !b)
167
- return false;
168
- if (Object.keys(a).length !== Object.keys(b).length)
169
- return false;
170
- for (let key in a) {
171
- if (b[key] === void 0)
172
- return false;
173
- if (typeof b[key] === "function" || typeof a[key] === "function")
174
- throw new Error("type error");
175
- if (typeof b[key] != typeof a[key])
176
- return false;
177
- if (typeof a[key] === "object")
178
- return objEqual(a[key], b[key]);
179
- if (a[key] !== b[key])
180
- return false;
181
- }
182
- return true;
183
- };
184
-
185
- const arrEqual = (a, b, isSort = true) => {
186
- if (a.length !== b.length)
187
- return false;
188
- if (isSort) {
189
- return a.sort().toString() === b.sort().toString();
190
- } else {
191
- return a.toString() === b.toString();
192
- }
193
- };
194
- const arrUnique = (arr, val) => {
195
- const res = /* @__PURE__ */ new Map();
196
- return arr.filter((item) => !res.has(item[val]) && res.set(item[val], 1));
197
- };
198
-
199
- const isEmpty = (value) => {
200
- return !!(value === null || typeof value === "undefined" || value === "");
201
- };
202
-
203
- const setHtmlMinWH = (layout) => {
204
- let minWidth = "", minHeight = "";
205
- if (layout?.minWidth)
206
- minWidth = layout.minWidth;
207
- if (layout?.minHeight)
208
- minHeight = layout.minHeight;
209
- document.documentElement.style.minWidth = minWidth;
210
- document.documentElement.style.minHeight = minHeight;
211
- };
212
-
213
- export { arrEqual, arrUnique, dateFormat, filterTreeArray, findNonEmptyChildrenItems, flatTree, funcUrlDel, getFullPath, getUrlParams, isEmpty, objEqual, objectToUrlparams, setHtmlMinWH, treeFind, urlParamsToObject };
1
+ export * from "@das-fed/utils/common-tools/date-format";
2
+ export * from "@das-fed/utils/common-tools/get-url-params";
3
+ export * from "@das-fed/utils/common-tools/nest-tree-format";
4
+ export * from "@das-fed/utils/common-tools/obj-tools";
5
+ export * from "@das-fed/utils/common-tools/arr-tools";
6
+ export * from "@das-fed/utils/common-tools/handle-data";
7
+ export * from "@das-fed/utils/common-tools/setHtmlMinWH";
@@ -0,0 +1,30 @@
1
+ /**
2
+ * 过滤掉叶子节点,返回嵌套数组
3
+ * @param arr 要过滤的树
4
+ * @param children 子节点指定字段名,默认‘children’
5
+ * @returns 返回过滤掉叶子节点的嵌套数组
6
+ */
7
+ export declare const findNonEmptyChildrenItems: (arr: any[], children?: string) => any[];
8
+ /**
9
+ * 树形数组转扁平数组
10
+ * @param list 要拍平的树
11
+ * @param child 子节点指定字段名,默认‘children’
12
+ * @param deleteChild 是否删除children字段,默认为true
13
+ * @returns
14
+ */
15
+ export declare const flatTree: (list: any[], child?: string, deleteChild?: boolean) => any[];
16
+ /**
17
+ * 根据条件过滤节点
18
+ * @param tree 要过滤的树
19
+ * @param predicate 过滤条件,符合条件的节点保留
20
+ * @param children 子节点指定字段名,默认‘children’
21
+ * @returns
22
+ */
23
+ export declare const filterTreeArray: (tree: any[], predicate: (node: any) => boolean, children?: string) => any[];
24
+ /**
25
+ * 树结构查找节点,深度优先
26
+ * @param tree 要过滤的树
27
+ * @param func 过滤条件,符合条件的节点保留(参数为函数,返回值为布尔值)
28
+ * @returns 查找到的节点
29
+ */
30
+ export declare const treeFind: (tree: any[], func: (node: any) => boolean) => any;
@@ -1,53 +1,26 @@
1
- const findNonEmptyChildrenItems = (arr, children = "children") => {
2
- let result = [];
3
- for (let i = 0; i < arr.length; i++) {
4
- if (arr[i][children] && arr[i][children].length > 0) {
5
- result.push(arr[i]);
6
- result = result.concat(findNonEmptyChildrenItems(arr[i][children]));
7
- }
8
- }
9
- return result;
10
- };
11
- const flatTree = (list, child = "children", deleteChild = true) => {
12
- if (Array.isArray(list) && list.length) {
13
- return list.reduce((ls, item) => {
14
- let children = item[child];
15
- let res = { ...item };
16
- if (deleteChild) {
17
- delete res[child];
18
- }
19
- if (children && children.length) {
20
- return ls.concat(res, flatTree(children, child, deleteChild));
21
- } else {
22
- return ls.concat(res);
23
- }
24
- }, []);
25
- } else {
26
- return [];
27
- }
28
- };
29
- const filterTreeArray = (tree, predicate, children = "children") => {
30
- return tree.filter((item) => {
31
- return predicate(item);
32
- }).map((item) => {
33
- item = Object.assign({}, item);
34
- if (item[children]) {
35
- item[children] = filterTreeArray(item[children], predicate);
36
- }
37
- return item;
38
- });
39
- };
40
- const treeFind = (tree, func) => {
41
- for (const data of tree) {
42
- if (func(data))
43
- return data;
44
- if (data?.children && data.children.length) {
45
- const res = treeFind(data.children, func);
46
- if (res)
47
- return res;
1
+ const o = (n, t = "children") => {
2
+ let r = [];
3
+ for (let e = 0; e < n.length; e++)
4
+ n[e][t] && n[e][t].length > 0 && (r.push(n[e]), r = r.concat(o(n[e][t])));
5
+ return r;
6
+ }, c = (n, t = "children", r = !0) => Array.isArray(n) && n.length ? n.reduce((e, f) => {
7
+ let l = f[t], u = { ...f };
8
+ return r && delete u[t], l && l.length ? e.concat(u, c(l, t, r)) : e.concat(u);
9
+ }, []) : [], s = (n, t, r = "children") => n.filter((e) => t(e)).map((e) => (e = Object.assign({}, e), e[r] && (e[r] = s(e[r], t)), e)), h = (n, t) => {
10
+ for (const r of n) {
11
+ if (t(r))
12
+ return r;
13
+ if (r != null && r.children && r.children.length) {
14
+ const e = h(r.children, t);
15
+ if (e)
16
+ return e;
48
17
  }
49
18
  }
50
19
  return null;
51
20
  };
52
-
53
- export { filterTreeArray, findNonEmptyChildrenItems, flatTree, treeFind };
21
+ export {
22
+ s as filterTreeArray,
23
+ o as findNonEmptyChildrenItems,
24
+ c as flatTree,
25
+ h as treeFind
26
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 判断两个对象内容值是否相等
3
+ * @param a 对象一
4
+ * @param b 对象二
5
+ * @returns 相等返回true,不相等返回false
6
+ */
7
+ export declare const objEqual: (a: Record<string, any>, b: Record<string, any>) => boolean;
@@ -1,21 +1,20 @@
1
- const objEqual = (a, b) => {
2
- if (!a || !b)
3
- return false;
4
- if (Object.keys(a).length !== Object.keys(b).length)
5
- return false;
6
- for (let key in a) {
7
- if (b[key] === void 0)
8
- return false;
9
- if (typeof b[key] === "function" || typeof a[key] === "function")
1
+ const f = (t, r) => {
2
+ if (!t || !r || Object.keys(t).length !== Object.keys(r).length)
3
+ return !1;
4
+ for (let e in t) {
5
+ if (r[e] === void 0)
6
+ return !1;
7
+ if (typeof r[e] == "function" || typeof t[e] == "function")
10
8
  throw new Error("type error");
11
- if (typeof b[key] != typeof a[key])
12
- return false;
13
- if (typeof a[key] === "object")
14
- return objEqual(a[key], b[key]);
15
- if (a[key] !== b[key])
16
- return false;
9
+ if (typeof r[e] != typeof t[e])
10
+ return !1;
11
+ if (typeof t[e] == "object")
12
+ return f(t[e], r[e]);
13
+ if (t[e] !== r[e])
14
+ return !1;
17
15
  }
18
- return true;
16
+ return !0;
17
+ };
18
+ export {
19
+ f as objEqual
19
20
  };
20
-
21
- export { objEqual };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 自定义html最小宽高
3
+ * @param layout minWidth、minHeight为空则为重置
4
+ */
5
+ export declare const setHtmlMinWH: (layout?: Record<'minWidth' | 'minHeight', string>) => void;
@@ -1,11 +1,7 @@
1
- const setHtmlMinWH = (layout) => {
2
- let minWidth = "", minHeight = "";
3
- if (layout?.minWidth)
4
- minWidth = layout.minWidth;
5
- if (layout?.minHeight)
6
- minHeight = layout.minHeight;
7
- document.documentElement.style.minWidth = minWidth;
8
- document.documentElement.style.minHeight = minHeight;
1
+ const m = (i) => {
2
+ let e = "", n = "";
3
+ i != null && i.minWidth && (e = i.minWidth), i != null && i.minHeight && (n = i.minHeight), document.documentElement.style.minWidth = e, document.documentElement.style.minHeight = n;
4
+ };
5
+ export {
6
+ m as setHtmlMinWH
9
7
  };
10
-
11
- export { setHtmlMinWH };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 节流: n 秒内只运行一次,若在 n 秒内重复触发,只有一次生效
3
+ * @param fn 需执行的方法
4
+ * @param delay 延迟时长,默认300ms
5
+ * @returns
6
+ */
7
+ export declare function throttled(fn: Function, delay?: number): (this: any) => void;
@@ -1,19 +1,10 @@
1
- function throttled(fn, delay = 300) {
2
- let timer = null;
3
- let starttime = Date.now();
1
+ function u(t, i = 300) {
2
+ let e = null, l = Date.now();
4
3
  return function() {
5
- let curTime = Date.now();
6
- let remaining = delay - (curTime - starttime);
7
- let context = this;
8
- let args = arguments;
9
- clearTimeout(timer);
10
- if (remaining <= 0) {
11
- fn.apply(context, args);
12
- starttime = Date.now();
13
- } else {
14
- timer = setTimeout(fn, remaining);
15
- }
4
+ let r = Date.now(), n = i - (r - l), o = this, a = arguments;
5
+ clearTimeout(e), n <= 0 ? (t.apply(o, a), l = Date.now()) : e = setTimeout(t, n);
16
6
  };
17
7
  }
18
-
19
- export { throttled };
8
+ export {
9
+ u as throttled
10
+ };
@@ -0,0 +1,2 @@
1
+ declare const getConfig: () => any;
2
+ export { getConfig };
package/config/index.js CHANGED
@@ -1,26 +1,9 @@
1
- const getConfig = () => {
2
- let windowConfig = window?.config || {};
3
- let config = { ...windowConfig };
4
- if (!config.rootContainer)
5
- config.rootContainer = "#app";
6
- if (!config.baseURL)
7
- config.baseURL = location.origin;
8
- if (!config.ossBaseURL)
9
- config.ossBaseURL = "/oss";
10
- if (config.ossBaseURL.startsWith("/"))
11
- config.ossBaseURL = `${config.baseURL}/oss`;
12
- if (!config.ssoBaseURL)
13
- config.ssoBaseURL = config.baseURL;
14
- let { microAppName, publicPath, mainAppName } = config;
15
- const isPro = import.meta.env.PROD;
16
- if (microAppName && isPro && !publicPath)
17
- publicPath = `/${microAppName}/`.replace(/\/\//g, "/");
18
- if (!publicPath)
19
- publicPath = "/";
20
- config.publicPath = publicPath;
21
- if (!config.autoOssBucket)
22
- config.autoOssBucket = mainAppName || microAppName;
23
- return config;
1
+ const n = () => {
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: i, publicPath: o, mainAppName: e } = s;
5
+ return i && !0 && !o && (o = `/${i}/`.replace(/\/\//g, "/")), o || (o = "/"), s.publicPath = o, s.autoOssBucket || (s.autoOssBucket = e || i), s;
6
+ };
7
+ export {
8
+ n as getConfig
24
9
  };
25
-
26
- export { getConfig };
@@ -0,0 +1,11 @@
1
+ import type { Ref, ComputedRef } from 'vue';
2
+ import type { CurringConfigFun, CurringConfig, CurringRes } from './type';
3
+ /** 第一层(接入层):接收封装后的axios实例,第二个参数是全局请求配置,配置项参考AxiosRequestConfig */
4
+ declare const curringHttp: (axiosInstance: any, globalConfig?: CurringConfigFun) => {
5
+ get: (url: string | Ref | ComputedRef, urlConfig?: CurringConfigFun) => (payload?: any, payloadConfig?: CurringConfig) => CurringRes;
6
+ post: (url: string | Ref | ComputedRef, urlConfig?: CurringConfigFun) => (payload?: any, payloadConfig?: CurringConfig) => CurringRes;
7
+ put: (url: string | Ref | ComputedRef, urlConfig?: CurringConfigFun) => (payload?: any, payloadConfig?: CurringConfig) => CurringRes;
8
+ patch: (url: string | Ref | ComputedRef, urlConfig?: CurringConfigFun) => (payload?: any, payloadConfig?: CurringConfig) => CurringRes;
9
+ delete: (url: string | Ref | ComputedRef, urlConfig?: CurringConfigFun) => (payload?: any, payloadConfig?: CurringConfig) => CurringRes;
10
+ };
11
+ export { curringHttp };