@obr-fe/utils 1.2.0 → 2.0.1

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 (419) hide show
  1. package/dist/array.d.mts +98 -3
  2. package/dist/{array-CiSUhZCW.d.mts → array.d.ts} +8 -9
  3. package/dist/array.js +1 -0
  4. package/dist/array.mjs +1 -1
  5. package/dist/base.d.mts +192 -3
  6. package/dist/{base-BXKvmcaf.d.cts → base.d.ts} +4 -5
  7. package/dist/base.js +1 -0
  8. package/dist/base.mjs +1 -1
  9. package/dist/chunk-224VP3SO.mjs +1 -0
  10. package/dist/chunk-34VTCYOF.mjs +1 -0
  11. package/dist/chunk-3EVCK72A.mjs +1 -0
  12. package/dist/chunk-3JZFB5CS.mjs +1 -0
  13. package/dist/chunk-44EYU7QJ.mjs +1 -0
  14. package/dist/chunk-4JPCGRPU.mjs +1 -0
  15. package/dist/chunk-6DX7ZFGR.mjs +1 -0
  16. package/dist/chunk-7YMDSJIW.mjs +1 -0
  17. package/dist/chunk-A25LR755.mjs +1 -0
  18. package/dist/chunk-A5BXGBYT.mjs +1 -0
  19. package/dist/chunk-BEM6E7R7.mjs +1 -0
  20. package/dist/chunk-BPXO4V4X.mjs +1 -0
  21. package/dist/chunk-CJW7PR5X.mjs +1 -0
  22. package/dist/chunk-DDHFJKTT.mjs +1 -0
  23. package/dist/chunk-DKKF6DRJ.mjs +1 -0
  24. package/dist/chunk-DVMX6FDA.mjs +1 -0
  25. package/dist/chunk-E4SEMOGO.mjs +1 -0
  26. package/dist/chunk-EUDEMS67.mjs +1 -0
  27. package/dist/chunk-G6NAYP42.mjs +1 -0
  28. package/dist/chunk-HERHZLBT.mjs +1 -0
  29. package/dist/chunk-HOXWKSQ2.mjs +1 -0
  30. package/dist/chunk-INFFTHYR.mjs +1 -0
  31. package/dist/chunk-IZHCWZIN.mjs +1 -0
  32. package/dist/chunk-KGXCJWE5.mjs +1 -0
  33. package/dist/chunk-MQBXN7R5.mjs +1 -0
  34. package/dist/chunk-MUUIQW2M.mjs +1 -0
  35. package/dist/chunk-NX2HGAYK.mjs +1 -0
  36. package/dist/chunk-PE3DNHCL.mjs +1 -0
  37. package/dist/chunk-PK5CYIDE.mjs +1 -0
  38. package/dist/chunk-R2AK2OJS.mjs +1 -0
  39. package/dist/chunk-SAXMBV46.mjs +1 -0
  40. package/dist/chunk-SZOHVFVZ.mjs +1 -0
  41. package/dist/chunk-TQ5GXPYB.mjs +1 -0
  42. package/dist/chunk-UVMLBW6A.mjs +1 -0
  43. package/dist/chunk-UYN2YSOE.mjs +1 -0
  44. package/dist/chunk-WN7L4HYY.mjs +1 -0
  45. package/dist/chunk-X7TUTCBW.mjs +1 -0
  46. package/dist/chunk-YA66RVVU.mjs +1 -0
  47. package/dist/clipboard.d.mts +3 -2
  48. package/dist/clipboard.d.ts +3 -0
  49. package/dist/clipboard.js +1 -0
  50. package/dist/clipboard.mjs +1 -1
  51. package/dist/dayjs.d.mts +29 -2
  52. package/dist/{dayjs-DgS65bx1.d.cts → dayjs.d.ts} +5 -6
  53. package/dist/dayjs.js +1 -0
  54. package/dist/dayjs.mjs +1 -1
  55. package/dist/dom/base.d.mts +24 -2
  56. package/dist/{base-Ca2FN16G.d.mts → dom/base.d.ts} +2 -3
  57. package/dist/dom/base.js +1 -0
  58. package/dist/dom/base.mjs +1 -1
  59. package/dist/dom/class.d.mts +26 -2
  60. package/dist/{class-Bp70Yi1y.d.cts → dom/class.d.ts} +2 -3
  61. package/dist/dom/class.js +1 -0
  62. package/dist/dom/class.mjs +1 -1
  63. package/dist/dom/contains.d.mts +10 -2
  64. package/dist/{contains-Bj-oQ7KI.d.mts → dom/contains.d.ts} +2 -3
  65. package/dist/dom/contains.js +1 -0
  66. package/dist/dom/contains.mjs +1 -1
  67. package/dist/dom/css.d.mts +22 -2
  68. package/dist/{css-5xR1zP0f.d.cts → dom/css.d.ts} +10 -11
  69. package/dist/dom/css.js +1 -0
  70. package/dist/dom/css.mjs +1 -1
  71. package/dist/dom/dynamic-css.d.mts +20 -2
  72. package/dist/{dynamic-css-CIw8ZtwR.d.cts → dom/dynamic-css.d.ts} +8 -9
  73. package/dist/dom/dynamic-css.js +1 -0
  74. package/dist/dom/dynamic-css.mjs +1 -1
  75. package/dist/dom/find-dom-node.d.mts +3 -2
  76. package/dist/dom/find-dom-node.d.ts +3 -0
  77. package/dist/dom/find-dom-node.js +1 -0
  78. package/dist/dom/find-dom-node.mjs +1 -1
  79. package/dist/dom/focus.d.mts +10 -2
  80. package/dist/{focus-BBcVAsFx.d.cts → dom/focus.d.ts} +2 -3
  81. package/dist/dom/focus.js +1 -0
  82. package/dist/dom/focus.mjs +1 -1
  83. package/dist/dom/iframe.d.mts +57 -2
  84. package/dist/{iframe-CBeiHcmx.d.mts → dom/iframe.d.ts} +15 -16
  85. package/dist/dom/iframe.js +1 -0
  86. package/dist/dom/iframe.mjs +1 -1
  87. package/dist/dom/index.d.mts +17 -18
  88. package/dist/dom/index.d.ts +17 -0
  89. package/dist/dom/index.js +1 -0
  90. package/dist/dom/index.mjs +1 -1
  91. package/dist/dom/is-visible.d.mts +3 -2
  92. package/dist/dom/is-visible.d.ts +3 -0
  93. package/dist/dom/is-visible.js +1 -0
  94. package/dist/dom/is-visible.mjs +1 -1
  95. package/dist/dom/lib/can-use-dom.d.mts +2 -3
  96. package/dist/dom/lib/can-use-dom.d.ts +3 -0
  97. package/dist/dom/lib/can-use-dom.js +1 -0
  98. package/dist/dom/lib/can-use-dom.mjs +1 -1
  99. package/dist/dom/scrollbar.d.mts +8 -2
  100. package/dist/{scrollbar-B0PNF6i2.d.mts → dom/scrollbar.d.ts} +2 -3
  101. package/dist/dom/scrollbar.js +1 -0
  102. package/dist/dom/scrollbar.mjs +1 -1
  103. package/dist/dom/storage.d.mts +20 -3
  104. package/dist/{storage-DicI9wsP.d.cts → dom/storage.d.ts} +4 -5
  105. package/dist/dom/storage.js +1 -0
  106. package/dist/dom/storage.mjs +1 -1
  107. package/dist/dom/style-checker.d.mts +4 -2
  108. package/dist/{style-checker-CpyAZJew.d.cts → dom/style-checker.d.ts} +2 -3
  109. package/dist/dom/style-checker.js +1 -0
  110. package/dist/dom/style-checker.mjs +1 -1
  111. package/dist/dom/style-names.d.mts +3 -2
  112. package/dist/{style-names-ClFu2pk1.d.cts → dom/style-names.d.ts} +2 -3
  113. package/dist/dom/style-names.js +1 -0
  114. package/dist/dom/style-names.mjs +1 -1
  115. package/dist/dom/support.d.mts +8 -2
  116. package/dist/dom/support.d.ts +8 -0
  117. package/dist/dom/support.js +1 -0
  118. package/dist/dom/support.mjs +1 -1
  119. package/dist/dom/video.d.mts +9 -2
  120. package/dist/{video-Bp6NaeX6.d.cts → dom/video.d.ts} +2 -3
  121. package/dist/dom/video.js +1 -0
  122. package/dist/dom/video.mjs +1 -1
  123. package/dist/encrypt.d.mts +28 -2
  124. package/dist/{encrypt-BFDBlSX_.d.cts → encrypt.d.ts} +2 -3
  125. package/dist/encrypt.js +1 -0
  126. package/dist/encrypt.mjs +1 -1
  127. package/dist/file.d.mts +35 -2
  128. package/dist/{file-CjjpuB5u.d.cts → file.d.ts} +5 -6
  129. package/dist/file.js +1 -0
  130. package/dist/file.mjs +1 -1
  131. package/dist/index.d.mts +36 -44
  132. package/dist/index.d.ts +36 -0
  133. package/dist/index.js +1 -0
  134. package/dist/index.mjs +1 -1
  135. package/dist/lodash.d.mts +1 -2
  136. package/dist/lodash.d.ts +1 -0
  137. package/dist/lodash.js +1 -0
  138. package/dist/lodash.mjs +1 -1
  139. package/dist/object.d.mts +86 -3
  140. package/dist/{object-CqyPehTh.d.cts → object.d.ts} +4 -5
  141. package/dist/object.js +1 -0
  142. package/dist/object.mjs +1 -1
  143. package/dist/other.d.mts +49 -3
  144. package/dist/{other-BzR4DqG0.d.cts → other.d.ts} +4 -5
  145. package/dist/other.js +1 -0
  146. package/dist/other.mjs +1 -1
  147. package/dist/parse.d.mts +21 -3
  148. package/dist/{parse-DQMRWCdz.d.mts → parse.d.ts} +7 -8
  149. package/dist/parse.js +1 -0
  150. package/dist/parse.mjs +1 -1
  151. package/dist/pinyin.d.mts +18 -2
  152. package/dist/{pinyin-C2BqrFMq.d.mts → pinyin.d.ts} +3 -5
  153. package/dist/pinyin.js +1 -0
  154. package/dist/pinyin.mjs +1 -1
  155. package/dist/request/constant.d.mts +4 -4
  156. package/dist/request/{constant.d.cts → constant.d.ts} +4 -4
  157. package/dist/request/constant.js +1 -0
  158. package/dist/request/constant.mjs +1 -1
  159. package/dist/request/handler.d.mts +10 -3
  160. package/dist/request/handler.d.ts +10 -0
  161. package/dist/request/handler.js +1 -0
  162. package/dist/request/handler.mjs +1 -1
  163. package/dist/request/index.d.mts +4 -6
  164. package/dist/request/index.d.ts +4 -0
  165. package/dist/request/index.js +1 -0
  166. package/dist/request/index.mjs +1 -1
  167. package/dist/request/request.d.mts +99 -3
  168. package/dist/request/request.d.ts +99 -0
  169. package/dist/request/request.js +1 -0
  170. package/dist/request/request.mjs +1 -1
  171. package/dist/request/utils/cancel.d.mts +4 -4
  172. package/dist/request/utils/{cancel.d.cts → cancel.d.ts} +4 -4
  173. package/dist/request/utils/cancel.js +1 -0
  174. package/dist/request/utils/cancel.mjs +1 -1
  175. package/dist/request/utils/file.d.mts +4 -4
  176. package/dist/request/utils/file.d.ts +6 -0
  177. package/dist/request/utils/file.js +1 -0
  178. package/dist/request/utils/file.mjs +1 -1
  179. package/dist/request/utils/format.d.mts +4 -4
  180. package/dist/request/utils/{format.d.cts → format.d.ts} +4 -4
  181. package/dist/request/utils/format.js +1 -0
  182. package/dist/request/utils/format.mjs +1 -1
  183. package/dist/request/utils/params.d.mts +4 -4
  184. package/dist/request/utils/params.d.ts +6 -0
  185. package/dist/request/utils/params.js +1 -0
  186. package/dist/request/utils/params.mjs +1 -1
  187. package/dist/safe-next-tick.d.mts +9 -2
  188. package/dist/{safe-next-tick-DlJsO1Ha.d.mts → safe-next-tick.d.ts} +4 -5
  189. package/dist/safe-next-tick.js +1 -0
  190. package/dist/safe-next-tick.mjs +1 -1
  191. package/dist/types.d.mts +207 -2
  192. package/dist/types.d.ts +207 -0
  193. package/dist/types.js +1 -0
  194. package/dist/types.mjs +1 -1
  195. package/dist/vue/hooks/clipboard.d.mts +8 -2
  196. package/dist/vue/hooks/clipboard.d.ts +8 -0
  197. package/dist/vue/hooks/clipboard.js +1 -0
  198. package/dist/vue/hooks/clipboard.mjs +1 -1
  199. package/dist/vue/index.d.mts +3 -4
  200. package/dist/vue/index.d.ts +3 -0
  201. package/dist/vue/index.js +1 -0
  202. package/dist/vue/index.mjs +1 -1
  203. package/dist/vue/type-util.d.mts +47 -2
  204. package/dist/{type-util-BdSpgYN3.d.mts → vue/type-util.d.ts} +21 -22
  205. package/dist/vue/type-util.js +1 -0
  206. package/dist/vue/type-util.mjs +1 -1
  207. package/package.json +5 -13
  208. package/dist/array-CEhD-Z_e.mjs +0 -1
  209. package/dist/array-okkZATKz.d.cts +0 -99
  210. package/dist/array-ri-t3Wsz.cjs +0 -1
  211. package/dist/array.cjs +0 -1
  212. package/dist/array.d.cts +0 -3
  213. package/dist/base-854WVUaj.mjs +0 -1
  214. package/dist/base-BSg8gJZf.mjs +0 -1
  215. package/dist/base-DSfexc9G.d.cts +0 -25
  216. package/dist/base-DUxrUTOr.cjs +0 -1
  217. package/dist/base-Dl59EolR.d.mts +0 -193
  218. package/dist/base-DmSU_ydZ.cjs +0 -1
  219. package/dist/base.cjs +0 -1
  220. package/dist/base.d.cts +0 -3
  221. package/dist/can-use-dom-DiyvIP5G.mjs +0 -1
  222. package/dist/can-use-dom-DvmMdeGa.cjs +0 -1
  223. package/dist/cancel-BV5B58Lw.mjs +0 -1
  224. package/dist/cancel-Do0w5I5K.cjs +0 -1
  225. package/dist/chunk-BcXMmzxH.cjs +0 -1
  226. package/dist/chunk-Dbq9I6zD.mjs +0 -1
  227. package/dist/class-C29-Mh-o.mjs +0 -1
  228. package/dist/class-D5duI9ps.d.mts +0 -27
  229. package/dist/class-D8a8qnWA.cjs +0 -1
  230. package/dist/clipboard-BN1iiQLu.d.mts +0 -4
  231. package/dist/clipboard-C8ZiJE_h.d.cts +0 -9
  232. package/dist/clipboard-CJ-9sRbH.d.mts +0 -9
  233. package/dist/clipboard-CWQVWiTk.cjs +0 -1
  234. package/dist/clipboard-Ci0l5Dtt.d.cts +0 -4
  235. package/dist/clipboard-CjgXtqbg.mjs +0 -1
  236. package/dist/clipboard-DqGhq6A4.mjs +0 -1
  237. package/dist/clipboard-ZMrs6wzK.cjs +0 -1
  238. package/dist/clipboard.cjs +0 -1
  239. package/dist/clipboard.d.cts +0 -2
  240. package/dist/constant-CskvZDUK.cjs +0 -1
  241. package/dist/constant-Dxt8HuVn.mjs +0 -1
  242. package/dist/contains-BpG9RIaT.mjs +0 -1
  243. package/dist/contains-CYQgjY4K.cjs +0 -1
  244. package/dist/contains-D3q8gHUu.d.cts +0 -11
  245. package/dist/css-DIpTZrC7.mjs +0 -1
  246. package/dist/css-DkmknM-7.d.mts +0 -23
  247. package/dist/css-WYllKaVv.cjs +0 -1
  248. package/dist/dayjs-00xX6Mts.d.mts +0 -31
  249. package/dist/dayjs-BBOQ72ow.mjs +0 -1
  250. package/dist/dayjs-Bvzj_rlD.cjs +0 -1
  251. package/dist/dayjs.cjs +0 -1
  252. package/dist/dayjs.d.cts +0 -2
  253. package/dist/dom/base.cjs +0 -1
  254. package/dist/dom/base.d.cts +0 -2
  255. package/dist/dom/class.cjs +0 -1
  256. package/dist/dom/class.d.cts +0 -2
  257. package/dist/dom/contains.cjs +0 -1
  258. package/dist/dom/contains.d.cts +0 -2
  259. package/dist/dom/css.cjs +0 -1
  260. package/dist/dom/css.d.cts +0 -2
  261. package/dist/dom/dynamic-css.cjs +0 -1
  262. package/dist/dom/dynamic-css.d.cts +0 -2
  263. package/dist/dom/find-dom-node.cjs +0 -1
  264. package/dist/dom/find-dom-node.d.cts +0 -2
  265. package/dist/dom/focus.cjs +0 -1
  266. package/dist/dom/focus.d.cts +0 -2
  267. package/dist/dom/iframe.cjs +0 -1
  268. package/dist/dom/iframe.d.cts +0 -2
  269. package/dist/dom/index.cjs +0 -1
  270. package/dist/dom/index.d.cts +0 -18
  271. package/dist/dom/is-visible.cjs +0 -1
  272. package/dist/dom/is-visible.d.cts +0 -2
  273. package/dist/dom/lib/can-use-dom.cjs +0 -1
  274. package/dist/dom/lib/can-use-dom.d.cts +0 -3
  275. package/dist/dom/scrollbar.cjs +0 -1
  276. package/dist/dom/scrollbar.d.cts +0 -2
  277. package/dist/dom/storage.cjs +0 -1
  278. package/dist/dom/storage.d.cts +0 -3
  279. package/dist/dom/style-checker.cjs +0 -1
  280. package/dist/dom/style-checker.d.cts +0 -2
  281. package/dist/dom/style-names.cjs +0 -1
  282. package/dist/dom/style-names.d.cts +0 -2
  283. package/dist/dom/support.cjs +0 -1
  284. package/dist/dom/support.d.cts +0 -2
  285. package/dist/dom/video.cjs +0 -1
  286. package/dist/dom/video.d.cts +0 -2
  287. package/dist/dom-D2QfuVth.mjs +0 -1
  288. package/dist/dynamic-css-CD9eHWzL.d.mts +0 -21
  289. package/dist/dynamic-css-CP1iFszw.mjs +0 -1
  290. package/dist/dynamic-css-iSnm5CN6.cjs +0 -1
  291. package/dist/encrypt-CHxdyuoC.d.mts +0 -29
  292. package/dist/encrypt-D6oTfiTY.cjs +0 -1
  293. package/dist/encrypt-Z5CU2r_1.mjs +0 -1
  294. package/dist/encrypt.cjs +0 -1
  295. package/dist/encrypt.d.cts +0 -2
  296. package/dist/file-B9oorXhT.cjs +0 -1
  297. package/dist/file-D4oBhObv.d.mts +0 -36
  298. package/dist/file-Dwobl-pF.mjs +0 -1
  299. package/dist/file-TjtumYrh.mjs +0 -1
  300. package/dist/file-rmcv99h0.cjs +0 -1
  301. package/dist/file.cjs +0 -1
  302. package/dist/file.d.cts +0 -2
  303. package/dist/find-dom-node-BYO9We8P.d.mts +0 -4
  304. package/dist/find-dom-node-BkrYW2pm.d.cts +0 -4
  305. package/dist/find-dom-node-gbroqN2N.mjs +0 -1
  306. package/dist/find-dom-node-lY7vePVL.cjs +0 -1
  307. package/dist/focus-ByNB07tt.d.mts +0 -11
  308. package/dist/focus-DtSCSQEr.cjs +0 -1
  309. package/dist/focus-REYXIBdQ.mjs +0 -1
  310. package/dist/format-3CsgkBWg.mjs +0 -1
  311. package/dist/format-CezZBld9.cjs +0 -1
  312. package/dist/handler-C40H2JG4.cjs +0 -1
  313. package/dist/handler-Dk1QWSgF.d.cts +0 -10
  314. package/dist/handler-N6Akxkpa.mjs +0 -1
  315. package/dist/handler-bsPUG7U9.d.mts +0 -10
  316. package/dist/iframe-ByOdqFYr.mjs +0 -1
  317. package/dist/iframe-CR0bl22C.cjs +0 -1
  318. package/dist/iframe-QhpkIola.d.cts +0 -58
  319. package/dist/index-6bSwZ6-V.d.cts +0 -1
  320. package/dist/index-BYjO2-Dk.d.mts +0 -3
  321. package/dist/index-CLTQPxoD.d.mts +0 -1
  322. package/dist/index-CqciuydZ.d.cts +0 -7
  323. package/dist/index-Ctvuv0vV.d.cts +0 -1
  324. package/dist/index-D-9tW2r5.d.mts +0 -1
  325. package/dist/index.cjs +0 -1
  326. package/dist/index.d.cts +0 -43
  327. package/dist/is-visible-BXbqt6I2.mjs +0 -1
  328. package/dist/is-visible-BpFCb4uJ.d.mts +0 -4
  329. package/dist/is-visible-DT2jLmnp.d.cts +0 -4
  330. package/dist/is-visible-laJngqtK.cjs +0 -1
  331. package/dist/lodash-BrrZKPAY.d.cts +0 -10
  332. package/dist/lodash-DAdPs0O9.d.mts +0 -10
  333. package/dist/lodash-iHVEJs1z.mjs +0 -1
  334. package/dist/lodash-kixEH9o9.cjs +0 -1
  335. package/dist/lodash.cjs +0 -1
  336. package/dist/lodash.d.cts +0 -2
  337. package/dist/object-C6qVmoZY.cjs +0 -1
  338. package/dist/object-j-lK643f.mjs +0 -1
  339. package/dist/object-l_DvbWqN.d.mts +0 -87
  340. package/dist/object.cjs +0 -1
  341. package/dist/object.d.cts +0 -3
  342. package/dist/other-B2ug3Xof.mjs +0 -1
  343. package/dist/other-H13CGzY5.d.mts +0 -50
  344. package/dist/other-c9ZDQ-tY.cjs +0 -1
  345. package/dist/other.cjs +0 -1
  346. package/dist/other.d.cts +0 -3
  347. package/dist/params-CnZhAsve.cjs +0 -1
  348. package/dist/params-CpjttIDa.mjs +0 -1
  349. package/dist/parse-BpErok05.cjs +0 -1
  350. package/dist/parse-C1eaIjot.mjs +0 -1
  351. package/dist/parse-vp0jh8-x.d.cts +0 -22
  352. package/dist/parse.cjs +0 -1
  353. package/dist/parse.d.cts +0 -3
  354. package/dist/pinyin-BE6Ew65z.cjs +0 -1
  355. package/dist/pinyin-D11MW4u2.mjs +0 -1
  356. package/dist/pinyin-Di92101W.d.cts +0 -20
  357. package/dist/pinyin.cjs +0 -1
  358. package/dist/pinyin.d.cts +0 -2
  359. package/dist/request/constant.cjs +0 -1
  360. package/dist/request/handler.cjs +0 -1
  361. package/dist/request/handler.d.cts +0 -3
  362. package/dist/request/index.cjs +0 -1
  363. package/dist/request/index.d.cts +0 -6
  364. package/dist/request/request.cjs +0 -1
  365. package/dist/request/request.d.cts +0 -3
  366. package/dist/request/utils/cancel.cjs +0 -1
  367. package/dist/request/utils/file.cjs +0 -1
  368. package/dist/request/utils/file.d.cts +0 -6
  369. package/dist/request/utils/format.cjs +0 -1
  370. package/dist/request/utils/params.cjs +0 -1
  371. package/dist/request/utils/params.d.cts +0 -6
  372. package/dist/request-BG5UIh9R.mjs +0 -1
  373. package/dist/request-C8gChBjl.d.cts +0 -99
  374. package/dist/request-Cbv8Ih3e.cjs +0 -1
  375. package/dist/request-CcQHJNao.cjs +0 -1
  376. package/dist/request-CmsAe99W.mjs +0 -1
  377. package/dist/request-DGUcKxsQ.d.mts +0 -99
  378. package/dist/safe-next-tick-1ezZPIPs.d.cts +0 -10
  379. package/dist/safe-next-tick-Cc30ZlUX.mjs +0 -1
  380. package/dist/safe-next-tick-DphyaFY6.cjs +0 -1
  381. package/dist/safe-next-tick.cjs +0 -1
  382. package/dist/safe-next-tick.d.cts +0 -2
  383. package/dist/scrollbar-07jqhpVk.d.cts +0 -9
  384. package/dist/scrollbar-2zQwgB3N.cjs +0 -1
  385. package/dist/scrollbar-BsVSwcz1.mjs +0 -1
  386. package/dist/storage-CVE8yo6N.mjs +0 -1
  387. package/dist/storage-ClTxbIcP.cjs +0 -1
  388. package/dist/storage-HTBNfA8Q.d.mts +0 -21
  389. package/dist/style-checker-066o7h7_.mjs +0 -1
  390. package/dist/style-checker-B5wzcdHi.d.mts +0 -5
  391. package/dist/style-checker-DAxS0NyJ.cjs +0 -1
  392. package/dist/style-names-CYvxRARD.cjs +0 -1
  393. package/dist/style-names-DDdz6-7S.d.mts +0 -4
  394. package/dist/style-names-cEIIM3cL.mjs +0 -1
  395. package/dist/support-BKRoxgNc.d.mts +0 -9
  396. package/dist/support-BZYJpIOE.cjs +0 -1
  397. package/dist/support-jAYY4GwL.d.cts +0 -9
  398. package/dist/support-wu9hh5gZ.mjs +0 -1
  399. package/dist/type-util-BRGMhQFp.d.cts +0 -48
  400. package/dist/type-util-HyvLYA2w.cjs +0 -1
  401. package/dist/type-util-Qle7ht7X.mjs +0 -1
  402. package/dist/types-BEdiy6mb.d.mts +0 -208
  403. package/dist/types-Bs46AtMe.mjs +0 -1
  404. package/dist/types-DTtPjrm8.d.cts +0 -208
  405. package/dist/types.cjs +0 -1
  406. package/dist/types.d.cts +0 -2
  407. package/dist/video-BDLauzJm.cjs +0 -1
  408. package/dist/video-C_sYI0Ht.d.mts +0 -10
  409. package/dist/video-CtkByFxt.mjs +0 -1
  410. package/dist/vue/hooks/clipboard.cjs +0 -1
  411. package/dist/vue/hooks/clipboard.d.cts +0 -2
  412. package/dist/vue/index.cjs +0 -1
  413. package/dist/vue/index.d.cts +0 -4
  414. package/dist/vue/type-util.cjs +0 -1
  415. package/dist/vue/type-util.d.cts +0 -2
  416. package/dist/vue-Q8n_JN-R.mjs +0 -1
  417. /package/dist/{dom-DzrnEGri.cjs → chunk-G27KRYT2.mjs} +0 -0
  418. /package/dist/{types-DAFnYo8a.cjs → chunk-PM3H3ISM.mjs} +0 -0
  419. /package/dist/{vue-CGBzFhF4.cjs → chunk-WBQAMGXK.mjs} +0 -0
