orion-design 0.1.4 → 0.1.6

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.
Files changed (350) hide show
  1. package/README.md +5 -0
  2. package/dist/Throne/index.d.ts +18 -0
  3. package/dist/Throne/index.js +20 -0
  4. package/dist/Throne/index.js.map +1 -0
  5. package/dist/_commonjsHelpers-DaMA6jEr.js +9 -0
  6. package/dist/_commonjsHelpers-DaMA6jEr.js.map +1 -0
  7. package/dist/components/Button/Button.vue.d.ts +2 -0
  8. package/dist/components/Button/index.d.ts +2 -0
  9. package/dist/components/Button/index.js +27 -0
  10. package/dist/components/Button/index.js.map +1 -0
  11. package/dist/components/Flex/Col.d.ts +4 -4
  12. package/dist/components/Flex/Item.d.ts +4 -4
  13. package/dist/components/Flex/Row.d.ts +4 -4
  14. package/dist/components/Flex/index.d.ts +4 -4
  15. package/dist/components/Flex/index.js +95 -127
  16. package/dist/components/Flex/index.js.map +1 -0
  17. package/dist/components/Form/ButtonGroup/ButtonGroup.d.ts +5 -0
  18. package/dist/components/Form/ButtonGroup/ButtonGroup.js +2 -0
  19. package/dist/components/Form/ButtonGroup/ButtonGroup.js.map +1 -0
  20. package/dist/components/Form/ButtonGroup/ButtonGroup.vue.d.ts +17 -0
  21. package/dist/components/Form/ButtonGroup/index.d.ts +1 -0
  22. package/dist/components/Form/ButtonGroup/index.js +2 -0
  23. package/dist/components/Form/ButtonGroup/index.js.map +1 -0
  24. package/dist/components/Form/Checkbox/Checkbox.d.ts +10 -0
  25. package/dist/components/Form/Checkbox/Checkbox.js +2 -0
  26. package/dist/components/Form/Checkbox/Checkbox.js.map +1 -0
  27. package/dist/components/Form/Checkbox/Checkbox.vue.d.ts +3 -0
  28. package/dist/components/Form/Checkbox/index.d.ts +1 -0
  29. package/dist/components/Form/Checkbox/index.js +2 -0
  30. package/dist/components/Form/Checkbox/index.js.map +1 -0
  31. package/dist/components/Form/CheckboxGroup/CheckboxGroup.d.ts +14 -0
  32. package/dist/components/Form/CheckboxGroup/CheckboxGroup.js +2 -0
  33. package/dist/components/Form/CheckboxGroup/CheckboxGroup.js.map +1 -0
  34. package/dist/components/Form/CheckboxGroup/CheckboxGroup.vue.d.ts +3 -0
  35. package/dist/components/Form/CheckboxGroup/index.d.ts +1 -0
  36. package/dist/components/Form/CheckboxGroup/index.js +2 -0
  37. package/dist/components/Form/CheckboxGroup/index.js.map +1 -0
  38. package/dist/components/Form/DateInput/DateInput.d.ts +17 -0
  39. package/dist/components/Form/DateInput/DateInput.js +2 -0
  40. package/dist/components/Form/DateInput/DateInput.js.map +1 -0
  41. package/dist/components/Form/DateInput/DateInput.vue.d.ts +3 -0
  42. package/dist/components/Form/DateInput/index.d.ts +1 -0
  43. package/dist/components/Form/DateInput/index.js +2 -0
  44. package/dist/components/Form/DateInput/index.js.map +1 -0
  45. package/dist/components/Form/FileInput/FileInput.d.ts +10 -0
  46. package/dist/components/Form/FileInput/FileInput.js +2 -0
  47. package/dist/components/Form/FileInput/FileInput.js.map +1 -0
  48. package/dist/components/Form/FileInput/FileInput.vue.d.ts +451 -0
  49. package/dist/components/Form/FileInput/index.d.ts +1 -0
  50. package/dist/components/Form/FileInput/index.js +2 -0
  51. package/dist/components/Form/FileInput/index.js.map +1 -0
  52. package/dist/components/Form/Form.d.ts +21 -0
  53. package/dist/components/Form/Form.js +5 -0
  54. package/dist/components/Form/Form.js.map +1 -0
  55. package/dist/components/Form/Form.vue.d.ts +465 -0
  56. package/dist/components/Form/MultiSelect/MultiSelect.d.ts +15 -0
  57. package/dist/components/Form/MultiSelect/MultiSelect.js +2 -0
  58. package/dist/components/Form/MultiSelect/MultiSelect.js.map +1 -0
  59. package/dist/components/Form/MultiSelect/MultiSelect.vue.d.ts +3 -0
  60. package/dist/components/Form/MultiSelect/index.d.ts +1 -0
  61. package/dist/components/Form/MultiSelect/index.js +2 -0
  62. package/dist/components/Form/MultiSelect/index.js.map +1 -0
  63. package/dist/components/Form/PasswordInput/PasswordInput.d.ts +13 -0
  64. package/dist/components/Form/PasswordInput/PasswordInput.js +2 -0
  65. package/dist/components/Form/PasswordInput/PasswordInput.js.map +1 -0
  66. package/dist/components/Form/PasswordInput/PasswordInput.vue.d.ts +3 -0
  67. package/dist/components/Form/PasswordInput/index.d.ts +1 -0
  68. package/dist/components/Form/PasswordInput/index.js +2 -0
  69. package/dist/components/Form/PasswordInput/index.js.map +1 -0
  70. package/dist/components/Form/RadioGroup/RadioGroup.d.ts +14 -0
  71. package/dist/components/Form/RadioGroup/RadioGroup.js +2 -0
  72. package/dist/components/Form/RadioGroup/RadioGroup.js.map +1 -0
  73. package/dist/components/Form/RadioGroup/RadioGroup.vue.d.ts +3 -0
  74. package/dist/components/Form/RadioGroup/index.d.ts +1 -0
  75. package/dist/components/Form/RadioGroup/index.js +2 -0
  76. package/dist/components/Form/RadioGroup/index.js.map +1 -0
  77. package/dist/components/Form/SingleSelect/SingleSelect.d.ts +17 -0
  78. package/dist/components/Form/SingleSelect/SingleSelect.js +2 -0
  79. package/dist/components/Form/SingleSelect/SingleSelect.js.map +1 -0
  80. package/dist/components/Form/SingleSelect/SingleSelect.vue.d.ts +3 -0
  81. package/dist/components/Form/SingleSelect/index.d.ts +1 -0
  82. package/dist/components/Form/SingleSelect/index.js +2 -0
  83. package/dist/components/Form/SingleSelect/index.js.map +1 -0
  84. package/dist/components/Form/StringInput/StringInput.d.ts +13 -0
  85. package/dist/components/Form/StringInput/StringInput.js +2 -0
  86. package/dist/components/Form/StringInput/StringInput.js.map +1 -0
  87. package/dist/components/Form/StringInput/StringInput.vue.d.ts +3 -0
  88. package/dist/components/Form/StringInput/index.d.ts +1 -0
  89. package/dist/components/Form/StringInput/index.js +2 -0
  90. package/dist/components/Form/StringInput/index.js.map +1 -0
  91. package/dist/components/Form/Switch/Switch.d.ts +10 -0
  92. package/dist/components/Form/Switch/Switch.js +2 -0
  93. package/dist/components/Form/Switch/Switch.js.map +1 -0
  94. package/dist/components/Form/Switch/Switch.vue.d.ts +3 -0
  95. package/dist/components/Form/Switch/index.d.ts +1 -0
  96. package/dist/components/Form/Switch/index.js +2 -0
  97. package/dist/components/Form/Switch/index.js.map +1 -0
  98. package/dist/components/Form/Textarea/Textarea.d.ts +14 -0
  99. package/dist/components/Form/Textarea/Textarea.js +2 -0
  100. package/dist/components/Form/Textarea/Textarea.js.map +1 -0
  101. package/dist/components/Form/Textarea/Textarea.vue.d.ts +3 -0
  102. package/dist/components/Form/Textarea/index.d.ts +1 -0
  103. package/dist/components/Form/Textarea/index.js +2 -0
  104. package/dist/components/Form/Textarea/index.js.map +1 -0
  105. package/dist/components/Form/hooks/useForm.d.ts +7 -0
  106. package/dist/components/Form/hooks/useForm.js +44 -0
  107. package/dist/components/Form/hooks/useForm.js.map +1 -0
  108. package/dist/components/Form/index.d.ts +301 -0
  109. package/dist/components/Form/index.js +660 -0
  110. package/dist/components/Form/index.js.map +1 -0
  111. package/dist/components/Form/utils/index.d.ts +8 -0
  112. package/dist/components/Form/utils/index.js +26 -0
  113. package/dist/components/Form/utils/index.js.map +1 -0
  114. package/dist/components/Modal/index.d.ts +1 -14
  115. package/dist/components/Modal/useModal.d.ts +1 -1
  116. package/dist/components/Modal/useModal.js +7 -7
  117. package/dist/components/Modal/useModal.js.map +1 -0
  118. package/dist/components/Pagetable/Pagetable.d.ts +91 -0
  119. package/dist/components/Pagetable/columns/PagetableCellButton.d.ts +24 -0
  120. package/dist/components/Pagetable/columns/PagetableColumnButtongroup.d.ts +78 -0
  121. package/dist/components/Pagetable/columns/PagetableColumnDate.d.ts +101 -0
  122. package/dist/components/Pagetable/columns/PagetableColumnDiy.d.ts +78 -0
  123. package/dist/components/Pagetable/columns/PagetableColumnIndex.d.ts +5 -0
  124. package/dist/components/Pagetable/columns/PagetableColumnMultiselect.d.ts +109 -0
  125. package/dist/components/Pagetable/columns/PagetableColumnNumber.d.ts +114 -0
  126. package/dist/components/Pagetable/columns/PagetableColumnSingleselect.d.ts +109 -0
  127. package/dist/components/Pagetable/columns/PagetableColumnString.d.ts +75 -0
  128. package/dist/components/Pagetable/columns/PagetableColumngroup.d.ts +35 -0
  129. package/dist/components/Pagetable/hooks/useColumns.d.ts +1 -0
  130. package/dist/components/Pagetable/hooks/useColumns.js +96 -0
  131. package/dist/components/Pagetable/hooks/useColumns.js.map +1 -0
  132. package/dist/components/Pagetable/index.d.ts +85 -0
  133. package/dist/components/Pagetable/index.js +521 -0
  134. package/dist/components/Pagetable/index.js.map +1 -0
  135. package/dist/components/Pagetable/interface.d.ts +10 -0
  136. package/dist/components/Pagetable/interface.js +2 -0
  137. package/dist/components/Pagetable/interface.js.map +1 -0
  138. package/dist/components/Pagetable/utils/index.d.ts +15 -0
  139. package/dist/components/Pagetable/utils/index.js +169 -0
  140. package/dist/components/Pagetable/utils/index.js.map +1 -0
  141. package/dist/components/Space/index.d.ts +12 -12
  142. package/dist/components/_util/arrays.d.ts +5 -0
  143. package/dist/components/_util/arrays.js +8 -0
  144. package/dist/components/_util/arrays.js.map +1 -0
  145. package/dist/components/_util/browser.d.ts +3 -0
  146. package/dist/components/_util/browser.js +9 -0
  147. package/dist/components/_util/browser.js.map +1 -0
  148. package/dist/components/_util/classNames.js +20 -27
  149. package/dist/components/_util/classNames.js.map +1 -0
  150. package/dist/components/_util/dom/aria.d.ts +30 -0
  151. package/dist/components/_util/dom/aria.js +46 -0
  152. package/dist/components/_util/dom/aria.js.map +1 -0
  153. package/dist/components/_util/dom/element.d.ts +3 -0
  154. package/dist/components/_util/dom/element.js +18 -0
  155. package/dist/components/_util/dom/element.js.map +1 -0
  156. package/dist/components/_util/dom/event.d.ts +6 -0
  157. package/dist/components/_util/dom/event.js +10 -0
  158. package/dist/components/_util/dom/event.js.map +1 -0
  159. package/dist/components/_util/dom/index.d.ts +6 -0
  160. package/dist/components/_util/dom/index.js +39 -0
  161. package/dist/components/_util/dom/index.js.map +1 -0
  162. package/dist/components/_util/dom/position.d.ts +7 -0
  163. package/dist/components/_util/dom/position.js +30 -0
  164. package/dist/components/_util/dom/position.js.map +1 -0
  165. package/dist/components/_util/dom/scroll.d.ts +11 -0
  166. package/dist/components/_util/dom/scroll.js +78 -0
  167. package/dist/components/_util/dom/scroll.js.map +1 -0
  168. package/dist/components/_util/dom/style.d.ts +9 -0
  169. package/dist/components/_util/dom/style.js +58 -0
  170. package/dist/components/_util/dom/style.js.map +1 -0
  171. package/dist/components/_util/easings.d.ts +1 -0
  172. package/dist/components/_util/easings.js +8 -0
  173. package/dist/components/_util/easings.js.map +1 -0
  174. package/dist/components/_util/error.d.ts +3 -0
  175. package/dist/components/_util/error.js +22 -0
  176. package/dist/components/_util/error.js.map +1 -0
  177. package/dist/components/_util/functions.d.ts +1 -0
  178. package/dist/components/_util/functions.js +6 -0
  179. package/dist/components/_util/functions.js.map +1 -0
  180. package/dist/components/_util/i18n.d.ts +1 -0
  181. package/dist/components/_util/i18n.js +5 -0
  182. package/dist/components/_util/i18n.js.map +1 -0
  183. package/dist/components/_util/index.d.ts +15 -0
  184. package/dist/components/_util/index.js +140 -0
  185. package/dist/components/_util/index.js.map +1 -0
  186. package/dist/components/_util/isValid.js +4 -4
  187. package/dist/components/_util/isValid.js.map +1 -0
  188. package/dist/components/_util/objects.d.ts +8 -0
  189. package/dist/components/_util/objects.js +17 -0
  190. package/dist/components/_util/objects.js.map +1 -0
  191. package/dist/components/_util/props-util/index.d.ts +4 -4
  192. package/dist/components/_util/props-util/index.js +23 -50
  193. package/dist/components/_util/props-util/index.js.map +1 -0
  194. package/dist/components/_util/props-util/initDefaultProps.d.ts +2 -2
  195. package/dist/components/_util/props-util/initDefaultProps.js +13 -24
  196. package/dist/components/_util/props-util/initDefaultProps.js.map +1 -0
  197. package/dist/components/_util/raf.d.ts +2 -0
  198. package/dist/components/_util/raf.js +7 -0
  199. package/dist/components/_util/raf.js.map +1 -0
  200. package/dist/components/_util/rand.d.ts +12 -0
  201. package/dist/components/_util/rand.js +6 -0
  202. package/dist/components/_util/rand.js.map +1 -0
  203. package/dist/components/_util/strings.d.ts +6 -0
  204. package/dist/components/_util/strings.js +11 -0
  205. package/dist/components/_util/strings.js.map +1 -0
  206. package/dist/components/_util/throttleByRaf.d.ts +4 -0
  207. package/dist/components/_util/throttleByRaf.js +16 -0
  208. package/dist/components/_util/throttleByRaf.js.map +1 -0
  209. package/dist/components/_util/type.d.ts +5 -1
  210. package/dist/components/_util/type.js +52 -65
  211. package/dist/components/_util/type.js.map +1 -0
  212. package/dist/components/_util/types.d.ts +10 -0
  213. package/dist/components/_util/types.js +25 -0
  214. package/dist/components/_util/types.js.map +1 -0
  215. package/dist/components/_util/typescript.d.ts +12 -0
  216. package/dist/components/_util/typescript.js +5 -0
  217. package/dist/components/_util/typescript.js.map +1 -0
  218. package/dist/components/_util/util.d.ts +1 -1
  219. package/dist/components/_util/util.js +46 -74
  220. package/dist/components/_util/util.js.map +1 -0
  221. package/dist/components/_util/vue/global-node.d.ts +3 -0
  222. package/dist/components/_util/vue/global-node.js +21 -0
  223. package/dist/components/_util/vue/global-node.js.map +1 -0
  224. package/dist/components/_util/vue/icon.d.ts +23 -0
  225. package/dist/components/_util/vue/icon.js +154 -0
  226. package/dist/components/_util/vue/icon.js.map +1 -0
  227. package/dist/components/_util/vue/index.d.ts +9 -0
  228. package/dist/components/_util/vue/index.js +44 -0
  229. package/dist/components/_util/vue/index.js.map +1 -0
  230. package/dist/components/_util/vue/install.d.ts +6 -0
  231. package/dist/components/_util/vue/install.js +21 -0
  232. package/dist/components/_util/vue/install.js.map +1 -0
  233. package/dist/components/_util/vue/props/index.d.ts +3 -0
  234. package/dist/components/_util/vue/props/index.js +9 -0
  235. package/dist/components/_util/vue/props/index.js.map +1 -0
  236. package/dist/components/_util/vue/props/runtime.d.ts +29 -0
  237. package/dist/components/_util/vue/props/runtime.js +37 -0
  238. package/dist/components/_util/vue/props/runtime.js.map +1 -0
  239. package/dist/components/_util/vue/props/types.d.ts +120 -0
  240. package/dist/components/_util/vue/props/types.js +2 -0
  241. package/dist/components/_util/vue/props/types.js.map +1 -0
  242. package/dist/components/_util/vue/props/util.d.ts +8 -0
  243. package/dist/components/_util/vue/props/util.js +2 -0
  244. package/dist/components/_util/vue/props/util.js.map +1 -0
  245. package/dist/components/_util/vue/refs.d.ts +3 -0
  246. package/dist/components/_util/vue/refs.js +12 -0
  247. package/dist/components/_util/vue/refs.js.map +1 -0
  248. package/dist/components/_util/vue/size.d.ts +2 -0
  249. package/dist/components/_util/vue/size.js +6 -0
  250. package/dist/components/_util/vue/size.js.map +1 -0
  251. package/dist/components/_util/vue/typescript.d.ts +5 -0
  252. package/dist/components/_util/vue/typescript.js +2 -0
  253. package/dist/components/_util/vue/typescript.js.map +1 -0
  254. package/dist/components/_util/vue/validator.d.ts +3 -0
  255. package/dist/components/_util/vue/validator.js +7 -0
  256. package/dist/components/_util/vue/validator.js.map +1 -0
  257. package/dist/components/_util/vue/vnode.d.ts +50 -0
  258. package/dist/components/_util/vue/vnode.js +68 -0
  259. package/dist/components/_util/vue/vnode.js.map +1 -0
  260. package/dist/components/_util/vue-types/index.d.ts +3 -3
  261. package/dist/components/_util/vue-types/index.js +275 -417
  262. package/dist/components/_util/vue-types/index.js.map +1 -0
  263. package/dist/components/components.d.ts +4 -0
  264. package/dist/components/components.js +19 -12
  265. package/dist/components/components.js.map +1 -0
  266. package/dist/components/index.d.ts +1 -1
  267. package/dist/components/index.js +26 -24
  268. package/dist/components/index.js.map +1 -0
  269. package/dist/components-CutWiB7Q.js +68 -0
  270. package/dist/components-CutWiB7Q.js.map +1 -0
  271. package/dist/error/OrionError.js +7 -12
  272. package/dist/error/OrionError.js.map +1 -0
  273. package/dist/functions-DzLqXvGt.js +33 -0
  274. package/dist/functions-DzLqXvGt.js.map +1 -0
  275. package/dist/index-BbsXWo7C.js +44 -0
  276. package/dist/index-BbsXWo7C.js.map +1 -0
  277. package/dist/index-C8JNJPWW.js +8 -0
  278. package/dist/index-C8JNJPWW.js.map +1 -0
  279. package/dist/index.css +1 -44
  280. package/dist/index.d.ts +2 -1
  281. package/dist/index.js +27 -14
  282. package/dist/index.js.map +1 -0
  283. package/dist/print/LodopFuncs.js +48 -111
  284. package/dist/print/LodopFuncs.js.map +1 -0
  285. package/dist/print/index.d.ts +2 -2
  286. package/dist/print/index.js +111 -220
  287. package/dist/print/index.js.map +1 -0
  288. package/dist/request/ErrorHandlerChain.js +17 -15
  289. package/dist/request/ErrorHandlerChain.js.map +1 -0
  290. package/dist/request/RequestFilterChain.d.ts +1 -1
  291. package/dist/request/RequestFilterChain.js +16 -14
  292. package/dist/request/RequestFilterChain.js.map +1 -0
  293. package/dist/request/ResponseParserChain.d.ts +1 -1
  294. package/dist/request/ResponseParserChain.js +17 -15
  295. package/dist/request/ResponseParserChain.js.map +1 -0
  296. package/dist/request/disivion/DateSerializer.js +25 -46
  297. package/dist/request/disivion/DateSerializer.js.map +1 -0
  298. package/dist/request/disivion/DivisionErrorHandler.d.ts +1 -1
  299. package/dist/request/disivion/DivisionErrorHandler.js +30 -52
  300. package/dist/request/disivion/DivisionErrorHandler.js.map +1 -0
  301. package/dist/request/disivion/DivisionResponseParser.d.ts +2 -2
  302. package/dist/request/disivion/DivisionResponseParser.js +13 -25
  303. package/dist/request/disivion/DivisionResponseParser.js.map +1 -0
  304. package/dist/request/disivion/index.d.ts +3 -3
  305. package/dist/request/disivion/index.js +230 -480
  306. package/dist/request/disivion/index.js.map +1 -0
  307. package/dist/request/error/BizExceptionResponseError.d.ts +2 -2
  308. package/dist/request/error/BizExceptionResponseError.js +8 -15
  309. package/dist/request/error/BizExceptionResponseError.js.map +1 -0
  310. package/dist/request/error/ExceptionResponseError.d.ts +2 -2
  311. package/dist/request/error/ExceptionResponseError.js +8 -15
  312. package/dist/request/error/ExceptionResponseError.js.map +1 -0
  313. package/dist/request/error/ResponseError.d.ts +1 -1
  314. package/dist/request/error/ResponseError.js +7 -14
  315. package/dist/request/error/ResponseError.js.map +1 -0
  316. package/dist/request/error/SessionExceptionResponseError.d.ts +2 -2
  317. package/dist/request/error/SessionExceptionResponseError.js +8 -15
  318. package/dist/request/error/SessionExceptionResponseError.js.map +1 -0
  319. package/dist/request/index.js +11 -17
  320. package/dist/request/index.js.map +1 -0
  321. package/dist/style/index.d.ts +0 -3
  322. package/dist/style/index.js +1 -0
  323. package/dist/style/index.js.map +1 -0
  324. package/dist/utils/DateUtil.js +36 -50
  325. package/dist/utils/DateUtil.js.map +1 -0
  326. package/dist/utils/NumberUtil.js +9 -8
  327. package/dist/utils/NumberUtil.js.map +1 -0
  328. package/dist/utils/cloneDeep.js +5 -1
  329. package/dist/utils/cloneDeep.js.map +1 -0
  330. package/dist/utils/delay.js +6 -4
  331. package/dist/utils/delay.js.map +1 -0
  332. package/dist/utils/functions.d.ts +1 -0
  333. package/dist/utils/functions.js +6 -0
  334. package/dist/utils/functions.js.map +1 -0
  335. package/dist/utils/index.js +15 -9
  336. package/dist/utils/index.js.map +1 -0
  337. package/dist/utils/md5.js +120 -245
  338. package/dist/utils/md5.js.map +1 -0
  339. package/dist/utils/uuid.js +28 -58
  340. package/dist/utils/uuid.js.map +1 -0
  341. package/dist/version/index.d.ts +1 -1
  342. package/dist/version/index.js +5 -6
  343. package/dist/version/index.js.map +1 -0
  344. package/dist/version/version.d.ts +1 -1
  345. package/dist/version/version.js +5 -3
  346. package/dist/version/version.js.map +1 -0
  347. package/dist/vite.svg +1 -0
  348. package/global.d.ts +6 -0
  349. package/package.json +53 -63
  350. package/dist/components-BTX5S_6V.js +0 -128
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/print/index.ts"],"sourcesContent":["// @ts-nocheck\r\nimport OrionError from '../error/OrionError'\r\nimport { getLodop } from './LodopFuncs'\r\n\r\nexport function lodopInit() {\r\n // 获取lodop\r\n const LODOP = getLodop()\r\n\r\n return new Promise((resolve) => {\r\n resolve(LODOP)\r\n })\r\n}\r\n\r\n// 获取打印机列表\r\nexport function getPrinterList() {\r\n lodopInit()\r\n const printers = []\r\n const count = LODOP.GET_PRINTER_COUNT()\r\n for (let i = 0; i < count; i++) {\r\n printers.push({\r\n value: i,\r\n content: LODOP.GET_PRINTER_NAME(i),\r\n })\r\n }\r\n\r\n return printers\r\n}\r\n\r\n// 获取打印机名称列表\r\nexport function getPrinterNameList() {\r\n lodopInit()\r\n const printers = []\r\n const count = LODOP.GET_PRINTER_COUNT()\r\n for (let i = 0; i < count; i++) {\r\n const prname = LODOP.GET_PRINTER_NAME(i)\r\n printers.push({\r\n value: prname,\r\n content: prname,\r\n })\r\n }\r\n\r\n return printers\r\n}\r\n\r\n//////////////////////////////////// 接口\r\n\r\n// 获取默认打印机名称\r\nexport async function getDefaultPrinter() {\r\n const LODOP = await lodopInit()\r\n return LODOP.GET_PRINTER_NAME(-1) // 获取默认打印机名称(-1是指定默认打印机)\r\n}\r\n\r\nexport interface PrintParaI {\r\n direction?: 1 | 2 | 3 | 0 // 1纵向;2横向;3纵向,高度自适应;0方向不定\r\n page_width?: number // 纸张宽度,默认为0\r\n page_height?: number // 纸张高度,默认为0\r\n page_type?: string // 纸张类型\r\n print_duplex?: 0 | 1 | 2 | 3 // 双面打印,默认为0 0-不控制 1-不双面 2-双面(长边装订) 3-小册子双面(短边装订_长边水平)\r\n print_defaultsource?: 0 | 1 | 4 | 7 // 双面打印方式,默认为0 1-纸盒 4-手动 7-自动 0-不控制\r\n print_mode_map?: {\r\n // 扩展接口,打印第三方文件时可能需要调优,参数可参考lodop官方文档的LODOP.SET_PRINT_MODE方法\r\n PRINT_PAGE_PERCENT: string // 指定整页缩放打印的比例 格式为Full-Width | Full-Height | Full-Page | “Width:XX%;Height:XX%”\r\n }\r\n}\r\n\r\n// 无打印模板,预览打印\r\nexport async function preview(params: { pdfurl: string; print_para?: PrintParaI }) {\r\n if (!params) {\r\n throw new OrionError('打印异常:入参为空,请检查')\r\n }\r\n\r\n const { pdfurl, print_para = {} } = params\r\n\r\n if (!pdfurl) {\r\n throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印')\r\n }\r\n\r\n const LODOP = await lodopInit()\r\n\r\n //获取传入的打印参数\r\n let page_width = 0\r\n if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {\r\n page_width = print_para.page_width\r\n }\r\n let page_height = 0\r\n if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {\r\n page_height = print_para.page_height\r\n }\r\n let page_type = ''\r\n if (print_para.page_type) {\r\n page_type = print_para.page_type\r\n }\r\n let direction = 1\r\n if (print_para.direction) {\r\n direction = print_para.direction\r\n }\r\n let print_duplex = 0\r\n if (print_para.print_duplex) {\r\n print_duplex = print_para.print_duplex\r\n }\r\n let print_defaultsource = 0\r\n if (print_para.print_defaultsource) {\r\n print_defaultsource = print_para.print_defaultsource\r\n }\r\n\r\n // 历史问题,防止重复打印的问题\r\n LODOP.PRINT_INIT('')\r\n\r\n if (print_para.print_mode_map) {\r\n Object.keys(print_para.print_mode_map).map((item) => {\r\n LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item])\r\n })\r\n }\r\n LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0)\r\n LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0)\r\n LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type)\r\n LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', new URL(pdfurl, import.meta.url))\r\n LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', true) // 移除预览的线条\r\n LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, '预览查看.开始打印') // 适高,工具条,弹出选择打印机,窗口宽,窗口高,窗口名\r\n LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true) //返回打印机状态\r\n\r\n return new Promise((resolve) => {\r\n LODOP.On_Return = function (TaskID, Value) {\r\n resolve(Value)\r\n }\r\n LODOP.PREVIEW()\r\n })\r\n}\r\n\r\nexport async function print(params: { pdfurl: string; print_para?: PrintParaI; printer?: string | -1 }) {\r\n if (!params) {\r\n throw new OrionError('打印异常:入参为空,请检查')\r\n }\r\n\r\n const { pdfurl, print_para = {}, printer } = params\r\n\r\n if (!pdfurl) {\r\n throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印')\r\n }\r\n\r\n if (printer) {\r\n return await printWithCertainPrinter(pdfurl, print_para, printer)\r\n } else {\r\n // 没设置打印机\r\n return await printNeedSelectPrinter(pdfurl, print_para)\r\n }\r\n}\r\n\r\nasync function printWithCertainPrinter(pdfurl: string, print_para: PrintParaI = {}, pr_name: string | -1) {\r\n if (!pdfurl) {\r\n throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印')\r\n }\r\n if (!pr_name) {\r\n throw new OrionError('打印异常:未设置打印机,无法进行打印')\r\n }\r\n\r\n //获取传入的打印参数\r\n let page_width = 0\r\n if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {\r\n page_width = print_para.page_width\r\n }\r\n let page_height = 0\r\n if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {\r\n page_height = print_para.page_height\r\n }\r\n let page_type = ''\r\n if (print_para.page_type) {\r\n page_type = print_para.page_type\r\n }\r\n let direction = 1\r\n if (print_para.direction) {\r\n direction = print_para.direction\r\n }\r\n let print_duplex = 0\r\n if (print_para.print_duplex) {\r\n print_duplex = print_para.print_duplex\r\n }\r\n let print_defaultsource = 0\r\n if (print_para.print_defaultsource) {\r\n print_defaultsource = print_para.print_defaultsource\r\n }\r\n\r\n const LODOP = await lodopInit()\r\n // 指定打印设备(打印机)\r\n LODOP.PRINT_INIT('')\r\n // 设置了打印机\r\n if (pr_name === -1) {\r\n LODOP.SET_PRINTER_INDEXA(LODOP.GET_PRINTER_NAME(-1))\r\n } else {\r\n LODOP.SET_PRINTER_INDEXA(pr_name)\r\n }\r\n LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type)\r\n if (print_para.print_mode_map) {\r\n Object.keys(print_para.print_mode_map).map((item) => {\r\n LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item])\r\n })\r\n }\r\n LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0)\r\n LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0)\r\n LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', new URL(pdfurl, import.meta.url))\r\n LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true) //返回打印机状态\r\n\r\n return new Promise((resolve) => {\r\n LODOP.On_Return = function (TaskID, Value) {\r\n resolve(Value)\r\n }\r\n LODOP.PRINT()\r\n })\r\n}\r\n\r\n// 无打印模板,直接打印,需要选择打印机\r\nexport async function printNeedSelectPrinter(url: string, print_para: PrintParaI = {}) {\r\n if (url === null || url === '' || typeof url === 'undefined') {\r\n throw new OrionError('打印异常:未知的文件地址[' + url + '],无法进行打印')\r\n }\r\n\r\n const LODOP = await lodopInit()\r\n\r\n //获取传入的打印参数\r\n let page_width = 0\r\n if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {\r\n page_width = print_para.page_width\r\n }\r\n let page_height = 0\r\n if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {\r\n page_height = print_para.page_height\r\n }\r\n let page_type = ''\r\n if (print_para.page_type) {\r\n page_type = print_para.page_type\r\n }\r\n let direction = 1\r\n if (print_para.direction) {\r\n direction = print_para.direction\r\n }\r\n let print_duplex = 0\r\n if (print_para.print_duplex) {\r\n print_duplex = print_para.print_duplex\r\n }\r\n let print_defaultsource = 0\r\n if (print_para.print_defaultsource) {\r\n print_defaultsource = print_para.print_defaultsource\r\n }\r\n\r\n // 历史问题,防止重复打印的问题\r\n LODOP.PRINT_INIT('')\r\n\r\n if (print_para.print_mode_map) {\r\n Object.keys(print_para.print_mode_map).map((item) => {\r\n LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item])\r\n })\r\n }\r\n\r\n LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0)\r\n LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0)\r\n LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type)\r\n LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', url)\r\n LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', true) // 移除预览的线条\r\n LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, '预览查看.开始打印') // 适高,工具条,弹出选择打印机,窗口宽,窗口高,窗口名\r\n\r\n //返回打印机状态\r\n LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)\r\n\r\n return new Promise((resolve) => {\r\n LODOP.On_Return = function (TaskID, Value) {\r\n resolve(Value)\r\n }\r\n LODOP.PRINTA()\r\n })\r\n}\r\n"],"names":["lodopInit","LODOP","getLodop","resolve","getPrinterList","printers","count","i","getPrinterNameList","prname","getDefaultPrinter","preview","params","OrionError","pdfurl","print_para","page_width","page_height","page_type","direction","print_duplex","print_defaultsource","item","TaskID","Value","print","printer","printWithCertainPrinter","printNeedSelectPrinter","pr_name","url"],"mappings":"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"}
@@ -1,18 +1,20 @@
1
- class ErrorHandlerChain {
2
- handlers;
3
- index;
4
- constructor(handlers) {
5
- this.handlers = handlers ? handlers : [];
6
- this.index = 0;
1
+ var i = Object.defineProperty;
2
+ var a = (h, n, s) => n in h ? i(h, n, { enumerable: !0, configurable: !0, writable: !0, value: s }) : h[n] = s;
3
+ var t = (h, n, s) => a(h, typeof n != "symbol" ? n + "" : n, s);
4
+ class r {
5
+ constructor(n) {
6
+ t(this, "handlers");
7
+ t(this, "index");
8
+ this.handlers = n || [], this.index = 0;
7
9
  }
8
- async handle(error, chain) {
9
- if (this.index == this.handlers.length) {
10
- throw error;
11
- }
12
- const handler = this.handlers[this.index];
13
- this.index++;
14
- return await handler.handle(error, chain);
10
+ async handle(n, s) {
11
+ if (this.index == this.handlers.length)
12
+ throw n;
13
+ const e = this.handlers[this.index];
14
+ return this.index++, await e.handle(n, s);
15
15
  }
16
16
  }
17
-
18
- export { ErrorHandlerChain as default };
17
+ export {
18
+ r as default
19
+ };
20
+ //# sourceMappingURL=ErrorHandlerChain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorHandlerChain.js","sources":["../../src/request/ErrorHandlerChain.ts"],"sourcesContent":["export interface ErrorHandler<T = Error> {\r\n handle: (error: T, chain: ErrorHandlerChain) => void\r\n}\r\n\r\nexport default class ErrorHandlerChain<T = Error> {\r\n private handlers: Array<ErrorHandler<T>>\r\n private index: number\r\n\r\n constructor(handlers: Array<ErrorHandler<T>>) {\r\n this.handlers = handlers ? handlers : []\r\n this.index = 0\r\n }\r\n\r\n async handle(error: T, chain: ErrorHandlerChain) {\r\n if (this.index == this.handlers.length) {\r\n throw error\r\n }\r\n\r\n const handler = this.handlers[this.index]\r\n\r\n this.index++\r\n\r\n return await handler.handle(error, chain)\r\n }\r\n}\r\n"],"names":["ErrorHandlerChain","handlers","__publicField","error","chain","handler"],"mappings":";;;AAIA,MAAqBA,EAA6B;AAAA,EAIhD,YAAYC,GAAkC;AAHtC,IAAAC,EAAA;AACA,IAAAA,EAAA;AAGD,SAAA,WAAWD,KAAsB,CAAA,GACtC,KAAK,QAAQ;AAAA,EACf;AAAA,EAEA,MAAM,OAAOE,GAAUC,GAA0B;AAC/C,QAAI,KAAK,SAAS,KAAK,SAAS;AACxB,YAAAD;AAGR,UAAME,IAAU,KAAK,SAAS,KAAK,KAAK;AAEnC,gBAAA,SAEE,MAAMA,EAAQ,OAAOF,GAAOC,CAAK;AAAA,EAC1C;AACF;"}
@@ -1,4 +1,4 @@
1
- import type { AxiosRequestConfig } from 'axios';
1
+ import { AxiosRequestConfig } from 'axios';
2
2
  export interface RequestFilter<T = AxiosRequestConfig> {
3
3
  doFilter(request: T, chain: RequestFilterChain): void;
4
4
  }
@@ -1,18 +1,20 @@
1
- class RequestFilterChain {
2
- filters;
3
- index;
4
- constructor(filters) {
5
- this.filters = filters ? filters : [];
6
- this.index = 0;
1
+ var l = Object.defineProperty;
2
+ var n = (i, t, e) => t in i ? l(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var s = (i, t, e) => n(i, typeof t != "symbol" ? t + "" : t, e);
4
+ class d {
5
+ constructor(t) {
6
+ s(this, "filters");
7
+ s(this, "index");
8
+ this.filters = t || [], this.index = 0;
7
9
  }
8
- doFilter(request, chain) {
9
- if (this.index == this.filters.length) {
10
+ doFilter(t, e) {
11
+ if (this.index == this.filters.length)
10
12
  return;
11
- }
12
- const filter = this.filters[this.index];
13
- this.index++;
14
- filter.doFilter(request, chain);
13
+ const r = this.filters[this.index];
14
+ this.index++, r.doFilter(t, e);
15
15
  }
16
16
  }
17
-
18
- export { RequestFilterChain as default };
17
+ export {
18
+ d as default
19
+ };
20
+ //# sourceMappingURL=RequestFilterChain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequestFilterChain.js","sources":["../../src/request/RequestFilterChain.ts"],"sourcesContent":["import type { AxiosRequestConfig } from 'axios'\r\n\r\nexport interface RequestFilter<T = AxiosRequestConfig> {\r\n doFilter(request: T, chain: RequestFilterChain): void\r\n}\r\n\r\nexport default class RequestFilterChain<T = AxiosRequestConfig> {\r\n private filters: Array<RequestFilter<T>>\r\n private index: number\r\n\r\n constructor(filters: Array<RequestFilter<T>>) {\r\n this.filters = filters ? filters : []\r\n this.index = 0\r\n }\r\n\r\n doFilter(request: T, chain: RequestFilterChain) {\r\n if (this.index == this.filters.length) {\r\n return\r\n }\r\n\r\n const filter = this.filters[this.index]\r\n\r\n this.index++\r\n\r\n filter.doFilter(request, chain)\r\n }\r\n}\r\n"],"names":["RequestFilterChain","filters","__publicField","request","chain","filter"],"mappings":";;;AAMA,MAAqBA,EAA2C;AAAA,EAI9D,YAAYC,GAAkC;AAHtC,IAAAC,EAAA;AACA,IAAAA,EAAA;AAGD,SAAA,UAAUD,KAAoB,CAAA,GACnC,KAAK,QAAQ;AAAA,EACf;AAAA,EAEA,SAASE,GAAYC,GAA2B;AAC9C,QAAI,KAAK,SAAS,KAAK,QAAQ;AAC7B;AAGF,UAAMC,IAAS,KAAK,QAAQ,KAAK,KAAK;AAEjC,SAAA,SAEEA,EAAA,SAASF,GAASC,CAAK;AAAA,EAChC;AACF;"}
@@ -1,4 +1,4 @@
1
- import type { AxiosResponse } from 'axios';
1
+ import { AxiosResponse } from 'axios';
2
2
  export interface ResponseParser<T = AxiosResponse> {
3
3
  parse(response: T, chain: ResponseParserChain): T;
4
4
  }
@@ -1,18 +1,20 @@
1
- class ResponseParserChain {
2
- parsers;
3
- index;
4
- constructor(parsers) {
5
- this.parsers = parsers ? parsers : [];
6
- this.index = 0;
1
+ var a = Object.defineProperty;
2
+ var n = (r, s, e) => s in r ? a(r, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[s] = e;
3
+ var t = (r, s, e) => n(r, typeof s != "symbol" ? s + "" : s, e);
4
+ class d {
5
+ constructor(s) {
6
+ t(this, "parsers");
7
+ t(this, "index");
8
+ this.parsers = s || [], this.index = 0;
7
9
  }
8
- doParse(response, chain) {
9
- if (this.index == this.parsers.length) {
10
- return response;
11
- }
12
- const parser = this.parsers[this.index];
13
- this.index++;
14
- return parser.parse(response, chain);
10
+ doParse(s, e) {
11
+ if (this.index == this.parsers.length)
12
+ return s;
13
+ const i = this.parsers[this.index];
14
+ return this.index++, i.parse(s, e);
15
15
  }
16
16
  }
17
-
18
- export { ResponseParserChain as default };
17
+ export {
18
+ d as default
19
+ };
20
+ //# sourceMappingURL=ResponseParserChain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResponseParserChain.js","sources":["../../src/request/ResponseParserChain.ts"],"sourcesContent":["import type { AxiosResponse } from 'axios'\r\n\r\nexport interface ResponseParser<T = AxiosResponse> {\r\n parse(response: T, chain: ResponseParserChain): T\r\n}\r\n\r\nexport default class ResponseParserChain<T = AxiosResponse> {\r\n private parsers: Array<ResponseParser<T>>\r\n private index: number\r\n\r\n constructor(parsers: Array<ResponseParser<T>>) {\r\n this.parsers = parsers ? parsers : []\r\n this.index = 0\r\n }\r\n\r\n doParse(response: T, chain: ResponseParserChain) {\r\n if (this.index == this.parsers.length) {\r\n return response\r\n }\r\n\r\n const parser = this.parsers[this.index]\r\n\r\n this.index++\r\n\r\n return parser.parse(response, chain)\r\n }\r\n}\r\n"],"names":["ResponseParserChain","parsers","__publicField","response","chain","parser"],"mappings":";;;AAMA,MAAqBA,EAAuC;AAAA,EAI1D,YAAYC,GAAmC;AAHvC,IAAAC,EAAA;AACA,IAAAA,EAAA;AAGD,SAAA,UAAUD,KAAoB,CAAA,GACnC,KAAK,QAAQ;AAAA,EACf;AAAA,EAEA,QAAQE,GAAaC,GAA4B;AAC/C,QAAI,KAAK,SAAS,KAAK,QAAQ;AACtB,aAAAD;AAGT,UAAME,IAAS,KAAK,QAAQ,KAAK,KAAK;AAEjC,gBAAA,SAEEA,EAAO,MAAMF,GAAUC,CAAK;AAAA,EACrC;AACF;"}
@@ -1,52 +1,31 @@
1
- import dayjs from 'dayjs';
2
-
3
- class DateSerializer {
4
- format;
5
- constructor(format = 'YYYY-MM-DD HH:mm:ss.SSS') {
6
- this.format = format;
1
+ var y = Object.defineProperty;
2
+ var A = (f, s, i) => s in f ? y(f, s, { enumerable: !0, configurable: !0, writable: !0, value: i }) : f[s] = i;
3
+ var m = (f, s, i) => A(f, typeof s != "symbol" ? s + "" : s, i);
4
+ import o from "dayjs";
5
+ class b {
6
+ constructor(s = "YYYY-MM-DD HH:mm:ss.SSS") {
7
+ m(this, "format");
8
+ this.format = s;
7
9
  }
8
- serialize(data) {
9
- const format = this.format;
10
- function objTransfer(data) {
11
- const result = {};
12
- Object.keys(data).forEach(key => {
13
- const value = data[key];
14
- if (value instanceof Date || dayjs.isDayjs(value)) {
15
- result[key] = dayjs(value).format(format);
16
- } else if (value && value instanceof Object && !Array.isArray(value)) {
17
- result[key] = objTransfer(value);
18
- } else if (value && Array.isArray(value)) {
19
- result[key] = arrayTransfer(value);
20
- } else {
21
- result[key] = value;
22
- }
23
- });
24
- return result;
10
+ serialize(s) {
11
+ const i = this.format;
12
+ function n(e) {
13
+ const r = {};
14
+ return Object.keys(e).forEach((a) => {
15
+ const t = e[a];
16
+ t instanceof Date || o.isDayjs(t) ? r[a] = o(t).format(i) : t && t instanceof Object && !Array.isArray(t) ? r[a] = n(t) : t && Array.isArray(t) ? r[a] = c(t) : r[a] = t;
17
+ }), r;
25
18
  }
26
- function arrayTransfer(data) {
27
- return data.map(value => {
28
- if (value instanceof Date || dayjs.isDayjs(value)) {
29
- return dayjs(value).format(format);
30
- } else if (value && value instanceof Object && !Array.isArray(value)) {
31
- return objTransfer(value);
32
- } else if (value && Array.isArray(value)) {
33
- return arrayTransfer(value);
34
- } else {
35
- return value;
36
- }
37
- });
19
+ function c(e) {
20
+ return e.map((r) => r instanceof Date || o.isDayjs(r) ? o(r).format(i) : r && r instanceof Object && !Array.isArray(r) ? n(r) : r && Array.isArray(r) ? c(r) : r);
38
21
  }
39
- Object.keys(data).forEach(key => {
40
- const value = data[key];
41
- if (value instanceof Date || dayjs.isDayjs(value)) {
42
- data[key] = dayjs(value).format(this.format);
43
- } else if (value && typeof value == 'object' && !Array.isArray(value)) {
44
- data[key] = objTransfer(value);
45
- } else if (value && Array.isArray(value)) {
46
- data[key] = arrayTransfer(value);
47
- }
22
+ Object.keys(s).forEach((e) => {
23
+ const r = s[e];
24
+ r instanceof Date || o.isDayjs(r) ? s[e] = o(r).format(this.format) : r && typeof r == "object" && !Array.isArray(r) ? s[e] = n(r) : r && Array.isArray(r) && (s[e] = c(r));
48
25
  });
49
26
  }
50
27
  }
51
-
52
- export { DateSerializer as default };
28
+ export {
29
+ b as default
30
+ };
31
+ //# sourceMappingURL=DateSerializer.js.map
@@ -0,0 +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":";;;;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,4 +1,4 @@
1
- import type ErrorHandlerChain from '../ErrorHandlerChain';
1
+ import { default as ErrorHandlerChain } from '../ErrorHandlerChain';
2
2
  export declare function readBlob(blob: Blob): Promise<string>;
3
3
  export default class DivisionErrorHandler {
4
4
  constructor();
@@ -1,59 +1,37 @@
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
-
6
- // import { Modal } from 'dw-neit-antd'
7
- // import SobekThrone from '../../throne/SobekThrone'
8
- // import SobekMsgBox from '../../msgbox/SobekMsgBox'
9
- function readBlob(blob) {
10
- return new Promise(resolve => {
11
- const reader = new FileReader();
12
- reader.addEventListener('loadend', () => {
13
- resolve(reader.result);
14
- });
15
- 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);
16
11
  });
17
12
  }
18
- class DivisionErrorHandler {
19
- constructor() {}
20
- async handle(error, chain) {
21
- if (error instanceof ResponseError) {
22
- const response = error.response;
23
- if (response.status == 200) {
24
- const rawData = response.data;
25
- let jsonData;
26
- if (rawData instanceof Blob) {
27
- // 文件下载抛异常JSON,在Blob里面
28
- jsonData = await readBlob(rawData);
29
- jsonData = JSON.parse(jsonData);
30
- jsonData = JSON.parse(jsonData);
31
- } else {
32
- // 普通请求的异常JSON
33
- jsonData = rawData;
34
- }
35
- const {
36
- success,
37
- errorcode,
38
- data,
39
- errortext
40
- } = jsonData;
41
- if (errorcode === '-1') {
42
- throw new ExceptionResponseError(errortext, error, response, jsonData);
43
- } else if (errorcode === '-2') {
44
- throw new BizExceptionResponseError(errortext, error, response, jsonData);
45
- } else if (errorcode === '-3') {
46
- throw new SessionExceptionResponseError(errortext, error, response, jsonData);
47
- } else {
48
- throw new ExceptionResponseError(errortext, error, response, jsonData);
49
- }
13
+ class R {
14
+ constructor() {
15
+ }
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);
50
25
  } else {
51
- let errortext = "'" + response.config.url + "' " + response.status + ' ' + response.statusText;
52
- throw new ExceptionResponseError(errortext, error, response, null);
26
+ let o = "'" + t.config.url + "' " + t.status + " " + t.statusText;
27
+ throw new i(o, s, t, null);
53
28
  }
54
29
  }
55
- throw error;
30
+ throw s;
56
31
  }
57
32
  }
58
-
59
- export { DivisionErrorHandler as default, readBlob };
33
+ export {
34
+ R as default,
35
+ w as readBlob
36
+ };
37
+ //# sourceMappingURL=DivisionErrorHandler.js.map
@@ -0,0 +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,5 +1,5 @@
1
- import type { AxiosResponse } from 'axios';
2
- import type ResponseParserChain from '../ResponseParserChain';
1
+ import { AxiosResponse } from 'axios';
2
+ import { default as ResponseParserChain } from '../ResponseParserChain';
3
3
  export default class DivisionResponseParser {
4
4
  parse(response: AxiosResponse, chain: ResponseParserChain): AxiosResponse<any, any>;
5
5
  }
@@ -1,27 +1,15 @@
1
- class DivisionResponseParser {
2
- parse(response, chain) {
3
- // server 端不响应内容
4
- const contentType = response.headers['content-type'];
5
- if (!contentType) {
6
- return chain.doParse(response, chain);
7
- }
8
- // server 端响应的不是 application/json 协议
9
- if (contentType.indexOf('application/json') === -1) {
10
- return chain.doParse(response, chain);
11
- }
12
- // data为string时,兼容ie
13
- const {
14
- success,
15
- errorcode,
16
- data,
17
- errortext
18
- } = typeof response.data === 'string' ? JSON.parse(response.data) : response.data;
19
- if (success === true) {
20
- return chain.doParse(data, chain);
21
- } else {
22
- throw new Error(errortext);
23
- }
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);
24
10
  }
25
11
  }
26
-
27
- export { DivisionResponseParser as default };
12
+ export {
13
+ n as default
14
+ };
15
+ //# sourceMappingURL=DivisionResponseParser.js.map
@@ -0,0 +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,6 +1,6 @@
1
- import { type ResponseParser } from '../ResponseParserChain';
2
- import { type ErrorHandler } from '../ErrorHandlerChain';
3
- import { type RequestFilter } from '../RequestFilterChain';
1
+ import { ResponseParser } from '../ResponseParserChain';
2
+ import { ErrorHandler } from '../ErrorHandlerChain';
3
+ import { RequestFilter } from '../RequestFilterChain';
4
4
  export type RequestParams = Record<string, unknown>;
5
5
  export interface RequestOptionsI {
6
6
  loading?: boolean;