orion-design 0.1.30 → 0.1.31
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +5 -5
- package/dist/Throne/index.js +30 -14
- package/dist/Throne/index.js.map +1 -1
- package/dist/_commonjsHelpers-DWwsNxpa.js +9 -0
- package/dist/_commonjsHelpers-DWwsNxpa.js.map +1 -0
- package/dist/components/Button/index.js +40 -33
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Flex/index.js +122 -89
- package/dist/components/Flex/index.js.map +1 -1
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Form/LovInput/LovInput.js +2 -2
- package/dist/components/Form/LovInput/LovInput.js.map +1 -1
- package/dist/components/Form/LovInput/hooks/useLov.js +5 -5
- package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -1
- package/dist/components/Form/LovInput/index.js +4 -4
- package/dist/components/Form/hooks/FormItemValidateTrigger.js +2 -2
- package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -1
- package/dist/components/Form/hooks/index.js +128 -66
- package/dist/components/Form/hooks/index.js.map +1 -1
- package/dist/components/Form/index.js +836 -656
- package/dist/components/Form/index.js.map +1 -1
- package/dist/components/Form/utils/index.js +30 -18
- package/dist/components/Form/utils/index.js.map +1 -1
- package/dist/components/LovTable/index.js +179 -105
- package/dist/components/LovTable/index.js.map +1 -1
- package/dist/components/Modal/index.js +111 -56
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/types.js +4 -3
- package/dist/components/Modal/types.js.map +1 -1
- package/dist/components/Modal/useModal.js +5 -5
- package/dist/components/Modal/useModal.js.map +1 -1
- package/dist/components/Pagetable/hooks/useColumns.js +88 -80
- package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
- package/dist/components/Pagetable/index.js +687 -542
- package/dist/components/Pagetable/index.js.map +1 -1
- package/dist/components/Pagetable/utils/index.js +92 -54
- package/dist/components/Pagetable/utils/index.js.map +1 -1
- package/dist/components/Querytable/hooks/useColumns.js +82 -74
- package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
- package/dist/components/Querytable/index.js +579 -469
- package/dist/components/Querytable/index.js.map +1 -1
- package/dist/components/Querytable/utils/index.js +92 -54
- package/dist/components/Querytable/utils/index.js.map +1 -1
- package/dist/components/RichTextEditor/index.js +100 -74
- package/dist/components/RichTextEditor/index.js.map +1 -1
- package/dist/components/Tabs/constants.js +2 -2
- package/dist/components/Tabs/constants.js.map +1 -1
- package/dist/components/Tabs/index.js +603 -358
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/tab-bar.js +6 -6
- package/dist/components/Tabs/tab-bar.js.map +1 -1
- package/dist/components/Tabs/tab-pane.js +3 -3
- package/dist/components/Tabs/tab-pane.js.map +1 -1
- package/dist/components/_constants/aria.js +2 -2
- package/dist/components/_constants/aria.js.map +1 -1
- package/dist/components/_constants/event.js +6 -4
- package/dist/components/_constants/event.js.map +1 -1
- package/dist/components/_constants/index.js +6 -6
- package/dist/components/_hooks/index.js +7 -7
- package/dist/components/_hooks/use-namespace/index.js +74 -39
- package/dist/components/_hooks/use-namespace/index.js.map +1 -1
- package/dist/components/_hooks/use-ordered-children/index.js +29 -19
- package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
- package/dist/components/_util/arrays.js +9 -5
- package/dist/components/_util/arrays.js.map +1 -1
- package/dist/components/_util/browser.js +6 -6
- package/dist/components/_util/browser.js.map +1 -1
- package/dist/components/_util/classNames.js +22 -17
- package/dist/components/_util/classNames.js.map +1 -1
- package/dist/components/_util/dom/aria.js +74 -39
- package/dist/components/_util/dom/aria.js.map +1 -1
- package/dist/components/_util/dom/element.js +9 -8
- package/dist/components/_util/dom/element.js.map +1 -1
- package/dist/components/_util/dom/event.js +14 -7
- package/dist/components/_util/dom/event.js.map +1 -1
- package/dist/components/_util/dom/index.js +36 -36
- package/dist/components/_util/dom/position.js +49 -25
- package/dist/components/_util/dom/position.js.map +1 -1
- package/dist/components/_util/dom/scroll.js +103 -61
- package/dist/components/_util/dom/scroll.js.map +1 -1
- package/dist/components/_util/dom/style.js +65 -50
- package/dist/components/_util/dom/style.js.map +1 -1
- package/dist/components/_util/easings.js +8 -4
- package/dist/components/_util/easings.js.map +1 -1
- package/dist/components/_util/error.js +12 -11
- package/dist/components/_util/error.js.map +1 -1
- package/dist/components/_util/functions.js +3 -3
- package/dist/components/_util/i18n.js +2 -2
- package/dist/components/_util/i18n.js.map +1 -1
- package/dist/components/_util/index.js +137 -137
- package/dist/components/_util/isValid.js +4 -2
- package/dist/components/_util/isValid.js.map +1 -1
- package/dist/components/_util/objects.js +18 -14
- package/dist/components/_util/objects.js.map +1 -1
- package/dist/components/_util/props-util/index.js +46 -20
- package/dist/components/_util/props-util/index.js.map +1 -1
- package/dist/components/_util/props-util/initDefaultProps.js +18 -10
- package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
- package/dist/components/_util/raf.js +5 -4
- package/dist/components/_util/raf.js.map +1 -1
- package/dist/components/_util/rand.js +4 -3
- package/dist/components/_util/rand.js.map +1 -1
- package/dist/components/_util/strings.js +9 -8
- package/dist/components/_util/strings.js.map +1 -1
- package/dist/components/_util/throttleByRaf.js +16 -10
- package/dist/components/_util/throttleByRaf.js.map +1 -1
- package/dist/components/_util/type.js +41 -38
- package/dist/components/_util/type.js.map +1 -1
- package/dist/components/_util/types.js +41 -22
- package/dist/components/_util/types.js.map +1 -1
- package/dist/components/_util/typescript.js +2 -2
- package/dist/components/_util/typescript.js.map +1 -1
- package/dist/components/_util/util.js +85 -43
- package/dist/components/_util/util.js.map +1 -1
- package/dist/components/_util/vue/global-node.js +27 -15
- package/dist/components/_util/vue/global-node.js.map +1 -1
- package/dist/components/_util/vue/icon.js +29 -25
- package/dist/components/_util/vue/icon.js.map +1 -1
- package/dist/components/_util/vue/index.js +41 -41
- package/dist/components/_util/vue/install.js +35 -18
- package/dist/components/_util/vue/install.js.map +1 -1
- package/dist/components/_util/vue/props/index.js +6 -6
- package/dist/components/_util/vue/props/runtime.js +46 -30
- package/dist/components/_util/vue/props/runtime.js.map +1 -1
- package/dist/components/_util/vue/refs.js +12 -6
- package/dist/components/_util/vue/refs.js.map +1 -1
- package/dist/components/_util/vue/size.js +5 -3
- package/dist/components/_util/vue/size.js.map +1 -1
- package/dist/components/_util/vue/validator.js +5 -4
- package/dist/components/_util/vue/validator.js.map +1 -1
- package/dist/components/_util/vue/vnode.js +100 -54
- package/dist/components/_util/vue/vnode.js.map +1 -1
- package/dist/components/_util/vue-types/index.js +231 -220
- package/dist/components/_util/vue-types/index.js.map +1 -1
- package/dist/components/components.js +20 -20
- package/dist/components/index.js +38 -35
- package/dist/components/index.js.map +1 -1
- package/dist/components-B3d9m_tn.js +27 -0
- package/dist/components-B3d9m_tn.js.map +1 -0
- package/dist/error/OrionError.js +8 -4
- package/dist/error/OrionError.js.map +1 -1
- package/dist/functions-BeMkokbY.js +63 -0
- package/dist/functions-BeMkokbY.js.map +1 -0
- package/dist/index-BOKLZnqH.js +54 -0
- package/dist/index-BOKLZnqH.js.map +1 -0
- package/dist/index-D1m0KTpK.js +69 -0
- package/dist/index-D1m0KTpK.js.map +1 -0
- package/dist/index-DR5ZP7mD.js +160 -0
- package/dist/index-DR5ZP7mD.js.map +1 -0
- package/dist/index-DkwIULcN.js +200 -0
- package/dist/index-DkwIULcN.js.map +1 -0
- package/dist/index.css +797 -1
- package/dist/index.js +36 -36
- package/dist/print/LodopFuncs.js +101 -43
- package/dist/print/LodopFuncs.js.map +1 -1
- package/dist/print/index.js +200 -108
- package/dist/print/index.js.map +1 -1
- package/dist/request/ErrorHandlerChain.js +17 -14
- package/dist/request/ErrorHandlerChain.js.map +1 -1
- package/dist/request/RequestFilterChain.js +16 -13
- package/dist/request/RequestFilterChain.js.map +1 -1
- package/dist/request/ResponseParserChain.js +17 -14
- package/dist/request/ResponseParserChain.js.map +1 -1
- package/dist/request/disivion/DateSerializer.js +47 -22
- package/dist/request/disivion/DateSerializer.js.map +1 -1
- package/dist/request/disivion/DivisionErrorHandler.js +40 -25
- package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
- package/dist/request/disivion/DivisionResponseParser.js +16 -10
- package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
- package/dist/request/disivion/index.js +305 -201
- package/dist/request/disivion/index.js.map +1 -1
- package/dist/request/error/BizExceptionResponseError.js +11 -5
- package/dist/request/error/BizExceptionResponseError.js.map +1 -1
- package/dist/request/error/ExceptionResponseError.js +11 -5
- package/dist/request/error/ExceptionResponseError.js.map +1 -1
- package/dist/request/error/ResponseError.js +9 -4
- package/dist/request/error/ResponseError.js.map +1 -1
- package/dist/request/error/SessionExceptionResponseError.js +11 -5
- package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
- package/dist/request/index.js +11 -11
- package/dist/utils/DateUtil.js +48 -33
- package/dist/utils/DateUtil.js.map +1 -1
- package/dist/utils/NumberUtil.js +6 -6
- package/dist/utils/NumberUtil.js.map +1 -1
- package/dist/utils/cloneDeep.js +2 -2
- package/dist/utils/delay.js +3 -3
- package/dist/utils/delay.js.map +1 -1
- package/dist/utils/functions.js +3 -3
- package/dist/utils/index.js +12 -12
- package/dist/utils/md5.js +191 -93
- package/dist/utils/md5.js.map +1 -1
- package/dist/utils/uuid.js +35 -25
- package/dist/utils/uuid.js.map +1 -1
- package/dist/version/index.js +2 -2
- package/dist/version/version.d.ts +1 -1
- package/dist/version/version.js +2 -2
- package/dist/version/version.js.map +1 -1
- package/package.json +1 -1
@@ -1,250 +1,354 @@
|
|
1
|
-
import
|
2
|
-
import { cloneDeep
|
1
|
+
import axios from "axios";
|
2
|
+
import { cloneDeep } from "lodash-es";
|
3
3
|
import "dayjs";
|
4
4
|
import "../../utils/md5.js";
|
5
5
|
import "decimal.js";
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
10
|
-
import
|
11
|
-
import
|
12
|
-
import { ElLoading
|
13
|
-
import
|
14
|
-
const
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
6
|
+
import ResponseParserChain from "../ResponseParserChain.js";
|
7
|
+
import ErrorHandlerChain from "../ErrorHandlerChain.js";
|
8
|
+
import RequestFilterChain from "../RequestFilterChain.js";
|
9
|
+
import DateSerializer from "./DateSerializer.js";
|
10
|
+
import DivisionResponseParser from "./DivisionResponseParser.js";
|
11
|
+
import DivisionErrorHandler from "./DivisionErrorHandler.js";
|
12
|
+
import { ElLoading } from "element-plus";
|
13
|
+
import ResponseError from "../error/ResponseError.js";
|
14
|
+
const version = "3.7.7";
|
15
|
+
const VERSION = version;
|
16
|
+
const _hasBuffer = typeof Buffer === "function";
|
17
|
+
const _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
|
18
|
+
const _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
|
19
|
+
const b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
20
|
+
const b64chs = Array.prototype.slice.call(b64ch);
|
21
|
+
const b64tab = ((a) => {
|
22
|
+
let tab = {};
|
23
|
+
a.forEach((c, i) => tab[c] = i);
|
24
|
+
return tab;
|
25
|
+
})(b64chs);
|
26
|
+
const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
|
27
|
+
const _fromCC = String.fromCharCode.bind(String);
|
28
|
+
const _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it) => new Uint8Array(Array.prototype.slice.call(it, 0));
|
29
|
+
const _mkUriSafe = (src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_");
|
30
|
+
const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, "");
|
31
|
+
const btoaPolyfill = (bin) => {
|
32
|
+
let u32, c0, c1, c2, asc = "";
|
33
|
+
const pad = bin.length % 3;
|
34
|
+
for (let i = 0; i < bin.length; ) {
|
35
|
+
if ((c0 = bin.charCodeAt(i++)) > 255 || (c1 = bin.charCodeAt(i++)) > 255 || (c2 = bin.charCodeAt(i++)) > 255)
|
22
36
|
throw new TypeError("invalid character found");
|
23
|
-
|
37
|
+
u32 = c0 << 16 | c1 << 8 | c2;
|
38
|
+
asc += b64chs[u32 >> 18 & 63] + b64chs[u32 >> 12 & 63] + b64chs[u32 >> 6 & 63] + b64chs[u32 & 63];
|
24
39
|
}
|
25
|
-
return
|
26
|
-
}
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
40
|
+
return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
|
41
|
+
};
|
42
|
+
const _btoa = typeof btoa === "function" ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
|
43
|
+
const _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
|
44
|
+
const maxargs = 4096;
|
45
|
+
let strs = [];
|
46
|
+
for (let i = 0, l = u8a.length; i < l; i += maxargs) {
|
47
|
+
strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
|
48
|
+
}
|
49
|
+
return _btoa(strs.join(""));
|
50
|
+
};
|
51
|
+
const fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a);
|
52
|
+
const cb_utob = (c) => {
|
53
|
+
if (c.length < 2) {
|
54
|
+
var cc = c.charCodeAt(0);
|
55
|
+
return cc < 128 ? c : cc < 2048 ? _fromCC(192 | cc >>> 6) + _fromCC(128 | cc & 63) : _fromCC(224 | cc >>> 12 & 15) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
|
35
56
|
} else {
|
36
|
-
var
|
37
|
-
return
|
57
|
+
var cc = 65536 + (c.charCodeAt(0) - 55296) * 1024 + (c.charCodeAt(1) - 56320);
|
58
|
+
return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
|
38
59
|
}
|
39
|
-
}
|
40
|
-
|
60
|
+
};
|
61
|
+
const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
|
62
|
+
const utob = (u) => u.replace(re_utob, cb_utob);
|
63
|
+
const _encode = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
|
64
|
+
const encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
|
65
|
+
const encodeURI = (src) => encode(src, true);
|
66
|
+
const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
67
|
+
const cb_btou = (cccc) => {
|
68
|
+
switch (cccc.length) {
|
41
69
|
case 4:
|
42
|
-
var
|
43
|
-
return
|
70
|
+
var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536;
|
71
|
+
return _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320);
|
44
72
|
case 3:
|
45
|
-
return
|
73
|
+
return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2));
|
46
74
|
default:
|
47
|
-
return
|
75
|
+
return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
|
48
76
|
}
|
49
|
-
}
|
50
|
-
|
77
|
+
};
|
78
|
+
const btou = (b) => b.replace(re_btou, cb_btou);
|
79
|
+
const atobPolyfill = (asc) => {
|
80
|
+
asc = asc.replace(/\s+/g, "");
|
81
|
+
if (!b64re.test(asc))
|
51
82
|
throw new TypeError("malformed base64.");
|
52
|
-
|
53
|
-
let
|
54
|
-
for (let
|
55
|
-
|
56
|
-
|
57
|
-
}
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
83
|
+
asc += "==".slice(2 - (asc.length & 3));
|
84
|
+
let u24, bin = "", r1, r2;
|
85
|
+
for (let i = 0; i < asc.length; ) {
|
86
|
+
u24 = b64tab[asc.charAt(i++)] << 18 | b64tab[asc.charAt(i++)] << 12 | (r1 = b64tab[asc.charAt(i++)]) << 6 | (r2 = b64tab[asc.charAt(i++)]);
|
87
|
+
bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
|
88
|
+
}
|
89
|
+
return bin;
|
90
|
+
};
|
91
|
+
const _atob = typeof atob === "function" ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
|
92
|
+
const _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a).split("").map((c) => c.charCodeAt(0)));
|
93
|
+
const toUint8Array = (a) => _toUint8Array(_unURI(a));
|
94
|
+
const _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
|
95
|
+
const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/"));
|
96
|
+
const decode = (src) => _decode(_unURI(src));
|
97
|
+
const isValid = (src) => {
|
98
|
+
if (typeof src !== "string")
|
99
|
+
return false;
|
100
|
+
const s = src.replace(/\s+/g, "").replace(/={0,2}$/, "");
|
101
|
+
return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s);
|
102
|
+
};
|
103
|
+
const _noEnum = (v) => {
|
104
|
+
return {
|
105
|
+
value: v,
|
106
|
+
enumerable: false,
|
107
|
+
writable: true,
|
108
|
+
configurable: true
|
109
|
+
};
|
110
|
+
};
|
111
|
+
const extendString = function() {
|
112
|
+
const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body));
|
113
|
+
_add("fromBase64", function() {
|
114
|
+
return decode(this);
|
115
|
+
});
|
116
|
+
_add("toBase64", function(urlsafe) {
|
117
|
+
return encode(this, urlsafe);
|
118
|
+
});
|
119
|
+
_add("toBase64URI", function() {
|
120
|
+
return encode(this, true);
|
121
|
+
});
|
122
|
+
_add("toBase64URL", function() {
|
123
|
+
return encode(this, true);
|
124
|
+
});
|
125
|
+
_add("toUint8Array", function() {
|
126
|
+
return toUint8Array(this);
|
127
|
+
});
|
128
|
+
};
|
129
|
+
const extendUint8Array = function() {
|
130
|
+
const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body));
|
131
|
+
_add("toBase64", function(urlsafe) {
|
132
|
+
return fromUint8Array(this, urlsafe);
|
133
|
+
});
|
134
|
+
_add("toBase64URI", function() {
|
135
|
+
return fromUint8Array(this, true);
|
79
136
|
});
|
80
|
-
|
81
|
-
|
82
|
-
e("toBase64", function(t) {
|
83
|
-
return b(this, t);
|
84
|
-
}), e("toBase64URI", function() {
|
85
|
-
return b(this, !0);
|
86
|
-
}), e("toBase64URL", function() {
|
87
|
-
return b(this, !0);
|
137
|
+
_add("toBase64URL", function() {
|
138
|
+
return fromUint8Array(this, true);
|
88
139
|
});
|
89
|
-
}, ce = () => {
|
90
|
-
N(), V();
|
91
|
-
}, de = {
|
92
|
-
version: O,
|
93
|
-
VERSION: re,
|
94
|
-
atob: U,
|
95
|
-
atobPolyfill: q,
|
96
|
-
btoa: w,
|
97
|
-
btoaPolyfill: k,
|
98
|
-
fromBase64: A,
|
99
|
-
toBase64: d,
|
100
|
-
encode: d,
|
101
|
-
encodeURI: D,
|
102
|
-
encodeURL: D,
|
103
|
-
utob: L,
|
104
|
-
btou: j,
|
105
|
-
decode: A,
|
106
|
-
isValid: ue,
|
107
|
-
fromUint8Array: b,
|
108
|
-
toUint8Array: z,
|
109
|
-
extendString: N,
|
110
|
-
extendUint8Array: V,
|
111
|
-
extendBuiltins: ce
|
112
140
|
};
|
113
|
-
|
141
|
+
const extendBuiltins = () => {
|
142
|
+
extendString();
|
143
|
+
extendUint8Array();
|
144
|
+
};
|
145
|
+
const gBase64 = {
|
146
|
+
version,
|
147
|
+
VERSION,
|
148
|
+
atob: _atob,
|
149
|
+
atobPolyfill,
|
150
|
+
btoa: _btoa,
|
151
|
+
btoaPolyfill,
|
152
|
+
fromBase64: decode,
|
153
|
+
toBase64: encode,
|
154
|
+
encode,
|
155
|
+
encodeURI,
|
156
|
+
encodeURL: encodeURI,
|
157
|
+
utob,
|
158
|
+
btou,
|
159
|
+
decode,
|
160
|
+
isValid,
|
161
|
+
fromUint8Array,
|
162
|
+
toUint8Array,
|
163
|
+
extendString,
|
164
|
+
extendUint8Array,
|
165
|
+
extendBuiltins
|
166
|
+
};
|
167
|
+
let gRequestHeaders = () => ({});
|
168
|
+
let gResponseParsers = [new DivisionResponseParser()];
|
169
|
+
let gErrorHandlers = [new DivisionErrorHandler()];
|
170
|
+
let gRequestFilters = [
|
114
171
|
{
|
115
|
-
doFilter: (
|
116
|
-
const
|
117
|
-
Object.keys(
|
118
|
-
|
119
|
-
})
|
172
|
+
doFilter: (request2, chain) => {
|
173
|
+
const headers = gRequestHeaders();
|
174
|
+
Object.keys(headers).forEach(function(key) {
|
175
|
+
request2.headers[key] = headers[key];
|
176
|
+
});
|
177
|
+
chain.doFilter(request2, chain);
|
120
178
|
}
|
121
179
|
},
|
122
180
|
{
|
123
|
-
doFilter: (
|
124
|
-
new
|
181
|
+
doFilter: (request2) => {
|
182
|
+
new DateSerializer("YYYYMMDDHHmmss").serialize(request2.data);
|
125
183
|
}
|
126
184
|
}
|
127
|
-
]
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
185
|
+
];
|
186
|
+
let BASE_URL = "/";
|
187
|
+
let REQUEST_TIMEOUT = 1e3 * 30;
|
188
|
+
const g_AxiosInstance = axios.create();
|
189
|
+
g_AxiosInstance.interceptors.request.use(function(config2) {
|
190
|
+
const chain = new RequestFilterChain(gRequestFilters);
|
191
|
+
chain.doFilter(config2, chain);
|
192
|
+
return config2;
|
132
193
|
});
|
133
|
-
|
194
|
+
g_AxiosInstance.interceptors.response.use(function(response) {
|
134
195
|
try {
|
135
|
-
const
|
136
|
-
return
|
137
|
-
} catch (
|
138
|
-
throw new
|
196
|
+
const chain = new ResponseParserChain(gResponseParsers);
|
197
|
+
return chain.doParse(response, chain);
|
198
|
+
} catch (e) {
|
199
|
+
throw new ResponseError(e.message, { cause: e }, response);
|
139
200
|
}
|
140
201
|
});
|
141
|
-
function
|
142
|
-
let
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
202
|
+
function request(url, data = {}, options = { loading: true, mask: false, timeout: REQUEST_TIMEOUT }) {
|
203
|
+
let newData = data;
|
204
|
+
if (!(data instanceof FormData)) {
|
205
|
+
newData = cloneDeep(data);
|
206
|
+
}
|
207
|
+
let loading;
|
208
|
+
if (options.loading === true) {
|
209
|
+
loading = ElLoading.service({ fullscreen: true, background: "transparent" });
|
210
|
+
}
|
211
|
+
return g_AxiosInstance.request({
|
212
|
+
baseURL: BASE_URL,
|
147
213
|
method: "POST",
|
148
|
-
timeout:
|
149
|
-
withCredentials:
|
150
|
-
url
|
151
|
-
data:
|
214
|
+
timeout: REQUEST_TIMEOUT,
|
215
|
+
withCredentials: true,
|
216
|
+
url,
|
217
|
+
data: newData,
|
152
218
|
responseType: "json",
|
153
|
-
...
|
154
|
-
}).then((
|
155
|
-
|
156
|
-
|
157
|
-
|
219
|
+
...options
|
220
|
+
}).then((data2) => {
|
221
|
+
if (loading) {
|
222
|
+
loading.close();
|
223
|
+
}
|
224
|
+
return data2;
|
225
|
+
}).catch(function(error) {
|
226
|
+
if (loading) {
|
227
|
+
loading.close();
|
228
|
+
}
|
229
|
+
const chain = new ErrorHandlerChain(gErrorHandlers);
|
230
|
+
return chain.handle(error, chain);
|
158
231
|
});
|
159
232
|
}
|
160
|
-
function
|
161
|
-
let
|
162
|
-
|
163
|
-
|
233
|
+
function download(url, data = {}, options = { loading: true, mask: false, timeout: REQUEST_TIMEOUT }) {
|
234
|
+
let loading;
|
235
|
+
if (options.loading === true) {
|
236
|
+
loading = ElLoading.service({ fullscreen: true, background: "transparent" });
|
237
|
+
}
|
238
|
+
return g_AxiosInstance.request({
|
239
|
+
baseURL: BASE_URL,
|
164
240
|
method: "POST",
|
165
|
-
timeout:
|
166
|
-
withCredentials:
|
167
|
-
url
|
168
|
-
data
|
241
|
+
timeout: REQUEST_TIMEOUT,
|
242
|
+
withCredentials: true,
|
243
|
+
url,
|
244
|
+
data,
|
169
245
|
responseType: "blob",
|
170
|
-
...
|
171
|
-
}).then((
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
246
|
+
...options
|
247
|
+
}).then((data2) => {
|
248
|
+
if (loading) {
|
249
|
+
loading.close();
|
250
|
+
}
|
251
|
+
return data2;
|
252
|
+
}).then((response) => {
|
253
|
+
const contentDisposition = response.headers["content-disposition"];
|
254
|
+
const blob = response.data;
|
255
|
+
const base64FileName = contentDisposition.match(/attachment; filename=\"(.*?)\"/)[1];
|
256
|
+
const decodedFileName = gBase64.decode(base64FileName);
|
257
|
+
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
|
258
|
+
window.navigator.msSaveOrOpenBlob(blob, decodedFileName);
|
259
|
+
} else {
|
260
|
+
const a = document.createElement("a");
|
261
|
+
const url2 = URL.createObjectURL(blob);
|
262
|
+
a.href = url2;
|
263
|
+
a.download = decodedFileName;
|
264
|
+
document.body.appendChild(a);
|
265
|
+
a.click();
|
266
|
+
document.body.removeChild(a);
|
267
|
+
URL.revokeObjectURL(url2);
|
178
268
|
}
|
179
|
-
}).catch(function(
|
180
|
-
|
181
|
-
|
182
|
-
|
269
|
+
}).catch(function(error) {
|
270
|
+
if (loading) {
|
271
|
+
loading.close();
|
272
|
+
}
|
273
|
+
const chain = new ErrorHandlerChain(gErrorHandlers);
|
274
|
+
return chain.handle(error, chain);
|
183
275
|
});
|
184
276
|
}
|
185
|
-
function
|
186
|
-
const
|
187
|
-
if (
|
188
|
-
const
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
277
|
+
function upload(url, params, options) {
|
278
|
+
const formdata = new FormData();
|
279
|
+
if (params) {
|
280
|
+
const keys = Object.keys(params);
|
281
|
+
const normalParams = {};
|
282
|
+
for (let i = 0; i < keys.length; i++) {
|
283
|
+
const key = keys[i];
|
284
|
+
const itemValue = params[key];
|
285
|
+
if (itemValue instanceof File) {
|
286
|
+
formdata.append(key, itemValue);
|
287
|
+
} else if (itemValue instanceof Array) {
|
288
|
+
let isFile = false;
|
289
|
+
for (let j = 0; j < itemValue.length; j++) {
|
290
|
+
if (itemValue[j] instanceof File) {
|
291
|
+
isFile = true;
|
198
292
|
break;
|
199
293
|
}
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
294
|
+
}
|
295
|
+
if (isFile) {
|
296
|
+
for (let j = 0; j < itemValue.length; j++) {
|
297
|
+
formdata.append(key, itemValue[j]);
|
298
|
+
}
|
299
|
+
} else {
|
300
|
+
normalParams[key] = itemValue;
|
301
|
+
}
|
302
|
+
} else {
|
303
|
+
normalParams[key] = itemValue;
|
304
|
+
}
|
207
305
|
}
|
208
|
-
|
306
|
+
formdata.append("ibayJson", JSON.stringify(normalParams));
|
209
307
|
}
|
210
|
-
return
|
308
|
+
return request(url, formdata, options);
|
211
309
|
}
|
212
|
-
const
|
213
|
-
setBaseUrl: (
|
214
|
-
if (!
|
215
|
-
throw new Error(
|
216
|
-
|
310
|
+
const config = {
|
311
|
+
setBaseUrl: (pBaseUrl) => {
|
312
|
+
if (!pBaseUrl) {
|
313
|
+
throw new Error(`pBaseUrl is null!`);
|
314
|
+
}
|
315
|
+
BASE_URL = pBaseUrl;
|
217
316
|
},
|
218
|
-
setRequestTimeout: (
|
219
|
-
|
317
|
+
setRequestTimeout: (pTimeout) => {
|
318
|
+
REQUEST_TIMEOUT = pTimeout;
|
220
319
|
},
|
221
|
-
setRequestHeaders: (
|
222
|
-
if (!
|
223
|
-
throw new Error(
|
224
|
-
|
225
|
-
|
226
|
-
|
320
|
+
setRequestHeaders: (pRequestHeaders) => {
|
321
|
+
if (!pRequestHeaders) {
|
322
|
+
throw new Error(`pRequestHeaders is null!`);
|
323
|
+
}
|
324
|
+
if (!(pRequestHeaders instanceof Function)) {
|
325
|
+
throw new Error(`pRequestHeaders is not a function!`);
|
326
|
+
}
|
327
|
+
gRequestHeaders = pRequestHeaders;
|
227
328
|
},
|
228
|
-
setRequestFilters: (...
|
229
|
-
if (
|
230
|
-
throw new Error(
|
231
|
-
|
329
|
+
setRequestFilters: (...filters) => {
|
330
|
+
if (filters == null) {
|
331
|
+
throw new Error(`filters is null!`);
|
332
|
+
}
|
333
|
+
gRequestFilters = filters;
|
232
334
|
},
|
233
|
-
setResponseParsers: (...
|
234
|
-
if (
|
235
|
-
throw new Error(
|
236
|
-
|
335
|
+
setResponseParsers: (...parsers) => {
|
336
|
+
if (parsers == null) {
|
337
|
+
throw new Error(`parsers is null!`);
|
338
|
+
}
|
339
|
+
gResponseParsers = parsers;
|
237
340
|
},
|
238
|
-
setErrorHandlers: (...
|
239
|
-
if (
|
240
|
-
throw new Error(
|
241
|
-
|
341
|
+
setErrorHandlers: (...handlers) => {
|
342
|
+
if (handlers == null) {
|
343
|
+
throw new Error(`handlers should not null!`);
|
344
|
+
}
|
345
|
+
gErrorHandlers = handlers;
|
242
346
|
}
|
243
347
|
};
|
244
348
|
export {
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
349
|
+
config,
|
350
|
+
download,
|
351
|
+
request,
|
352
|
+
upload
|
249
353
|
};
|
250
354
|
//# sourceMappingURL=index.js.map
|