@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
@@ -1,27 +1,20 @@
1
- import { ref, onMounted } from 'vue';
2
-
3
- const SizeWatcher = (cb, dom) => {
4
- const watchDom = dom || document.documentElement;
5
- const objResizeObserver = new ResizeObserver((entries) => {
6
- const entry = entries[0];
7
- cb(entry.contentRect);
1
+ import { ref as r, onMounted as u } from "vue";
2
+ const i = (e, t) => {
3
+ const n = t || document.documentElement, o = new ResizeObserver((c) => {
4
+ const s = c[0];
5
+ e(s.contentRect);
8
6
  });
9
- if (dom !== null)
10
- objResizeObserver.observe(watchDom);
11
- return objResizeObserver;
12
- };
13
- const useSizeWatcher = () => {
14
- const el = ref(null);
15
- const rect = ref({ bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0, toJSON: () => {
7
+ return t !== null && o.observe(n), o;
8
+ }, h = () => {
9
+ const e = r(null), t = r({ bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0, toJSON: () => {
16
10
  } });
17
- onMounted(() => {
18
- SizeWatcher((val) => {
19
- rect.value = val;
20
- }, el.value);
21
- if (!el.value)
22
- return;
23
- });
24
- return { el, rect };
11
+ return u(() => {
12
+ i((n) => {
13
+ t.value = n;
14
+ }, e.value), e.value;
15
+ }), { el: e, rect: t };
16
+ };
17
+ export {
18
+ i as SizeWatcher,
19
+ h as useSizeWatcher
25
20
  };
26
-
27
- export { SizeWatcher, useSizeWatcher };
package/style/index.js CHANGED
@@ -3,113 +3,72 @@
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
-
7
- !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
8
- !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
9
- const cacheStringFunction = (fn) => {
10
- const cache = /* @__PURE__ */ Object.create(null);
11
- return (str) => {
12
- const hit = cache[str];
13
- return hit || (cache[str] = fn(str));
14
- };
15
- };
16
- const camelizeRE = /-(\w)/g;
17
- const camelize = cacheStringFunction((str) => {
18
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
19
- });
20
-
21
- const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
22
- const hasClass = (el, cls) => {
23
- if (!el || !cls)
24
- return false;
25
- if (cls.includes(" "))
6
+ process.env.NODE_ENV !== "production" && Object.freeze({});
7
+ process.env.NODE_ENV !== "production" && Object.freeze([]);
8
+ const u = (t) => {
9
+ const e = /* @__PURE__ */ Object.create(null);
10
+ return (r) => e[r] || (e[r] = t(r));
11
+ }, m = /-(\w)/g, p = u((t) => t.replace(m, (e, r) => r ? r.toUpperCase() : "")), a = (t = "") => t.split(" ").filter((e) => !!e.trim()), h = (t, e) => {
12
+ if (!t || !e)
13
+ return !1;
14
+ if (e.includes(" "))
26
15
  throw new Error("className should not contain space.");
27
- return el.classList.contains(cls);
28
- };
29
- const addClass = (el, cls) => {
30
- if (!el || !cls.trim())
31
- return;
32
- el.classList.add(...classNameToArray(cls));
33
- };
34
- const removeClass = (el, cls) => {
35
- if (!el || !cls.trim())
36
- return;
37
- el.classList.remove(...classNameToArray(cls));
38
- };
39
- const getStyle = (element, styleName) => {
40
- if (!element || !styleName)
16
+ return t.classList.contains(e);
17
+ }, y = (t, e) => {
18
+ !t || !e.trim() || t.classList.add(...a(e));
19
+ }, g = (t, e) => {
20
+ !t || !e.trim() || t.classList.remove(...a(e));
21
+ }, N = (t, e) => {
22
+ if (!t || !e)
41
23
  return "";
42
- let key = camelize(styleName);
43
- if (key === "float")
44
- key = "cssFloat";
24
+ let r = p(e);
25
+ r === "float" && (r = "cssFloat");
45
26
  try {
46
- const style = element.style[key];
47
- if (style)
48
- return style;
49
- const computed = window?.getComputedStyle(element, "");
50
- return computed ? computed[key] : "";
27
+ const n = t.style[r];
28
+ if (n)
29
+ return n;
30
+ const s = window == null ? void 0 : window.getComputedStyle(t, "");
31
+ return s ? s[r] : "";
51
32
  } catch {
52
- return element.style[key];
33
+ return t.style[r];
53
34
  }
54
- };
55
- const getCSS = (styleObj = {}) => {
56
- return Object.keys(styleObj).map((key) => `${key}:${styleObj[key] !== "" ? styleObj[key] : '""'}`).join(";");
57
- };
58
- const createStyle = (id, data) => {
59
- if (document.getElementById(id))
60
- return;
61
- return new Promise((resolve, reject) => {
62
- const styleSheet = document.createElement("style");
63
- styleSheet.rel = "text/css";
64
- styleSheet.id = id;
65
- for (const item of data) {
66
- styleSheet.appendChild(document.createTextNode(`${item.className}{${getCSS(item.style)}}`));
67
- }
68
- const head = document.getElementsByTagName("head")[0];
69
- head.appendChild(styleSheet);
70
- styleSheet.onload = () => resolve("load success");
71
- styleSheet.onerror = () => reject("load error");
72
- });
73
- };
74
- const updateStyle = (id, data) => {
75
- const styleSheet = document.getElementById(id);
76
- if (styleSheet) {
77
- styleSheet.innerHTML = "";
78
- for (const item of data) {
79
- styleSheet.appendChild(document.createTextNode(`${item.className}{${getCSS(item.style)}}`));
80
- }
35
+ }, d = (t = {}) => Object.keys(t).map((e) => `${e}:${t[e] !== "" ? t[e] : '""'}`).join(";"), E = (t, e) => {
36
+ if (!document.getElementById(t))
37
+ return new Promise((r, n) => {
38
+ const s = document.createElement("style");
39
+ s.rel = "text/css", s.id = t;
40
+ for (const i of e)
41
+ s.appendChild(document.createTextNode(`${i.className}{${d(i.style)}}`));
42
+ document.getElementsByTagName("head")[0].appendChild(s), s.onload = () => r("load success"), s.onerror = () => n("load error");
43
+ });
44
+ }, S = (t, e) => {
45
+ const r = document.getElementById(t);
46
+ if (r) {
47
+ r.innerHTML = "";
48
+ for (const n of e)
49
+ r.appendChild(document.createTextNode(`${n.className}{${d(n.style)}}`));
81
50
  }
51
+ }, l = (t) => Number(t.toString().replace("px", "")), o = (t, e, r) => {
52
+ e = l(e), r = l(r);
53
+ let n;
54
+ return t === "add" && (n = e + r), t === "subtract" && (n = e - r), t === "multiply" && (n = e * r), t === "divide" && (n = e / r), e = null, r = null, n;
55
+ }, c = (t) => ({
56
+ add: (e) => c(o("add", t, e)),
57
+ subtract: (e) => c(o("subtract", t, e)),
58
+ multiply: (e) => c(o("multiply", t, e)),
59
+ divide: (e) => c(o("divide", t, e)),
60
+ res: () => {
61
+ const e = t + "px";
62
+ return t = null, e;
63
+ }
64
+ });
65
+ export {
66
+ y as addClass,
67
+ E as createStyle,
68
+ c as curringMath,
69
+ d as getCSS,
70
+ N as getStyle,
71
+ h as hasClass,
72
+ g as removeClass,
73
+ S as updateStyle
82
74
  };
83
-
84
- const px2number = (str) => Number(str.toString().replace("px", ""));
85
- const operation = (type, a, b) => {
86
- a = px2number(a);
87
- b = px2number(b);
88
- let res;
89
- if (type === "add")
90
- res = a + b;
91
- if (type === "subtract")
92
- res = a - b;
93
- if (type === "multiply")
94
- res = a * b;
95
- if (type === "divide")
96
- res = a / b;
97
- a = null;
98
- b = null;
99
- return res;
100
- };
101
- const curringMath = (a) => {
102
- return {
103
- add: (b) => curringMath(operation("add", a, b)),
104
- subtract: (b) => curringMath(operation("subtract", a, b)),
105
- multiply: (b) => curringMath(operation("multiply", a, b)),
106
- divide: (b) => curringMath(operation("divide", a, b)),
107
- res: () => {
108
- const res = a + "px";
109
- a = null;
110
- return res;
111
- }
112
- };
113
- };
114
-
115
- export { addClass, createStyle, curringMath, getCSS, getStyle, hasClass, removeClass, updateStyle };
package/style/math.js CHANGED
@@ -1,32 +1,17 @@
1
- const px2number = (str) => Number(str.toString().replace("px", ""));
2
- const operation = (type, a, b) => {
3
- a = px2number(a);
4
- b = px2number(b);
5
- let res;
6
- if (type === "add")
7
- res = a + b;
8
- if (type === "subtract")
9
- res = a - b;
10
- if (type === "multiply")
11
- res = a * b;
12
- if (type === "divide")
13
- res = a / b;
14
- a = null;
15
- b = null;
16
- return res;
1
+ const e = (t) => Number(t.toString().replace("px", "")), l = (t, r, i) => {
2
+ r = e(r), i = e(i);
3
+ let u;
4
+ return t === "add" && (u = r + i), t === "subtract" && (u = r - i), t === "multiply" && (u = r * i), t === "divide" && (u = r / i), r = null, i = null, u;
5
+ }, n = (t) => ({
6
+ add: (r) => n(l("add", t, r)),
7
+ subtract: (r) => n(l("subtract", t, r)),
8
+ multiply: (r) => n(l("multiply", t, r)),
9
+ divide: (r) => n(l("divide", t, r)),
10
+ res: () => {
11
+ const r = t + "px";
12
+ return t = null, r;
13
+ }
14
+ });
15
+ export {
16
+ n as curringMath
17
17
  };
18
- const curringMath = (a) => {
19
- return {
20
- add: (b) => curringMath(operation("add", a, b)),
21
- subtract: (b) => curringMath(operation("subtract", a, b)),
22
- multiply: (b) => curringMath(operation("multiply", a, b)),
23
- divide: (b) => curringMath(operation("divide", a, b)),
24
- res: () => {
25
- const res = a + "px";
26
- a = null;
27
- return res;
28
- }
29
- };
30
- };
31
-
32
- export { curringMath };
package/style/style.js CHANGED
@@ -3,82 +3,59 @@
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
-
7
- !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
8
- !!(process.env.NODE_ENV !== "production") ? Object.freeze([]) : [];
9
- const cacheStringFunction = (fn) => {
10
- const cache = /* @__PURE__ */ Object.create(null);
11
- return (str) => {
12
- const hit = cache[str];
13
- return hit || (cache[str] = fn(str));
14
- };
15
- };
16
- const camelizeRE = /-(\w)/g;
17
- const camelize = cacheStringFunction((str) => {
18
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
19
- });
20
-
21
- const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
22
- const hasClass = (el, cls) => {
23
- if (!el || !cls)
24
- return false;
25
- if (cls.includes(" "))
6
+ process.env.NODE_ENV !== "production" && Object.freeze({});
7
+ process.env.NODE_ENV !== "production" && Object.freeze([]);
8
+ const i = (e) => {
9
+ const t = /* @__PURE__ */ Object.create(null);
10
+ return (n) => t[n] || (t[n] = e(n));
11
+ }, d = /-(\w)/g, l = i((e) => e.replace(d, (t, n) => n ? n.toUpperCase() : "")), c = (e = "") => e.split(" ").filter((t) => !!t.trim()), m = (e, t) => {
12
+ if (!e || !t)
13
+ return !1;
14
+ if (t.includes(" "))
26
15
  throw new Error("className should not contain space.");
27
- return el.classList.contains(cls);
28
- };
29
- const addClass = (el, cls) => {
30
- if (!el || !cls.trim())
31
- return;
32
- el.classList.add(...classNameToArray(cls));
33
- };
34
- const removeClass = (el, cls) => {
35
- if (!el || !cls.trim())
36
- return;
37
- el.classList.remove(...classNameToArray(cls));
38
- };
39
- const getStyle = (element, styleName) => {
40
- if (!element || !styleName)
16
+ return e.classList.contains(t);
17
+ }, p = (e, t) => {
18
+ !e || !t.trim() || e.classList.add(...c(t));
19
+ }, f = (e, t) => {
20
+ !e || !t.trim() || e.classList.remove(...c(t));
21
+ }, h = (e, t) => {
22
+ if (!e || !t)
41
23
  return "";
42
- let key = camelize(styleName);
43
- if (key === "float")
44
- key = "cssFloat";
24
+ let n = l(t);
25
+ n === "float" && (n = "cssFloat");
45
26
  try {
46
- const style = element.style[key];
47
- if (style)
48
- return style;
49
- const computed = window?.getComputedStyle(element, "");
50
- return computed ? computed[key] : "";
27
+ const o = e.style[n];
28
+ if (o)
29
+ return o;
30
+ const r = window == null ? void 0 : window.getComputedStyle(e, "");
31
+ return r ? r[n] : "";
51
32
  } catch {
52
- return element.style[key];
33
+ return e.style[n];
53
34
  }
54
- };
55
- const getCSS = (styleObj = {}) => {
56
- return Object.keys(styleObj).map((key) => `${key}:${styleObj[key] !== "" ? styleObj[key] : '""'}`).join(";");
57
- };
58
- const createStyle = (id, data) => {
59
- if (document.getElementById(id))
60
- return;
61
- return new Promise((resolve, reject) => {
62
- const styleSheet = document.createElement("style");
63
- styleSheet.rel = "text/css";
64
- styleSheet.id = id;
65
- for (const item of data) {
66
- styleSheet.appendChild(document.createTextNode(`${item.className}{${getCSS(item.style)}}`));
67
- }
68
- const head = document.getElementsByTagName("head")[0];
69
- head.appendChild(styleSheet);
70
- styleSheet.onload = () => resolve("load success");
71
- styleSheet.onerror = () => reject("load error");
72
- });
73
- };
74
- const updateStyle = (id, data) => {
75
- const styleSheet = document.getElementById(id);
76
- if (styleSheet) {
77
- styleSheet.innerHTML = "";
78
- for (const item of data) {
79
- styleSheet.appendChild(document.createTextNode(`${item.className}{${getCSS(item.style)}}`));
80
- }
35
+ }, a = (e = {}) => Object.keys(e).map((t) => `${t}:${e[t] !== "" ? e[t] : '""'}`).join(";"), y = (e, t) => {
36
+ if (!document.getElementById(e))
37
+ return new Promise((n, o) => {
38
+ const r = document.createElement("style");
39
+ r.rel = "text/css", r.id = e;
40
+ for (const s of t)
41
+ r.appendChild(document.createTextNode(`${s.className}{${a(s.style)}}`));
42
+ document.getElementsByTagName("head")[0].appendChild(r), r.onload = () => n("load success"), r.onerror = () => o("load error");
43
+ });
44
+ }, E = (e, t) => {
45
+ const n = document.getElementById(e);
46
+ if (n) {
47
+ n.innerHTML = "";
48
+ for (const o of t)
49
+ n.appendChild(document.createTextNode(`${o.className}{${a(o.style)}}`));
81
50
  }
82
51
  };
83
-
84
- export { addClass, classNameToArray, createStyle, getCSS, getStyle, hasClass, removeClass, updateStyle };
52
+ export {
53
+ p as addClass,
54
+ c as classNameToArray,
55
+ y as createStyle,
56
+ a as getCSS,
57
+ h as getStyle,
58
+ m as hasClass,
59
+ f as removeClass,
60
+ E as updateStyle
61
+ };