@@ -1,3 +1,99 @@
1
- import "../types-BEdiy6mb.mjs";
2
- import { t as ObrRequest } from "../request-DGUcKxsQ.mjs";
3
- export { ObrRequest };
1
+ import { RequestBaseConfig, ObjectDataType, ObrAxiosRequestConfig, PageQueryType, RequestMethod, PageAlias, PageResType, OptionResAlias, BaseOptionType, CascaderRequestOption, CascaderOptionType, ResDataType } from '../types.mjs';
2
+ import 'axios';
3
+
4
+ declare class ObrRequest {
5
+ private options;
6
+ private instance;
7
+ constructor(options: RequestBaseConfig);
8
+ private setupInterceptors;
9
+ /**
10
+ * @description: 请求本地文件
11
+ * @param {string} path
12
+ * @return {Promise<Response>}
13
+ * @autor: 刘 相卿
14
+ */
15
+ fetchLocalFile(path: string): Promise<Response>;
16
+ /**
17
+ * @description: get请求
18
+ * @param {string} url
19
+ * @param {ObjectDataType} params
20
+ * @param {ObrAxiosRequestConfig} config
21
+ * @return {*}
22
+ * @autor: 刘 相卿
23
+ */
24
+ get<T = any>(url: string, params?: ObjectDataType, config?: ObrAxiosRequestConfig): Promise<T>;
25
+ /**
26
+ * @description: post请求
27
+ * @param {string} url
28
+ * @param {ObjectDataType} params 请求参数
29
+ * @param {ObrAxiosRequestConfig} config 请求配置项
30
+ * @return {Promise<T>}
31
+ * @autor: 刘 相卿
32
+ */
33
+ post<T = any>(url: string, params?: ObjectDataType, config?: ObrAxiosRequestConfig): Promise<T>;
34
+ /**
35
+ * @description: post请求(json参数会转为FormData类型)
36
+ * @param {string} url
37
+ * @param {ObjectDataType} params 请求参数
38
+ * @param {ObrAxiosRequestConfig} config 请求配置项
39
+ * @return {Promise<T>}
40
+ * @autor: 刘 相卿
41
+ */
42
+ postForm<T = any>(url: string, params?: ObjectDataType, config?: ObrAxiosRequestConfig): Promise<T>;
43
+ /**
44
+ * @description: 请求分页接口
45
+ * @param {string} url
46
+ * @param {ObjectDataType} searchParams 请求参数
47
+ * @param {PageQueryType} pageParams 分页参数
48
+ * @param {RequestMethod} method 请求方法
49
+ * @param {Partial} alias 分页别名配置
50
+ * @param {ObrAxiosRequestConfig} config 请求配置项
51
+ * @return {Promise<PageResType<R>>}
52
+ * @autor: 刘 相卿
53
+ */
54
+ getPageRecords<R = ObjectDataType>(url: string, searchParams?: ObjectDataType, pageParams?: PageQueryType, method?: RequestMethod, alias?: Partial<PageAlias>, config?: ObrAxiosRequestConfig): Promise<PageResType<R>>;
55
+ /**
56
+ * @description: 获取options类型数据(下拉选择/字典等)
57
+ * @param {string} url
58
+ * @param {ObjectDataType} params
59
+ * @param {RequestMethod} method
60
+ * @param {Partial} alias alias.label可设置为模板 #{name}/#{no} 从模板中获取
61
+ * @param {ObrAxiosRequestConfig} config
62
+ * @param {boolean} unique
63
+ * @return {Promise<BaseOptionType<T>[]>}
64
+ * @autor: 刘 相卿
65
+ */
66
+ getOptions<T = ObjectDataType>(url: string, params?: ObjectDataType, method?: RequestMethod, alias?: Partial<OptionResAlias>, config?: ObrAxiosRequestConfig, unique?: boolean): Promise<BaseOptionType<T>[]>;
67
+ /**
68
+ * @description: 获取级联类型数据(谨慎使用!!! 会发起大量请求!!!)
69
+ * @param {CascaderRequestOption} options 级联请求配置项
70
+ * @param {ObjectDataType} params 所有层级的请求参数(共用)
71
+ * @param {ObrAxiosRequestConfig} config
72
+ * @param {boolean} unique 单一层级下的去重
73
+ * @return {*}
74
+ * @autor: 刘 相卿
75
+ */
76
+ getCascaderOptions<T extends ObjectDataType = ObjectDataType>(options: CascaderRequestOption[], params?: ObjectDataType, config?: ObrAxiosRequestConfig, unique?: boolean): Promise<CascaderOptionType<T>[]>;
77
+ /**
78
+ * @description: 强制取消请求
79
+ * @param {ObrAxiosRequestConfig} config
80
+ * @return {*}
81
+ * @autor: 刘 相卿
82
+ */
83
+ cancel(config: ObrAxiosRequestConfig): void;
84
+ /**
85
+ * @description: request请求
86
+ * @param {ObrAxiosRequestConfig} config
87
+ * @return {Promise<ResDataType<T>>}
88
+ * @autor: 刘 相卿
89
+ */
90
+ request<T = any>(config: ObrAxiosRequestConfig): Promise<ResDataType<T>>;
91
+ /**
92
+ * @description: 取消所有请求并销毁axios实例
93
+ * @return {*}
94
+ * @autor: 刘 相卿
95
+ */
96
+ destory(): void;
97
+ }
98
+
99
+ export { ObrRequest };
@@ -0,0 +1,99 @@
1
+ import { RequestBaseConfig, ObjectDataType, ObrAxiosRequestConfig, PageQueryType, RequestMethod, PageAlias, PageResType, OptionResAlias, BaseOptionType, CascaderRequestOption, CascaderOptionType, ResDataType } from '../types.js';
2
+ import 'axios';
3
+
4
+ declare class ObrRequest {
5
+ private options;
6
+ private instance;
7
+ constructor(options: RequestBaseConfig);
8
+ private setupInterceptors;
9
+ /**
10
+ * @description: 请求本地文件
11
+ * @param {string} path
12
+ * @return {Promise<Response>}
13
+ * @autor: 刘 相卿
14
+ */
15
+ fetchLocalFile(path: string): Promise<Response>;
16
+ /**
17
+ * @description: get请求
18
+ * @param {string} url
19
+ * @param {ObjectDataType} params
20
+ * @param {ObrAxiosRequestConfig} config
21
+ * @return {*}
22
+ * @autor: 刘 相卿
23
+ */
24
+ get<T = any>(url: string, params?: ObjectDataType, config?: ObrAxiosRequestConfig): Promise<T>;
25
+ /**
26
+ * @description: post请求
27
+ * @param {string} url
28
+ * @param {ObjectDataType} params 请求参数
29
+ * @param {ObrAxiosRequestConfig} config 请求配置项
30
+ * @return {Promise<T>}
31
+ * @autor: 刘 相卿
32
+ */
33
+ post<T = any>(url: string, params?: ObjectDataType, config?: ObrAxiosRequestConfig): Promise<T>;
34
+ /**
35
+ * @description: post请求(json参数会转为FormData类型)
36
+ * @param {string} url
37
+ * @param {ObjectDataType} params 请求参数
38
+ * @param {ObrAxiosRequestConfig} config 请求配置项
39
+ * @return {Promise<T>}
40
+ * @autor: 刘 相卿
41
+ */
42
+ postForm<T = any>(url: string, params?: ObjectDataType, config?: ObrAxiosRequestConfig): Promise<T>;
43
+ /**
44
+ * @description: 请求分页接口
45
+ * @param {string} url
46
+ * @param {ObjectDataType} searchParams 请求参数
47
+ * @param {PageQueryType} pageParams 分页参数
48
+ * @param {RequestMethod} method 请求方法
49
+ * @param {Partial} alias 分页别名配置
50
+ * @param {ObrAxiosRequestConfig} config 请求配置项
51
+ * @return {Promise<PageResType<R>>}
52
+ * @autor: 刘 相卿
53
+ */
54
+ getPageRecords<R = ObjectDataType>(url: string, searchParams?: ObjectDataType, pageParams?: PageQueryType, method?: RequestMethod, alias?: Partial<PageAlias>, config?: ObrAxiosRequestConfig): Promise<PageResType<R>>;
55
+ /**
56
+ * @description: 获取options类型数据(下拉选择/字典等)
57
+ * @param {string} url
58
+ * @param {ObjectDataType} params
59
+ * @param {RequestMethod} method
60
+ * @param {Partial} alias alias.label可设置为模板 #{name}/#{no} 从模板中获取
61
+ * @param {ObrAxiosRequestConfig} config
62
+ * @param {boolean} unique
63
+ * @return {Promise<BaseOptionType<T>[]>}
64
+ * @autor: 刘 相卿
65
+ */
66
+ getOptions<T = ObjectDataType>(url: string, params?: ObjectDataType, method?: RequestMethod, alias?: Partial<OptionResAlias>, config?: ObrAxiosRequestConfig, unique?: boolean): Promise<BaseOptionType<T>[]>;
67
+ /**
68
+ * @description: 获取级联类型数据(谨慎使用!!! 会发起大量请求!!!)
69
+ * @param {CascaderRequestOption} options 级联请求配置项
70
+ * @param {ObjectDataType} params 所有层级的请求参数(共用)
71
+ * @param {ObrAxiosRequestConfig} config
72
+ * @param {boolean} unique 单一层级下的去重
73
+ * @return {*}
74
+ * @autor: 刘 相卿
75
+ */
76
+ getCascaderOptions<T extends ObjectDataType = ObjectDataType>(options: CascaderRequestOption[], params?: ObjectDataType, config?: ObrAxiosRequestConfig, unique?: boolean): Promise<CascaderOptionType<T>[]>;
77
+ /**
78
+ * @description: 强制取消请求
79
+ * @param {ObrAxiosRequestConfig} config
80
+ * @return {*}
81
+ * @autor: 刘 相卿
82
+ */
83
+ cancel(config: ObrAxiosRequestConfig): void;
84
+ /**
85
+ * @description: request请求
86
+ * @param {ObrAxiosRequestConfig} config
87
+ * @return {Promise<ResDataType<T>>}
88
+ * @autor: 刘 相卿
89
+ */
90
+ request<T = any>(config: ObrAxiosRequestConfig): Promise<ResDataType<T>>;
91
+ /**
92
+ * @description: 取消所有请求并销毁axios实例
93
+ * @return {*}
94
+ * @autor: 刘 相卿
95
+ */
96
+ destory(): void;
97
+ }
98
+
99
+ export { ObrRequest };
@@ -0,0 +1 @@
1
+ "use strict";var ce=Object.create;var D=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var ye=(e,t)=>{for(var n in t)D(e,n,{get:t[n],enumerable:!0})},L=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ue(t))!fe.call(e,a)&&a!==n&&D(e,a,{get:()=>t[a],enumerable:!(r=pe(t,a))||r.enumerable});return e};var V=(e,t,n)=>(n=e!=null?ce(le(e)):{},L(t||!e||!e.__esModule?D(n,"default",{value:e,enumerable:!0}):n,e)),me=e=>L(D({},"__esModule",{value:!0}),e);var Oe={};ye(Oe,{ObrRequest:()=>U});module.exports=me(Oe);var S=V(require("axios"));var u=require("es-toolkit/compat");var M=require("es-toolkit/compat");var x=e=>typeof e=="string",A=e=>typeof e=="number";function $(e){return typeof e=="boolean"}var b=e=>Array.isArray(e);var C=e=>Object.prototype.toString.call(e)==="[object Object]",g=e=>Object.prototype.toString.call(e)==="[object Object]";function m(e){return e==null||e===""||typeof e=="number"&&Number.isNaN(e)}function w(e=[]){return Array.isArray(e)&&!e.length}function _(e,t=[],n){if(e==null)return n||e;let a=Object.getOwnPropertyNames(e).reduce((s,o)=>(t.includes(o)||(s[o]=e[o]),s),{});return Object.assign(a,n)}function F(e={}){let t=new FormData;return Object.entries(e).forEach(([n,r])=>{t.append(n,r)}),t}var R={data:"data",code:"code",msg:"msg"},Q={label:"label",value:"value",json:"json",disabled:"disabled",children:"children"},k={pageSize:"pageSize",pageNo:"pageNo",total:"total",records:"records"},K={baseURL:"",timeout:60*1e3,basePath:"",allowCancel:!1,allowNullValue:!0,successCode:[200],unauthorizedCode:[401],whiteUrl:()=>[],alias:()=>R,token:{key:"x-access-token",get:()=>""}};var z=V(require("axios")),T=new Map;function G(e){let{url:t,method:n,params:r,data:a,headers:s}=e,o=a,c=r;typeof a=="string"&&(o=JSON.parse(a)),typeof r=="string"&&(c=JSON.parse(r));let i=[],y=s?.["X-Cancel-Rule"];return y==="path"?i=[`\u8BF7\u6C42\u8DEF\u5F84:${t}`]:y==="method"?i=[`\u8BF7\u6C42\u8DEF\u5F84:${t}`,`\u8BF7\u6C42\u65B9\u6CD5:${n}`]:i=[`\u8BF7\u6C42\u8DEF\u5F84:${t}`,`\u8BF7\u6C42\u65B9\u6CD5:${n}`,`\u8BF7\u6C42PARAMS:${JSON.stringify(c)}`,`\u8BF7\u6C42DATA:${JSON.stringify(o)}`],i.join(";")}function H(e){if(!e.headers?.neverCancel){let t=G(e);e.cancelToken=new z.default.CancelToken(n=>{T.has(t)||T.set(t,n)})}}function O(e,t=!1){if(!e.headers?.["X-Never-Cancel"]||t){let n=G(e);if(T.has(n)){let r=T.get(n);r&&r(n),T.delete(n)}}}function P(){Array.from(T.keys()).forEach(e=>{T.get(e)&&T.get(e)(e),T.delete(e)})}function J(e){return new Promise(t=>{let n={code:200,data:e,msg:""};if(e.type!=="application/json")t(n);else{let r=new FileReader;r.readAsText(e),r.onloadend=()=>{n=JSON.parse(r.result),t(n)}}})}var E=require("es-toolkit/compat");function N(e){return e.filter(t=>!m(t))}function X(e=[],t="children",n=!1){let r=[],a=(s,o)=>{s.forEach(c=>{let{[o]:i,...y}=c;n?r.push(c):r.push(y),i&&a(i,o)})};return a(e,t),r}function W(e,t){return e.reduce((r,a)=>(r.find(o=>t.every(c=>o[c]===a[c]))||r.push(a),r),[])}function Y(e,t={},n){let{prefix:r="#{",suffix:a="}",defaultValue:s=""}=n??{};if(typeof e!="string")return String(e);if(!t||typeof t!="object")return e;let o=f=>f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=o(r),i=o(a),y=new RegExp(`${c}([^${i}]+)${i}`,"g");return e.replace(y,(f,l)=>{let p=t[l];return m(p)?String(m(s)?"":s):String(p)})}function Z(e={}){return Object.keys(e).sort().reduce((n,r)=>(n[r]=e[r],n),{})}function ee(e={}){return Object.keys(e).reduce((t,n)=>{let r=e[n];return m(r)||(A(r)&&String(r).length>=15?t[n]=String(r):t[n]=r),t},{})}function j(e,t=R){let{code:n="code",data:r="data",msg:a="msg"}=t;return{data:e[r],msg:e[a],code:e[n]}}function q(e,t=Q,n=!0){let{label:r="label",value:a="value",json:s="json",disabled:o="disabled",children:c="children"}=t,i=e;e.some(l=>C(l)&&Object.keys(l).includes(c))&&(i=X(e,c));let f=i.reduce((l,p)=>{if(C(p)){let d=r.includes("#{")?r:`#{${r}}`,ie={label:Y(d,p,{prefix:"#{",suffix:"}"}),value:(0,E.get)(p,a),disabled:(0,E.get)(p,o)??!1,json:(0,E.get)(p,s)??p};l.push(ie)}else(A(p)||x(p)||$(p))&&l.push({label:p,value:p,json:{}});return l},[]);return n?W(f,["value"]):f}function v(e={pageSize:10,pageNo:1},t=k){return Object.keys(e).reduce((n,r)=>(n[t[r]]=e[r],n),{})}function te(e,t=k){let{records:n="records",total:r="total"}=t;return{records:e[n]??[],total:e[r]??0}}function B(e){let t=N([e].flat());return w(t)?[200]:t}function I(e){let t=N([e].flat());return w(t)?[401]:t}var ne=new Map;function Te(e){let t={},n=e.split("?")[1];return n&&n.split("&").forEach(r=>{let[a="",s=""]=r.split("=");t[a]=s}),t}function re(e,t){ne.get(401)&&!t.whiteUrl?.().includes(e.url??"")&&O(e,!0);let n=(0,u.merge)({},e),[r=""]=(n.url??"").split("?"),a=Z((0,u.merge)({},Te(n.url??""),n.params));t.allowNullValue||(a=ee(a)),n.url=r,n.params=a,n.headers?.["Content-Type"]||(0,u.merge)(n.headers,{"Content-Type":"application/json;charset=utf-8"});let{token:s}=t;if(s?.key&&s.get()){let o={[s.key]:s.get()};(0,u.merge)(n.headers,o)}else s?.key&&n.headers&&Reflect.deleteProperty(n.headers,s.key);return t.allowCancel&&(O(n),H(n)),t.beforeRequest?t.beforeRequest(n):n}function h(e){if(e.type==="REQUEST"&&I(e.options.unauthorizedCode).includes(e.content.code)){if(P(),e.options[401])return e.options[401](e)}else{if(e.type==="CANCEL"&&e.options.cancel)return e.options.cancel(e);if(e.options.error)return e.options.error(e)}return Promise.reject(e)}async function ae(e,t){let{data:n,config:r}=e,a=n,s=r;if(t.afterRequest){let{data:c,config:i}=t.afterRequest(e,t);a=c,s=i}let o=(0,u.merge)({},R,t.alias?.());if(O(e.config),I(t.unauthorizedCode).includes(a[o.code]))return h({type:"REQUEST",content:j(a,o),options:t,response:e});if(ne.delete(401),s.responseType==="blob"){let c=await J(a);return B(t.successCode).includes(c.code)?j(c):h({type:"REQUEST",content:c,options:t,response:e})}else return B(t.successCode).includes(a[o.code])?Promise.resolve(j(a,o)):h({type:"REQUEST",content:j(a,o),options:t,response:e})}var se=require("es-toolkit/compat");function ge(e,t){return t==="toArray"?b(e)?e:[e].flat().filter(n=>!m(n)):t==="toNumber"?x(e)?Number(e):e:t==="toString"?b(e)?e.join(","):String(e):e}function be(e,t={}){let n;for(let r of e)if(n=(r.path?(0,se.get)(t,r.path):r.defaultValue)??r.defaultValue,r.formatter&&(n=ge(n,r.formatter)),!m(n))break;return n}function oe(e=[],t={}){let n={};for(let r of e)if(n=n===null?{}:n,r.required&&(!r.key||!r.source.length)){n=null;break}else if(r.key&&r.source.length){let a=be(r.source,t);if(r.required&&m(a)){n=null;break}else if(r.toValue){if(n=a,!g(n))break}else g(n)&&(n[r.key]=a)}return n}var U=class{options;instance;constructor(t){this.options=(0,u.merge)({},K,t),this.instance=this.setupInterceptors(this.options)}setupInterceptors(t){let n=S.default.create(_(t,["basePath","allowCancel","allowNullValue","successCode","unauthorizedCode","whiteUrl","alias","token","beforeRequest","afterRequest",401,"cancel","error"]));return n.interceptors.request.use(r=>re(r,this.options)),n.interceptors.response.use(r=>ae(r,this.options),r=>h({type:(0,S.isCancel)(r)?"CANCEL":"ERROR",content:r,options:this.options})),n}fetchLocalFile(t){return fetch((this.options.basePath??"")+t)}async get(t,n={},r){let{data:a}=await this.instance.get(t,{...r,params:n});return a}async post(t,n={},r){let{data:a}=await this.instance.post(t,n,r);return a}async postForm(t,n={},r){let a=F(n),{data:s}=await this.instance.post(t,a,(0,u.merge)({},{headers:{"Content-Type":"multipart/form-data"},...r}));return s}async getPageRecords(t,n={},r={},a="GET",s,o){let c=a.toUpperCase()==="GET",i={...v(r,s),...n},{data:y}=await this.instance.request({...o,url:t,method:a,params:c?i:{...v(r,s)},data:c?{}:i});return te(y,s)}async getOptions(t,n={},r="GET",a,s,o=!0){let c=r.toUpperCase()==="GET",{data:i=[]}=await this.instance.request({...s,url:t,method:r,params:n,data:c?{}:n});if(b(i))return q(i,a,o);if(g(i)){if(Object.values(i).every(l=>b(l))){let l=Object.values(i).flat();return q(l,a,o)}let f=Object.entries(i).map(([l,p])=>({label:p,value:l}));return q(f,void 0,o)}return[]}async getCascaderOptions(t,n={},r,a=!0){if(!t.length)return[];let s=async(c,i,y={})=>{let f=c[i];if(!f?.url)return[];let l=oe(f.params,y)??{},p=(await this.getOptions(f.url,g(l)?(0,u.merge)({},n,l):l,f.method,f.alias,r,a)).map(d=>({...d,children:d.json?.children??[]}));for(let d=0;d<p.length;d++)p[d].children=await s(c,i+1,p[d].json);return p};return await s(t,0,n)}cancel(t){O(t,!0)}request(t){return this.instance.request(t)}destory(){P(),this.instance=null}};0&&(module.exports={ObrRequest});
@@ -1 +1 @@
1
- import"../base-854WVUaj.mjs";import"../lodash-iHVEJs1z.mjs";import"../object-j-lK643f.mjs";import"../array-CEhD-Z_e.mjs";import"../constant-Dxt8HuVn.mjs";import"../cancel-BV5B58Lw.mjs";import"../file-Dwobl-pF.mjs";import"../parse-C1eaIjot.mjs";import"../format-3CsgkBWg.mjs";import"../handler-N6Akxkpa.mjs";import"../params-CpjttIDa.mjs";import{t as e}from"../request-BG5UIh9R.mjs";export{e as ObrRequest};
1
+ import{a}from"../chunk-R2AK2OJS.mjs";import"../chunk-34VTCYOF.mjs";import"../chunk-UYN2YSOE.mjs";import"../chunk-44EYU7QJ.mjs";import"../chunk-BPXO4V4X.mjs";import"../chunk-SZOHVFVZ.mjs";import"../chunk-UVMLBW6A.mjs";import"../chunk-A25LR755.mjs";import"../chunk-224VP3SO.mjs";import"../chunk-3JZFB5CS.mjs";import"../chunk-A5BXGBYT.mjs";import"../chunk-HERHZLBT.mjs";export{a as ObrRequest};
@@ -1,6 +1,6 @@
1
- import { f as ObrAxiosRequestConfig } from "../../types-BEdiy6mb.mjs";
1
+ import { ObrAxiosRequestConfig } from '../../types.mjs';
2
+ import 'axios';
2
3
 
