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