halo-fe 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +3 -0
- package/dist/main.js +2539 -0
- package/dist/vendor-@monaco-editor-DKC4UNw_.js +258 -0
- package/dist/vendor-@vue-l0sNRNKZ.js +1 -0
- package/dist/vendor-axios-ud9O0vdJ.js +1670 -0
- package/dist/vendor-clone-NGbTzSwJ.js +159 -0
- package/dist/vendor-crypto-js-B6Qe-gIg.js +4995 -0
- package/dist/vendor-file-saver-DKXzEV2Q.js +74 -0
- package/dist/vendor-moment-h96o7c8I.js +2578 -0
- package/dist/vendor-pinia-DVLspbiC.js +310 -0
- package/dist/vendor-sprintf-js-BPTdvBYM.js +148 -0
- package/dist/vendor-state-local-CEworIRt.js +131 -0
- package/dist/vendor-underscore-DVTek3G4.js +1070 -0
- package/dist/vendor-underscore.string-vrHhfBaT.js +425 -0
- package/dist/vendor-util-deprecate-BfbfwJhs.js +28 -0
- package/dist/vendor-vue-demi-CIhrFbpB.js +17 -0
- package/esm/drivers/IDriver.d.ts +10 -0
- package/esm/drivers/cdns/Cdn.d.ts +14 -0
- package/esm/drivers/cdns/CdnFactory.d.ts +11 -0
- package/esm/drivers/cdns/ICdn.d.ts +34 -0
- package/esm/drivers/cdns/implements/BootCdn.d.ts +12 -0
- package/esm/drivers/cdns/implements/JsdelivrCdn.d.ts +13 -0
- package/esm/drivers/cdns/implements/LocalCdn.d.ts +12 -0
- package/esm/drivers/cdns/implements/StaticFileCdn.d.ts +16 -0
- package/esm/drivers/cdns/implements/UnpkgCdn.d.ts +10 -0
- package/esm/drivers/cdns/index.d.ts +0 -0
- package/esm/drivers/driver-helper.d.ts +46 -0
- package/esm/drivers/encoders/Encoder.d.ts +11 -0
- package/esm/drivers/encoders/EncoderFactory.d.ts +16 -0
- package/esm/drivers/encoders/IEncoder.d.ts +22 -0
- package/esm/drivers/encoders/implement/Base64Encoder.d.ts +11 -0
- package/esm/drivers/encoders/index.d.ts +0 -0
- package/esm/drivers/excels/ExcelFactory.d.ts +11 -0
- package/esm/drivers/excels/IExcel.d.ts +18 -0
- package/esm/drivers/excels/implements/XlsxExcel.d.ts +10 -0
- package/esm/drivers/excels/index.d.ts +2 -0
- package/esm/drivers/explainers/Explainer.d.ts +4 -0
- package/esm/drivers/explainers/ExplainerFactory.d.ts +1 -0
- package/esm/drivers/explainers/IExplainer.d.ts +3 -0
- package/esm/drivers/explainers/implement/JsonExplainer.d.ts +4 -0
- package/esm/drivers/explainers/index.d.ts +0 -0
- package/esm/drivers/factories/DriverFactory.d.ts +19 -0
- package/esm/drivers/factories/Factory.d.ts +8 -0
- package/esm/drivers/factories/IFactory.d.ts +10 -0
- package/esm/drivers/factories/index.d.ts +2 -0
- package/esm/drivers/features/FeatureFactory.d.ts +11 -0
- package/esm/drivers/features/IFeature.d.ts +23 -0
- package/esm/drivers/features/implements/ExpressionFeature.d.ts +12 -0
- package/esm/drivers/features/implements/I18NFeature.d.ts +12 -0
- package/esm/drivers/features/implements/SortFeature.d.ts +13 -0
- package/esm/drivers/features/index.d.ts +2 -0
- package/esm/drivers/hashers/Hasher.d.ts +10 -0
- package/esm/drivers/hashers/HasherFactory.d.ts +13 -0
- package/esm/drivers/hashers/IHasher.d.ts +19 -0
- package/esm/drivers/hashers/implement/Md5Hasher.d.ts +10 -0
- package/esm/drivers/hashers/implement/Sha256Hasher.d.ts +10 -0
- package/esm/drivers/hashers/index.d.ts +2 -0
- package/esm/drivers/index.d.ts +10 -0
- package/esm/drivers/providers/IProvider.d.ts +47 -0
- package/esm/drivers/providers/ProviderFactory.d.ts +11 -0
- package/esm/drivers/providers/implements/IndexedDbProvider.d.ts +55 -0
- package/esm/drivers/providers/index.d.ts +2 -0
- package/esm/drivers/requesters/IRequester.d.ts +21 -0
- package/esm/drivers/requesters/Requester.d.ts +12 -0
- package/esm/drivers/requesters/RequesterFactory.d.ts +23 -0
- package/esm/drivers/requesters/entities/HttpRequest.d.ts +34 -0
- package/esm/drivers/requesters/entities/HttpResponse.d.ts +19 -0
- package/esm/drivers/requesters/implements/DefaultRequester.d.ts +12 -0
- package/esm/drivers/requesters/implements/LocalRequester.d.ts +43 -0
- package/esm/drivers/requesters/implements/MkRequester.d.ts +40 -0
- package/esm/drivers/requesters/index.d.ts +5 -0
- package/esm/drivers/signers/ISigner.d.ts +33 -0
- package/esm/drivers/signers/SignerFactory.d.ts +11 -0
- package/esm/drivers/signers/implements/DefaultSigner.d.ts +18 -0
- package/esm/drivers/signers/index.d.ts +2 -0
- package/esm/drivers/ssos/ISso.d.ts +41 -0
- package/esm/drivers/ssos/SsoFactory.d.ts +11 -0
- package/esm/drivers/ssos/implements/AnonymousSso.d.ts +18 -0
- package/esm/drivers/ssos/implements/BearerSso.d.ts +24 -0
- package/esm/drivers/ssos/implements/NioSso.d.ts +23 -0
- package/esm/drivers/ssos/implements/SecretSso.d.ts +20 -0
- package/esm/drivers/ssos/implements/WeiXinSso.d.ts +20 -0
- package/esm/drivers/ssos/index.d.ts +2 -0
- package/esm/helpers/array-helper.d.ts +97 -0
- package/esm/helpers/component-helper.d.ts +10 -0
- package/esm/helpers/cookie-helper.d.ts +6 -0
- package/esm/helpers/dictionary-helper.d.ts +18 -0
- package/esm/helpers/dom-helper.d.ts +86 -0
- package/esm/helpers/event-helper.d.ts +30 -0
- package/esm/helpers/file-helper.d.ts +22 -0
- package/esm/helpers/html-helper.d.ts +10 -0
- package/esm/helpers/i18n-helper.d.ts +14 -0
- package/esm/helpers/image-helper.d.ts +10 -0
- package/esm/helpers/index.d.ts +26 -0
- package/esm/helpers/json-helper.d.ts +31 -0
- package/esm/helpers/math-helper.d.ts +46 -0
- package/esm/helpers/micro-helper.d.ts +10 -0
- package/esm/helpers/mount-helper.d.ts +14 -0
- package/esm/helpers/object-helper.d.ts +34 -0
- package/esm/helpers/script-helper.d.ts +31 -0
- package/esm/helpers/scroll-helper.d.ts +14 -0
- package/esm/helpers/sign-helper.d.ts +14 -0
- package/esm/helpers/storage-helper.d.ts +34 -0
- package/esm/helpers/string-helper.d.ts +94 -0
- package/esm/helpers/task-helper.d.ts +26 -0
- package/esm/helpers/time-helper.d.ts +62 -0
- package/esm/helpers/tree-helper.d.ts +54 -0
- package/esm/helpers/type-helper.d.ts +26 -0
- package/esm/helpers/url-helper.d.ts +96 -0
- package/esm/main.d.ts +3 -0
- package/esm/services/SettingService.d.ts +5 -0
- package/esm/services/index.d.ts +15 -0
- package/esm/stores/config.d.ts +59 -0
- package/esm/stores/driver.d.ts +41 -0
- package/esm/stores/env.d.ts +12 -0
- package/esm/stores/index.d.ts +7 -0
- package/esm/stores/log.d.ts +20 -0
- package/esm/stores/setting.d.ts +47 -0
- package/esm/stores/socket.d.ts +27 -0
- package/esm/stores/user.d.ts +44 -0
- package/esm/thirds/index.d.ts +8 -0
- package/esm/vite.config.d.ts +6 -0
- package/package.json +52 -0
package/dist/main.js
ADDED
@@ -0,0 +1,2539 @@
|
|
1
|
+
import { defineAsyncComponent as qt } from "vue";
|
2
|
+
import { _ as At } from "./vendor-underscore.string-vrHhfBaT.js";
|
3
|
+
import { _ as lt } from "./vendor-underscore-DVTek3G4.js";
|
4
|
+
import { F as $t } from "./vendor-file-saver-DKXzEV2Q.js";
|
5
|
+
import { b as Ut } from "./vendor-clone-NGbTzSwJ.js";
|
6
|
+
import { l as Lt } from "./vendor-@monaco-editor-DKC4UNw_.js";
|
7
|
+
import { h as E } from "./vendor-moment-h96o7c8I.js";
|
8
|
+
import { d as L } from "./vendor-pinia-DVLspbiC.js";
|
9
|
+
import { C as P } from "./vendor-crypto-js-B6Qe-gIg.js";
|
10
|
+
import { a as Nt, A as Rt } from "./vendor-axios-ud9O0vdJ.js";
|
11
|
+
import { utils as it, writeFile as Dt } from "xlsx-js-style";
|
12
|
+
const B = class B {
|
13
|
+
};
|
14
|
+
B.isString = (t) => Object.prototype.toString.call(t) == "[object String]", B.isObject = (t) => Object.prototype.toString.call(t) == "[object Object]", B.isArray = (t) => Object.prototype.toString.call(t) == "[object Array]", B.isNumber = (t) => {
|
15
|
+
let e = Object.prototype.toString.call(t);
|
16
|
+
return e == "[object Number]" || e == "[object BigInt]";
|
17
|
+
}, B.isBoolean = (t) => Object.prototype.toString.call(t) == "[object Boolean]";
|
18
|
+
let y = B;
|
19
|
+
const h = class h {
|
20
|
+
/**
|
21
|
+
* 根据字符串或数组,自动返回数组
|
22
|
+
*/
|
23
|
+
static getArray(t) {
|
24
|
+
return y.isString(t) ? [t.toString()] : t instanceof Array ? t : [];
|
25
|
+
}
|
26
|
+
/**
|
27
|
+
* 忽略大小写比较
|
28
|
+
*/
|
29
|
+
static equalsIgnoreCase(t, e) {
|
30
|
+
let s = t.toUpperCase(), r = e.toUpperCase();
|
31
|
+
return s == r;
|
32
|
+
}
|
33
|
+
};
|
34
|
+
h.getUniqueId = () => {
|
35
|
+
let t = Date.now().toString(36);
|
36
|
+
return t += Math.random().toString(36).substring(2), t;
|
37
|
+
}, h.padLeft = (t, e, s) => At.pad(t, e, s), h.trimStart = (t, e) => {
|
38
|
+
if (e == null)
|
39
|
+
return t;
|
40
|
+
let s = t.indexOf(e);
|
41
|
+
return t.substring(s + e.length);
|
42
|
+
}, h.trimEnd = (t, e) => {
|
43
|
+
if (e == null)
|
44
|
+
return t;
|
45
|
+
let s = t.lastIndexOf(e);
|
46
|
+
return t.substring(0, s);
|
47
|
+
}, h.trim = (t, e, s) => {
|
48
|
+
let r = h.trimStart(t, e);
|
49
|
+
return h.trimEnd(r, s);
|
50
|
+
}, h.getDashName = (t) => {
|
51
|
+
if (!t)
|
52
|
+
return null;
|
53
|
+
let e = "";
|
54
|
+
for (let s = 0; s < t.length; s++) {
|
55
|
+
let r = t[s];
|
56
|
+
r == "/" ? e += "-" : r >= "A" && r <= "Z" ? (s > 0 && t[s - 1] != "/" && (e += "-"), e += r.toLowerCase()) : e += r;
|
57
|
+
}
|
58
|
+
return e;
|
59
|
+
}, h.containsIgnoreCase = (t, e) => {
|
60
|
+
if (!t)
|
61
|
+
return !0;
|
62
|
+
let s = e instanceof Array ? e : [e];
|
63
|
+
for (let r = 0; r < s.length; r++) {
|
64
|
+
let n = s[r];
|
65
|
+
if (!n)
|
66
|
+
return !1;
|
67
|
+
if (n.toString().toUpperCase().includes(t.toUpperCase()))
|
68
|
+
return !0;
|
69
|
+
}
|
70
|
+
return !1;
|
71
|
+
}, h.getTextFromHtml = (t) => {
|
72
|
+
if (!t)
|
73
|
+
return null;
|
74
|
+
let e = new RegExp("<.+?>", "g");
|
75
|
+
return t.replace(e, "");
|
76
|
+
}, h.isNumber = (t) => t != null && !isNaN(t), h.isEmail = (t) => /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t), h.isJson = (t) => {
|
77
|
+
try {
|
78
|
+
if (!t)
|
79
|
+
return !1;
|
80
|
+
let e = JSON.parse(t);
|
81
|
+
return y.isObject(e);
|
82
|
+
} catch {
|
83
|
+
return !1;
|
84
|
+
}
|
85
|
+
}, h.isJsonp = (t) => {
|
86
|
+
if (!t)
|
87
|
+
return !1;
|
88
|
+
let e = t.indexOf("("), s = t.lastIndexOf(")"), r = t.substring(e + 1, s);
|
89
|
+
return !!h.isJson(r);
|
90
|
+
}, h.isHtml = (t) => {
|
91
|
+
if (!t)
|
92
|
+
return !1;
|
93
|
+
let e = document.createElement("div");
|
94
|
+
e.innerHTML = t;
|
95
|
+
for (let s = e.childNodes, r = s.length; r--; )
|
96
|
+
if (s[r].nodeType == 1)
|
97
|
+
return !0;
|
98
|
+
return !1;
|
99
|
+
}, h.getContentType = (t) => h.isJson(t) || h.isJsonp(t) ? "json" : h.isHtml(t) ? "html" : "text", h.isNullOrEmpty = (t) => t == null || h.isEmpty(t), h.isEmpty = (t) => t == "", h.isPassword = (t) => !0, h.getNumberOrNull = (t) => t == null || isNaN(t) ? 0 : parseFloat(t), h.format = (t, e) => {
|
100
|
+
let s = parseFloat(t), r;
|
101
|
+
return e ? r = s.toFixed(e).replace(/(\d)(?=(\d{3})+\.)/g, "$1,") : r = s.toLocaleString(), r;
|
102
|
+
}, h.getBetween = (t, e, s) => {
|
103
|
+
let r = t.indexOf(e);
|
104
|
+
if (r == -1)
|
105
|
+
return null;
|
106
|
+
let n = r + e.length, l = t.substring(n), i = l.indexOf(s);
|
107
|
+
return i == -1 ? null : l.substring(0, i);
|
108
|
+
};
|
109
|
+
let S = h;
|
110
|
+
class $e {
|
111
|
+
/**
|
112
|
+
* 根据动态加载的组件对象,得到组件集合
|
113
|
+
*/
|
114
|
+
static getComponents(t, e, s = null) {
|
115
|
+
let r = {}, n = Object.keys(t);
|
116
|
+
if (n.length == 0)
|
117
|
+
return r;
|
118
|
+
for (let l = 0; l < n.length; l++) {
|
119
|
+
const i = n[l];
|
120
|
+
let u = S.trim(i, e, ".vue"), c = (s ? s + "-" : "") + S.getDashName(u), g = t[i];
|
121
|
+
if (g.default)
|
122
|
+
r[c] = g.default;
|
123
|
+
else {
|
124
|
+
let p = qt(g);
|
125
|
+
r[c] = p;
|
126
|
+
}
|
127
|
+
}
|
128
|
+
return r;
|
129
|
+
}
|
130
|
+
}
|
131
|
+
const d = class d {
|
132
|
+
};
|
133
|
+
d.getChunks = (t, e) => {
|
134
|
+
let s = [];
|
135
|
+
for (let r = 0; r < t.length; r += e) {
|
136
|
+
let n = t.slice(r, r + e);
|
137
|
+
s.push(n);
|
138
|
+
}
|
139
|
+
return s;
|
140
|
+
}, d.intersect = (t, e) => t.filter((r) => e.indexOf(r) > -1), d.except = (t, e, s = null) => {
|
141
|
+
let r = e instanceof Array ? e : [e], n = [];
|
142
|
+
if (s == null)
|
143
|
+
n = t.filter((l) => r.indexOf(l) == -1);
|
144
|
+
else
|
145
|
+
for (let l = 0; l < t.length; l++) {
|
146
|
+
let i = t[l];
|
147
|
+
r.find((o) => s(i, o)) || n.push(i);
|
148
|
+
}
|
149
|
+
return n;
|
150
|
+
}, d.contains = (t, e) => t.indexOf(e) > -1, d.filterContains = (t, e, s) => {
|
151
|
+
let r = [];
|
152
|
+
if (!s)
|
153
|
+
return t;
|
154
|
+
for (let n = 0; n < t.length; n++) {
|
155
|
+
let l = t[n];
|
156
|
+
if (l)
|
157
|
+
for (let i = 0; i < e.length; i++) {
|
158
|
+
let u = e[i];
|
159
|
+
l[u].toString().toUpperCase().includes(s.toUpperCase()) && r.push(l);
|
160
|
+
}
|
161
|
+
}
|
162
|
+
return r;
|
163
|
+
}, d.same = (t, e) => {
|
164
|
+
if (t.length != e.length)
|
165
|
+
return !1;
|
166
|
+
let s = t.length >= e.length ? t : e, r = t.length < e.length ? t : e;
|
167
|
+
for (let n in s)
|
168
|
+
if (s[n] != r[n])
|
169
|
+
return !1;
|
170
|
+
return !0;
|
171
|
+
}, d.max = (t, e) => lt.max(t, e), d.min = (t, e) => lt.min(t, e), d.sum = (t, e, s = null) => {
|
172
|
+
let r = 0;
|
173
|
+
for (let l = 0; l < t.length; l++)
|
174
|
+
r += e(t[l]);
|
175
|
+
return s == null ? r : parseFloat(r.toFixed(s));
|
176
|
+
}, d.avg = (t, e, s = null) => {
|
177
|
+
let n = d.sum(t, e) / t.length;
|
178
|
+
return s == null ? n : parseFloat(n.toFixed(s));
|
179
|
+
}, d.distinct = (t, e) => {
|
180
|
+
let s = new Set(t.map((n) => e(n)));
|
181
|
+
return Array.from(s);
|
182
|
+
}, d.pushIfNotExist = (t, e) => {
|
183
|
+
t.indexOf(e) == -1 && t.push(e);
|
184
|
+
}, d.fromValues = (t, e, s, r) => {
|
185
|
+
if (!t || t.length == 0 || !e || e.length == 0)
|
186
|
+
return [];
|
187
|
+
let n = [];
|
188
|
+
return t.forEach((l) => {
|
189
|
+
let i = e.find((u) => u[s] == l);
|
190
|
+
i || (i = { [s]: l, [r]: l }), n.push(i);
|
191
|
+
}), n;
|
192
|
+
}, d.removeIndex = (t, e, s) => {
|
193
|
+
let r = t.split(s);
|
194
|
+
return r.splice(e, 1), r.join(s);
|
195
|
+
}, d.split = (t, e, s = null) => {
|
196
|
+
let r = [];
|
197
|
+
return t && (r = t.split(e)), s != null && r.push(s), r;
|
198
|
+
}, d.combine = (...t) => {
|
199
|
+
let e = [], s = lt.max(t, (r) => r.length);
|
200
|
+
for (let r = 0; r < s.length; r++) {
|
201
|
+
let n = [], l;
|
202
|
+
for (let i = 0; i < t.length; i++) {
|
203
|
+
let u = t[i][r];
|
204
|
+
u != null && (l = u);
|
205
|
+
break;
|
206
|
+
}
|
207
|
+
for (let i = 0; i < t.length; i++) {
|
208
|
+
let u = t[i][r];
|
209
|
+
u != null ? n.push(u) : n.push(l);
|
210
|
+
}
|
211
|
+
e.push(n);
|
212
|
+
}
|
213
|
+
return e;
|
214
|
+
}, d.insert = (t, e, s) => {
|
215
|
+
let r = t.indexOf(e);
|
216
|
+
return t.splice(r, 0, s), r;
|
217
|
+
}, d.append = (t, e, s) => {
|
218
|
+
let r = t.indexOf(e) + 1;
|
219
|
+
return t.splice(r, 0, s), r;
|
220
|
+
}, d.remove = (t, e) => {
|
221
|
+
if (y.isNumber(e))
|
222
|
+
t.splice(e, 1);
|
223
|
+
else if (y.isArray(e))
|
224
|
+
for (let s = 0; s < e.length; s++)
|
225
|
+
d.remove(t, e[s]);
|
226
|
+
else
|
227
|
+
t.splice(t.indexOf(e), 1);
|
228
|
+
}, d.orderBy = (t, e, s = !0) => {
|
229
|
+
y.isArray(e) || (e = [e]);
|
230
|
+
let r = t.sort((n, l) => {
|
231
|
+
let i = e[0](n) - e[0](l);
|
232
|
+
return i == 0 && e[1] ? e[1](n) - e[1](l) : i;
|
233
|
+
});
|
234
|
+
return s ? r.reverse() : r;
|
235
|
+
}, d.groupByArray = (t, e) => {
|
236
|
+
let s = [];
|
237
|
+
return t.forEach((r) => {
|
238
|
+
let n = e(r), l = s.find((i) => i.key == n);
|
239
|
+
l == null && (l = { key: n, value: [] }, s.push(l)), l.value.push(r);
|
240
|
+
}), s;
|
241
|
+
}, d.groupBy = (t, e, s = null) => {
|
242
|
+
let r = {};
|
243
|
+
return t.forEach((n) => {
|
244
|
+
let l = e(n);
|
245
|
+
r[l] == null && (r[l] = []), r[l].push(n);
|
246
|
+
}), s && Object.keys(r).forEach((n) => {
|
247
|
+
r[n] = s(r[n]);
|
248
|
+
}), r;
|
249
|
+
};
|
250
|
+
let z = d;
|
251
|
+
class Ue {
|
252
|
+
}
|
253
|
+
const T = class T {
|
254
|
+
/**
|
255
|
+
* 根据字符串Ascii码得到固定颜色字典
|
256
|
+
*/
|
257
|
+
static getColors(t) {
|
258
|
+
let e = {}, s = 0;
|
259
|
+
for (let r = 0; r < t.length; r++) {
|
260
|
+
let n = t[r], l = 0;
|
261
|
+
for (let i = 0; i < n.length; i++)
|
262
|
+
l += n.charCodeAt(i);
|
263
|
+
l > s && (s = l);
|
264
|
+
}
|
265
|
+
for (let r = 0; r < t.length; r++) {
|
266
|
+
let n = t[r], l = 0;
|
267
|
+
for (let g = 0; g < n.length; g++)
|
268
|
+
l += n.charCodeAt(g);
|
269
|
+
let i = l / s, u = 255 * i, o = 255 * (1 - i), c = 255 * (1 - i);
|
270
|
+
e[n] = `rgb(${u}, ${o}, ${c})`;
|
271
|
+
}
|
272
|
+
return e;
|
273
|
+
}
|
274
|
+
//#region 类
|
275
|
+
/**
|
276
|
+
* 获取样式名
|
277
|
+
*/
|
278
|
+
static getClass(...t) {
|
279
|
+
if (t.length == 0)
|
280
|
+
return null;
|
281
|
+
let e = "";
|
282
|
+
for (let s = 0; s < t.length; s++) {
|
283
|
+
let r = t[s];
|
284
|
+
S.isNullOrEmpty(r) || (e += r, s != t.length - 1 && (e += " "));
|
285
|
+
}
|
286
|
+
return e;
|
287
|
+
}
|
288
|
+
//#endregion
|
289
|
+
//#region 样式
|
290
|
+
/**
|
291
|
+
* 根据计算后的样式进行DOM过滤
|
292
|
+
*/
|
293
|
+
static filterStyle(t, e) {
|
294
|
+
let s = [];
|
295
|
+
return t.forEach((r) => {
|
296
|
+
let n = getComputedStyle(r, null);
|
297
|
+
e(n) && s.push(r);
|
298
|
+
}), s;
|
299
|
+
}
|
300
|
+
/**
|
301
|
+
* 添加样式
|
302
|
+
*/
|
303
|
+
static addStyle(t, e, s) {
|
304
|
+
t.style[e] = s;
|
305
|
+
}
|
306
|
+
//#endregion
|
307
|
+
//#region 查找
|
308
|
+
/**
|
309
|
+
* 查找指定父节点
|
310
|
+
*/
|
311
|
+
static parentUntil(t, e) {
|
312
|
+
if (!t)
|
313
|
+
return null;
|
314
|
+
let s = t.parentNode;
|
315
|
+
for (; s != null; ) {
|
316
|
+
let r = e.substring(1);
|
317
|
+
if (s.classList.contains(r))
|
318
|
+
return s;
|
319
|
+
s = s.parentNode;
|
320
|
+
}
|
321
|
+
return null;
|
322
|
+
}
|
323
|
+
/**
|
324
|
+
* 查找第一个绝对定位的元素或backdrop元素,否则使用html元素
|
325
|
+
*/
|
326
|
+
static parentAbsolute(t) {
|
327
|
+
if (!t)
|
328
|
+
return null;
|
329
|
+
let e = t.parentNode;
|
330
|
+
for (; e != null; ) {
|
331
|
+
if (e.nodeName == "HTML")
|
332
|
+
return e;
|
333
|
+
let s = getComputedStyle(e, null);
|
334
|
+
if (s.getPropertyValue("backdrop-filter") != "none")
|
335
|
+
return e;
|
336
|
+
let n = s.getPropertyValue("position");
|
337
|
+
if (n == "absolute" || n == "fixed")
|
338
|
+
return e;
|
339
|
+
e = e.parentNode;
|
340
|
+
}
|
341
|
+
return null;
|
342
|
+
}
|
343
|
+
/**
|
344
|
+
* 查找孩子节点
|
345
|
+
*/
|
346
|
+
static find(t, e) {
|
347
|
+
return t.querySelector(e);
|
348
|
+
}
|
349
|
+
/**
|
350
|
+
* 统计所有控件宽度,含外边距
|
351
|
+
*/
|
352
|
+
static getWidth(t) {
|
353
|
+
return this.getWidthOrHeight(t, "width", (s) => {
|
354
|
+
let r = getComputedStyle(s);
|
355
|
+
return parseFloat(r.marginLeft) + parseFloat(r.marginRight);
|
356
|
+
});
|
357
|
+
}
|
358
|
+
/**
|
359
|
+
* 获取元素可用宽度(移除内填充)
|
360
|
+
*/
|
361
|
+
static getAvailableWidth(t) {
|
362
|
+
return this.getWidthOrHeight(t, "height", (s) => {
|
363
|
+
let r = getComputedStyle(s);
|
364
|
+
return -(parseFloat(r.paddingLeft) + parseFloat(r.paddingRight));
|
365
|
+
});
|
366
|
+
}
|
367
|
+
/**
|
368
|
+
* 统计所有非固定定位控件高度,含内填充和外边距
|
369
|
+
*/
|
370
|
+
static getHeight(t) {
|
371
|
+
return this.getWidthOrHeight(t, "height", (s) => {
|
372
|
+
let r = getComputedStyle(s);
|
373
|
+
return parseFloat(r.marginTop) + parseFloat(r.marginBottom);
|
374
|
+
});
|
375
|
+
}
|
376
|
+
/**
|
377
|
+
* 获取元素可用高度(移除内填充)
|
378
|
+
*/
|
379
|
+
static getAvailableHeight(t) {
|
380
|
+
return this.getWidthOrHeight(t, "height", (s) => {
|
381
|
+
let r = getComputedStyle(s), n = parseFloat(r.paddingTop) + parseFloat(r.paddingBottom), l = parseFloat(r.borderTopWidth) + parseFloat(r.borderBottomWidth);
|
382
|
+
return -(n + l);
|
383
|
+
});
|
384
|
+
}
|
385
|
+
//#endregion
|
386
|
+
/**
|
387
|
+
* 获取指定元素在视口内的位置
|
388
|
+
*/
|
389
|
+
static getViewportStyle(t, e, s, r, n) {
|
390
|
+
let l = t.querySelector(s);
|
391
|
+
if (!l)
|
392
|
+
return null;
|
393
|
+
let i = {}, u = t.getBoundingClientRect(), o = r.getBoundingClientRect(), g = t.querySelector(e).getBoundingClientRect(), p = l.getBoundingClientRect(), v = o.height - g.top;
|
394
|
+
if (n == "right") {
|
395
|
+
i.left = `${u.left + u.width}px`;
|
396
|
+
let F;
|
397
|
+
p.height > o.height ? F = o.height : F = p.height, i.height = `${F}px`, F + g.top > o.height ? (i.top = "initial", i.bottom = "0px") : i.top = `${u.top}px`;
|
398
|
+
} else if (n == "bottom")
|
399
|
+
v -= g.height, i.left = `${u.left}px`, i.top = `${u.top + u.height}px`, v < p.height ? i.height = `${v}px` : i.height = `${p.height}px`;
|
400
|
+
else
|
401
|
+
throw new Error(`暂未支持的position:${n}`);
|
402
|
+
return i;
|
403
|
+
}
|
404
|
+
/**
|
405
|
+
* 获取指定选择器最大的索引
|
406
|
+
*/
|
407
|
+
static getMaxIndex(t) {
|
408
|
+
let e = document.querySelectorAll(t);
|
409
|
+
if (e.length == 0)
|
410
|
+
return 0;
|
411
|
+
let s = [];
|
412
|
+
for (let n = 0; n < e.length; n++) {
|
413
|
+
let l = e[n], i = getComputedStyle(l), u = i.zIndex == "auto" ? 0 : i.zIndex;
|
414
|
+
s.push(u);
|
415
|
+
}
|
416
|
+
return Math.max(...s);
|
417
|
+
}
|
418
|
+
/**
|
419
|
+
* 判断当前鼠标位置是否在指定范围之内
|
420
|
+
*/
|
421
|
+
static inRange(t, e, s, r, n) {
|
422
|
+
let l = t.clientX >= e && t.clientX <= e + r, i = t.clientY >= s && t.clientY <= s + n;
|
423
|
+
return l && i;
|
424
|
+
}
|
425
|
+
//#region 创建
|
426
|
+
/**
|
427
|
+
* 创建指定标签的dom,并设置内容
|
428
|
+
*/
|
429
|
+
static create(t, e = null, s = null) {
|
430
|
+
let r = document.createElement(t);
|
431
|
+
if (e != null) {
|
432
|
+
let n = e.substring(1);
|
433
|
+
r.classList.add(n);
|
434
|
+
}
|
435
|
+
return s != null && (r.innerHTML = s), r;
|
436
|
+
}
|
437
|
+
/**
|
438
|
+
* 不存在时创建dom,并自动追加到文档
|
439
|
+
*/
|
440
|
+
static createIfAbsent(t, e, s = null) {
|
441
|
+
let r = document.querySelector(e);
|
442
|
+
if (r)
|
443
|
+
return r;
|
444
|
+
let n = this.create(t, e, s);
|
445
|
+
return document.body.append(n), n;
|
446
|
+
}
|
447
|
+
//#endregion
|
448
|
+
//#region 文本
|
449
|
+
/**
|
450
|
+
* 获取文本宽度
|
451
|
+
*/
|
452
|
+
static getTextWidth(t) {
|
453
|
+
let e = this.createIfAbsent("div", ".ha-measure"), s = this.create("span", null, t);
|
454
|
+
e.append(s);
|
455
|
+
let r = s.offsetWidth;
|
456
|
+
return s.remove(), r;
|
457
|
+
}
|
458
|
+
//#endregion
|
459
|
+
};
|
460
|
+
T.addClass = (t, e, s = null) => {
|
461
|
+
let r;
|
462
|
+
if (e == null || e == "") {
|
463
|
+
if (s == null || s == "")
|
464
|
+
return;
|
465
|
+
r = s;
|
466
|
+
} else
|
467
|
+
r = e;
|
468
|
+
t.classList.add(r);
|
469
|
+
}, T.removeClass = (t, e, s = null) => {
|
470
|
+
if (e == null || e == "")
|
471
|
+
return;
|
472
|
+
let r = [];
|
473
|
+
if (typeof t == "string") {
|
474
|
+
let n = Array.from(document.querySelectorAll(t));
|
475
|
+
r.push(...n);
|
476
|
+
} else
|
477
|
+
r.push(t);
|
478
|
+
for (let n = 0; n < r.length; n++) {
|
479
|
+
let l = r[n];
|
480
|
+
s != l && l.classList.remove(e);
|
481
|
+
}
|
482
|
+
}, T.getWidthOrHeight = (t, e, s = null) => {
|
483
|
+
let r = 0, n = [];
|
484
|
+
y.isArray(t) ? n.push(...t) : n.push(t);
|
485
|
+
for (let l = 0; l < n.length; l++) {
|
486
|
+
let i = n[l];
|
487
|
+
if (!i || !i.getBoundingClientRect)
|
488
|
+
continue;
|
489
|
+
let u = i.getBoundingClientRect();
|
490
|
+
r += u[e], s && (r += s(i));
|
491
|
+
}
|
492
|
+
return r;
|
493
|
+
};
|
494
|
+
let U = T;
|
495
|
+
class X {
|
496
|
+
/**
|
497
|
+
* 从指定字典中提取忽略大小写的key的值
|
498
|
+
*/
|
499
|
+
static getValueIgnoreCase(t, e) {
|
500
|
+
let s = Object.keys(e);
|
501
|
+
for (let r = 0; r < s.length; r++) {
|
502
|
+
let n = s[r];
|
503
|
+
if (n.toUpperCase() == t.toUpperCase())
|
504
|
+
return e[n];
|
505
|
+
}
|
506
|
+
return null;
|
507
|
+
}
|
508
|
+
/**
|
509
|
+
* 对字典进行排序,并得到新字典
|
510
|
+
*/
|
511
|
+
static sort(t) {
|
512
|
+
let e = {}, r = Object.keys(t).sort();
|
513
|
+
for (let n of r)
|
514
|
+
e[n] = t[n];
|
515
|
+
return e;
|
516
|
+
}
|
517
|
+
// #region 连接
|
518
|
+
/**
|
519
|
+
* 连接字典
|
520
|
+
*/
|
521
|
+
static join(t, e = null, s = null, r = null) {
|
522
|
+
let n = "";
|
523
|
+
if (t == null)
|
524
|
+
return n;
|
525
|
+
let l = Object.keys(t);
|
526
|
+
for (let i = 0; i < l.length; i++) {
|
527
|
+
let u = l[i], o = e == null ? t[u] : e(t[u]);
|
528
|
+
n = n.concat(u).concat(s).concat(o), i != l.length - 1 && (n += r);
|
529
|
+
}
|
530
|
+
return n;
|
531
|
+
}
|
532
|
+
// #endregion
|
533
|
+
}
|
534
|
+
const j = class j {
|
535
|
+
};
|
536
|
+
j.bind = (t, e, s) => {
|
537
|
+
e && t.forEach((r) => {
|
538
|
+
e.addEventListener(r, s, !0);
|
539
|
+
});
|
540
|
+
}, j.unbind = (t, e, s) => {
|
541
|
+
e && t.forEach((r) => {
|
542
|
+
e.removeEventListener(r, s, !0);
|
543
|
+
});
|
544
|
+
}, j.click = (t, e) => {
|
545
|
+
t && t.addEventListener("click", e, !0);
|
546
|
+
}, j.unclick = (t, e) => {
|
547
|
+
t && t.removeEventListener("click", e, !0);
|
548
|
+
}, j.scroll = (t, e) => {
|
549
|
+
t && t.addEventListener("scroll", e, !0);
|
550
|
+
}, j.unscroll = (t, e) => {
|
551
|
+
t && t.removeEventListener("scroll", e, !0);
|
552
|
+
};
|
553
|
+
let bt = j;
|
554
|
+
const I = class I {
|
555
|
+
};
|
556
|
+
I.save = (t, e) => {
|
557
|
+
let s = window.atob(t), r = s.length, n = new Uint8Array(r);
|
558
|
+
for (; r--; )
|
559
|
+
n[r] = s.charCodeAt(r);
|
560
|
+
let l = new Blob([n]);
|
561
|
+
$t.saveAs(l, e);
|
562
|
+
}, I.getExtension = (t) => {
|
563
|
+
let e = t.lastIndexOf(".");
|
564
|
+
return e == -1 ? "" : t.substring(e).split("?")[0];
|
565
|
+
}, I.isExcel = (t) => {
|
566
|
+
let e = I.getExtension(t);
|
567
|
+
return [".xls", ".xlsx"].indexOf(e) > -1;
|
568
|
+
}, I.isImage = (t) => {
|
569
|
+
let e = I.getExtension(t);
|
570
|
+
return [".png", ".jpg", ".jpeg", ".bmp", ".gif"].indexOf(e) > -1;
|
571
|
+
};
|
572
|
+
let Z = I;
|
573
|
+
const mt = class mt {
|
574
|
+
};
|
575
|
+
mt.getHtml = (t) => y.isNumber(t) ? t : t && t.replace(/\n/g, "<br/>");
|
576
|
+
let wt = mt;
|
577
|
+
const pt = class pt {
|
578
|
+
};
|
579
|
+
pt.base64 = (t) => "data:image/png;base64," + t;
|
580
|
+
let St = pt;
|
581
|
+
const b = class b {
|
582
|
+
/**
|
583
|
+
* 生成指定范围内的随机数
|
584
|
+
*/
|
585
|
+
static random(t, e) {
|
586
|
+
let s = t + Math.random() * (e - t);
|
587
|
+
var r = parseInt(s.toString());
|
588
|
+
return r;
|
589
|
+
}
|
590
|
+
/**
|
591
|
+
* 获取最大值
|
592
|
+
*/
|
593
|
+
static max(...t) {
|
594
|
+
return Math.max(...t);
|
595
|
+
}
|
596
|
+
};
|
597
|
+
b.filterPage = (t, e, s) => {
|
598
|
+
let r = (e - 1) * s, n = e * s;
|
599
|
+
return t.filter((i, u) => u >= r && u < n);
|
600
|
+
}, b.pageCount = (t, e) => Math.ceil(t / e), b.round = (t, e) => t.toFixed(e), b.ceil = (t) => Math.ceil(t), b.getPercentage = (t, e) => {
|
601
|
+
if (!t || !e)
|
602
|
+
return 0;
|
603
|
+
let s = t / e * 100, r = b.round(s, 2);
|
604
|
+
return parseFloat(r);
|
605
|
+
}, b.getPercentageText = (t, e) => b.getPercentage(t, e).toFixed(2), b.getProgressText = (t, e) => `${t ?? "-"}/${e ?? "-"}`, b.size = (t) => {
|
606
|
+
if (!t)
|
607
|
+
return "OKB";
|
608
|
+
let e = 1024, s = e * 1024;
|
609
|
+
if (t < s)
|
610
|
+
return b.round(t / e, 2) + "KB";
|
611
|
+
let r = s * 1024;
|
612
|
+
if (t < r)
|
613
|
+
return b.round(t / s, 2) + "MB";
|
614
|
+
let n = r * 1024;
|
615
|
+
if (t < n)
|
616
|
+
return b.round(t / r, 2) + "GB";
|
617
|
+
let l = n * 1024;
|
618
|
+
if (t < l)
|
619
|
+
return b.round(t / n, 2) + "TB";
|
620
|
+
throw new Error("暂未支持比TB更大的大小");
|
621
|
+
};
|
622
|
+
let xt = b;
|
623
|
+
const yt = class yt {
|
624
|
+
};
|
625
|
+
yt.load = function(t, e, s, r) {
|
626
|
+
};
|
627
|
+
let kt = yt;
|
628
|
+
const M = class M {
|
629
|
+
};
|
630
|
+
M.emit = (t, e) => {
|
631
|
+
M.emits({ [t]: e });
|
632
|
+
}, M.emits = (t) => {
|
633
|
+
var s, r;
|
634
|
+
let e = (r = (s = window.parent) == null ? void 0 : s.window) == null ? void 0 : r.emit;
|
635
|
+
e && Object.keys(t).forEach((n) => {
|
636
|
+
e(n, t[n]);
|
637
|
+
});
|
638
|
+
};
|
639
|
+
let G = M;
|
640
|
+
const q = class q {
|
641
|
+
/**
|
642
|
+
* 净化对象,返回不带默认属性的对象
|
643
|
+
*/
|
644
|
+
static pure(t) {
|
645
|
+
let e = {}, s = Object.keys(t);
|
646
|
+
for (let r = 0; r < s.length; r++) {
|
647
|
+
let n = s[r], l = t[n];
|
648
|
+
l != null && (y.isObject(l) ? e[n] = this.pure(l) : e[n] = t[n]);
|
649
|
+
}
|
650
|
+
return e;
|
651
|
+
}
|
652
|
+
/**
|
653
|
+
* 过滤key,并输出新对象
|
654
|
+
*/
|
655
|
+
static filter(t, e, s) {
|
656
|
+
let r = [];
|
657
|
+
return Object.keys(t).forEach((n) => {
|
658
|
+
let l = { key: n, value: t[n] };
|
659
|
+
e(l) && r.push(s(l));
|
660
|
+
}), r;
|
661
|
+
}
|
662
|
+
/**
|
663
|
+
* 把数组转换成对象
|
664
|
+
*/
|
665
|
+
static toObject(t, e, s) {
|
666
|
+
let r = {};
|
667
|
+
for (let n = 0; n < t.length; n++) {
|
668
|
+
let l = t[n];
|
669
|
+
r[e(l)] = s(l);
|
670
|
+
}
|
671
|
+
return r;
|
672
|
+
}
|
673
|
+
};
|
674
|
+
q.copy = (t, e = null) => {
|
675
|
+
let s = [];
|
676
|
+
y.isObject(t) && s.push(t);
|
677
|
+
let r = [];
|
678
|
+
for (let n = 0; n < s.length; n++) {
|
679
|
+
let l = s[n], i = {};
|
680
|
+
Object.keys(l).forEach((u) => {
|
681
|
+
let o = l[u];
|
682
|
+
e && e[u] ? i[u] = e[u]() : i[u] = o;
|
683
|
+
}), r.push(i);
|
684
|
+
}
|
685
|
+
return y.isObject(t) ? r[0] : r;
|
686
|
+
}, q.clone = (t, e = null) => {
|
687
|
+
let s = Ut(t, !0);
|
688
|
+
if (e == null)
|
689
|
+
return s;
|
690
|
+
if (y.isArray(t))
|
691
|
+
for (let r = 0; r < s.length; r++)
|
692
|
+
e(s[r]);
|
693
|
+
else y.isObject(t) && e(s);
|
694
|
+
return s;
|
695
|
+
}, q.mergeTo = (t, e) => t == null ? e : e == null ? t : y.isArray(e) ? e.slice() : (Object.keys(e).forEach((r) => {
|
696
|
+
let n = e[r];
|
697
|
+
typeof n == "object" ? t[r] = q.mergeTo(t[r], n) : t[r] = n;
|
698
|
+
}), t), q.addProperties = (t, e, s) => {
|
699
|
+
let r = t;
|
700
|
+
for (let n = 0; n < e.length; n++) {
|
701
|
+
let l = e[n];
|
702
|
+
n == e.length - 1 ? r[l] = s : (r[l] || (r[l] = {}), r = r[l]);
|
703
|
+
}
|
704
|
+
};
|
705
|
+
let R = q;
|
706
|
+
const C = class C {
|
707
|
+
};
|
708
|
+
C.loadContentAsync = async (t) => {
|
709
|
+
let e = t instanceof Array ? t : [t], s = [];
|
710
|
+
for (let r = 0; r < e.length; r++) {
|
711
|
+
let n = e[r], l = new Promise((i, u) => {
|
712
|
+
let o = new XMLHttpRequest();
|
713
|
+
o.open("GET", n, !1), o.onreadystatechange = () => {
|
714
|
+
if (o.readyState == 4) {
|
715
|
+
let c = C.getInnerTagByUrl(n);
|
716
|
+
c.appendChild(document.createTextNode(o.responseText)), document.head.appendChild(c), i();
|
717
|
+
}
|
718
|
+
}, o.onerror = () => {
|
719
|
+
u();
|
720
|
+
}, o.send(null);
|
721
|
+
});
|
722
|
+
s.push(l);
|
723
|
+
}
|
724
|
+
return Promise.all(s);
|
725
|
+
}, C.loadPathAsync = async (t, e) => {
|
726
|
+
let s = [];
|
727
|
+
for (let r = 0; r < e.length; r++)
|
728
|
+
s.push(t + e[r]);
|
729
|
+
await C.loadAsync(s);
|
730
|
+
}, C.loadAsync = async (t) => {
|
731
|
+
let e = S.getArray(t), s = [];
|
732
|
+
for (let r = 0; r < e.length; r++) {
|
733
|
+
let n = new Promise((l, i) => {
|
734
|
+
let u = e[r], o = C.getOuterTagByUrl(u);
|
735
|
+
document.head.appendChild(o), o.onload = (c) => {
|
736
|
+
l(c);
|
737
|
+
}, o.onerror = (c) => {
|
738
|
+
i(c);
|
739
|
+
};
|
740
|
+
});
|
741
|
+
s.push(n);
|
742
|
+
}
|
743
|
+
return new Promise((r, n) => {
|
744
|
+
Promise.all(s).then(() => {
|
745
|
+
r();
|
746
|
+
}).catch(() => {
|
747
|
+
n();
|
748
|
+
});
|
749
|
+
});
|
750
|
+
}, C.loadAll = (...t) => Promise.all(t), C.getInnerTagByUrl = (t) => Z.getExtension(t).substring(1) == "css" ? document.createElement("style") : document.createElement("script"), C.getOuterTagByUrl = (t) => {
|
751
|
+
if (Z.getExtension(t).substring(1) == "css") {
|
752
|
+
let r = document.createElement("link");
|
753
|
+
return r.rel = "stylesheet", r.href = t, r;
|
754
|
+
}
|
755
|
+
let s = document.createElement("script");
|
756
|
+
return s.src = t, s;
|
757
|
+
};
|
758
|
+
let H = C;
|
759
|
+
const A = class A {
|
760
|
+
};
|
761
|
+
A.delay = (t, e) => setTimeout(t, e), A.execute = (t, e, s) => {
|
762
|
+
if (!s) {
|
763
|
+
let r = setInterval(t, e);
|
764
|
+
return Promise.resolve(r);
|
765
|
+
}
|
766
|
+
return new Promise((r) => {
|
767
|
+
setTimeout(() => {
|
768
|
+
let n = setInterval(t, e);
|
769
|
+
r(n);
|
770
|
+
}, s);
|
771
|
+
});
|
772
|
+
}, A.clearInterval = (t) => {
|
773
|
+
clearInterval(t);
|
774
|
+
}, A.debounce = (t, e) => {
|
775
|
+
let s = null;
|
776
|
+
return (r) => {
|
777
|
+
s && clearTimeout(s), s = setTimeout(t, e, r);
|
778
|
+
};
|
779
|
+
}, A.throttle = (t, e) => {
|
780
|
+
let s = !0;
|
781
|
+
return (r) => {
|
782
|
+
if (!s)
|
783
|
+
return !1;
|
784
|
+
s = !1, setTimeout((n) => {
|
785
|
+
t(n), s = !0;
|
786
|
+
}, e, r);
|
787
|
+
};
|
788
|
+
};
|
789
|
+
let Ct = A;
|
790
|
+
const m = class m {
|
791
|
+
};
|
792
|
+
m.getTimestamp = (t = null) => (t ? new Date(t) : /* @__PURE__ */ new Date()).getTime(), m.getTime = (t = null) => t ? new Date(t) : /* @__PURE__ */ new Date(), m.format = (t, e) => E(t).format(e), m.getDateTimeString = () => m.formatSecondTime(/* @__PURE__ */ new Date()), m.getDateString = () => m.formatDate(/* @__PURE__ */ new Date()), m.getTimeString = () => m.formatTime(/* @__PURE__ */ new Date()), m.formatSecondTime = (t) => E(t).format("YYYY-MM-DD HH:mm:ss"), m.formatMillisecondTime = (t) => t ? E(t).format("YYYY-MM-DD HH:mm:ss SSS") : null, m.formatTime = (t) => t ? E(t).format("HH:mm:ss SSS") : null, m.formatDate = (t) => t ? E(t).format("YYYY-MM-DD") : null, m.addDays = (t, e) => t ? E(t).add(e, "days").format() : null, m.addMonths = (t, e) => t ? E(t).add(e, "months").format() : null, m.isWeekend = (t) => {
|
793
|
+
if (!t)
|
794
|
+
return !1;
|
795
|
+
let e = E(t).format("d");
|
796
|
+
return e == "6" || e == "0";
|
797
|
+
}, m.localeTime = (t) => {
|
798
|
+
if (!t)
|
799
|
+
return null;
|
800
|
+
let s = (/* @__PURE__ */ new Date()).getTimezoneOffset() + 480;
|
801
|
+
return E(t).add(s, "minutes").format();
|
802
|
+
};
|
803
|
+
let D = m;
|
804
|
+
const f = class f {
|
805
|
+
};
|
806
|
+
f.getById = (t, e, s, r) => {
|
807
|
+
if (!s)
|
808
|
+
return null;
|
809
|
+
let n = s.find((l) => l[e] == t) || null;
|
810
|
+
if (n != null)
|
811
|
+
return n;
|
812
|
+
for (let l = 0; l < s.length; l++) {
|
813
|
+
let i = f.getById(t, e, s[l][r], r);
|
814
|
+
if (i != null) {
|
815
|
+
n = i;
|
816
|
+
break;
|
817
|
+
}
|
818
|
+
}
|
819
|
+
return n;
|
820
|
+
}, f.getByIds = (t, e, s, r) => {
|
821
|
+
let n = z.distinct(t, (i) => i), l = [];
|
822
|
+
return n.forEach((i) => {
|
823
|
+
let u = f.getById(i, e, s, r);
|
824
|
+
l.push(u);
|
825
|
+
}), l;
|
826
|
+
}, f.getNextById = (t, e, s, r) => {
|
827
|
+
let n = f.getById(t, e, s, r), l = f.getParentsById(t, e, s, r);
|
828
|
+
if (l.length == 0) {
|
829
|
+
if (s.length == 1)
|
830
|
+
return null;
|
831
|
+
let c = s.indexOf(n);
|
832
|
+
return c == s.length - 1 ? s[c - 1] : s[c + 1];
|
833
|
+
}
|
834
|
+
let i = l[l.length - 1], u = i[r];
|
835
|
+
if (u.length == 1)
|
836
|
+
return i;
|
837
|
+
let o = u.indexOf(n);
|
838
|
+
return o == u.length - 1 ? u[o - 1] : u[o + 1];
|
839
|
+
}, f.getSiblingsById = (t, e, s, r) => {
|
840
|
+
let n = f.getParentById(t, e, s, r);
|
841
|
+
return n == null ? s : n[r];
|
842
|
+
}, f.getParentById = (t, e, s, r) => {
|
843
|
+
let n = f.getParentsById(t, e, s, r, !1);
|
844
|
+
return n[n.length - 1];
|
845
|
+
}, f.getParentsById = (t, e, s, r, n = !1) => {
|
846
|
+
let l = [];
|
847
|
+
return vt(t, e, s, r, l, n), l;
|
848
|
+
}, f.getChildrenById = (t, e, s, r, n = !1) => {
|
849
|
+
let l = f.getById(t, e, s, r), i = [];
|
850
|
+
return n && i.push(l), ut(l, r, i), i;
|
851
|
+
}, f.getChildren = (t, e, s = !1) => {
|
852
|
+
let r = [];
|
853
|
+
return s && r.push(t), ut(t, e, r), r;
|
854
|
+
}, f.searchTree = (t, e, s, r) => {
|
855
|
+
let n = [];
|
856
|
+
if (!e)
|
857
|
+
return n;
|
858
|
+
let l = t ? t.toUpperCase() : "", i = y.isString(r) ? [r] : r;
|
859
|
+
for (let u of e) {
|
860
|
+
let o = !1, c = f.getChildren(u, s, !0);
|
861
|
+
for (let g of c) {
|
862
|
+
for (let p of i) {
|
863
|
+
let v = g[p];
|
864
|
+
if ((v ? v.toUpperCase() : "").indexOf(l) > -1) {
|
865
|
+
o = !0;
|
866
|
+
break;
|
867
|
+
}
|
868
|
+
}
|
869
|
+
if (o)
|
870
|
+
break;
|
871
|
+
}
|
872
|
+
if (o) {
|
873
|
+
let g = f.searchTree(t, u[s], s, r), p = { ...u, [s]: g };
|
874
|
+
n.push(p);
|
875
|
+
}
|
876
|
+
}
|
877
|
+
return n;
|
878
|
+
}, f.removeById = (t, e, s, r) => {
|
879
|
+
let n = f.getById(t, e, s, r), l = f.getParentsById(t, e, s, r);
|
880
|
+
if (l.length == 0) {
|
881
|
+
z.remove(s, n);
|
882
|
+
return;
|
883
|
+
}
|
884
|
+
let i = l[l.length - 1];
|
885
|
+
z.remove(i[r], n);
|
886
|
+
}, f.getFlat = (t, e) => {
|
887
|
+
let s = [...t];
|
888
|
+
for (let r = 0; r < t.length; r++) {
|
889
|
+
let l = t[r][e];
|
890
|
+
if (l.length > 0) {
|
891
|
+
let i = f.getFlat(l, e);
|
892
|
+
s.push(...i);
|
893
|
+
}
|
894
|
+
}
|
895
|
+
return s;
|
896
|
+
}, f.map = (t, e, s, r) => {
|
897
|
+
let n = [];
|
898
|
+
for (let l = 0; l < t.length; l++) {
|
899
|
+
let i = t[l], u = r(i);
|
900
|
+
n.push(u);
|
901
|
+
let o = i[e];
|
902
|
+
if (o && o.length > 0) {
|
903
|
+
let c = f.map(o, e, s, r);
|
904
|
+
u[s] = c;
|
905
|
+
}
|
906
|
+
}
|
907
|
+
return n;
|
908
|
+
};
|
909
|
+
let _ = f;
|
910
|
+
function vt(a, t, e, s, r, n) {
|
911
|
+
for (let l = 0; l < e.length; l++) {
|
912
|
+
let i = e[l];
|
913
|
+
if (i[t] == a) {
|
914
|
+
n && r.push(i);
|
915
|
+
break;
|
916
|
+
} else
|
917
|
+
_.getById(a, t, i[s], s) != null && (r.push(i), vt(a, t, i[s], s, r, n));
|
918
|
+
}
|
919
|
+
return r;
|
920
|
+
}
|
921
|
+
function ut(a, t, e) {
|
922
|
+
let s = a[t];
|
923
|
+
if (!s || s.length == 0)
|
924
|
+
return e;
|
925
|
+
for (let r = 0; r < s.length; r++) {
|
926
|
+
let n = s[r];
|
927
|
+
e.push(n), ut(n, t, e);
|
928
|
+
}
|
929
|
+
return e;
|
930
|
+
}
|
931
|
+
const O = class O {
|
932
|
+
};
|
933
|
+
O.get = (t, e = null) => localStorage.getItem(t) ?? e, O.set = (t, e) => localStorage.setItem(t, e), O.getObject = (t) => JSON.parse(localStorage.getItem(t)), O.setObject = (t, e) => localStorage.setItem(t, JSON.stringify(e)), O.remove = (t) => localStorage.removeItem(t), O.getLeftStorage = () => {
|
934
|
+
let t = 0;
|
935
|
+
return Object.keys(localStorage).forEach((s) => {
|
936
|
+
t += localStorage.getItem(s).length;
|
937
|
+
}), 1e-4 * 1024 - t / 1024;
|
938
|
+
}, O.canStorage = (t) => {
|
939
|
+
let e = JSON.stringify(t).length / 1024;
|
940
|
+
return O.getLeftStorage() > e;
|
941
|
+
};
|
942
|
+
let w = O;
|
943
|
+
const rt = class rt {
|
944
|
+
};
|
945
|
+
rt.isBottom = (t) => {
|
946
|
+
let e = document.querySelector(t);
|
947
|
+
return e ? e.scrollTop + e.clientHeight == e.scrollHeight : !1;
|
948
|
+
}, rt.scrollToBottom = (t) => {
|
949
|
+
let e = document.querySelector(t);
|
950
|
+
if (!e)
|
951
|
+
return;
|
952
|
+
let s = e.scrollHeight - e.clientHeight;
|
953
|
+
e.scrollTop = s;
|
954
|
+
};
|
955
|
+
let Ot = rt;
|
956
|
+
class Ft {
|
957
|
+
/**
|
958
|
+
* 从树集合构建出Json对象
|
959
|
+
*/
|
960
|
+
static buildObject(t, e, s) {
|
961
|
+
return ot(t, e, 1, s);
|
962
|
+
}
|
963
|
+
/**
|
964
|
+
* 把字符串格式化为Json字符串
|
965
|
+
*/
|
966
|
+
static stringify(t) {
|
967
|
+
return JSON.stringify(t, null, 2);
|
968
|
+
}
|
969
|
+
/**
|
970
|
+
* 把字符串格式化为Json字符串
|
971
|
+
*/
|
972
|
+
static stringifyString(t) {
|
973
|
+
if (!t)
|
974
|
+
return null;
|
975
|
+
let e;
|
976
|
+
try {
|
977
|
+
e = JSON.parse(t);
|
978
|
+
} catch {
|
979
|
+
return t;
|
980
|
+
}
|
981
|
+
return JSON.stringify(e, null, 2);
|
982
|
+
}
|
983
|
+
/**
|
984
|
+
* 根据props中的.自动分割得到属性值
|
985
|
+
*/
|
986
|
+
static getValue(t, e) {
|
987
|
+
if (!e)
|
988
|
+
return null;
|
989
|
+
let s = e.split("."), r = t;
|
990
|
+
for (let n of s) {
|
991
|
+
let l = r[n];
|
992
|
+
if (!l)
|
993
|
+
return null;
|
994
|
+
r = l;
|
995
|
+
}
|
996
|
+
return r;
|
997
|
+
}
|
998
|
+
/**
|
999
|
+
* 把json字符串合并到目标对象上
|
1000
|
+
*/
|
1001
|
+
static mergeTo(t, e) {
|
1002
|
+
if (S.isNullOrEmpty(e))
|
1003
|
+
return;
|
1004
|
+
let s = JSON.parse(e);
|
1005
|
+
Object.keys(s).forEach((n) => {
|
1006
|
+
let l = s[n];
|
1007
|
+
t[n] = l;
|
1008
|
+
});
|
1009
|
+
}
|
1010
|
+
}
|
1011
|
+
function ot(a, t, e, s) {
|
1012
|
+
if (!a || a.length == 0)
|
1013
|
+
return "{}";
|
1014
|
+
let r = `{
|
1015
|
+
`;
|
1016
|
+
for (let n = 0; n < a.length; n++) {
|
1017
|
+
let l = a[n], i = s(l);
|
1018
|
+
i.type == "array" ? (i.remark && (r += Q(2 * e) + "//" + i.remark + `
|
1019
|
+
`), r += at(2 * e, i.key) + "[", r += ot(l[t], t, e + 1, s), r += "]", n != a.length - 1 && (r += ",")) : i.type == "object" ? (i.remark && (r += Q(2 * e) + "//" + i.remark + `
|
1020
|
+
`), r += at(2 * e, i.key), r += ot(l[t], t, e + 1, s), n != a.length - 1 && (r += ",")) : (r += at(2 * e, i.key), i.type == "string" ? r += '""' : i.type == "date" ? r += `"${D.getDateTimeString()}"` : i.type == "int" || i.type == "number" ? r += "0" : i.type == "boolean" ? r += "false" : r += null, n != a.length - 1 && (r += ","), i.remark && (r += " //" + i.remark)), r += `
|
1021
|
+
`;
|
1022
|
+
}
|
1023
|
+
return r += Q(2 * (e - 1)), r += "}", r;
|
1024
|
+
}
|
1025
|
+
function Q(a) {
|
1026
|
+
let t = "";
|
1027
|
+
for (let e = 0; e < a; e++)
|
1028
|
+
t += " ";
|
1029
|
+
return t;
|
1030
|
+
}
|
1031
|
+
function at(a, t) {
|
1032
|
+
let e = Q(a);
|
1033
|
+
return e += '"' + t + '": ', e;
|
1034
|
+
}
|
1035
|
+
class dt {
|
1036
|
+
}
|
1037
|
+
class Pt extends dt {
|
1038
|
+
constructor() {
|
1039
|
+
super(...arguments), this.type = "Default";
|
1040
|
+
}
|
1041
|
+
open(t) {
|
1042
|
+
}
|
1043
|
+
send(t) {
|
1044
|
+
return new Promise((e, s) => {
|
1045
|
+
let r = (/* @__PURE__ */ new Date()).getTime(), n = new XMLHttpRequest();
|
1046
|
+
if (n.open(t.method, t.url), t.headers != null)
|
1047
|
+
for (let l of t.headers)
|
1048
|
+
n.setRequestHeader(l, t.headers[l]);
|
1049
|
+
t.contentType != null && n.setRequestHeader("content-type", t.contentType), n.onreadystatechange = () => {
|
1050
|
+
if (n.readyState == 4) {
|
1051
|
+
let i = { elapsed: (/* @__PURE__ */ new Date()).getTime() - r, body: n.responseText, request: t };
|
1052
|
+
e(i);
|
1053
|
+
}
|
1054
|
+
}, n.onerror = (l) => {
|
1055
|
+
let u = { elapsed: (/* @__PURE__ */ new Date()).getTime() - r, body: n.responseText, request: t };
|
1056
|
+
e(u);
|
1057
|
+
}, n.send(t.body);
|
1058
|
+
});
|
1059
|
+
}
|
1060
|
+
}
|
1061
|
+
class jt {
|
1062
|
+
}
|
1063
|
+
class zt extends jt {
|
1064
|
+
constructor() {
|
1065
|
+
super(...arguments), this.type = "Sha256";
|
1066
|
+
}
|
1067
|
+
open(t) {
|
1068
|
+
}
|
1069
|
+
async compute(t) {
|
1070
|
+
let s = new TextEncoder().encode(t), r = await crypto.subtle.digest("SHA-256", s);
|
1071
|
+
return Array.from(new Uint8Array(r)).map((i) => i.toString(16).padStart(2, "0")).join("");
|
1072
|
+
}
|
1073
|
+
}
|
1074
|
+
class Tt extends jt {
|
1075
|
+
constructor() {
|
1076
|
+
super(...arguments), this.type = "Md5";
|
1077
|
+
}
|
1078
|
+
open(t) {
|
1079
|
+
}
|
1080
|
+
compute(t) {
|
1081
|
+
let e = P.MD5(t).toString();
|
1082
|
+
return Promise.resolve(e);
|
1083
|
+
}
|
1084
|
+
}
|
1085
|
+
class tt {
|
1086
|
+
/**
|
1087
|
+
* 创建执行类型的Hash实例
|
1088
|
+
*/
|
1089
|
+
static create(t) {
|
1090
|
+
let s = [new zt(), new Tt()].find((r) => S.equalsIgnoreCase(r.type, t));
|
1091
|
+
if (s == null)
|
1092
|
+
throw new Error(`未实现IHasher: ${t}`);
|
1093
|
+
return s;
|
1094
|
+
}
|
1095
|
+
/**
|
1096
|
+
* 获取MD5 Hash对象
|
1097
|
+
*/
|
1098
|
+
static getMd5() {
|
1099
|
+
return this.md5 != null ? this.md5 : (this.md5 = this.create("Md5"), this.md5);
|
1100
|
+
}
|
1101
|
+
}
|
1102
|
+
class Mt extends dt {
|
1103
|
+
constructor() {
|
1104
|
+
super(...arguments), this.type = "Mk";
|
1105
|
+
}
|
1106
|
+
/**
|
1107
|
+
* 危险操作,会暴露敏感信息
|
1108
|
+
*/
|
1109
|
+
open(t) {
|
1110
|
+
Ft.mergeTo(this, t), this.requester = N.getRequester().getDefault(), this.hasher = tt.create("Sha256");
|
1111
|
+
}
|
1112
|
+
/**
|
1113
|
+
* 危险操作,会暴露敏感信息
|
1114
|
+
*/
|
1115
|
+
async send(t) {
|
1116
|
+
let e = D.getTimestamp(), s = {
|
1117
|
+
app_id: this.appId,
|
1118
|
+
hash_type: "sha256",
|
1119
|
+
timestamp: parseInt((e / 1e3).toString())
|
1120
|
+
};
|
1121
|
+
S.isNullOrEmpty(t.body) || (s.jsonBody = t.body);
|
1122
|
+
let r = k.deserialize(t.path);
|
1123
|
+
for (let g in r)
|
1124
|
+
s[g] = r[g];
|
1125
|
+
let n = k.getPath(t.path);
|
1126
|
+
s = X.sort(s);
|
1127
|
+
let l = te.signDictionary(s, !1), i = `POST${n}?${l}${this.appSecret}`, u = await this.hasher.compute(i);
|
1128
|
+
s.sign = u.toLowerCase(), delete s.jsonBody, s = X.sort(s);
|
1129
|
+
let o = k.serialize(s);
|
1130
|
+
return t.url = k.concatUrl(this.baseUrl, n + "?" + o), await this.requester.send(t);
|
1131
|
+
}
|
1132
|
+
}
|
1133
|
+
class Jt {
|
1134
|
+
}
|
1135
|
+
let ct;
|
1136
|
+
window._setting ? ct = window._setting : ct = window.setting;
|
1137
|
+
const K = ct;
|
1138
|
+
class Wt extends dt {
|
1139
|
+
constructor() {
|
1140
|
+
super(...arguments), this.type = "Local";
|
1141
|
+
}
|
1142
|
+
open(t) {
|
1143
|
+
this.request = Nt.create({
|
1144
|
+
baseURL: K.api.url
|
1145
|
+
// withCredentials: true, // send cookies when cross-domain requests
|
1146
|
+
// timeout: 15000
|
1147
|
+
}), this.request.interceptors.request.use(
|
1148
|
+
async (e) => {
|
1149
|
+
if (k.httpOrHttps(e.url))
|
1150
|
+
return e;
|
1151
|
+
let s = Bt(), r = k.getUrl(e.baseURL + e.url, e.params);
|
1152
|
+
if (e.headers.Authorization = await s.getAuthorization(r, e.data), !e.headers["Accept-Language"]) {
|
1153
|
+
let n = et();
|
1154
|
+
e.headers["Accept-Language"] = n.language;
|
1155
|
+
}
|
1156
|
+
return e;
|
1157
|
+
},
|
1158
|
+
(e) => (console.log(e), Promise.reject(e))
|
1159
|
+
);
|
1160
|
+
}
|
1161
|
+
send(t) {
|
1162
|
+
return Promise.resolve(void 0);
|
1163
|
+
}
|
1164
|
+
/**
|
1165
|
+
* GET请求
|
1166
|
+
*/
|
1167
|
+
async get(t, e = null, s = null) {
|
1168
|
+
let r = { method: "get", url: t, params: e, headers: s };
|
1169
|
+
return this.request(r).then((n) => this.handleResponse(n)).catch((n) => this.handleError(n));
|
1170
|
+
}
|
1171
|
+
/**
|
1172
|
+
* POST请求
|
1173
|
+
*/
|
1174
|
+
async post(t, e = null, s = null) {
|
1175
|
+
return this.request.post(t, e, s).then((r) => this.handleResponse(r)).catch((r) => this.handleError(r));
|
1176
|
+
}
|
1177
|
+
/**
|
1178
|
+
* PATCH请求
|
1179
|
+
*/
|
1180
|
+
async patch(t, e = null, s = null) {
|
1181
|
+
return this.request.patch(t, e, s).then((r) => this.handleResponse(r)).catch((r) => this.handleError(r));
|
1182
|
+
}
|
1183
|
+
/**
|
1184
|
+
* 处理响应信息 或 响应体信息
|
1185
|
+
*/
|
1186
|
+
handleResponse(t) {
|
1187
|
+
if (k.httpOrHttps(t.config.url))
|
1188
|
+
return Promise.resolve(t.data);
|
1189
|
+
let e = t.config.tip;
|
1190
|
+
return this.handleResponseBody(t.data, e);
|
1191
|
+
}
|
1192
|
+
/**
|
1193
|
+
* 处理响应体信息,并自动添加响应通知
|
1194
|
+
*/
|
1195
|
+
handleResponseBody(t, e = !1) {
|
1196
|
+
return Et().add(t.code, t.message, t.stack, t.elapsed), e && t.code == "Ok" && this.messageService.success(t.message), t.code != "Ok" ? Promise.reject(t) : Promise.resolve(t);
|
1197
|
+
}
|
1198
|
+
/**
|
1199
|
+
* 处理网络错误和响应错误场景
|
1200
|
+
*/
|
1201
|
+
handleError(t) {
|
1202
|
+
if (t instanceof Rt) {
|
1203
|
+
Et().add("error", t.message, t.stack);
|
1204
|
+
let s = t.message;
|
1205
|
+
t.message == "Network Error" && (k.httpOrHttps(t.config.url) ? s = "接口网络错误: " + t.config.url : s = "接口网络错误: " + t.config.baseURL + t.config.url), this.messageService.error(s);
|
1206
|
+
} else
|
1207
|
+
this.messageService.error(t.message);
|
1208
|
+
return Promise.reject(t);
|
1209
|
+
}
|
1210
|
+
}
|
1211
|
+
class Vt extends Jt {
|
1212
|
+
create(t) {
|
1213
|
+
let s = [new Pt(), new Mt(), new Wt()].find((r) => S.equalsIgnoreCase(r.type, t));
|
1214
|
+
if (s == null)
|
1215
|
+
throw Error(`不存在请求器: ${t}`);
|
1216
|
+
return s;
|
1217
|
+
}
|
1218
|
+
/**
|
1219
|
+
* 获取默认请求器
|
1220
|
+
*/
|
1221
|
+
getDefault() {
|
1222
|
+
return this._default != null ? this._default : (this._default = this.create("Default"), this._default);
|
1223
|
+
}
|
1224
|
+
/**
|
1225
|
+
* 获取本地请求实例
|
1226
|
+
* 获取完毕后,下游第一行代码就要配置消息服务
|
1227
|
+
*/
|
1228
|
+
getLocal() {
|
1229
|
+
return this.local == null && (this.local = this.create("Local")), this.local;
|
1230
|
+
}
|
1231
|
+
}
|
1232
|
+
const J = class J {
|
1233
|
+
/**
|
1234
|
+
* 获取并缓存工厂实例
|
1235
|
+
*/
|
1236
|
+
static create(t, e) {
|
1237
|
+
let s = J.mappings[t];
|
1238
|
+
return s || (s = new e(), J.mappings[t] = s), s;
|
1239
|
+
}
|
1240
|
+
/**
|
1241
|
+
*获取请求器工厂
|
1242
|
+
*/
|
1243
|
+
static getRequester() {
|
1244
|
+
return this.create("RequesterFactory", Vt);
|
1245
|
+
}
|
1246
|
+
};
|
1247
|
+
J.mappings = {};
|
1248
|
+
let ht = J;
|
1249
|
+
const N = ht;
|
1250
|
+
let It = L("setting", {
|
1251
|
+
state() {
|
1252
|
+
return {
|
1253
|
+
loaded: !1,
|
1254
|
+
particles: !1,
|
1255
|
+
home: "/",
|
1256
|
+
background: null,
|
1257
|
+
//前端默认背景
|
1258
|
+
font: "Consolas",
|
1259
|
+
//前端默认字体
|
1260
|
+
language: navigator.language.toLowerCase(),
|
1261
|
+
//前端默认语言
|
1262
|
+
layout: "side",
|
1263
|
+
//前端默认布局
|
1264
|
+
theme: "dark",
|
1265
|
+
//前端默认主题
|
1266
|
+
themes: [],
|
1267
|
+
layouts: [],
|
1268
|
+
backgrounds: [],
|
1269
|
+
locales: [],
|
1270
|
+
//本地化语言集合
|
1271
|
+
fonts: null,
|
1272
|
+
ssos: [],
|
1273
|
+
//SSO信息
|
1274
|
+
size: "default",
|
1275
|
+
//前端默认尺寸
|
1276
|
+
watermark: null,
|
1277
|
+
app: null,
|
1278
|
+
env: null,
|
1279
|
+
/**
|
1280
|
+
* 中心库
|
1281
|
+
*/
|
1282
|
+
central: null,
|
1283
|
+
/**
|
1284
|
+
* 业务库
|
1285
|
+
*/
|
1286
|
+
business: null,
|
1287
|
+
upload: null,
|
1288
|
+
version: null,
|
1289
|
+
/**
|
1290
|
+
* 请求器
|
1291
|
+
*/
|
1292
|
+
requester: N.getRequester().getLocal()
|
1293
|
+
};
|
1294
|
+
},
|
1295
|
+
actions: {
|
1296
|
+
/**
|
1297
|
+
* 系统初始化
|
1298
|
+
*/
|
1299
|
+
async init() {
|
1300
|
+
this.loaded || (await this.loadSetting(), this.loaded = !0);
|
1301
|
+
},
|
1302
|
+
/**
|
1303
|
+
* 加载设置
|
1304
|
+
*/
|
1305
|
+
async loadSetting() {
|
1306
|
+
return this.requester.get("/app/setting").then(({ data: a }) => (Object.keys(a).forEach((t) => {
|
1307
|
+
let e = a[t];
|
1308
|
+
e && (this[t] = e);
|
1309
|
+
}), U.addClass(document.documentElement, this.theme, window.setting.web.theme), G.emits({ theme: this.theme }), Promise.resolve(a))).catch((a) => Promise.reject(a));
|
1310
|
+
}
|
1311
|
+
}
|
1312
|
+
}), Yt = L("config", {
|
1313
|
+
state() {
|
1314
|
+
return {
|
1315
|
+
/**
|
1316
|
+
* 默认背景
|
1317
|
+
*/
|
1318
|
+
background: null,
|
1319
|
+
/**
|
1320
|
+
* 当前主题
|
1321
|
+
*/
|
1322
|
+
theme: null,
|
1323
|
+
/**
|
1324
|
+
* 当前布局方式
|
1325
|
+
*/
|
1326
|
+
layout: null,
|
1327
|
+
/**
|
1328
|
+
* 当前语言
|
1329
|
+
*/
|
1330
|
+
language: null,
|
1331
|
+
/**
|
1332
|
+
* 字体
|
1333
|
+
*/
|
1334
|
+
font: null,
|
1335
|
+
/**
|
1336
|
+
* 文件布局方式
|
1337
|
+
*/
|
1338
|
+
fileLayout: null,
|
1339
|
+
/**
|
1340
|
+
* 请求器
|
1341
|
+
*/
|
1342
|
+
requester: N.getRequester().getLocal()
|
1343
|
+
};
|
1344
|
+
},
|
1345
|
+
actions: {
|
1346
|
+
/**
|
1347
|
+
* 初始化配置值(不一定跟登录用户相关,这也是单独分离的好处)
|
1348
|
+
*/
|
1349
|
+
init(a) {
|
1350
|
+
let t = It();
|
1351
|
+
this.background = t.background, this.theme = t.theme, this.layout = t.layout, this.language = t.language, this.font = t.font, a.forEach((e) => {
|
1352
|
+
let s = this.getLocalConfig(e.type);
|
1353
|
+
this[e.type] = s ?? e.content;
|
1354
|
+
}), U.removeClass(document.documentElement, t.theme), U.addClass(document.documentElement, this.theme), G.emit("theme", this.theme), U.addClass(document.documentElement, this.layout), this.setBackground(this.background), U.addStyle(document.documentElement, "font-family", this.font);
|
1355
|
+
},
|
1356
|
+
/**
|
1357
|
+
* 获取本地配置
|
1358
|
+
*/
|
1359
|
+
getLocalConfig(a) {
|
1360
|
+
return w.getObject(a);
|
1361
|
+
},
|
1362
|
+
/**
|
1363
|
+
* 设置背景
|
1364
|
+
*/
|
1365
|
+
setBackground(a) {
|
1366
|
+
let t = `url("/default/backgrounds/${a}") center / cover no-repeat`, e = this.layout == "desktop" ? "unset" : 0.05, s = document.createElement("style");
|
1367
|
+
s.innerText = `html::before{content:'';width:100%;height:100%;position:absolute;background:${t};opacity:${e};`, document.head.appendChild(s), this.background = a;
|
1368
|
+
},
|
1369
|
+
/**
|
1370
|
+
* 加载用户配置
|
1371
|
+
*/
|
1372
|
+
async loadConfig(a, t = !0) {
|
1373
|
+
if (t) {
|
1374
|
+
let e = this.getLocalConfig(a);
|
1375
|
+
if (e)
|
1376
|
+
return Promise.resolve(e);
|
1377
|
+
}
|
1378
|
+
return this.requester.get(`/user/config?type=${a}`).then((e) => {
|
1379
|
+
let s = e.data ? JSON.parse(e.data) : null;
|
1380
|
+
return Promise.resolve(s);
|
1381
|
+
});
|
1382
|
+
},
|
1383
|
+
/**
|
1384
|
+
* 全量保存用户配置
|
1385
|
+
*/
|
1386
|
+
async saveConfig(a, t, e = !0) {
|
1387
|
+
return e && w.setObject(a, t), this.requester.post(`/user/config?type=${a}`, t).then((s) => Promise.resolve(!0));
|
1388
|
+
},
|
1389
|
+
/**
|
1390
|
+
* 部分保存用户配置
|
1391
|
+
*/
|
1392
|
+
async patchConfig(a, t) {
|
1393
|
+
return this.requester.patch(`/user/config?type=${a}`, t).then((e) => Promise.resolve(!0));
|
1394
|
+
}
|
1395
|
+
}
|
1396
|
+
});
|
1397
|
+
const et = Yt;
|
1398
|
+
let Qt = L("log", {
|
1399
|
+
state() {
|
1400
|
+
return {
|
1401
|
+
logs: []
|
1402
|
+
};
|
1403
|
+
},
|
1404
|
+
actions: {
|
1405
|
+
/**
|
1406
|
+
* 手动添加日志
|
1407
|
+
*/
|
1408
|
+
add(a, t, e, s = null) {
|
1409
|
+
let r = D.getTimeString();
|
1410
|
+
this.logs.unshift({ time: r, code: a, message: t, stack: e, elapsed: s });
|
1411
|
+
},
|
1412
|
+
/**
|
1413
|
+
* 删除日志
|
1414
|
+
*/
|
1415
|
+
remove(a) {
|
1416
|
+
this.logs.splice(a, 1);
|
1417
|
+
},
|
1418
|
+
/**
|
1419
|
+
* 清空日志
|
1420
|
+
*/
|
1421
|
+
clear() {
|
1422
|
+
this.logs = [];
|
1423
|
+
}
|
1424
|
+
}
|
1425
|
+
});
|
1426
|
+
const Et = Qt;
|
1427
|
+
let Kt = L("env", {
|
1428
|
+
state() {
|
1429
|
+
return {
|
1430
|
+
//环境变量
|
1431
|
+
env: null
|
1432
|
+
};
|
1433
|
+
},
|
1434
|
+
actions: {
|
1435
|
+
/**
|
1436
|
+
* 使用环境变量
|
1437
|
+
*/
|
1438
|
+
useEnv(a) {
|
1439
|
+
this.env = a, this.env.base = S.trimEnd(a.VITE_ROOT, "/");
|
1440
|
+
}
|
1441
|
+
}
|
1442
|
+
}), Xt = L("socket", {
|
1443
|
+
state() {
|
1444
|
+
return {
|
1445
|
+
socket: null,
|
1446
|
+
//socket连接对象
|
1447
|
+
connected: null,
|
1448
|
+
//是否已连接(空表示不需连接)
|
1449
|
+
reconnect: !1,
|
1450
|
+
//是否需要自动重新连接
|
1451
|
+
handler: null
|
1452
|
+
//消息处理程序
|
1453
|
+
};
|
1454
|
+
},
|
1455
|
+
actions: {
|
1456
|
+
/**
|
1457
|
+
* 登录后,连接Socket
|
1458
|
+
*/
|
1459
|
+
async connect() {
|
1460
|
+
if (!K.api.ws)
|
1461
|
+
return;
|
1462
|
+
if (this.socket == null || this.reconnect) {
|
1463
|
+
let t = K.api.ws, s = await Bt().getAuthorization(t), r = k.encode(s), n = `${t}?authorization=${r}`;
|
1464
|
+
this.socket = new WebSocket(n);
|
1465
|
+
}
|
1466
|
+
let a;
|
1467
|
+
this.socket.onopen = (t) => {
|
1468
|
+
clearTimeout(a), this.connected = !0;
|
1469
|
+
}, this.socket.onmessage = (t) => {
|
1470
|
+
this.handler && this.handler(t);
|
1471
|
+
}, this.socket.onerror = (t) => {
|
1472
|
+
this.reconnect = !0, console.warn(`Socket连接失败:${K.api.ws}`);
|
1473
|
+
}, this.socket.onclose = (t) => {
|
1474
|
+
this.connected = !1, this.reconnect && (a = setTimeout(async () => await this.connect(), 1e3));
|
1475
|
+
};
|
1476
|
+
},
|
1477
|
+
/**
|
1478
|
+
* 订阅并替换Socket事件处理程序
|
1479
|
+
*/
|
1480
|
+
subscribe(a = null) {
|
1481
|
+
this.handler = a;
|
1482
|
+
},
|
1483
|
+
/**
|
1484
|
+
* 取消订阅Socket事件处理程序,防止内存泄漏
|
1485
|
+
*/
|
1486
|
+
unsubscribe() {
|
1487
|
+
this.handler = null;
|
1488
|
+
},
|
1489
|
+
/**
|
1490
|
+
* 退出时断开连接
|
1491
|
+
*/
|
1492
|
+
disconnect() {
|
1493
|
+
this.socket.close(), this.reconnect = !1, this.connected = null, this.handler = null;
|
1494
|
+
}
|
1495
|
+
}
|
1496
|
+
});
|
1497
|
+
const Zt = L("user", {
|
1498
|
+
state: () => ({
|
1499
|
+
user: null,
|
1500
|
+
//用户信息
|
1501
|
+
menus: null,
|
1502
|
+
//接口返回的菜单信息(空:菜单未加载 空数组:匿名用户已加载菜单,但是无菜单;防止未登录状态每次跳转路由都加载菜单)
|
1503
|
+
menusFlat: null,
|
1504
|
+
debugger: null,
|
1505
|
+
//是否调试人
|
1506
|
+
env: null,
|
1507
|
+
//当前访问环境
|
1508
|
+
/**
|
1509
|
+
* 请求器
|
1510
|
+
*/
|
1511
|
+
requester: N.getRequester().getLocal()
|
1512
|
+
}),
|
1513
|
+
actions: {
|
1514
|
+
/**
|
1515
|
+
* 获取本地缓存中的用户信息;好处:即使手动更改storage数据,也可以里面获取到
|
1516
|
+
*/
|
1517
|
+
getSso() {
|
1518
|
+
return w.getObject("sso");
|
1519
|
+
},
|
1520
|
+
/**
|
1521
|
+
* 登录后,获取用户信息
|
1522
|
+
*/
|
1523
|
+
async loadInfo() {
|
1524
|
+
return this.requester.get("/user/info").then(({ data: a }) => {
|
1525
|
+
let t = Kt(), e = et();
|
1526
|
+
e.init(a.configs);
|
1527
|
+
let s = t.env.VITE_CDN == "true" ? "StaticFile" : "Local", r = t.env.VITE_BASE, n = Y.getCdn(s, r);
|
1528
|
+
this.user = a, this.debugger = a.debugger;
|
1529
|
+
let l = e.language == "en" ? null : e.language, i = {
|
1530
|
+
paths: { vs: n.getPath("monaco-editor") },
|
1531
|
+
//加载monaco cdn压缩资源包,可以大幅减少本地请求数量
|
1532
|
+
"vs/nls": { availableLanguages: { "*": l } }
|
1533
|
+
//设置编辑器默认语言
|
1534
|
+
};
|
1535
|
+
return Lt.config(i), Promise.resolve(a);
|
1536
|
+
});
|
1537
|
+
},
|
1538
|
+
/**
|
1539
|
+
* 通过完整url和请求体,获取授权头
|
1540
|
+
*/
|
1541
|
+
async getAuthorization(a, t = null) {
|
1542
|
+
let e = this.getSso();
|
1543
|
+
if (e == null)
|
1544
|
+
return "pc";
|
1545
|
+
let s = D.getTimestamp(), n = await Y.getSigner("default").getSign(e.userId, a, t, s, e.secret);
|
1546
|
+
return Y.getSso(e.type).getAuthorization(e.identity.token, s, n, this.env);
|
1547
|
+
},
|
1548
|
+
/**
|
1549
|
+
* 未登录,获取匿名登录信息
|
1550
|
+
*/
|
1551
|
+
getAnonymous() {
|
1552
|
+
et().init([]);
|
1553
|
+
},
|
1554
|
+
/**
|
1555
|
+
* 根据路径获取路由
|
1556
|
+
*/
|
1557
|
+
getMenuByUrl(a) {
|
1558
|
+
let t = k.getPath(a);
|
1559
|
+
return this.menusFlat.find((s) => s.url.split("?")[0] == t);
|
1560
|
+
},
|
1561
|
+
/**
|
1562
|
+
* 加载服务端路由
|
1563
|
+
*/
|
1564
|
+
async loadMenus() {
|
1565
|
+
return this.requester.get("/user/menu").then(({ data: a }) => (this.menus = a, this.menusFlat = _.getFlat(a, "children"), Promise.resolve(a)));
|
1566
|
+
},
|
1567
|
+
/**
|
1568
|
+
* 退出登录
|
1569
|
+
*/
|
1570
|
+
async logout() {
|
1571
|
+
return this.requester.post("/user/logout").then(() => (this.user = null, this.menus = null, Y.getSso(this.getSso().type).logout(), Xt().disconnect(), Promise.resolve()));
|
1572
|
+
}
|
1573
|
+
}
|
1574
|
+
}), Bt = Zt;
|
1575
|
+
L("driver", {
|
1576
|
+
state() {
|
1577
|
+
return {
|
1578
|
+
/**
|
1579
|
+
* 加载完毕状态记录
|
1580
|
+
*/
|
1581
|
+
loaded: {
|
1582
|
+
apps: !1,
|
1583
|
+
envs: !1
|
1584
|
+
},
|
1585
|
+
/**
|
1586
|
+
* 是否加载中状态,用于并发场景 防止重复拉取接口
|
1587
|
+
*/
|
1588
|
+
loading: {
|
1589
|
+
apps: !1,
|
1590
|
+
envs: !1
|
1591
|
+
},
|
1592
|
+
/**
|
1593
|
+
* 应用集合,存储到Store中,防止每一个Driver实例重复加载
|
1594
|
+
*/
|
1595
|
+
apps: [],
|
1596
|
+
/**
|
1597
|
+
* 环境集合,存储到Store中,防止每一个Driver实例重复加载
|
1598
|
+
*/
|
1599
|
+
envs: [],
|
1600
|
+
/**
|
1601
|
+
* 请求器
|
1602
|
+
*/
|
1603
|
+
requester: N.getRequester().getLocal()
|
1604
|
+
};
|
1605
|
+
},
|
1606
|
+
actions: {
|
1607
|
+
/**
|
1608
|
+
* 加载应用选项
|
1609
|
+
*/
|
1610
|
+
async loadApps(a = !1) {
|
1611
|
+
if (!this.loading.apps && !(!a && this.loaded.apps))
|
1612
|
+
return this.loading.apps = !0, this.requester.post("/app/options").then((t) => {
|
1613
|
+
this.apps = t.data, this.loaded.apps = !0;
|
1614
|
+
}).finally(() => {
|
1615
|
+
this.loading.apps = !1;
|
1616
|
+
});
|
1617
|
+
},
|
1618
|
+
/**
|
1619
|
+
* 加载环境选项
|
1620
|
+
*/
|
1621
|
+
async loadEnvs(a = !1) {
|
1622
|
+
if (!this.loading.envs && (this.loading.envs = !0, !(!a && this.loaded.envs)))
|
1623
|
+
return this.requester.post("/env/options").then((t) => {
|
1624
|
+
this.envs = t.data, this.loaded.envs = !0;
|
1625
|
+
}).finally(() => {
|
1626
|
+
this.loading.envs = !1;
|
1627
|
+
});
|
1628
|
+
}
|
1629
|
+
}
|
1630
|
+
});
|
1631
|
+
class Le {
|
1632
|
+
/**
|
1633
|
+
* 获取浏览器默认语言
|
1634
|
+
*/
|
1635
|
+
static getBrowserLanguage() {
|
1636
|
+
return navigator.language == "zh-CN" ? "zh-cn" : "en";
|
1637
|
+
}
|
1638
|
+
/**
|
1639
|
+
* 获取当前语言
|
1640
|
+
*/
|
1641
|
+
static getCurrentLanguage() {
|
1642
|
+
let t = et(), e = this.getBrowserLanguage();
|
1643
|
+
return t.language || e || "zh-cn";
|
1644
|
+
}
|
1645
|
+
}
|
1646
|
+
class Gt {
|
1647
|
+
}
|
1648
|
+
class Ht extends Gt {
|
1649
|
+
constructor() {
|
1650
|
+
super(...arguments), this.type = "Base64";
|
1651
|
+
}
|
1652
|
+
open(t) {
|
1653
|
+
}
|
1654
|
+
encode(t) {
|
1655
|
+
let e = P.enc.Utf8.parse(t);
|
1656
|
+
return P.enc.Base64.stringify(e);
|
1657
|
+
}
|
1658
|
+
decode(t) {
|
1659
|
+
let e = P.enc.Base64.parse(t);
|
1660
|
+
return P.enc.Utf8.stringify(e);
|
1661
|
+
}
|
1662
|
+
}
|
1663
|
+
class st {
|
1664
|
+
/**
|
1665
|
+
* 创建执行类型的Hash实例
|
1666
|
+
*/
|
1667
|
+
static create(t) {
|
1668
|
+
let s = [new Ht()].find((r) => S.equalsIgnoreCase(r.type, t));
|
1669
|
+
if (s == null)
|
1670
|
+
throw new Error(`未实现 IHasher: ${t}`);
|
1671
|
+
return s;
|
1672
|
+
}
|
1673
|
+
/**
|
1674
|
+
* 获取Base64 编码器对象
|
1675
|
+
*/
|
1676
|
+
static getBase64() {
|
1677
|
+
return this.base64 != null ? this.base64 : (this.base64 = this.create("Base64"), this.base64);
|
1678
|
+
}
|
1679
|
+
}
|
1680
|
+
const x = class x {
|
1681
|
+
/**
|
1682
|
+
* 获取指定地址路由对象
|
1683
|
+
*/
|
1684
|
+
static getToRoute(t, e = !0) {
|
1685
|
+
if (!t)
|
1686
|
+
return null;
|
1687
|
+
let s = this.getToUrl(t, e);
|
1688
|
+
return this.getRoute(s);
|
1689
|
+
}
|
1690
|
+
/**
|
1691
|
+
* 获取要跳转的Url地址信息,自动涵盖后退地址
|
1692
|
+
*/
|
1693
|
+
static getToUrl(t, e = !0) {
|
1694
|
+
let s = {};
|
1695
|
+
if (!this.getRoute(t).query.m) {
|
1696
|
+
let l = this.getQueryParam(location.search, "m");
|
1697
|
+
l && (s.m = l);
|
1698
|
+
}
|
1699
|
+
if (e) {
|
1700
|
+
let l = location.pathname + location.search;
|
1701
|
+
l && (s.return_url = l);
|
1702
|
+
}
|
1703
|
+
return this.getUrl(t, s);
|
1704
|
+
}
|
1705
|
+
/**
|
1706
|
+
* 获取菜单参数
|
1707
|
+
*/
|
1708
|
+
static getM(t) {
|
1709
|
+
let e = this.getQueryParam(t, "m");
|
1710
|
+
if (!e)
|
1711
|
+
return {};
|
1712
|
+
let s = e.split(";"), r = {};
|
1713
|
+
return s.length > 0 && (r.m = s[0]), s.length > 1 && (r.max = s[1] == "max", r.min = s[1] == "min"), r;
|
1714
|
+
}
|
1715
|
+
//endregion
|
1716
|
+
//region 后退地址
|
1717
|
+
/**
|
1718
|
+
* 获取后退地址路由
|
1719
|
+
*/
|
1720
|
+
static getBackRoute() {
|
1721
|
+
let t = this.getBackUrl();
|
1722
|
+
return this.getRoute(t);
|
1723
|
+
}
|
1724
|
+
/**
|
1725
|
+
* 获取要后退的地址URL
|
1726
|
+
*/
|
1727
|
+
static getBackUrl() {
|
1728
|
+
let t = this.getQueryParam(location.search, "return_url");
|
1729
|
+
if (!t)
|
1730
|
+
return null;
|
1731
|
+
let e = t.split(";");
|
1732
|
+
return e[e.length - 1];
|
1733
|
+
}
|
1734
|
+
//endregion
|
1735
|
+
/**
|
1736
|
+
* 获取指定地址的路由对象,自动合并qs,并解码
|
1737
|
+
*/
|
1738
|
+
static getRoute(t, e = null) {
|
1739
|
+
let s = this.getUrl(t, e);
|
1740
|
+
if (!s)
|
1741
|
+
return null;
|
1742
|
+
let r = {}, n = s.split("?");
|
1743
|
+
return r.path = n[0], n.length > 1 ? r.query = this.deserializeQs(n[1]) : r.query = {}, r;
|
1744
|
+
}
|
1745
|
+
/**
|
1746
|
+
* 处理实体,得到url query参数形式
|
1747
|
+
* 如:app=Tool&compare[language]=json&compare[sql]=App%3D%27Tool%27+and+[Table]+like+%27Ctl_%25%27+order+by+[Table],+Name
|
1748
|
+
*/
|
1749
|
+
static getQuery(t) {
|
1750
|
+
let e = "", s = Object.keys(t);
|
1751
|
+
for (let n of s) {
|
1752
|
+
let l = [n], i = this.handleQueryValue(t[n], l);
|
1753
|
+
e += i;
|
1754
|
+
}
|
1755
|
+
return e.substring(1);
|
1756
|
+
}
|
1757
|
+
/**
|
1758
|
+
* 从Url中提取路径
|
1759
|
+
*/
|
1760
|
+
static getPath(t) {
|
1761
|
+
return t ? t.split("?")[0] : null;
|
1762
|
+
}
|
1763
|
+
/**
|
1764
|
+
* 获取path中最后一个片段信息
|
1765
|
+
*/
|
1766
|
+
static getLastSegment(t) {
|
1767
|
+
if (!t)
|
1768
|
+
return null;
|
1769
|
+
let s = this.getPath(t).split("/").filter((n) => n);
|
1770
|
+
return s[s.length - 1];
|
1771
|
+
}
|
1772
|
+
/**
|
1773
|
+
* 获取地址中的查询参数
|
1774
|
+
*/
|
1775
|
+
static getQueryParam(t, e) {
|
1776
|
+
if (!t)
|
1777
|
+
return null;
|
1778
|
+
let s = t.split("?")[1];
|
1779
|
+
return new URLSearchParams(s).get(e);
|
1780
|
+
}
|
1781
|
+
//region 序列化和反序列化
|
1782
|
+
/**
|
1783
|
+
* 从Url中提取查询对象
|
1784
|
+
*/
|
1785
|
+
static deserialize(t) {
|
1786
|
+
if (!t)
|
1787
|
+
return null;
|
1788
|
+
let e = t.split("?");
|
1789
|
+
return e.length == 1 ? null : this.deserializeQs(e[1]);
|
1790
|
+
}
|
1791
|
+
/**
|
1792
|
+
* 把查询字符串转换成对象(自动解码成源数据)
|
1793
|
+
*/
|
1794
|
+
static deserializeQs(t, e = !0) {
|
1795
|
+
let s = {}, r = t.split("&");
|
1796
|
+
for (let n = 0; n < r.length; n++) {
|
1797
|
+
let l = r[n], i = l.indexOf("="), u = l.substring(0, i), o = l.substring(i + 1);
|
1798
|
+
s[u] = e ? decodeURIComponent(o) : o;
|
1799
|
+
}
|
1800
|
+
return s;
|
1801
|
+
}
|
1802
|
+
/**
|
1803
|
+
* 把对象转换成查询字符串,自动编码
|
1804
|
+
*/
|
1805
|
+
static serialize(t, e = !0) {
|
1806
|
+
let s = (n) => e ? encodeURIComponent(n) : n;
|
1807
|
+
return X.join(t, s, "=", "&");
|
1808
|
+
}
|
1809
|
+
//endregion
|
1810
|
+
//region 编码和解码
|
1811
|
+
/**
|
1812
|
+
* URL编码
|
1813
|
+
*/
|
1814
|
+
static encode(t) {
|
1815
|
+
return encodeURIComponent(t);
|
1816
|
+
}
|
1817
|
+
/**
|
1818
|
+
* 把指定对象转换成base64字符串
|
1819
|
+
*/
|
1820
|
+
static base64(t) {
|
1821
|
+
let e = JSON.stringify(t);
|
1822
|
+
return st.getBase64().encode(e);
|
1823
|
+
}
|
1824
|
+
/**
|
1825
|
+
* 把指定base64字符串解析为原对象
|
1826
|
+
*/
|
1827
|
+
static base64Decode(t) {
|
1828
|
+
let e = st.getBase64().decode(t);
|
1829
|
+
return JSON.parse(e);
|
1830
|
+
}
|
1831
|
+
//endregion
|
1832
|
+
/**
|
1833
|
+
* 是否是http或https开头的地址
|
1834
|
+
*/
|
1835
|
+
static httpOrHttps(t) {
|
1836
|
+
return t ? t.indexOf("http://") > -1 || t.indexOf("https://") > -1 : !1;
|
1837
|
+
}
|
1838
|
+
};
|
1839
|
+
x.handleQueryValue = (t, e) => {
|
1840
|
+
let s = "";
|
1841
|
+
if (t == null)
|
1842
|
+
return s;
|
1843
|
+
if (t instanceof Array) {
|
1844
|
+
if (t.length > 0)
|
1845
|
+
for (let r = 0; r < t.length; r++) {
|
1846
|
+
let n = R.clone(e);
|
1847
|
+
n.push(""), s += x.handleQueryValue(t[r], n);
|
1848
|
+
}
|
1849
|
+
} else if (t instanceof Object) {
|
1850
|
+
let r = Object.keys(t);
|
1851
|
+
for (let n of r) {
|
1852
|
+
let l = R.clone(e);
|
1853
|
+
l.push(n), s += x.handleQueryValue(t[n], l);
|
1854
|
+
}
|
1855
|
+
} else {
|
1856
|
+
let r = "";
|
1857
|
+
for (let l = 0; l < e.length; l++)
|
1858
|
+
l > 0 && (r += "["), r += e[l], l > 0 && (r += "]");
|
1859
|
+
let n = encodeURIComponent(t);
|
1860
|
+
n = n.replace(/'/g, "%27"), n = n.replace(/%20/g, "+"), n = n.replace(/%5B/g, "["), n = n.replace(/%5D/g, "]"), n = n.replace(/%2C/g, ","), n = n.replace(/%3A/g, ":"), n = n.replace(/%24/g, "$"), s += `&${r}=${n}`;
|
1861
|
+
}
|
1862
|
+
return s;
|
1863
|
+
}, x.concatUrl = (t, e) => x.httpOrHttps(e) ? e : t + e, x.getUrl = (t, e = null) => {
|
1864
|
+
if (t == null)
|
1865
|
+
return null;
|
1866
|
+
if (e == null)
|
1867
|
+
return t;
|
1868
|
+
let s = x.deserialize(t), r = R.mergeTo(s, e);
|
1869
|
+
return x.getPath(t) + "?" + x.getQuery(r);
|
1870
|
+
}, x.getAnchor = (t, e = null) => {
|
1871
|
+
let s = { href: null, target: null };
|
1872
|
+
return x.httpOrHttps(t) ? (s.href = t, s.target = "_blank", s) : (s.href = x.getUrl(t, e), s);
|
1873
|
+
};
|
1874
|
+
let gt = x;
|
1875
|
+
const k = gt;
|
1876
|
+
class _t {
|
1877
|
+
/**
|
1878
|
+
* 清空对象中的空值
|
1879
|
+
*/
|
1880
|
+
static clean(t) {
|
1881
|
+
let e = Object.keys(t);
|
1882
|
+
for (let s of e)
|
1883
|
+
t[s] == null && delete t[s];
|
1884
|
+
}
|
1885
|
+
/**
|
1886
|
+
* 签名字典
|
1887
|
+
*/
|
1888
|
+
static signDictionary(t, e = !0) {
|
1889
|
+
return this.clean(t), k.serialize(t, e);
|
1890
|
+
}
|
1891
|
+
}
|
1892
|
+
const te = _t, nt = class nt {
|
1893
|
+
constructor() {
|
1894
|
+
this.type = "Bearer";
|
1895
|
+
}
|
1896
|
+
open(t) {
|
1897
|
+
this.requester = N.getRequester().getLocal();
|
1898
|
+
}
|
1899
|
+
async login(t) {
|
1900
|
+
return this.requester.post(`/user/login?type=${this.type}`, t).then((e) => {
|
1901
|
+
let s = e.data;
|
1902
|
+
return w.setObject("sso", s), Promise.resolve(e);
|
1903
|
+
});
|
1904
|
+
}
|
1905
|
+
loginUrl(t) {
|
1906
|
+
return "";
|
1907
|
+
}
|
1908
|
+
getUser() {
|
1909
|
+
let t = w.getObject("sso");
|
1910
|
+
return { userId: t.userId, token: t.token, secret: t.userSecret };
|
1911
|
+
}
|
1912
|
+
getAuthorization(t, e, s, r = "") {
|
1913
|
+
let n = `${this.type} ${t} ${e} ${s} pc`;
|
1914
|
+
return r && (n += " " + r), n;
|
1915
|
+
}
|
1916
|
+
logout() {
|
1917
|
+
w.remove(nt.loginKey), w.remove("sso");
|
1918
|
+
}
|
1919
|
+
};
|
1920
|
+
nt.loginKey = "user";
|
1921
|
+
let W = nt;
|
1922
|
+
class ee {
|
1923
|
+
constructor() {
|
1924
|
+
this.type = "Nio";
|
1925
|
+
}
|
1926
|
+
open(t) {
|
1927
|
+
this.url = t.url, this.app_id = t.app_id;
|
1928
|
+
}
|
1929
|
+
async login(t) {
|
1930
|
+
w.setObject("sso", t);
|
1931
|
+
}
|
1932
|
+
loginUrl(t) {
|
1933
|
+
let e = encodeURIComponent(t);
|
1934
|
+
return `${this.url}/oauth2/authorize?client_id=${this.app_id}&redirect_uri=${e}&response_type=code`;
|
1935
|
+
}
|
1936
|
+
getUser() {
|
1937
|
+
return w.getObject(W.loginKey);
|
1938
|
+
}
|
1939
|
+
getAuthorization(t, e, s, r) {
|
1940
|
+
return `${this.type} ${t} ${e} ${s} pc`;
|
1941
|
+
}
|
1942
|
+
logout() {
|
1943
|
+
w.remove("sso");
|
1944
|
+
}
|
1945
|
+
}
|
1946
|
+
class se {
|
1947
|
+
constructor() {
|
1948
|
+
this.type = "WeiXin";
|
1949
|
+
}
|
1950
|
+
open(t) {
|
1951
|
+
}
|
1952
|
+
async login(t) {
|
1953
|
+
}
|
1954
|
+
loginUrl(t) {
|
1955
|
+
return "";
|
1956
|
+
}
|
1957
|
+
getUser() {
|
1958
|
+
return { userId: "", token: "", secret: "" };
|
1959
|
+
}
|
1960
|
+
getAuthorization(t, e, s, r) {
|
1961
|
+
return "";
|
1962
|
+
}
|
1963
|
+
logout() {
|
1964
|
+
}
|
1965
|
+
}
|
1966
|
+
class re {
|
1967
|
+
constructor() {
|
1968
|
+
this.type = "Anonymous";
|
1969
|
+
}
|
1970
|
+
open(t) {
|
1971
|
+
}
|
1972
|
+
async login(t) {
|
1973
|
+
}
|
1974
|
+
loginUrl(t) {
|
1975
|
+
return "";
|
1976
|
+
}
|
1977
|
+
getUser() {
|
1978
|
+
let t = w.get("anonymous");
|
1979
|
+
if (!t) {
|
1980
|
+
let e = S.getUniqueId();
|
1981
|
+
w.set("anonymous", e), t = e;
|
1982
|
+
}
|
1983
|
+
return { userId: "", token: t, secret: "" };
|
1984
|
+
}
|
1985
|
+
getAuthorization(t, e, s, r) {
|
1986
|
+
return `Anonymous ${t} pc`;
|
1987
|
+
}
|
1988
|
+
logout() {
|
1989
|
+
}
|
1990
|
+
}
|
1991
|
+
class ne {
|
1992
|
+
constructor() {
|
1993
|
+
this.type = "Secret";
|
1994
|
+
}
|
1995
|
+
open(t) {
|
1996
|
+
this.requester = N.getRequester().getLocal();
|
1997
|
+
}
|
1998
|
+
async login(t) {
|
1999
|
+
return this.requester.post(`/user/login?type=${this.type}`, t).then((e) => {
|
2000
|
+
let s = e.data;
|
2001
|
+
return w.setObject("sso", s), Promise.resolve(e);
|
2002
|
+
});
|
2003
|
+
}
|
2004
|
+
loginUrl(t) {
|
2005
|
+
return "";
|
2006
|
+
}
|
2007
|
+
getUser() {
|
2008
|
+
let t = w.getObject(W.loginKey);
|
2009
|
+
return { userId: t.userId, token: t.token, secret: t.userSecret };
|
2010
|
+
}
|
2011
|
+
getAuthorization(t, e, s, r) {
|
2012
|
+
return `${this.type} ${t} ${e} ${s} pc`;
|
2013
|
+
}
|
2014
|
+
logout() {
|
2015
|
+
}
|
2016
|
+
}
|
2017
|
+
class le {
|
2018
|
+
/**
|
2019
|
+
* 获取指定SSO实例
|
2020
|
+
*/
|
2021
|
+
static getSso(t) {
|
2022
|
+
let s = [new ne(), new ee(), new se(), new W(), new re()].find((r) => r.type.toLowerCase() == t.toLowerCase());
|
2023
|
+
if (s == null)
|
2024
|
+
throw new Error(`未支持的SSO类型:${t}`);
|
2025
|
+
return s;
|
2026
|
+
}
|
2027
|
+
}
|
2028
|
+
class ie {
|
2029
|
+
constructor() {
|
2030
|
+
this.type = "Default";
|
2031
|
+
}
|
2032
|
+
open(t) {
|
2033
|
+
this.hasher = tt.getMd5();
|
2034
|
+
}
|
2035
|
+
callback(t) {
|
2036
|
+
}
|
2037
|
+
async getSign(t, e, s, r, n) {
|
2038
|
+
let l = "";
|
2039
|
+
s && (y.isString(s) ? l = s.toString() : l = JSON.stringify(s));
|
2040
|
+
let i = `${t}.${e}.${l}.${r}.${n}`;
|
2041
|
+
return (await this.hasher.compute(i)).toUpperCase();
|
2042
|
+
}
|
2043
|
+
loginUrl(t) {
|
2044
|
+
return "";
|
2045
|
+
}
|
2046
|
+
dispose() {
|
2047
|
+
}
|
2048
|
+
}
|
2049
|
+
class ae {
|
2050
|
+
/**
|
2051
|
+
* 获取指定签名实例
|
2052
|
+
*/
|
2053
|
+
static create(t) {
|
2054
|
+
let s = [new ie()].find((r) => r.type.toLowerCase() == t.toLowerCase());
|
2055
|
+
if (s == null)
|
2056
|
+
throw new Error(`未支持的Signer类型:${t}`);
|
2057
|
+
return s;
|
2058
|
+
}
|
2059
|
+
}
|
2060
|
+
class ue {
|
2061
|
+
constructor() {
|
2062
|
+
this.type = "Sort";
|
2063
|
+
}
|
2064
|
+
open(t) {
|
2065
|
+
}
|
2066
|
+
add(t, e, s, r) {
|
2067
|
+
this.resort(t, e, s);
|
2068
|
+
}
|
2069
|
+
insert(t, e, s, r, n) {
|
2070
|
+
this.resort(t, e, s);
|
2071
|
+
}
|
2072
|
+
//复制时,自动往后排序
|
2073
|
+
copy(t, e, s) {
|
2074
|
+
this.resort(t, e, s);
|
2075
|
+
}
|
2076
|
+
//重新排序
|
2077
|
+
resort(t, e, s) {
|
2078
|
+
let r = s[t.name];
|
2079
|
+
for (let n = 0; n < r.length; n++) {
|
2080
|
+
let l = r[n];
|
2081
|
+
l[e.name] = (n + 1) * 10;
|
2082
|
+
}
|
2083
|
+
}
|
2084
|
+
}
|
2085
|
+
class oe {
|
2086
|
+
constructor() {
|
2087
|
+
this.type = "I18N";
|
2088
|
+
}
|
2089
|
+
open(t) {
|
2090
|
+
}
|
2091
|
+
add(t, e, s, r) {
|
2092
|
+
}
|
2093
|
+
insert(t, e, s, r, n) {
|
2094
|
+
}
|
2095
|
+
copy(t, e, s) {
|
2096
|
+
}
|
2097
|
+
}
|
2098
|
+
class ce {
|
2099
|
+
constructor() {
|
2100
|
+
this.type = "Expression";
|
2101
|
+
}
|
2102
|
+
open(t) {
|
2103
|
+
}
|
2104
|
+
add(t, e, s, r) {
|
2105
|
+
}
|
2106
|
+
insert(t, e, s, r, n) {
|
2107
|
+
}
|
2108
|
+
copy(t, e, s) {
|
2109
|
+
}
|
2110
|
+
}
|
2111
|
+
class he {
|
2112
|
+
/**
|
2113
|
+
* 获取指定特征实例
|
2114
|
+
*/
|
2115
|
+
static create(t) {
|
2116
|
+
let s = [new ue(), new oe(), new ce()].find((r) => r.type.toLowerCase() == t.toLowerCase());
|
2117
|
+
if (s == null)
|
2118
|
+
throw new Error(`未支持的Feature类型:${t}`);
|
2119
|
+
return s;
|
2120
|
+
}
|
2121
|
+
}
|
2122
|
+
const $ = class $ {
|
2123
|
+
constructor() {
|
2124
|
+
this.type = "IndexedDb", this.database = null, this.store = null, this.objectStoreNames = null;
|
2125
|
+
}
|
2126
|
+
/**
|
2127
|
+
* 进行数据库初始化 或 从现有数据库中得到最新版本号(数据库首次初始化和open是版本号升级时,会触发升级事件)
|
2128
|
+
*/
|
2129
|
+
async openAsync(t) {
|
2130
|
+
return this.database = t, new Promise((e, s) => {
|
2131
|
+
let r = indexedDB.open(t);
|
2132
|
+
r.onsuccess = (n) => {
|
2133
|
+
let l = n.target.result;
|
2134
|
+
$.version = l.version, this.objectStoreNames = l.objectStoreNames, e($.version);
|
2135
|
+
}, r.onerror = (n) => {
|
2136
|
+
s(n.target);
|
2137
|
+
};
|
2138
|
+
});
|
2139
|
+
}
|
2140
|
+
/**
|
2141
|
+
* 保证创建存储Store
|
2142
|
+
*/
|
2143
|
+
async createAsync(t) {
|
2144
|
+
return this.store = t, this.objectStoreNames.contains(t) ? Promise.resolve(!0) : new Promise((e, s) => {
|
2145
|
+
let r = indexedDB.open(this.database, ++$.version);
|
2146
|
+
r.onupgradeneeded = (n) => {
|
2147
|
+
let l = n.target.result;
|
2148
|
+
l.objectStoreNames.contains(this.store) || l.createObjectStore(this.store);
|
2149
|
+
}, r.onsuccess = (n) => {
|
2150
|
+
e(n);
|
2151
|
+
}, r.onerror = (n) => {
|
2152
|
+
s(n);
|
2153
|
+
};
|
2154
|
+
});
|
2155
|
+
}
|
2156
|
+
/**
|
2157
|
+
* 打开数据库(不升级,用于执行命令)
|
2158
|
+
*/
|
2159
|
+
async openDbAsync() {
|
2160
|
+
return new Promise((t, e) => {
|
2161
|
+
let s = indexedDB.open(this.database, $.version);
|
2162
|
+
s.onsuccess = (r) => {
|
2163
|
+
let n = r.target.result;
|
2164
|
+
t(n);
|
2165
|
+
}, s.onerror = (r) => {
|
2166
|
+
e(r.target);
|
2167
|
+
};
|
2168
|
+
});
|
2169
|
+
}
|
2170
|
+
/**
|
2171
|
+
* 查询数据
|
2172
|
+
*/
|
2173
|
+
async getAsync(t) {
|
2174
|
+
let e = await this.openDbAsync();
|
2175
|
+
return new Promise((s, r) => {
|
2176
|
+
if (t == null) {
|
2177
|
+
s(null);
|
2178
|
+
return;
|
2179
|
+
}
|
2180
|
+
let n = e.transaction(this.store, "readonly");
|
2181
|
+
n.oncomplete = (u) => {
|
2182
|
+
e.close();
|
2183
|
+
}, n.onerror = (u) => {
|
2184
|
+
r(u);
|
2185
|
+
};
|
2186
|
+
let i = n.objectStore(this.store).get(t);
|
2187
|
+
i.onsuccess = (u) => {
|
2188
|
+
let o = u.target.result;
|
2189
|
+
s(o);
|
2190
|
+
}, i.onerror = (u) => {
|
2191
|
+
r(u.target);
|
2192
|
+
};
|
2193
|
+
});
|
2194
|
+
}
|
2195
|
+
/**
|
2196
|
+
* 添加数据
|
2197
|
+
*/
|
2198
|
+
async insertAsync(t, e) {
|
2199
|
+
if (t == null || Object.is(t, NaN))
|
2200
|
+
return;
|
2201
|
+
let s = await this.openDbAsync();
|
2202
|
+
return new Promise((r, n) => {
|
2203
|
+
let l = s.transaction(this.store, "readwrite");
|
2204
|
+
l.oncomplete = (o) => {
|
2205
|
+
s.close();
|
2206
|
+
}, l.onerror = (o) => {
|
2207
|
+
n(o);
|
2208
|
+
};
|
2209
|
+
let u = l.objectStore(this.store).add(e, t);
|
2210
|
+
u.onsuccess = (o) => {
|
2211
|
+
let c = o.target.result;
|
2212
|
+
r(c);
|
2213
|
+
}, u.onerror = (o) => {
|
2214
|
+
let c = o.target.error;
|
2215
|
+
n(c.message);
|
2216
|
+
};
|
2217
|
+
});
|
2218
|
+
}
|
2219
|
+
/**
|
2220
|
+
* 修改数据
|
2221
|
+
*/
|
2222
|
+
async updateAsync(t, e) {
|
2223
|
+
}
|
2224
|
+
/**
|
2225
|
+
* 保存数据,支持代理对象保存
|
2226
|
+
*/
|
2227
|
+
async saveAsync(t, e) {
|
2228
|
+
if (t == null || Object.is(t, NaN))
|
2229
|
+
return;
|
2230
|
+
let s = await this.openDbAsync();
|
2231
|
+
return new Promise((r, n) => {
|
2232
|
+
let l = s.transaction(this.store, "readwrite");
|
2233
|
+
l.oncomplete = (c) => {
|
2234
|
+
s.close();
|
2235
|
+
}, l.onerror = (c) => {
|
2236
|
+
n(c);
|
2237
|
+
};
|
2238
|
+
let i = R.clone(e), o = l.objectStore(this.store).put(i, t);
|
2239
|
+
o.onsuccess = (c) => {
|
2240
|
+
let g = c.target.result;
|
2241
|
+
r(g);
|
2242
|
+
}, o.onerror = (c) => {
|
2243
|
+
let g = c.target.error;
|
2244
|
+
n(g.message);
|
2245
|
+
};
|
2246
|
+
});
|
2247
|
+
}
|
2248
|
+
/**
|
2249
|
+
* 删除数据
|
2250
|
+
*/
|
2251
|
+
async deleteAsync(t) {
|
2252
|
+
if (t == null || Object.is(t, NaN))
|
2253
|
+
return;
|
2254
|
+
let e = await this.openDbAsync();
|
2255
|
+
return new Promise((s, r) => {
|
2256
|
+
let n = e.transaction(this.store, "readwrite");
|
2257
|
+
n.oncomplete = (u) => {
|
2258
|
+
e.close();
|
2259
|
+
}, n.onerror = (u) => {
|
2260
|
+
r(u);
|
2261
|
+
};
|
2262
|
+
let i = n.objectStore(this.store).delete(t);
|
2263
|
+
i.onsuccess = (u) => {
|
2264
|
+
let o = u.target.result;
|
2265
|
+
s(o);
|
2266
|
+
}, i.onerror = (u) => {
|
2267
|
+
let o = u.target.error.message;
|
2268
|
+
r(o);
|
2269
|
+
};
|
2270
|
+
});
|
2271
|
+
}
|
2272
|
+
/**
|
2273
|
+
* 提交事务
|
2274
|
+
*/
|
2275
|
+
commit() {
|
2276
|
+
}
|
2277
|
+
/**
|
2278
|
+
* 关闭连接
|
2279
|
+
*/
|
2280
|
+
dispose() {
|
2281
|
+
}
|
2282
|
+
};
|
2283
|
+
$.version = null;
|
2284
|
+
let ft = $;
|
2285
|
+
class ge {
|
2286
|
+
/**
|
2287
|
+
* 获取指定类型的提供程序
|
2288
|
+
*/
|
2289
|
+
static create(t) {
|
2290
|
+
let s = [new ft()].find((r) => r.type == t);
|
2291
|
+
if (s == null)
|
2292
|
+
throw new Error(`未实现数据库提供程序:${t}`);
|
2293
|
+
return s;
|
2294
|
+
}
|
2295
|
+
}
|
2296
|
+
class fe {
|
2297
|
+
constructor() {
|
2298
|
+
this.type = "xlsx";
|
2299
|
+
}
|
2300
|
+
open(t) {
|
2301
|
+
}
|
2302
|
+
export(t, e) {
|
2303
|
+
if (!e)
|
2304
|
+
throw new Error("Excel名称不能为空");
|
2305
|
+
t || (t = []);
|
2306
|
+
let s;
|
2307
|
+
t.length > 0 ? s = Object.keys(t[0]) : s = [];
|
2308
|
+
let r = [], n = [];
|
2309
|
+
if (s.forEach((c) => {
|
2310
|
+
n.push(c);
|
2311
|
+
}), r.push(n), t.length > 0)
|
2312
|
+
for (let c = 0; c < t.length; c++) {
|
2313
|
+
let g = t[c], p = [];
|
2314
|
+
Object.keys(g).forEach((v) => {
|
2315
|
+
p.push(g[v]);
|
2316
|
+
}), r.push(p);
|
2317
|
+
}
|
2318
|
+
let l = it.book_new(), i = it.json_to_sheet(r, { skipHeader: !0 });
|
2319
|
+
it.book_append_sheet(l, i, "abc");
|
2320
|
+
let u = 65;
|
2321
|
+
for (let c = 0; c < s.length; c++) {
|
2322
|
+
let p = `${String.fromCharCode(u + c)}1`;
|
2323
|
+
i[p].s = {
|
2324
|
+
alignment: { horizontal: "center" },
|
2325
|
+
font: { bold: !0, color: { rgb: "000000" } },
|
2326
|
+
fill: { fgColor: { rgb: "409eff" } }
|
2327
|
+
};
|
2328
|
+
}
|
2329
|
+
let o = [];
|
2330
|
+
s.forEach((c) => {
|
2331
|
+
let g = t[0][c], p = { wpx: 50 };
|
2332
|
+
typeof g == "string" && (p.wpx = 100), o.push(p);
|
2333
|
+
}), i["!cols"] = o, Dt(l, e);
|
2334
|
+
}
|
2335
|
+
}
|
2336
|
+
class de {
|
2337
|
+
/**
|
2338
|
+
* 获取Excel实例
|
2339
|
+
*/
|
2340
|
+
static create(t) {
|
2341
|
+
let s = [new fe()].find((r) => r.type.toLowerCase() == t.toLowerCase());
|
2342
|
+
if (s == null)
|
2343
|
+
throw new Error(`未支持的 Excel 类型:${t}`);
|
2344
|
+
return s;
|
2345
|
+
}
|
2346
|
+
}
|
2347
|
+
class V {
|
2348
|
+
getPath(t) {
|
2349
|
+
let e = X.getValueIgnoreCase(t, this.mappings);
|
2350
|
+
return k.httpOrHttps(e) ? e : this.baseUrl + e;
|
2351
|
+
}
|
2352
|
+
async loadPathAsync(t, e) {
|
2353
|
+
let s = this.baseUrl + t;
|
2354
|
+
await H.loadPathAsync(s, e);
|
2355
|
+
}
|
2356
|
+
async loadAsync(t) {
|
2357
|
+
let e = S.getArray(t), s = [];
|
2358
|
+
for (let r = 0; r < e.length; r++) {
|
2359
|
+
let n = this.getPath(e[r]);
|
2360
|
+
s.push(n);
|
2361
|
+
}
|
2362
|
+
return await H.loadAsync(s);
|
2363
|
+
}
|
2364
|
+
}
|
2365
|
+
class me extends V {
|
2366
|
+
constructor() {
|
2367
|
+
super(...arguments), this.type = "Jsdelivr", this.mappings = {
|
2368
|
+
"monaco-editor": "/npm/monaco-editor@0.49.0/min/vs"
|
2369
|
+
};
|
2370
|
+
}
|
2371
|
+
open(t) {
|
2372
|
+
this.baseUrl = "https://cdn.jsdelivr.net";
|
2373
|
+
}
|
2374
|
+
}
|
2375
|
+
class pe extends V {
|
2376
|
+
constructor() {
|
2377
|
+
super(...arguments), this.type = "StaticFile", this.mappings = {
|
2378
|
+
//通过cdn引入样式文件,并且打包文件中不会包括样式文件
|
2379
|
+
"element-plus": "/element-plus/2.7.5/index.css",
|
2380
|
+
// 加载monaco cdn压缩资源包,可以大幅减少本地请求数量
|
2381
|
+
//首次加载4.11s
|
2382
|
+
//不能使用,偶发404:https://cdn.staticfile.net/monaco-editor/0.45.0/min/vs
|
2383
|
+
"monaco-editor": "https://cdn.jsdelivr.net/npm/monaco-editor@0.49.0/min/vs",
|
2384
|
+
quill: "/quill/2.0.2/quill.snow.min.css",
|
2385
|
+
"fort-awesome": "https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css"
|
2386
|
+
};
|
2387
|
+
}
|
2388
|
+
open(t) {
|
2389
|
+
this.baseUrl = "https://cdn.staticfile.net";
|
2390
|
+
}
|
2391
|
+
}
|
2392
|
+
class ye extends V {
|
2393
|
+
constructor() {
|
2394
|
+
super(...arguments), this.type = "BootCdn", this.mappings = {
|
2395
|
+
"element-plus": "/ajax/libs/element-plus/2.4.4/index.css",
|
2396
|
+
"monaco-editor": "/ajax/libs/monaco-editor/0.45.0/min/vs",
|
2397
|
+
quill: "/ajax/libs/quill/1.3.7/quill.snow.min.css"
|
2398
|
+
};
|
2399
|
+
}
|
2400
|
+
open(t) {
|
2401
|
+
this.baseUrl = "https://cdn.bootcdn.net";
|
2402
|
+
}
|
2403
|
+
}
|
2404
|
+
class be extends V {
|
2405
|
+
constructor() {
|
2406
|
+
super(...arguments), this.type = "Local", this.mappings = {
|
2407
|
+
//引入本地样式文件,会导致始终打包进打包文件
|
2408
|
+
//后续可以改进为:发包后,单独存放静态样式文件,框架加载时,自动通过异步方式加载样式文件
|
2409
|
+
//为了同时让下游同时支持CDN引入和本地引入样式表文件,所以需要把element-plus的样式文件,独立打包到一个文件中,让下游:
|
2410
|
+
//1. 启用CDN时,能够使用CDN加载,而不加载本地element-plus的样式文件
|
2411
|
+
//2. 不启用CDN时,采用本地打包方式,支持载入本地element-plus样式表文件
|
2412
|
+
//所以,上游包,必须同时包含独立的element-plus样式表文件
|
2413
|
+
//复制包内的样式表文件,方便cdn方式不加载样式表 和 未启用cdn方式加载 样式表
|
2414
|
+
"element-plus": "element-plus/dist/index.css",
|
2415
|
+
quill: "quill/dist/quill.snow.css",
|
2416
|
+
"fort-awesome": "@fortawesome/fontawesome-free/css/all.min.css"
|
2417
|
+
};
|
2418
|
+
}
|
2419
|
+
open(t) {
|
2420
|
+
this.baseUrl = t;
|
2421
|
+
}
|
2422
|
+
}
|
2423
|
+
class we extends V {
|
2424
|
+
constructor() {
|
2425
|
+
super(...arguments), this.type = "Unpkg", this.mappings = {
|
2426
|
+
//首次加载很不稳定: 30s+, 稳定后: 首次加载2.5s(使用https加载,可以防止本地http访问外部http资源时的请求警告)
|
2427
|
+
"monaco-editor": ["/monaco-editor@0.49.0/min/vs"]
|
2428
|
+
};
|
2429
|
+
}
|
2430
|
+
open(t) {
|
2431
|
+
this.baseUrl = "https://unpkg.com";
|
2432
|
+
}
|
2433
|
+
}
|
2434
|
+
class Se {
|
2435
|
+
/**
|
2436
|
+
* 获取指定CDN实例
|
2437
|
+
*/
|
2438
|
+
static create(t) {
|
2439
|
+
let s = [new me(), new pe(), new ye(), new be(), new we()].find((r) => r.type.toLowerCase() == t.toLowerCase());
|
2440
|
+
if (s == null)
|
2441
|
+
throw new Error(`未支持的Cdn类型:${t}`);
|
2442
|
+
return s;
|
2443
|
+
}
|
2444
|
+
}
|
2445
|
+
class Y {
|
2446
|
+
/**
|
2447
|
+
* 获取SSO
|
2448
|
+
*/
|
2449
|
+
static getSso(t) {
|
2450
|
+
if (!t)
|
2451
|
+
throw new Error("SSO 配置类型不能为空");
|
2452
|
+
let s = It().ssos.find((l) => l.type.toUpperCase() == t.toUpperCase()), r = { url: s == null ? void 0 : s.url, app_id: s == null ? void 0 : s.appId }, n = le.getSso(t);
|
2453
|
+
return n.open(r), n;
|
2454
|
+
}
|
2455
|
+
/**
|
2456
|
+
* 获取签名器
|
2457
|
+
*/
|
2458
|
+
static getSigner(t) {
|
2459
|
+
if (!t)
|
2460
|
+
throw new Error("Signer 配置类型不能为空");
|
2461
|
+
let e = ae.create(t);
|
2462
|
+
return e.open(null), e;
|
2463
|
+
}
|
2464
|
+
/**
|
2465
|
+
* 获取特征
|
2466
|
+
*/
|
2467
|
+
static getFeature(t) {
|
2468
|
+
if (!t)
|
2469
|
+
throw new Error("Feature 配置类型不能为空");
|
2470
|
+
let e = he.create(t);
|
2471
|
+
return e.open(null), e;
|
2472
|
+
}
|
2473
|
+
/**
|
2474
|
+
* 获取并开启 指定类型的驱动程序
|
2475
|
+
*/
|
2476
|
+
static async getProviderAsync(t, e = null) {
|
2477
|
+
let s = ge.create(t);
|
2478
|
+
return await s.openAsync("halo"), e != null && await s.createAsync(e), s;
|
2479
|
+
}
|
2480
|
+
/**
|
2481
|
+
* 获取Excel实例
|
2482
|
+
*/
|
2483
|
+
static getExcel(t) {
|
2484
|
+
let e = de.create(t);
|
2485
|
+
return e.open(null), e;
|
2486
|
+
}
|
2487
|
+
/**
|
2488
|
+
* 获取CDN实例
|
2489
|
+
*/
|
2490
|
+
static getCdn(t, e = null) {
|
2491
|
+
let s = Se.create(t);
|
2492
|
+
return s.open(e), s;
|
2493
|
+
}
|
2494
|
+
/**
|
2495
|
+
* 获取编码器
|
2496
|
+
*/
|
2497
|
+
static getEncoder(t) {
|
2498
|
+
let e;
|
2499
|
+
return S.equalsIgnoreCase(t, "base64") ? e = st.getBase64() : e = st.create(t), e.open(null), e;
|
2500
|
+
}
|
2501
|
+
/**
|
2502
|
+
* 获取Hasher
|
2503
|
+
*/
|
2504
|
+
static getHasher(t) {
|
2505
|
+
let e;
|
2506
|
+
return S.equalsIgnoreCase(t, "md5") ? e = tt.getMd5() : e = tt.create(t), e.open(null), e;
|
2507
|
+
}
|
2508
|
+
}
|
2509
|
+
export {
|
2510
|
+
z as ArrayHelper,
|
2511
|
+
$e as ComponentHelper,
|
2512
|
+
Ue as CookieHelper,
|
2513
|
+
X as DictionaryHelper,
|
2514
|
+
U as DomHelper,
|
2515
|
+
N as DriverFactory,
|
2516
|
+
Y as DriverHelper,
|
2517
|
+
bt as EventHelper,
|
2518
|
+
Z as FileHelper,
|
2519
|
+
wt as HtmlHelper,
|
2520
|
+
Le as I18nHelper,
|
2521
|
+
St as ImageHelper,
|
2522
|
+
Ft as JsonHelper,
|
2523
|
+
xt as MathHelper,
|
2524
|
+
kt as MicroHelper,
|
2525
|
+
G as MountHelper,
|
2526
|
+
R as ObjectHelper,
|
2527
|
+
Vt as RequesterFactory,
|
2528
|
+
H as ScriptHelper,
|
2529
|
+
Ot as ScrollHelper,
|
2530
|
+
K as SettingService,
|
2531
|
+
te as SignHelper,
|
2532
|
+
w as StorageHelper,
|
2533
|
+
S as StringHelper,
|
2534
|
+
Ct as TaskHelper,
|
2535
|
+
D as TimeHelper,
|
2536
|
+
_ as TreeHelper,
|
2537
|
+
y as TypeHelper,
|
2538
|
+
k as UrlHelper
|
2539
|
+
};
|