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.
Files changed (199) hide show
  1. package/README.md +5 -5
  2. package/dist/Throne/index.js +30 -14
  3. package/dist/Throne/index.js.map +1 -1
  4. package/dist/_commonjsHelpers-DWwsNxpa.js +9 -0
  5. package/dist/_commonjsHelpers-DWwsNxpa.js.map +1 -0
  6. package/dist/components/Button/index.js +40 -33
  7. package/dist/components/Button/index.js.map +1 -1
  8. package/dist/components/Flex/index.js +122 -89
  9. package/dist/components/Flex/index.js.map +1 -1
  10. package/dist/components/Form/Form.js +2 -2
  11. package/dist/components/Form/Form.js.map +1 -1
  12. package/dist/components/Form/LovInput/LovInput.js +2 -2
  13. package/dist/components/Form/LovInput/LovInput.js.map +1 -1
  14. package/dist/components/Form/LovInput/hooks/useLov.js +5 -5
  15. package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -1
  16. package/dist/components/Form/LovInput/index.js +4 -4
  17. package/dist/components/Form/hooks/FormItemValidateTrigger.js +2 -2
  18. package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -1
  19. package/dist/components/Form/hooks/index.js +128 -66
  20. package/dist/components/Form/hooks/index.js.map +1 -1
  21. package/dist/components/Form/index.js +836 -656
  22. package/dist/components/Form/index.js.map +1 -1
  23. package/dist/components/Form/utils/index.js +30 -18
  24. package/dist/components/Form/utils/index.js.map +1 -1
  25. package/dist/components/LovTable/index.js +179 -105
  26. package/dist/components/LovTable/index.js.map +1 -1
  27. package/dist/components/Modal/index.js +111 -56
  28. package/dist/components/Modal/index.js.map +1 -1
  29. package/dist/components/Modal/types.js +4 -3
  30. package/dist/components/Modal/types.js.map +1 -1
  31. package/dist/components/Modal/useModal.js +5 -5
  32. package/dist/components/Modal/useModal.js.map +1 -1
  33. package/dist/components/Pagetable/hooks/useColumns.js +88 -80
  34. package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
  35. package/dist/components/Pagetable/index.js +687 -542
  36. package/dist/components/Pagetable/index.js.map +1 -1
  37. package/dist/components/Pagetable/utils/index.js +92 -54
  38. package/dist/components/Pagetable/utils/index.js.map +1 -1
  39. package/dist/components/Querytable/hooks/useColumns.js +82 -74
  40. package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
  41. package/dist/components/Querytable/index.js +579 -469
  42. package/dist/components/Querytable/index.js.map +1 -1
  43. package/dist/components/Querytable/utils/index.js +92 -54
  44. package/dist/components/Querytable/utils/index.js.map +1 -1
  45. package/dist/components/RichTextEditor/index.js +100 -74
  46. package/dist/components/RichTextEditor/index.js.map +1 -1
  47. package/dist/components/Tabs/constants.js +2 -2
  48. package/dist/components/Tabs/constants.js.map +1 -1
  49. package/dist/components/Tabs/index.js +603 -358
  50. package/dist/components/Tabs/index.js.map +1 -1
  51. package/dist/components/Tabs/tab-bar.js +6 -6
  52. package/dist/components/Tabs/tab-bar.js.map +1 -1
  53. package/dist/components/Tabs/tab-pane.js +3 -3
  54. package/dist/components/Tabs/tab-pane.js.map +1 -1
  55. package/dist/components/_constants/aria.js +2 -2
  56. package/dist/components/_constants/aria.js.map +1 -1
  57. package/dist/components/_constants/event.js +6 -4
  58. package/dist/components/_constants/event.js.map +1 -1
  59. package/dist/components/_constants/index.js +6 -6
  60. package/dist/components/_hooks/index.js +7 -7
  61. package/dist/components/_hooks/use-namespace/index.js +74 -39
  62. package/dist/components/_hooks/use-namespace/index.js.map +1 -1
  63. package/dist/components/_hooks/use-ordered-children/index.js +29 -19
  64. package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
  65. package/dist/components/_util/arrays.js +9 -5
  66. package/dist/components/_util/arrays.js.map +1 -1
  67. package/dist/components/_util/browser.js +6 -6
  68. package/dist/components/_util/browser.js.map +1 -1
  69. package/dist/components/_util/classNames.js +22 -17
  70. package/dist/components/_util/classNames.js.map +1 -1
  71. package/dist/components/_util/dom/aria.js +74 -39
  72. package/dist/components/_util/dom/aria.js.map +1 -1
  73. package/dist/components/_util/dom/element.js +9 -8
  74. package/dist/components/_util/dom/element.js.map +1 -1
  75. package/dist/components/_util/dom/event.js +14 -7
  76. package/dist/components/_util/dom/event.js.map +1 -1
  77. package/dist/components/_util/dom/index.js +36 -36
  78. package/dist/components/_util/dom/position.js +49 -25
  79. package/dist/components/_util/dom/position.js.map +1 -1
  80. package/dist/components/_util/dom/scroll.js +103 -61
  81. package/dist/components/_util/dom/scroll.js.map +1 -1
  82. package/dist/components/_util/dom/style.js +65 -50
  83. package/dist/components/_util/dom/style.js.map +1 -1
  84. package/dist/components/_util/easings.js +8 -4
  85. package/dist/components/_util/easings.js.map +1 -1
  86. package/dist/components/_util/error.js +12 -11
  87. package/dist/components/_util/error.js.map +1 -1
  88. package/dist/components/_util/functions.js +3 -3
  89. package/dist/components/_util/i18n.js +2 -2
  90. package/dist/components/_util/i18n.js.map +1 -1
  91. package/dist/components/_util/index.js +137 -137
  92. package/dist/components/_util/isValid.js +4 -2
  93. package/dist/components/_util/isValid.js.map +1 -1
  94. package/dist/components/_util/objects.js +18 -14
  95. package/dist/components/_util/objects.js.map +1 -1
  96. package/dist/components/_util/props-util/index.js +46 -20
  97. package/dist/components/_util/props-util/index.js.map +1 -1
  98. package/dist/components/_util/props-util/initDefaultProps.js +18 -10
  99. package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
  100. package/dist/components/_util/raf.js +5 -4
  101. package/dist/components/_util/raf.js.map +1 -1
  102. package/dist/components/_util/rand.js +4 -3
  103. package/dist/components/_util/rand.js.map +1 -1
  104. package/dist/components/_util/strings.js +9 -8
  105. package/dist/components/_util/strings.js.map +1 -1
  106. package/dist/components/_util/throttleByRaf.js +16 -10
  107. package/dist/components/_util/throttleByRaf.js.map +1 -1
  108. package/dist/components/_util/type.js +41 -38
  109. package/dist/components/_util/type.js.map +1 -1
  110. package/dist/components/_util/types.js +41 -22
  111. package/dist/components/_util/types.js.map +1 -1
  112. package/dist/components/_util/typescript.js +2 -2
  113. package/dist/components/_util/typescript.js.map +1 -1
  114. package/dist/components/_util/util.js +85 -43
  115. package/dist/components/_util/util.js.map +1 -1
  116. package/dist/components/_util/vue/global-node.js +27 -15
  117. package/dist/components/_util/vue/global-node.js.map +1 -1
  118. package/dist/components/_util/vue/icon.js +29 -25
  119. package/dist/components/_util/vue/icon.js.map +1 -1
  120. package/dist/components/_util/vue/index.js +41 -41
  121. package/dist/components/_util/vue/install.js +35 -18
  122. package/dist/components/_util/vue/install.js.map +1 -1
  123. package/dist/components/_util/vue/props/index.js +6 -6
  124. package/dist/components/_util/vue/props/runtime.js +46 -30
  125. package/dist/components/_util/vue/props/runtime.js.map +1 -1
  126. package/dist/components/_util/vue/refs.js +12 -6
  127. package/dist/components/_util/vue/refs.js.map +1 -1
  128. package/dist/components/_util/vue/size.js +5 -3
  129. package/dist/components/_util/vue/size.js.map +1 -1
  130. package/dist/components/_util/vue/validator.js +5 -4
  131. package/dist/components/_util/vue/validator.js.map +1 -1
  132. package/dist/components/_util/vue/vnode.js +100 -54
  133. package/dist/components/_util/vue/vnode.js.map +1 -1
  134. package/dist/components/_util/vue-types/index.js +231 -220
  135. package/dist/components/_util/vue-types/index.js.map +1 -1
  136. package/dist/components/components.js +20 -20
  137. package/dist/components/index.js +38 -35
  138. package/dist/components/index.js.map +1 -1
  139. package/dist/components-B3d9m_tn.js +27 -0
  140. package/dist/components-B3d9m_tn.js.map +1 -0
  141. package/dist/error/OrionError.js +8 -4
  142. package/dist/error/OrionError.js.map +1 -1
  143. package/dist/functions-BeMkokbY.js +63 -0
  144. package/dist/functions-BeMkokbY.js.map +1 -0
  145. package/dist/index-BOKLZnqH.js +54 -0
  146. package/dist/index-BOKLZnqH.js.map +1 -0
  147. package/dist/index-D1m0KTpK.js +69 -0
  148. package/dist/index-D1m0KTpK.js.map +1 -0
  149. package/dist/index-DR5ZP7mD.js +160 -0
  150. package/dist/index-DR5ZP7mD.js.map +1 -0
  151. package/dist/index-DkwIULcN.js +200 -0
  152. package/dist/index-DkwIULcN.js.map +1 -0
  153. package/dist/index.css +797 -1
  154. package/dist/index.js +36 -36
  155. package/dist/print/LodopFuncs.js +101 -43
  156. package/dist/print/LodopFuncs.js.map +1 -1
  157. package/dist/print/index.js +200 -108
  158. package/dist/print/index.js.map +1 -1
  159. package/dist/request/ErrorHandlerChain.js +17 -14
  160. package/dist/request/ErrorHandlerChain.js.map +1 -1
  161. package/dist/request/RequestFilterChain.js +16 -13
  162. package/dist/request/RequestFilterChain.js.map +1 -1
  163. package/dist/request/ResponseParserChain.js +17 -14
  164. package/dist/request/ResponseParserChain.js.map +1 -1
  165. package/dist/request/disivion/DateSerializer.js +47 -22
  166. package/dist/request/disivion/DateSerializer.js.map +1 -1
  167. package/dist/request/disivion/DivisionErrorHandler.js +40 -25
  168. package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
  169. package/dist/request/disivion/DivisionResponseParser.js +16 -10
  170. package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
  171. package/dist/request/disivion/index.js +305 -201
  172. package/dist/request/disivion/index.js.map +1 -1
  173. package/dist/request/error/BizExceptionResponseError.js +11 -5
  174. package/dist/request/error/BizExceptionResponseError.js.map +1 -1
  175. package/dist/request/error/ExceptionResponseError.js +11 -5
  176. package/dist/request/error/ExceptionResponseError.js.map +1 -1
  177. package/dist/request/error/ResponseError.js +9 -4
  178. package/dist/request/error/ResponseError.js.map +1 -1
  179. package/dist/request/error/SessionExceptionResponseError.js +11 -5
  180. package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
  181. package/dist/request/index.js +11 -11
  182. package/dist/utils/DateUtil.js +48 -33
  183. package/dist/utils/DateUtil.js.map +1 -1
  184. package/dist/utils/NumberUtil.js +6 -6
  185. package/dist/utils/NumberUtil.js.map +1 -1
  186. package/dist/utils/cloneDeep.js +2 -2
  187. package/dist/utils/delay.js +3 -3
  188. package/dist/utils/delay.js.map +1 -1
  189. package/dist/utils/functions.js +3 -3
  190. package/dist/utils/index.js +12 -12
  191. package/dist/utils/md5.js +191 -93
  192. package/dist/utils/md5.js.map +1 -1
  193. package/dist/utils/uuid.js +35 -25
  194. package/dist/utils/uuid.js.map +1 -1
  195. package/dist/version/index.js +2 -2
  196. package/dist/version/version.d.ts +1 -1
  197. package/dist/version/version.js +2 -2
  198. package/dist/version/version.js.map +1 -1
  199. package/package.json +1 -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":["DateSerializer","format","__publicField","data","objTransfer","result","key","value","dayjs","arrayTransfer"],"mappings":";;;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IACpBA,KAAS,MAAM,QAAQA,CAAK,MAChCJ,EAAAG,CAAG,IAAIG,EAAcF,CAAK;AAAA,IACjC,CACD;AAAA,EACH;AACF;"}
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,MAAqB,eAAe;AAAA,EAGlC,YAAY,SAAS,2BAA2B;AAFxC;AAGN,SAAK,SAAS;AAAA,EAChB;AAAA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,KAAK,GAAG;AAChE,aAAA,GAAG,IAAI,YAAY,KAAK;AAAA,MACpB,WAAA,SAAS,MAAM,QAAQ,KAAK,GAAG;AACnC,aAAA,GAAG,IAAI,cAAc,KAAK;AAAA,MACjC;AAAA,IAAA,CACD;AAAA,EACH;AACF;"}
@@ -1,37 +1,52 @@
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);
1
+ import ResponseError from "../error/ResponseError.js";
2
+ import ExceptionResponseError from "../error/ExceptionResponseError.js";
3
+ import BizExceptionResponseError from "../error/BizExceptionResponseError.js";
4
+ import SessionExceptionResponseError from "../error/SessionExceptionResponseError.js";
5
+ function readBlob(blob) {
6
+ return new Promise((resolve) => {
7
+ const reader = new FileReader();
8
+ reader.addEventListener("loadend", () => {
9
+ resolve(reader.result);
10
+ });
11
+ reader.readAsText(blob);
11
12
  });
12
13
  }