3
- //#region src/request/utils/cancel.d.ts
4
4
  declare const pendingMap: Map<any, any>;
5
5
  /**
6
6
  * @description: 添加到pending队列
@@ -19,5 +19,5 @@ declare function addPending(config: ObrAxiosRequestConfig): void;
19
19
  declare function removePending(config: ObrAxiosRequestConfig, force?: boolean): void;
20
20
  declare function removeNdAddPending(config: ObrAxiosRequestConfig): void;
21
21
  declare function removeAllPending(): void;
22
- //#endregion
23
- export { addPending, pendingMap, removeAllPending, removeNdAddPending, removePending };
22
+
23
+ export { addPending, pendingMap, removeAllPending, removeNdAddPending, removePending };
@@ -1,6 +1,6 @@
1
- import { f as ObrAxiosRequestConfig } from "../../types-DTtPjrm8.cjs";
1
+ import { ObrAxiosRequestConfig } from '../../types.js';
2
+ import 'axios';
2
3
 
3
- //#region src/request/utils/cancel.d.ts
4
4
  declare const pendingMap: Map<any, any>;
5
5
  /**
6
6
  * @description: 添加到pending队列
@@ -19,5 +19,5 @@ declare function addPending(config: ObrAxiosRequestConfig): void;
19
19
  declare function removePending(config: ObrAxiosRequestConfig, force?: boolean): void;
20
20
  declare function removeNdAddPending(config: ObrAxiosRequestConfig): void;
21
21
  declare function removeAllPending(): void;
22
- //#endregion
23
- export { addPending, pendingMap, removeAllPending, removeNdAddPending, removePending };
22
+
23
+ export { addPending, pendingMap, removeAllPending, removeNdAddPending, removePending };
@@ -0,0 +1 @@
1
+ "use strict";var x=Object.create;var a=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var v=(e,n)=>{for(var t in n)a(e,t,{get:n[t],enumerable:!0})},p=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of C(n))!O.call(e,i)&&i!==t&&a(e,i,{get:()=>n[i],enumerable:!(r=y(n,i))||r.enumerable});return e};var R=(e,n,t)=>(t=e!=null?x(h(e)):{},p(n||!e||!e.__esModule?a(t,"default",{value:e,enumerable:!0}):t,e)),$=e=>p(a({},"__esModule",{value:!0}),e);var P={};v(P,{addPending:()=>u,pendingMap:()=>o,removeAllPending:()=>N,removeNdAddPending:()=>b,removePending:()=>m});module.exports=$(P);var c=R(require("axios")),o=new Map;function g(e){let{url:n,method:t,params:r,data:i,headers:A}=e,d=i,f=r;typeof i=="string"&&(d=JSON.parse(i)),typeof r=="string"&&(f=JSON.parse(r));let s=[],l=A?.["X-Cancel-Rule"];return l==="path"?s=[`\u8BF7\u6C42\u8DEF\u5F84:${n}`]:l==="method"?s=[`\u8BF7\u6C42\u8DEF\u5F84:${n}`,`\u8BF7\u6C42\u65B9\u6CD5:${t}`]:s=[`\u8BF7\u6C42\u8DEF\u5F84:${n}`,`\u8BF7\u6C42\u65B9\u6CD5:${t}`,`\u8BF7\u6C42PARAMS:${JSON.stringify(f)}`,`\u8BF7\u6C42DATA:${JSON.stringify(d)}`],s.join(";")}function u(e){if(!e.headers?.neverCancel){let n=g(e);e.cancelToken=new c.default.CancelToken(t=>{o.has(n)||o.set(n,t)})}}function m(e,n=!1){if(!e.headers?.["X-Never-Cancel"]||n){let t=g(e);if(o.has(t)){let r=o.get(t);r&&r(t),o.delete(t)}}}function b(e){m(e),u(e)}function N(){Array.from(o.keys()).forEach(e=>{o.get(e)&&o.get(e)(e),o.delete(e)})}0&&(module.exports={addPending,pendingMap,removeAllPending,removeNdAddPending,removePending});
@@ -1 +1 @@
1
- import{a as e,i as t,n,r,t as i}from"../../cancel-BV5B58Lw.mjs";export{i as addPending,n as pendingMap,r as removeAllPending,t as removeNdAddPending,e as removePending};
1
+ import{a,b,c,d,e}from"../../chunk-44EYU7QJ.mjs";export{b as addPending,a as pendingMap,e as removeAllPending,d as removeNdAddPending,c as removePending};
@@ -1,6 +1,6 @@
1
- import { C as ResDataType } from "../../types-BEdiy6mb.mjs";
1
+ import { ResDataType } from '../../types.mjs';
2
+ import 'axios';
2
3
 
3
- //#region src/request/utils/file.d.ts
4
4
  declare function readBlobResponse(file: Blob): Promise<ResDataType>;
5
- //#endregion
6
- export { readBlobResponse };
5
+
6
+ export { readBlobResponse };
@@ -0,0 +1,6 @@
1
+ import { ResDataType } from '../../types.js';
2
+ import 'axios';
3
+
4
+ declare function readBlobResponse(file: Blob): Promise<ResDataType>;
5
+
6
+ export { readBlobResponse };
@@ -0,0 +1 @@
1
+ "use strict";var r=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var i=(t,e)=>{for(var a in e)r(t,a,{get:e[a],enumerable:!0})},l=(t,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of p(e))!d.call(t,o)&&o!==a&&r(t,o,{get:()=>e[o],enumerable:!(s=n(e,o))||s.enumerable});return t};var y=t=>l(r({},"__esModule",{value:!0}),t);var m={};i(m,{readBlobResponse:()=>R});module.exports=y(m);function R(t){return new Promise(e=>{let a={code:200,data:t,msg:""};if(t.type!=="application/json")e(a);else{let s=new FileReader;s.readAsText(t),s.onloadend=()=>{a=JSON.parse(s.result),e(a)}}})}0&&(module.exports={readBlobResponse});
@@ -1 +1 @@
1
- import{t as e}from"../../file-Dwobl-pF.mjs";export{e as readBlobResponse};
1
+ import{a}from"../../chunk-BPXO4V4X.mjs";export{a as readBlobResponse};
@@ -1,6 +1,6 @@
1
- import { C as ResDataType, S as ResAlias, _ as PageQueryType, g as PageAlias, h as OptionResAlias, t as BaseOptionType, u as ObjectDataType, v as PageResType } from "../../types-BEdiy6mb.mjs";
1
+ import { ObjectDataType, ResDataType, ResAlias, OptionResAlias, BaseOptionType, PageQueryType, PageAlias, PageResType } from '../../types.mjs';
2
+ import 'axios';
2
3
 
3
- //#region src/request/utils/format.d.ts
4
4
  declare function sort(object?: ObjectDataType): ObjectDataType<any, string>;
5
5
  declare function format(object?: ObjectDataType): ObjectDataType<any, string>;
6
6
  declare function formatData(object: ResDataType, alias?: ResAlias): ResDataType;
@@ -9,5 +9,5 @@ declare function formatPageQuery(object?: PageQueryType, alias?: Partial<PageAli
9
9
  declare function formatPageRecords<T = ObjectDataType>(data: ObjectDataType, alias?: Partial<PageAlias>): PageResType<T>;
10
10
  declare function getSuccessCode(code?: number | number[]): number[];
11
11
  declare function getUnauthorizedCode(code?: number | number[]): number[];
12
- //#endregion
13
- export { format, formatData, formatOption, formatPageQuery, formatPageRecords, getSuccessCode, getUnauthorizedCode, sort };
12
+
13
+ export { format, formatData, formatOption, formatPageQuery, formatPageRecords, getSuccessCode, getUnauthorizedCode, sort };
@@ -1,6 +1,6 @@
1
- import { C as ResDataType, S as ResAlias, _ as PageQueryType, g as PageAlias, h as OptionResAlias, t as BaseOptionType, u as ObjectDataType, v as PageResType } from "../../types-DTtPjrm8.cjs";
1
+ import { ObjectDataType, ResDataType, ResAlias, OptionResAlias, BaseOptionType, PageQueryType, PageAlias, PageResType } from '../../types.js';
2
+ import 'axios';
2
3
 
3
- //#region src/request/utils/format.d.ts
4
4
  declare function sort(object?: ObjectDataType): ObjectDataType<any, string>;
5
5
  declare function format(object?: ObjectDataType): ObjectDataType<any, string>;
6
6
  declare function formatData(object: ResDataType, alias?: ResAlias): ResDataType;
@@ -9,5 +9,5 @@ declare function formatPageQuery(object?: PageQueryType, alias?: Partial<PageAli
9
9
  declare function formatPageRecords<T = ObjectDataType>(data: ObjectDataType, alias?: Partial<PageAlias>): PageResType<T>;
10
10
  declare function getSuccessCode(code?: number | number[]): number[];
11
11
  declare function getUnauthorizedCode(code?: number | number[]): number[];
12
- //#endregion
13
- export { format, formatData, formatOption, formatPageQuery, formatPageRecords, getSuccessCode, getUnauthorizedCode, sort };
12
+
13
+ export { format, formatData, formatOption, formatPageQuery, formatPageRecords, getSuccessCode, getUnauthorizedCode, sort };
@@ -0,0 +1 @@
1
+ "use strict";var d=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var I=(e,t)=>{for(var r in t)d(e,r,{get:t[r],enumerable:!0})},L=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of C(t))!B.call(e,a)&&a!==r&&d(e,a,{get:()=>t[a],enumerable:!(n=v(t,a))||n.enumerable});return e};var _=e=>L(d({},"__esModule",{value:!0}),e);var J={};I(J,{format:()=>V,formatData:()=>F,formatOption:()=>K,formatPageQuery:()=>M,formatPageRecords:()=>q,getSuccessCode:()=>z,getUnauthorizedCode:()=>Q,sort:()=>U});module.exports=_(J);var g=require("es-toolkit/compat");var O={data:"data",code:"code",msg:"msg"},R={label:"label",value:"value",json:"json",disabled:"disabled",children:"children"},x={pageSize:"pageSize",pageNo:"pageNo",total:"total",records:"records"},H={baseURL:"",timeout:60*1e3,basePath:"",allowCancel:!1,allowNullValue:!0,successCode:[200],unauthorizedCode:[401],whiteUrl:()=>[],alias:()=>O,token:{key:"x-access-token",get:()=>""}};var j=e=>typeof e=="string",b=e=>typeof e=="number";function A(e){return typeof e=="boolean"}var m=e=>Object.prototype.toString.call(e)==="[object Object]";function l(e){return e==null||e===""||typeof e=="number"&&Number.isNaN(e)}function D(e=[]){return Array.isArray(e)&&!e.length}var i=require("es-toolkit/compat");var E=require("es-toolkit/compat");function h(e){return e.filter(t=>!l(t))}function S(e=[],t="children",r=!1){let n=[],a=(y,c)=>{y.forEach(s=>{let{[c]:p,...T}=s;r?n.push(s):n.push(T),p&&a(p,c)})};return a(e,t),n}function k(e,t){return e.reduce((n,a)=>(n.find(c=>t.every(s=>c[s]===a[s]))||n.push(a),n),[])}function N(e,t={},r){let{prefix:n="#{",suffix:a="}",defaultValue:y=""}=r??{};if(typeof e!="string")return String(e);if(!t||typeof t!="object")return e;let c=f=>f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=c(n),p=c(a),T=new RegExp(`${s}([^${p}]+)${p}`,"g");return e.replace(T,(f,u)=>{let o=t[u];return l(o)?String(l(y)?"":y):String(o)})}function U(e={}){return Object.keys(e).sort().reduce((r,n)=>(r[n]=e[n],r),{})}function V(e={}){return Object.keys(e).reduce((t,r)=>{let n=e[r];return l(n)||(b(n)&&String(n).length>=15?t[r]=String(n):t[r]=n),t},{})}function F(e,t=O){let{code:r="code",data:n="data",msg:a="msg"}=t;return{data:e[n],msg:e[a],code:e[r]}}function K(e,t=R,r=!0){let{label:n="label",value:a="value",json:y="json",disabled:c="disabled",children:s="children"}=t,p=e;e.some(u=>m(u)&&Object.keys(u).includes(s))&&(p=S(e,s));let f=p.reduce((u,o)=>{if(m(o)){let w=n.includes("#{")?n:`#{${n}}`,P={label:N(w,o,{prefix:"#{",suffix:"}"}),value:(0,g.get)(o,a),disabled:(0,g.get)(o,c)??!1,json:(0,g.get)(o,y)??o};u.push(P)}else(b(o)||j(o)||A(o))&&u.push({label:o,value:o,json:{}});return u},[]);return r?k(f,["value"]):f}function M(e={pageSize:10,pageNo:1},t=x){return Object.keys(e).reduce((r,n)=>(r[t[n]]=e[n],r),{})}function q(e,t=x){let{records:r="records",total:n="total"}=t;return{records:e[r]??[],total:e[n]??0}}function z(e){let t=h([e].flat());return D(t)?[200]:t}function Q(e){let t=h([e].flat());return D(t)?[401]:t}0&&(module.exports={format,formatData,formatOption,formatPageQuery,formatPageRecords,getSuccessCode,getUnauthorizedCode,sort});
@@ -1 +1 @@
1
- import"../../base-854WVUaj.mjs";import"../../lodash-iHVEJs1z.mjs";import"../../object-j-lK643f.mjs";import"../../array-CEhD-Z_e.mjs";import"../../constant-Dxt8HuVn.mjs";import"../../parse-C1eaIjot.mjs";import{a as e,c as t,i as n,n as r,o as i,r as a,s as o,t as s}from"../../format-3CsgkBWg.mjs";export{s as format,r as formatData,a as formatOption,n as formatPageQuery,e as formatPageRecords,i as getSuccessCode,o as getUnauthorizedCode,t as sort};
1
+ import{a,b,c,d,e,f,g,h}from"../../chunk-SZOHVFVZ.mjs";import"../../chunk-UVMLBW6A.mjs";import"../../chunk-A25LR755.mjs";import"../../chunk-224VP3SO.mjs";import"../../chunk-3JZFB5CS.mjs";import"../../chunk-A5BXGBYT.mjs";import"../../chunk-HERHZLBT.mjs";export{b as format,c as formatData,d as formatOption,e as formatPageQuery,f as formatPageRecords,g as getSuccessCode,h as getUnauthorizedCode,a as sort};
@@ -1,6 +1,6 @@
1
- import { u as ObjectDataType, x as RequestParamConfig } from "../../types-BEdiy6mb.mjs";
1
+ import { RequestParamConfig, ObjectDataType } from '../../types.mjs';
2
+ import 'axios';
2
3
 
3
- //#region src/request/utils/params.d.ts
4
4
  declare function getRequestParamValues(params?: RequestParamConfig[], data?: ObjectDataType): any[] | ObjectDataType | null;
5
- //#endregion
6
- export { getRequestParamValues };
5
+
6
+ export { getRequestParamValues };
@@ -0,0 +1,6 @@
1
+ import { RequestParamConfig, ObjectDataType } from '../../types.js';
2
+ import 'axios';
3
+
4
+ declare function getRequestParamValues(params?: RequestParamConfig[], data?: ObjectDataType): any[] | ObjectDataType | null;
5
+
6
+ export { getRequestParamValues };
@@ -0,0 +1 @@
1
+ "use strict";var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var b=(t,r)=>{for(var e in r)s(t,e,{get:r[e],enumerable:!0})},g=(t,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of f(r))!y.call(t,o)&&o!==e&&s(t,o,{get:()=>r[o],enumerable:!(n=l(r,o))||n.enumerable});return t};var m=t=>g(s({},"__esModule",{value:!0}),t);var O={};b(O,{getRequestParamValues:()=>T});module.exports=m(O);var p=require("es-toolkit/compat");var c=t=>typeof t=="string";var a=t=>Array.isArray(t);var u=t=>Object.prototype.toString.call(t)==="[object Object]";function i(t){return t==null||t===""||typeof t=="number"&&Number.isNaN(t)}function x(t,r){return r==="toArray"?a(t)?t:[t].flat().filter(e=>!i(e)):r==="toNumber"?c(t)?Number(t):t:r==="toString"?a(t)?t.join(","):String(t):t}function j(t,r={}){let e;for(let n of t)if(e=(n.path?(0,p.get)(r,n.path):n.defaultValue)??n.defaultValue,n.formatter&&(e=x(e,n.formatter)),!i(e))break;return e}function T(t=[],r={}){let e={};for(let n of t)if(e=e===null?{}:e,n.required&&(!n.key||!n.source.length)){e=null;break}else if(n.key&&n.source.length){let o=j(n.source,r);if(n.required&&i(o)){e=null;break}else if(n.toValue){if(e=o,!u(e))break}else u(e)&&(e[n.key]=o)}return e}0&&(module.exports={getRequestParamValues});
@@ -1 +1 @@
1
- import"../../base-854WVUaj.mjs";import{t as e}from"../../params-CpjttIDa.mjs";export{e as getRequestParamValues};
1
+ import{a}from"../../chunk-34VTCYOF.mjs";import"../../chunk-A5BXGBYT.mjs";export{a as getRequestParamValues};
@@ -1,2 +1,9 @@
1
- import { n as safeNextick, t as delayTimer } from "./safe-next-tick-DlJsO1Ha.mjs";
2
- export { delayTimer, safeNextick };
1
+ declare function delayTimer(delay?: number): Promise<unknown>;
2
+ declare function safeNextick(fn?: () => void, option?: {
3
+ delay: number;
4
+ }): void;
5
+ declare function safeNextick(fn?: () => void, option?: {
6
+ delay: number;
7
+ }): Promise<void>;
8
+
9
+ export { delayTimer, safeNextick };
@@ -1,10 +1,9 @@
1
- //#region src/safe-next-tick.d.ts
2
1
  declare function delayTimer(delay?: number): Promise<unknown>;
3
2
  declare function safeNextick(fn?: () => void, option?: {
4
- delay: number;
3
+ delay: number;
5
4
  }): void;
6
5
  declare function safeNextick(fn?: () => void, option?: {
7
- delay: number;
6
+ delay: number;
8
7
  }): Promise<void>;
9
- //#endregion
10
- export { safeNextick as n, delayTimer as t };
8
+
9
+ export { delayTimer, safeNextick };
@@ -0,0 +1 @@
1
+ "use strict";var o=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var l=(t,n)=>{for(var e in n)o(t,e,{get:n[e],enumerable:!0})},y=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of u(n))!p.call(t,r)&&r!==e&&o(t,r,{get:()=>n[r],enumerable:!(i=c(n,r))||i.enumerable});return t};var f=t=>y(o({},"__esModule",{value:!0}),t);var g={};l(g,{delayTimer:()=>a,safeNextick:()=>b});module.exports=f(g);var s=t=>typeof t=="function";async function a(t=0){return new Promise(n=>{let e=setTimeout(()=>{n(!0),clearTimeout(e)},t)})}async function b(t,n){await a(n?.delay),t&&s(t)&&t()}0&&(module.exports={delayTimer,safeNextick});
@@ -1 +1 @@
1
- import"./base-854WVUaj.mjs";import{n as e,t}from"./safe-next-tick-Cc30ZlUX.mjs";export{t as delayTimer,e as safeNextick};
1
+ import{a,b}from"./chunk-7YMDSJIW.mjs";import"./chunk-A5BXGBYT.mjs";export{a as delayTimer,b as safeNextick};
package/dist/types.d.mts CHANGED
@@ -1,2 +1,207 @@
1
- import { C as ResDataType, S as ResAlias, T as TreeItemType, _ as PageQueryType, a as ErrorContentObject, b as RequestMethod, c as HeadersType, d as ObrAxiosInstance, f as ObrAxiosRequestConfig, g as PageAlias, h as OptionResAlias, i as DataType, l as MappingType, m as ObrAxiosStatic, n as CascaderOptionType, o as ErrorType, p as ObrAxiosResponse, r as CascaderRequestOption, s as ErrorTypeKey, t as BaseOptionType, u as ObjectDataType, v as PageResType, w as TokenConfig, x as RequestParamConfig, y as RequestBaseConfig } from "./types-BEdiy6mb.mjs";
2
- export { BaseOptionType, CascaderOptionType, CascaderRequestOption, DataType, ErrorContentObject, ErrorType, ErrorTypeKey, HeadersType, MappingType, ObjectDataType, ObrAxiosInstance, ObrAxiosRequestConfig, ObrAxiosResponse, ObrAxiosStatic, OptionResAlias, PageAlias, PageQueryType, PageResType, RequestBaseConfig, RequestMethod, RequestParamConfig, ResAlias, ResDataType, TokenConfig, TreeItemType };
1
+ import { AxiosRequestConfig, AxiosResponse, CanceledError, AxiosError, Method, AxiosStatic, CreateAxiosDefaults, AxiosInstance, AxiosInterceptorManager } from 'axios';
2
+
3
+ type ObjectDataType<T = any, D extends string = string> = Record<D, T>;
4
+ /**
5
+ * @description: 树形结构数据类型
6
+ * @autor: 刘 相卿
7
+ */
8
+ interface TreeItemType extends ObjectDataType {
9
+ label?: string;
10
+ children?: TreeItemType[];
11
+ }
12
+ /**
13
+ * @description: 数据类型
14
+ * @autor: 刘 相卿
15
+ */
16
+ type DataType = 'set' | 'map' | 'function' | 'object' | 'array' | 'undefined' | 'null' | 'number' | 'symbol' | 'string' | 'boolean' | 'regexp' | 'date' | 'bigint' | 'blob' | 'formdata';
17
+ interface MappingType {
18
+ [x: string | number]: any;
19
+ default: any;
20
+ }
21
+ interface BaseOptionType<T = ObjectDataType> extends ObjectDataType {
22
+ label: string;
23
+ value: any;
24
+ disabled?: boolean;
25
+ json?: T;
26
+ children?: BaseOptionType<T>[];
27
+ }
28
+ interface OptionResAlias {
29
+ label: string;
30
+ value: string;
31
+ disabled: string;
32
+ children: string;
33
+ json: string;
34
+ }
35
+ interface CascaderRequestOption {
36
+ url: string;
37
+ method?: Method;
38
+ params?: RequestParamConfig[];
39
+ alias?: Partial<Omit<OptionResAlias, 'json'>>;
40
+ }
41
+ interface CascaderOptionType<T extends ObjectDataType = ObjectDataType> {
42
+ label: string;
43
+ value: any;
44
+ disabled?: boolean;
45
+ json?: T;
46
+ children?: CascaderOptionType<T>[];
47
+ }
48
+ /**
49
+ * @description: Token配置类型
50
+ * @param {string} key token的键名称
51
+ * @param {() => string} get 获取token的方法
52
+ * @autor: 刘 相卿
53
+ */
54
+ interface TokenConfig {
55
+ key: string;
56
+ get: () => string;
57
+ }
58
+ /**
59
+ * @description: header配置
60
+ * @param {boolean} `X-Never-Cancel` 是否永远不取消该请求
61
+ * @param {'path' | 'method' | 'params'} `X-Cancel-Rule` 取消规则(path: 同一路径; method: 同一路径+请求方法; params: 同一路径+请求方法+参数)
62
+ * @param {boolean} `X-Hide-Message` 是否隐藏请求消息提示
63
+ * @autor: 刘 相卿
64
+ */
65
+ interface HeadersType {
66
+ 'X-Never-Cancel'?: boolean;
67
+ 'X-Cancel-Rule'?: 'path' | 'method' | 'params';
68
+ 'X-Hide-Message'?: boolean;
69
+ }
70
+ interface ObrAxiosRequestConfig<D = any> extends AxiosRequestConfig<D> {
71
+ headers?: AxiosRequestConfig['headers'] & HeadersType;
72
+ }
73
+ interface ObrAxiosResponse<T = any> extends Omit<AxiosResponse<T>, 'data'> {
74
+ data: ResDataType<T>;
75
+ }
76
+ interface ObrAxiosStatic extends Omit<AxiosStatic, 'create'> {
77
+ create: (config?: CreateAxiosDefaults) => ObrAxiosInstance;
78
+ }
79
+ interface ObrAxiosInstance extends Pick<AxiosInstance, 'defaults'> {
80
+ interceptors: {
81
+ request: AxiosInterceptorManager<ObrAxiosRequestConfig>;
82
+ response: AxiosInterceptorManager<ObrAxiosResponse<ResDataType>>;
83
+ };
84
+ <T = any, D = any>(config: AxiosRequestConfig<D>): Promise<ResDataType<T>>;
85
+ <T = any, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<ResDataType<T>>;
86
+ getUri: (config?: ObrAxiosRequestConfig) => string;
87
+ request: <T = any>(config: ObrAxiosRequestConfig) => Promise<ResDataType<T>>;
88
+ get: <T = any>(url: string, config?: ObrAxiosRequestConfig) => Promise<ResDataType<T>>;
89
+ delete: <T = any>(url: string, config?: ObrAxiosRequestConfig) => Promise<ResDataType<T>>;
90
+ head: <T = any>(url: string, config?: ObrAxiosRequestConfig) => Promise<ResDataType<T>>;
91
+ options: <T = any>(url: string, config?: ObrAxiosRequestConfig) => Promise<ResDataType<T>>;
92
+ post: <T = any, D = any>(url: string, data?: D, config?: ObrAxiosRequestConfig) => Promise<ResDataType<T>>;
93
+ put: <T = any, D = any>(url: string, data?: D, config?: ObrAxiosRequestConfig) => Promise<ResDataType<T>>;
94
+ postForm: <T = any, D = any>(url: string, data?: D, config?: ObrAxiosRequestConfig) => Promise<ResDataType<T>>;
95
+ putForm: <T = any, D = any>(url: string, data?: D, config?: ObrAxiosRequestConfig) => Promise<ResDataType<T>>;
96
+ patch: <T = any, D = any>(url: string, data?: D, config?: ObrAxiosRequestConfig) => Promise<ResDataType<T>>;
97
+ patchForm: <T = any, D = any>(url: string, data?: D, config?: ObrAxiosRequestConfig) => Promise<ResDataType<T>>;
98
+ }
99
+ /**
100
+ * @description: 响应字段别名
101
+ * @param {string} code 响应code别名
102
+ * @param {string} data 响应数据别名
103
+ * @param {string} msg 响应消息提示别名
104
+ * @autor: 刘 相卿
105
+ */
106
+ interface ResAlias {
107
+ code: string;
108
+ data: string;
109
+ msg: string;
110
+ }
111
+ interface PageAlias {
112
+ records: string;
113
+ total: string;
114
+ pageSize: string;
115
+ pageNo: string;
116
+ }
117
+ /**
118
+ * @description: 响应数据类型
119
+ * @param {number} code 响应code
120
+ * @param {T} data 响应数据
121
+ * @param {string} msg 响应消息提示
122
+ * @autor: 刘 相卿
123
+ */
124
+ interface ResDataType<T = any> extends ObjectDataType {
125
+ code: number;
126
+ data: T;
127
+ msg: string;
128
+ }
129
+ /**
130
+ * @description: 分页接口响应数据
131
+ * @param {R[]} records 分页数据
132
+ * @param {number} total 分页总数
133
+ * @autor: 刘 相卿
134
+ */
135
+ interface PageResType<R = ObjectDataType> {
136
+ records: R[];
137
+ total: number;
138
+ }
139
+ /**
140
+ * @description: 错误消息类型
141
+ * @param {number} type 错误类型
142
+ * @param {T} error 错误数据
143
+ * @autor: 刘 相卿
144
+ */
145
+ interface ErrorContentObject {
146
+ REQUEST: {
147
+ type: 'REQUEST';
148
+ content: ResDataType;
149
+ };
150
+ CANCEL: {
151
+ type: 'CANCEL';
152
+ content: CanceledError<any>;
153
+ };
154
+ ERROR: {
155
+ type: 'ERROR';
156
+ content: AxiosError<any>;
157
+ };
158
+ }
159
+ interface ErrorBasicType {
160
+ options: RequestBaseConfig;
161
+ response?: ObrAxiosResponse<ResDataType>;
162
+ }
163
+ type ErrorTypeKey = keyof ErrorContentObject;
164
+ type ErrorType<T extends ErrorTypeKey = ErrorTypeKey> = ErrorBasicType & ErrorContentObject[T];
165
+ /**
166
+ * @description: 分页查询请求参数
167
+ * @param {number} pageSize 分页大小 = 10
168
+ * @param {number} pageNo 分页页码 = 1
169
+ * @autor: 刘 相卿
170
+ */
171
+ interface PageQueryType {
172
+ pageSize?: number;
173
+ pageNo?: number;
174
+ }
175
+ interface RequestBaseConfig extends AxiosRequestConfig {
176
+ basePath?: string;
177
+ allowCancel?: boolean;
178
+ allowNullValue?: boolean;
179
+ successCode?: number | number[];
180
+ unauthorizedCode?: number | number[];
181
+ whiteUrl?: () => string[];
182
+ alias?: () => Partial<ResAlias>;
183
+ token?: TokenConfig;
184
+ beforeRequest?: (config: ObrAxiosRequestConfig) => ObrAxiosRequestConfig;
185
+ afterRequest?: (response: ObrAxiosResponse<ResDataType>, options: RequestBaseConfig) => ObrAxiosResponse<ResDataType>;
186
+ 401?: (error: ErrorType<'REQUEST'>) => any;
187
+ cancel?: (error: ErrorType<'CANCEL'>) => any;
188
+ error?: (error: ErrorType) => any;
189
+ }
190
+ type RequestMethod = Method;
191
+ /**
192
+ * @description: 请求参数配置
193
+ * @return {*}
194
+ * @autor: 刘 相卿
195
+ */
196
+ interface RequestParamConfig {
197
+ key: string;
198
+ required?: boolean;
199
+ toValue?: boolean;
200
+ source: {
201
+ path?: string;
202
+ defaultValue?: any;
203
+ formatter?: 'toArray' | 'toString' | 'toNumber';
204
+ }[];
205
+ }
206
+
207
+ export type { BaseOptionType, CascaderOptionType, CascaderRequestOption, DataType, ErrorContentObject, ErrorType, ErrorTypeKey, HeadersType, MappingType, ObjectDataType, ObrAxiosInstance, ObrAxiosRequestConfig, ObrAxiosResponse, ObrAxiosStatic, OptionResAlias, PageAlias, PageQueryType, PageResType, RequestBaseConfig, RequestMethod, RequestParamConfig, ResAlias, ResDataType, TokenConfig, TreeItemType };