@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,156 +1,88 @@
1
1
  /*! js-cookie v3.0.5 | MIT */
2
- /* eslint-disable no-var */
3
- function assign (target) {
4
- for (var i = 1; i < arguments.length; i++) {
5
- var source = arguments[i];
6
- for (var key in source) {
7
- target[key] = source[key];
8
- }
2
+ function a(e) {
3
+ for (var n = 1; n < arguments.length; n++) {
4
+ var r = arguments[n];
5
+ for (var i in r)
6
+ e[i] = r[i];
9
7
  }
10
- return target
8
+ return e;
11
9
  }
12
- /* eslint-enable no-var */
13
-
14
- /* eslint-disable no-var */
15
- var defaultConverter = {
16
- read: function (value) {
17
- if (value[0] === '"') {
18
- value = value.slice(1, -1);
19
- }
20
- return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
10
+ var I = {
11
+ read: function(e) {
12
+ return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
21
13
  },
22
- write: function (value) {
23
- return encodeURIComponent(value).replace(
14
+ write: function(e) {
15
+ return encodeURIComponent(e).replace(
24
16
  /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
25
17
  decodeURIComponent
26
- )
18
+ );
27
19
  }
28
20
  };
29
- /* eslint-enable no-var */
30
-
31
- /* eslint-disable no-var */
32
-
33
- function init (converter, defaultAttributes) {
34
- function set (name, value, attributes) {
35
- if (typeof document === 'undefined') {
36
- return
37
- }
38
-
39
- attributes = assign({}, defaultAttributes, attributes);
40
-
41
- if (typeof attributes.expires === 'number') {
42
- attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
21
+ function g(e, n) {
22
+ function r(o, f, t) {
23
+ if (!(typeof document > "u")) {
24
+ t = a({}, n, t), typeof t.expires == "number" && (t.expires = new Date(Date.now() + t.expires * 864e5)), t.expires && (t.expires = t.expires.toUTCString()), o = encodeURIComponent(o).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
25
+ var c = "";
26
+ for (var s in t)
27
+ t[s] && (c += "; " + s, t[s] !== !0 && (c += "=" + t[s].split(";")[0]));
28
+ return document.cookie = o + "=" + e.write(f, o) + c;
43
29
  }
44
- if (attributes.expires) {
45
- attributes.expires = attributes.expires.toUTCString();
46
- }
47
-
48
- name = encodeURIComponent(name)
49
- .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
50
- .replace(/[()]/g, escape);
51
-
52
- var stringifiedAttributes = '';
53
- for (var attributeName in attributes) {
54
- if (!attributes[attributeName]) {
55
- continue
56
- }
57
-
58
- stringifiedAttributes += '; ' + attributeName;
59
-
60
- if (attributes[attributeName] === true) {
61
- continue
62
- }
63
-
64
- // Considers RFC 6265 section 5.2:
65
- // ...
66
- // 3. If the remaining unparsed-attributes contains a %x3B (";")
67
- // character:
68
- // Consume the characters of the unparsed-attributes up to,
69
- // not including, the first %x3B (";") character.
70
- // ...
71
- stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
72
- }
73
-
74
- return (document.cookie =
75
- name + '=' + converter.write(value, name) + stringifiedAttributes)
76
30
  }
77
-
78
- function get (name) {
79
- if (typeof document === 'undefined' || (arguments.length && !name)) {
80
- return
81
- }
82
-
83
- // To prevent the for loop in the first place assign an empty array
84
- // in case there are no cookies at all.
85
- var cookies = document.cookie ? document.cookie.split('; ') : [];
86
- var jar = {};
87
- for (var i = 0; i < cookies.length; i++) {
88
- var parts = cookies[i].split('=');
89
- var value = parts.slice(1).join('=');
90
-
91
- try {
92
- var found = decodeURIComponent(parts[0]);
93
- jar[found] = converter.read(value, found);
94
-
95
- if (name === found) {
96
- break
31
+ function i(o) {
32
+ if (!(typeof document > "u" || arguments.length && !o)) {
33
+ for (var f = document.cookie ? document.cookie.split("; ") : [], t = {}, c = 0; c < f.length; c++) {
34
+ var s = f[c].split("="), u = s.slice(1).join("=");
35
+ try {
36
+ var p = decodeURIComponent(s[0]);
37
+ if (t[p] = e.read(u, p), o === p)
38
+ break;
39
+ } catch {
97
40
  }
98
- } catch (e) {}
41
+ }
42
+ return o ? t[o] : t;
99
43
  }
100
-
101
- return name ? jar[name] : jar
102
44
  }
103
-
104
45
  return Object.create(
105
46
  {
106
- set,
107
- get,
108
- remove: function (name, attributes) {
109
- set(
110
- name,
111
- '',
112
- assign({}, attributes, {
47
+ set: r,
48
+ get: i,
49
+ remove: function(o, f) {
50
+ r(
51
+ o,
52
+ "",
53
+ a({}, f, {
113
54
  expires: -1
114
55
  })
115
56
  );
116
57
  },
117
- withAttributes: function (attributes) {
118
- return init(this.converter, assign({}, this.attributes, attributes))
58
+ withAttributes: function(o) {
59
+ return g(this.converter, a({}, this.attributes, o));
119
60
  },
120
- withConverter: function (converter) {
121
- return init(assign({}, this.converter, converter), this.attributes)
61
+ withConverter: function(o) {
62
+ return g(a({}, this.converter, o), this.attributes);
122
63
  }
123
64
  },
124
65
  {
125
- attributes: { value: Object.freeze(defaultAttributes) },
126
- converter: { value: Object.freeze(converter) }
66
+ attributes: { value: Object.freeze(n) },
67
+ converter: { value: Object.freeze(e) }
127
68
  }
128
- )
69
+ );
129
70
  }
130
-
131
- var api = init(defaultConverter, { path: '/' });
132
-
133
- const getUrlToken = () => {
134
- const search = new URL(location.href).searchParams;
135
- const token = search.get("token") || search.get("accessToken") || search.get("accesstoken") || "";
136
- if (token) {
137
- const tokenInfo = JSON.stringify({ access_token: token });
138
- sessionStorage.setItem("accessToken", token);
139
- sessionStorage.setItem("tokenInfo", tokenInfo);
140
- api.set("accessToken", token);
141
- api.set("accessTokenInfo", tokenInfo);
71
+ var d = g(I, { path: "/" });
72
+ const h = () => {
73
+ const e = new URL(location.href).searchParams, n = e.get("token") || e.get("accessToken") || e.get("accesstoken") || "";
74
+ if (n) {
75
+ const r = JSON.stringify({ access_token: n });
76
+ sessionStorage.setItem("accessToken", n), sessionStorage.setItem("tokenInfo", r), d.set("accessToken", n), d.set("accessTokenInfo", r);
142
77
  }
143
- };
144
- const getProjectInfoFromQuery = () => {
145
- const preProject = JSON.parse(sessionStorage.getItem("projectInfo") || "{}");
146
- const search = new URL(location.href).searchParams;
147
- const id = search.get("project") || search.get("projectId") || "";
148
- if (!id)
78
+ }, v = () => {
79
+ const e = JSON.parse(sessionStorage.getItem("projectInfo") || "{}"), n = new URL(location.href).searchParams, r = n.get("project") || n.get("projectId") || "";
80
+ if (!r)
149
81
  return;
150
- const parentId = search.get("projectParent") || search.get("projectParentId") || preProject?.parentId || "";
151
- const name = search.get("projectName") || preProject?.name || "";
152
- sessionStorage.setItem("project", id);
153
- sessionStorage.setItem("projectInfo", JSON.stringify({ ...preProject, id, name, parentId }));
82
+ const i = n.get("projectParent") || n.get("projectParentId") || (e == null ? void 0 : e.parentId) || "", o = n.get("projectName") || (e == null ? void 0 : e.name) || "";
83
+ sessionStorage.setItem("project", r), sessionStorage.setItem("projectInfo", JSON.stringify({ ...e, id: r, name: o, parentId: i }));
84
+ };
85
+ export {
86
+ v as getProjectInfoFromQuery,
87
+ h as getUrlToken
154
88
  };
155
-
156
- export { getProjectInfoFromQuery, getUrlToken };
@@ -1,15 +1,8 @@
1
- const arrEqual = (a, b, isSort = true) => {
2
- if (a.length !== b.length)
3
- return false;
4
- if (isSort) {
5
- return a.sort().toString() === b.sort().toString();
6
- } else {
7
- return a.toString() === b.toString();
8
- }
1
+ const o = (t, r, e = !0) => t.length !== r.length ? !1 : e ? t.sort().toString() === r.sort().toString() : t.toString() === r.toString(), s = (t, r) => {
2
+ const e = /* @__PURE__ */ new Map();
3
+ return t.filter((n) => !e.has(n[r]) && e.set(n[r], 1));
9
4
  };
10
- const arrUnique = (arr, val) => {
11
- const res = /* @__PURE__ */ new Map();
12
- return arr.filter((item) => !res.has(item[val]) && res.set(item[val], 1));
5
+ export {
6
+ o as arrEqual,
7
+ s as arrUnique
13
8
  };
14
-
15
- export { arrEqual, arrUnique };
@@ -1,22 +1,19 @@
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;
1
+ const a = (s, t = "yyyy-MM-dd HH:mm:ss") => {
2
+ let e = s ? new Date(s) : /* @__PURE__ */ new Date();
3
+ var r = {
4
+ "M+": e.getMonth() + 1,
5
+ "d+": e.getDate(),
6
+ "H+": e.getHours(),
7
+ "m+": e.getMinutes(),
8
+ "s+": e.getSeconds(),
9
+ "q+": Math.floor((e.getMonth() + 3) / 3),
10
+ S: e.getMilliseconds()
11
+ }, g = e.getFullYear().toString();
12
+ g = g.length >= 4 ? g : "0000".substr(0, 4 - g.length) + g, /(y+)/.test(t) && (t = t.replace(RegExp.$1, (g + "").substr(4 - RegExp.$1.length)));
13
+ for (var n in r)
14
+ new RegExp("(" + n + ")").test(t) && (t = t.replace(RegExp.$1, RegExp.$1.length === 1 ? r[n] : ("00" + r[n]).substr(("" + r[n]).length)));
15
+ return t;
16
+ };
17
+ export {
18
+ a as dateFormat
20
19
  };
21
-
22
- export { dateFormat };
@@ -1,92 +1,51 @@
1
- const getUrlParams = (allUrl, name) => {
2
- let search = window.location.search || "";
3
- if (allUrl && allUrl !== location.href) {
4
- const index = allUrl.indexOf("?");
5
- if (index !== -1) {
6
- search = allUrl.slice(index);
7
- } else {
8
- search = "";
9
- }
1
+ const a = (r, n) => {
2
+ let e = window.location.search || "";
3
+ if (r && r !== location.href) {
4
+ const s = r.indexOf("?");
5
+ s !== -1 ? e = r.slice(s) : e = "";
10
6
  }
11
- const params = new URLSearchParams(search);
12
- if (name) {
13
- return params.get(name);
14
- } else {
15
- let allParams = {};
16
- for (let [key, value] of params.entries()) {
17
- allParams[key] = value;
18
- }
19
- return allParams;
7
+ const t = new URLSearchParams(e);
8
+ if (n)
9
+ return t.get(n);
10
+ {
11
+ let s = {};
12
+ for (let [l, i] of t.entries())
13
+ s[l] = i;
14
+ return s;
20
15
  }
16
+ }, f = (r, n = {}) => {
17
+ let e = "", t = "";
18
+ const s = Object.keys(n);
19
+ return s && s.length && s.forEach((l, i) => {
20
+ i === s.length - 1 ? t += `${l}=${n[l]}` : t += `${l}=${n[l]}&`;
21
+ }), t ? e = location.origin + r + `?${t}` : e = location.origin + r, e;
22
+ }, u = (r, n) => {
23
+ const e = n || location.href, t = a(e), s = Object.keys(t) || [];
24
+ if (!s || !s.length)
25
+ return e.includes("?") ? e.split("?")[0] : e.split("&")[0];
26
+ let l = s.filter((o) => !r.includes(o));
27
+ if (!l || !l.length)
28
+ return e.includes("?") ? e.split("?")[0] : e.split("&")[0];
29
+ let i = "";
30
+ return l.forEach((o, c) => {
31
+ c === s.length - 1 ? i += `${o}=${t[o]}` : i += `${o}=${t[o]}&`;
32
+ }), e.includes("?") ? e.split("?")[0] + `?${i}` : e.split("&")[0] + `?${i}`;
33
+ }, h = (r) => {
34
+ const n = new URLSearchParams(r.split("?")[1]), e = {};
35
+ for (const [t, s] of n)
36
+ e.hasOwnProperty(t) ? Array.isArray(e[t]) ? e[t].push(s) : e[t] = [e[t], s] : e[t] = s;
37
+ return e;
38
+ }, $ = (r) => {
39
+ let n = "";
40
+ const e = Object.keys(r);
41
+ return e && e.length && e.forEach((t, s) => {
42
+ s === e.length - 1 ? n += `${t}=${r[t]}` : n += `${t}=${r[t]}&`;
43
+ }), n;
21
44
  };
22
- const getFullPath = (url, params = {}) => {
23
- let result = "";
24
- let query = "";
25
- const keys = Object.keys(params);
26
- if (keys && keys.length) {
27
- keys.forEach((key, index) => {
28
- if (index === keys.length - 1) {
29
- query += `${key}=${params[key]}`;
30
- } else {
31
- query += `${key}=${params[key]}&`;
32
- }
33
- });
34
- }
35
- if (query) {
36
- result = location.origin + url + `?${query}`;
37
- } else {
38
- result = location.origin + url;
39
- }
40
- return result;
41
- };
42
- const funcUrlDel = (names, url) => {
43
- const preUrl = url ? url : location.href;
44
- const params = getUrlParams(preUrl);
45
- const keys = Object.keys(params) || [];
46
- if (!keys || !keys.length)
47
- return preUrl.includes("?") ? preUrl.split("?")[0] : preUrl.split("&")[0];
48
- let paramsResult = keys.filter((item) => !names.includes(item));
49
- if (!paramsResult || !paramsResult.length)
50
- return preUrl.includes("?") ? preUrl.split("?")[0] : preUrl.split("&")[0];
51
- let query = "";
52
- paramsResult.forEach((key, index) => {
53
- if (index === keys.length - 1) {
54
- query += `${key}=${params[key]}`;
55
- } else {
56
- query += `${key}=${params[key]}&`;
57
- }
58
- });
59
- return preUrl.includes("?") ? preUrl.split("?")[0] + `?${query}` : preUrl.split("&")[0] + `?${query}`;
60
- };
61
- const urlParamsToObject = (url) => {
62
- const searchParams = new URLSearchParams(url.split("?")[1]);
63
- const params = {};
64
- for (const [key, value] of searchParams) {
65
- if (params.hasOwnProperty(key)) {
66
- if (Array.isArray(params[key])) {
67
- params[key].push(value);
68
- } else {
69
- params[key] = [params[key], value];
70
- }
71
- } else {
72
- params[key] = value;
73
- }
74
- }
75
- return params;
76
- };
77
- const objectToUrlparams = (params) => {
78
- let query = "";
79
- const keys = Object.keys(params);
80
- if (keys && keys.length) {
81
- keys.forEach((key, index) => {
82
- if (index === keys.length - 1) {
83
- query += `${key}=${params[key]}`;
84
- } else {
85
- query += `${key}=${params[key]}&`;
86
- }
87
- });
88
- }
89
- return query;
45
+ export {
46
+ u as funcUrlDel,
47
+ f as getFullPath,
48
+ a as getUrlParams,
49
+ $ as objectToUrlparams,
50
+ h as urlParamsToObject
90
51
  };
91
-
92
- export { funcUrlDel, getFullPath, getUrlParams, objectToUrlparams, urlParamsToObject };
@@ -1,5 +1,4 @@
1
- const isEmpty = (value) => {
2
- return !!(value === null || typeof value === "undefined" || value === "");
1
+ const t = (n) => n === null || typeof n > "u" || n === "";
2
+ export {
3
+ t as isEmpty
3
4
  };
4
-
5
- export { isEmpty };