13
- class R {
14
+ class DivisionErrorHandler {
14
15
  constructor() {
15
16
  }
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);
17
+ async handle(error, chain) {
18
+ if (error instanceof ResponseError) {
19
+ const response = error.response;
20
+ if (response.status == 200) {
21
+ const rawData = response.data;
22
+ let jsonData;
23
+ if (rawData instanceof Blob) {
24
+ jsonData = await readBlob(rawData);
25
+ jsonData = JSON.parse(jsonData);
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
+ }
25
40
  } else {
26
- let o = "'" + t.config.url + "' " + t.status + " " + t.statusText;
27
- throw new i(o, s, t, null);
41
+ let errortext = "'" + response.config.url + "' " + response.status + " " + response.statusText;
42
+ throw new ExceptionResponseError(errortext, error, response, null);
28
43
  }
29
44
  }
30
- throw s;
45
+ throw error;
31
46
  }
32
47
  }
33
48
  export {
34
- R as default,
35
- w as readBlob
49
+ DivisionErrorHandler as default,
50
+ readBlob
36
51
  };
37
52
  //# 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":["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
+ {"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,SAAS,SAAS,MAA6B;AAC7C,SAAA,IAAI,QAAQ,CAAC,YAAY;AACxB,UAAA,SAAS,IAAI;AACZ,WAAA,iBAAiB,WAAW,MAAM;AACvC,cAAQ,OAAO,MAAgB;AAAA,IAAA,CAChC;AACD,WAAO,WAAW,IAAI;AAAA,EAAA,CACvB;AACH;AAEA,MAAqB,qBAAqB;AAAA,EACxC,cAAc;AAAA,EAAC;AAAA,EAEf,MAAM,OAAO,OAAc,OAA0B;AACnD,QAAI,iBAAiB,eAAe;AAClC,YAAM,WAAW,MAAM;AACnB,UAAA,SAAS,UAAU,KAAK;AAC1B,cAAM,UAAU,SAAS;AACrB,YAAA;AAEJ,YAAI,mBAAmB,MAAM;AAEhB,qBAAA,MAAM,SAAS,OAAO;AACtB,qBAAA,KAAK,MAAM,QAAQ;AACnB,qBAAA,KAAK,MAAM,QAAQ;AAAA,QAAA,OACzB;AAEM,qBAAA;AAAA,QACb;AAEA,cAAM,EAAE,SAAS,WAAW,MAAM,cAAc;AAChD,YAAI,cAAc,MAAM;AACtB,gBAAM,IAAI,uBAAuB,WAAW,OAAO,UAAU,QAAQ;AAAA,QAAA,WAC5D,cAAc,MAAM;AAC7B,gBAAM,IAAI,0BAA0B,WAAW,OAAO,UAAU,QAAQ;AAAA,QAAA,WAC/D,cAAc,MAAM;AAC7B,gBAAM,IAAI,8BAA8B,WAAW,OAAO,UAAU,QAAQ;AAAA,QAAA,OACvE;AACL,gBAAM,IAAI,uBAAuB,WAAW,OAAO,UAAU,QAAQ;AAAA,QACvE;AAAA,MAAA,OACK;AACD,YAAA,YAAY,MAAM,SAAS,OAAO,MAAM,OAAO,SAAS,SAAS,MAAM,SAAS;AACpF,cAAM,IAAI,uBAAuB,WAAW,OAAO,UAAU,IAAI;AAAA,MACnE;AAAA,IACF;AAEM,UAAA;AAAA,EACR;AACF;"}
@@ -1,15 +1,21 @@
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);
1
+ class DivisionResponseParser {
2
+ parse(response, chain) {
3
+ const contentType = response.headers["content-type"];
4
+ if (!contentType) {
5
+ return chain.doParse(response, chain);
6
+ }
7
+ if (contentType.indexOf("application/json") === -1) {
8
+ return chain.doParse(response, chain);
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
+ }
10
16
  }
11
17
  }
12
18
  export {
13
- n as default
19
+ DivisionResponseParser as default
14
20
  };
15
21
  //# 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":["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;"}
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,MAAqB,uBAAuB;AAAA,EAC1C,MAAM,UAAyB,OAA4B;AAEnD,UAAA,cAAc,SAAS,QAAQ,cAAc;AACnD,QAAI,CAAC,aAAa;AACT,aAAA,MAAM,QAAQ,UAAU,KAAK;AAAA,IACtC;AAGA,QAAI,YAAY,QAAQ,kBAAkB,MAAM,IAAI;AAC3C,aAAA,MAAM,QAAQ,UAAU,KAAK;AAAA,IACtC;AAGA,UAAM,EAAE,SAAS,WAAW,MAAM,cAAc,OAAO,SAAS,SAAS,WAAW,KAAK,MAAM,SAAS,IAAI,IAAI,SAAS;AACzH,QAAI,YAAY,MAAM;AACb,aAAA,MAAM,QAAQ,MAAM,KAAK;AAAA,IAAA,OAC3B;AACC,YAAA,IAAI,MAAM,SAAS;AAAA,IAC3B;AAAA,EACF;AACF;"}