@das-fed/upf-utils 6.4.0-dev.169 → 6.4.0-dev.171
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-services/es5.js +4622 -0
- package/api-services/i18n/es5.js +53 -0
- package/api-services/index.js +593 -611
- package/api-services/index.js.gz +0 -0
- package/api-services/modules/app-manage/index.js +487 -505
- package/api-services/modules/app-manage/index.js.gz +0 -0
- package/api-services/modules/authentication/index.js +487 -505
- package/api-services/modules/authentication/index.js.gz +0 -0
- package/api-services/modules/bems/index.js +479 -497
- package/api-services/modules/bems/index.js.gz +0 -0
- package/api-services/modules/contract/index.js +847 -883
- package/api-services/modules/contract/index.js.gz +0 -0
- package/api-services/modules/duty-manage/index.js +822 -858
- package/api-services/modules/duty-manage/index.js.gz +0 -0
- package/api-services/modules/enterpriseright/index.js +847 -883
- package/api-services/modules/enterpriseright/index.js.gz +0 -0
- package/api-services/modules/es5.js +4569 -0
- package/api-services/modules/file/index.js +942 -978
- package/api-services/modules/file/index.js.gz +0 -0
- package/api-services/modules/gateway-edge/index.js +487 -505
- package/api-services/modules/gateway-edge/index.js.gz +0 -0
- package/api-services/modules/index.js +1022 -1058
- package/api-services/modules/index.js.gz +0 -0
- package/api-services/modules/iot/index.js +831 -849
- package/api-services/modules/iot/index.js.gz +0 -0
- package/api-services/modules/justauth/index.js +478 -496
- package/api-services/modules/justauth/index.js.gz +0 -0
- package/api-services/modules/knowledge/index.js +880 -880
- package/api-services/modules/knowledge/index.js.gz +0 -0
- package/api-services/modules/link/index.js +880 -880
- package/api-services/modules/link/index.js.gz +0 -0
- package/api-services/modules/permission/index.js +880 -880
- package/api-services/modules/permission/index.js.gz +0 -0
- package/api-services/modules/platformManage/index.js +873 -877
- package/api-services/modules/platformManage/index.js.gz +0 -0
- package/api-services/modules/portal/index.js +487 -505
- package/api-services/modules/portal/index.js.gz +0 -0
- package/api-services/modules/space-manage/index.js +847 -883
- package/api-services/modules/space-manage/index.js.gz +0 -0
- package/api-services/modules/super-admin/index.js +479 -497
- package/api-services/modules/super-admin/index.js.gz +0 -0
- package/api-services/modules/supplier/index.js +882 -882
- package/api-services/modules/supplier/index.js.gz +0 -0
- package/api-services/modules/supplychain-manage/index.js +847 -883
- package/api-services/modules/supplychain-manage/index.js.gz +0 -0
- package/api-services/modules/systemConfiguration/index.js +490 -508
- package/api-services/modules/systemConfiguration/index.js.gz +0 -0
- package/api-services/modules/tool/index.js +880 -880
- package/api-services/modules/tool/index.js.gz +0 -0
- package/api-services/src/create-service/index.js +865 -901
- package/api-services/src/create-service/index.js.gz +0 -0
- package/atob/es5.js +9 -0
- package/common-info/es5.js +201 -0
- package/common-info/getIframeUrl/es5.js +16 -0
- package/common-info/getInfoFromUrl/es5.js +91 -0
- package/common-info/index.js +18 -18
- package/common-info/index.js.gz +0 -0
- package/common-info/set-personal-info/es5.js +2210 -0
- package/common-info/set-personal-info/index.js +172 -189
- package/common-info/set-personal-info/index.js.gz +0 -0
- package/common-tools/arr-tools/es5.js +11 -0
- package/common-tools/calc-text-width/es5.js +8 -0
- package/common-tools/date-format/es5.js +18 -0
- package/common-tools/es5.js +14 -0
- package/common-tools/extract-file-name/es5.js +2211 -0
- package/common-tools/extract-file-name/index.js +138 -155
- package/common-tools/extract-file-name/index.js.gz +0 -0
- package/common-tools/get-file-extension/es5.js +5 -0
- package/common-tools/get-url-params/es5.js +101 -0
- package/common-tools/handle-data/es5.js +146 -0
- package/common-tools/handle-data/index.d.ts +1 -2
- package/common-tools/handle-data/index.js +41 -73
- package/common-tools/handle-data/index.js.gz +0 -0
- package/common-tools/nest-tree-format/es5.js +53 -0
- package/common-tools/obj-tools/es5.js +13 -0
- package/common-tools/platform-tools/es5.js +19 -0
- package/common-tools/queue-promise/es5.js +13 -0
- package/common-tools/setHtmlMinWH/es5.js +6 -0
- package/common-tools/update-browser-title/es5.js +54 -0
- package/common-tools/update-fav-icon/es5.js +73 -0
- package/config/es5.js +15 -0
- package/create-api-service/check-token/es5.js +2305 -0
- package/create-api-service/check-token/index.js +158 -175
- package/create-api-service/check-token/index.js.gz +0 -0
- package/create-api-service/es5.js +3947 -0
- package/create-api-service/i18n/es5.js +33 -0
- package/create-api-service/index.js +865 -901
- package/create-api-service/index.js.gz +0 -0
- package/create-api-service/proxy-sso/es5.js +33 -0
- package/create-api-service/sso/es5.js +2815 -0
- package/create-api-service/sso/index.js +309 -327
- package/create-api-service/sso/index.js.gz +0 -0
- package/curring-http/es5.js +2913 -0
- package/curring-http/index.js +285 -303
- package/curring-http/index.js.gz +0 -0
- package/dimple-canvas/es5.js +1 -0
- package/directive/auth/es5.js +94 -0
- package/directive/clickOutside/es5.js +85 -0
- package/directive/es5.js +3 -0
- package/directive/hoverInside/es5.js +59 -0
- package/directive/utils/es5.js +36 -0
- package/dom-check-in/es5.js +11 -0
- package/dom-watcher/es5.js +13 -0
- package/esm-map.json +1 -2
- package/hooks/use-get-auth/es5.js +199 -0
- package/hooks/use-get-auth/index.js +22 -22
- package/hooks/use-get-auth/index.js.gz +0 -0
- package/load-js/es5.js +13 -0
- package/nextTiken/es5.js +64 -0
- package/oss/es5.js +10 -0
- package/package.json +7 -4
- package/pinyin-first-character/es5.js +9311 -0
- package/pinyin-first-character/index.js +24 -24
- package/pinyin-first-character/index.js.gz +0 -0
- package/process-engine-info/es5.js +15 -0
- package/pure-image-src/es5.js +28 -0
- package/size-watcher/es5.js +32 -0
- package/style/es5.js +134 -0
- package/token-tools/es5.js +21 -0
- package/use-low-code/es5.js +115 -0
- package/use-low-code/index.js +2 -2
- package/use-low-code/index.js.gz +0 -0
- package/vue/es5.js +1 -0
- package/webSocket-service/es5.js +120 -0
- package/with-install/es5.js +6 -0
|
@@ -18867,11 +18867,11 @@ const Z = nn(), gn = Object.keys(Z).map((n) => ({
|
|
|
18867
18867
|
}, un = Object.keys(O);
|
|
18868
18868
|
function sn(n, i, g) {
|
|
18869
18869
|
if (un.indexOf(n) === -1)
|
|
18870
|
-
return
|
|
18871
|
-
if (i === g && i &&
|
|
18872
|
-
return f(
|
|
18870
|
+
return e(n);
|
|
18871
|
+
if (i === g && i && e(i) !== i)
|
|
18872
|
+
return f(e(n));
|
|
18873
18873
|
if (g && !hn[n].includes(g)) {
|
|
18874
|
-
const h =
|
|
18874
|
+
const h = e(g);
|
|
18875
18875
|
if (h !== g) {
|
|
18876
18876
|
const u = m(h), s = O[n];
|
|
18877
18877
|
for (let z in s)
|
|
@@ -18889,7 +18889,7 @@ function on(n, i) {
|
|
|
18889
18889
|
return !i || !x.get(i) ? "tóng" : x.get(i).split(" ")[0];
|
|
18890
18890
|
}
|
|
18891
18891
|
function C(n, i, g) {
|
|
18892
|
-
return on(n, i) || zn(n, i) || sn(n, i, g) ||
|
|
18892
|
+
return on(n, i) || zn(n, i) || sn(n, i, g) || e(n);
|
|
18893
18893
|
}
|
|
18894
18894
|
const a = {
|
|
18895
18895
|
南宫: "nán gōng",
|
|
@@ -23491,7 +23491,7 @@ const a = {
|
|
|
23491
23491
|
length: 4,
|
|
23492
23492
|
priority: j.Normal,
|
|
23493
23493
|
dict: Symbol("dict4")
|
|
23494
|
-
})),
|
|
23494
|
+
})), _ = {
|
|
23495
23495
|
巴尔干半岛: "bā ěr gàn bàn dǎo",
|
|
23496
23496
|
巴尔喀什湖: "bā ěr kā shí hú",
|
|
23497
23497
|
不幸而言中: "bú xìng ér yán zhòng",
|
|
@@ -23507,15 +23507,15 @@ const a = {
|
|
|
23507
23507
|
亚得里亚海: "yà dé lǐ yà hǎi",
|
|
23508
23508
|
眼不见为净: "yǎn bú jiàn wéi jìng",
|
|
23509
23509
|
竹筒倒豆子: "zhú tǒng dào dòu zi"
|
|
23510
|
-
}, jn = Object.keys(
|
|
23510
|
+
}, jn = Object.keys(_).map((n) => ({
|
|
23511
23511
|
zh: n,
|
|
23512
|
-
pinyin:
|
|
23512
|
+
pinyin: _[n],
|
|
23513
23513
|
probability: 2e-8,
|
|
23514
23514
|
length: 5,
|
|
23515
23515
|
priority: j.Normal,
|
|
23516
23516
|
dict: Symbol("dict5")
|
|
23517
23517
|
}));
|
|
23518
|
-
function
|
|
23518
|
+
function v(n, i) {
|
|
23519
23519
|
return n && (n.decimal < i.decimal || n.decimal === i.decimal && n.probability > i.probability) ? n : i;
|
|
23520
23520
|
}
|
|
23521
23521
|
function E(n) {
|
|
@@ -23536,14 +23536,14 @@ function xn(n, i) {
|
|
|
23536
23536
|
patterns: z.patterns,
|
|
23537
23537
|
concatPattern: u
|
|
23538
23538
|
};
|
|
23539
|
-
E(y), g[l] =
|
|
23539
|
+
E(y), g[l] = v(g[l], y), u = n[--h];
|
|
23540
23540
|
}
|
|
23541
23541
|
const o = {
|
|
23542
23542
|
probability: 1e-13 * z.probability,
|
|
23543
23543
|
decimal: 0,
|
|
23544
23544
|
patterns: z.patterns
|
|
23545
23545
|
};
|
|
23546
|
-
E(o), g[s] =
|
|
23546
|
+
E(o), g[s] = v(g[s], o), g[s].concatPattern && (g[s].patterns = g[s].patterns.concat(g[s].concatPattern), g[s].concatPattern = void 0, delete g[s + 1]);
|
|
23547
23547
|
}
|
|
23548
23548
|
return g[0].patterns.reverse();
|
|
23549
23549
|
}
|
|
@@ -23553,7 +23553,7 @@ function A(n, i) {
|
|
|
23553
23553
|
function bn(n) {
|
|
23554
23554
|
return n.priority === j.Custom ? -(n.length * n.length * 1e5) : n.priority === j.Surname ? -(n.length * n.length * 100) : 1;
|
|
23555
23555
|
}
|
|
23556
|
-
function
|
|
23556
|
+
function en(n, i) {
|
|
23557
23557
|
const g = [];
|
|
23558
23558
|
let h = n.length - 1, u = n[h];
|
|
23559
23559
|
for (let s = i - 1; s >= 0; s--) {
|
|
@@ -23574,7 +23574,7 @@ function rn(n, i) {
|
|
|
23574
23574
|
}
|
|
23575
23575
|
return g[0].patterns.reverse();
|
|
23576
23576
|
}
|
|
23577
|
-
function
|
|
23577
|
+
function rn(n, i) {
|
|
23578
23578
|
return !(i.index + i.length <= n.index || i.priority > n.priority || i.priority === n.priority && i.length > n.length);
|
|
23579
23579
|
}
|
|
23580
23580
|
function wn(n) {
|
|
@@ -23582,7 +23582,7 @@ function wn(n) {
|
|
|
23582
23582
|
for (let g = n.length - 1; g >= 0; ) {
|
|
23583
23583
|
const { index: h } = n[g];
|
|
23584
23584
|
let u = g - 1;
|
|
23585
|
-
for (; u >= 0 &&
|
|
23585
|
+
for (; u >= 0 && rn(n[g], n[u]); )
|
|
23586
23586
|
u--;
|
|
23587
23587
|
(u < 0 || n[u].index + n[u].length <= h) && i.push(n[g]), g = u;
|
|
23588
23588
|
}
|
|
@@ -23684,7 +23684,7 @@ class qn {
|
|
|
23684
23684
|
}
|
|
23685
23685
|
search(i, g, h = 2) {
|
|
23686
23686
|
const u = this.match(i, g);
|
|
23687
|
-
return h === 1 ? wn(u) : h === 3 ?
|
|
23687
|
+
return h === 1 ? wn(u) : h === 3 ? en(u, d(i)) : xn(u, d(i));
|
|
23688
23688
|
}
|
|
23689
23689
|
}
|
|
23690
23690
|
const fn = [
|
|
@@ -23696,7 +23696,7 @@ const fn = [
|
|
|
23696
23696
|
...yn
|
|
23697
23697
|
], U = new qn();
|
|
23698
23698
|
U.build(fn);
|
|
23699
|
-
const mn = new F(), pn = () => mn,
|
|
23699
|
+
const mn = new F(), pn = () => mn, e = (n) => {
|
|
23700
23700
|
const i = x.get(n);
|
|
23701
23701
|
return i ? i.split(" ")[0] : n;
|
|
23702
23702
|
}, an = (n, i, g, h) => {
|
|
@@ -23780,7 +23780,7 @@ const mn = new F(), pn = () => mn, r = (n) => {
|
|
|
23780
23780
|
initial: g.join(" ")
|
|
23781
23781
|
// 声母
|
|
23782
23782
|
};
|
|
23783
|
-
},
|
|
23783
|
+
}, r = (n) => {
|
|
23784
23784
|
const { final: i } = q(n);
|
|
23785
23785
|
let g = "", h = "", u = "";
|
|
23786
23786
|
return Y.indexOf(f(i)) !== -1 ? (g = i[0], h = i[1], u = i.slice(2)) : (h = i[0] || "", u = i.slice(1) || ""), { head: g, body: h, tail: u };
|
|
@@ -23841,17 +23841,17 @@ const Dn = (n, i) => {
|
|
|
23841
23841
|
break;
|
|
23842
23842
|
case "finalHead":
|
|
23843
23843
|
n.forEach((g) => {
|
|
23844
|
-
g.result = g.isZh ?
|
|
23844
|
+
g.result = g.isZh ? r(g.result).head : "";
|
|
23845
23845
|
});
|
|
23846
23846
|
break;
|
|
23847
23847
|
case "finalBody":
|
|
23848
23848
|
n.forEach((g) => {
|
|
23849
|
-
g.result = g.isZh ?
|
|
23849
|
+
g.result = g.isZh ? r(g.result).body : "";
|
|
23850
23850
|
});
|
|
23851
23851
|
break;
|
|
23852
23852
|
case "finalTail":
|
|
23853
23853
|
n.forEach((g) => {
|
|
23854
|
-
g.result = g.isZh ?
|
|
23854
|
+
g.result = g.isZh ? r(g.result).tail : "";
|
|
23855
23855
|
});
|
|
23856
23856
|
break;
|
|
23857
23857
|
}
|
|
@@ -23884,7 +23884,7 @@ const Dn = (n, i) => {
|
|
|
23884
23884
|
});
|
|
23885
23885
|
}
|
|
23886
23886
|
return i.type === "array" ? n.map((h) => h.result) : i.type === "all" ? n.map((h) => {
|
|
23887
|
-
const u = h.isZh ? h.result : "", { initial: s, final: z } = q(u), { head: o, body: l, tail: y } =
|
|
23887
|
+
const u = h.isZh ? h.result : "", { initial: s, final: z } = q(u), { head: o, body: l, tail: y } = r(u);
|
|
23888
23888
|
let c = [];
|
|
23889
23889
|
return u !== "" && (c = [u].concat(W(h.origin, i.surname).filter((t) => t !== u))), {
|
|
23890
23890
|
origin: h.origin,
|
|
@@ -23917,7 +23917,7 @@ const Dn = (n, i) => {
|
|
|
23917
23917
|
toneSandhi: !0,
|
|
23918
23918
|
segmentit: 2
|
|
23919
23919
|
};
|
|
23920
|
-
function
|
|
23920
|
+
function _n(n, i) {
|
|
23921
23921
|
if (i = Object.assign(Object.assign({}, Nn), i || {}), !Sn(n))
|
|
23922
23922
|
return n;
|
|
23923
23923
|
if (n === "")
|
|
@@ -23931,12 +23931,12 @@ var k;
|
|
|
23931
23931
|
n[n.AllSegment = 1] = "AllSegment", n[n.AllArray = 2] = "AllArray", n[n.AllString = 3] = "AllString", n[n.PinyinSegment = 4] = "PinyinSegment", n[n.PinyinArray = 5] = "PinyinArray", n[n.PinyinString = 6] = "PinyinString", n[n.ZhSegment = 7] = "ZhSegment", n[n.ZhArray = 8] = "ZhArray", n[n.ZhString = 9] = "ZhString";
|
|
23932
23932
|
})(k || (k = {}));
|
|
23933
23933
|
k.AllSegment;
|
|
23934
|
-
const
|
|
23934
|
+
const vn = (n) => _n(n, {
|
|
23935
23935
|
pattern: "first",
|
|
23936
23936
|
toneType: "none",
|
|
23937
23937
|
type: "string",
|
|
23938
23938
|
separator: ""
|
|
23939
23939
|
});
|
|
23940
23940
|
export {
|
|
23941
|
-
|
|
23941
|
+
vn as getPinyinFirstCharacter
|
|
23942
23942
|
};
|
|
Binary file
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var s = function s(e) {
|
|
2
|
+
sessionStorage.setItem("hotentToken", e.accessToken || ""), sessionStorage.setItem("currentUser", JSON.stringify({
|
|
3
|
+
token: e.accessToken || ""
|
|
4
|
+
}));
|
|
5
|
+
},
|
|
6
|
+
o = function o() {
|
|
7
|
+
sessionStorage.removeItem("hotentToken"), sessionStorage.removeItem("currentUser");
|
|
8
|
+
},
|
|
9
|
+
t = function t(e) {
|
|
10
|
+
sessionStorage.setItem("project", e);
|
|
11
|
+
},
|
|
12
|
+
n = function n() {
|
|
13
|
+
sessionStorage.removeItem("project");
|
|
14
|
+
};
|
|
15
|
+
export { n as removeProcessEngineProject, o as removeProcessEngineToken, t as setProcessEngineProject, s as setProcessEngineToken };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var e = "oss",
|
|
2
|
+
c = function c(n) {
|
|
3
|
+
return n.indexOf("/".concat(e, "/")) === 0 ? n : null;
|
|
4
|
+
},
|
|
5
|
+
l = function l(n) {
|
|
6
|
+
return n.indexOf("/") === 0 ? "/".concat(e).concat(n) : null;
|
|
7
|
+
},
|
|
8
|
+
a = function a(n) {
|
|
9
|
+
return n.indexOf("".concat(e, "/")) === 0 ? "/".concat(n) : null;
|
|
10
|
+
},
|
|
11
|
+
d = function d(n) {
|
|
12
|
+
return "/".concat(e, "/").concat(n);
|
|
13
|
+
},
|
|
14
|
+
o = function o() {
|
|
15
|
+
for (var _len = arguments.length, n = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
16
|
+
n[_key] = arguments[_key];
|
|
17
|
+
}
|
|
18
|
+
return function (t) {
|
|
19
|
+
return n.reduce(function (r, u) {
|
|
20
|
+
return r !== null ? r : u(t);
|
|
21
|
+
}, null);
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
i = o(c, l, a, d),
|
|
25
|
+
s = function s(n) {
|
|
26
|
+
return n ? i(n) : "";
|
|
27
|
+
};
|
|
28
|
+
export { s as pureImageSrc };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ref, onMounted } from 'vue';
|
|
2
|
+
var i = function i(e, t) {
|
|
3
|
+
var n = t || document.documentElement,
|
|
4
|
+
o = new ResizeObserver(function (c) {
|
|
5
|
+
var s = c[0];
|
|
6
|
+
e(s.contentRect);
|
|
7
|
+
});
|
|
8
|
+
return t !== null && o.observe(n), o;
|
|
9
|
+
},
|
|
10
|
+
h = function h() {
|
|
11
|
+
var e = ref(null),
|
|
12
|
+
t = ref({
|
|
13
|
+
bottom: 0,
|
|
14
|
+
height: 0,
|
|
15
|
+
left: 0,
|
|
16
|
+
right: 0,
|
|
17
|
+
top: 0,
|
|
18
|
+
width: 0,
|
|
19
|
+
x: 0,
|
|
20
|
+
y: 0,
|
|
21
|
+
toJSON: function toJSON() {}
|
|
22
|
+
});
|
|
23
|
+
return onMounted(function () {
|
|
24
|
+
i(function (n) {
|
|
25
|
+
t.value = n;
|
|
26
|
+
}, e.value), e.value;
|
|
27
|
+
}), {
|
|
28
|
+
el: e,
|
|
29
|
+
rect: t
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export { i as SizeWatcher, h as useSizeWatcher };
|
package/style/es5.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
2
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
6
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
7
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
8
|
+
/**
|
|
9
|
+
* @vue/shared v3.5.17
|
|
10
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
11
|
+
* @license MIT
|
|
12
|
+
**/
|
|
13
|
+
process.env.NODE_ENV !== "production" && Object.freeze({});
|
|
14
|
+
process.env.NODE_ENV !== "production" && Object.freeze([]);
|
|
15
|
+
var u = function u(t) {
|
|
16
|
+
var e = /* @__PURE__ */Object.create(null);
|
|
17
|
+
return function (r) {
|
|
18
|
+
return e[r] || (e[r] = t(r));
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
m = /-(\w)/g,
|
|
22
|
+
p = u(function (t) {
|
|
23
|
+
return t.replace(m, function (e, r) {
|
|
24
|
+
return r ? r.toUpperCase() : "";
|
|
25
|
+
});
|
|
26
|
+
}),
|
|
27
|
+
a = function a() {
|
|
28
|
+
var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
29
|
+
return t.split(" ").filter(function (e) {
|
|
30
|
+
return !!e.trim();
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
h = function h(t, e) {
|
|
34
|
+
if (!t || !e) return false;
|
|
35
|
+
if (e.includes(" ")) throw new Error("className should not contain space.");
|
|
36
|
+
return t.classList.contains(e);
|
|
37
|
+
},
|
|
38
|
+
y = function y(t, e) {
|
|
39
|
+
var _t$classList;
|
|
40
|
+
!t || !e.trim() || (_t$classList = t.classList).add.apply(_t$classList, _toConsumableArray(a(e)));
|
|
41
|
+
},
|
|
42
|
+
g = function g(t, e) {
|
|
43
|
+
var _t$classList2;
|
|
44
|
+
!t || !e.trim() || (_t$classList2 = t.classList).remove.apply(_t$classList2, _toConsumableArray(a(e)));
|
|
45
|
+
},
|
|
46
|
+
N = function N(t, e) {
|
|
47
|
+
if (!t || !e) return "";
|
|
48
|
+
var r = p(e);
|
|
49
|
+
r === "float" && (r = "cssFloat");
|
|
50
|
+
try {
|
|
51
|
+
var n = t.style[r];
|
|
52
|
+
if (n) return n;
|
|
53
|
+
var s = window == null ? void 0 : window.getComputedStyle(t, "");
|
|
54
|
+
return s ? s[r] : "";
|
|
55
|
+
} catch (_unused) {
|
|
56
|
+
return t.style[r];
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
d = function d() {
|
|
60
|
+
var t = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
61
|
+
return Object.keys(t).map(function (e) {
|
|
62
|
+
return "".concat(e, ":").concat(t[e] !== "" ? t[e] : '""');
|
|
63
|
+
}).join(";");
|
|
64
|
+
},
|
|
65
|
+
E = function E(t, e) {
|
|
66
|
+
if (!document.getElementById(t)) return new Promise(function (r, n) {
|
|
67
|
+
var s = document.createElement("style");
|
|
68
|
+
s.rel = "text/css", s.id = t;
|
|
69
|
+
var _iterator = _createForOfIteratorHelper(e),
|
|
70
|
+
_step;
|
|
71
|
+
try {
|
|
72
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
73
|
+
var i = _step.value;
|
|
74
|
+
s.appendChild(document.createTextNode("".concat(i.className, "{").concat(d(i.style), "}")));
|
|
75
|
+
}
|
|
76
|
+
} catch (err) {
|
|
77
|
+
_iterator.e(err);
|
|
78
|
+
} finally {
|
|
79
|
+
_iterator.f();
|
|
80
|
+
}
|
|
81
|
+
document.getElementsByTagName("head")[0].appendChild(s), s.onload = function () {
|
|
82
|
+
return r("load success");
|
|
83
|
+
}, s.onerror = function () {
|
|
84
|
+
return n("load error");
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
S = function S(t, e) {
|
|
89
|
+
var r = document.getElementById(t);
|
|
90
|
+
if (r) {
|
|
91
|
+
r.innerHTML = "";
|
|
92
|
+
var _iterator2 = _createForOfIteratorHelper(e),
|
|
93
|
+
_step2;
|
|
94
|
+
try {
|
|
95
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
96
|
+
var n = _step2.value;
|
|
97
|
+
r.appendChild(document.createTextNode("".concat(n.className, "{").concat(d(n.style), "}")));
|
|
98
|
+
}
|
|
99
|
+
} catch (err) {
|
|
100
|
+
_iterator2.e(err);
|
|
101
|
+
} finally {
|
|
102
|
+
_iterator2.f();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
l = function l(t) {
|
|
107
|
+
return Number(t.toString().replace("px", ""));
|
|
108
|
+
},
|
|
109
|
+
o = function o(t, e, r) {
|
|
110
|
+
e = l(e), r = l(r);
|
|
111
|
+
var n;
|
|
112
|
+
return t === "add" && (n = e + r), t === "subtract" && (n = e - r), t === "multiply" && (n = e * r), t === "divide" && (n = e / r), e = null, r = null, n;
|
|
113
|
+
},
|
|
114
|
+
_c = function c(t) {
|
|
115
|
+
return {
|
|
116
|
+
add: function add(e) {
|
|
117
|
+
return _c(o("add", t, e));
|
|
118
|
+
},
|
|
119
|
+
subtract: function subtract(e) {
|
|
120
|
+
return _c(o("subtract", t, e));
|
|
121
|
+
},
|
|
122
|
+
multiply: function multiply(e) {
|
|
123
|
+
return _c(o("multiply", t, e));
|
|
124
|
+
},
|
|
125
|
+
divide: function divide(e) {
|
|
126
|
+
return _c(o("divide", t, e));
|
|
127
|
+
},
|
|
128
|
+
res: function res() {
|
|
129
|
+
var e = t + "px";
|
|
130
|
+
return t = null, e;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
export { y as addClass, E as createStyle, _c as curringMath, d as getCSS, N as getStyle, h as hasClass, g as removeClass, S as updateStyle };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var o = "accessToken",
|
|
2
|
+
r = "accessTokenExpiredAt",
|
|
3
|
+
c = "refreshToken",
|
|
4
|
+
s = "redirectUri",
|
|
5
|
+
a = function a() {
|
|
6
|
+
var _ref, _localStorage$getItem;
|
|
7
|
+
return (_ref = (_localStorage$getItem = localStorage.getItem(o)) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : sessionStorage.getItem(o)) !== null && _ref !== void 0 ? _ref : "";
|
|
8
|
+
},
|
|
9
|
+
n = function n(e) {
|
|
10
|
+
var _ref2, _localStorage$getItem2;
|
|
11
|
+
return (_ref2 = (_localStorage$getItem2 = localStorage.getItem(e)) !== null && _localStorage$getItem2 !== void 0 ? _localStorage$getItem2 : sessionStorage.getItem(e)) !== null && _ref2 !== void 0 ? _ref2 : "";
|
|
12
|
+
},
|
|
13
|
+
l = function l(e) {
|
|
14
|
+
var _t$accessTokenExpired, _t$refreshToken;
|
|
15
|
+
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
16
|
+
localStorage.setItem(o, e), localStorage.setItem(r, (_t$accessTokenExpired = t.accessTokenExpiredAt) !== null && _t$accessTokenExpired !== void 0 ? _t$accessTokenExpired : "0"), localStorage.setItem(c, (_t$refreshToken = t.refreshToken) !== null && _t$refreshToken !== void 0 ? _t$refreshToken : ""), t.redirectUri && localStorage.setItem(s, t.redirectUri);
|
|
17
|
+
},
|
|
18
|
+
g = function g() {
|
|
19
|
+
localStorage.removeItem(o), localStorage.removeItem(r), localStorage.removeItem(c), localStorage.removeItem(s);
|
|
20
|
+
};
|
|
21
|
+
export { a as getAccessToken, n as getAccessTokenInfo, g as removeAccessToken, l as setAccessToken };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
4
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
5
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
6
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
7
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
8
|
+
import { defineComponent, computed, onMounted, onBeforeUnmount, ref, openBlock, createElementBlock } from 'vue';
|
|
9
|
+
var x = ["src"],
|
|
10
|
+
b = /* @__PURE__ */defineComponent({
|
|
11
|
+
__name: "low-code-iframe",
|
|
12
|
+
props: {
|
|
13
|
+
app: {},
|
|
14
|
+
query: {},
|
|
15
|
+
iframeLoading: {
|
|
16
|
+
type: Boolean
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
emits: ["emit-change", "update:iframeLoading"],
|
|
20
|
+
setup: function setup(n, _ref) {
|
|
21
|
+
var c = _ref.expose,
|
|
22
|
+
s = _ref.emit;
|
|
23
|
+
var a = n,
|
|
24
|
+
r = computed(function () {
|
|
25
|
+
if (!a.app) return;
|
|
26
|
+
var e = "";
|
|
27
|
+
var o = "";
|
|
28
|
+
var t = a.query || {};
|
|
29
|
+
return a.app && (t.app = a.app), e = "".concat(o, "/api/node-low-code/v1/visitor/views/index?").concat(new URLSearchParams(t).toString()), e;
|
|
30
|
+
}),
|
|
31
|
+
l = s,
|
|
32
|
+
d = computed({
|
|
33
|
+
get: function get() {
|
|
34
|
+
return a.iframeLoading;
|
|
35
|
+
},
|
|
36
|
+
set: function set(e) {
|
|
37
|
+
return l("update:iframeLoading", e);
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
p = function p(e) {
|
|
41
|
+
var _ref2 = e.data || {},
|
|
42
|
+
_ref2$emitName = _ref2.emitName,
|
|
43
|
+
o = _ref2$emitName === void 0 ? "" : _ref2$emitName,
|
|
44
|
+
_ref2$emitData = _ref2.emitData,
|
|
45
|
+
t = _ref2$emitData === void 0 ? {} : _ref2$emitData;
|
|
46
|
+
o === "app-mounted" ? d.value = false : l("emit-change", o, t);
|
|
47
|
+
};
|
|
48
|
+
onMounted(function () {
|
|
49
|
+
window.addEventListener("message", p, false);
|
|
50
|
+
}), onBeforeUnmount(function () {
|
|
51
|
+
window.removeEventListener("message", p, false);
|
|
52
|
+
});
|
|
53
|
+
var i = ref(null),
|
|
54
|
+
m = function m(e) {
|
|
55
|
+
var o;
|
|
56
|
+
d.value || (o = i.value) != null && o.contentWindow && i.value.contentWindow.postMessage(e);
|
|
57
|
+
};
|
|
58
|
+
c({
|
|
59
|
+
onActivated: function onActivated() {
|
|
60
|
+
m({
|
|
61
|
+
type: "onActivated"
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
onDeactivated: function onDeactivated() {
|
|
65
|
+
m({
|
|
66
|
+
type: "onDeactivated"
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
var w = function w() {
|
|
71
|
+
var o, t, f;
|
|
72
|
+
var _URL = new URL(r.value || "", location.origin),
|
|
73
|
+
e = _URL.origin;
|
|
74
|
+
e && ((f = (t = (o = i.value) == null ? undefined : o.contentWindow) == null ? undefined : t.postMessage) == null || f.call(t, {
|
|
75
|
+
type: "setProxSsoStatus",
|
|
76
|
+
data: {
|
|
77
|
+
visible: true,
|
|
78
|
+
parentHref: location.href
|
|
79
|
+
}
|
|
80
|
+
}, e));
|
|
81
|
+
};
|
|
82
|
+
return function (e, o) {
|
|
83
|
+
return openBlock(), createElementBlock("iframe", {
|
|
84
|
+
"class": "low-code-iframe",
|
|
85
|
+
id: "low-code-iframe",
|
|
86
|
+
src: r.value,
|
|
87
|
+
frameborder: "0",
|
|
88
|
+
sandbox: "allow-same-origin allow-scripts allow-forms allow-modals allow-popups allow-downloads allow-top-navigation",
|
|
89
|
+
ref_key: "lowCodeRef",
|
|
90
|
+
ref: i,
|
|
91
|
+
onLoad: w
|
|
92
|
+
}, null, 40, x);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}),
|
|
96
|
+
C = function C(n, c) {
|
|
97
|
+
var s = n.__vccOpts || n;
|
|
98
|
+
var _iterator = _createForOfIteratorHelper(c),
|
|
99
|
+
_step;
|
|
100
|
+
try {
|
|
101
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
102
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
|
103
|
+
a = _step$value[0],
|
|
104
|
+
r = _step$value[1];
|
|
105
|
+
s[a] = r;
|
|
106
|
+
}
|
|
107
|
+
} catch (err) {
|
|
108
|
+
_iterator.e(err);
|
|
109
|
+
} finally {
|
|
110
|
+
_iterator.f();
|
|
111
|
+
}
|
|
112
|
+
return s;
|
|
113
|
+
},
|
|
114
|
+
B = /* @__PURE__ */C(b, [["__scopeId", "data-v-c5870bec"]]);
|
|
115
|
+
export { B as LowCode };
|
package/use-low-code/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as v, computed as u, onMounted as g, onBeforeUnmount as _, ref as L,
|
|
1
|
+
import { defineComponent as v, computed as u, onMounted as g, onBeforeUnmount as _, ref as L, openBlock as y, createElementBlock as h } from "vue";
|
|
2
2
|
const x = ["src"], b = /* @__PURE__ */ v({
|
|
3
3
|
__name: "low-code-iframe",
|
|
4
4
|
props: {
|
|
@@ -47,7 +47,7 @@ const x = ["src"], b = /* @__PURE__ */ v({
|
|
|
47
47
|
e
|
|
48
48
|
));
|
|
49
49
|
};
|
|
50
|
-
return (e, o) => (
|
|
50
|
+
return (e, o) => (y(), h("iframe", {
|
|
51
51
|
class: "low-code-iframe",
|
|
52
52
|
id: "low-code-iframe",
|
|
53
53
|
src: r.value,
|
package/use-low-code/index.js.gz
CHANGED
|
Binary file
|
package/vue/es5.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useModelValue } from '@das-fed/upf-utils/vue/hooks/use-model-value';
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
6
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
7
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
9
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
import { getConfig } from '@das-fed/upf-utils/config';
|
|
11
|
+
import { getToken } from '@das-fed/upf-utils/common-info';
|
|
12
|
+
import { objectToUrlparams } from '@das-fed/upf-utils/common-tools';
|
|
13
|
+
var c = getConfig(),
|
|
14
|
+
h = function h() {
|
|
15
|
+
var s = "";
|
|
16
|
+
return c.baseURL ? s = c.baseURL : s = location.origin, s.replace("https://", "wss://").replace("http://", "ws://") || "";
|
|
17
|
+
},
|
|
18
|
+
w = function w(s) {
|
|
19
|
+
var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
20
|
+
var e = objectToUrlparams(t);
|
|
21
|
+
return e ? h() + s + "?".concat(e) : h() + s;
|
|
22
|
+
},
|
|
23
|
+
p = function p(s, t) {
|
|
24
|
+
return Math.floor(Math.random() * (t - s + 1)) + s;
|
|
25
|
+
};
|
|
26
|
+
var R = /*#__PURE__*/function () {
|
|
27
|
+
function R(_ref) {
|
|
28
|
+
var t = _ref.url,
|
|
29
|
+
_ref$params = _ref.params,
|
|
30
|
+
e = _ref$params === void 0 ? {} : _ref$params,
|
|
31
|
+
r = _ref.opened,
|
|
32
|
+
n = _ref.close,
|
|
33
|
+
i = _ref.error,
|
|
34
|
+
o = _ref.message,
|
|
35
|
+
a = _ref.ifReconnect,
|
|
36
|
+
l = _ref.reconnectNum,
|
|
37
|
+
u = _ref.reconnectWhenClose;
|
|
38
|
+
_classCallCheck(this, R);
|
|
39
|
+
if (this.$ws = null, this.url = "", this.params = {}, this.lockReturn = false, this.startTime = 0, this.heartbeatInterval = null, this.ifReconnect = true, this.reconnectId = null, this.reconnectNum = 3, this.reconnectWhenClose = false, this.currentReconnectNum = 0, this.$ws = null, this.startTime = 0, this.heartbeatInterval = null, this.ifReconnect = a !== null && a !== void 0 ? a : true, this.reconnectNum = l !== null && l !== void 0 ? l : 3, this.reconnectWhenClose = u !== null && u !== void 0 ? u : false, this.lockReturn = false, this.currentReconnectNum = 0, this.reconnectId = null, this.params = _objectSpread(_objectSpread({}, e), {}, {
|
|
40
|
+
access_token: getToken()
|
|
41
|
+
}), t) this.url = t;else throw new Error("url is required");
|
|
42
|
+
r && (this.opened = r), n && (this.close = n), i && (this.error = i), o && (this.afterMsg = o), this.initWebSocket();
|
|
43
|
+
}
|
|
44
|
+
return _createClass(R, [{
|
|
45
|
+
key: "initWebSocket",
|
|
46
|
+
value: function initWebSocket() {
|
|
47
|
+
var _this = this;
|
|
48
|
+
if ((typeof WebSocket === "undefined" ? "undefined" : _typeof(WebSocket)) > "u") throw new Error("您的浏览器不支持websocket");
|
|
49
|
+
var t = w(this.url, this.params);
|
|
50
|
+
this.$ws = new WebSocket(t), this.$ws.onopen = function () {
|
|
51
|
+
_this.open();
|
|
52
|
+
}, this.$ws.onclose = function (e) {
|
|
53
|
+
_this.close(e);
|
|
54
|
+
}, this.$ws.onmessage = function (e) {
|
|
55
|
+
_this.message(e);
|
|
56
|
+
}, this.$ws.onerror = function (e) {
|
|
57
|
+
_this.error(e);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "open",
|
|
62
|
+
value: function open() {
|
|
63
|
+
this.currentReconnectNum = 0, this.startTime = (/* @__PURE__ */new Date()).getTime(), this.opened(this.$ws), this.startHeartbeat();
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "opened",
|
|
67
|
+
value: function opened(t) {}
|
|
68
|
+
}, {
|
|
69
|
+
key: "close",
|
|
70
|
+
value: function close(t) {
|
|
71
|
+
this.$ws.readyState === WebSocket.CLOSED && ((/* @__PURE__ */new Date()).getTime(), this.reconnectWhenClose && this.reconnect(), clearInterval(this.heartbeatInterval));
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "message",
|
|
75
|
+
value: function message(t) {
|
|
76
|
+
var e = _typeof(t.data) == "object" ? t.data : JSON.parse(t.data);
|
|
77
|
+
this.afterMsg(e);
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
key: "afterMsg",
|
|
81
|
+
value: function afterMsg(t) {}
|
|
82
|
+
}, {
|
|
83
|
+
key: "error",
|
|
84
|
+
value: function error(t) {
|
|
85
|
+
return this.ifReconnect && this.reconnect(), t;
|
|
86
|
+
}
|
|
87
|
+
/** websocket重连 */
|
|
88
|
+
}, {
|
|
89
|
+
key: "reconnect",
|
|
90
|
+
value: function reconnect() {
|
|
91
|
+
var _this2 = this;
|
|
92
|
+
this.lockReturn || (this.lockReturn = true, this.currentReconnectNum++, !(this.currentReconnectNum > this.reconnectNum) && (this.reconnectId && clearTimeout(this.reconnectId), this.reconnectId = setTimeout(function () {
|
|
93
|
+
_this2.initWebSocket(), _this2.lockReturn = false;
|
|
94
|
+
}, 3e3)));
|
|
95
|
+
}
|
|
96
|
+
/** 发送消息给服务器 */
|
|
97
|
+
}, {
|
|
98
|
+
key: "send",
|
|
99
|
+
value: function send(t) {
|
|
100
|
+
var e;
|
|
101
|
+
((e = this.$ws) == null ? undefined : e.readyState) === WebSocket.OPEN && this.$ws.send(t);
|
|
102
|
+
}
|
|
103
|
+
// 启动心跳检测==>30s-5分钟内随机发一次心跳保持会话(时间区间内随机是为了降低突增流量的概率)
|
|
104
|
+
}, {
|
|
105
|
+
key: "startHeartbeat",
|
|
106
|
+
value: function startHeartbeat() {
|
|
107
|
+
var _this3 = this;
|
|
108
|
+
this.heartbeatInterval = setInterval(function () {
|
|
109
|
+
_this3.send("");
|
|
110
|
+
}, p(3e4, 3e5));
|
|
111
|
+
}
|
|
112
|
+
/** 断开连接 */
|
|
113
|
+
}, {
|
|
114
|
+
key: "disconnect",
|
|
115
|
+
value: function disconnect() {
|
|
116
|
+
this.$ws.close();
|
|
117
|
+
}
|
|
118
|
+
}]);
|
|
119
|
+
}();
|
|
120
|
+
export { R as socketService };
|