orion-design 0.1.31 → 0.1.32
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 +14 -30
- package/dist/Throne/index.js.map +1 -1
- package/dist/components/Button/index.js +33 -40
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Flex/index.js +89 -122
- 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 +68 -127
- package/dist/components/Form/hooks/index.js.map +1 -1
- package/dist/components/Form/index.js +656 -836
- package/dist/components/Form/index.js.map +1 -1
- package/dist/components/Form/utils/index.js +18 -30
- package/dist/components/Form/utils/index.js.map +1 -1
- package/dist/components/LovTable/LovPagetable.vue.d.ts +492 -0
- package/dist/components/LovTable/index.d.ts +246 -0
- package/dist/components/LovTable/index.js +106 -179
- package/dist/components/LovTable/index.js.map +1 -1
- package/dist/components/Modal/index.js +56 -111
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/types.d.ts +1 -1
- package/dist/components/Modal/types.js +3 -4
- 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/Pagetable.d.ts +92 -1
- package/dist/components/Pagetable/columns/PagetableColumnButtongroup.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnDate.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnLink.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnMultiselect.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnNumber.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnSingleselect.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnString.d.ts +13 -0
- package/dist/components/Pagetable/hooks/useColumns.js +85 -88
- package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
- package/dist/components/Pagetable/index.d.ts +155 -0
- package/dist/components/Pagetable/index.js +596 -683
- package/dist/components/Pagetable/index.js.map +1 -1
- package/dist/components/Pagetable/utils/index.js +54 -92
- package/dist/components/Pagetable/utils/index.js.map +1 -1
- package/dist/components/Querytable/hooks/useColumns.js +74 -82
- package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
- package/dist/components/Querytable/index.js +469 -579
- package/dist/components/Querytable/index.js.map +1 -1
- package/dist/components/Querytable/utils/index.js +54 -92
- package/dist/components/Querytable/utils/index.js.map +1 -1
- package/dist/components/RichTextEditor/index.js +74 -100
- 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 +358 -603
- 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 +4 -6
- 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 +39 -74
- package/dist/components/_hooks/use-namespace/index.js.map +1 -1
- package/dist/components/_hooks/use-ordered-children/index.js +19 -29
- package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
- package/dist/components/_util/arrays.js +5 -9
- 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 +17 -22
- package/dist/components/_util/classNames.js.map +1 -1
- package/dist/components/_util/dom/aria.js +39 -74
- package/dist/components/_util/dom/aria.js.map +1 -1
- package/dist/components/_util/dom/element.js +8 -9
- package/dist/components/_util/dom/element.js.map +1 -1
- package/dist/components/_util/dom/event.js +7 -14
- 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 +25 -49
- package/dist/components/_util/dom/position.js.map +1 -1
- package/dist/components/_util/dom/scroll.js +61 -103
- package/dist/components/_util/dom/scroll.js.map +1 -1
- package/dist/components/_util/dom/style.js +50 -65
- package/dist/components/_util/dom/style.js.map +1 -1
- package/dist/components/_util/easings.js +4 -8
- package/dist/components/_util/easings.js.map +1 -1
- package/dist/components/_util/error.js +11 -12
- 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 +2 -4
- package/dist/components/_util/isValid.js.map +1 -1
- package/dist/components/_util/objects.js +14 -18
- package/dist/components/_util/objects.js.map +1 -1
- package/dist/components/_util/props-util/index.js +20 -46
- package/dist/components/_util/props-util/index.js.map +1 -1
- package/dist/components/_util/props-util/initDefaultProps.js +10 -18
- package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
- package/dist/components/_util/raf.js +4 -5
- package/dist/components/_util/raf.js.map +1 -1
- package/dist/components/_util/rand.js +3 -4
- package/dist/components/_util/rand.js.map +1 -1
- package/dist/components/_util/strings.js +8 -9
- package/dist/components/_util/strings.js.map +1 -1
- package/dist/components/_util/throttleByRaf.js +10 -16
- package/dist/components/_util/throttleByRaf.js.map +1 -1
- package/dist/components/_util/type.js +38 -41
- package/dist/components/_util/type.js.map +1 -1
- package/dist/components/_util/types.js +22 -41
- 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 +43 -85
- package/dist/components/_util/util.js.map +1 -1
- package/dist/components/_util/vue/global-node.js +15 -27
- package/dist/components/_util/vue/global-node.js.map +1 -1
- package/dist/components/_util/vue/icon.js +25 -29
- 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 +18 -35
- 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 +30 -46
- package/dist/components/_util/vue/props/runtime.js.map +1 -1
- package/dist/components/_util/vue/refs.js +6 -12
- package/dist/components/_util/vue/refs.js.map +1 -1
- package/dist/components/_util/vue/size.js +3 -5
- package/dist/components/_util/vue/size.js.map +1 -1
- package/dist/components/_util/vue/validator.js +4 -5
- package/dist/components/_util/vue/validator.js.map +1 -1
- package/dist/components/_util/vue/vnode.js +54 -100
- package/dist/components/_util/vue/vnode.js.map +1 -1
- package/dist/components/_util/vue-types/index.js +220 -231
- package/dist/components/_util/vue-types/index.js.map +1 -1
- package/dist/components/components.js +20 -20
- package/dist/components/index.js +35 -38
- package/dist/components/index.js.map +1 -1
- package/dist/error/OrionError.js +4 -8
- package/dist/error/OrionError.js.map +1 -1
- package/dist/index.css +1 -797
- package/dist/index.js +36 -36
- package/dist/print/LodopFuncs.js +43 -101
- package/dist/print/LodopFuncs.js.map +1 -1
- package/dist/print/index.js +108 -200
- package/dist/print/index.js.map +1 -1
- package/dist/request/ErrorHandlerChain.js +14 -17
- package/dist/request/ErrorHandlerChain.js.map +1 -1
- package/dist/request/RequestFilterChain.js +13 -16
- package/dist/request/RequestFilterChain.js.map +1 -1
- package/dist/request/ResponseParserChain.js +14 -17
- package/dist/request/ResponseParserChain.js.map +1 -1
- package/dist/request/disivion/DateSerializer.js +22 -47
- package/dist/request/disivion/DateSerializer.js.map +1 -1
- package/dist/request/disivion/DivisionErrorHandler.js +25 -40
- package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
- package/dist/request/disivion/DivisionResponseParser.js +10 -16
- package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
- package/dist/request/disivion/index.js +201 -305
- package/dist/request/disivion/index.js.map +1 -1
- package/dist/request/error/BizExceptionResponseError.js +5 -11
- package/dist/request/error/BizExceptionResponseError.js.map +1 -1
- package/dist/request/error/ExceptionResponseError.js +5 -11
- package/dist/request/error/ExceptionResponseError.js.map +1 -1
- package/dist/request/error/ResponseError.js +4 -9
- package/dist/request/error/ResponseError.js.map +1 -1
- package/dist/request/error/SessionExceptionResponseError.js +5 -11
- package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
- package/dist/request/index.js +11 -11
- package/dist/utils/DateUtil.js +33 -48
- 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 +93 -191
- package/dist/utils/md5.js.map +1 -1
- package/dist/utils/uuid.js +25 -35
- 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
- package/dist/_commonjsHelpers-DWwsNxpa.js +0 -9
- package/dist/_commonjsHelpers-DWwsNxpa.js.map +0 -1
- package/dist/components-B3d9m_tn.js +0 -27
- package/dist/components-B3d9m_tn.js.map +0 -1
- package/dist/functions-BeMkokbY.js +0 -63
- package/dist/functions-BeMkokbY.js.map +0 -1
- package/dist/index-BOKLZnqH.js +0 -54
- package/dist/index-BOKLZnqH.js.map +0 -1
- package/dist/index-D1m0KTpK.js +0 -69
- package/dist/index-D1m0KTpK.js.map +0 -1
- package/dist/index-DR5ZP7mD.js +0 -160
- package/dist/index-DR5ZP7mD.js.map +0 -1
- package/dist/index-DkwIULcN.js +0 -200
- package/dist/index-DkwIULcN.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DateSerializer.js","sources":["../../../src/request/disivion/DateSerializer.ts"],"sourcesContent":["import dayjs from 'dayjs'\r\n\r\nexport default class DateSerializer {\r\n private format: string \r\n\r\n constructor(format = 'YYYY-MM-DD HH:mm:ss.SSS') {\r\n this.format = format\r\n }\r\n\r\n serialize(data: Record<string, unknown>) {\r\n const format = this.format\r\n\r\n function objTransfer(data: any): Record<any, unknown> {\r\n const result: Record<any, unknown> = {}\r\n Object.keys(data).forEach((key) => {\r\n const value = data[key]\r\n if (value instanceof Date || dayjs.isDayjs(value)) {\r\n result[key] = dayjs(value).format(format)\r\n } else if (value && value instanceof Object && !Array.isArray(value)) {\r\n result[key] = objTransfer(value)\r\n } else if (value && Array.isArray(value)) {\r\n result[key] = arrayTransfer(value)\r\n } else {\r\n result[key] = value\r\n }\r\n })\r\n return result\r\n }\r\n function arrayTransfer(data: Array<unknown>): Array<unknown> {\r\n return data.map((value) => {\r\n if (value instanceof Date || dayjs.isDayjs(value)) {\r\n return dayjs(value).format(format)\r\n } else if (value && value instanceof Object && !Array.isArray(value)) {\r\n return objTransfer(value)\r\n } else if (value && Array.isArray(value)) {\r\n return arrayTransfer(value)\r\n } else {\r\n return value\r\n }\r\n })\r\n }\r\n\r\n Object.keys(data).forEach((key) => {\r\n const value = data[key]\r\n if (value instanceof Date || dayjs.isDayjs(value)) {\r\n data[key] = dayjs(value).format(this.format)\r\n } else if (value && typeof value == 'object' && !Array.isArray(value)) {\r\n data[key] = objTransfer(value)\r\n } else if (value && Array.isArray(value)) {\r\n data[key] = arrayTransfer(value)\r\n }\r\n })\r\n }\r\n}\r\n"],"names":["data"],"mappings":";;;;AAEA,
|
1
|
+
{"version":3,"file":"DateSerializer.js","sources":["../../../src/request/disivion/DateSerializer.ts"],"sourcesContent":["import dayjs from 'dayjs'\r\n\r\nexport default class DateSerializer {\r\n private format: string \r\n\r\n constructor(format = 'YYYY-MM-DD HH:mm:ss.SSS') {\r\n this.format = format\r\n }\r\n\r\n serialize(data: Record<string, unknown>) {\r\n const format = this.format\r\n\r\n function objTransfer(data: any): Record<any, unknown> {\r\n const result: Record<any, unknown> = {}\r\n Object.keys(data).forEach((key) => {\r\n const value = data[key]\r\n if (value instanceof Date || dayjs.isDayjs(value)) {\r\n result[key] = dayjs(value).format(format)\r\n } else if (value && value instanceof Object && !Array.isArray(value)) {\r\n result[key] = objTransfer(value)\r\n } else if (value && Array.isArray(value)) {\r\n result[key] = arrayTransfer(value)\r\n } else {\r\n result[key] = value\r\n }\r\n })\r\n return result\r\n }\r\n function arrayTransfer(data: Array<unknown>): Array<unknown> {\r\n return data.map((value) => {\r\n if (value instanceof Date || dayjs.isDayjs(value)) {\r\n return dayjs(value).format(format)\r\n } else if (value && value instanceof Object && !Array.isArray(value)) {\r\n return objTransfer(value)\r\n } else if (value && Array.isArray(value)) {\r\n return arrayTransfer(value)\r\n } else {\r\n return value\r\n }\r\n })\r\n }\r\n\r\n Object.keys(data).forEach((key) => {\r\n const value = data[key]\r\n if (value instanceof Date || dayjs.isDayjs(value)) {\r\n data[key] = dayjs(value).format(this.format)\r\n } else if (value && typeof value == 'object' && !Array.isArray(value)) {\r\n data[key] = objTransfer(value)\r\n } else if (value && Array.isArray(value)) {\r\n data[key] = arrayTransfer(value)\r\n }\r\n })\r\n }\r\n}\r\n"],"names":["DateSerializer","format","__publicField","data","objTransfer","result","key","value","dayjs","arrayTransfer"],"mappings":";;;;AAEA,MAAqBA,EAAe;AAAA,EAGlC,YAAYC,IAAS,2BAA2B;AAFxC,IAAAC,EAAA;AAGN,SAAK,SAASD;AAAA,EAChB;AAAA,EAEA,UAAUE,GAA+B;AACvC,UAAMF,IAAS,KAAK;AAEpB,aAASG,EAAYD,GAAiC;AACpD,YAAME,IAA+B,CAAA;AACrC,oBAAO,KAAKF,CAAI,EAAE,QAAQ,CAACG,MAAQ;AAC3B,cAAAC,IAAQJ,EAAKG,CAAG;AACtB,QAAIC,aAAiB,QAAQC,EAAM,QAAQD,CAAK,IAC9CF,EAAOC,CAAG,IAAIE,EAAMD,CAAK,EAAE,OAAON,CAAM,IAC/BM,KAASA,aAAiB,UAAU,CAAC,MAAM,QAAQA,CAAK,IAC1DF,EAAAC,CAAG,IAAIF,EAAYG,CAAK,IACtBA,KAAS,MAAM,QAAQA,CAAK,IAC9BF,EAAAC,CAAG,IAAIG,EAAcF,CAAK,IAEjCF,EAAOC,CAAG,IAAIC;AAAA,MAChB,CACD,GACMF;AAAA,IACT;AACA,aAASI,EAAcN,GAAsC;AACpDA,aAAAA,EAAK,IAAI,CAACI,MACXA,aAAiB,QAAQC,EAAM,QAAQD,CAAK,IACvCC,EAAMD,CAAK,EAAE,OAAON,CAAM,IACxBM,KAASA,aAAiB,UAAU,CAAC,MAAM,QAAQA,CAAK,IAC1DH,EAAYG,CAAK,IACfA,KAAS,MAAM,QAAQA,CAAK,IAC9BE,EAAcF,CAAK,IAEnBA,CAEV;AAAA,IACH;AAEA,WAAO,KAAKJ,CAAI,EAAE,QAAQ,CAACG,MAAQ;AAC3B,YAAAC,IAAQJ,EAAKG,CAAG;AACtB,MAAIC,aAAiB,QAAQC,EAAM,QAAQD,CAAK,IAC9CJ,EAAKG,CAAG,IAAIE,EAAMD,CAAK,EAAE,OAAO,KAAK,MAAM,IAClCA,KAAS,OAAOA,KAAS,YAAY,CAAC,MAAM,QAAQA,CAAK,IAC7DJ,EAAAG,CAAG,IAAIF,EAAYG,CAAK,IACpBA,KAAS,MAAM,QAAQA,CAAK,MAChCJ,EAAAG,CAAG,IAAIG,EAAcF,CAAK;AAAA,IACjC,CACD;AAAA,EACH;AACF;"}
|
@@ -1,52 +1,37 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
function
|
6
|
-
return new Promise((
|
7
|
-
const
|
8
|
-
|
9
|
-
|
10
|
-
});
|
11
|
-
reader.readAsText(blob);
|
1
|
+
import l from "../error/ResponseError.js";
|
2
|
+
import i from "../error/ExceptionResponseError.js";
|
3
|
+
import p from "../error/BizExceptionResponseError.js";
|
4
|
+
import f from "../error/SessionExceptionResponseError.js";
|
5
|
+
function w(c) {
|
6
|
+
return new Promise((s) => {
|
7
|
+
const n = new FileReader();
|
8
|
+
n.addEventListener("loadend", () => {
|
9
|
+
s(n.result);
|
10
|
+
}), n.readAsText(c);
|
12
11
|
});
|
13
12
|
}
|
14
|
-
class
|
13
|
+
class R {
|
15
14
|
constructor() {
|
16
15
|
}
|
17
|
-
async handle(
|
18
|
-
if (
|
19
|
-
const
|
20
|
-
if (
|
21
|
-
const
|
22
|
-
let
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
jsonData = JSON.parse(jsonData);
|
27
|
-
} else {
|
28
|
-
jsonData = rawData;
|
29
|
-
}
|
30
|
-
const { success, errorcode, data, errortext } = jsonData;
|
31
|
-
if (errorcode === "-1") {
|
32
|
-
throw new ExceptionResponseError(errortext, error, response, jsonData);
|
33
|
-
} else if (errorcode === "-2") {
|
34
|
-
throw new BizExceptionResponseError(errortext, error, response, jsonData);
|
35
|
-
} else if (errorcode === "-3") {
|
36
|
-
throw new SessionExceptionResponseError(errortext, error, response, jsonData);
|
37
|
-
} else {
|
38
|
-
throw new ExceptionResponseError(errortext, error, response, jsonData);
|
39
|
-
}
|
16
|
+
async handle(s, n) {
|
17
|
+
if (s instanceof l) {
|
18
|
+
const t = s.response;
|
19
|
+
if (t.status == 200) {
|
20
|
+
const o = t.data;
|
21
|
+
let e;
|
22
|
+
o instanceof Blob ? (e = await w(o), e = JSON.parse(e), e = JSON.parse(e)) : e = o;
|
23
|
+
const { success: d, errorcode: a, data: u, errortext: r } = e;
|
24
|
+
throw a === "-1" ? new i(r, s, t, e) : a === "-2" ? new p(r, s, t, e) : a === "-3" ? new f(r, s, t, e) : new i(r, s, t, e);
|
40
25
|
} else {
|
41
|
-
let
|
42
|
-
throw new
|
26
|
+
let o = "'" + t.config.url + "' " + t.status + " " + t.statusText;
|
27
|
+
throw new i(o, s, t, null);
|
43
28
|
}
|
44
29
|
}
|
45
|
-
throw
|
30
|
+
throw s;
|
46
31
|
}
|
47
32
|
}
|
48
33
|
export {
|
49
|
-
|
50
|
-
readBlob
|
34
|
+
R as default,
|
35
|
+
w as readBlob
|
51
36
|
};
|
52
37
|
//# sourceMappingURL=DivisionErrorHandler.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DivisionErrorHandler.js","sources":["../../../src/request/disivion/DivisionErrorHandler.ts"],"sourcesContent":["// import { Modal } from 'dw-neit-antd'\r\n// import SobekThrone from '../../throne/SobekThrone'\r\n// import SobekMsgBox from '../../msgbox/SobekMsgBox'\r\n\r\nimport type ErrorHandlerChain from '../ErrorHandlerChain'\r\n\r\nimport ResponseError from '../error/ResponseError'\r\nimport ExceptionResponseError from '../error/ExceptionResponseError'\r\nimport BizExceptionResponseError from '../error/BizExceptionResponseError'\r\nimport SessionExceptionResponseError from '../error/SessionExceptionResponseError'\r\n\r\nexport function readBlob(blob: Blob): Promise<string> {\r\n return new Promise((resolve) => {\r\n const reader = new FileReader()\r\n reader.addEventListener('loadend', () => {\r\n resolve(reader.result as string)\r\n })\r\n reader.readAsText(blob)\r\n })\r\n}\r\n\r\nexport default class DivisionErrorHandler {\r\n constructor() {}\r\n\r\n async handle(error: Error, chain: ErrorHandlerChain) {\r\n if (error instanceof ResponseError) {\r\n const response = error.response\r\n if (response.status == 200) {\r\n const rawData = response.data\r\n let jsonData\r\n\r\n if (rawData instanceof Blob) {\r\n // 文件下载抛异常JSON,在Blob里面\r\n jsonData = await readBlob(rawData)\r\n jsonData = JSON.parse(jsonData)\r\n jsonData = JSON.parse(jsonData)\r\n } else {\r\n // 普通请求的异常JSON\r\n jsonData = rawData\r\n }\r\n\r\n const { success, errorcode, data, errortext } = jsonData\r\n if (errorcode === '-1') {\r\n throw new ExceptionResponseError(errortext, error, response, jsonData)\r\n } else if (errorcode === '-2') {\r\n throw new BizExceptionResponseError(errortext, error, response, jsonData)\r\n } else if (errorcode === '-3') {\r\n throw new SessionExceptionResponseError(errortext, error, response, jsonData)\r\n } else {\r\n throw new ExceptionResponseError(errortext, error, response, jsonData)\r\n }\r\n } else {\r\n let errortext = \"'\" + response.config.url + \"' \" + response.status + ' ' + response.statusText\r\n throw new ExceptionResponseError(errortext, error, response, null)\r\n }\r\n }\r\n\r\n throw error\r\n }\r\n}\r\n"],"names":[],"mappings":";;;;AAWO,
|
1
|
+
{"version":3,"file":"DivisionErrorHandler.js","sources":["../../../src/request/disivion/DivisionErrorHandler.ts"],"sourcesContent":["// import { Modal } from 'dw-neit-antd'\r\n// import SobekThrone from '../../throne/SobekThrone'\r\n// import SobekMsgBox from '../../msgbox/SobekMsgBox'\r\n\r\nimport type ErrorHandlerChain from '../ErrorHandlerChain'\r\n\r\nimport ResponseError from '../error/ResponseError'\r\nimport ExceptionResponseError from '../error/ExceptionResponseError'\r\nimport BizExceptionResponseError from '../error/BizExceptionResponseError'\r\nimport SessionExceptionResponseError from '../error/SessionExceptionResponseError'\r\n\r\nexport function readBlob(blob: Blob): Promise<string> {\r\n return new Promise((resolve) => {\r\n const reader = new FileReader()\r\n reader.addEventListener('loadend', () => {\r\n resolve(reader.result as string)\r\n })\r\n reader.readAsText(blob)\r\n })\r\n}\r\n\r\nexport default class DivisionErrorHandler {\r\n constructor() {}\r\n\r\n async handle(error: Error, chain: ErrorHandlerChain) {\r\n if (error instanceof ResponseError) {\r\n const response = error.response\r\n if (response.status == 200) {\r\n const rawData = response.data\r\n let jsonData\r\n\r\n if (rawData instanceof Blob) {\r\n // 文件下载抛异常JSON,在Blob里面\r\n jsonData = await readBlob(rawData)\r\n jsonData = JSON.parse(jsonData)\r\n jsonData = JSON.parse(jsonData)\r\n } else {\r\n // 普通请求的异常JSON\r\n jsonData = rawData\r\n }\r\n\r\n const { success, errorcode, data, errortext } = jsonData\r\n if (errorcode === '-1') {\r\n throw new ExceptionResponseError(errortext, error, response, jsonData)\r\n } else if (errorcode === '-2') {\r\n throw new BizExceptionResponseError(errortext, error, response, jsonData)\r\n } else if (errorcode === '-3') {\r\n throw new SessionExceptionResponseError(errortext, error, response, jsonData)\r\n } else {\r\n throw new ExceptionResponseError(errortext, error, response, jsonData)\r\n }\r\n } else {\r\n let errortext = \"'\" + response.config.url + \"' \" + response.status + ' ' + response.statusText\r\n throw new ExceptionResponseError(errortext, error, response, null)\r\n }\r\n }\r\n\r\n throw error\r\n }\r\n}\r\n"],"names":["readBlob","blob","resolve","reader","DivisionErrorHandler","error","chain","ResponseError","response","rawData","jsonData","success","errorcode","data","errortext","ExceptionResponseError","BizExceptionResponseError","SessionExceptionResponseError"],"mappings":";;;;AAWO,SAASA,EAASC,GAA6B;AAC7C,SAAA,IAAI,QAAQ,CAACC,MAAY;AACxB,UAAAC,IAAS,IAAI;AACZ,IAAAA,EAAA,iBAAiB,WAAW,MAAM;AACvC,MAAAD,EAAQC,EAAO,MAAgB;AAAA,IAAA,CAChC,GACDA,EAAO,WAAWF,CAAI;AAAA,EAAA,CACvB;AACH;AAEA,MAAqBG,EAAqB;AAAA,EACxC,cAAc;AAAA,EAAC;AAAA,EAEf,MAAM,OAAOC,GAAcC,GAA0B;AACnD,QAAID,aAAiBE,GAAe;AAClC,YAAMC,IAAWH,EAAM;AACnB,UAAAG,EAAS,UAAU,KAAK;AAC1B,cAAMC,IAAUD,EAAS;AACrB,YAAAE;AAEJ,QAAID,aAAmB,QAEVC,IAAA,MAAMV,EAASS,CAAO,GACtBC,IAAA,KAAK,MAAMA,CAAQ,GACnBA,IAAA,KAAK,MAAMA,CAAQ,KAGnBA,IAAAD;AAGb,cAAM,EAAE,SAAAE,GAAS,WAAAC,GAAW,MAAAC,GAAM,WAAAC,MAAcJ;AAChD,cAAIE,MAAc,OACV,IAAIG,EAAuBD,GAAWT,GAAOG,GAAUE,CAAQ,IAC5DE,MAAc,OACjB,IAAII,EAA0BF,GAAWT,GAAOG,GAAUE,CAAQ,IAC/DE,MAAc,OACjB,IAAIK,EAA8BH,GAAWT,GAAOG,GAAUE,CAAQ,IAEtE,IAAIK,EAAuBD,GAAWT,GAAOG,GAAUE,CAAQ;AAAA,MACvE,OACK;AACD,YAAAI,IAAY,MAAMN,EAAS,OAAO,MAAM,OAAOA,EAAS,SAAS,MAAMA,EAAS;AACpF,cAAM,IAAIO,EAAuBD,GAAWT,GAAOG,GAAU,IAAI;AAAA,MACnE;AAAA,IACF;AAEM,UAAAH;AAAA,EACR;AACF;"}
|
@@ -1,21 +1,15 @@
|
|
1
|
-
class
|
2
|
-
parse(
|
3
|
-
const
|
4
|
-
if (!
|
5
|
-
return
|
6
|
-
}
|
7
|
-
if (
|
8
|
-
return
|
9
|
-
|
10
|
-
const { success, errorcode, data, errortext } = typeof response.data === "string" ? JSON.parse(response.data) : response.data;
|
11
|
-
if (success === true) {
|
12
|
-
return chain.doParse(data, chain);
|
13
|
-
} else {
|
14
|
-
throw new Error(errortext);
|
15
|
-
}
|
1
|
+
class n {
|
2
|
+
parse(t, r) {
|
3
|
+
const e = t.headers["content-type"];
|
4
|
+
if (!e || e.indexOf("application/json") === -1)
|
5
|
+
return r.doParse(t, r);
|
6
|
+
const { success: a, errorcode: f, data: o, errortext: d } = typeof t.data == "string" ? JSON.parse(t.data) : t.data;
|
7
|
+
if (a === !0)
|
8
|
+
return r.doParse(o, r);
|
9
|
+
throw new Error(d);
|
16
10
|
}
|
17
11
|
}
|
18
12
|
export {
|
19
|
-
|
13
|
+
n as default
|
20
14
|
};
|
21
15
|
//# sourceMappingURL=DivisionResponseParser.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DivisionResponseParser.js","sources":["../../../src/request/disivion/DivisionResponseParser.ts"],"sourcesContent":["import type { AxiosResponse } from 'axios'\r\nimport type ResponseParserChain from '../ResponseParserChain'\r\n\r\nexport default class DivisionResponseParser {\r\n parse(response: AxiosResponse, chain: ResponseParserChain) {\r\n // server 端不响应内容\r\n const contentType = response.headers['content-type']\r\n if (!contentType) {\r\n return chain.doParse(response, chain)\r\n }\r\n\r\n // server 端响应的不是 application/json 协议\r\n if (contentType.indexOf('application/json') === -1) {\r\n return chain.doParse(response, chain)\r\n }\r\n\r\n // data为string时,兼容ie\r\n const { success, errorcode, data, errortext } = typeof response.data === 'string' ? JSON.parse(response.data) : response.data\r\n if (success === true) {\r\n return chain.doParse(data, chain)\r\n } else {\r\n throw new Error(errortext)\r\n }\r\n }\r\n}\r\n"],"names":[],"mappings":"AAGA,
|
1
|
+
{"version":3,"file":"DivisionResponseParser.js","sources":["../../../src/request/disivion/DivisionResponseParser.ts"],"sourcesContent":["import type { AxiosResponse } from 'axios'\r\nimport type ResponseParserChain from '../ResponseParserChain'\r\n\r\nexport default class DivisionResponseParser {\r\n parse(response: AxiosResponse, chain: ResponseParserChain) {\r\n // server 端不响应内容\r\n const contentType = response.headers['content-type']\r\n if (!contentType) {\r\n return chain.doParse(response, chain)\r\n }\r\n\r\n // server 端响应的不是 application/json 协议\r\n if (contentType.indexOf('application/json') === -1) {\r\n return chain.doParse(response, chain)\r\n }\r\n\r\n // data为string时,兼容ie\r\n const { success, errorcode, data, errortext } = typeof response.data === 'string' ? JSON.parse(response.data) : response.data\r\n if (success === true) {\r\n return chain.doParse(data, chain)\r\n } else {\r\n throw new Error(errortext)\r\n }\r\n }\r\n}\r\n"],"names":["DivisionResponseParser","response","chain","contentType","success","errorcode","data","errortext"],"mappings":"AAGA,MAAqBA,EAAuB;AAAA,EAC1C,MAAMC,GAAyBC,GAA4B;AAEnD,UAAAC,IAAcF,EAAS,QAAQ,cAAc;AAMnD,QALI,CAACE,KAKDA,EAAY,QAAQ,kBAAkB,MAAM;AACvC,aAAAD,EAAM,QAAQD,GAAUC,CAAK;AAItC,UAAM,EAAE,SAAAE,GAAS,WAAAC,GAAW,MAAAC,GAAM,WAAAC,MAAc,OAAON,EAAS,QAAS,WAAW,KAAK,MAAMA,EAAS,IAAI,IAAIA,EAAS;AACzH,QAAIG,MAAY;AACP,aAAAF,EAAM,QAAQI,GAAMJ,CAAK;AAE1B,UAAA,IAAI,MAAMK,CAAS;AAAA,EAE7B;AACF;"}
|