@obr-fe/utils 1.2.0 → 2.0.0
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-3EVCK72A.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-7FGMUEZA.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-AMTPTGPU.mjs +1 -0
- package/dist/chunk-BEM6E7R7.mjs +1 -0
- package/dist/chunk-BPXO4V4X.mjs +1 -0
- package/dist/chunk-CTKIL4BL.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-GS4ARDQV.mjs +1 -0
- package/dist/chunk-HOXWKSQ2.mjs +1 -0
- package/dist/chunk-HZMHGGXU.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-LPLK3ZT5.mjs +1 -0
- package/dist/chunk-MQBXN7R5.mjs +1 -0
- package/dist/chunk-MUHFPVB3.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-SAXMBV46.mjs +1 -0
- package/dist/chunk-TQ5GXPYB.mjs +1 -0
- package/dist/chunk-UVMLBW6A.mjs +1 -0
- package/dist/chunk-VYAKT4FB.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 +44 -44
- package/dist/index.d.ts +44 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -1
- package/dist/lodash.d.mts +9 -2
- package/dist/lodash.d.ts +9 -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 +4 -4
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var le=Object.create;var E=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty;var Te=(e,t)=>{for(var r in t)E(e,r,{get:t[r],enumerable:!0})},P=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ye(t))!de.call(e,a)&&a!==r&&E(e,a,{get:()=>t[a],enumerable:!(n=fe(t,a))||n.enumerable});return e},h=(e,t,r)=>(P(e,t,"default"),r&&P(r,t,"default")),l=(e,t,r)=>(r=e!=null?le(me(e)):{},P(t||!e||!e.__esModule?E(r,"default",{value:e,enumerable:!0}):r,e)),ge=e=>P(E({},"__esModule",{value:!0}),e);var j={};Te(j,{ErrorMessage:()=>M,ObrRequest:()=>Q,requestUrl2json:()=>ie,useErrorHandler:()=>R,useRequestHandler:()=>_,useResponseHandler:()=>F});module.exports=ge(j);var K=l(require("lodash.clonedeep")),be=l(require("lodash.debounce")),d=l(require("lodash.merge")),Oe=l(require("lodash.clone")),xe=l(require("lodash.get")),Re=l(require("lodash.set")),je=l(require("lodash.has")),he=l(require("lodash.kebabcase")),De=l(require("lodash.camelcase"));var D={data:"data",code:"code",msg:"msg"},z={label:"label",value:"value",json:"json",disabled:"disabled",children:"children"},B={pageSize:"pageSize",pageNo:"pageNo",total:"total",records:"records"},G={baseURL:"",timeout:60*1e3,basePath:"",allowCancel:!1,allowNullValue:!0,successCode:[200],unauthorizedCode:[401],whiteUrl:()=>[],alias:()=>D,token:{key:"x-access-token",get:()=>""}};var H=l(require("axios")),g=new Map;function J(e){let{url:t,method:r,params:n,data:a,headers:s}=e,o=a,c=n;typeof a=="string"&&(o=JSON.parse(a)),typeof n=="string"&&(c=JSON.parse(n));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:${r}`]:i=[`\u8BF7\u6C42\u8DEF\u5F84:${t}`,`\u8BF7\u6C42\u65B9\u6CD5:${r}`,`\u8BF7\u6C42PARAMS:${JSON.stringify(c)}`,`\u8BF7\u6C42DATA:${JSON.stringify(o)}`],i.join(";")}function X(e){if(!e.headers?.neverCancel){let t=J(e);e.cancelToken=new H.default.CancelToken(r=>{g.has(t)||g.set(t,r)})}}function O(e,t=!1){if(!e.headers?.["X-Never-Cancel"]||t){let r=J(e);if(g.has(r)){let n=g.get(r);n&&n(r),g.delete(r)}}}function q(){Array.from(g.keys()).forEach(e=>{g.get(e)&&g.get(e)(e),g.delete(e)})}function W(e){return new Promise(t=>{let r={code:200,data:e,msg:""};if(e.type!=="application/json")t(r);else{let n=new FileReader;n.readAsText(e),n.onloadend=()=>{r=JSON.parse(n.result),t(r)}}})}var k=l(require("lodash.get"));var A=e=>typeof e=="string",S=e=>typeof e=="number";function Y(e){return typeof e=="boolean"}var x=e=>Array.isArray(e);var w=e=>Object.prototype.toString.call(e)==="[object Object]",b=e=>Object.prototype.toString.call(e)==="[object Object]";function m(e){return e==null||e===""||typeof e=="number"&&Number.isNaN(e)}function I(e=[]){return Array.isArray(e)&&!e.length}var Ce=l(require("lodash.merge")),Pe=l(require("lodash.clonedeep"));function Z(e,t=[],r){if(e==null)return r||e;let a=Object.getOwnPropertyNames(e).reduce((s,o)=>(t.includes(o)||(s[o]=e[o]),s),{});return Object.assign(a,r)}function ee(e={}){let t=new FormData;return Object.entries(e).forEach(([r,n])=>{t.append(r,n)}),t}function U(e){return e.filter(t=>!m(t))}function te(e=[],t="children",r=!1){let n=[],a=(s,o)=>{s.forEach(c=>{let{[o]:i,...y}=c;r?n.push(c):n.push(y),i&&a(i,o)})};return a(e,t),n}function re(e,t){return e.reduce((n,a)=>(n.find(o=>t.every(c=>o[c]===a[c]))||n.push(a),n),[])}function ne(e,t={},r){let{prefix:n="#{",suffix:a="}",defaultValue:s=""}=r??{};if(typeof e!="string")return String(e);if(!t||typeof t!="object")return e;let o=f=>f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=o(n),i=o(a),y=new RegExp(`${c}([^${i}]+)${i}`,"g");return e.replace(y,(f,u)=>{let p=t[u];return m(p)?String(m(s)?"":s):String(p)})}function ae(e={}){return Object.keys(e).sort().reduce((r,n)=>(r[n]=e[n],r),{})}function se(e={}){return Object.keys(e).reduce((t,r)=>{let n=e[r];return m(n)||(S(n)&&String(n).length>=15?t[r]=String(n):t[r]=n),t},{})}function C(e,t=D){let{code:r="code",data:n="data",msg:a="msg"}=t;return{data:e[n],msg:e[a],code:e[r]}}function N(e,t=z,r=!0){let{label:n="label",value:a="value",json:s="json",disabled:o="disabled",children:c="children"}=t,i=e;e.some(u=>w(u)&&Object.keys(u).includes(c))&&(i=te(e,c));let f=i.reduce((u,p)=>{if(w(p)){let T=n.includes("#{")?n:`#{${n}}`,ue={label:ne(T,p,{prefix:"#{",suffix:"}"}),value:(0,k.default)(p,a),disabled:(0,k.default)(p,o)??!1,json:(0,k.default)(p,s)??p};u.push(ue)}else(S(p)||A(p)||Y(p))&&u.push({label:p,value:p,json:{}});return u},[]);return r?re(f,["value"]):f}function L(e={pageSize:10,pageNo:1},t=B){return Object.keys(e).reduce((r,n)=>(r[t[n]]=e[n],r),{})}function oe(e,t=B){let{records:r="records",total:n="total"}=t;return{records:e[r]??[],total:e[n]??0}}function V(e){let t=U([e].flat());return I(t)?[200]:t}function $(e){let t=U([e].flat());return I(t)?[401]:t}var M=new Map;function ie(e){let t={},r=e.split("?")[1];return r&&r.split("&").forEach(n=>{let[a="",s=""]=n.split("=");t[a]=s}),t}function _(e,t){M.get(401)&&!t.whiteUrl?.().includes(e.url??"")&&O(e,!0);let r=(0,d.default)({},e),[n=""]=(r.url??"").split("?"),a=ae((0,d.default)({},ie(r.url??""),r.params));t.allowNullValue||(a=se(a)),r.url=n,r.params=a,r.headers?.["Content-Type"]||(0,d.default)(r.headers,{"Content-Type":"application/json;charset=utf-8"});let{token:s}=t;if(s?.key&&s.get()){let o={[s.key]:s.get()};(0,d.default)(r.headers,o)}else s?.key&&r.headers&&Reflect.deleteProperty(r.headers,s.key);return t.allowCancel&&(O(r),X(r)),t.beforeRequest?t.beforeRequest(r):r}function R(e){if(e.type==="REQUEST"&&$(e.options.unauthorizedCode).includes(e.content.code)){if(q(),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 F(e,t){let{data:r,config:n}=e,a=r,s=n;if(t.afterRequest){let{data:c,config:i}=t.afterRequest(e,t);a=c,s=i}let o=(0,d.default)({},D,t.alias?.());if(O(e.config),$(t.unauthorizedCode).includes(a[o.code]))return R({type:"REQUEST",content:C(a,o),options:t,response:e});if(M.delete(401),s.responseType==="blob"){let c=await W(a);return V(t.successCode).includes(c.code)?C(c):R({type:"REQUEST",content:c,options:t,response:e})}else return V(t.successCode).includes(a[o.code])?Promise.resolve(C(a,o)):R({type:"REQUEST",content:C(a,o),options:t,response:e})}var v=l(require("axios"));var ce=l(require("lodash.get"));function Ee(e,t){return t==="toArray"?x(e)?e:[e].flat().filter(r=>!m(r)):t==="toNumber"?A(e)?Number(e):e:t==="toString"?x(e)?e.join(","):String(e):e}function qe(e,t={}){let r;for(let n of e)if(r=(n.path?(0,ce.default)(t,n.path):n.defaultValue)??n.defaultValue,n.formatter&&(r=Ee(r,n.formatter)),!m(r))break;return r}function pe(e=[],t={}){let r={};for(let n of e)if(r=r===null?{}:r,n.required&&(!n.key||!n.source.length)){r=null;break}else if(n.key&&n.source.length){let a=qe(n.source,t);if(n.required&&m(a)){r=null;break}else if(n.toValue){if(r=a,!b(r))break}else b(r)&&(r[n.key]=a)}return r}var Q=class{options;instance;constructor(t){this.options=(0,d.default)({},G,t),this.instance=this.setupInterceptors(this.options)}setupInterceptors(t){let r=v.default.create(Z(t,["basePath","allowCancel","allowNullValue","successCode","unauthorizedCode","whiteUrl","alias","token","beforeRequest","afterRequest",401,"cancel","error"]));return r.interceptors.request.use(n=>_(n,this.options)),r.interceptors.response.use(n=>F(n,this.options),n=>R({type:(0,v.isCancel)(n)?"CANCEL":"ERROR",content:n,options:this.options})),r}fetchLocalFile(t){return fetch((this.options.basePath??"")+t)}async get(t,r={},n){let{data:a}=await this.instance.get(t,{...n,params:r});return a}async post(t,r={},n){let{data:a}=await this.instance.post(t,r,n);return a}async postForm(t,r={},n){let a=ee(r),{data:s}=await this.instance.post(t,a,(0,d.default)({},{headers:{"Content-Type":"multipart/form-data"},...n}));return s}async getPageRecords(t,r={},n={},a="GET",s,o){let c=a.toUpperCase()==="GET",i={...L(n,s),...r},{data:y}=await this.instance.request({...o,url:t,method:a,params:c?i:{...L(n,s)},data:c?{}:i});return oe(y,s)}async getOptions(t,r={},n="GET",a,s,o=!0){let c=n.toUpperCase()==="GET",{data:i=[]}=await this.instance.request({...s,url:t,method:n,params:r,data:c?{}:r});if(x(i))return N(i,a,o);if(b(i)){if(Object.values(i).every(u=>x(u))){let u=Object.values(i).flat();return N(u,a,o)}let f=Object.entries(i).map(([u,p])=>({label:p,value:u}));return N(f,void 0,o)}return[]}async getCascaderOptions(t,r={},n,a=!0){if(!t.length)return[];let s=async(c,i,y={})=>{let f=c[i];if(!f?.url)return[];let u=pe(f.params,y)??{},p=(await this.getOptions(f.url,b(u)?(0,d.default)({},r,u):u,f.method,f.alias,n,a)).map(T=>({...T,children:T.json?.children??[]}));for(let T=0;T<p.length;T++)p[T].children=await s(c,i+1,p[T].json);return p};return await s(t,0,r)}cancel(t){O(t,!0)}request(t){return this.instance.request(t)}destory(){q(),this.instance=null}};h(j,require("axios"),module.exports);0&&(module.exports={ErrorMessage,ObrRequest,requestUrl2json,useErrorHandler,useRequestHandler,useResponseHandler,...require("axios")});
|
package/dist/request/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import"../chunk-HOXWKSQ2.mjs";import{a as f}from"../chunk-HZMHGGXU.mjs";import"../chunk-AMTPTGPU.mjs";import{a,b,c,d,e}from"../chunk-7FGMUEZA.mjs";import"../chunk-44EYU7QJ.mjs";import"../chunk-BPXO4V4X.mjs";import"../chunk-MUHFPVB3.mjs";import"../chunk-UVMLBW6A.mjs";import"../chunk-A25LR755.mjs";import"../chunk-GS4ARDQV.mjs";import"../chunk-LPLK3ZT5.mjs";import"../chunk-A5BXGBYT.mjs";import"../chunk-CTKIL4BL.mjs";export{a as ErrorMessage,f as ObrRequest,b as requestUrl2json,d as useErrorHandler,c as useRequestHandler,e as useResponseHandler};
|
|
@@ -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 A=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)A(e,n,{get:t[n],enumerable:!0})},V=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ue(t))!fe.call(e,a)&&a!==n&&A(e,a,{get:()=>t[a],enumerable:!(r=pe(t,a))||r.enumerable});return e};var l=(e,t,n)=>(n=e!=null?ce(le(e)):{},V(t||!e||!e.__esModule?A(n,"default",{value:e,enumerable:!0}):n,e)),me=e=>V(A({},"__esModule",{value:!0}),e);var Ee={};ye(Ee,{ObrRequest:()=>L});module.exports=me(Ee);var w=l(require("axios"));var $=l(require("lodash.clonedeep")),de=l(require("lodash.debounce")),d=l(require("lodash.merge")),Te=l(require("lodash.clone")),ge=l(require("lodash.get")),be=l(require("lodash.set")),Oe=l(require("lodash.has")),xe=l(require("lodash.kebabcase")),Re=l(require("lodash.camelcase"));var he=l(require("lodash.merge")),De=l(require("lodash.clonedeep"));var R=e=>typeof e=="string",C=e=>typeof e=="number";function M(e){return typeof e=="boolean"}var O=e=>Array.isArray(e);var P=e=>Object.prototype.toString.call(e)==="[object Object]",b=e=>Object.prototype.toString.call(e)==="[object Object]";function m(e){return e==null||e===""||typeof e=="number"&&Number.isNaN(e)}function k(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 j={data:"data",code:"code",msg:"msg"},Q={label:"label",value:"value",json:"json",disabled:"disabled",children:"children"},N={pageSize:"pageSize",pageNo:"pageNo",total:"total",records:"records"},K={baseURL:"",timeout:60*1e3,basePath:"",allowCancel:!1,allowNullValue:!0,successCode:[200],unauthorizedCode:[401],whiteUrl:()=>[],alias:()=>j,token:{key:"x-access-token",get:()=>""}};var z=l(require("axios")),g=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=>{g.has(t)||g.set(t,n)})}}function x(e,t=!1){if(!e.headers?.["X-Never-Cancel"]||t){let n=G(e);if(g.has(n)){let r=g.get(n);r&&r(n),g.delete(n)}}}function E(){Array.from(g.keys()).forEach(e=>{g.get(e)&&g.get(e)(e),g.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 q=l(require("lodash.get"));function v(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,u)=>{let p=t[u];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)||(C(r)&&String(r).length>=15?t[n]=String(r):t[n]=r),t},{})}function h(e,t=j){let{code:n="code",data:r="data",msg:a="msg"}=t;return{data:e[r],msg:e[a],code:e[n]}}function S(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(u=>P(u)&&Object.keys(u).includes(c))&&(i=X(e,c));let f=i.reduce((u,p)=>{if(P(p)){let T=r.includes("#{")?r:`#{${r}}`,ie={label:Y(T,p,{prefix:"#{",suffix:"}"}),value:(0,q.default)(p,a),disabled:(0,q.default)(p,o)??!1,json:(0,q.default)(p,s)??p};u.push(ie)}else(C(p)||R(p)||M(p))&&u.push({label:p,value:p,json:{}});return u},[]);return n?W(f,["value"]):f}function B(e={pageSize:10,pageNo:1},t=N){return Object.keys(e).reduce((n,r)=>(n[t[r]]=e[r],n),{})}function te(e,t=N){let{records:n="records",total:r="total"}=t;return{records:e[n]??[],total:e[r]??0}}function I(e){let t=v([e].flat());return k(t)?[200]:t}function U(e){let t=v([e].flat());return k(t)?[401]:t}var ne=new Map;function Ae(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??"")&&x(e,!0);let n=(0,d.default)({},e),[r=""]=(n.url??"").split("?"),a=Z((0,d.default)({},Ae(n.url??""),n.params));t.allowNullValue||(a=ee(a)),n.url=r,n.params=a,n.headers?.["Content-Type"]||(0,d.default)(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,d.default)(n.headers,o)}else s?.key&&n.headers&&Reflect.deleteProperty(n.headers,s.key);return t.allowCancel&&(x(n),H(n)),t.beforeRequest?t.beforeRequest(n):n}function D(e){if(e.type==="REQUEST"&&U(e.options.unauthorizedCode).includes(e.content.code)){if(E(),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,d.default)({},j,t.alias?.());if(x(e.config),U(t.unauthorizedCode).includes(a[o.code]))return D({type:"REQUEST",content:h(a,o),options:t,response:e});if(ne.delete(401),s.responseType==="blob"){let c=await J(a);return I(t.successCode).includes(c.code)?h(c):D({type:"REQUEST",content:c,options:t,response:e})}else return I(t.successCode).includes(a[o.code])?Promise.resolve(h(a,o)):D({type:"REQUEST",content:h(a,o),options:t,response:e})}var se=l(require("lodash.get"));function Ce(e,t){return t==="toArray"?O(e)?e:[e].flat().filter(n=>!m(n)):t==="toNumber"?R(e)?Number(e):e:t==="toString"?O(e)?e.join(","):String(e):e}function Pe(e,t={}){let n;for(let r of e)if(n=(r.path?(0,se.default)(t,r.path):r.defaultValue)??r.defaultValue,r.formatter&&(n=Ce(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=Pe(r.source,t);if(r.required&&m(a)){n=null;break}else if(r.toValue){if(n=a,!b(n))break}else b(n)&&(n[r.key]=a)}return n}var L=class{options;instance;constructor(t){this.options=(0,d.default)({},K,t),this.instance=this.setupInterceptors(this.options)}setupInterceptors(t){let n=w.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=>D({type:(0,w.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,d.default)({},{headers:{"Content-Type":"multipart/form-data"},...r}));return s}async getPageRecords(t,n={},r={},a="GET",s,o){let c=a.toUpperCase()==="GET",i={...B(r,s),...n},{data:y}=await this.instance.request({...o,url:t,method:a,params:c?i:{...B(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(O(i))return S(i,a,o);if(b(i)){if(Object.values(i).every(u=>O(u))){let u=Object.values(i).flat();return S(u,a,o)}let f=Object.entries(i).map(([u,p])=>({label:p,value:u}));return S(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 u=oe(f.params,y)??{},p=(await this.getOptions(f.url,b(u)?(0,d.default)({},n,u):u,f.method,f.alias,r,a)).map(T=>({...T,children:T.json?.children??[]}));for(let T=0;T<p.length;T++)p[T].children=await s(c,i+1,p[T].json);return p};return await s(t,0,n)}cancel(t){x(t,!0)}request(t){return this.instance.request(t)}destory(){E(),this.instance=null}};0&&(module.exports={ObrRequest});
|
package/dist/request/request.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../
|
|
1
|
+
import{a}from"../chunk-HZMHGGXU.mjs";import"../chunk-AMTPTGPU.mjs";import"../chunk-7FGMUEZA.mjs";import"../chunk-44EYU7QJ.mjs";import"../chunk-BPXO4V4X.mjs";import"../chunk-MUHFPVB3.mjs";import"../chunk-UVMLBW6A.mjs";import"../chunk-A25LR755.mjs";import"../chunk-GS4ARDQV.mjs";import"../chunk-LPLK3ZT5.mjs";import"../chunk-A5BXGBYT.mjs";import"../chunk-CTKIL4BL.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 B=Object.create;var T=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var r in t)T(e,r,{get:t[r],enumerable:!0})},R=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of I(t))!_.call(e,o)&&o!==r&&T(e,o,{get:()=>t[o],enumerable:!(n=C(t,o))||n.enumerable});return e};var s=(e,t,r)=>(r=e!=null?B(L(e)):{},R(t||!e||!e.__esModule?T(r,"default",{value:e,enumerable:!0}):r,e)),U=e=>R(T({},"__esModule",{value:!0}),e);var ae={};$(ae,{format:()=>Y,formatData:()=>Z,formatOption:()=>ee,formatPageQuery:()=>te,formatPageRecords:()=>ne,getSuccessCode:()=>re,getUnauthorizedCode:()=>oe,sort:()=>X});module.exports=U(ae);var d=s(require("lodash.get"));var O={data:"data",code:"code",msg:"msg"},A={label:"label",value:"value",json:"json",disabled:"disabled",children:"children"},x={pageSize:"pageSize",pageNo:"pageNo",total:"total",records:"records"},ie={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 E(e){return typeof e=="boolean"}var g=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 S=s(require("lodash.clonedeep")),V=s(require("lodash.debounce")),F=s(require("lodash.merge")),K=s(require("lodash.clone")),M=s(require("lodash.get")),q=s(require("lodash.set")),z=s(require("lodash.has")),Q=s(require("lodash.kebabcase")),J=s(require("lodash.camelcase"));var H=s(require("lodash.merge")),W=s(require("lodash.clonedeep"));function h(e){return e.filter(t=>!l(t))}function k(e=[],t="children",r=!1){let n=[],o=(y,c)=>{y.forEach(i=>{let{[c]:p,...m}=i;r?n.push(i):n.push(m),p&&o(p,c)})};return o(e,t),n}function N(e,t){return e.reduce((n,o)=>(n.find(c=>t.every(i=>c[i]===o[i]))||n.push(o),n),[])}function w(e,t={},r){let{prefix:n="#{",suffix:o="}",defaultValue:y=""}=r??{};if(typeof e!="string")return String(e);if(!t||typeof t!="object")return e;let c=f=>f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=c(n),p=c(o),m=new RegExp(`${i}([^${p}]+)${p}`,"g");return e.replace(m,(f,u)=>{let a=t[u];return l(a)?String(l(y)?"":y):String(a)})}function X(e={}){return Object.keys(e).sort().reduce((r,n)=>(r[n]=e[n],r),{})}function Y(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 Z(e,t=O){let{code:r="code",data:n="data",msg:o="msg"}=t;return{data:e[n],msg:e[o],code:e[r]}}function ee(e,t=A,r=!0){let{label:n="label",value:o="value",json:y="json",disabled:c="disabled",children:i="children"}=t,p=e;e.some(u=>g(u)&&Object.keys(u).includes(i))&&(p=k(e,i));let f=p.reduce((u,a)=>{if(g(a)){let P=n.includes("#{")?n:`#{${n}}`,v={label:w(P,a,{prefix:"#{",suffix:"}"}),value:(0,d.default)(a,o),disabled:(0,d.default)(a,c)??!1,json:(0,d.default)(a,y)??a};u.push(v)}else(b(a)||j(a)||E(a))&&u.push({label:a,value:a,json:{}});return u},[]);return r?N(f,["value"]):f}function te(e={pageSize:10,pageNo:1},t=x){return Object.keys(e).reduce((r,n)=>(r[t[n]]=e[n],r),{})}function ne(e,t=x){let{records:r="records",total:n="total"}=t;return{records:e[r]??[],total:e[n]??0}}function re(e){let t=h([e].flat());return D(t)?[200]:t}function oe(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-MUHFPVB3.mjs";import"../../chunk-UVMLBW6A.mjs";import"../../chunk-A25LR755.mjs";import"../../chunk-GS4ARDQV.mjs";import"../../chunk-LPLK3ZT5.mjs";import"../../chunk-A5BXGBYT.mjs";import"../../chunk-CTKIL4BL.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 f=Object.create;var i=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty;var x=(t,n)=>{for(var e in n)i(t,e,{get:n[e],enumerable:!0})},c=(t,n,e,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of b(n))!m.call(t,o)&&o!==e&&i(t,o,{get:()=>n[o],enumerable:!(r=y(n,o))||r.enumerable});return t};var j=(t,n,e)=>(e=t!=null?f(g(t)):{},c(n||!t||!t.__esModule?i(e,"default",{value:t,enumerable:!0}):e,t)),T=t=>c(i({},"__esModule",{value:!0}),t);var D={};x(D,{getRequestParamValues:()=>h});module.exports=T(D);var l=j(require("lodash.get"));var p=t=>typeof t=="string";var a=t=>Array.isArray(t);var u=t=>Object.prototype.toString.call(t)==="[object Object]";function s(t){return t==null||t===""||typeof t=="number"&&Number.isNaN(t)}function O(t,n){return n==="toArray"?a(t)?t:[t].flat().filter(e=>!s(e)):n==="toNumber"?p(t)?Number(t):t:n==="toString"?a(t)?t.join(","):String(t):t}function k(t,n={}){let e;for(let r of t)if(e=(r.path?(0,l.default)(n,r.path):r.defaultValue)??r.defaultValue,r.formatter&&(e=O(e,r.formatter)),!s(e))break;return e}function h(t=[],n={}){let e={};for(let r of t)if(e=e===null?{}:e,r.required&&(!r.key||!r.source.length)){e=null;break}else if(r.key&&r.source.length){let o=k(r.source,n);if(r.required&&s(o)){e=null;break}else if(r.toValue){if(e=o,!u(e))break}else u(e)&&(e[r.key]=o)}return e}0&&(module.exports={getRequestParamValues});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../
|
|
1
|
+
import{a}from"../../chunk-AMTPTGPU.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};
|