@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.
- package/dist/array.d.mts +98 -3
- package/dist/{array-CiSUhZCW.d.mts → array.d.ts} +8 -9
- package/dist/array.js +1 -0
- package/dist/array.mjs +1 -1
- package/dist/base.d.mts +192 -3
- package/dist/{base-BXKvmcaf.d.cts → base.d.ts} +4 -5
- package/dist/base.js +1 -0
- package/dist/base.mjs +1 -1
- package/dist/chunk-224VP3SO.mjs +1 -0
- package/dist/chunk-34VTCYOF.mjs +1 -0
- package/dist/chunk-3EVCK72A.mjs +1 -0
- package/dist/chunk-3JZFB5CS.mjs +1 -0
- package/dist/chunk-44EYU7QJ.mjs +1 -0
- package/dist/chunk-4JPCGRPU.mjs +1 -0
- package/dist/chunk-6DX7ZFGR.mjs +1 -0
- package/dist/chunk-7YMDSJIW.mjs +1 -0
- package/dist/chunk-A25LR755.mjs +1 -0
- package/dist/chunk-A5BXGBYT.mjs +1 -0
- package/dist/chunk-BEM6E7R7.mjs +1 -0
- package/dist/chunk-BPXO4V4X.mjs +1 -0
- package/dist/chunk-CJW7PR5X.mjs +1 -0
- package/dist/chunk-DDHFJKTT.mjs +1 -0
- package/dist/chunk-DKKF6DRJ.mjs +1 -0
- package/dist/chunk-DVMX6FDA.mjs +1 -0
- package/dist/chunk-E4SEMOGO.mjs +1 -0
- package/dist/chunk-EUDEMS67.mjs +1 -0
- package/dist/chunk-G6NAYP42.mjs +1 -0
- package/dist/chunk-HERHZLBT.mjs +1 -0
- package/dist/chunk-HOXWKSQ2.mjs +1 -0
- package/dist/chunk-INFFTHYR.mjs +1 -0
- package/dist/chunk-IZHCWZIN.mjs +1 -0
- package/dist/chunk-KGXCJWE5.mjs +1 -0
- package/dist/chunk-MQBXN7R5.mjs +1 -0
- package/dist/chunk-MUUIQW2M.mjs +1 -0
- package/dist/chunk-NX2HGAYK.mjs +1 -0
- package/dist/chunk-PE3DNHCL.mjs +1 -0
- package/dist/chunk-PK5CYIDE.mjs +1 -0
- package/dist/chunk-R2AK2OJS.mjs +1 -0
- package/dist/chunk-SAXMBV46.mjs +1 -0
- package/dist/chunk-SZOHVFVZ.mjs +1 -0
- package/dist/chunk-TQ5GXPYB.mjs +1 -0
- package/dist/chunk-UVMLBW6A.mjs +1 -0
- package/dist/chunk-UYN2YSOE.mjs +1 -0
- package/dist/chunk-WN7L4HYY.mjs +1 -0
- package/dist/chunk-X7TUTCBW.mjs +1 -0
- package/dist/chunk-YA66RVVU.mjs +1 -0
- package/dist/clipboard.d.mts +3 -2
- package/dist/clipboard.d.ts +3 -0
- package/dist/clipboard.js +1 -0
- package/dist/clipboard.mjs +1 -1
- package/dist/dayjs.d.mts +29 -2
- package/dist/{dayjs-DgS65bx1.d.cts → dayjs.d.ts} +5 -6
- package/dist/dayjs.js +1 -0
- package/dist/dayjs.mjs +1 -1
- package/dist/dom/base.d.mts +24 -2
- package/dist/{base-Ca2FN16G.d.mts → dom/base.d.ts} +2 -3
- package/dist/dom/base.js +1 -0
- package/dist/dom/base.mjs +1 -1
- package/dist/dom/class.d.mts +26 -2
- package/dist/{class-Bp70Yi1y.d.cts → dom/class.d.ts} +2 -3
- package/dist/dom/class.js +1 -0
- package/dist/dom/class.mjs +1 -1
- package/dist/dom/contains.d.mts +10 -2
- package/dist/{contains-Bj-oQ7KI.d.mts → dom/contains.d.ts} +2 -3
- package/dist/dom/contains.js +1 -0
- package/dist/dom/contains.mjs +1 -1
- package/dist/dom/css.d.mts +22 -2
- package/dist/{css-5xR1zP0f.d.cts → dom/css.d.ts} +10 -11
- package/dist/dom/css.js +1 -0
- package/dist/dom/css.mjs +1 -1
- package/dist/dom/dynamic-css.d.mts +20 -2
- package/dist/{dynamic-css-CIw8ZtwR.d.cts → dom/dynamic-css.d.ts} +8 -9
- package/dist/dom/dynamic-css.js +1 -0
- package/dist/dom/dynamic-css.mjs +1 -1
- package/dist/dom/find-dom-node.d.mts +3 -2
- package/dist/dom/find-dom-node.d.ts +3 -0
- package/dist/dom/find-dom-node.js +1 -0
- package/dist/dom/find-dom-node.mjs +1 -1
- package/dist/dom/focus.d.mts +10 -2
- package/dist/{focus-BBcVAsFx.d.cts → dom/focus.d.ts} +2 -3
- package/dist/dom/focus.js +1 -0
- package/dist/dom/focus.mjs +1 -1
- package/dist/dom/iframe.d.mts +57 -2
- package/dist/{iframe-CBeiHcmx.d.mts → dom/iframe.d.ts} +15 -16
- package/dist/dom/iframe.js +1 -0
- package/dist/dom/iframe.mjs +1 -1
- package/dist/dom/index.d.mts +17 -18
- package/dist/dom/index.d.ts +17 -0
- package/dist/dom/index.js +1 -0
- package/dist/dom/index.mjs +1 -1
- package/dist/dom/is-visible.d.mts +3 -2
- package/dist/dom/is-visible.d.ts +3 -0
- package/dist/dom/is-visible.js +1 -0
- package/dist/dom/is-visible.mjs +1 -1
- package/dist/dom/lib/can-use-dom.d.mts +2 -3
- package/dist/dom/lib/can-use-dom.d.ts +3 -0
- package/dist/dom/lib/can-use-dom.js +1 -0
- package/dist/dom/lib/can-use-dom.mjs +1 -1
- package/dist/dom/scrollbar.d.mts +8 -2
- package/dist/{scrollbar-B0PNF6i2.d.mts → dom/scrollbar.d.ts} +2 -3
- package/dist/dom/scrollbar.js +1 -0
- package/dist/dom/scrollbar.mjs +1 -1
- package/dist/dom/storage.d.mts +20 -3
- package/dist/{storage-DicI9wsP.d.cts → dom/storage.d.ts} +4 -5
- package/dist/dom/storage.js +1 -0
- package/dist/dom/storage.mjs +1 -1
- package/dist/dom/style-checker.d.mts +4 -2
- package/dist/{style-checker-CpyAZJew.d.cts → dom/style-checker.d.ts} +2 -3
- package/dist/dom/style-checker.js +1 -0
- package/dist/dom/style-checker.mjs +1 -1
- package/dist/dom/style-names.d.mts +3 -2
- package/dist/{style-names-ClFu2pk1.d.cts → dom/style-names.d.ts} +2 -3
- package/dist/dom/style-names.js +1 -0
- package/dist/dom/style-names.mjs +1 -1
- package/dist/dom/support.d.mts +8 -2
- package/dist/dom/support.d.ts +8 -0
- package/dist/dom/support.js +1 -0
- package/dist/dom/support.mjs +1 -1
- package/dist/dom/video.d.mts +9 -2
- package/dist/{video-Bp6NaeX6.d.cts → dom/video.d.ts} +2 -3
- package/dist/dom/video.js +1 -0
- package/dist/dom/video.mjs +1 -1
- package/dist/encrypt.d.mts +28 -2
- package/dist/{encrypt-BFDBlSX_.d.cts → encrypt.d.ts} +2 -3
- package/dist/encrypt.js +1 -0
- package/dist/encrypt.mjs +1 -1
- package/dist/file.d.mts +35 -2
- package/dist/{file-CjjpuB5u.d.cts → file.d.ts} +5 -6
- package/dist/file.js +1 -0
- package/dist/file.mjs +1 -1
- package/dist/index.d.mts +36 -44
- package/dist/index.d.ts +36 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -1
- package/dist/lodash.d.mts +1 -2
- package/dist/lodash.d.ts +1 -0
- package/dist/lodash.js +1 -0
- package/dist/lodash.mjs +1 -1
- package/dist/object.d.mts +86 -3
- package/dist/{object-CqyPehTh.d.cts → object.d.ts} +4 -5
- package/dist/object.js +1 -0
- package/dist/object.mjs +1 -1
- package/dist/other.d.mts +49 -3
- package/dist/{other-BzR4DqG0.d.cts → other.d.ts} +4 -5
- package/dist/other.js +1 -0
- package/dist/other.mjs +1 -1
- package/dist/parse.d.mts +21 -3
- package/dist/{parse-DQMRWCdz.d.mts → parse.d.ts} +7 -8
- package/dist/parse.js +1 -0
- package/dist/parse.mjs +1 -1
- package/dist/pinyin.d.mts +18 -2
- package/dist/{pinyin-C2BqrFMq.d.mts → pinyin.d.ts} +3 -5
- package/dist/pinyin.js +1 -0
- package/dist/pinyin.mjs +1 -1
- package/dist/request/constant.d.mts +4 -4
- package/dist/request/{constant.d.cts → constant.d.ts} +4 -4
- package/dist/request/constant.js +1 -0
- package/dist/request/constant.mjs +1 -1
- package/dist/request/handler.d.mts +10 -3
- package/dist/request/handler.d.ts +10 -0
- package/dist/request/handler.js +1 -0
- package/dist/request/handler.mjs +1 -1
- package/dist/request/index.d.mts +4 -6
- package/dist/request/index.d.ts +4 -0
- package/dist/request/index.js +1 -0
- package/dist/request/index.mjs +1 -1
- package/dist/request/request.d.mts +99 -3
- package/dist/request/request.d.ts +99 -0
- package/dist/request/request.js +1 -0
- package/dist/request/request.mjs +1 -1
- package/dist/request/utils/cancel.d.mts +4 -4
- package/dist/request/utils/{cancel.d.cts → cancel.d.ts} +4 -4
- package/dist/request/utils/cancel.js +1 -0
- package/dist/request/utils/cancel.mjs +1 -1
- package/dist/request/utils/file.d.mts +4 -4
- package/dist/request/utils/file.d.ts +6 -0
- package/dist/request/utils/file.js +1 -0
- package/dist/request/utils/file.mjs +1 -1
- package/dist/request/utils/format.d.mts +4 -4
- package/dist/request/utils/{format.d.cts → format.d.ts} +4 -4
- package/dist/request/utils/format.js +1 -0
- package/dist/request/utils/format.mjs +1 -1
- package/dist/request/utils/params.d.mts +4 -4
- package/dist/request/utils/params.d.ts +6 -0
- package/dist/request/utils/params.js +1 -0
- package/dist/request/utils/params.mjs +1 -1
- package/dist/safe-next-tick.d.mts +9 -2
- package/dist/{safe-next-tick-DlJsO1Ha.d.mts → safe-next-tick.d.ts} +4 -5
- package/dist/safe-next-tick.js +1 -0
- package/dist/safe-next-tick.mjs +1 -1
- package/dist/types.d.mts +207 -2
- package/dist/types.d.ts +207 -0
- package/dist/types.js +1 -0
- package/dist/types.mjs +1 -1
- package/dist/vue/hooks/clipboard.d.mts +8 -2
- package/dist/vue/hooks/clipboard.d.ts +8 -0
- package/dist/vue/hooks/clipboard.js +1 -0
- package/dist/vue/hooks/clipboard.mjs +1 -1
- package/dist/vue/index.d.mts +3 -4
- package/dist/vue/index.d.ts +3 -0
- package/dist/vue/index.js +1 -0
- package/dist/vue/index.mjs +1 -1
- package/dist/vue/type-util.d.mts +47 -2
- package/dist/{type-util-BdSpgYN3.d.mts → vue/type-util.d.ts} +21 -22
- package/dist/vue/type-util.js +1 -0
- package/dist/vue/type-util.mjs +1 -1
- package/package.json +5 -13
- package/dist/array-CEhD-Z_e.mjs +0 -1
- package/dist/array-okkZATKz.d.cts +0 -99
- package/dist/array-ri-t3Wsz.cjs +0 -1
- package/dist/array.cjs +0 -1
- package/dist/array.d.cts +0 -3
- package/dist/base-854WVUaj.mjs +0 -1
- package/dist/base-BSg8gJZf.mjs +0 -1
- package/dist/base-DSfexc9G.d.cts +0 -25
- package/dist/base-DUxrUTOr.cjs +0 -1
- package/dist/base-Dl59EolR.d.mts +0 -193
- package/dist/base-DmSU_ydZ.cjs +0 -1
- package/dist/base.cjs +0 -1
- package/dist/base.d.cts +0 -3
- package/dist/can-use-dom-DiyvIP5G.mjs +0 -1
- package/dist/can-use-dom-DvmMdeGa.cjs +0 -1
- package/dist/cancel-BV5B58Lw.mjs +0 -1
- package/dist/cancel-Do0w5I5K.cjs +0 -1
- package/dist/chunk-BcXMmzxH.cjs +0 -1
- package/dist/chunk-Dbq9I6zD.mjs +0 -1
- package/dist/class-C29-Mh-o.mjs +0 -1
- package/dist/class-D5duI9ps.d.mts +0 -27
- package/dist/class-D8a8qnWA.cjs +0 -1
- package/dist/clipboard-BN1iiQLu.d.mts +0 -4
- package/dist/clipboard-C8ZiJE_h.d.cts +0 -9
- package/dist/clipboard-CJ-9sRbH.d.mts +0 -9
- package/dist/clipboard-CWQVWiTk.cjs +0 -1
- package/dist/clipboard-Ci0l5Dtt.d.cts +0 -4
- package/dist/clipboard-CjgXtqbg.mjs +0 -1
- package/dist/clipboard-DqGhq6A4.mjs +0 -1
- package/dist/clipboard-ZMrs6wzK.cjs +0 -1
- package/dist/clipboard.cjs +0 -1
- package/dist/clipboard.d.cts +0 -2
- package/dist/constant-CskvZDUK.cjs +0 -1
- package/dist/constant-Dxt8HuVn.mjs +0 -1
- package/dist/contains-BpG9RIaT.mjs +0 -1
- package/dist/contains-CYQgjY4K.cjs +0 -1
- package/dist/contains-D3q8gHUu.d.cts +0 -11
- package/dist/css-DIpTZrC7.mjs +0 -1
- package/dist/css-DkmknM-7.d.mts +0 -23
- package/dist/css-WYllKaVv.cjs +0 -1
- package/dist/dayjs-00xX6Mts.d.mts +0 -31
- package/dist/dayjs-BBOQ72ow.mjs +0 -1
- package/dist/dayjs-Bvzj_rlD.cjs +0 -1
- package/dist/dayjs.cjs +0 -1
- package/dist/dayjs.d.cts +0 -2
- package/dist/dom/base.cjs +0 -1
- package/dist/dom/base.d.cts +0 -2
- package/dist/dom/class.cjs +0 -1
- package/dist/dom/class.d.cts +0 -2
- package/dist/dom/contains.cjs +0 -1
- package/dist/dom/contains.d.cts +0 -2
- package/dist/dom/css.cjs +0 -1
- package/dist/dom/css.d.cts +0 -2
- package/dist/dom/dynamic-css.cjs +0 -1
- package/dist/dom/dynamic-css.d.cts +0 -2
- package/dist/dom/find-dom-node.cjs +0 -1
- package/dist/dom/find-dom-node.d.cts +0 -2
- package/dist/dom/focus.cjs +0 -1
- package/dist/dom/focus.d.cts +0 -2
- package/dist/dom/iframe.cjs +0 -1
- package/dist/dom/iframe.d.cts +0 -2
- package/dist/dom/index.cjs +0 -1
- package/dist/dom/index.d.cts +0 -18
- package/dist/dom/is-visible.cjs +0 -1
- package/dist/dom/is-visible.d.cts +0 -2
- package/dist/dom/lib/can-use-dom.cjs +0 -1
- package/dist/dom/lib/can-use-dom.d.cts +0 -3
- package/dist/dom/scrollbar.cjs +0 -1
- package/dist/dom/scrollbar.d.cts +0 -2
- package/dist/dom/storage.cjs +0 -1
- package/dist/dom/storage.d.cts +0 -3
- package/dist/dom/style-checker.cjs +0 -1
- package/dist/dom/style-checker.d.cts +0 -2
- package/dist/dom/style-names.cjs +0 -1
- package/dist/dom/style-names.d.cts +0 -2
- package/dist/dom/support.cjs +0 -1
- package/dist/dom/support.d.cts +0 -2
- package/dist/dom/video.cjs +0 -1
- package/dist/dom/video.d.cts +0 -2
- package/dist/dom-D2QfuVth.mjs +0 -1
- package/dist/dynamic-css-CD9eHWzL.d.mts +0 -21
- package/dist/dynamic-css-CP1iFszw.mjs +0 -1
- package/dist/dynamic-css-iSnm5CN6.cjs +0 -1
- package/dist/encrypt-CHxdyuoC.d.mts +0 -29
- package/dist/encrypt-D6oTfiTY.cjs +0 -1
- package/dist/encrypt-Z5CU2r_1.mjs +0 -1
- package/dist/encrypt.cjs +0 -1
- package/dist/encrypt.d.cts +0 -2
- package/dist/file-B9oorXhT.cjs +0 -1
- package/dist/file-D4oBhObv.d.mts +0 -36
- package/dist/file-Dwobl-pF.mjs +0 -1
- package/dist/file-TjtumYrh.mjs +0 -1
- package/dist/file-rmcv99h0.cjs +0 -1
- package/dist/file.cjs +0 -1
- package/dist/file.d.cts +0 -2
- package/dist/find-dom-node-BYO9We8P.d.mts +0 -4
- package/dist/find-dom-node-BkrYW2pm.d.cts +0 -4
- package/dist/find-dom-node-gbroqN2N.mjs +0 -1
- package/dist/find-dom-node-lY7vePVL.cjs +0 -1
- package/dist/focus-ByNB07tt.d.mts +0 -11
- package/dist/focus-DtSCSQEr.cjs +0 -1
- package/dist/focus-REYXIBdQ.mjs +0 -1
- package/dist/format-3CsgkBWg.mjs +0 -1
- package/dist/format-CezZBld9.cjs +0 -1
- package/dist/handler-C40H2JG4.cjs +0 -1
- package/dist/handler-Dk1QWSgF.d.cts +0 -10
- package/dist/handler-N6Akxkpa.mjs +0 -1
- package/dist/handler-bsPUG7U9.d.mts +0 -10
- package/dist/iframe-ByOdqFYr.mjs +0 -1
- package/dist/iframe-CR0bl22C.cjs +0 -1
- package/dist/iframe-QhpkIola.d.cts +0 -58
- package/dist/index-6bSwZ6-V.d.cts +0 -1
- package/dist/index-BYjO2-Dk.d.mts +0 -3
- package/dist/index-CLTQPxoD.d.mts +0 -1
- package/dist/index-CqciuydZ.d.cts +0 -7
- package/dist/index-Ctvuv0vV.d.cts +0 -1
- package/dist/index-D-9tW2r5.d.mts +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.cts +0 -43
- package/dist/is-visible-BXbqt6I2.mjs +0 -1
- package/dist/is-visible-BpFCb4uJ.d.mts +0 -4
- package/dist/is-visible-DT2jLmnp.d.cts +0 -4
- package/dist/is-visible-laJngqtK.cjs +0 -1
- package/dist/lodash-BrrZKPAY.d.cts +0 -10
- package/dist/lodash-DAdPs0O9.d.mts +0 -10
- package/dist/lodash-iHVEJs1z.mjs +0 -1
- package/dist/lodash-kixEH9o9.cjs +0 -1
- package/dist/lodash.cjs +0 -1
- package/dist/lodash.d.cts +0 -2
- package/dist/object-C6qVmoZY.cjs +0 -1
- package/dist/object-j-lK643f.mjs +0 -1
- package/dist/object-l_DvbWqN.d.mts +0 -87
- package/dist/object.cjs +0 -1
- package/dist/object.d.cts +0 -3
- package/dist/other-B2ug3Xof.mjs +0 -1
- package/dist/other-H13CGzY5.d.mts +0 -50
- package/dist/other-c9ZDQ-tY.cjs +0 -1
- package/dist/other.cjs +0 -1
- package/dist/other.d.cts +0 -3
- package/dist/params-CnZhAsve.cjs +0 -1
- package/dist/params-CpjttIDa.mjs +0 -1
- package/dist/parse-BpErok05.cjs +0 -1
- package/dist/parse-C1eaIjot.mjs +0 -1
- package/dist/parse-vp0jh8-x.d.cts +0 -22
- package/dist/parse.cjs +0 -1
- package/dist/parse.d.cts +0 -3
- package/dist/pinyin-BE6Ew65z.cjs +0 -1
- package/dist/pinyin-D11MW4u2.mjs +0 -1
- package/dist/pinyin-Di92101W.d.cts +0 -20
- package/dist/pinyin.cjs +0 -1
- package/dist/pinyin.d.cts +0 -2
- package/dist/request/constant.cjs +0 -1
- package/dist/request/handler.cjs +0 -1
- package/dist/request/handler.d.cts +0 -3
- package/dist/request/index.cjs +0 -1
- package/dist/request/index.d.cts +0 -6
- package/dist/request/request.cjs +0 -1
- package/dist/request/request.d.cts +0 -3
- package/dist/request/utils/cancel.cjs +0 -1
- package/dist/request/utils/file.cjs +0 -1
- package/dist/request/utils/file.d.cts +0 -6
- package/dist/request/utils/format.cjs +0 -1
- package/dist/request/utils/params.cjs +0 -1
- package/dist/request/utils/params.d.cts +0 -6
- package/dist/request-BG5UIh9R.mjs +0 -1
- package/dist/request-C8gChBjl.d.cts +0 -99
- package/dist/request-Cbv8Ih3e.cjs +0 -1
- package/dist/request-CcQHJNao.cjs +0 -1
- package/dist/request-CmsAe99W.mjs +0 -1
- package/dist/request-DGUcKxsQ.d.mts +0 -99
- package/dist/safe-next-tick-1ezZPIPs.d.cts +0 -10
- package/dist/safe-next-tick-Cc30ZlUX.mjs +0 -1
- package/dist/safe-next-tick-DphyaFY6.cjs +0 -1
- package/dist/safe-next-tick.cjs +0 -1
- package/dist/safe-next-tick.d.cts +0 -2
- package/dist/scrollbar-07jqhpVk.d.cts +0 -9
- package/dist/scrollbar-2zQwgB3N.cjs +0 -1
- package/dist/scrollbar-BsVSwcz1.mjs +0 -1
- package/dist/storage-CVE8yo6N.mjs +0 -1
- package/dist/storage-ClTxbIcP.cjs +0 -1
- package/dist/storage-HTBNfA8Q.d.mts +0 -21
- package/dist/style-checker-066o7h7_.mjs +0 -1
- package/dist/style-checker-B5wzcdHi.d.mts +0 -5
- package/dist/style-checker-DAxS0NyJ.cjs +0 -1
- package/dist/style-names-CYvxRARD.cjs +0 -1
- package/dist/style-names-DDdz6-7S.d.mts +0 -4
- package/dist/style-names-cEIIM3cL.mjs +0 -1
- package/dist/support-BKRoxgNc.d.mts +0 -9
- package/dist/support-BZYJpIOE.cjs +0 -1
- package/dist/support-jAYY4GwL.d.cts +0 -9
- package/dist/support-wu9hh5gZ.mjs +0 -1
- package/dist/type-util-BRGMhQFp.d.cts +0 -48
- package/dist/type-util-HyvLYA2w.cjs +0 -1
- package/dist/type-util-Qle7ht7X.mjs +0 -1
- package/dist/types-BEdiy6mb.d.mts +0 -208
- package/dist/types-Bs46AtMe.mjs +0 -1
- package/dist/types-DTtPjrm8.d.cts +0 -208
- package/dist/types.cjs +0 -1
- package/dist/types.d.cts +0 -2
- package/dist/video-BDLauzJm.cjs +0 -1
- package/dist/video-C_sYI0Ht.d.mts +0 -10
- package/dist/video-CtkByFxt.mjs +0 -1
- package/dist/vue/hooks/clipboard.cjs +0 -1
- package/dist/vue/hooks/clipboard.d.cts +0 -2
- package/dist/vue/index.cjs +0 -1
- package/dist/vue/index.d.cts +0 -4
- package/dist/vue/type-util.cjs +0 -1
- package/dist/vue/type-util.d.cts +0 -2
- package/dist/vue-Q8n_JN-R.mjs +0 -1
- /package/dist/{dom-DzrnEGri.cjs → chunk-G27KRYT2.mjs} +0 -0
- /package/dist/{types-DAFnYo8a.cjs → chunk-PM3H3ISM.mjs} +0 -0
- /package/dist/{vue-CGBzFhF4.cjs → chunk-WBQAMGXK.mjs} +0 -0
|
@@ -1,3 +1,99 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
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});
|
package/dist/request/request.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../
|
|
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 {
|
|
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
|
-
|
|
23
|
-
export { addPending, pendingMap, removeAllPending, removeNdAddPending, removePending };
|
|
22
|
+
|
|
23
|
+
export { addPending, pendingMap, removeAllPending, removeNdAddPending, removePending };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
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
|
|
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 {
|
|
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
|
-
|
|
6
|
-
export { readBlobResponse };
|
|
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{
|
|
1
|
+
import{a}from"../../chunk-BPXO4V4X.mjs";export{a as readBlobResponse};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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"../../
|
|
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 {
|
|
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
|
-
|
|
6
|
-
export { getRequestParamValues };
|
|
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"../../
|
|
1
|
+
import{a}from"../../chunk-34VTCYOF.mjs";import"../../chunk-A5BXGBYT.mjs";export{a as getRequestParamValues};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
3
|
+
delay: number;
|
|
5
4
|
}): void;
|
|
6
5
|
declare function safeNextick(fn?: () => void, option?: {
|
|
7
|
-
|
|
6
|
+
delay: number;
|
|
8
7
|
}): Promise<void>;
|
|
9
|
-
|
|
10
|
-
export {
|
|
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});
|
package/dist/safe-next-tick.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./
|
|
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 {
|
|
2
|
-
|
|
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 };
|