@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,41 +1,22 @@
1
- import { ref, getCurrentInstance, inject, computed, unref } from 'vue';
2
-
3
- const isNumber = (val) => typeof val === "number";
4
-
5
- const zIndex = ref(0);
6
- const defaultInitialZIndex = 2e3;
7
- const zIndexContextKey = Symbol("zIndexContextKey");
8
- const useZIndex$1 = (zIndexOverrides) => {
9
- const zIndexInjection = zIndexOverrides || (getCurrentInstance() ? inject(zIndexContextKey, void 0) : void 0);
10
- const initialZIndex = computed(() => {
11
- const zIndexFromInjection = unref(zIndexInjection);
12
- return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
13
- });
14
- const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
15
- const nextZIndex = () => {
16
- zIndex.value++;
17
- return currentZIndex.value;
18
- };
1
+ import { ref as I, getCurrentInstance as u, inject as s, computed as e, unref as i } from "vue";
2
+ const Z = (n) => typeof n == "number", d = I(0), l = 2e3, a = Symbol("zIndexContextKey"), m = (n) => {
3
+ const t = n || (u() ? s(a, void 0) : void 0), r = e(() => {
4
+ const c = i(t);
5
+ return Z(c) ? c : l;
6
+ }), x = e(() => r.value + d.value);
19
7
  return {
20
- initialZIndex,
21
- currentZIndex,
22
- nextZIndex
23
- };
24
- };
25
-
26
- const elementZindex = useZIndex$1();
27
- const useZIndex = () => {
28
- const initialZIndex = computed(() => elementZindex.initialZIndex.value);
29
- const currentZIndex = computed(() => elementZindex.currentZIndex.value);
30
- const nextZIndex = () => {
31
- const currentZIndex2 = elementZindex.nextZIndex();
32
- return currentZIndex2;
8
+ initialZIndex: r,
9
+ currentZIndex: x,
10
+ nextZIndex: () => (d.value++, x.value)
33
11
  };
12
+ }, o = m(), z = () => {
13
+ const n = e(() => o.initialZIndex.value), t = e(() => o.currentZIndex.value);
34
14
  return {
35
- initialZIndex,
36
- currentZIndex,
37
- nextZIndex
15
+ initialZIndex: n,
16
+ currentZIndex: t,
17
+ nextZIndex: () => o.nextZIndex()
38
18
  };
39
19
  };
40
-
41
- export { useZIndex };
20
+ export {
21
+ z as useZIndex
22
+ };
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,215 +1,2 @@
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);
36
- }
37
- return res;
38
- };
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
- }
54
- }
55
- return flag;
56
- }
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;
67
- }
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 ?? "";
82
- }
83
- }
84
- }
85
- let flag = false;
86
- if (code) {
87
- const btnList = getPageAuth(menuCode, applicationCode) ?? [];
88
- flag = hasBtnAuth(btnList, code);
89
- } else {
90
- flag = !!getPageAuth(menuCode, applicationCode);
91
- }
92
- return flag;
93
- };
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");
100
- }
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");
108
- }
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)
126
- return;
127
- getEl(el, options).then((element) => {
128
- if (newHasPermission) {
129
- addEl(element, type);
130
- } else {
131
- removeEl(element, type);
132
- }
133
- });
134
- }
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
- }
162
- }
163
- document.addEventListener("click", eventHandler);
164
- },
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
- }
177
- }
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
- }
191
- }
192
- targetEl.addEventListener("mouseenter", (e) => {
193
- eventHandler(true, e);
194
- });
195
- targetEl.addEventListener("mouseleave", (e) => {
196
- eventHandler(false, e);
197
- });
198
- },
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;
205
- }
206
- };
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 };
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,23 +1,13 @@
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
+ 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))
7
5
  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;
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;
20
9
  });
21
10
  };
22
-
23
- export { loadJs };
11
+ export {
12
+ c as loadJs
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,16 +1,12 @@
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
+ 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}`;
9
+ };
10
+ export {
11
+ n as oss
14
12
  };
15
-
16
- export { oss };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@das-fed/utils",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
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": "1.0.2",
12
- "@das-fed/utils": "1.0.1",
11
+ "@das-fed/ui": "1.1.2",
12
+ "@das-fed/utils": "1.0.3",
13
13
  "@vue/shared": "^3.4.21",
14
14
  "axios": "^1.6.7",
15
15
  "dayjs": "^1.11.10",
@@ -19,23 +19,18 @@
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",
24
- "ant-design-vue": "^4.1.2",
22
+ "@vitejs/plugin-vue": "^5.0.4",
25
23
  "consola": "^3.2.3",
26
- "element-plus": "^2.5.6",
24
+ "element-plus": "2.4.2",
27
25
  "fast-glob": "^3.3.2",
28
26
  "fs-extra": "^11.2.0",
29
27
  "js-cookie": "^3.0.5",
30
28
  "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"
29
+ "vite": "^5.1.6",
30
+ "vite-plugin-dts": "^3.7.3"
35
31
  },
36
32
  "peerDependencies": {
37
- "@das-fed/ui": "^1.0.0",
38
- "axios": "^1.6.7"
33
+ "@das-fed/ui": "^1.0.0"
39
34
  },
40
35
  "publishConfig": {
41
36
  "access": "public",
@@ -0,0 +1,2 @@
1
+ /** 获取输入内容中的中文拼音首字符,如:汉字 --> hz; test汉字拼音test --> hzpy */
2
+ export declare const getPinyinFirstCharacter: (value: string) => any;