@topthink/common 1.0.26 → 1.0.29

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/lib/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as n,Fragment as c}from"react/jsx-runtime";import t,{SubMenu as r,MenuItem as i}from"rc-menu";import o from"styled-components";import{useRoutes as a,useLocation as s,Link as l,BrowserRouter as d,Routes as u,Route as h,Navigate as m,useNavigate as g}from"react-router-dom";import*as p from"react";import f,{useMemo as v,useEffect as b,useState as x,useContext as y,Children as w,useCallback as _,createElement as k,forwardRef as z,useRef as C,useImperativeHandle as S,Fragment as N}from"react";import"rc-menu/assets/index.css";import j from"sweetalert2/dist/sweetalert2.js";import E from"sweetalert2-react-content";import{Dropdown as A,Spinner as D,Card as F,Alert as I,Button as O,Pagination as B,Table as L,Form as P,Modal as T,OverlayTrigger as U,Tooltip as M}from"react-bootstrap";import q from"query-string";import H from"axios";import*as K from"retry-axios";import R from"classnames";import{intersection as V,mapValues as G,debounce as Y,values as $,uniqueId as J}from"lodash";import Q from"rc-steps";import"rc-steps/assets/index.css";import W,{getRegistry as X}from"@topthink/json-form";import Z from"rc-table";import{useAsyncCallback as ee}from"react-async-hook";function ne(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var ce;const te=o.footer(ce||(ce=ne(["\n\n"])));function re(){return e(te,{children:e("div",{className:"container"})})}const ie=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";const c=[];for(const o of e){var t,r,i;if(null!==(t=o.meta)&&void 0!==t&&t.hideInMenu)continue;const e=null===(r=o.meta)||void 0===r?void 0:r.title;if(!e)continue;let a=o.path||"";a="".concat(n,"/").concat(a),a=a.replace(/\/+/,"/").replace(/\/$/,"");const s={title:e,path:a,children:[]};null!==(i=o.meta)&&void 0!==i&&i.hideChildrenInMenu||o.children&&o.children.length>0&&(s.children=ie(o.children,a)),c.push(s)}return c};var oe,ae,se,le,de,ue;const he=n=>n.map((n=>n.children.length>0?e(r,{title:n.title,children:he(n.children)},n.path):e(i,{children:e(l,{to:n.path,children:n.title})},n.path))),me=()=>({height:0}),ge=e=>({height:e.scrollHeight}),pe={motionName:"rc-menu-collapse",motionAppear:!0,onAppearStart:me,onAppearActive:ge,onEnterStart:me,onEnterActive:ge,onLeaveStart:ge,onLeaveActive:me};function fe(c){let{routes:t,basename:r,title:i}=c;const o=a(t),l=v((()=>function(e){return ie(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/")}(t,r)),[t,r]),{pathname:d}=s(),u=v((()=>{const e=[];return d.split("/").reduce(((n,c)=>(n.length>1&&e.push(n.join("/")),[...n,c])),[]),e}),[d]),h=v((()=>[...u,d]),[d,u]);return n(ve,{children:[n(be,{children:[e(xe,{children:i}),e(_e,{mode:"inline",motion:pe,defaultOpenKeys:u,selectedKeys:h,children:he(l)})]}),n(ye,{children:[e(we,{children:o}),e(re,{})]})]})}const ve=o.div(oe||(oe=ne(["\n display: flex;\n flex-wrap: nowrap;\n width: 100%;\n"]))),be=o.nav(ae||(ae=ne(["\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 100;\n padding: 54px 0 0;\n border-right: 1px solid #e3e3e3;\n width: 230px;\n background-color: #f5f5f5;\n"]))),xe=o.div(se||(se=ne(["\n padding: 10px 0;\n height: 64px;\n line-height: 44px;\n text-indent: 24px;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n font-size: 16px;\n"]))),ye=o.div(le||(le=ne(["\n margin-left: 230px;\n flex: 1;\n"]))),we=o.main(de||(de=ne(["\n min-height: calc(100vh - 54px);\n position: relative;\n"]))),_e=o(t)(ue||(ue=ne(["\n border: none;\n box-shadow: none;\n padding: 0;\n\n .rc-menu-item {\n display: flex;\n\n &:hover {\n background-color: #f0f0f0;\n }\n\n a {\n flex: 1;\n text-decoration: none;\n color: dimgray;\n }\n }\n\n .rc-menu-sub {\n background-color: #eee;\n border-top: 1px solid #eee;\n border-bottom: 1px solid #eee;\n\n & > li {\n &:first-child {\n margin-top: 4px;\n }\n\n &:last-child {\n margin-bottom: 4px;\n }\n }\n\n .rc-menu-item-selected {\n background-color: #eee;\n color: var(--bs-primary);\n\n & > a {\n color: var(--bs-primary);\n }\n }\n\n .rc-menu-item-active {\n background-color: #eee;\n }\n\n .rc-menu-item {\n &:hover {\n background-color: #e7e7e7;\n }\n }\n }\n\n .rc-menu-submenu {\n & > .rc-menu-submenu-title {\n &:hover {\n background-color: #e7e7e7;\n }\n }\n }\n\n .rc-menu-submenu-active > .rc-menu-submenu-title {\n background-color: #eee;\n }\n\n .rc-menu-item,\n .rc-menu-submenu > .rc-menu-submenu-title {\n padding: 0 8px 0 24px;\n font-size: 14px;\n line-height: 36px;\n cursor: pointer;\n }\n\n .rc-menu-sub > .rc-menu-item,\n .rc-menu-sub > .rc-menu-submenu > .rc-menu-submenu-title {\n padding-top: 0;\n padding-bottom: 0;\n padding-right: 0;\n }\n\n .rc-menu-submenu-arrow {\n line-height: 38px;\n }\n\n .rc-menu-item-selected {\n background-color: #f5f5f5;\n color: var(--bs-primary);\n\n & > a {\n color: var(--bs-primary);\n }\n }\n\n .rc-menu-submenu-selected {\n background-color: #eee;\n\n .rc-menu-submenu-title {\n color: var(--bs-primary);\n font-weight: 500;\n }\n }\n\n & > .rc-menu-item {\n line-height: 38px;\n }\n\n & > .rc-menu-submenu {\n &.rc-menu-submenu-selected {\n background-color: #f5f5f5;\n }\n\n & > .rc-menu-submenu-title {\n line-height: 38px;\n\n &:hover {\n background-color: #f0f0f0;\n }\n }\n\n &.rc-menu-submenu-active > .rc-menu-submenu-title {\n background-color: #f5f5f5;\n }\n\n & > .rc-menu-sub {\n border-top: 1px solid #e6e6e6;\n border-bottom: 1px solid #e6e6e6;\n\n & > li {\n &:first-child {\n margin-top: 9px;\n }\n\n &:last-child {\n margin-bottom: 9px;\n }\n }\n }\n }\n\n"]))),ke=E(j),ze={confirmButtonText:"确定",cancelButtonText:"取消"},Ce={confirm:async e=>{const{isConfirmed:n}=await ke.fire({...ze,icon:"warning",showCancelButton:!0,...e});return n},error:e=>{ke.fire({...ze,toast:!0,position:"top",icon:"error",timer:3e3,showConfirmButton:!1,...e})}};var Se,Ne,je,Ee;const Ae=o.div(Se||(Se=ne(["\n padding: 48px 32px;\n"]))),De=o.div(Ne||(Ne=ne(["\n margin-bottom: 24px;\n text-align: center;\n font-size: 72px;\n"]))),Fe=o.div(je||(je=ne(["\n color: rgba(0, 0, 0, .85);\n font-size: 24px;\n line-height: 1.8;\n text-align: center;\n"]))),Ie=o.div(Ee||(Ee=ne(["\n margin-top: 32px;\n text-align: center;\n"]))),Oe={success:e("i",{className:"bi bi-check-circle-fill text-success"}),error:e("i",{className:"bi bi-exclamation-circle-fill text-danger"}),info:e("i",{className:"bi bi-info-circle-fill text-info"}),warning:e("i",{className:"bi bi-exclamation-triangle-fill text-warning"})};function Be(c){let{status:t,title:r,icon:i,extra:o}=c;return!i&&t&&(i=Oe[t]),n(Ae,{children:[i&&e(De,{children:i}),r&&e(Fe,{children:r}),o&&e(Ie,{children:o})]})}var Le,Pe;const Te=o.a(Le||(Le=ne(["\n cursor: pointer;\n"])));function Ue(c){let{children:t,menus:r}=c;return e(Me,{className:"navbar navbar-light bg-white border-bottom sticky-top",children:n("div",{className:"container-fluid",children:[e("a",{className:"navbar-brand",href:"https://www.topthink.com",children:e("img",{src:"data:image/svg+xml,%3csvg width='485' height='132' xmlns='http://www.w3.org/2000/svg' xml:space='preserve' style='enable-background:new 0 0 531.69 198.43%3b' version='1.1'%3e %3cstyle type='text/css'%3e.st0%7bfill:%233C60FF%3b%7d%3c/style%3e %3cg%3e %3ctitle%3ebackground%3c/title%3e %3crect fill='none' id='canvas_background' height='134' width='487' y='-1' x='-1'/%3e %3c/g%3e %3cg%3e %3ctitle%3eLayer 1%3c/title%3e %3cpath id='svg_1' d='m132.29%2c62.34c-1.19%2c-18.77 -10.34%2c-35.36 -24.11%2c-46.46c-11.15%2c-8.99 -25.34%2c-14.38 -40.79%2c-14.38c-0.55%2c0 -1.09%2c0.01 -1.63%2c0.02c-3.32%2c0.08 -6.57%2c0.41 -9.75%2c0.98c-30.49%2c5.38 -53.65%2c32 -53.65%2c64.04c0%2c1.87 0.08%2c3.73 0.24%2c5.57c2.5%2c29.51 24.7%2c53.4 53.41%2c58.47c2.38%2c0.42 4.8%2c0.72 7.26%2c0.86c0.83%2c0.05 1.66%2c0.09 2.5%2c0.11c0.54%2c0.01 1.08%2c0.02 1.63%2c0.02c34.04%2c0 61.97%2c-26.16 64.79%2c-59.46c0.16%2c-1.83 0.24%2c-3.69 0.24%2c-5.57c0%2c-1.42 -0.05%2c-2.82 -0.14%2c-4.2zm-76.27%2c32.5c-0.26%2c0.01 -0.53%2c0.01 -0.79%2c0.01c-14.56%2c0 -26.88%2c-9.57 -31.03%2c-22.76c-0.97%2c-3.08 -1.49%2c-6.35 -1.49%2c-9.75c0%2c-17.95 14.56%2c-32.52 32.51%2c-32.52c0.26%2c0 0.53%2c0 0.79%2c0.01c3.41%2c0.08 6.69%2c0.68 9.75%2c1.74c6.5%2c2.22 12.06%2c6.45 15.97%2c11.94c1.98%2c2.78 3.54%2c5.9 4.57%2c9.25c0.94%2c3.03 1.44%2c6.24 1.44%2c9.58l-9.75%2c0c0%2c-2.18 -0.31%2c-4.29 -0.88%2c-6.28c-0.92%2c-3.23 -2.55%2c-6.17 -4.69%2c-8.64c-1.86%2c-2.14 -4.12%2c-3.93 -6.65%2c-5.25c-2.93%2c-1.54 -6.24%2c-2.46 -9.75%2c-2.58c-0.26%2c-0.01 -0.52%2c-0.01 -0.79%2c-0.01c-12.57%2c0 -22.76%2c10.19 -22.76%2c22.76c0%2c3.49 0.79%2c6.8 2.19%2c9.75c3.65%2c7.69 11.49%2c13.01 20.57%2c13.01c0.27%2c0 0.53%2c-0.01 0.79%2c-0.01l0%2c9.75zm55.7%2c-17.92c-3.35%2c10.5 -13.18%2c18.09 -24.78%2c18.09c-3.13%2c0 -6.13%2c-0.55 -8.91%2c-1.57c-2.18%2c-0.8 -4.24%2c-1.88 -6.11%2c-3.21c-2.38%2c-1.68 -4.47%2c-3.76 -6.16%2c-6.13c-0.28%2c-0.39 -0.55%2c-0.79 -0.81%2c-1.2c-2.03%2c-3.2 -3.38%2c-6.87 -3.85%2c-10.82l9.87%2c0c0.33%2c1.71 0.92%2c3.32 1.74%2c4.8c1.61%2c2.91 4.09%2c5.26 7.09%2c6.72c0.57%2c0.28 1.15%2c0.53 1.76%2c0.73c1.68%2c0.6 3.49%2c0.92 5.37%2c0.92c7.92%2c0 14.52%2c-5.67 15.96%2c-13.17c0.2%2c-1 0.3%2c-2.04 0.3%2c-3.09c0%2c-2.37 -0.51%2c-4.63 -1.43%2c-6.67c-1.66%2c-3.71 -4.68%2c-6.68 -8.43%2c-8.28l3.54%2c-9.1c7.43%2c3.08 13.13%2c9.49 15.21%2c17.38c0.44%2c1.64 0.72%2c3.34 0.81%2c5.09c0.04%2c0.52 0.05%2c1.05 0.05%2c1.58c0%2c1.05 -0.07%2c2.07 -0.18%2c3.09c-0.18%2c1.68 -0.54%2c3.3 -1.04%2c4.84z' class='st0'/%3e %3cg id='svg_2'%3e %3cg id='svg_3'%3e %3crect id='svg_4' height='6.34' width='94.12' class='st0' y='20.46' x='163.29'/%3e %3c/g%3e %3cg id='svg_5'%3e %3cpath id='svg_6' d='m169.31%2c113.72l0%2c-6.34c6.49%2c0 11.77%2c-5.28 11.77%2c-11.77l0%2c-71.98l6.34%2c0l0%2c71.98c0%2c9.98 -8.12%2c18.11 -18.11%2c18.11z' class='st0'/%3e %3c/g%3e %3cg id='svg_7'%3e %3cpath id='svg_8' d='m255.49%2c91.27l-6.34%2c0l0%2c-38.2c0%2c-5.06 -4.12%2c-9.18 -9.18%2c-9.18l-19.37%2c0c-5.06%2c0 -9.18%2c4.12 -9.18%2c9.18l0%2c38.2l-6.34%2c0l0%2c-38.2c0%2c-8.55 6.96%2c-15.51 15.51%2c-15.51l19.38%2c0c8.55%2c0 15.51%2c6.96 15.51%2c15.51l0%2c38.2l0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_9'%3e %3crect id='svg_10' height='17.09' width='6.34' class='st0' y='23.63' x='227.12'/%3e %3c/g%3e %3cg id='svg_11'%3e %3cpath id='svg_12' d='m206.43%2c113.84l-3.34%2c0l0%2c-6.34l3.34%2c0c6.3%2c0 12.9%2c-3.56 15.35%2c-8.29c3.49%2c-6.71 5.33%2c-14.25 5.33%2c-21.81l0%2c-26.13l6.34%2c0l0%2c26.13c0%2c8.58 -2.09%2c17.13 -6.05%2c24.74c-3.98%2c7.68 -13.57%2c11.7 -20.97%2c11.7z' class='st0'/%3e %3c/g%3e %3cg id='svg_13'%3e %3cpath id='svg_14' d='m257.48%2c113.84l-3.34%2c0c-7.4%2c0 -16.98%2c-4.02 -20.98%2c-11.7c-3.96%2c-7.61 -6.05%2c-16.16 -6.05%2c-24.74l6.34%2c0c0%2c7.56 1.84%2c15.1 5.33%2c21.81c2.46%2c4.73 9.06%2c8.29 15.35%2c8.29l3.34%2c0l0%2c6.34l0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_15'%3e %3crect id='svg_16' height='6.34' width='42.87' class='st0' y='27.89' x='274.07'/%3e %3c/g%3e %3cg id='svg_17'%3e %3crect id='svg_18' height='61.38' width='6.34' class='st0' y='14.89' x='293.05'/%3e %3c/g%3e %3cg id='svg_19'%3e %3crect id='svg_20' height='6.34' width='33.26' class='st0' transform='matrix(0.11%2c-0.9939%2c0.9939%2c0.11%2c194.7608%2c392.0006) ' y='46.985071' x='325.728637'/%3e %3c/g%3e %3cg id='svg_21'%3e %3crect id='svg_22' height='33.26' width='6.34' class='st0' transform='matrix(0.9939%2c-0.11%2c0.11%2c0.9939%2c-7.5075%2c38.3801) ' y='37.060893' x='310.495485'/%3e %3c/g%3e %3cg id='svg_23'%3e %3cpath id='svg_24' d='m352.9%2c77.14l-15.15%2c0c-7.52%2c0 -13.64%2c-6.12 -13.64%2c-13.63l0%2c-29.61c0%2c-7.52 6.12%2c-13.64 13.64%2c-13.64l15.15%2c0c7.52%2c0 13.64%2c6.12 13.64%2c13.64l0%2c29.61c0%2c7.52 -6.12%2c13.63 -13.64%2c13.63zm-15.15%2c-50.54c-4.02%2c0 -7.3%2c3.27 -7.3%2c7.3l0%2c29.61c0%2c4.02 3.27%2c7.3 7.3%2c7.3l15.15%2c0c4.02%2c0 7.3%2c-3.27 7.3%2c-7.3l0%2c-29.61c0%2c-4.02 -3.27%2c-7.3 -7.3%2c-7.3l-15.15%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_25'%3e %3cg id='svg_26'%3e %3crect id='svg_27' height='6.34' width='17.8' class='st0' y='37.2' x='336.43'/%3e %3c/g%3e %3cg id='svg_28'%3e %3crect id='svg_29' height='6.34' width='17.8' class='st0' y='53.87' x='336.43'/%3e %3c/g%3e %3c/g%3e %3cg id='svg_30'%3e %3cpath id='svg_31' d='m352.7%2c113.84l-37.98%2c0c-8%2c0 -14.5%2c-6.51 -14.5%2c-14.5l0%2c-16.14l6.34%2c0l0%2c16.13c0%2c4.5 3.66%2c8.17 8.17%2c8.17l37.98%2c0l0%2c6.34l-0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_32'%3e %3crect id='svg_33' height='6.34' width='23.57' class='st0' transform='matrix(0.2529%2c-0.9675%2c0.9675%2c0.2529%2c114.4986%2c402.9877) ' y='83.698593' x='326.836101'/%3e %3c/g%3e %3cg id='svg_34'%3e %3crect id='svg_35' height='6.34' width='20.52' class='st0' y='86.2' x='321.58'/%3e %3c/g%3e %3cg id='svg_36'%3e %3crect id='svg_37' height='24.75' width='6.34' class='st0' transform='matrix(0.9556%2c-0.2946%2c0.2946%2c0.9556%2c-19.7967%2c122.424) ' y='75.874073' x='369.686666'/%3e %3c/g%3e %3cg id='svg_38'%3e %3crect id='svg_39' height='6.34' width='71.83' class='st0' y='20.46' x='395.51'/%3e %3c/g%3e %3cg id='svg_40'%3e %3crect id='svg_41' height='6.34' width='90.81' class='st0' y='57.44' x='386.02'/%3e %3c/g%3e %3cg id='svg_42'%3e %3cpath id='svg_43' d='m463.12%2c113.64l-56%2c0c-4.5%2c0 -8.59%2c-2.29 -10.94%2c-6.14c-2.35%2c-3.84 -2.52%2c-8.53 -0.46%2c-12.53l17.68%2c-35.81l5.64%2c2.89l-17.68%2c35.81c-1.04%2c2.02 -0.95%2c4.39 0.23%2c6.33c1.19%2c1.94 3.25%2c3.1 5.53%2c3.1l56%2c0c1.51%2c0 2.88%2c-0.71 3.74%2c-1.95c0.81%2c-1.16 1.03%2c-2.57 0.63%2c-3.91l-7.8%2c-12.34l5.36%2c-3.39l8.18%2c12.94l0.12%2c0.31c1.24%2c3.34 0.76%2c7.08 -1.28%2c10.01c-2.04%2c2.94 -5.39%2c4.68 -8.95%2c4.68z' class='st0'/%3e %3c/g%3e %3c/g%3e %3c/g%3e%3c/svg%3e",height:"30"})}),t,e("div",{className:"d-flex align-items-center",children:n(A,{navbar:!0,children:[e(A.Toggle,{as:Te,className:"nav-link",children:e("i",{className:"bi bi-person-circle"})}),e(A.Menu,{className:"shadow",children:r})]})})]})})}const Me=o.header(Pe||(Pe=ne(["\n height: 54px;\n"])));var qe,He;o.div(qe||(qe=ne(["\n position: relative;\n"])));const Ke=o.div(He||(He=ne(["\n display: ",";\n position: absolute;\n top: 0 !important;\n left: 0 !important;\n width: 100%;\n height: 100%;\n text-align: center;\n vertical-align: middle;\n padding: 1em;\n background-color: ",";\n opacity: ",";\n line-height: 1;\n animation-fill-mode: both;\n animation-duration: .5s;\n transition: background-color .5s linear;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n user-select: none;\n will-change: opacity;\n z-index: 990;\n"])),(e=>e.active?"flex":"none"),(e=>e.inverted?"rgba(255, 255, 255, .85)":"rgba(0, 0, 0, .85)"),(e=>e.active?1:0));var Re;function Ve(c){let{loading:t=!0,children:r,variant:i="success",animation:o="border",wrap:a,...s}=c;return t?(r&&(r=e("p",{className:"mt-3 text-secondary",children:r})),r=n(Ke,{inverted:!0,active:!0,children:[e(D,{animation:o,variant:i,...s}),r]}),a?e(Ge,{height:"number"==typeof a?a:150,children:r}):r):null}const Ge=o.div(Re||(Re=ne(["\n position: relative;\n height: ",";\n"])),(e=>"".concat(e.height,"px")));K.attach(),H.defaults.raxConfig={retryDelay:2e3,backoffType:"static",shouldRetry:e=>{var n,c;return"GET"===(null===(n=e.config.method)||void 0===n?void 0:n.toUpperCase())&&449===(null===(c=e.response)||void 0===c?void 0:c.status)}},H.defaults.maxContentLength=1/0,H.defaults.maxBodyLength=1/0,H.defaults.baseURL="/api",H.interceptors.request.use((e=>{const n=sessionStorage.getItem("authorization");return n&&(e.headers={...e.headers,Authorization:"Bearer ".concat(n)}),e}),(e=>Promise.reject(e)));const Ye=e=>e&&"object"==typeof e;H.interceptors.response.use((e=>(201===e.status&&e.data.location&&(window.location.href=e.data.location,e.data=void 0),e)),(e=>{if(H.isAxiosError(e)&&e.response){const{data:n,status:c}=e.response;if(401===c){if(Ye(n)&&n.url){"/logout"!==window.location.pathname&&sessionStorage.setItem("redirect_uri",window.location.pathname+window.location.search);const e=window.location.origin+"/login";window.location.href=q.stringifyUrl({url:n.url,query:{redirect_uri:e}})}e.errors="Unauthorized"}else Ye(n)?422===c?e.errors=n:"message"in n&&(e.errors=n.message):e.errors=n}return Promise.reject(e)}));const $e=H.isAxiosError,Je=async function(e){e="string"==typeof e?{url:e}:e;const{data:n}=await H.request({paramsSerializer:function(e){return q.stringify(e,{sort:!1,skipNull:!0,skipEmptyString:!0})},...e});return n};function Qe(){const n=s(),c=q.parse(n.hash.substr(1));sessionStorage.setItem("authorization",c.access_token);const t=sessionStorage.getItem("redirect_uri");return t&&sessionStorage.removeItem("redirect_uri"),e(m,{to:t||"/",replace:!0})}function We(){return b((()=>{Je("/logout").catch((()=>{sessionStorage.removeItem("authorization")}))}),[]),e(Ve,{})}function Xe(c){let{children:t}=c;return e(d,{children:n(u,{children:[e(h,{path:"*",element:t}),e(h,{path:"login",element:e(Qe,{})}),e(h,{path:"logout",element:e(We,{})})]})})}function Ze(t){let{children:r,title:i,className:o,...a}=t;return e(F,{className:R("border-0 shadow-sm mb-3",o),...a,children:n("div",{className:"card-body",children:[i&&n(c,{children:[e("h5",{children:i}),e("hr",{})]}),r]})})}function en(n){let{errors:c}=n;return c?e(I,{variant:"danger",children:e("ul",{className:"mb-0",children:"string"==typeof c?e("li",{children:c}):Object.entries(c).map((n=>{let[c,t]=n;return e("li",{children:t},c)}))})}):null}const nn=f.createContext([null,()=>{}]),cn=function(n){let{children:c,user:t}=n;const[r,i]=x(t);return b((()=>{i(t)}),[t]),r?e(nn.Provider,{value:[r,i],children:c}):e(Ve,{})};function tn(){const[e,n]=y(nn);if(!e)throw new Error("please use `useUser` in UserContext");return[e,n]}function rn(n){let{require:t,children:r,fallback:i}=n;const[o]=tn();let a=!1;return"function"==typeof t?a=t(o):("string"==typeof t&&(t=[t]),a=V(o.roles,t).length>0),a||(r=i),e(c,{children:r})}var on,an;function sn(n){let{children:c,size:t="small"}=n;"string"==typeof t&&(t={small:8,middle:16,large:24}[t]);const r=w.map(c,(n=>{if(n)return e(dn,{children:n})}));return e(ln,{size:t,children:r})}const ln=o.div(on||(on=ne(["\n display: inline-flex;\n align-items: center;\n gap: ","px;\n"])),(e=>e.size)),dn=o.div(an||(an=ne(["\n\n"])));var un;function hn(){return hn=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var c=arguments[n];for(var t in c)Object.prototype.hasOwnProperty.call(c,t)&&(e[t]=c[t])}return e},hn.apply(this,arguments)}const mn=e=>p.createElement("svg",hn({className:"step_check_svg__icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor"},e),un||(un=p.createElement("path",{d:"M887.904 298.208c-12.864-12.064-33.152-11.488-45.216 1.408L415.936 753.984l-233.12-229.696c-12.608-12.416-32.864-12.288-45.28.32-12.416 12.576-12.256 32.864.352 45.248l256.48 252.672c.096.096.224.128.32.224s.128.224.224.32c2.016 1.92 4.448 3.008 6.784 4.288 1.152.672 2.144 1.664 3.36 2.144 3.776 1.472 7.776 2.24 11.744 2.24 4.192 0 8.384-.832 12.288-2.496 1.312-.544 2.336-1.664 3.552-2.368 2.4-1.408 4.896-2.592 6.944-4.672.096-.096.128-.256.224-.352.064-.096.192-.128.288-.224L889.28 343.424c12.16-12.832 11.488-33.088-1.376-45.216z"})));var gn;function pn(n){return e(fn,{icons:{finish:e(mn,{}),error:e(c,{})},...n})}pn.Step=Q.Step;const fn=o(Q)(gn||(gn=ne(["\n .rc-steps-item-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n & > .rc-steps-icon {\n top: 0;\n }\n }\n\n .rc-steps-item-process {\n .rc-steps-item-icon {\n background: var(--bs-primary);\n border-color: var(--bs-primary);\n }\n }\n\n .rc-steps-item-finish {\n .rc-steps-item-icon {\n border-color: var(--bs-primary);\n\n & > .rc-steps-icon {\n color: var(--bs-primary);\n }\n }\n\n .rc-steps-item-title:after {\n background-color: var(--bs-primary);\n }\n }\n\n"])));function vn(n){let{value:t,locale:r="zh-CN",currency:i=!0}=n;const o=v((()=>{let e={};return e=i?{style:"currency",currency:"CNY",...e}:{minimumFractionDigits:2},new Intl.NumberFormat(r,e)}),[i,r]);return e(c,{children:o.format(t)})}function bn(n){let{loading:c,children:t,...r}=n;return e(O,{...r,disabled:c,children:c?"Loading…":t})}function xn(e){let{url:n,method:c,confirm:t,onSuccess:r,children:i,disabled:o,as:a=O,...s}=e;const[l,d]=x(!1),u=_((async e=>{e.preventDefault();try{if(d(!0),t&&!await Ce.confirm({text:t}))return;const e="string"==typeof n?{url:n,method:c}:{method:c,...n},i=await Je(e);r&&r(i)}catch(e){if(!H.isAxiosError(e))throw e;{let n=e.errors;"string"!=typeof e.errors&&(n=Object.values(e.errors).join("<br />")),Ce.error({text:n})}}finally{d(!1)}}),[n,c,d]);return k(a,{...s,disabled:o||l,onClick:u},i)}function yn(n){let{to:c,replace:t,...r}=n,i=g();return e(O,{...r,onClick:e=>{e.preventDefault(),i(c,{replace:t})}})}const wn=require("ajv-i18n/localize/zh"),_n={upload:function(n){const{widgets:c}=X(),t={...n.options,async onUpload(e){if(n.options.onUpload instanceof Function)return await n.options.onUpload.call(e);if(n.options.endpoint){const c=new FormData;c.set("file",e);const{url:t}=await Je({url:n.options.endpoint,method:"post",data:c});return t}}};return e(c.upload,{...n,options:t})}},kn=z(((n,c)=>{let{action:t,method:r="post",onSuccess:i,formData:o,onSubmit:a,onChange:s,submitText:l="提交",children:d,...u}=n;const[h,m]=x(),[g,p]=x(!1),[f,v]=x(o),b=_((async(e,n)=>{try{if(p(!0),t){const{formData:n}=e;try{const e=await Je({url:t,method:r,data:n});m(void 0),i&&await i(e)}catch(e){throw H.isAxiosError(e)&&m((e=>{const n=e.errors;return"string"==typeof n?{__errors:[n]}:G(n,(e=>({__errors:[e]})))})(e)),e}}else a&&await a(e,n)}finally{p(!1)}}),[t,r,a]),y=_((e=>{const{formData:n}=e;v(n),s&&s(e)}),[v,s]),w=_((e=>(e=e.map((e=>({keyword:e.name,dataPath:e.property,...e}))),wn(e),e)),[]),k=e(bn,{loading:g,type:"submit",variant:"primary",children:l});return"function"==typeof d&&(d=d({submit:k,loading:g})),e(W,{ref:c,extraErrors:h,onSubmit:b,transformErrors:w,noHtml5Validate:!0,noValidate:!0,...u,formData:f,onChange:y,widgets:_n,children:d||e("div",{className:"col-12",children:k})})}));var zn,Cn,Sn,Nn,jn;const En=o.div(zn||(zn=ne(["\n width: 100%;\n"]))),An=o.div(Cn||(Cn=ne(["\n background-color: #fff;\n display: flex;\n\n .container {\n padding: 0 24px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n"]))),Dn=o.div(Sn||(Sn=ne(["\n margin-top: 24px;\n"]))),Fn=o.div(Nn||(Nn=ne(["\n font-size: 22px;\n line-height: 64px;\n height: 64px;\n"]))),In=o.div(jn||(jn=ne(["\n\n"])));function On(c){let{title:t,children:r,extra:i}=c;return n(En,{children:[e(An,{children:n("div",{className:"container",children:[e(Fn,{children:t}),e(In,{children:i})]})}),e(Dn,{className:"container",children:r})]})}function Bn(){}function Ln(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}const Pn=function(n){let{indeterminate:c=!1,...t}=n;const r=C(null);return b((()=>{r.current&&(r.current.indeterminate=c)}),[c]),e("input",{ref:r,...t,className:"form-check-input",type:"checkbox"})};var Tn,Un,Mn,qn,Hn,Kn;const Rn=o(L)(Tn||(Tn=ne(["\n .rc-table-thead {\n border-top: none;\n }\n"]))),Vn={table:n=>e(Rn,{...n,className:"align-middle table-hover"})},Gn=o((function(n){let{total:c=0,onChange:t=Bn,defaultCurrent:r=1,defaultPageSize:i=10,className:o,...a}=n;const[s,l]=x(r),[d,u]=x(i);b((()=>{Ln(a.current)&&l(a.current)}),[a.current]),b((()=>{Ln(a.pageSize)&&u(a.pageSize)}),[a.pageSize]);const h=v((()=>Math.floor((c-1)/d)+1),[c,d]),m=_((e=>()=>{e!==s&&(l(e),t(e,d))}),[t,s,d]),g=s-1>0?s-1:0,p=s+1<h?s+1:h,f=[];let y=null,w=null,k=null,z=null;if(h<=7)for(let n=1;n<=h;n+=1){const c=s===n;f.push(e(B.Item,{active:c,onClick:m(n),children:n},n))}else{z=e(B.Last,{onClick:m(h)},"last"),k=e(B.First,{onClick:m(1)},"first"),y=e(B.Prev,{onClick:m(g)},"prev"),w=e(B.Next,{onClick:m(p)},"next");let n=Math.max(1,s-2),c=Math.min(s+2,h);s-1<=2&&(c=5),h-s<=2&&(n=h-4);for(let t=n;t<=c;t+=1){const n=s===t;f.push(e(B.Item,{active:n,onClick:m(t),children:t},t))}s-1>=4&&3!==s&&f.unshift(y),h-s>=4&&s!==h-2&&f.push(w),1!==n&&f.unshift(k),c!==h&&f.push(z)}return e(B,{className:o,children:f})}))(Un||(Un=ne(["\n margin-bottom: 0;\n justify-content: flex-end;\n"])));function Yn(e){return"current_page"in e}const $n=z(((t,r)=>{let{source:i,rowKey:o="id",paginate:a=!0,toolBarRender:s,columns:l=[],search:d,rowSelection:u,card:h=!0,...m}=t;const[g,p]=x([]),[f,y]=x(a?{total:0,current:1,pageSize:10}:null),[w,k]=x(!0),[z,N]=x(""),j=_((async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};k(!0);try{let n;if("string"==typeof i){const c={q:z};f&&(c.page=e.page||f.current),n=await Je({url:i,params:c})}else n=await i();a&&Yn(n)&&(y({total:n.total,current:n.current_page,pageSize:n.per_page}),n=n.data),p(n)}catch(e){}finally{k(!1)}}),[i,p,f,z]);b((()=>{j()}),[z]);const E=C({reload:j});b((()=>{E.current={reload:j}}),[j]),S(r,(()=>E.current));const[A]=function(n,c,t){const[r,i]=x((()=>new Set((null==n?void 0:n.selectedRowKeys)||[]))),o=e=>"string"==typeof c?e[c]:c(e),a=e=>t.find((n=>o(n)===e)),s=_((e=>{i(e);const c=Array.from(e),t=c.map((function(e){return a(e)}));null!=n&&n.onChange&&(null==n||n.onChange(c,t))}),[a]);return[_((c=>{if(!n)return c;const i=t.map(o),a=i.every((function(e){return r.has(e)})),l=i.some((function(e){return r.has(e)}));return[{key:"selection",title:e(Pn,{checked:a,indeterminate:!a&&l,onChange:()=>{a?i.forEach((function(e){r.delete(e)})):i.forEach((function(e){r.add(e)})),s(new Set(r))}}),width:30,align:"center",render(n){let{record:c}=n;const t=o(c),i=r.has(t);return e(Pn,{checked:i,onChange:()=>{i?r.delete(t):r.add(t),s(new Set(r))}})}},...c]}),[t,n,r])]}(u,o,g),D=v((()=>A(l).map((e=>{const n={...e,render:void 0};if("render"in e&&e.render){const c=e.render;n.render=(e,n,t)=>c({value:e,record:n,index:t,action:E.current})}return n}))),[l,A,E]),F=function(e,n,c){const t=C(e),r=C(Y(e,n,c));return b((()=>{t.current=e})),b((()=>{r.current=Y((function(){t.current(...arguments)}),n,c)}),[n,c]),r.current}((e=>{N(e.target.value)}),500),I=n(c,{children:[e(Ve,{loading:w}),!1!==s&&n(Jn,{children:[e(Wn,{size:12,children:s&&s(E.current)}),n(Qn,{size:12,children:[d&&e(P.Control,{onChange:F,type:"search",placeholder:"Search..."}),e(Xn,{onClick:E.current.reload,children:e("i",{className:"bi bi-arrow-repeat"})})]})]}),e(Z,{...m,rowKey:o,columns:D,components:Vn,data:g}),f&&e(Gn,{...f,onChange:e=>{j({page:e})}})]});return h?e(Ze,{children:I}):I})),Jn=o.div(Mn||(Mn=ne(["\n display: flex;\n justify-content: space-between;\n padding-bottom: 1rem;\n height: 48px;\n"]))),Qn=o(sn)(qn||(qn=ne(["\n\n"]))),Wn=o(sn)(Hn||(Hn=ne(["\n\n"]))),Xn=o.span(Kn||(Kn=ne(["\n cursor: pointer;\n font-size: 20px;\n line-height: 1;\n\n &:hover {\n color: var(--bs-primary);\n }\n"]))),Zn=z(((t,r)=>{let{text:i,variant:o="primary",header:a=i,footer:s=!0,onOk:l,size:d,onShow:u,children:h}=t;const[m,g]=x(!1),[p,f]=x(!1),v=()=>g(!1);S(r,(()=>({close:v})));return n(c,{children:[e(O,{variant:o,onClick:()=>g(!0),children:i}),n(T,{size:d,show:m,onHide:v,onShow:u,children:[a&&e(T.Header,{closeButton:!0,children:e(T.Title,{as:"h5",children:a})}),e(T.Body,{children:h}),s&&n(T.Footer,{children:[e(O,{variant:"secondary",onClick:v,children:"取消"}),e(bn,{loading:p,variant:"primary",onClick:async()=>{if(l){f(!0);const e=await l();if(f(!1),!1===e)return}v()},children:"确定"})]})]})]})}));function ec(n){let{text:c,header:t,schema:r,uiSchema:i,action:o,method:a,formData:s,variant:l,onSuccess:d,onChange:u,fields:h,size:m}=n;const g=C(null),p=C(null),f=_((async()=>{try{var e;return await(null===(e=g.current)||void 0===e?void 0:e.submit()),!0}catch{return!1}}),[]);return e(Zn,{ref:p,text:c,onOk:f,header:t,variant:l,size:m,children:e(kn,{ref:g,schema:r,uiSchema:i,action:o,method:a,formData:s,fields:h,onChange:u,onSuccess:d,children:e(N,{})})})}function nc(e){let{manual:n,refreshDeps:c,...t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{execute:r,currentParams:i,error:o,...a}=ee((async n=>(e="string"==typeof e?{url:e}:e,await Je({...e,...n}))),t);b((()=>{n||c||r()}),[]),b((()=>{c&&s()}),c);const s=_((()=>{i?r(...i):r()}),[r,i]);if(o&&$e(o)){const e=o.errors;o=new Error("string"==typeof e?e:$(e).join(""))}return{refresh:s,execute:r,error:o,...a}}let cc=0;function tc(){let{onHide:e,onShow:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[c,t]=x(!1),[r,i]=x("visible-".concat(cc)),o=_((()=>{t(!1),e&&e()}),[t,e]),a=_((()=>{i("visible-".concat(++cc))}),[i,cc]),s=_((()=>{t(!0),n&&n()}),[t,n]),l={show:c,onHide:o,onExited:a,key:r};return{visible:c,show:s,hide:o,state:l}}function rc(n){let{tooltip:c,children:t,placement:r="bottom"}=n;return e(U,{placement:r,overlay:e(M,{id:J(),children:c}),children:t})}export{rn as Access,Ze as Card,On as Content,en as Error,re as Footer,kn as Form,Ue as Header,yn as LinkButton,Ve as Loader,bn as LoadingButton,Ce as Message,Zn as ModalButton,ec as ModalForm,vn as NumberFormat,xn as RequestButton,Be as Result,Xe as Root,fe as SiderLayout,sn as Space,pn as Steps,$n as Table,rc as Tooltip,cn as UserProvider,$e as isRequestError,Je as request,tc as useOverlayState,nc as useRequest,tn as useUser};
1
+ import{jsx as e,jsxs as n,Fragment as c}from"react/jsx-runtime";import t,{SubMenu as r,MenuItem as i}from"rc-menu";import o from"styled-components";import{useRoutes as a,useLocation as s,Link as l,BrowserRouter as d,Routes as u,Route as h,Navigate as m,useNavigate as g}from"react-router-dom";import*as p from"react";import f,{useMemo as v,useState as b,useEffect as x,useContext as y,Children as w,useCallback as _,createElement as k,forwardRef as z,useRef as C,useImperativeHandle as S,Fragment as N}from"react";import"rc-menu/assets/index.css";import j from"sweetalert2/dist/sweetalert2.js";import E from"sweetalert2-react-content";import{Spinner as A,Dropdown as D,Card as F,Alert as I,Button as O,Pagination as B,Table as L,Form as P,Modal as T,OverlayTrigger as U,Tooltip as M}from"react-bootstrap";import q from"query-string";import H from"axios";import*as K from"retry-axios";import R from"classnames";import{intersection as V,mapValues as G,debounce as W,values as Y,uniqueId as $}from"lodash";import J from"rc-steps";import"rc-steps/assets/index.css";import Q,{getRegistry as X}from"@topthink/json-form";import Z from"rc-table";import{useAsyncCallback as ee}from"react-async-hook";function ne(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var ce;const te=o.footer(ce||(ce=ne(["\n\n"])));function re(){return e(te,{children:e("div",{className:"container"})})}const ie=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/";const c=[];for(const o of e){var t,r,i;if(null!==(t=o.meta)&&void 0!==t&&t.hideInMenu)continue;const e=null===(r=o.meta)||void 0===r?void 0:r.title;if(!e)continue;let a=o.path||"";a="".concat(n,"/").concat(a),a=a.replace(/\/+/,"/").replace(/\/$/,"");const s={title:e,path:a,children:[]};null!==(i=o.meta)&&void 0!==i&&i.hideChildrenInMenu||o.children&&o.children.length>0&&(s.children=ie(o.children,a)),c.push(s)}return c};var oe,ae,se,le,de,ue;const he=n=>n.map((n=>n.children.length>0?e(r,{title:n.title,children:he(n.children)},n.path):e(i,{children:e(l,{to:n.path,children:n.title})},n.path))),me=()=>({height:0}),ge=e=>({height:e.scrollHeight}),pe={motionName:"rc-menu-collapse",motionAppear:!0,onAppearStart:me,onAppearActive:ge,onEnterStart:me,onEnterActive:ge,onLeaveStart:ge,onLeaveActive:me};function fe(c){let{routes:t,basename:r,title:i}=c;const o=a(t),l=v((()=>function(e){return ie(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/")}(t,r)),[t,r]),{pathname:d}=s(),u=v((()=>{const e=[];return d.split("/").reduce(((n,c)=>(n.length>1&&e.push(n.join("/")),[...n,c])),[]),e.push(d),e}),[d]),[h,m]=b([]);x((()=>{m(u.slice(0,-1))}),[u]);return n(ve,{children:[n(be,{children:[e(xe,{children:i}),e(_e,{mode:"inline",motion:pe,openKeys:h,onOpenChange:e=>{const n=e[e.length-1];m(e.filter((e=>n.startsWith(e))))},selectedKeys:u,children:he(l)})]}),n(ye,{children:[e(we,{children:o}),e(re,{})]})]})}const ve=o.div(oe||(oe=ne(["\n display: flex;\n flex-wrap: nowrap;\n width: 100%;\n"]))),be=o.nav(ae||(ae=ne(["\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 100;\n padding: 54px 0 0;\n border-right: 1px solid #e3e3e3;\n width: 230px;\n background-color: #f5f5f5;\n"]))),xe=o.div(se||(se=ne(["\n padding: 10px 0;\n height: 64px;\n line-height: 44px;\n text-indent: 24px;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n font-size: 16px;\n"]))),ye=o.div(le||(le=ne(["\n margin-left: 230px;\n flex: 1;\n"]))),we=o.main(de||(de=ne(["\n min-height: calc(100vh - 54px);\n position: relative;\n"]))),_e=o(t)(ue||(ue=ne(["\n border: none;\n box-shadow: none;\n padding: 0;\n\n .rc-menu-item {\n display: flex;\n\n &:hover {\n background-color: #f0f0f0;\n }\n\n a {\n flex: 1;\n text-decoration: none;\n color: dimgray;\n }\n }\n\n .rc-menu-sub {\n background-color: #eee;\n border-top: 1px solid #eee;\n border-bottom: 1px solid #eee;\n\n & > li {\n &:first-child {\n margin-top: 4px;\n }\n\n &:last-child {\n margin-bottom: 4px;\n }\n }\n\n .rc-menu-item-selected {\n background-color: #eee;\n color: var(--bs-primary);\n\n & > a {\n color: var(--bs-primary);\n }\n }\n\n .rc-menu-item-active {\n background-color: #eee;\n }\n\n .rc-menu-item {\n &:hover {\n background-color: #e7e7e7;\n }\n }\n }\n\n .rc-menu-submenu {\n & > .rc-menu-submenu-title {\n &:hover {\n background-color: #e7e7e7;\n }\n }\n }\n\n .rc-menu-submenu-active > .rc-menu-submenu-title {\n background-color: #eee;\n }\n\n .rc-menu-item,\n .rc-menu-submenu > .rc-menu-submenu-title {\n padding: 0 8px 0 24px;\n font-size: 14px;\n line-height: 36px;\n cursor: pointer;\n }\n\n .rc-menu-sub > .rc-menu-item,\n .rc-menu-sub > .rc-menu-submenu > .rc-menu-submenu-title {\n padding-top: 0;\n padding-bottom: 0;\n padding-right: 0;\n }\n\n .rc-menu-submenu-arrow {\n line-height: 38px;\n }\n\n .rc-menu-item-selected {\n background-color: #f5f5f5;\n color: var(--bs-primary);\n\n & > a {\n color: var(--bs-primary);\n }\n }\n\n .rc-menu-submenu-selected {\n background-color: #eee;\n\n .rc-menu-submenu-title {\n color: var(--bs-primary);\n font-weight: 500;\n }\n }\n\n & > .rc-menu-item {\n line-height: 38px;\n }\n\n & > .rc-menu-submenu {\n &.rc-menu-submenu-selected {\n background-color: #f5f5f5;\n }\n\n & > .rc-menu-submenu-title {\n line-height: 38px;\n\n &:hover {\n background-color: #f0f0f0;\n }\n }\n\n &.rc-menu-submenu-active > .rc-menu-submenu-title {\n background-color: #f5f5f5;\n }\n\n & > .rc-menu-sub {\n border-top: 1px solid #e6e6e6;\n border-bottom: 1px solid #e6e6e6;\n\n & > li {\n &:first-child {\n margin-top: 9px;\n }\n\n &:last-child {\n margin-bottom: 9px;\n }\n }\n }\n }\n\n"]))),ke=E(j),ze={confirmButtonText:"确定",cancelButtonText:"取消"},Ce={confirm:async e=>{const{isConfirmed:n}=await ke.fire({...ze,icon:"warning",showCancelButton:!0,...e});return n},error:e=>{ke.fire({...ze,toast:!0,position:"top",icon:"error",timer:3e3,showConfirmButton:!1,...e})}};var Se,Ne,je,Ee;const Ae=o.div(Se||(Se=ne(["\n padding: 48px 32px;\n"]))),De=o.div(Ne||(Ne=ne(["\n margin-bottom: 24px;\n text-align: center;\n font-size: 72px;\n"]))),Fe=o.div(je||(je=ne(["\n color: rgba(0, 0, 0, .85);\n font-size: 24px;\n line-height: 1.8;\n text-align: center;\n"]))),Ie=o.div(Ee||(Ee=ne(["\n margin-top: 32px;\n text-align: center;\n"]))),Oe={success:e("i",{className:"bi bi-check-circle-fill text-success"}),error:e("i",{className:"bi bi-exclamation-circle-fill text-danger"}),info:e("i",{className:"bi bi-info-circle-fill text-info"}),warning:e("i",{className:"bi bi-exclamation-triangle-fill text-warning"})};function Be(c){let{status:t,title:r,icon:i,extra:o}=c;return!i&&t&&(i=Oe[t]),n(Ae,{children:[i&&e(De,{children:i}),r&&e(Fe,{children:r}),o&&e(Ie,{children:o})]})}var Le,Pe;o.div(Le||(Le=ne(["\n position: relative;\n"])));const Te=o.div(Pe||(Pe=ne(["\n display: ",";\n position: absolute;\n top: 0 !important;\n left: 0 !important;\n width: 100%;\n height: 100%;\n text-align: center;\n vertical-align: middle;\n padding: 1em;\n background-color: ",";\n opacity: ",";\n line-height: 1;\n animation-fill-mode: both;\n animation-duration: .5s;\n transition: background-color .5s linear;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n user-select: none;\n will-change: opacity;\n z-index: 990;\n"])),(e=>e.active?"flex":"none"),(e=>e.inverted?"rgba(255, 255, 255, .85)":"rgba(0, 0, 0, .85)"),(e=>e.active?1:0));var Ue;function Me(c){let{loading:t=!0,children:r,variant:i="success",animation:o="border",wrap:a,...s}=c;return t?(r&&(r=e("p",{className:"mt-3 text-secondary",children:r})),r=n(Te,{inverted:!0,active:!0,children:[e(A,{animation:o,variant:i,...s}),r]}),a?e(qe,{height:"number"==typeof a?a:150,children:r}):r):null}const qe=o.div(Ue||(Ue=ne(["\n position: relative;\n height: ",";\n"])),(e=>"".concat(e.height,"px"))),He=f.createContext([null,()=>{}]),Ke=function(n){let{children:c,user:t}=n;const[r,i]=b(t);return x((()=>{i(t)}),[t]),r?e(He.Provider,{value:[r,i],children:c}):e(Me,{})};function Re(){const[e,n]=y(He);if(!e)throw new Error("please use `useUser` in UserContext");return[e,n]}var Ve,Ge;const We=o.a(Ve||(Ve=ne(["\n cursor: pointer;\n"])));function Ye(c){let{children:t,menus:r}=c;const[i]=Re();return e($e,{className:"navbar navbar-expand-lg navbar-light bg-white border-bottom sticky-top",children:n("div",{className:"container-fluid",children:[e("a",{className:"navbar-brand",href:"https://www.topthink.com",children:e("img",{src:"data:image/svg+xml,%3csvg width='485' height='132' xmlns='http://www.w3.org/2000/svg' xml:space='preserve' style='enable-background:new 0 0 531.69 198.43%3b' version='1.1'%3e %3cstyle type='text/css'%3e.st0%7bfill:%233C60FF%3b%7d%3c/style%3e %3cg%3e %3ctitle%3ebackground%3c/title%3e %3crect fill='none' id='canvas_background' height='134' width='487' y='-1' x='-1'/%3e %3c/g%3e %3cg%3e %3ctitle%3eLayer 1%3c/title%3e %3cpath id='svg_1' d='m132.29%2c62.34c-1.19%2c-18.77 -10.34%2c-35.36 -24.11%2c-46.46c-11.15%2c-8.99 -25.34%2c-14.38 -40.79%2c-14.38c-0.55%2c0 -1.09%2c0.01 -1.63%2c0.02c-3.32%2c0.08 -6.57%2c0.41 -9.75%2c0.98c-30.49%2c5.38 -53.65%2c32 -53.65%2c64.04c0%2c1.87 0.08%2c3.73 0.24%2c5.57c2.5%2c29.51 24.7%2c53.4 53.41%2c58.47c2.38%2c0.42 4.8%2c0.72 7.26%2c0.86c0.83%2c0.05 1.66%2c0.09 2.5%2c0.11c0.54%2c0.01 1.08%2c0.02 1.63%2c0.02c34.04%2c0 61.97%2c-26.16 64.79%2c-59.46c0.16%2c-1.83 0.24%2c-3.69 0.24%2c-5.57c0%2c-1.42 -0.05%2c-2.82 -0.14%2c-4.2zm-76.27%2c32.5c-0.26%2c0.01 -0.53%2c0.01 -0.79%2c0.01c-14.56%2c0 -26.88%2c-9.57 -31.03%2c-22.76c-0.97%2c-3.08 -1.49%2c-6.35 -1.49%2c-9.75c0%2c-17.95 14.56%2c-32.52 32.51%2c-32.52c0.26%2c0 0.53%2c0 0.79%2c0.01c3.41%2c0.08 6.69%2c0.68 9.75%2c1.74c6.5%2c2.22 12.06%2c6.45 15.97%2c11.94c1.98%2c2.78 3.54%2c5.9 4.57%2c9.25c0.94%2c3.03 1.44%2c6.24 1.44%2c9.58l-9.75%2c0c0%2c-2.18 -0.31%2c-4.29 -0.88%2c-6.28c-0.92%2c-3.23 -2.55%2c-6.17 -4.69%2c-8.64c-1.86%2c-2.14 -4.12%2c-3.93 -6.65%2c-5.25c-2.93%2c-1.54 -6.24%2c-2.46 -9.75%2c-2.58c-0.26%2c-0.01 -0.52%2c-0.01 -0.79%2c-0.01c-12.57%2c0 -22.76%2c10.19 -22.76%2c22.76c0%2c3.49 0.79%2c6.8 2.19%2c9.75c3.65%2c7.69 11.49%2c13.01 20.57%2c13.01c0.27%2c0 0.53%2c-0.01 0.79%2c-0.01l0%2c9.75zm55.7%2c-17.92c-3.35%2c10.5 -13.18%2c18.09 -24.78%2c18.09c-3.13%2c0 -6.13%2c-0.55 -8.91%2c-1.57c-2.18%2c-0.8 -4.24%2c-1.88 -6.11%2c-3.21c-2.38%2c-1.68 -4.47%2c-3.76 -6.16%2c-6.13c-0.28%2c-0.39 -0.55%2c-0.79 -0.81%2c-1.2c-2.03%2c-3.2 -3.38%2c-6.87 -3.85%2c-10.82l9.87%2c0c0.33%2c1.71 0.92%2c3.32 1.74%2c4.8c1.61%2c2.91 4.09%2c5.26 7.09%2c6.72c0.57%2c0.28 1.15%2c0.53 1.76%2c0.73c1.68%2c0.6 3.49%2c0.92 5.37%2c0.92c7.92%2c0 14.52%2c-5.67 15.96%2c-13.17c0.2%2c-1 0.3%2c-2.04 0.3%2c-3.09c0%2c-2.37 -0.51%2c-4.63 -1.43%2c-6.67c-1.66%2c-3.71 -4.68%2c-6.68 -8.43%2c-8.28l3.54%2c-9.1c7.43%2c3.08 13.13%2c9.49 15.21%2c17.38c0.44%2c1.64 0.72%2c3.34 0.81%2c5.09c0.04%2c0.52 0.05%2c1.05 0.05%2c1.58c0%2c1.05 -0.07%2c2.07 -0.18%2c3.09c-0.18%2c1.68 -0.54%2c3.3 -1.04%2c4.84z' class='st0'/%3e %3cg id='svg_2'%3e %3cg id='svg_3'%3e %3crect id='svg_4' height='6.34' width='94.12' class='st0' y='20.46' x='163.29'/%3e %3c/g%3e %3cg id='svg_5'%3e %3cpath id='svg_6' d='m169.31%2c113.72l0%2c-6.34c6.49%2c0 11.77%2c-5.28 11.77%2c-11.77l0%2c-71.98l6.34%2c0l0%2c71.98c0%2c9.98 -8.12%2c18.11 -18.11%2c18.11z' class='st0'/%3e %3c/g%3e %3cg id='svg_7'%3e %3cpath id='svg_8' d='m255.49%2c91.27l-6.34%2c0l0%2c-38.2c0%2c-5.06 -4.12%2c-9.18 -9.18%2c-9.18l-19.37%2c0c-5.06%2c0 -9.18%2c4.12 -9.18%2c9.18l0%2c38.2l-6.34%2c0l0%2c-38.2c0%2c-8.55 6.96%2c-15.51 15.51%2c-15.51l19.38%2c0c8.55%2c0 15.51%2c6.96 15.51%2c15.51l0%2c38.2l0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_9'%3e %3crect id='svg_10' height='17.09' width='6.34' class='st0' y='23.63' x='227.12'/%3e %3c/g%3e %3cg id='svg_11'%3e %3cpath id='svg_12' d='m206.43%2c113.84l-3.34%2c0l0%2c-6.34l3.34%2c0c6.3%2c0 12.9%2c-3.56 15.35%2c-8.29c3.49%2c-6.71 5.33%2c-14.25 5.33%2c-21.81l0%2c-26.13l6.34%2c0l0%2c26.13c0%2c8.58 -2.09%2c17.13 -6.05%2c24.74c-3.98%2c7.68 -13.57%2c11.7 -20.97%2c11.7z' class='st0'/%3e %3c/g%3e %3cg id='svg_13'%3e %3cpath id='svg_14' d='m257.48%2c113.84l-3.34%2c0c-7.4%2c0 -16.98%2c-4.02 -20.98%2c-11.7c-3.96%2c-7.61 -6.05%2c-16.16 -6.05%2c-24.74l6.34%2c0c0%2c7.56 1.84%2c15.1 5.33%2c21.81c2.46%2c4.73 9.06%2c8.29 15.35%2c8.29l3.34%2c0l0%2c6.34l0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_15'%3e %3crect id='svg_16' height='6.34' width='42.87' class='st0' y='27.89' x='274.07'/%3e %3c/g%3e %3cg id='svg_17'%3e %3crect id='svg_18' height='61.38' width='6.34' class='st0' y='14.89' x='293.05'/%3e %3c/g%3e %3cg id='svg_19'%3e %3crect id='svg_20' height='6.34' width='33.26' class='st0' transform='matrix(0.11%2c-0.9939%2c0.9939%2c0.11%2c194.7608%2c392.0006) ' y='46.985071' x='325.728637'/%3e %3c/g%3e %3cg id='svg_21'%3e %3crect id='svg_22' height='33.26' width='6.34' class='st0' transform='matrix(0.9939%2c-0.11%2c0.11%2c0.9939%2c-7.5075%2c38.3801) ' y='37.060893' x='310.495485'/%3e %3c/g%3e %3cg id='svg_23'%3e %3cpath id='svg_24' d='m352.9%2c77.14l-15.15%2c0c-7.52%2c0 -13.64%2c-6.12 -13.64%2c-13.63l0%2c-29.61c0%2c-7.52 6.12%2c-13.64 13.64%2c-13.64l15.15%2c0c7.52%2c0 13.64%2c6.12 13.64%2c13.64l0%2c29.61c0%2c7.52 -6.12%2c13.63 -13.64%2c13.63zm-15.15%2c-50.54c-4.02%2c0 -7.3%2c3.27 -7.3%2c7.3l0%2c29.61c0%2c4.02 3.27%2c7.3 7.3%2c7.3l15.15%2c0c4.02%2c0 7.3%2c-3.27 7.3%2c-7.3l0%2c-29.61c0%2c-4.02 -3.27%2c-7.3 -7.3%2c-7.3l-15.15%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_25'%3e %3cg id='svg_26'%3e %3crect id='svg_27' height='6.34' width='17.8' class='st0' y='37.2' x='336.43'/%3e %3c/g%3e %3cg id='svg_28'%3e %3crect id='svg_29' height='6.34' width='17.8' class='st0' y='53.87' x='336.43'/%3e %3c/g%3e %3c/g%3e %3cg id='svg_30'%3e %3cpath id='svg_31' d='m352.7%2c113.84l-37.98%2c0c-8%2c0 -14.5%2c-6.51 -14.5%2c-14.5l0%2c-16.14l6.34%2c0l0%2c16.13c0%2c4.5 3.66%2c8.17 8.17%2c8.17l37.98%2c0l0%2c6.34l-0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_32'%3e %3crect id='svg_33' height='6.34' width='23.57' class='st0' transform='matrix(0.2529%2c-0.9675%2c0.9675%2c0.2529%2c114.4986%2c402.9877) ' y='83.698593' x='326.836101'/%3e %3c/g%3e %3cg id='svg_34'%3e %3crect id='svg_35' height='6.34' width='20.52' class='st0' y='86.2' x='321.58'/%3e %3c/g%3e %3cg id='svg_36'%3e %3crect id='svg_37' height='24.75' width='6.34' class='st0' transform='matrix(0.9556%2c-0.2946%2c0.2946%2c0.9556%2c-19.7967%2c122.424) ' y='75.874073' x='369.686666'/%3e %3c/g%3e %3cg id='svg_38'%3e %3crect id='svg_39' height='6.34' width='71.83' class='st0' y='20.46' x='395.51'/%3e %3c/g%3e %3cg id='svg_40'%3e %3crect id='svg_41' height='6.34' width='90.81' class='st0' y='57.44' x='386.02'/%3e %3c/g%3e %3cg id='svg_42'%3e %3cpath id='svg_43' d='m463.12%2c113.64l-56%2c0c-4.5%2c0 -8.59%2c-2.29 -10.94%2c-6.14c-2.35%2c-3.84 -2.52%2c-8.53 -0.46%2c-12.53l17.68%2c-35.81l5.64%2c2.89l-17.68%2c35.81c-1.04%2c2.02 -0.95%2c4.39 0.23%2c6.33c1.19%2c1.94 3.25%2c3.1 5.53%2c3.1l56%2c0c1.51%2c0 2.88%2c-0.71 3.74%2c-1.95c0.81%2c-1.16 1.03%2c-2.57 0.63%2c-3.91l-7.8%2c-12.34l5.36%2c-3.39l8.18%2c12.94l0.12%2c0.31c1.24%2c3.34 0.76%2c7.08 -1.28%2c10.01c-2.04%2c2.94 -5.39%2c4.68 -8.95%2c4.68z' class='st0'/%3e %3c/g%3e %3c/g%3e %3c/g%3e%3c/svg%3e",height:"30"})}),t,n(D,{navbar:!0,children:[e(D.Toggle,{as:We,className:"nav-link",children:e("img",{className:"rounded-circle",width:"25",height:"25",src:i.avatar})}),e(D.Menu,{className:"shadow",children:r})]})]})})}const $e=o.header(Ge||(Ge=ne(["\n height: 54px;\n"])));K.attach(),H.defaults.raxConfig={retryDelay:2e3,backoffType:"static",shouldRetry:e=>{var n,c;return"GET"===(null===(n=e.config.method)||void 0===n?void 0:n.toUpperCase())&&449===(null===(c=e.response)||void 0===c?void 0:c.status)}},H.defaults.maxContentLength=1/0,H.defaults.maxBodyLength=1/0,H.defaults.baseURL="/api",H.interceptors.request.use((e=>{const n=sessionStorage.getItem("authorization");return n&&(e.headers={...e.headers,Authorization:"Bearer ".concat(n)}),e}),(e=>Promise.reject(e)));const Je=e=>e&&"object"==typeof e;H.interceptors.response.use((e=>(201===e.status&&e.data.location&&(window.location.href=e.data.location,e.data=void 0),e)),(e=>{if(H.isAxiosError(e)&&e.response){const{data:n,status:c}=e.response;if(401===c){if(Je(n)&&n.url){"/logout"!==window.location.pathname&&sessionStorage.setItem("redirect_uri",window.location.pathname+window.location.search);const e=window.location.origin+"/login";window.location.href=q.stringifyUrl({url:n.url,query:{redirect_uri:e}})}e.errors="Unauthorized"}else Je(n)?422===c?e.errors=n:"message"in n&&(e.errors=n.message):e.errors=n}return Promise.reject(e)}));const Qe=H.isAxiosError,Xe=async function(e){e="string"==typeof e?{url:e}:e;const{data:n}=await H.request({paramsSerializer:function(e){return q.stringify(e,{sort:!1,skipNull:!0,skipEmptyString:!0})},...e});return n};function Ze(){const n=s(),c=q.parse(n.hash.substr(1));sessionStorage.setItem("authorization",c.access_token);const t=sessionStorage.getItem("redirect_uri");return t&&sessionStorage.removeItem("redirect_uri"),e(m,{to:t||"/",replace:!0})}function en(){return x((()=>{Xe("/logout").catch((()=>{sessionStorage.removeItem("authorization")}))}),[]),e(Me,{})}function nn(c){let{children:t}=c;return e(d,{children:n(u,{children:[e(h,{path:"*",element:t}),e(h,{path:"login",element:e(Ze,{})}),e(h,{path:"logout",element:e(en,{})})]})})}function cn(t){let{children:r,title:i,className:o,...a}=t;return e(F,{className:R("border-0 shadow-sm mb-3",o),...a,children:n("div",{className:"card-body",children:[i&&n(c,{children:[e("h5",{children:i}),e("hr",{})]}),r]})})}function tn(n){let{errors:c}=n;return c?e(I,{variant:"danger",children:e("ul",{className:"mb-0",children:"string"==typeof c?e("li",{children:c}):Object.entries(c).map((n=>{let[c,t]=n;return e("li",{children:t},c)}))})}):null}function rn(n){let{require:t,children:r,fallback:i}=n;const[o]=Re();let a=!1;return"function"==typeof t?a=t(o):("string"==typeof t&&(t=[t]),a=V(o.roles,t).length>0),a||(r=i),e(c,{children:r})}var on,an;function sn(n){let{children:c,size:t="small"}=n;"string"==typeof t&&(t={small:8,middle:16,large:24}[t]);const r=w.map(c,(n=>{if(n)return e(dn,{children:n})}));return e(ln,{size:t,children:r})}const ln=o.div(on||(on=ne(["\n display: inline-flex;\n align-items: center;\n gap: ","px;\n"])),(e=>e.size)),dn=o.div(an||(an=ne(["\n\n"])));var un;function hn(){return hn=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var c=arguments[n];for(var t in c)Object.prototype.hasOwnProperty.call(c,t)&&(e[t]=c[t])}return e},hn.apply(this,arguments)}const mn=e=>p.createElement("svg",hn({className:"step_check_svg__icon",viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor"},e),un||(un=p.createElement("path",{d:"M887.904 298.208c-12.864-12.064-33.152-11.488-45.216 1.408L415.936 753.984l-233.12-229.696c-12.608-12.416-32.864-12.288-45.28.32-12.416 12.576-12.256 32.864.352 45.248l256.48 252.672c.096.096.224.128.32.224s.128.224.224.32c2.016 1.92 4.448 3.008 6.784 4.288 1.152.672 2.144 1.664 3.36 2.144 3.776 1.472 7.776 2.24 11.744 2.24 4.192 0 8.384-.832 12.288-2.496 1.312-.544 2.336-1.664 3.552-2.368 2.4-1.408 4.896-2.592 6.944-4.672.096-.096.128-.256.224-.352.064-.096.192-.128.288-.224L889.28 343.424c12.16-12.832 11.488-33.088-1.376-45.216z"})));var gn;function pn(n){return e(fn,{icons:{finish:e(mn,{}),error:e(c,{})},...n})}pn.Step=J.Step;const fn=o(J)(gn||(gn=ne(["\n .rc-steps-item-icon {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n & > .rc-steps-icon {\n top: 0;\n }\n }\n\n .rc-steps-item-process {\n .rc-steps-item-icon {\n background: var(--bs-primary);\n border-color: var(--bs-primary);\n }\n }\n\n .rc-steps-item-finish {\n .rc-steps-item-icon {\n border-color: var(--bs-primary);\n\n & > .rc-steps-icon {\n color: var(--bs-primary);\n }\n }\n\n .rc-steps-item-title:after {\n background-color: var(--bs-primary);\n }\n }\n\n"])));function vn(n){let{value:t,locale:r="zh-CN",currency:i=!0}=n;const o=v((()=>{let e={};return e=i?{style:"currency",currency:"CNY",...e}:{minimumFractionDigits:2},new Intl.NumberFormat(r,e)}),[i,r]);return e(c,{children:o.format(t)})}function bn(n){let{loading:c,children:t,...r}=n;return e(O,{...r,disabled:c,children:c?"Loading…":t})}function xn(e){let{url:n,method:c,confirm:t,onSuccess:r,children:i,disabled:o,as:a=O,...s}=e;const[l,d]=b(!1),u=_((async e=>{e.preventDefault();try{if(d(!0),t&&!await Ce.confirm({text:t}))return;const e="string"==typeof n?{url:n,method:c}:{method:c,...n},i=await Xe(e);r&&r(i)}catch(e){if(!H.isAxiosError(e))throw e;{let n=e.errors;"string"!=typeof e.errors&&(n=Object.values(e.errors).join("<br />")),Ce.error({text:n})}}finally{d(!1)}}),[n,c,d]);return k(a,{...s,disabled:o||l,onClick:u},i)}function yn(n){let{to:c,replace:t,...r}=n,i=g();return e(O,{...r,onClick:e=>{e.preventDefault(),i(c,{replace:t})}})}const wn=require("ajv-i18n/localize/zh"),_n={upload:function(n){const{widgets:c}=X(),t={...n.options,async onUpload(e){if(n.options.onUpload instanceof Function)return await n.options.onUpload.call(e);if(n.options.endpoint){const c=new FormData;c.set("file",e);const{url:t}=await Xe({url:n.options.endpoint,method:"post",data:c});return t}}};return e(c.upload,{...n,options:t})}},kn=z(((n,c)=>{let{action:t,method:r="post",onSuccess:i,formData:o,onSubmit:a,onChange:s,submitText:l="提交",children:d,...u}=n;const[h,m]=b(),[g,p]=b(!1),[f,v]=b(o),x=_((async(e,n)=>{try{if(p(!0),t){const{formData:n}=e;try{const e=await Xe({url:t,method:r,data:n});m(void 0),i&&await i(e)}catch(e){throw H.isAxiosError(e)&&m((e=>{const n=e.errors;return"string"==typeof n?{__errors:[n]}:G(n,(e=>({__errors:[e]})))})(e)),e}}else a&&await a(e,n)}finally{p(!1)}}),[t,r,a]),y=_((e=>{const{formData:n}=e;v(n),s&&s(e)}),[v,s]),w=_((e=>(e=e.map((e=>({keyword:e.name,dataPath:e.property,...e}))),wn(e),e)),[]),k=e(bn,{loading:g,type:"submit",variant:"primary",children:l});return"function"==typeof d&&(d=d({submit:k,loading:g})),e(Q,{ref:c,extraErrors:h,onSubmit:x,transformErrors:w,noHtml5Validate:!0,noValidate:!0,...u,formData:f,onChange:y,widgets:_n,children:d||e("div",{className:"col-12",children:k})})}));var zn,Cn,Sn,Nn,jn;function En(c){let{title:t,children:r,extra:i}=c;return n(An,{children:[e(Dn,{children:n("div",{className:"container",children:[e(In,{children:t}),e(On,{children:i})]})}),e(Fn,{className:"container",children:r})]})}const An=o.div(zn||(zn=ne(["\n width: 100%;\n"]))),Dn=o.div(Cn||(Cn=ne(["\n background-color: #fff;\n display: flex;\n\n .container {\n padding: 0 24px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n"]))),Fn=o.div(Sn||(Sn=ne(["\n margin-top: 24px;\n"]))),In=o.div(Nn||(Nn=ne(["\n font-size: 22px;\n line-height: 64px;\n height: 64px;\n"]))),On=o.div(jn||(jn=ne(["\n\n"])));function Bn(){}function Ln(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}const Pn=function(n){let{indeterminate:c=!1,...t}=n;const r=C(null);return x((()=>{r.current&&(r.current.indeterminate=c)}),[c]),e("input",{ref:r,...t,className:"form-check-input",type:"checkbox"})};var Tn,Un,Mn,qn,Hn,Kn;const Rn=o(L)(Tn||(Tn=ne(["\n .rc-table-thead {\n border-top: none;\n }\n"]))),Vn={table:n=>e(Rn,{...n,className:"align-middle table-hover"})},Gn=o((function(n){let{total:c=0,onChange:t=Bn,defaultCurrent:r=1,defaultPageSize:i=10,className:o,...a}=n;const[s,l]=b(r),[d,u]=b(i);x((()=>{Ln(a.current)&&l(a.current)}),[a.current]),x((()=>{Ln(a.pageSize)&&u(a.pageSize)}),[a.pageSize]);const h=v((()=>Math.floor((c-1)/d)+1),[c,d]),m=_((e=>()=>{e!==s&&(l(e),t(e,d))}),[t,s,d]),g=s-1>0?s-1:0,p=s+1<h?s+1:h,f=[];let y=null,w=null,k=null,z=null;if(h<=7)for(let n=1;n<=h;n+=1){const c=s===n;f.push(e(B.Item,{active:c,onClick:m(n),children:n},n))}else{z=e(B.Last,{onClick:m(h)},"last"),k=e(B.First,{onClick:m(1)},"first"),y=e(B.Prev,{onClick:m(g)},"prev"),w=e(B.Next,{onClick:m(p)},"next");let n=Math.max(1,s-2),c=Math.min(s+2,h);s-1<=2&&(c=5),h-s<=2&&(n=h-4);for(let t=n;t<=c;t+=1){const n=s===t;f.push(e(B.Item,{active:n,onClick:m(t),children:t},t))}s-1>=4&&3!==s&&f.unshift(y),h-s>=4&&s!==h-2&&f.push(w),1!==n&&f.unshift(k),c!==h&&f.push(z)}return e(B,{className:o,children:f})}))(Un||(Un=ne(["\n margin-bottom: 0;\n justify-content: flex-end;\n"])));function Wn(e){return"current_page"in e}const Yn=z(((t,r)=>{let{source:i,rowKey:o="id",paginate:a=!0,toolBarRender:s,columns:l=[],search:d,rowSelection:u,card:h=!0,...m}=t;const[g,p]=b([]),[f,y]=b(a?{total:0,current:1,pageSize:10}:null),[w,k]=b(!0),[z,N]=b(""),j=_((async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};k(!0);try{let n;if("string"==typeof i){const c={q:z};f&&(c.page=e.page||f.current),n=await Xe({url:i,params:c})}else n=await i();a&&Wn(n)&&(y({total:n.total,current:n.current_page,pageSize:n.per_page}),n=n.data),p(n)}catch(e){}finally{k(!1)}}),[i,p,f,z]);x((()=>{j()}),[z]);const E=C({reload:j});x((()=>{E.current={reload:j}}),[j]),S(r,(()=>E.current));const[A]=function(n,c,t){const[r,i]=b((()=>new Set((null==n?void 0:n.selectedRowKeys)||[]))),o=e=>"string"==typeof c?e[c]:c(e),a=e=>t.find((n=>o(n)===e)),s=_((e=>{i(e);const c=Array.from(e),t=c.map((function(e){return a(e)}));null!=n&&n.onChange&&(null==n||n.onChange(c,t))}),[a]);return[_((c=>{if(!n)return c;const i=t.map(o),a=i.every((function(e){return r.has(e)})),l=i.some((function(e){return r.has(e)}));return[{key:"selection",title:e(Pn,{checked:a,indeterminate:!a&&l,onChange:()=>{a?i.forEach((function(e){r.delete(e)})):i.forEach((function(e){r.add(e)})),s(new Set(r))}}),width:30,align:"center",render(n){let{record:c}=n;const t=o(c),i=r.has(t);return e(Pn,{checked:i,onChange:()=>{i?r.delete(t):r.add(t),s(new Set(r))}})}},...c]}),[t,n,r])]}(u,o,g),D=v((()=>A(l).map((e=>{const n={...e,render:void 0};if("render"in e&&e.render){const c=e.render;n.render=(e,n,t)=>c({value:e,record:n,index:t,action:E.current})}return n}))),[l,A,E]),F=function(e,n,c){const t=C(e),r=C(W(e,n,c));return x((()=>{t.current=e})),x((()=>{r.current=W((function(){t.current(...arguments)}),n,c)}),[n,c]),r.current}((e=>{N(e.target.value)}),500),I=n(c,{children:[e(Me,{loading:w}),!1!==s&&n($n,{children:[e(Qn,{size:12,children:s&&s(E.current)}),n(Jn,{size:12,children:[d&&e(P.Control,{onChange:F,type:"search",placeholder:"Search..."}),e(Xn,{onClick:E.current.reload,children:e("i",{className:"bi bi-arrow-repeat"})})]})]}),e(Z,{...m,rowKey:o,columns:D,components:Vn,data:g}),f&&e(Gn,{...f,onChange:e=>{j({page:e})}})]});return h?e(cn,{children:I}):I})),$n=o.div(Mn||(Mn=ne(["\n display: flex;\n justify-content: space-between;\n padding-bottom: 1rem;\n height: 48px;\n"]))),Jn=o(sn)(qn||(qn=ne(["\n\n"]))),Qn=o(sn)(Hn||(Hn=ne(["\n\n"]))),Xn=o.span(Kn||(Kn=ne(["\n cursor: pointer;\n font-size: 20px;\n line-height: 1;\n\n &:hover {\n color: var(--bs-primary);\n }\n"]))),Zn=z(((t,r)=>{let{text:i,variant:o="primary",header:a=i,footer:s=!0,onOk:l,size:d,onShow:u,children:h}=t;const[m,g]=b(!1),[p,f]=b(!1),v=()=>g(!1);S(r,(()=>({close:v})));return n(c,{children:[e(O,{variant:o,onClick:()=>g(!0),children:i}),n(T,{size:d,show:m,onHide:v,onShow:u,children:[a&&e(T.Header,{closeButton:!0,children:e(T.Title,{as:"h5",children:a})}),e(T.Body,{children:h}),s&&n(T.Footer,{children:[e(O,{variant:"secondary",onClick:v,children:"取消"}),e(bn,{loading:p,variant:"primary",onClick:async()=>{if(l){f(!0);const e=await l();if(f(!1),!1===e)return}v()},children:"确定"})]})]})]})}));function ec(n){let{text:c,header:t,schema:r,uiSchema:i,action:o,method:a,formData:s,variant:l,onSuccess:d,onChange:u,fields:h,size:m}=n;const g=C(null),p=C(null),f=_((async()=>{try{var e;return await(null===(e=g.current)||void 0===e?void 0:e.submit()),!0}catch{return!1}}),[]);return e(Zn,{ref:p,text:c,onOk:f,header:t,variant:l,size:m,children:e(kn,{ref:g,schema:r,uiSchema:i,action:o,method:a,formData:s,fields:h,onChange:u,onSuccess:d,children:e(N,{})})})}function nc(e){let{manual:n,refreshDeps:c,...t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{execute:r,currentParams:i,error:o,...a}=ee((async n=>(e="string"==typeof e?{url:e}:e,await Xe({...e,...n}))),t);x((()=>{n||c||r()}),[]),x((()=>{c&&s()}),c);const s=_((()=>{i?r(...i):r()}),[r,i]);if(o&&Qe(o)){const e=o.errors;o=new Error("string"==typeof e?e:Y(e).join(""))}return{refresh:s,execute:r,error:o,...a}}let cc=0;function tc(){let{onHide:e,onShow:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[c,t]=b(!1),[r,i]=b("visible-".concat(cc)),o=_((()=>{t(!1),e&&e()}),[t,e]),a=_((()=>{i("visible-".concat(++cc))}),[i,cc]),s=_((()=>{t(!0),n&&n()}),[t,n]),l={show:c,onHide:o,onExited:a,key:r};return{visible:c,show:s,hide:o,state:l}}function rc(n){let{tooltip:c,children:t,placement:r="bottom"}=n;return e(U,{placement:r,overlay:e(M,{id:$(),children:c}),children:t})}export{rn as Access,cn as Card,En as Content,tn as Error,re as Footer,kn as Form,Ye as Header,yn as LinkButton,Me as Loader,bn as LoadingButton,Ce as Message,Zn as ModalButton,ec as ModalForm,vn as NumberFormat,xn as RequestButton,Be as Result,nn as Root,fe as SiderLayout,sn as Space,pn as Steps,Yn as Table,rc as Tooltip,Ke as UserProvider,Qe as isRequestError,Xe as request,tc as useOverlayState,nc as useRequest,Re as useUser};
2
2
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js","../src/components/footer.tsx","../src/utils/get-menu-data.ts","../src/layout/sider.tsx","../src/utils/message.ts","../src/components/result.tsx","../src/images/logo.svg","../src/components/header.tsx","../src/components/dimmer.tsx","../src/components/loader.tsx","../src/request.ts","../src/components/root.tsx","../src/components/card.tsx","../src/components/error.tsx","../src/components/user-provider.tsx","../src/components/access.tsx","../src/components/space.tsx","../src/images/step_check.svg","../src/components/steps.tsx","../src/components/number-format.tsx","../src/components/loading-button.tsx","../src/components/request-button.tsx","../src/components/link-button.tsx","../src/components/form.tsx","../src/components/content.tsx","../src/components/pagination.tsx","../src/components/table/use-selection.tsx","../src/components/table/index.tsx","../src/hooks/use-debounce.ts","../src/components/modal-button.tsx","../src/components/modal-form.tsx","../src/hooks/use-request.ts","../src/hooks/use-overlay-state.ts","../src/components/tooltip.tsx"],"sourcesContent":["export default function _taggedTemplateLiteral(strings, raw) {\n if (!raw) {\n raw = strings.slice(0);\n }\n\n return Object.freeze(Object.defineProperties(strings, {\n raw: {\n value: Object.freeze(raw)\n }\n }));\n}","import styled from 'styled-components';\r\n\r\nconst FooterWrapper = styled.footer`\r\n\r\n`;\r\n\r\n\r\nexport default function Footer() {\r\n return <FooterWrapper>\r\n <div className='container'>\r\n\r\n </div>\r\n </FooterWrapper>;\r\n}\r\n","import type { RouteObject } from 'react-router';\r\n\r\nexport interface MenuData {\r\n path: string;\r\n title: string;\r\n children: MenuData[];\r\n}\r\n\r\nconst formatRelativePath = (\r\n routes: RouteObject[],\r\n parent: string = '/',\r\n): MenuData[] => {\r\n\r\n const menus: MenuData[] = [];\r\n\r\n for (const route of routes) {\r\n\r\n if (route.meta?.hideInMenu) {\r\n continue;\r\n }\r\n\r\n const title = route.meta?.title;\r\n if (!title) {\r\n continue;\r\n }\r\n\r\n let path = route.path || '';\r\n\r\n path = `${parent}/${path}`;\r\n\r\n path = path.replace(/\\/+/, '/').replace(/\\/$/, '');\r\n\r\n const menu: MenuData = {\r\n title,\r\n path,\r\n children: []\r\n };\r\n\r\n if (!route.meta?.hideChildrenInMenu) {\r\n if (route.children && route.children.length > 0) {\r\n menu.children = formatRelativePath(route.children, path);\r\n }\r\n }\r\n\r\n menus.push(menu);\r\n }\r\n\r\n return menus;\r\n};\r\n\r\nexport default function getMenuData(routes: RouteObject[], base: string = '/'): MenuData[] {\r\n return formatRelativePath(routes, base);\r\n}\r\n","import RcMenu, { MenuItem, SubMenu } from 'rc-menu';\r\nimport Footer from '../components/footer';\r\nimport { Link, useLocation, useRoutes } from 'react-router-dom';\r\nimport { useMemo } from 'react';\r\nimport styled from 'styled-components';\r\nimport 'rc-menu/assets/index.css';\r\nimport type { RouteObject } from 'react-router';\r\nimport getMenuData, { MenuData } from '../utils/get-menu-data';\r\nimport type { CSSMotionProps } from 'rc-motion';\r\n\r\ninterface Props {\r\n title: string;\r\n routes: RouteObject[];\r\n basename: string;\r\n}\r\n\r\nconst renderMenuItems = (items: MenuData[]) => {\r\n return items.map((item) => {\r\n if (item.children.length > 0) {\r\n return <SubMenu title={item.title} key={item.path}>\r\n {renderMenuItems(item.children)}\r\n </SubMenu>;\r\n } else {\r\n return <MenuItem key={item.path}>\r\n <Link to={item.path}>{item.title}</Link>\r\n </MenuItem>;\r\n }\r\n });\r\n};\r\n\r\nconst collapseNode = () => {\r\n return { height: 0 };\r\n};\r\nconst expandNode = (node: HTMLElement) => {\r\n return { height: node.scrollHeight };\r\n};\r\n\r\nconst motion: CSSMotionProps = {\r\n motionName: 'rc-menu-collapse',\r\n motionAppear: true,\r\n onAppearStart: collapseNode,\r\n onAppearActive: expandNode,\r\n onEnterStart: collapseNode,\r\n onEnterActive: expandNode,\r\n onLeaveStart: expandNode,\r\n onLeaveActive: collapseNode,\r\n};\r\n\r\n\r\nexport default function SiderLayout({ routes, basename, title }: Props) {\r\n\r\n const children = useRoutes(routes);\r\n\r\n const menu = useMemo(() => getMenuData(routes, basename), [routes, basename]);\r\n\r\n const { pathname } = useLocation();\r\n\r\n const openKeys = useMemo(() => {\r\n const keys: string[] = [];\r\n const parts = pathname.split('/');\r\n parts.reduce<string[]>((pre, curr) => {\r\n if (pre.length > 1) {\r\n keys.push(pre.join('/'));\r\n }\r\n return [...pre, curr];\r\n }, []);\r\n\r\n return keys;\r\n }, [pathname]);\r\n\r\n const selectedKeys = useMemo(() => {\r\n return [...openKeys, pathname];\r\n }, [pathname, openKeys]);\r\n\r\n return <Container>\r\n <Sidebar>\r\n <Header>{title}</Header>\r\n <Menu mode='inline' motion={motion} defaultOpenKeys={openKeys} selectedKeys={selectedKeys}>\r\n {renderMenuItems(menu)}\r\n </Menu>\r\n </Sidebar>\r\n <Content>\r\n <Main>{children}</Main>\r\n <Footer />\r\n </Content>\r\n </Container>;\r\n}\r\n\r\nconst Container = styled.div`\r\n display: flex;\r\n flex-wrap: nowrap;\r\n width: 100%;\r\n`;\r\n\r\nconst Sidebar = styled.nav`\r\n position: fixed;\r\n top: 0;\r\n bottom: 0;\r\n left: 0;\r\n z-index: 100;\r\n padding: 54px 0 0;\r\n border-right: 1px solid #e3e3e3;\r\n width: 230px;\r\n background-color: #f5f5f5;\r\n`;\r\n\r\nconst Header = styled.div`\r\n padding: 10px 0;\r\n height: 64px;\r\n line-height: 44px;\r\n text-indent: 24px;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n font-size: 16px;\r\n`;\r\n\r\nconst Content = styled.div`\r\n margin-left: 230px;\r\n flex: 1;\r\n`;\r\n\r\nconst Main = styled.main`\r\n min-height: calc(100vh - 54px);\r\n position: relative;\r\n`;\r\n\r\nconst Menu = styled(RcMenu)`\r\n border: none;\r\n box-shadow: none;\r\n padding: 0;\r\n\r\n .rc-menu-item {\r\n display: flex;\r\n\r\n &:hover {\r\n background-color: #f0f0f0;\r\n }\r\n\r\n a {\r\n flex: 1;\r\n text-decoration: none;\r\n color: dimgray;\r\n }\r\n }\r\n\r\n .rc-menu-sub {\r\n background-color: #eee;\r\n border-top: 1px solid #eee;\r\n border-bottom: 1px solid #eee;\r\n\r\n & > li {\r\n &:first-child {\r\n margin-top: 4px;\r\n }\r\n\r\n &:last-child {\r\n margin-bottom: 4px;\r\n }\r\n }\r\n\r\n .rc-menu-item-selected {\r\n background-color: #eee;\r\n color: var(--bs-primary);\r\n\r\n & > a {\r\n color: var(--bs-primary);\r\n }\r\n }\r\n\r\n .rc-menu-item-active {\r\n background-color: #eee;\r\n }\r\n\r\n .rc-menu-item {\r\n &:hover {\r\n background-color: #e7e7e7;\r\n }\r\n }\r\n }\r\n\r\n .rc-menu-submenu {\r\n & > .rc-menu-submenu-title {\r\n &:hover {\r\n background-color: #e7e7e7;\r\n }\r\n }\r\n }\r\n\r\n .rc-menu-submenu-active > .rc-menu-submenu-title {\r\n background-color: #eee;\r\n }\r\n\r\n .rc-menu-item,\r\n .rc-menu-submenu > .rc-menu-submenu-title {\r\n padding: 0 8px 0 24px;\r\n font-size: 14px;\r\n line-height: 36px;\r\n cursor: pointer;\r\n }\r\n\r\n .rc-menu-sub > .rc-menu-item,\r\n .rc-menu-sub > .rc-menu-submenu > .rc-menu-submenu-title {\r\n padding-top: 0;\r\n padding-bottom: 0;\r\n padding-right: 0;\r\n }\r\n\r\n .rc-menu-submenu-arrow {\r\n line-height: 38px;\r\n }\r\n\r\n .rc-menu-item-selected {\r\n background-color: #f5f5f5;\r\n color: var(--bs-primary);\r\n\r\n & > a {\r\n color: var(--bs-primary);\r\n }\r\n }\r\n\r\n .rc-menu-submenu-selected {\r\n background-color: #eee;\r\n\r\n .rc-menu-submenu-title {\r\n color: var(--bs-primary);\r\n font-weight: 500;\r\n }\r\n }\r\n\r\n & > .rc-menu-item {\r\n line-height: 38px;\r\n }\r\n\r\n & > .rc-menu-submenu {\r\n &.rc-menu-submenu-selected {\r\n background-color: #f5f5f5;\r\n }\r\n\r\n & > .rc-menu-submenu-title {\r\n line-height: 38px;\r\n\r\n &:hover {\r\n background-color: #f0f0f0;\r\n }\r\n }\r\n\r\n &.rc-menu-submenu-active > .rc-menu-submenu-title {\r\n background-color: #f5f5f5;\r\n }\r\n\r\n & > .rc-menu-sub {\r\n border-top: 1px solid #e6e6e6;\r\n border-bottom: 1px solid #e6e6e6;\r\n\r\n & > li {\r\n &:first-child {\r\n margin-top: 9px;\r\n }\r\n\r\n &:last-child {\r\n margin-bottom: 9px;\r\n }\r\n }\r\n }\r\n }\r\n\r\n`;\r\n","import Swal from 'sweetalert2/dist/sweetalert2.js';\r\nimport withReactContent from 'sweetalert2-react-content';\r\n\r\nconst CustomSwal = withReactContent(Swal);\r\n\r\ninterface MessageOptions {\r\n title?: string;\r\n text?: string;\r\n}\r\n\r\nconst defaultOptions = {\r\n confirmButtonText: '确定',\r\n cancelButtonText: '取消'\r\n};\r\n\r\nconst Message = {\r\n confirm: async (options: MessageOptions) => {\r\n const { isConfirmed } = await CustomSwal.fire({\r\n ...defaultOptions,\r\n icon: 'warning',\r\n showCancelButton: true,\r\n ...options\r\n });\r\n\r\n return isConfirmed;\r\n },\r\n error: (options: MessageOptions) => {\r\n CustomSwal.fire({\r\n ...defaultOptions,\r\n toast: true,\r\n position: 'top',\r\n icon: 'error',\r\n timer: 3000,\r\n showConfirmButton: false,\r\n ...options\r\n });\r\n }\r\n};\r\n\r\nexport default Message;\r\n","import { ReactNode } from 'react';\r\nimport styled from 'styled-components';\r\n\r\nconst Container = styled.div`\r\n padding: 48px 32px;\r\n`;\r\n\r\nconst Icon = styled.div`\r\n margin-bottom: 24px;\r\n text-align: center;\r\n font-size: 72px;\r\n`;\r\n\r\nconst Title = styled.div`\r\n color: rgba(0, 0, 0, .85);\r\n font-size: 24px;\r\n line-height: 1.8;\r\n text-align: center;\r\n`;\r\n\r\nconst Extra = styled.div`\r\n margin-top: 32px;\r\n text-align: center;\r\n`;\r\n\r\nconst IconMap = {\r\n success: <i className='bi bi-check-circle-fill text-success' />,\r\n error: <i className='bi bi-exclamation-circle-fill text-danger' />,\r\n info: <i className='bi bi-info-circle-fill text-info' />,\r\n warning: <i className='bi bi-exclamation-triangle-fill text-warning' />,\r\n};\r\n\r\ninterface ResultProps {\r\n status?: keyof typeof IconMap\r\n icon?: ReactNode\r\n title?: string\r\n extra?: ReactNode;\r\n}\r\n\r\nexport default function Result({ status, title, icon, extra }: ResultProps) {\r\n\r\n if (!icon && status) {\r\n icon = IconMap[status];\r\n }\r\n\r\n return <Container>\r\n {icon && <Icon>{icon}</Icon>}\r\n {title && <Title>{title}</Title>}\r\n {extra && <Extra>{extra}</Extra>}\r\n </Container>;\r\n}\r\n","var img = \"data:image/svg+xml,%3csvg width='485' height='132' xmlns='http://www.w3.org/2000/svg' xml:space='preserve' style='enable-background:new 0 0 531.69 198.43%3b' version='1.1'%3e %3cstyle type='text/css'%3e.st0%7bfill:%233C60FF%3b%7d%3c/style%3e %3cg%3e %3ctitle%3ebackground%3c/title%3e %3crect fill='none' id='canvas_background' height='134' width='487' y='-1' x='-1'/%3e %3c/g%3e %3cg%3e %3ctitle%3eLayer 1%3c/title%3e %3cpath id='svg_1' d='m132.29%2c62.34c-1.19%2c-18.77 -10.34%2c-35.36 -24.11%2c-46.46c-11.15%2c-8.99 -25.34%2c-14.38 -40.79%2c-14.38c-0.55%2c0 -1.09%2c0.01 -1.63%2c0.02c-3.32%2c0.08 -6.57%2c0.41 -9.75%2c0.98c-30.49%2c5.38 -53.65%2c32 -53.65%2c64.04c0%2c1.87 0.08%2c3.73 0.24%2c5.57c2.5%2c29.51 24.7%2c53.4 53.41%2c58.47c2.38%2c0.42 4.8%2c0.72 7.26%2c0.86c0.83%2c0.05 1.66%2c0.09 2.5%2c0.11c0.54%2c0.01 1.08%2c0.02 1.63%2c0.02c34.04%2c0 61.97%2c-26.16 64.79%2c-59.46c0.16%2c-1.83 0.24%2c-3.69 0.24%2c-5.57c0%2c-1.42 -0.05%2c-2.82 -0.14%2c-4.2zm-76.27%2c32.5c-0.26%2c0.01 -0.53%2c0.01 -0.79%2c0.01c-14.56%2c0 -26.88%2c-9.57 -31.03%2c-22.76c-0.97%2c-3.08 -1.49%2c-6.35 -1.49%2c-9.75c0%2c-17.95 14.56%2c-32.52 32.51%2c-32.52c0.26%2c0 0.53%2c0 0.79%2c0.01c3.41%2c0.08 6.69%2c0.68 9.75%2c1.74c6.5%2c2.22 12.06%2c6.45 15.97%2c11.94c1.98%2c2.78 3.54%2c5.9 4.57%2c9.25c0.94%2c3.03 1.44%2c6.24 1.44%2c9.58l-9.75%2c0c0%2c-2.18 -0.31%2c-4.29 -0.88%2c-6.28c-0.92%2c-3.23 -2.55%2c-6.17 -4.69%2c-8.64c-1.86%2c-2.14 -4.12%2c-3.93 -6.65%2c-5.25c-2.93%2c-1.54 -6.24%2c-2.46 -9.75%2c-2.58c-0.26%2c-0.01 -0.52%2c-0.01 -0.79%2c-0.01c-12.57%2c0 -22.76%2c10.19 -22.76%2c22.76c0%2c3.49 0.79%2c6.8 2.19%2c9.75c3.65%2c7.69 11.49%2c13.01 20.57%2c13.01c0.27%2c0 0.53%2c-0.01 0.79%2c-0.01l0%2c9.75zm55.7%2c-17.92c-3.35%2c10.5 -13.18%2c18.09 -24.78%2c18.09c-3.13%2c0 -6.13%2c-0.55 -8.91%2c-1.57c-2.18%2c-0.8 -4.24%2c-1.88 -6.11%2c-3.21c-2.38%2c-1.68 -4.47%2c-3.76 -6.16%2c-6.13c-0.28%2c-0.39 -0.55%2c-0.79 -0.81%2c-1.2c-2.03%2c-3.2 -3.38%2c-6.87 -3.85%2c-10.82l9.87%2c0c0.33%2c1.71 0.92%2c3.32 1.74%2c4.8c1.61%2c2.91 4.09%2c5.26 7.09%2c6.72c0.57%2c0.28 1.15%2c0.53 1.76%2c0.73c1.68%2c0.6 3.49%2c0.92 5.37%2c0.92c7.92%2c0 14.52%2c-5.67 15.96%2c-13.17c0.2%2c-1 0.3%2c-2.04 0.3%2c-3.09c0%2c-2.37 -0.51%2c-4.63 -1.43%2c-6.67c-1.66%2c-3.71 -4.68%2c-6.68 -8.43%2c-8.28l3.54%2c-9.1c7.43%2c3.08 13.13%2c9.49 15.21%2c17.38c0.44%2c1.64 0.72%2c3.34 0.81%2c5.09c0.04%2c0.52 0.05%2c1.05 0.05%2c1.58c0%2c1.05 -0.07%2c2.07 -0.18%2c3.09c-0.18%2c1.68 -0.54%2c3.3 -1.04%2c4.84z' class='st0'/%3e %3cg id='svg_2'%3e %3cg id='svg_3'%3e %3crect id='svg_4' height='6.34' width='94.12' class='st0' y='20.46' x='163.29'/%3e %3c/g%3e %3cg id='svg_5'%3e %3cpath id='svg_6' d='m169.31%2c113.72l0%2c-6.34c6.49%2c0 11.77%2c-5.28 11.77%2c-11.77l0%2c-71.98l6.34%2c0l0%2c71.98c0%2c9.98 -8.12%2c18.11 -18.11%2c18.11z' class='st0'/%3e %3c/g%3e %3cg id='svg_7'%3e %3cpath id='svg_8' d='m255.49%2c91.27l-6.34%2c0l0%2c-38.2c0%2c-5.06 -4.12%2c-9.18 -9.18%2c-9.18l-19.37%2c0c-5.06%2c0 -9.18%2c4.12 -9.18%2c9.18l0%2c38.2l-6.34%2c0l0%2c-38.2c0%2c-8.55 6.96%2c-15.51 15.51%2c-15.51l19.38%2c0c8.55%2c0 15.51%2c6.96 15.51%2c15.51l0%2c38.2l0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_9'%3e %3crect id='svg_10' height='17.09' width='6.34' class='st0' y='23.63' x='227.12'/%3e %3c/g%3e %3cg id='svg_11'%3e %3cpath id='svg_12' d='m206.43%2c113.84l-3.34%2c0l0%2c-6.34l3.34%2c0c6.3%2c0 12.9%2c-3.56 15.35%2c-8.29c3.49%2c-6.71 5.33%2c-14.25 5.33%2c-21.81l0%2c-26.13l6.34%2c0l0%2c26.13c0%2c8.58 -2.09%2c17.13 -6.05%2c24.74c-3.98%2c7.68 -13.57%2c11.7 -20.97%2c11.7z' class='st0'/%3e %3c/g%3e %3cg id='svg_13'%3e %3cpath id='svg_14' d='m257.48%2c113.84l-3.34%2c0c-7.4%2c0 -16.98%2c-4.02 -20.98%2c-11.7c-3.96%2c-7.61 -6.05%2c-16.16 -6.05%2c-24.74l6.34%2c0c0%2c7.56 1.84%2c15.1 5.33%2c21.81c2.46%2c4.73 9.06%2c8.29 15.35%2c8.29l3.34%2c0l0%2c6.34l0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_15'%3e %3crect id='svg_16' height='6.34' width='42.87' class='st0' y='27.89' x='274.07'/%3e %3c/g%3e %3cg id='svg_17'%3e %3crect id='svg_18' height='61.38' width='6.34' class='st0' y='14.89' x='293.05'/%3e %3c/g%3e %3cg id='svg_19'%3e %3crect id='svg_20' height='6.34' width='33.26' class='st0' transform='matrix(0.11%2c-0.9939%2c0.9939%2c0.11%2c194.7608%2c392.0006) ' y='46.985071' x='325.728637'/%3e %3c/g%3e %3cg id='svg_21'%3e %3crect id='svg_22' height='33.26' width='6.34' class='st0' transform='matrix(0.9939%2c-0.11%2c0.11%2c0.9939%2c-7.5075%2c38.3801) ' y='37.060893' x='310.495485'/%3e %3c/g%3e %3cg id='svg_23'%3e %3cpath id='svg_24' d='m352.9%2c77.14l-15.15%2c0c-7.52%2c0 -13.64%2c-6.12 -13.64%2c-13.63l0%2c-29.61c0%2c-7.52 6.12%2c-13.64 13.64%2c-13.64l15.15%2c0c7.52%2c0 13.64%2c6.12 13.64%2c13.64l0%2c29.61c0%2c7.52 -6.12%2c13.63 -13.64%2c13.63zm-15.15%2c-50.54c-4.02%2c0 -7.3%2c3.27 -7.3%2c7.3l0%2c29.61c0%2c4.02 3.27%2c7.3 7.3%2c7.3l15.15%2c0c4.02%2c0 7.3%2c-3.27 7.3%2c-7.3l0%2c-29.61c0%2c-4.02 -3.27%2c-7.3 -7.3%2c-7.3l-15.15%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_25'%3e %3cg id='svg_26'%3e %3crect id='svg_27' height='6.34' width='17.8' class='st0' y='37.2' x='336.43'/%3e %3c/g%3e %3cg id='svg_28'%3e %3crect id='svg_29' height='6.34' width='17.8' class='st0' y='53.87' x='336.43'/%3e %3c/g%3e %3c/g%3e %3cg id='svg_30'%3e %3cpath id='svg_31' d='m352.7%2c113.84l-37.98%2c0c-8%2c0 -14.5%2c-6.51 -14.5%2c-14.5l0%2c-16.14l6.34%2c0l0%2c16.13c0%2c4.5 3.66%2c8.17 8.17%2c8.17l37.98%2c0l0%2c6.34l-0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_32'%3e %3crect id='svg_33' height='6.34' width='23.57' class='st0' transform='matrix(0.2529%2c-0.9675%2c0.9675%2c0.2529%2c114.4986%2c402.9877) ' y='83.698593' x='326.836101'/%3e %3c/g%3e %3cg id='svg_34'%3e %3crect id='svg_35' height='6.34' width='20.52' class='st0' y='86.2' x='321.58'/%3e %3c/g%3e %3cg id='svg_36'%3e %3crect id='svg_37' height='24.75' width='6.34' class='st0' transform='matrix(0.9556%2c-0.2946%2c0.2946%2c0.9556%2c-19.7967%2c122.424) ' y='75.874073' x='369.686666'/%3e %3c/g%3e %3cg id='svg_38'%3e %3crect id='svg_39' height='6.34' width='71.83' class='st0' y='20.46' x='395.51'/%3e %3c/g%3e %3cg id='svg_40'%3e %3crect id='svg_41' height='6.34' width='90.81' class='st0' y='57.44' x='386.02'/%3e %3c/g%3e %3cg id='svg_42'%3e %3cpath id='svg_43' d='m463.12%2c113.64l-56%2c0c-4.5%2c0 -8.59%2c-2.29 -10.94%2c-6.14c-2.35%2c-3.84 -2.52%2c-8.53 -0.46%2c-12.53l17.68%2c-35.81l5.64%2c2.89l-17.68%2c35.81c-1.04%2c2.02 -0.95%2c4.39 0.23%2c6.33c1.19%2c1.94 3.25%2c3.1 5.53%2c3.1l56%2c0c1.51%2c0 2.88%2c-0.71 3.74%2c-1.95c0.81%2c-1.16 1.03%2c-2.57 0.63%2c-3.91l-7.8%2c-12.34l5.36%2c-3.39l8.18%2c12.94l0.12%2c0.31c1.24%2c3.34 0.76%2c7.08 -1.28%2c10.01c-2.04%2c2.94 -5.39%2c4.68 -8.95%2c4.68z' class='st0'/%3e %3c/g%3e %3c/g%3e %3c/g%3e%3c/svg%3e\";\n export default img;","import logo from '../images/logo.svg';\r\nimport { Dropdown } from 'react-bootstrap';\r\nimport styled from 'styled-components';\r\nimport { PropsWithChildren, ReactNode } from 'react';\r\n\r\nconst Avatar = styled.a`\r\n cursor: pointer;\r\n`;\r\n\r\ninterface Props {\r\n menus: ReactNode;\r\n}\r\n\r\nexport default function Header({ children, menus }: PropsWithChildren<Props>) {\r\n\r\n return <Container className='navbar navbar-light bg-white border-bottom sticky-top'>\r\n <div className='container-fluid'>\r\n <a className='navbar-brand' href='https://www.topthink.com'>\r\n <img src={logo} height='30' />\r\n </a>\r\n {children}\r\n <div className='d-flex align-items-center'>\r\n <Dropdown navbar>\r\n <Dropdown.Toggle as={Avatar} className='nav-link'>\r\n <i className='bi bi-person-circle' />\r\n </Dropdown.Toggle>\r\n <Dropdown.Menu className={'shadow'}>\r\n {menus}\r\n </Dropdown.Menu>\r\n </Dropdown>\r\n </div>\r\n </div>\r\n </Container>;\r\n}\r\n\r\nconst Container = styled.header`\r\n height: 54px;\r\n`;\r\n","import styled from 'styled-components';\r\n\r\nexport const Dimmable = styled.div`\r\n position: relative;\r\n`;\r\n\r\ninterface DimmerProps {\r\n active?: boolean\r\n inverted?: boolean\r\n}\r\n\r\nconst Dimmer = styled.div<DimmerProps>`\r\n display: ${props => props.active ? 'flex' : 'none'};\r\n position: absolute;\r\n top: 0 !important;\r\n left: 0 !important;\r\n width: 100%;\r\n height: 100%;\r\n text-align: center;\r\n vertical-align: middle;\r\n padding: 1em;\r\n background-color: ${props => props.inverted ? 'rgba(255, 255, 255, .85)' : 'rgba(0, 0, 0, .85)'};\r\n opacity: ${props => props.active ? 1 : 0};\r\n line-height: 1;\r\n animation-fill-mode: both;\r\n animation-duration: .5s;\r\n transition: background-color .5s linear;\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n user-select: none;\r\n will-change: opacity;\r\n z-index: 990;\r\n`;\r\n\r\nexport default Dimmer;\r\n","import { PropsWithChildren } from 'react';\r\nimport { Spinner, SpinnerProps } from 'react-bootstrap';\r\nimport Dimmer from './dimmer';\r\nimport styled from 'styled-components';\r\n\r\ninterface LoaderProps {\r\n loading?: boolean;\r\n animation?: SpinnerProps['animation'];\r\n wrap?: boolean;\r\n}\r\n\r\nexport default function Loader({\r\n loading = true,\r\n children,\r\n variant = 'success',\r\n animation = 'border',\r\n wrap,\r\n ...props\r\n}: PropsWithChildren<LoaderProps & Omit<SpinnerProps, 'animation'>>): JSX.Element | null {\r\n if (!loading) {\r\n return null;\r\n }\r\n\r\n if (children) {\r\n children = <p className='mt-3 text-secondary'>{children}</p>;\r\n }\r\n\r\n children = <Dimmer inverted active>\r\n <Spinner animation={animation} variant={variant} {...props} />\r\n {children}\r\n </Dimmer>;\r\n\r\n if (wrap) {\r\n return <Wrap height={typeof wrap === 'number' ? wrap : 150}>\r\n {children}\r\n </Wrap>;\r\n }\r\n\r\n return children as JSX.Element;\r\n}\r\n\r\nconst Wrap = styled.div<{ height: number }>`\r\n position: relative;\r\n height: ${props => `${props.height}px`};\r\n`;\r\n","import axios, { AxiosRequestConfig, AxiosInstance } from 'axios';\r\nimport queryString from 'query-string';\r\nimport * as rax from 'retry-axios';\r\nimport { RetryConfig } from 'retry-axios';\r\n\r\nexport type Errors = string | {\r\n [key: string]: string\r\n}\r\n\r\ndeclare module 'axios' {\r\n interface AxiosError {\r\n errors: Errors;\r\n }\r\n\r\n interface AxiosRequestConfig {\r\n raxConfig?: RetryConfig;\r\n }\r\n}\r\n\r\nrax.attach();\r\naxios.defaults.raxConfig = {\r\n retryDelay: 2000,\r\n backoffType: 'static',\r\n shouldRetry: (err) => {\r\n return (\r\n err.config.method?.toUpperCase() === 'GET'\r\n && err.response?.status === 449\r\n );\r\n }\r\n};\r\naxios.defaults.maxContentLength = Infinity;\r\naxios.defaults.maxBodyLength = Infinity;\r\naxios.defaults.baseURL = '/api';\r\naxios.interceptors.request.use(\r\n config => {\r\n const token = sessionStorage.getItem('authorization');\r\n\r\n if (token) {\r\n config.headers = {\r\n ...config.headers,\r\n Authorization: `Bearer ${token}`\r\n };\r\n }\r\n return config;\r\n },\r\n error => {\r\n return Promise.reject(error);\r\n }\r\n);\r\n\r\nconst isRecord = (data: any): data is Record<string, string> => {\r\n return data && (typeof data === 'object');\r\n};\r\n\r\naxios.interceptors.response.use(\r\n response => {\r\n if (response.status === 201 && response.data.location) {\r\n window.location.href = response.data.location;\r\n response.data = undefined; //防止多次跳转\r\n }\r\n\r\n return response;\r\n },\r\n e => {\r\n if (axios.isAxiosError(e)) {\r\n if (e.response) {\r\n const { data, status } = e.response;\r\n if (status === 401) {\r\n if (isRecord(data) && data.url) {\r\n if (window.location.pathname !== '/logout') {\r\n sessionStorage.setItem('redirect_uri', window.location.pathname + window.location.search);\r\n }\r\n const redirectUri = window.location.origin + '/login';\r\n\r\n window.location.href = queryString.stringifyUrl({\r\n url: data.url,\r\n query: { redirect_uri: redirectUri }\r\n });\r\n }\r\n\r\n e.errors = 'Unauthorized';\r\n } else {\r\n if (isRecord(data)) {\r\n if (status === 422) {\r\n e.errors = data;\r\n } else if ('message' in data) {\r\n e.errors = data['message'];\r\n }\r\n } else {\r\n e.errors = data as string;\r\n }\r\n }\r\n }\r\n }\r\n return Promise.reject(e);\r\n }\r\n);\r\n\r\nexport type RequestConfig = AxiosRequestConfig | string\r\nexport type RequestInstance = AxiosInstance\r\nexport const isRequestError = axios.isAxiosError;\r\n\r\nconst request = async function <T = any>(config: RequestConfig) {\r\n config = typeof config === 'string' ? { url: config } : config;\r\n\r\n const { data } = await axios.request<T>({\r\n paramsSerializer: function(params) {\r\n return queryString.stringify(params, {\r\n sort: false,\r\n skipNull: true,\r\n skipEmptyString: true\r\n });\r\n },\r\n ...config\r\n });\r\n\r\n return data;\r\n};\r\n\r\nexport default request;\r\n","import { PropsWithChildren, useEffect } from 'react';\r\nimport { BrowserRouter, Navigate, Route, Routes, useLocation } from 'react-router-dom';\r\nimport queryString from 'query-string';\r\nimport Loader from './loader';\r\nimport request from '../request';\r\n\r\nfunction Login() {\r\n\r\n const location = useLocation();\r\n\r\n const parsed = queryString.parse(location.hash.substr(1));\r\n\r\n sessionStorage.setItem('authorization', parsed.access_token as string);\r\n\r\n const redirectUri = sessionStorage.getItem('redirect_uri');\r\n if (redirectUri) {\r\n sessionStorage.removeItem('redirect_uri');\r\n }\r\n\r\n return <Navigate to={redirectUri || '/'} replace />;\r\n}\r\n\r\nfunction Logout() {\r\n\r\n useEffect(() => {\r\n request('/logout').catch(() => {\r\n sessionStorage.removeItem('authorization');\r\n });\r\n }, []);\r\n\r\n return <Loader />;\r\n}\r\n\r\nexport default function Root({ children }: PropsWithChildren<any>) {\r\n\r\n return <BrowserRouter>\r\n <Routes>\r\n <Route path='*' element={children} />\r\n <Route path='login' element={<Login />} />\r\n <Route path='logout' element={<Logout />} />\r\n </Routes>\r\n </BrowserRouter>;\r\n}\r\n","import { PropsWithChildren } from 'react';\r\nimport { Card as BsCard, CardProps as BsCardProps } from 'react-bootstrap';\r\nimport classNames from 'classnames';\r\n\r\ninterface CardProps extends BsCardProps {\r\n title?: string;\r\n}\r\n\r\nexport default function Card({ children, title, className, ...props }: PropsWithChildren<CardProps>) {\r\n\r\n return <BsCard className={classNames('border-0 shadow-sm mb-3', className)} {...props}>\r\n <div className='card-body'>\r\n {title && <>\r\n <h5>{title}</h5>\r\n <hr />\r\n </>}\r\n {children}\r\n </div>\r\n </BsCard>;\r\n}\r\n","import { Alert } from 'react-bootstrap';\r\nimport { Errors } from '../request';\r\n\r\nexport default function Error({ errors }: { errors?: Errors }) {\r\n if (!errors) {\r\n return null;\r\n }\r\n return <Alert variant='danger'>\r\n <ul className='mb-0'>\r\n {typeof errors === 'string'\r\n ? <li>{errors}</li>\r\n : Object.entries(errors).map(([name, error]) => <li key={name}>{error}</li>)\r\n }\r\n </ul>\r\n </Alert>;\r\n}\r\n","import React, { PropsWithChildren, useContext, useEffect, useState } from 'react';\r\nimport Loader from './loader';\r\nimport { User } from '../utils/types';\r\n\r\nexport const UserContext = React.createContext<[(User | null), ((user: User) => void)]>([null, () => {\r\n}]);\r\n\r\ninterface Props {\r\n user: User;\r\n}\r\n\r\nconst UserProvider = function({ children, user }: PropsWithChildren<Props>) {\r\n const [state, setState] = useState(user);\r\n\r\n useEffect(() => {\r\n setState(user);\r\n }, [user]);\r\n\r\n if (!state) {\r\n return <Loader />;\r\n }\r\n\r\n return <UserContext.Provider value={[state, setState]}>\r\n {children}\r\n </UserContext.Provider>;\r\n};\r\n\r\nexport function useUser(): [User, ((user: User) => void)] {\r\n const [user, setUser] = useContext(UserContext);\r\n if (!user) {\r\n throw new Error('please use `useUser` in UserContext');\r\n }\r\n\r\n return [user, setUser];\r\n}\r\n\r\nexport default UserProvider;\r\n","import { ReactNode } from 'react';\r\nimport { intersection } from 'lodash';\r\nimport { useUser } from './user-provider';\r\nimport { User } from '../utils/types';\r\n\r\nexport interface AccessProps {\r\n require?: string | string[] | ((user: User) => boolean);\r\n fallback?: ReactNode;\r\n children: ReactNode;\r\n}\r\n\r\nexport default function Access({\r\n require,\r\n children,\r\n fallback\r\n}: AccessProps) {\r\n const [user,] = useUser();\r\n let passed = false;\r\n if (typeof require === 'function') {\r\n passed = require(user);\r\n } else {\r\n if (typeof require === 'string') {\r\n require = [require];\r\n }\r\n passed = intersection(user.roles, require).length > 0;\r\n }\r\n if (!passed) {\r\n children = fallback;\r\n }\r\n\r\n return <>{children}</>;\r\n}\r\n","import { Children, ReactNode } from 'react';\r\nimport styled from 'styled-components';\r\n\r\ninterface SpaceProps {\r\n children: ReactNode;\r\n size?: 'small' | 'middle' | 'large' | number;\r\n}\r\n\r\n\r\nexport default function Space({ children, size = 'small' }: SpaceProps) {\r\n\r\n if (typeof size === 'string') {\r\n size = {\r\n small: 8,\r\n middle: 16,\r\n large: 24\r\n }[size];\r\n }\r\n\r\n const items = Children.map(children, (child) => {\r\n if (child) {\r\n return <Item>{child}</Item>;\r\n }\r\n });\r\n\r\n return <Container size={size}>\r\n {items}\r\n </Container>;\r\n}\r\n\r\nconst Container = styled.div<{ size: number }>`\r\n display: inline-flex;\r\n align-items: center;\r\n gap: ${props => props.size}px;\r\n`;\r\n\r\nconst Item = styled.div`\r\n\r\n`;\r\n","var img = \"data:image/svg+xml,%3csvg t='1651217947509' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='2548' width='16px' height='16px' fill='currentColor'%3e %3cpath d='M887.904 298.208c-12.864-12.064-33.152-11.488-45.216 1.408L415.936 753.984l-233.12-229.696C170.208 511.872 149.952 512 137.536 524.608c-12.416 12.576-12.256 32.864 0.352 45.248l256.48 252.672c0.096 0.096 0.224 0.128 0.32 0.224 0.096 0.096 0.128 0.224 0.224 0.32 2.016 1.92 4.448 3.008 6.784 4.288 1.152 0.672 2.144 1.664 3.36 2.144 3.776 1.472 7.776 2.24 11.744 2.24 4.192 0 8.384-0.832 12.288-2.496 1.312-0.544 2.336-1.664 3.552-2.368 2.4-1.408 4.896-2.592 6.944-4.672 0.096-0.096 0.128-0.256 0.224-0.352 0.064-0.096 0.192-0.128 0.288-0.224l449.184-478.208C901.44 330.592 900.768 310.336 887.904 298.208z' p-id='2549'%3e%3c/path%3e%3c/svg%3e\";\n export default img;","import RcSteps from 'rc-steps';\r\nimport 'rc-steps/assets/index.css';\r\nimport styled from 'styled-components';\r\nimport { ComponentProps } from 'react';\r\nimport { ReactComponent as CheckIcon } from '../images/step_check.svg';\r\n\r\nexport default function Steps(props: ComponentProps<typeof RcSteps>) {\r\n return <CustomRcSteps\r\n icons={{\r\n finish: <CheckIcon />,\r\n error: <></>\r\n }}\r\n {...props}\r\n />;\r\n}\r\n\r\nSteps.Step = RcSteps.Step;\r\n\r\nconst CustomRcSteps = styled(RcSteps)`\r\n .rc-steps-item-icon {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n\r\n & > .rc-steps-icon {\r\n top: 0;\r\n }\r\n }\r\n\r\n .rc-steps-item-process {\r\n .rc-steps-item-icon {\r\n background: var(--bs-primary);\r\n border-color: var(--bs-primary);\r\n }\r\n }\r\n\r\n .rc-steps-item-finish {\r\n .rc-steps-item-icon {\r\n border-color: var(--bs-primary);\r\n\r\n & > .rc-steps-icon {\r\n color: var(--bs-primary);\r\n }\r\n }\r\n\r\n .rc-steps-item-title:after {\r\n background-color: var(--bs-primary);\r\n }\r\n }\r\n\r\n`;\r\n","import { useMemo } from 'react';\r\n\r\ninterface Props {\r\n value: number;\r\n currency?: boolean;\r\n locale?: string;\r\n}\r\n\r\nexport default function NumberFormat({ value, locale = 'zh-CN', currency = true }: Props) {\r\n\r\n const formatter = useMemo(() => {\r\n\r\n let options = {};\r\n\r\n if (currency) {\r\n options = {\r\n style: 'currency',\r\n currency: 'CNY',\r\n ...options\r\n };\r\n } else {\r\n options = {\r\n minimumFractionDigits: 2,\r\n };\r\n }\r\n\r\n return new Intl.NumberFormat(locale, options);\r\n }, [currency, locale]);\r\n\r\n return <>{formatter.format(value)}</>;\r\n}\r\n","import { Button, ButtonProps } from 'react-bootstrap';\r\n\r\ninterface CustomButtonProps extends ButtonProps {\r\n loading: boolean\r\n}\r\n\r\nexport default function LoadingButton({ loading, children, ...props }: CustomButtonProps) {\r\n\r\n return <Button {...props} disabled={loading}>\r\n {loading ? 'Loading…' : children}\r\n </Button>;\r\n}\r\n","import { Button, ButtonProps } from 'react-bootstrap';\r\nimport request, { RequestConfig } from '../request';\r\nimport { createElement, ElementType, MouseEvent, useCallback, useState } from 'react';\r\nimport Message from '../utils/message';\r\nimport axios, { AxiosRequestConfig } from 'axios';\r\n\r\ninterface Props extends Omit<ButtonProps, 'as'> {\r\n url: RequestConfig;\r\n method?: AxiosRequestConfig['method'];\r\n confirm?: string;\r\n onSuccess?: (result: any) => void;\r\n as?: ElementType | ButtonProps['as'];\r\n}\r\n\r\nexport default function RequestButton({\r\n url,\r\n method,\r\n confirm,\r\n onSuccess,\r\n children,\r\n disabled,\r\n as = Button,\r\n ...props\r\n}: Props) {\r\n\r\n const [fetching, setFetching] = useState(false);\r\n\r\n const handleClick = useCallback(async (e: MouseEvent) => {\r\n e.preventDefault();\r\n try {\r\n setFetching(true);\r\n if (confirm) {\r\n if (!await Message.confirm({ text: confirm })) {\r\n return;\r\n }\r\n }\r\n\r\n const config = typeof url === 'string' ? { url, method } : { method, ...url };\r\n\r\n const result = await request(config);\r\n\r\n if (onSuccess) {\r\n onSuccess(result);\r\n }\r\n } catch (e) {\r\n if (axios.isAxiosError(e)) {\r\n let errors = e.errors;\r\n if (typeof e.errors !== 'string') {\r\n errors = Object.values(e.errors).join('<br />');\r\n }\r\n Message.error({ text: errors as string });\r\n } else {\r\n throw e;\r\n }\r\n } finally {\r\n setFetching(false);\r\n }\r\n }, [url, method, setFetching]);\r\n\r\n return createElement(as, {\r\n ...props,\r\n disabled: disabled || fetching,\r\n onClick: handleClick\r\n }, children);\r\n}\r\n","import { Button, ButtonProps } from 'react-bootstrap';\r\nimport { LinkProps, useNavigate } from 'react-router-dom';\r\n\r\ninterface Props extends ButtonProps, Pick<LinkProps, 'to' | 'replace'> {\r\n\r\n}\r\n\r\nexport default function LinkButton({ to, replace, ...props }: Props) {\r\n let navigate = useNavigate();\r\n\r\n return <Button {...props} onClick={(e) => {\r\n e.preventDefault();\r\n navigate(to, { replace });\r\n }} />;\r\n}\r\n","import JsonForm, { JsonFormProps, JsonFormType, getRegistry } from '@topthink/json-form';\r\nimport * as React from 'react';\r\nimport {\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n PropsWithoutRef,\r\n ReactNode,\r\n RefAttributes,\r\n useCallback,\r\n useState\r\n} from 'react';\r\nimport axios, { AxiosError, Method } from 'axios';\r\nimport LoadingButton from './loading-button';\r\nimport request from '../request';\r\nimport { mapValues } from 'lodash';\r\nimport { AjvError, ISubmitEvent, WidgetProps } from '@rjsf/core';\r\n\r\nconst localize = require('ajv-i18n/localize/zh');\r\n\r\nexport interface FormProps<T = any> extends JsonFormProps<T> {\r\n onSuccess?: (data: any) => void;\r\n method?: Method;\r\n children?: ReactNode | ((props: { submit: ReactNode, loading: boolean }) => ReactNode);\r\n submitText?: string;\r\n}\r\n\r\ntype Error = {\r\n __errors: string[]\r\n}\r\n\r\ntype Errors = Error | {\r\n [key: string]: Error\r\n}\r\n\r\nconst toExtraErrors = (error: AxiosError): Errors => {\r\n const errors = error.errors;\r\n if (typeof errors === 'string') {\r\n return {\r\n __errors: [errors]\r\n };\r\n }\r\n return mapValues(errors, (e) => {\r\n return {\r\n __errors: [e]\r\n };\r\n });\r\n};\r\n\r\nconst widgets = {\r\n upload: function(props: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n const options = {\r\n ...props.options,\r\n async onUpload(file: File) {\r\n if (props.options.onUpload instanceof Function) {\r\n return await props.options.onUpload.call(file);\r\n }\r\n if (props.options.endpoint) {\r\n const data = new FormData();\r\n\r\n data.set('file', file);\r\n\r\n const { url } = await request({\r\n url: props.options.endpoint as string,\r\n method: 'post',\r\n data\r\n });\r\n\r\n return url;\r\n }\r\n }\r\n };\r\n\r\n return <widgets.upload {...props} options={options} />;\r\n }\r\n};\r\n\r\nexport interface FormType extends JsonFormType {\r\n\r\n}\r\n\r\ntype Form<T = any> = ForwardRefExoticComponent<PropsWithoutRef<FormProps<T>> & RefAttributes<FormType>>\r\n\r\nconst Form: Form = forwardRef(({\r\n action,\r\n method = 'post',\r\n onSuccess,\r\n formData,\r\n onSubmit,\r\n onChange,\r\n submitText = '提交',\r\n children,\r\n ...props\r\n}, ref) => {\r\n\r\n const [extraErrors, setExtraErrors] = useState<Errors>();\r\n const [loading, setLoading] = useState(false);\r\n const [data, setData] = useState(formData);\r\n\r\n const handleSubmit = useCallback(async (e: ISubmitEvent<any>, nativeEvent: React.FormEvent<HTMLFormElement>) => {\r\n try {\r\n setLoading(true);\r\n if (action) {\r\n const { formData } = e;\r\n //todo 包含File对象需转FormData\r\n try {\r\n const result = await request({\r\n url: action,\r\n method,\r\n data: formData\r\n });\r\n setExtraErrors(undefined);\r\n if (onSuccess) {\r\n await onSuccess(result);\r\n }\r\n } catch (e) {\r\n if (axios.isAxiosError(e)) {\r\n setExtraErrors(toExtraErrors(e));\r\n }\r\n\r\n throw e;\r\n }\r\n } else if (onSubmit) {\r\n await onSubmit(e, nativeEvent);\r\n }\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [action, method, onSubmit]);\r\n\r\n const handleChange = useCallback((e: ISubmitEvent<any>) => {\r\n const { formData } = e;\r\n setData(formData);\r\n if (onChange) {\r\n onChange(e);\r\n }\r\n }, [setData, onChange]);\r\n\r\n const transformErrors = useCallback((errors: AjvError[]) => {\r\n errors = errors.map(error => ({\r\n keyword: error.name,\r\n dataPath: error.property,\r\n ...error\r\n }));\r\n\r\n localize(errors);\r\n\r\n return errors;\r\n }, []);\r\n\r\n const submit = <LoadingButton loading={loading} type='submit' variant='primary'>{submitText}</LoadingButton>;\r\n\r\n if (typeof children === 'function') {\r\n children = children({ submit, loading });\r\n }\r\n\r\n return <JsonForm\r\n ref={ref}\r\n extraErrors={extraErrors}\r\n onSubmit={handleSubmit}\r\n transformErrors={transformErrors}\r\n noHtml5Validate\r\n noValidate\r\n {...props}\r\n formData={data}\r\n onChange={handleChange}\r\n widgets={widgets}\r\n >\r\n {children || <div className='col-12'>\r\n {submit}\r\n </div>}\r\n </JsonForm>;\r\n});\r\n\r\nexport default Form;\r\n","import styled from 'styled-components';\r\nimport { PropsWithChildren, ReactNode } from 'react';\r\n\r\nconst Container = styled.div`\r\n width: 100%;\r\n`;\r\n\r\nconst Header = styled.div`\r\n background-color: #fff;\r\n display: flex;\r\n\r\n .container {\r\n padding: 0 24px;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n }\r\n`;\r\n\r\nconst Body = styled.div`\r\n margin-top: 24px;\r\n`;\r\n\r\nconst Title = styled.div`\r\n font-size: 22px;\r\n line-height: 64px;\r\n height: 64px;\r\n`;\r\n\r\nconst Extra = styled.div`\r\n\r\n`;\r\n\r\ninterface ContentProps {\r\n title: string\r\n extra?: ReactNode\r\n}\r\n\r\nexport default function Content({ title, children, extra }: PropsWithChildren<ContentProps>) {\r\n return <Container>\r\n <Header>\r\n <div className='container'>\r\n <Title>{title}</Title>\r\n <Extra>{extra}</Extra>\r\n </div>\r\n </Header>\r\n <Body className='container'>\r\n {children}\r\n </Body>\r\n </Container>;\r\n};\r\n","import { useCallback, useEffect, useMemo, useState } from 'react';\r\nimport { Pagination as BsPagination } from 'react-bootstrap';\r\n\r\nfunction noop() {\r\n}\r\n\r\n\r\nfunction isInteger(value: any): value is number {\r\n return (\r\n typeof value === 'number' && isFinite(value) && Math.floor(value) === value\r\n );\r\n}\r\n\r\nexport interface PaginationProps {\r\n className?: string\r\n total: number\r\n current?: number\r\n defaultCurrent?: number\r\n pageSize?: number\r\n defaultPageSize?: number,\r\n onChange?: (current: number, pageSize: number) => void\r\n}\r\n\r\nexport default function Pagination({\r\n total = 0,\r\n onChange = noop,\r\n defaultCurrent = 1,\r\n defaultPageSize = 10,\r\n className,\r\n ...props\r\n}: PaginationProps) {\r\n\r\n const [current, setCurrent] = useState(defaultCurrent);\r\n const [pageSize, setPageSize] = useState(defaultPageSize);\r\n\r\n useEffect(() => {\r\n if (isInteger(props.current)) {\r\n setCurrent(props.current);\r\n }\r\n }, [props.current]);\r\n\r\n useEffect(() => {\r\n if (isInteger(props.pageSize)) {\r\n setPageSize(props.pageSize);\r\n }\r\n }, [props.pageSize]);\r\n\r\n const allPages = useMemo(() => {\r\n return Math.floor((total - 1) / pageSize) + 1;\r\n }, [total, pageSize]);\r\n\r\n const handleChange = useCallback((p: number) => {\r\n return () => {\r\n if (p !== current) {\r\n setCurrent(p);\r\n onChange(p, pageSize);\r\n }\r\n };\r\n }, [onChange, current, pageSize]);\r\n\r\n const pageBufferSize = 2;\r\n const prevPage = current - 1 > 0 ? current - 1 : 0;\r\n const nextPage = current + 1 < allPages ? current + 1 : allPages;\r\n\r\n const pagerList = [];\r\n let jumpPrev = null;\r\n let jumpNext = null;\r\n let firstPager = null;\r\n let lastPager = null;\r\n\r\n if (allPages <= 3 + pageBufferSize * 2) {\r\n for (let i = 1; i <= allPages; i += 1) {\r\n const active = current === i;\r\n pagerList.push(\r\n <BsPagination.Item key={i} active={active} onClick={handleChange(i)}>{i}</BsPagination.Item>\r\n );\r\n }\r\n } else {\r\n lastPager = <BsPagination.Last key='last' onClick={handleChange(allPages)} />;\r\n firstPager = <BsPagination.First key='first' onClick={handleChange(1)} />;\r\n jumpPrev = <BsPagination.Prev key='prev' onClick={handleChange(prevPage)} />;\r\n jumpNext = <BsPagination.Next key='next' onClick={handleChange(nextPage)} />;\r\n\r\n let left = Math.max(1, current - pageBufferSize);\r\n let right = Math.min(current + pageBufferSize, allPages);\r\n\r\n if (current - 1 <= pageBufferSize) {\r\n right = 1 + pageBufferSize * 2;\r\n }\r\n\r\n if (allPages - current <= pageBufferSize) {\r\n left = allPages - pageBufferSize * 2;\r\n }\r\n\r\n for (let i = left; i <= right; i += 1) {\r\n const active = current === i;\r\n pagerList.push(\r\n <BsPagination.Item key={i} active={active} onClick={handleChange(i)}>{i}</BsPagination.Item>\r\n );\r\n }\r\n\r\n if (current - 1 >= pageBufferSize * 2 && current !== 1 + 2) {\r\n pagerList.unshift(jumpPrev);\r\n }\r\n if (\r\n allPages - current >= pageBufferSize * 2 &&\r\n current !== allPages - 2\r\n ) {\r\n pagerList.push(jumpNext);\r\n }\r\n\r\n if (left !== 1) {\r\n pagerList.unshift(firstPager);\r\n }\r\n if (right !== allPages) {\r\n pagerList.push(lastPager);\r\n }\r\n }\r\n\r\n return <BsPagination className={className}>\r\n {pagerList}\r\n </BsPagination>;\r\n\r\n}\r\n","import { Columns, TableProps, TableRowSelection } from './index';\r\nimport { InputHTMLAttributes, Key, useCallback, useEffect, useRef, useState } from 'react';\r\n\r\nconst Checkbox = function({\r\n indeterminate = false,\r\n ...props\r\n}: InputHTMLAttributes<HTMLInputElement> & { indeterminate?: boolean }) {\r\n\r\n const ref = useRef<HTMLInputElement>(null);\r\n\r\n useEffect(() => {\r\n if (ref.current) {\r\n ref.current.indeterminate = indeterminate;\r\n }\r\n }, [indeterminate]);\r\n\r\n return <input\r\n ref={ref}\r\n {...props}\r\n className='form-check-input'\r\n type='checkbox'\r\n />;\r\n};\r\n\r\nexport default function useSelection<T = any>(\r\n rowSelection: TableRowSelection<T> | undefined,\r\n rowKey: Required<TableProps<T>>['rowKey'],\r\n data: T[]\r\n) {\r\n const [keys, setKeys] = useState(() => new Set(rowSelection?.selectedRowKeys || []));\r\n\r\n const getRowKey = (record: T) => {\r\n if (typeof rowKey === 'string') {\r\n // @ts-ignore\r\n return record[rowKey];\r\n } else {\r\n return rowKey(record);\r\n }\r\n };\r\n\r\n const getRecordByKey = (key: Key) => {\r\n return data.find((record) => {\r\n return getRowKey(record) === key;\r\n })!;\r\n };\r\n\r\n const setSelectedKeys = useCallback((keys: Set<Key>) => {\r\n setKeys(keys);\r\n const changedKeys = Array.from(keys);\r\n\r\n const records = changedKeys.map(function(key) {\r\n return getRecordByKey(key);\r\n });\r\n\r\n if (rowSelection?.onChange) {\r\n rowSelection?.onChange(changedKeys, records);\r\n }\r\n }, [getRecordByKey]);\r\n\r\n const transformColumns = useCallback((columns: Columns): Columns => {\r\n if (!rowSelection) {\r\n return columns;\r\n }\r\n\r\n const recordKeys = data.map(getRowKey);\r\n\r\n const checkedCurrentAll = recordKeys.every(function(key) {\r\n return keys.has(key);\r\n });\r\n const checkedCurrentSome = recordKeys.some(function(key) {\r\n return keys.has(key);\r\n });\r\n\r\n return [{\r\n key: 'selection',\r\n title: <Checkbox\r\n checked={checkedCurrentAll}\r\n indeterminate={!checkedCurrentAll && checkedCurrentSome}\r\n onChange={() => {\r\n if (checkedCurrentAll) {\r\n recordKeys.forEach(function(key) {\r\n keys.delete(key);\r\n });\r\n } else {\r\n recordKeys.forEach(function(key) {\r\n keys.add(key);\r\n });\r\n }\r\n setSelectedKeys(new Set(keys));\r\n }}\r\n />,\r\n width: 30,\r\n align: 'center',\r\n render({ record }) {\r\n const key = getRowKey(record);\r\n const checked = keys.has(key);\r\n return <Checkbox\r\n checked={checked}\r\n onChange={() => {\r\n if (checked) {\r\n keys.delete(key);\r\n } else {\r\n keys.add(key);\r\n }\r\n setSelectedKeys(new Set(keys));\r\n }}\r\n />;\r\n }\r\n }, ...columns];\r\n }, [data, rowSelection, keys]);\r\n\r\n return [transformColumns];\r\n}\r\n","import RcTable from 'rc-table';\r\nimport { TableProps as RcTableProps } from 'rc-table/lib/Table';\r\nimport { ColumnGroupType, ColumnsType, ColumnType as BsColumnType, RenderedCell } from 'rc-table/lib/interface';\r\nimport { Form, Table as BsTable, TableProps as BsTableProps } from 'react-bootstrap';\r\nimport {\r\n ChangeEvent,\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n Key,\r\n PropsWithChildren,\r\n PropsWithoutRef,\r\n ReactNode,\r\n RefAttributes,\r\n useCallback,\r\n useEffect,\r\n useImperativeHandle,\r\n useMemo,\r\n useRef,\r\n useState\r\n} from 'react';\r\nimport Pagination from '../pagination';\r\nimport styled from 'styled-components';\r\nimport request from '../../request';\r\nimport Card from '../card';\r\nimport Loader from '../loader';\r\nimport Space from '../space';\r\nimport useDebounce from '../../hooks/use-debounce';\r\nimport useSelection from './use-selection';\r\nimport { PaginationType } from '../../utils/types';\r\n\r\nexport interface TableType {\r\n reload: () => void;\r\n}\r\n\r\ninterface ColumnType<RecordType> extends Omit<BsColumnType<RecordType>, 'render'> {\r\n render?: (data: { value: any, record: RecordType, index: number, action: TableType }) => ReactNode | RenderedCell<RecordType>;\r\n}\r\n\r\nexport type Columns<RecordType = any> = (ColumnGroupType<RecordType> | ColumnType<RecordType>)[]\r\n\r\nconst CustomTable = styled(BsTable)`\r\n .rc-table-thead {\r\n border-top: none;\r\n }\r\n`;\r\n\r\nconst components: RcTableProps['components'] = {\r\n table: (props: BsTableProps) => {\r\n return <CustomTable {...props} className='align-middle table-hover' />;\r\n },\r\n};\r\n\r\n\r\nconst CustomPagination = styled(Pagination)`\r\n margin-bottom: 0;\r\n justify-content: flex-end;\r\n`;\r\n\r\nfunction isPagination<T>(data: any): data is PaginationType<T> {\r\n return 'current_page' in data;\r\n}\r\n\r\nexport interface TableRowSelection<RecordType = any> {\r\n selectedRowKeys?: Key[];\r\n onChange?: (selectedRowKeys: Key[], selectedRows: RecordType[]) => void;\r\n}\r\n\r\nexport interface TableProps<RecordType = any> extends Omit<RcTableProps<RecordType>, 'children' | 'columns'> {\r\n source: string | (() => Promise<any>);\r\n paginate?: boolean;\r\n columns: Columns<RecordType>;\r\n toolBarRender?: ((action: TableType) => ReactNode) | false;\r\n search?: boolean | string;\r\n rowSelection?: TableRowSelection<RecordType>;\r\n card?: boolean;\r\n}\r\n\r\ntype Params = {\r\n page?: number;\r\n sortField?: string;\r\n sortOrder?: number;\r\n q?: string;\r\n [key: string]: any;\r\n};\r\n\r\ntype CustomTableType<T = any> = ForwardRefExoticComponent<PropsWithoutRef<PropsWithChildren<TableProps<T>>>\r\n & RefAttributes<TableType>>\r\n\r\nconst Table: CustomTableType = forwardRef((\r\n {\r\n source,\r\n rowKey = 'id',\r\n paginate = true,\r\n toolBarRender,\r\n columns = [],\r\n search,\r\n rowSelection,\r\n card = true,\r\n ...props\r\n },\r\n ref\r\n) => {\r\n const [data, setData] = useState<any[]>([]);\r\n const [pagination, setPagination] = useState(paginate ? { total: 0, current: 1, pageSize: 10 } : null);\r\n const [loading, setLoading] = useState(true);\r\n const [keyword, setKeyword] = useState('');\r\n\r\n const fetchData = useCallback(async (options: Params = {}) => {\r\n setLoading(true);\r\n try {\r\n let result;\r\n if (typeof source === 'string') {\r\n const params: Params = {\r\n q: keyword\r\n };\r\n if (pagination) {\r\n params.page = options.page || pagination.current;\r\n }\r\n result = await request({\r\n url: source,\r\n params,\r\n });\r\n } else {\r\n result = await source();\r\n }\r\n\r\n if (paginate && isPagination<any>(result)) {\r\n setPagination({\r\n total: result.total,\r\n current: result.current_page,\r\n pageSize: result.per_page\r\n });\r\n result = result.data;\r\n }\r\n setData(result);\r\n } catch (e) {\r\n\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [source, setData, pagination, keyword]);\r\n\r\n useEffect(() => {\r\n fetchData();\r\n }, [keyword]);\r\n\r\n const action = useRef<TableType>({\r\n reload: fetchData\r\n });\r\n\r\n useEffect(() => {\r\n action.current = {\r\n reload: fetchData\r\n };\r\n }, [fetchData]);\r\n\r\n useImperativeHandle(ref, () => action.current);\r\n\r\n //多选\r\n const [transformColumns] = useSelection(rowSelection, rowKey, data);\r\n\r\n const customColumns = useMemo(() => {\r\n return transformColumns(columns).map((column) => {\r\n const customColumn: BsColumnType<any> = { ...column, render: undefined };\r\n\r\n if ('render' in column && column.render) {\r\n const defaultRender = column.render;\r\n customColumn.render = (value, record, index) => {\r\n return defaultRender({ value, record, index, action: action.current });\r\n };\r\n }\r\n return customColumn;\r\n }) as ColumnsType<any>;\r\n }, [columns, transformColumns, action]);\r\n\r\n const handlePageChange = (current: number) => {\r\n fetchData({\r\n page: current\r\n });\r\n };\r\n\r\n const handleSearch = useDebounce((e: ChangeEvent<HTMLInputElement>) => {\r\n setKeyword(e.target.value);\r\n }, 500);\r\n\r\n const children = <>\r\n <Loader loading={loading} />\r\n {toolBarRender !== false && <Header>\r\n <LeftTools size={12}>\r\n {toolBarRender && toolBarRender(action.current)}\r\n </LeftTools>\r\n <RightTools size={12}>\r\n {search &&\r\n <Form.Control onChange={handleSearch} type={'search'} placeholder={'Search...'} />}\r\n <Action onClick={action.current.reload}><i className='bi bi-arrow-repeat' /></Action>\r\n </RightTools>\r\n </Header>}\r\n <RcTable {...props} rowKey={rowKey} columns={customColumns} components={components} data={data} />\r\n {pagination && <CustomPagination {...pagination} onChange={handlePageChange} />}\r\n </>;\r\n\r\n if (card) {\r\n return <Card>\r\n {children}\r\n </Card>;\r\n }\r\n return children;\r\n});\r\n\r\nexport default Table;\r\n\r\nconst Header = styled.div`\r\n display: flex;\r\n justify-content: space-between;\r\n padding-bottom: 1rem;\r\n height: 48px;\r\n`;\r\n\r\nconst RightTools = styled(Space)`\r\n\r\n`;\r\nconst LeftTools = styled(Space)`\r\n\r\n`;\r\n\r\nconst Action = styled.span`\r\n cursor: pointer;\r\n font-size: 20px;\r\n line-height: 1;\r\n\r\n &:hover {\r\n color: var(--bs-primary);\r\n }\r\n`;\r\n","import { debounce, DebouncedFunc } from 'lodash';\r\nimport { useEffect, useRef } from 'react';\r\n\r\nexport default function useDebounce<T extends (...args: any) => any>(callback: T, wait: number, options?: {}): DebouncedFunc<T> {\r\n const callbackRef = useRef<T>(callback);\r\n const debouncedCallbackRef = useRef<DebouncedFunc<T>>(\r\n debounce(callback, wait, options)\r\n );\r\n\r\n useEffect(() => {\r\n callbackRef.current = callback;\r\n });\r\n\r\n useEffect(() => {\r\n debouncedCallbackRef.current = debounce((...args: any) => {\r\n callbackRef.current(...args);\r\n }, wait, options);\r\n }, [wait, options]);\r\n\r\n return debouncedCallbackRef.current;\r\n}\r\n","import {\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n PropsWithChildren,\r\n PropsWithoutRef,\r\n RefAttributes,\r\n useImperativeHandle,\r\n useState\r\n} from 'react';\r\nimport { Button, ButtonProps, Modal, ModalProps } from 'react-bootstrap';\r\nimport LoadingButton from './loading-button';\r\n\r\nexport interface ModalButtonProps extends ModalProps {\r\n text: string;\r\n variant?: ButtonProps['variant'];\r\n header?: string;\r\n onOk?: () => any;\r\n footer?: boolean;\r\n}\r\n\r\nexport interface ModalType {\r\n close: () => void;\r\n}\r\n\r\ntype ModalButtonType = ForwardRefExoticComponent<PropsWithoutRef<PropsWithChildren<ModalButtonProps>>\r\n & RefAttributes<ModalType>>\r\n\r\nconst ModalButton: ModalButtonType = forwardRef(({\r\n text,\r\n variant = 'primary',\r\n header = text,\r\n footer = true,\r\n onOk,\r\n size,\r\n onShow,\r\n children\r\n}, ref) => {\r\n\r\n const [show, setShow] = useState(false);\r\n const [loading, setLoading] = useState(false);\r\n const handleClose = () => setShow(false);\r\n const handleShow = () => setShow(true);\r\n\r\n useImperativeHandle(ref, () => ({\r\n close: handleClose\r\n }));\r\n\r\n const handleOk = async () => {\r\n if (onOk) {\r\n setLoading(true);\r\n const result = await onOk();\r\n setLoading(false);\r\n if (result === false) {\r\n return;\r\n }\r\n }\r\n handleClose();\r\n };\r\n\r\n return <>\r\n <Button variant={variant} onClick={handleShow}>{text}</Button>\r\n <Modal size={size} show={show} onHide={handleClose} onShow={onShow}>\r\n {header && <Modal.Header closeButton>\r\n <Modal.Title as='h5'>{header}</Modal.Title>\r\n </Modal.Header>}\r\n <Modal.Body>{children}</Modal.Body>\r\n {footer && <Modal.Footer>\r\n <Button variant='secondary' onClick={handleClose}>\r\n 取消\r\n </Button>\r\n <LoadingButton loading={loading} variant='primary' onClick={handleOk}>\r\n 确定\r\n </LoadingButton>\r\n </Modal.Footer>}\r\n </Modal>\r\n </>;\r\n});\r\n\r\nexport default ModalButton;\r\n","import ModalButton, { ModalButtonProps, ModalType } from './modal-button';\r\nimport { Fragment, useCallback, useRef } from 'react';\r\nimport Form, { FormProps, FormType } from './form';\r\n\r\nexport type ModalFormProps<T = any> =\r\n Pick<ModalButtonProps, 'text' | 'variant' | 'header' | 'size'> &\r\n Pick<FormProps<T>, 'schema' | 'formData' | 'uiSchema' | 'action' | 'method' | 'onSuccess' | 'onChange' | 'fields' | 'formContext'>\r\n\r\nexport default function ModalForm<T = any>({\r\n text,\r\n header,\r\n schema,\r\n uiSchema,\r\n action,\r\n method,\r\n formData,\r\n variant,\r\n onSuccess,\r\n onChange,\r\n fields,\r\n size\r\n}: ModalFormProps<T>) {\r\n\r\n const form = useRef<FormType>(null);\r\n const modal = useRef<ModalType>(null);\r\n\r\n const handleOk = useCallback(async () => {\r\n try {\r\n await form.current?.submit();\r\n return true;\r\n } catch {\r\n return false;\r\n }\r\n }, []);\r\n\r\n return <ModalButton ref={modal} text={text} onOk={handleOk} header={header} variant={variant} size={size}>\r\n <Form\r\n ref={form}\r\n schema={schema}\r\n uiSchema={uiSchema}\r\n action={action}\r\n method={method}\r\n formData={formData}\r\n fields={fields}\r\n onChange={onChange}\r\n onSuccess={onSuccess}\r\n >\r\n <Fragment />\r\n </Form>\r\n </ModalButton>;\r\n}\r\n","import { useAsyncCallback, UseAsyncCallbackOptions } from 'react-async-hook';\r\nimport request, { isRequestError, RequestConfig } from '../request';\r\nimport { DependencyList, useCallback, useEffect } from 'react';\r\nimport { AxiosRequestConfig } from 'axios';\r\nimport { values } from 'lodash';\r\n\r\ntype UseRequestOptions<T> = {\r\n manual?: boolean\r\n refreshDeps?: DependencyList;\r\n} & UseAsyncCallbackOptions<T>;\r\n\r\nexport default function useRequest<T = any>(config: RequestConfig, {\r\n manual,\r\n refreshDeps,\r\n ...options\r\n}: UseRequestOptions<T> = {}) {\r\n let { execute, currentParams, error, ...others } = useAsyncCallback(async (params?: AxiosRequestConfig) => {\r\n\r\n config = typeof config === 'string' ? { url: config } : config;\r\n\r\n return await request<T>({\r\n ...config,\r\n ...params\r\n });\r\n }, options);\r\n\r\n useEffect(() => {\r\n if (!manual && !refreshDeps) {\r\n execute();\r\n }\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (refreshDeps) {\r\n refresh();\r\n }\r\n }, refreshDeps);\r\n\r\n const refresh = useCallback(() => {\r\n if (currentParams) {\r\n execute(...currentParams);\r\n } else {\r\n execute();\r\n }\r\n }, [execute, currentParams]);\r\n\r\n if (error && isRequestError(error)) {\r\n const errors = error.errors;\r\n error = new Error(typeof errors === 'string' ? errors : values(errors).join(''));\r\n }\r\n\r\n return {\r\n refresh,\r\n execute,\r\n error,\r\n ...others\r\n };\r\n}\r\n","import { useCallback, useState } from 'react';\r\n\r\ninterface Options {\r\n onHide?: () => void;\r\n onShow?: () => void;\r\n}\r\n\r\nlet id = 0;\r\n\r\nexport default function useOverlayState({ onHide, onShow }: Options = {}) {\r\n const [visible, setVisible] = useState(false);\r\n\r\n const [key, setKey] = useState(`visible-${id}`);\r\n\r\n const hide = useCallback(() => {\r\n setVisible(false);\r\n if (onHide) {\r\n onHide();\r\n }\r\n }, [setVisible, onHide]);\r\n\r\n const exit = useCallback(() => {\r\n setKey(`visible-${++id}`);\r\n }, [setKey, id]);\r\n\r\n const show = useCallback(() => {\r\n setVisible(true);\r\n if (onShow) {\r\n onShow();\r\n }\r\n }, [setVisible, onShow]);\r\n\r\n const state = {\r\n show: visible,\r\n onHide: hide,\r\n onExited: exit,\r\n key\r\n };\r\n\r\n return {\r\n visible,\r\n show,\r\n hide,\r\n state\r\n };\r\n}\r\n","import { OverlayTrigger, OverlayTriggerProps, Tooltip as BsTooltip } from 'react-bootstrap';\r\nimport { uniqueId } from 'lodash';\r\n\r\ninterface TooltipProps {\r\n tooltip: string;\r\n children: OverlayTriggerProps['children'];\r\n placement?: OverlayTriggerProps['placement'];\r\n}\r\n\r\nexport default function Tooltip({ tooltip, children, placement = 'bottom' }: TooltipProps) {\r\n\r\n return <OverlayTrigger\r\n placement={placement}\r\n overlay={\r\n <BsTooltip id={uniqueId()}>\r\n {tooltip}\r\n </BsTooltip>\r\n }\r\n >\r\n {children}\r\n </OverlayTrigger>;\r\n}\r\n"],"names":["_taggedTemplateLiteral","strings","raw","slice","Object","freeze","defineProperties","value","FooterWrapper","styled","footer","Footer","_jsx","className","formatRelativePath","routes","parent","menus","route","meta","_route$meta","hideInMenu","title","_route$meta2","path","replace","menu","children","_route$meta3","hideChildrenInMenu","length","push","renderMenuItems","items","map","item","SubMenu","MenuItem","Link","to","collapseNode","height","expandNode","node","scrollHeight","motion","motionName","motionAppear","onAppearStart","onAppearActive","onEnterStart","onEnterActive","onLeaveStart","onLeaveActive","SiderLayout","basename","useRoutes","useMemo","getMenuData","pathname","useLocation","openKeys","keys","split","reduce","pre","curr","join","selectedKeys","_jsxs","Container","Sidebar","Header","Menu","mode","defaultOpenKeys","Content","Main","div","nav","main","RcMenu","CustomSwal","withReactContent","Swal","defaultOptions","confirmButtonText","cancelButtonText","Message","confirm","async","isConfirmed","fire","icon","showCancelButton","options","error","toast","position","timer","showConfirmButton","Icon","Title","Extra","IconMap","success","info","warning","Result","status","extra","Avatar","a","href","src","Dropdown","navbar","Toggle","as","header","Dimmer","props","active","inverted","Loader","loading","variant","animation","wrap","Spinner","Wrap","rax","attach","axios","defaults","raxConfig","retryDelay","backoffType","shouldRetry","err","config","method","toUpperCase","response","maxContentLength","Infinity","maxBodyLength","baseURL","interceptors","request","use","token","sessionStorage","getItem","headers","Authorization","Promise","reject","isRecord","data","location","window","undefined","e","isAxiosError","url","setItem","search","redirectUri","origin","queryString","stringifyUrl","query","redirect_uri","errors","isRequestError","paramsSerializer","params","stringify","sort","skipNull","skipEmptyString","Login","parsed","parse","hash","substr","access_token","removeItem","Navigate","Logout","useEffect","catch","Root","BrowserRouter","Routes","Route","element","Card","BsCard","classNames","Error","Alert","entries","_ref2","name","UserContext","React","createContext","UserProvider","user","state","setState","useState","Provider","useUser","setUser","useContext","Access","require","fallback","passed","intersection","roles","Space","size","small","middle","large","Children","child","Item","_path","_extends","assign","target","i","arguments","source","key","prototype","hasOwnProperty","call","apply","this","SvgStepCheck","createElement","viewBox","xmlns","width","fill","d","Steps","CustomRcSteps","icons","finish","CheckIcon","Step","RcSteps","NumberFormat","locale","currency","formatter","style","minimumFractionDigits","Intl","format","LoadingButton","Button","disabled","RequestButton","onSuccess","fetching","setFetching","handleClick","useCallback","preventDefault","text","result","values","onClick","LinkButton","navigate","useNavigate","localize","widgets","upload","getRegistry","file","onUpload","Function","endpoint","FormData","set","Form","forwardRef","ref","action","formData","onSubmit","onChange","submitText","extraErrors","setExtraErrors","setLoading","setData","handleSubmit","nativeEvent","__errors","mapValues","toExtraErrors","handleChange","transformErrors","keyword","dataPath","property","submit","type","JsonForm","noHtml5Validate","noValidate","Body","noop","isInteger","isFinite","Math","floor","Checkbox","indeterminate","useRef","current","CustomTable","BsTable","components","table","CustomPagination","total","defaultCurrent","defaultPageSize","setCurrent","pageSize","setPageSize","allPages","p","prevPage","nextPage","pagerList","jumpPrev","jumpNext","firstPager","lastPager","BsPagination","Last","First","Prev","Next","left","max","right","min","pageBufferSize","unshift","isPagination","Table","rowKey","paginate","toolBarRender","columns","rowSelection","card","pagination","setPagination","setKeyword","fetchData","q","page","current_page","per_page","reload","useImperativeHandle","transformColumns","setKeys","Set","selectedRowKeys","getRowKey","record","getRecordByKey","find","setSelectedKeys","changedKeys","Array","from","records","recordKeys","checkedCurrentAll","every","has","checkedCurrentSome","some","checked","forEach","delete","add","align","render","useSelection","customColumns","column","customColumn","defaultRender","index","handleSearch","callback","wait","callbackRef","debouncedCallbackRef","debounce","useDebounce","LeftTools","RightTools","Control","placeholder","Action","RcTable","span","ModalButton","onOk","onShow","show","setShow","handleClose","close","Modal","onHide","closeButton","ModalForm","schema","uiSchema","fields","form","modal","handleOk","_form$current","Fragment","useRequest","manual","refreshDeps","execute","currentParams","others","useAsyncCallback","refresh","id","useOverlayState","visible","setVisible","setKey","hide","exit","onExited","Toolt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,cAAWA,EAAXhW,MAA0BA,KAAUiW,GAAWC,IAAiBxW,MAAAA,IAEhEkD,EAA2B,iBAAXA,EAAsB,CAAEyB,IAAKzB,GAAWA,QAE3CS,GAAW,IACjBT,KACAqC,MAERlF,GAEHgG,GAAU,KACD8P,GAAWC,GACZC,MAEL,IAEHhQ,GAAU,KACF+P,GACAK,MAELL,SAEGK,EAAUhL,GAAY,KACpB6K,EACAD,KAAWC,GAEXD,MAEL,CAACA,EAASC,OAEThW,GAAS+E,GAAe/E,GAAQ,OAC1B8E,EAAS9E,EAAM8E,OACrB9E,EAAQ,IAAIyG,MAAwB,iBAAX3B,EAAsBA,EAASyG,EAAOzG,GAAQ3G,KAAK,WAGzE,CACHgY,QAAAA,EACAJ,QAAAA,EACA/V,MAAAA,KACGiW,GChDX,IAAIG,GAAK,WAEeC,SAAgBpB,OAAEA,EAAFN,OAAUA,0DAAoB,SAC3D2B,EAASC,GAAclP,GAAS,IAEhC0B,EAAKyN,GAAUnP,oBAAoB+O,KAEpCK,EAAOtL,GAAY,KACrBoL,GAAW,GACPtB,GACAA,MAEL,CAACsB,EAAYtB,IAEVyB,EAAOvL,GAAY,KACrBqL,sBAAoBJ,OACrB,CAACI,EAAQJ,KAENxB,EAAOzJ,GAAY,KACrBoL,GAAW,GACP5B,GACAA,MAEL,CAAC4B,EAAY5B,IAEVxN,EAAQ,CACVyN,KAAM0B,EACNrB,OAAQwB,EACRE,SAAUD,EACV3N,IAAAA,SAGG,CACHuN,QAAAA,EACA1B,KAAAA,EACA6B,KAAAA,EACAtP,MAAAA,YClCgByP,UAAQC,QAAEA,EAAFlb,SAAWA,EAAXmb,UAAqBA,EAAY,mBAEtDlc,EAACmc,GACJD,UAAWA,EACXE,QACIpc,EAACqc,GAAUb,GAAIc,aACVL,aAIRlb"}
1
+ {"version":3,"file":"index.js","sources":["../../node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral.js","../src/components/footer.tsx","../src/utils/get-menu-data.ts","../src/layout/sider.tsx","../src/utils/message.ts","../src/components/result.tsx","../src/images/logo.svg","../src/components/dimmer.tsx","../src/components/loader.tsx","../src/components/user-provider.tsx","../src/components/header.tsx","../src/request.ts","../src/components/root.tsx","../src/components/card.tsx","../src/components/error.tsx","../src/components/access.tsx","../src/components/space.tsx","../src/images/step_check.svg","../src/components/steps.tsx","../src/components/number-format.tsx","../src/components/loading-button.tsx","../src/components/request-button.tsx","../src/components/link-button.tsx","../src/components/form.tsx","../src/components/content.tsx","../src/components/pagination.tsx","../src/components/table/use-selection.tsx","../src/components/table/index.tsx","../src/hooks/use-debounce.ts","../src/components/modal-button.tsx","../src/components/modal-form.tsx","../src/hooks/use-request.ts","../src/hooks/use-overlay-state.ts","../src/components/tooltip.tsx"],"sourcesContent":["export default function _taggedTemplateLiteral(strings, raw) {\n if (!raw) {\n raw = strings.slice(0);\n }\n\n return Object.freeze(Object.defineProperties(strings, {\n raw: {\n value: Object.freeze(raw)\n }\n }));\n}","import styled from 'styled-components';\r\n\r\nconst FooterWrapper = styled.footer`\r\n\r\n`;\r\n\r\n\r\nexport default function Footer() {\r\n return <FooterWrapper>\r\n <div className='container'>\r\n\r\n </div>\r\n </FooterWrapper>;\r\n}\r\n","import type { RouteObject } from 'react-router';\r\n\r\nexport interface MenuData {\r\n path: string;\r\n title: string;\r\n children: MenuData[];\r\n}\r\n\r\nconst formatRelativePath = (\r\n routes: RouteObject[],\r\n parent: string = '/',\r\n): MenuData[] => {\r\n\r\n const menus: MenuData[] = [];\r\n\r\n for (const route of routes) {\r\n\r\n if (route.meta?.hideInMenu) {\r\n continue;\r\n }\r\n\r\n const title = route.meta?.title;\r\n if (!title) {\r\n continue;\r\n }\r\n\r\n let path = route.path || '';\r\n\r\n path = `${parent}/${path}`;\r\n\r\n path = path.replace(/\\/+/, '/').replace(/\\/$/, '');\r\n\r\n const menu: MenuData = {\r\n title,\r\n path,\r\n children: []\r\n };\r\n\r\n if (!route.meta?.hideChildrenInMenu) {\r\n if (route.children && route.children.length > 0) {\r\n menu.children = formatRelativePath(route.children, path);\r\n }\r\n }\r\n\r\n menus.push(menu);\r\n }\r\n\r\n return menus;\r\n};\r\n\r\nexport default function getMenuData(routes: RouteObject[], base: string = '/'): MenuData[] {\r\n return formatRelativePath(routes, base);\r\n}\r\n","import RcMenu, { MenuItem, SubMenu } from 'rc-menu';\r\nimport Footer from '../components/footer';\r\nimport { Link, useLocation, useRoutes } from 'react-router-dom';\r\nimport { useEffect, useMemo, useState } from 'react';\r\nimport styled from 'styled-components';\r\nimport 'rc-menu/assets/index.css';\r\nimport type { RouteObject } from 'react-router';\r\nimport getMenuData, { MenuData } from '../utils/get-menu-data';\r\nimport type { CSSMotionProps } from 'rc-motion';\r\n\r\ninterface Props {\r\n title: string;\r\n routes: RouteObject[];\r\n basename: string;\r\n}\r\n\r\nconst renderMenuItems = (items: MenuData[]) => {\r\n return items.map((item) => {\r\n if (item.children.length > 0) {\r\n return <SubMenu title={item.title} key={item.path}>\r\n {renderMenuItems(item.children)}\r\n </SubMenu>;\r\n } else {\r\n return <MenuItem key={item.path}>\r\n <Link to={item.path}>{item.title}</Link>\r\n </MenuItem>;\r\n }\r\n });\r\n};\r\n\r\nconst collapseNode = () => {\r\n return { height: 0 };\r\n};\r\nconst expandNode = (node: HTMLElement) => {\r\n return { height: node.scrollHeight };\r\n};\r\n\r\nconst motion: CSSMotionProps = {\r\n motionName: 'rc-menu-collapse',\r\n motionAppear: true,\r\n onAppearStart: collapseNode,\r\n onAppearActive: expandNode,\r\n onEnterStart: collapseNode,\r\n onEnterActive: expandNode,\r\n onLeaveStart: expandNode,\r\n onLeaveActive: collapseNode,\r\n};\r\n\r\n\r\nexport default function SiderLayout({ routes, basename, title }: Props) {\r\n\r\n const children = useRoutes(routes);\r\n\r\n const menu = useMemo(() => getMenuData(routes, basename), [routes, basename]);\r\n\r\n const { pathname } = useLocation();\r\n\r\n const selectedKeys = useMemo(() => {\r\n const keys: string[] = [];\r\n const parts = pathname.split('/');\r\n parts.reduce<string[]>((pre, curr) => {\r\n if (pre.length > 1) {\r\n keys.push(pre.join('/'));\r\n }\r\n return [...pre, curr];\r\n }, []);\r\n keys.push(pathname);\r\n return keys;\r\n }, [pathname]);\r\n\r\n const [openKeys, setOpenKeys] = useState<string[]>([]);\r\n\r\n useEffect(() => {\r\n setOpenKeys(selectedKeys.slice(0, -1));\r\n }, [selectedKeys]);\r\n\r\n const onOpenChange = (openKeys: string[]) => {\r\n const currentKey = openKeys[openKeys.length - 1];\r\n setOpenKeys(openKeys.filter(key => currentKey.startsWith(key)));\r\n };\r\n\r\n return <Container>\r\n <Sidebar>\r\n <Header>{title}</Header>\r\n <Menu\r\n mode='inline'\r\n motion={motion}\r\n openKeys={openKeys}\r\n onOpenChange={onOpenChange}\r\n selectedKeys={selectedKeys}\r\n >\r\n {renderMenuItems(menu)}\r\n </Menu>\r\n </Sidebar>\r\n <Content>\r\n <Main>{children}</Main>\r\n <Footer />\r\n </Content>\r\n </Container>;\r\n}\r\n\r\nconst Container = styled.div`\r\n display: flex;\r\n flex-wrap: nowrap;\r\n width: 100%;\r\n`;\r\n\r\nconst Sidebar = styled.nav`\r\n position: fixed;\r\n top: 0;\r\n bottom: 0;\r\n left: 0;\r\n z-index: 100;\r\n padding: 54px 0 0;\r\n border-right: 1px solid #e3e3e3;\r\n width: 230px;\r\n background-color: #f5f5f5;\r\n`;\r\n\r\nconst Header = styled.div`\r\n padding: 10px 0;\r\n height: 64px;\r\n line-height: 44px;\r\n text-indent: 24px;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n font-size: 16px;\r\n`;\r\n\r\nconst Content = styled.div`\r\n margin-left: 230px;\r\n flex: 1;\r\n`;\r\n\r\nconst Main = styled.main`\r\n min-height: calc(100vh - 54px);\r\n position: relative;\r\n`;\r\n\r\nconst Menu = styled(RcMenu)`\r\n border: none;\r\n box-shadow: none;\r\n padding: 0;\r\n\r\n .rc-menu-item {\r\n display: flex;\r\n\r\n &:hover {\r\n background-color: #f0f0f0;\r\n }\r\n\r\n a {\r\n flex: 1;\r\n text-decoration: none;\r\n color: dimgray;\r\n }\r\n }\r\n\r\n .rc-menu-sub {\r\n background-color: #eee;\r\n border-top: 1px solid #eee;\r\n border-bottom: 1px solid #eee;\r\n\r\n & > li {\r\n &:first-child {\r\n margin-top: 4px;\r\n }\r\n\r\n &:last-child {\r\n margin-bottom: 4px;\r\n }\r\n }\r\n\r\n .rc-menu-item-selected {\r\n background-color: #eee;\r\n color: var(--bs-primary);\r\n\r\n & > a {\r\n color: var(--bs-primary);\r\n }\r\n }\r\n\r\n .rc-menu-item-active {\r\n background-color: #eee;\r\n }\r\n\r\n .rc-menu-item {\r\n &:hover {\r\n background-color: #e7e7e7;\r\n }\r\n }\r\n }\r\n\r\n .rc-menu-submenu {\r\n & > .rc-menu-submenu-title {\r\n &:hover {\r\n background-color: #e7e7e7;\r\n }\r\n }\r\n }\r\n\r\n .rc-menu-submenu-active > .rc-menu-submenu-title {\r\n background-color: #eee;\r\n }\r\n\r\n .rc-menu-item,\r\n .rc-menu-submenu > .rc-menu-submenu-title {\r\n padding: 0 8px 0 24px;\r\n font-size: 14px;\r\n line-height: 36px;\r\n cursor: pointer;\r\n }\r\n\r\n .rc-menu-sub > .rc-menu-item,\r\n .rc-menu-sub > .rc-menu-submenu > .rc-menu-submenu-title {\r\n padding-top: 0;\r\n padding-bottom: 0;\r\n padding-right: 0;\r\n }\r\n\r\n .rc-menu-submenu-arrow {\r\n line-height: 38px;\r\n }\r\n\r\n .rc-menu-item-selected {\r\n background-color: #f5f5f5;\r\n color: var(--bs-primary);\r\n\r\n & > a {\r\n color: var(--bs-primary);\r\n }\r\n }\r\n\r\n .rc-menu-submenu-selected {\r\n background-color: #eee;\r\n\r\n .rc-menu-submenu-title {\r\n color: var(--bs-primary);\r\n font-weight: 500;\r\n }\r\n }\r\n\r\n & > .rc-menu-item {\r\n line-height: 38px;\r\n }\r\n\r\n & > .rc-menu-submenu {\r\n &.rc-menu-submenu-selected {\r\n background-color: #f5f5f5;\r\n }\r\n\r\n & > .rc-menu-submenu-title {\r\n line-height: 38px;\r\n\r\n &:hover {\r\n background-color: #f0f0f0;\r\n }\r\n }\r\n\r\n &.rc-menu-submenu-active > .rc-menu-submenu-title {\r\n background-color: #f5f5f5;\r\n }\r\n\r\n & > .rc-menu-sub {\r\n border-top: 1px solid #e6e6e6;\r\n border-bottom: 1px solid #e6e6e6;\r\n\r\n & > li {\r\n &:first-child {\r\n margin-top: 9px;\r\n }\r\n\r\n &:last-child {\r\n margin-bottom: 9px;\r\n }\r\n }\r\n }\r\n }\r\n\r\n`;\r\n","import Swal from 'sweetalert2/dist/sweetalert2.js';\r\nimport withReactContent from 'sweetalert2-react-content';\r\n\r\nconst CustomSwal = withReactContent(Swal);\r\n\r\ninterface MessageOptions {\r\n title?: string;\r\n text?: string;\r\n}\r\n\r\nconst defaultOptions = {\r\n confirmButtonText: '确定',\r\n cancelButtonText: '取消'\r\n};\r\n\r\nconst Message = {\r\n confirm: async (options: MessageOptions) => {\r\n const { isConfirmed } = await CustomSwal.fire({\r\n ...defaultOptions,\r\n icon: 'warning',\r\n showCancelButton: true,\r\n ...options\r\n });\r\n\r\n return isConfirmed;\r\n },\r\n error: (options: MessageOptions) => {\r\n CustomSwal.fire({\r\n ...defaultOptions,\r\n toast: true,\r\n position: 'top',\r\n icon: 'error',\r\n timer: 3000,\r\n showConfirmButton: false,\r\n ...options\r\n });\r\n }\r\n};\r\n\r\nexport default Message;\r\n","import { ReactNode } from 'react';\r\nimport styled from 'styled-components';\r\n\r\nconst Container = styled.div`\r\n padding: 48px 32px;\r\n`;\r\n\r\nconst Icon = styled.div`\r\n margin-bottom: 24px;\r\n text-align: center;\r\n font-size: 72px;\r\n`;\r\n\r\nconst Title = styled.div`\r\n color: rgba(0, 0, 0, .85);\r\n font-size: 24px;\r\n line-height: 1.8;\r\n text-align: center;\r\n`;\r\n\r\nconst Extra = styled.div`\r\n margin-top: 32px;\r\n text-align: center;\r\n`;\r\n\r\nconst IconMap = {\r\n success: <i className='bi bi-check-circle-fill text-success' />,\r\n error: <i className='bi bi-exclamation-circle-fill text-danger' />,\r\n info: <i className='bi bi-info-circle-fill text-info' />,\r\n warning: <i className='bi bi-exclamation-triangle-fill text-warning' />,\r\n};\r\n\r\ninterface ResultProps {\r\n status?: keyof typeof IconMap\r\n icon?: ReactNode\r\n title?: string\r\n extra?: ReactNode;\r\n}\r\n\r\nexport default function Result({ status, title, icon, extra }: ResultProps) {\r\n\r\n if (!icon && status) {\r\n icon = IconMap[status];\r\n }\r\n\r\n return <Container>\r\n {icon && <Icon>{icon}</Icon>}\r\n {title && <Title>{title}</Title>}\r\n {extra && <Extra>{extra}</Extra>}\r\n </Container>;\r\n}\r\n","var img = \"data:image/svg+xml,%3csvg width='485' height='132' xmlns='http://www.w3.org/2000/svg' xml:space='preserve' style='enable-background:new 0 0 531.69 198.43%3b' version='1.1'%3e %3cstyle type='text/css'%3e.st0%7bfill:%233C60FF%3b%7d%3c/style%3e %3cg%3e %3ctitle%3ebackground%3c/title%3e %3crect fill='none' id='canvas_background' height='134' width='487' y='-1' x='-1'/%3e %3c/g%3e %3cg%3e %3ctitle%3eLayer 1%3c/title%3e %3cpath id='svg_1' d='m132.29%2c62.34c-1.19%2c-18.77 -10.34%2c-35.36 -24.11%2c-46.46c-11.15%2c-8.99 -25.34%2c-14.38 -40.79%2c-14.38c-0.55%2c0 -1.09%2c0.01 -1.63%2c0.02c-3.32%2c0.08 -6.57%2c0.41 -9.75%2c0.98c-30.49%2c5.38 -53.65%2c32 -53.65%2c64.04c0%2c1.87 0.08%2c3.73 0.24%2c5.57c2.5%2c29.51 24.7%2c53.4 53.41%2c58.47c2.38%2c0.42 4.8%2c0.72 7.26%2c0.86c0.83%2c0.05 1.66%2c0.09 2.5%2c0.11c0.54%2c0.01 1.08%2c0.02 1.63%2c0.02c34.04%2c0 61.97%2c-26.16 64.79%2c-59.46c0.16%2c-1.83 0.24%2c-3.69 0.24%2c-5.57c0%2c-1.42 -0.05%2c-2.82 -0.14%2c-4.2zm-76.27%2c32.5c-0.26%2c0.01 -0.53%2c0.01 -0.79%2c0.01c-14.56%2c0 -26.88%2c-9.57 -31.03%2c-22.76c-0.97%2c-3.08 -1.49%2c-6.35 -1.49%2c-9.75c0%2c-17.95 14.56%2c-32.52 32.51%2c-32.52c0.26%2c0 0.53%2c0 0.79%2c0.01c3.41%2c0.08 6.69%2c0.68 9.75%2c1.74c6.5%2c2.22 12.06%2c6.45 15.97%2c11.94c1.98%2c2.78 3.54%2c5.9 4.57%2c9.25c0.94%2c3.03 1.44%2c6.24 1.44%2c9.58l-9.75%2c0c0%2c-2.18 -0.31%2c-4.29 -0.88%2c-6.28c-0.92%2c-3.23 -2.55%2c-6.17 -4.69%2c-8.64c-1.86%2c-2.14 -4.12%2c-3.93 -6.65%2c-5.25c-2.93%2c-1.54 -6.24%2c-2.46 -9.75%2c-2.58c-0.26%2c-0.01 -0.52%2c-0.01 -0.79%2c-0.01c-12.57%2c0 -22.76%2c10.19 -22.76%2c22.76c0%2c3.49 0.79%2c6.8 2.19%2c9.75c3.65%2c7.69 11.49%2c13.01 20.57%2c13.01c0.27%2c0 0.53%2c-0.01 0.79%2c-0.01l0%2c9.75zm55.7%2c-17.92c-3.35%2c10.5 -13.18%2c18.09 -24.78%2c18.09c-3.13%2c0 -6.13%2c-0.55 -8.91%2c-1.57c-2.18%2c-0.8 -4.24%2c-1.88 -6.11%2c-3.21c-2.38%2c-1.68 -4.47%2c-3.76 -6.16%2c-6.13c-0.28%2c-0.39 -0.55%2c-0.79 -0.81%2c-1.2c-2.03%2c-3.2 -3.38%2c-6.87 -3.85%2c-10.82l9.87%2c0c0.33%2c1.71 0.92%2c3.32 1.74%2c4.8c1.61%2c2.91 4.09%2c5.26 7.09%2c6.72c0.57%2c0.28 1.15%2c0.53 1.76%2c0.73c1.68%2c0.6 3.49%2c0.92 5.37%2c0.92c7.92%2c0 14.52%2c-5.67 15.96%2c-13.17c0.2%2c-1 0.3%2c-2.04 0.3%2c-3.09c0%2c-2.37 -0.51%2c-4.63 -1.43%2c-6.67c-1.66%2c-3.71 -4.68%2c-6.68 -8.43%2c-8.28l3.54%2c-9.1c7.43%2c3.08 13.13%2c9.49 15.21%2c17.38c0.44%2c1.64 0.72%2c3.34 0.81%2c5.09c0.04%2c0.52 0.05%2c1.05 0.05%2c1.58c0%2c1.05 -0.07%2c2.07 -0.18%2c3.09c-0.18%2c1.68 -0.54%2c3.3 -1.04%2c4.84z' class='st0'/%3e %3cg id='svg_2'%3e %3cg id='svg_3'%3e %3crect id='svg_4' height='6.34' width='94.12' class='st0' y='20.46' x='163.29'/%3e %3c/g%3e %3cg id='svg_5'%3e %3cpath id='svg_6' d='m169.31%2c113.72l0%2c-6.34c6.49%2c0 11.77%2c-5.28 11.77%2c-11.77l0%2c-71.98l6.34%2c0l0%2c71.98c0%2c9.98 -8.12%2c18.11 -18.11%2c18.11z' class='st0'/%3e %3c/g%3e %3cg id='svg_7'%3e %3cpath id='svg_8' d='m255.49%2c91.27l-6.34%2c0l0%2c-38.2c0%2c-5.06 -4.12%2c-9.18 -9.18%2c-9.18l-19.37%2c0c-5.06%2c0 -9.18%2c4.12 -9.18%2c9.18l0%2c38.2l-6.34%2c0l0%2c-38.2c0%2c-8.55 6.96%2c-15.51 15.51%2c-15.51l19.38%2c0c8.55%2c0 15.51%2c6.96 15.51%2c15.51l0%2c38.2l0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_9'%3e %3crect id='svg_10' height='17.09' width='6.34' class='st0' y='23.63' x='227.12'/%3e %3c/g%3e %3cg id='svg_11'%3e %3cpath id='svg_12' d='m206.43%2c113.84l-3.34%2c0l0%2c-6.34l3.34%2c0c6.3%2c0 12.9%2c-3.56 15.35%2c-8.29c3.49%2c-6.71 5.33%2c-14.25 5.33%2c-21.81l0%2c-26.13l6.34%2c0l0%2c26.13c0%2c8.58 -2.09%2c17.13 -6.05%2c24.74c-3.98%2c7.68 -13.57%2c11.7 -20.97%2c11.7z' class='st0'/%3e %3c/g%3e %3cg id='svg_13'%3e %3cpath id='svg_14' d='m257.48%2c113.84l-3.34%2c0c-7.4%2c0 -16.98%2c-4.02 -20.98%2c-11.7c-3.96%2c-7.61 -6.05%2c-16.16 -6.05%2c-24.74l6.34%2c0c0%2c7.56 1.84%2c15.1 5.33%2c21.81c2.46%2c4.73 9.06%2c8.29 15.35%2c8.29l3.34%2c0l0%2c6.34l0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_15'%3e %3crect id='svg_16' height='6.34' width='42.87' class='st0' y='27.89' x='274.07'/%3e %3c/g%3e %3cg id='svg_17'%3e %3crect id='svg_18' height='61.38' width='6.34' class='st0' y='14.89' x='293.05'/%3e %3c/g%3e %3cg id='svg_19'%3e %3crect id='svg_20' height='6.34' width='33.26' class='st0' transform='matrix(0.11%2c-0.9939%2c0.9939%2c0.11%2c194.7608%2c392.0006) ' y='46.985071' x='325.728637'/%3e %3c/g%3e %3cg id='svg_21'%3e %3crect id='svg_22' height='33.26' width='6.34' class='st0' transform='matrix(0.9939%2c-0.11%2c0.11%2c0.9939%2c-7.5075%2c38.3801) ' y='37.060893' x='310.495485'/%3e %3c/g%3e %3cg id='svg_23'%3e %3cpath id='svg_24' d='m352.9%2c77.14l-15.15%2c0c-7.52%2c0 -13.64%2c-6.12 -13.64%2c-13.63l0%2c-29.61c0%2c-7.52 6.12%2c-13.64 13.64%2c-13.64l15.15%2c0c7.52%2c0 13.64%2c6.12 13.64%2c13.64l0%2c29.61c0%2c7.52 -6.12%2c13.63 -13.64%2c13.63zm-15.15%2c-50.54c-4.02%2c0 -7.3%2c3.27 -7.3%2c7.3l0%2c29.61c0%2c4.02 3.27%2c7.3 7.3%2c7.3l15.15%2c0c4.02%2c0 7.3%2c-3.27 7.3%2c-7.3l0%2c-29.61c0%2c-4.02 -3.27%2c-7.3 -7.3%2c-7.3l-15.15%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_25'%3e %3cg id='svg_26'%3e %3crect id='svg_27' height='6.34' width='17.8' class='st0' y='37.2' x='336.43'/%3e %3c/g%3e %3cg id='svg_28'%3e %3crect id='svg_29' height='6.34' width='17.8' class='st0' y='53.87' x='336.43'/%3e %3c/g%3e %3c/g%3e %3cg id='svg_30'%3e %3cpath id='svg_31' d='m352.7%2c113.84l-37.98%2c0c-8%2c0 -14.5%2c-6.51 -14.5%2c-14.5l0%2c-16.14l6.34%2c0l0%2c16.13c0%2c4.5 3.66%2c8.17 8.17%2c8.17l37.98%2c0l0%2c6.34l-0.01%2c0z' class='st0'/%3e %3c/g%3e %3cg id='svg_32'%3e %3crect id='svg_33' height='6.34' width='23.57' class='st0' transform='matrix(0.2529%2c-0.9675%2c0.9675%2c0.2529%2c114.4986%2c402.9877) ' y='83.698593' x='326.836101'/%3e %3c/g%3e %3cg id='svg_34'%3e %3crect id='svg_35' height='6.34' width='20.52' class='st0' y='86.2' x='321.58'/%3e %3c/g%3e %3cg id='svg_36'%3e %3crect id='svg_37' height='24.75' width='6.34' class='st0' transform='matrix(0.9556%2c-0.2946%2c0.2946%2c0.9556%2c-19.7967%2c122.424) ' y='75.874073' x='369.686666'/%3e %3c/g%3e %3cg id='svg_38'%3e %3crect id='svg_39' height='6.34' width='71.83' class='st0' y='20.46' x='395.51'/%3e %3c/g%3e %3cg id='svg_40'%3e %3crect id='svg_41' height='6.34' width='90.81' class='st0' y='57.44' x='386.02'/%3e %3c/g%3e %3cg id='svg_42'%3e %3cpath id='svg_43' d='m463.12%2c113.64l-56%2c0c-4.5%2c0 -8.59%2c-2.29 -10.94%2c-6.14c-2.35%2c-3.84 -2.52%2c-8.53 -0.46%2c-12.53l17.68%2c-35.81l5.64%2c2.89l-17.68%2c35.81c-1.04%2c2.02 -0.95%2c4.39 0.23%2c6.33c1.19%2c1.94 3.25%2c3.1 5.53%2c3.1l56%2c0c1.51%2c0 2.88%2c-0.71 3.74%2c-1.95c0.81%2c-1.16 1.03%2c-2.57 0.63%2c-3.91l-7.8%2c-12.34l5.36%2c-3.39l8.18%2c12.94l0.12%2c0.31c1.24%2c3.34 0.76%2c7.08 -1.28%2c10.01c-2.04%2c2.94 -5.39%2c4.68 -8.95%2c4.68z' class='st0'/%3e %3c/g%3e %3c/g%3e %3c/g%3e%3c/svg%3e\";\n export default img;","import styled from 'styled-components';\r\n\r\nexport const Dimmable = styled.div`\r\n position: relative;\r\n`;\r\n\r\ninterface DimmerProps {\r\n active?: boolean\r\n inverted?: boolean\r\n}\r\n\r\nconst Dimmer = styled.div<DimmerProps>`\r\n display: ${props => props.active ? 'flex' : 'none'};\r\n position: absolute;\r\n top: 0 !important;\r\n left: 0 !important;\r\n width: 100%;\r\n height: 100%;\r\n text-align: center;\r\n vertical-align: middle;\r\n padding: 1em;\r\n background-color: ${props => props.inverted ? 'rgba(255, 255, 255, .85)' : 'rgba(0, 0, 0, .85)'};\r\n opacity: ${props => props.active ? 1 : 0};\r\n line-height: 1;\r\n animation-fill-mode: both;\r\n animation-duration: .5s;\r\n transition: background-color .5s linear;\r\n flex-direction: column;\r\n align-items: center;\r\n justify-content: center;\r\n user-select: none;\r\n will-change: opacity;\r\n z-index: 990;\r\n`;\r\n\r\nexport default Dimmer;\r\n","import { PropsWithChildren } from 'react';\r\nimport { Spinner, SpinnerProps } from 'react-bootstrap';\r\nimport Dimmer from './dimmer';\r\nimport styled from 'styled-components';\r\n\r\ninterface LoaderProps {\r\n loading?: boolean;\r\n animation?: SpinnerProps['animation'];\r\n wrap?: boolean;\r\n}\r\n\r\nexport default function Loader({\r\n loading = true,\r\n children,\r\n variant = 'success',\r\n animation = 'border',\r\n wrap,\r\n ...props\r\n}: PropsWithChildren<LoaderProps & Omit<SpinnerProps, 'animation'>>): JSX.Element | null {\r\n if (!loading) {\r\n return null;\r\n }\r\n\r\n if (children) {\r\n children = <p className='mt-3 text-secondary'>{children}</p>;\r\n }\r\n\r\n children = <Dimmer inverted active>\r\n <Spinner animation={animation} variant={variant} {...props} />\r\n {children}\r\n </Dimmer>;\r\n\r\n if (wrap) {\r\n return <Wrap height={typeof wrap === 'number' ? wrap : 150}>\r\n {children}\r\n </Wrap>;\r\n }\r\n\r\n return children as JSX.Element;\r\n}\r\n\r\nconst Wrap = styled.div<{ height: number }>`\r\n position: relative;\r\n height: ${props => `${props.height}px`};\r\n`;\r\n","import React, { PropsWithChildren, useContext, useEffect, useState } from 'react';\r\nimport Loader from './loader';\r\nimport { User } from '../utils/types';\r\n\r\nexport const UserContext = React.createContext<[(User | null), ((user: User) => void)]>([null, () => {\r\n}]);\r\n\r\ninterface Props {\r\n user: User;\r\n}\r\n\r\nconst UserProvider = function({ children, user }: PropsWithChildren<Props>) {\r\n const [state, setState] = useState(user);\r\n\r\n useEffect(() => {\r\n setState(user);\r\n }, [user]);\r\n\r\n if (!state) {\r\n return <Loader />;\r\n }\r\n\r\n return <UserContext.Provider value={[state, setState]}>\r\n {children}\r\n </UserContext.Provider>;\r\n};\r\n\r\nexport function useUser(): [User, ((user: User) => void)] {\r\n const [user, setUser] = useContext(UserContext);\r\n if (!user) {\r\n throw new Error('please use `useUser` in UserContext');\r\n }\r\n\r\n return [user, setUser];\r\n}\r\n\r\nexport default UserProvider;\r\n","import logo from '../images/logo.svg';\r\nimport { Dropdown } from 'react-bootstrap';\r\nimport styled from 'styled-components';\r\nimport { PropsWithChildren, ReactNode } from 'react';\r\nimport { useUser } from './user-provider';\r\n\r\nconst Avatar = styled.a`\r\n cursor: pointer;\r\n`;\r\n\r\ninterface Props {\r\n menus: ReactNode;\r\n}\r\n\r\nexport default function Header({ children, menus }: PropsWithChildren<Props>) {\r\n const [user] = useUser();\r\n\r\n return <Container className='navbar navbar-expand-lg navbar-light bg-white border-bottom sticky-top'>\r\n <div className='container-fluid'>\r\n <a className='navbar-brand' href='https://www.topthink.com'>\r\n <img src={logo} height='30' />\r\n </a>\r\n {children}\r\n <Dropdown navbar>\r\n <Dropdown.Toggle as={Avatar} className='nav-link'>\r\n <img className='rounded-circle' width='25' height='25' src={user.avatar} />\r\n </Dropdown.Toggle>\r\n <Dropdown.Menu className={'shadow'}>\r\n {menus}\r\n </Dropdown.Menu>\r\n </Dropdown>\r\n </div>\r\n </Container>;\r\n}\r\n\r\nconst Container = styled.header`\r\n height: 54px;\r\n`;\r\n","import axios, { AxiosRequestConfig, AxiosInstance } from 'axios';\r\nimport queryString from 'query-string';\r\nimport * as rax from 'retry-axios';\r\nimport { RetryConfig } from 'retry-axios';\r\n\r\nexport type Errors = string | {\r\n [key: string]: string\r\n}\r\n\r\ndeclare module 'axios' {\r\n interface AxiosError {\r\n errors: Errors;\r\n }\r\n\r\n interface AxiosRequestConfig {\r\n raxConfig?: RetryConfig;\r\n }\r\n}\r\n\r\nrax.attach();\r\naxios.defaults.raxConfig = {\r\n retryDelay: 2000,\r\n backoffType: 'static',\r\n shouldRetry: (err) => {\r\n return (\r\n err.config.method?.toUpperCase() === 'GET'\r\n && err.response?.status === 449\r\n );\r\n }\r\n};\r\naxios.defaults.maxContentLength = Infinity;\r\naxios.defaults.maxBodyLength = Infinity;\r\naxios.defaults.baseURL = '/api';\r\naxios.interceptors.request.use(\r\n config => {\r\n const token = sessionStorage.getItem('authorization');\r\n\r\n if (token) {\r\n config.headers = {\r\n ...config.headers,\r\n Authorization: `Bearer ${token}`\r\n };\r\n }\r\n return config;\r\n },\r\n error => {\r\n return Promise.reject(error);\r\n }\r\n);\r\n\r\nconst isRecord = (data: any): data is Record<string, string> => {\r\n return data && (typeof data === 'object');\r\n};\r\n\r\naxios.interceptors.response.use(\r\n response => {\r\n if (response.status === 201 && response.data.location) {\r\n window.location.href = response.data.location;\r\n response.data = undefined; //防止多次跳转\r\n }\r\n\r\n return response;\r\n },\r\n e => {\r\n if (axios.isAxiosError(e)) {\r\n if (e.response) {\r\n const { data, status } = e.response;\r\n if (status === 401) {\r\n if (isRecord(data) && data.url) {\r\n if (window.location.pathname !== '/logout') {\r\n sessionStorage.setItem('redirect_uri', window.location.pathname + window.location.search);\r\n }\r\n const redirectUri = window.location.origin + '/login';\r\n\r\n window.location.href = queryString.stringifyUrl({\r\n url: data.url,\r\n query: { redirect_uri: redirectUri }\r\n });\r\n }\r\n\r\n e.errors = 'Unauthorized';\r\n } else {\r\n if (isRecord(data)) {\r\n if (status === 422) {\r\n e.errors = data;\r\n } else if ('message' in data) {\r\n e.errors = data['message'];\r\n }\r\n } else {\r\n e.errors = data as string;\r\n }\r\n }\r\n }\r\n }\r\n return Promise.reject(e);\r\n }\r\n);\r\n\r\nexport type RequestConfig = AxiosRequestConfig | string\r\nexport type RequestInstance = AxiosInstance\r\nexport const isRequestError = axios.isAxiosError;\r\n\r\nconst request = async function <T = any>(config: RequestConfig) {\r\n config = typeof config === 'string' ? { url: config } : config;\r\n\r\n const { data } = await axios.request<T>({\r\n paramsSerializer: function(params) {\r\n return queryString.stringify(params, {\r\n sort: false,\r\n skipNull: true,\r\n skipEmptyString: true\r\n });\r\n },\r\n ...config\r\n });\r\n\r\n return data;\r\n};\r\n\r\nexport default request;\r\n","import { PropsWithChildren, useEffect } from 'react';\r\nimport { BrowserRouter, Navigate, Route, Routes, useLocation } from 'react-router-dom';\r\nimport queryString from 'query-string';\r\nimport Loader from './loader';\r\nimport request from '../request';\r\n\r\nfunction Login() {\r\n\r\n const location = useLocation();\r\n\r\n const parsed = queryString.parse(location.hash.substr(1));\r\n\r\n sessionStorage.setItem('authorization', parsed.access_token as string);\r\n\r\n const redirectUri = sessionStorage.getItem('redirect_uri');\r\n if (redirectUri) {\r\n sessionStorage.removeItem('redirect_uri');\r\n }\r\n\r\n return <Navigate to={redirectUri || '/'} replace />;\r\n}\r\n\r\nfunction Logout() {\r\n\r\n useEffect(() => {\r\n request('/logout').catch(() => {\r\n sessionStorage.removeItem('authorization');\r\n });\r\n }, []);\r\n\r\n return <Loader />;\r\n}\r\n\r\nexport default function Root({ children }: PropsWithChildren<any>) {\r\n\r\n return <BrowserRouter>\r\n <Routes>\r\n <Route path='*' element={children} />\r\n <Route path='login' element={<Login />} />\r\n <Route path='logout' element={<Logout />} />\r\n </Routes>\r\n </BrowserRouter>;\r\n}\r\n","import { PropsWithChildren } from 'react';\r\nimport { Card as BsCard, CardProps as BsCardProps } from 'react-bootstrap';\r\nimport classNames from 'classnames';\r\n\r\ninterface CardProps extends BsCardProps {\r\n title?: string;\r\n}\r\n\r\nexport default function Card({ children, title, className, ...props }: PropsWithChildren<CardProps>) {\r\n\r\n return <BsCard className={classNames('border-0 shadow-sm mb-3', className)} {...props}>\r\n <div className='card-body'>\r\n {title && <>\r\n <h5>{title}</h5>\r\n <hr />\r\n </>}\r\n {children}\r\n </div>\r\n </BsCard>;\r\n}\r\n","import { Alert } from 'react-bootstrap';\r\nimport { Errors } from '../request';\r\n\r\nexport default function Error({ errors }: { errors?: Errors }) {\r\n if (!errors) {\r\n return null;\r\n }\r\n return <Alert variant='danger'>\r\n <ul className='mb-0'>\r\n {typeof errors === 'string'\r\n ? <li>{errors}</li>\r\n : Object.entries(errors).map(([name, error]) => <li key={name}>{error}</li>)\r\n }\r\n </ul>\r\n </Alert>;\r\n}\r\n","import { ReactNode } from 'react';\r\nimport { intersection } from 'lodash';\r\nimport { useUser } from './user-provider';\r\nimport { User } from '../utils/types';\r\n\r\nexport interface AccessProps {\r\n require?: string | string[] | ((user: User) => boolean);\r\n fallback?: ReactNode;\r\n children: ReactNode;\r\n}\r\n\r\nexport default function Access({\r\n require,\r\n children,\r\n fallback\r\n}: AccessProps) {\r\n const [user,] = useUser();\r\n let passed = false;\r\n if (typeof require === 'function') {\r\n passed = require(user);\r\n } else {\r\n if (typeof require === 'string') {\r\n require = [require];\r\n }\r\n passed = intersection(user.roles, require).length > 0;\r\n }\r\n if (!passed) {\r\n children = fallback;\r\n }\r\n\r\n return <>{children}</>;\r\n}\r\n","import { Children, ReactNode } from 'react';\r\nimport styled from 'styled-components';\r\n\r\ninterface SpaceProps {\r\n children: ReactNode;\r\n size?: 'small' | 'middle' | 'large' | number;\r\n}\r\n\r\n\r\nexport default function Space({ children, size = 'small' }: SpaceProps) {\r\n\r\n if (typeof size === 'string') {\r\n size = {\r\n small: 8,\r\n middle: 16,\r\n large: 24\r\n }[size];\r\n }\r\n\r\n const items = Children.map(children, (child) => {\r\n if (child) {\r\n return <Item>{child}</Item>;\r\n }\r\n });\r\n\r\n return <Container size={size}>\r\n {items}\r\n </Container>;\r\n}\r\n\r\nconst Container = styled.div<{ size: number }>`\r\n display: inline-flex;\r\n align-items: center;\r\n gap: ${props => props.size}px;\r\n`;\r\n\r\nconst Item = styled.div`\r\n\r\n`;\r\n","var img = \"data:image/svg+xml,%3csvg t='1651217947509' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='2548' width='16px' height='16px' fill='currentColor'%3e %3cpath d='M887.904 298.208c-12.864-12.064-33.152-11.488-45.216 1.408L415.936 753.984l-233.12-229.696C170.208 511.872 149.952 512 137.536 524.608c-12.416 12.576-12.256 32.864 0.352 45.248l256.48 252.672c0.096 0.096 0.224 0.128 0.32 0.224 0.096 0.096 0.128 0.224 0.224 0.32 2.016 1.92 4.448 3.008 6.784 4.288 1.152 0.672 2.144 1.664 3.36 2.144 3.776 1.472 7.776 2.24 11.744 2.24 4.192 0 8.384-0.832 12.288-2.496 1.312-0.544 2.336-1.664 3.552-2.368 2.4-1.408 4.896-2.592 6.944-4.672 0.096-0.096 0.128-0.256 0.224-0.352 0.064-0.096 0.192-0.128 0.288-0.224l449.184-478.208C901.44 330.592 900.768 310.336 887.904 298.208z' p-id='2549'%3e%3c/path%3e%3c/svg%3e\";\n export default img;","import RcSteps from 'rc-steps';\r\nimport 'rc-steps/assets/index.css';\r\nimport styled from 'styled-components';\r\nimport { ComponentProps } from 'react';\r\nimport { ReactComponent as CheckIcon } from '../images/step_check.svg';\r\n\r\nexport default function Steps(props: ComponentProps<typeof RcSteps>) {\r\n return <CustomRcSteps\r\n icons={{\r\n finish: <CheckIcon />,\r\n error: <></>\r\n }}\r\n {...props}\r\n />;\r\n}\r\n\r\nSteps.Step = RcSteps.Step;\r\n\r\nconst CustomRcSteps = styled(RcSteps)`\r\n .rc-steps-item-icon {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n\r\n & > .rc-steps-icon {\r\n top: 0;\r\n }\r\n }\r\n\r\n .rc-steps-item-process {\r\n .rc-steps-item-icon {\r\n background: var(--bs-primary);\r\n border-color: var(--bs-primary);\r\n }\r\n }\r\n\r\n .rc-steps-item-finish {\r\n .rc-steps-item-icon {\r\n border-color: var(--bs-primary);\r\n\r\n & > .rc-steps-icon {\r\n color: var(--bs-primary);\r\n }\r\n }\r\n\r\n .rc-steps-item-title:after {\r\n background-color: var(--bs-primary);\r\n }\r\n }\r\n\r\n`;\r\n","import { useMemo } from 'react';\r\n\r\ninterface Props {\r\n value: number;\r\n currency?: boolean;\r\n locale?: string;\r\n}\r\n\r\nexport default function NumberFormat({ value, locale = 'zh-CN', currency = true }: Props) {\r\n\r\n const formatter = useMemo(() => {\r\n\r\n let options = {};\r\n\r\n if (currency) {\r\n options = {\r\n style: 'currency',\r\n currency: 'CNY',\r\n ...options\r\n };\r\n } else {\r\n options = {\r\n minimumFractionDigits: 2,\r\n };\r\n }\r\n\r\n return new Intl.NumberFormat(locale, options);\r\n }, [currency, locale]);\r\n\r\n return <>{formatter.format(value)}</>;\r\n}\r\n","import { Button, ButtonProps } from 'react-bootstrap';\r\n\r\ninterface CustomButtonProps extends ButtonProps {\r\n loading: boolean\r\n}\r\n\r\nexport default function LoadingButton({ loading, children, ...props }: CustomButtonProps) {\r\n\r\n return <Button {...props} disabled={loading}>\r\n {loading ? 'Loading…' : children}\r\n </Button>;\r\n}\r\n","import { Button, ButtonProps } from 'react-bootstrap';\r\nimport request, { RequestConfig } from '../request';\r\nimport { createElement, ElementType, MouseEvent, useCallback, useState } from 'react';\r\nimport Message from '../utils/message';\r\nimport axios, { AxiosRequestConfig } from 'axios';\r\n\r\ninterface Props extends Omit<ButtonProps, 'as'> {\r\n url: RequestConfig;\r\n method?: AxiosRequestConfig['method'];\r\n confirm?: string;\r\n onSuccess?: (result: any) => void;\r\n as?: ElementType | ButtonProps['as'];\r\n}\r\n\r\nexport default function RequestButton({\r\n url,\r\n method,\r\n confirm,\r\n onSuccess,\r\n children,\r\n disabled,\r\n as = Button,\r\n ...props\r\n}: Props) {\r\n\r\n const [fetching, setFetching] = useState(false);\r\n\r\n const handleClick = useCallback(async (e: MouseEvent) => {\r\n e.preventDefault();\r\n try {\r\n setFetching(true);\r\n if (confirm) {\r\n if (!await Message.confirm({ text: confirm })) {\r\n return;\r\n }\r\n }\r\n\r\n const config = typeof url === 'string' ? { url, method } : { method, ...url };\r\n\r\n const result = await request(config);\r\n\r\n if (onSuccess) {\r\n onSuccess(result);\r\n }\r\n } catch (e) {\r\n if (axios.isAxiosError(e)) {\r\n let errors = e.errors;\r\n if (typeof e.errors !== 'string') {\r\n errors = Object.values(e.errors).join('<br />');\r\n }\r\n Message.error({ text: errors as string });\r\n } else {\r\n throw e;\r\n }\r\n } finally {\r\n setFetching(false);\r\n }\r\n }, [url, method, setFetching]);\r\n\r\n return createElement(as, {\r\n ...props,\r\n disabled: disabled || fetching,\r\n onClick: handleClick\r\n }, children);\r\n}\r\n","import { Button, ButtonProps } from 'react-bootstrap';\r\nimport { LinkProps, useNavigate } from 'react-router-dom';\r\n\r\ninterface Props extends ButtonProps, Pick<LinkProps, 'to' | 'replace'> {\r\n\r\n}\r\n\r\nexport default function LinkButton({ to, replace, ...props }: Props) {\r\n let navigate = useNavigate();\r\n\r\n return <Button {...props} onClick={(e) => {\r\n e.preventDefault();\r\n navigate(to, { replace });\r\n }} />;\r\n}\r\n","import JsonForm, { JsonFormProps, JsonFormType, getRegistry } from '@topthink/json-form';\r\nimport * as React from 'react';\r\nimport {\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n PropsWithoutRef,\r\n ReactNode,\r\n RefAttributes,\r\n useCallback,\r\n useState\r\n} from 'react';\r\nimport axios, { AxiosError, Method } from 'axios';\r\nimport LoadingButton from './loading-button';\r\nimport request from '../request';\r\nimport { mapValues } from 'lodash';\r\nimport { AjvError, ISubmitEvent, WidgetProps } from '@rjsf/core';\r\n\r\nconst localize = require('ajv-i18n/localize/zh');\r\n\r\nexport interface FormProps<T = any> extends JsonFormProps<T> {\r\n onSuccess?: (data: any) => void;\r\n method?: Method;\r\n children?: ReactNode | ((props: { submit: ReactNode, loading: boolean }) => ReactNode);\r\n submitText?: string;\r\n}\r\n\r\ntype Error = {\r\n __errors: string[]\r\n}\r\n\r\ntype Errors = Error | {\r\n [key: string]: Error\r\n}\r\n\r\nconst toExtraErrors = (error: AxiosError): Errors => {\r\n const errors = error.errors;\r\n if (typeof errors === 'string') {\r\n return {\r\n __errors: [errors]\r\n };\r\n }\r\n return mapValues(errors, (e) => {\r\n return {\r\n __errors: [e]\r\n };\r\n });\r\n};\r\n\r\nconst widgets = {\r\n upload: function(props: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n const options = {\r\n ...props.options,\r\n async onUpload(file: File) {\r\n if (props.options.onUpload instanceof Function) {\r\n return await props.options.onUpload.call(file);\r\n }\r\n if (props.options.endpoint) {\r\n const data = new FormData();\r\n\r\n data.set('file', file);\r\n\r\n const { url } = await request({\r\n url: props.options.endpoint as string,\r\n method: 'post',\r\n data\r\n });\r\n\r\n return url;\r\n }\r\n }\r\n };\r\n\r\n return <widgets.upload {...props} options={options} />;\r\n }\r\n};\r\n\r\nexport interface FormType extends JsonFormType {\r\n\r\n}\r\n\r\ntype Form<T = any> = ForwardRefExoticComponent<PropsWithoutRef<FormProps<T>> & RefAttributes<FormType>>\r\n\r\nconst Form: Form = forwardRef(({\r\n action,\r\n method = 'post',\r\n onSuccess,\r\n formData,\r\n onSubmit,\r\n onChange,\r\n submitText = '提交',\r\n children,\r\n ...props\r\n}, ref) => {\r\n\r\n const [extraErrors, setExtraErrors] = useState<Errors>();\r\n const [loading, setLoading] = useState(false);\r\n const [data, setData] = useState(formData);\r\n\r\n const handleSubmit = useCallback(async (e: ISubmitEvent<any>, nativeEvent: React.FormEvent<HTMLFormElement>) => {\r\n try {\r\n setLoading(true);\r\n if (action) {\r\n const { formData } = e;\r\n //todo 包含File对象需转FormData\r\n try {\r\n const result = await request({\r\n url: action,\r\n method,\r\n data: formData\r\n });\r\n setExtraErrors(undefined);\r\n if (onSuccess) {\r\n await onSuccess(result);\r\n }\r\n } catch (e) {\r\n if (axios.isAxiosError(e)) {\r\n setExtraErrors(toExtraErrors(e));\r\n }\r\n\r\n throw e;\r\n }\r\n } else if (onSubmit) {\r\n await onSubmit(e, nativeEvent);\r\n }\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [action, method, onSubmit]);\r\n\r\n const handleChange = useCallback((e: ISubmitEvent<any>) => {\r\n const { formData } = e;\r\n setData(formData);\r\n if (onChange) {\r\n onChange(e);\r\n }\r\n }, [setData, onChange]);\r\n\r\n const transformErrors = useCallback((errors: AjvError[]) => {\r\n errors = errors.map(error => ({\r\n keyword: error.name,\r\n dataPath: error.property,\r\n ...error\r\n }));\r\n\r\n localize(errors);\r\n\r\n return errors;\r\n }, []);\r\n\r\n const submit = <LoadingButton loading={loading} type='submit' variant='primary'>{submitText}</LoadingButton>;\r\n\r\n if (typeof children === 'function') {\r\n children = children({ submit, loading });\r\n }\r\n\r\n return <JsonForm\r\n ref={ref}\r\n extraErrors={extraErrors}\r\n onSubmit={handleSubmit}\r\n transformErrors={transformErrors}\r\n noHtml5Validate\r\n noValidate\r\n {...props}\r\n formData={data}\r\n onChange={handleChange}\r\n widgets={widgets}\r\n >\r\n {children || <div className='col-12'>\r\n {submit}\r\n </div>}\r\n </JsonForm>;\r\n});\r\n\r\nexport default Form;\r\n","import styled from 'styled-components';\r\nimport { PropsWithChildren, ReactNode } from 'react';\r\n\r\ninterface ContentProps {\r\n title: string;\r\n extra?: ReactNode;\r\n}\r\n\r\nexport default function Content({ title, children, extra }: PropsWithChildren<ContentProps>) {\r\n\r\n\r\n return <Container>\r\n <Header>\r\n <div className='container'>\r\n <Title>\r\n {title}\r\n </Title>\r\n <Extra>{extra}</Extra>\r\n </div>\r\n </Header>\r\n <Body className='container'>\r\n {children}\r\n </Body>\r\n </Container>;\r\n};\r\n\r\nconst Container = styled.div`\r\n width: 100%;\r\n`;\r\n\r\nconst Header = styled.div`\r\n background-color: #fff;\r\n display: flex;\r\n\r\n .container {\r\n padding: 0 24px;\r\n display: flex;\r\n justify-content: space-between;\r\n align-items: center;\r\n }\r\n`;\r\n\r\nconst Body = styled.div`\r\n margin-top: 24px;\r\n`;\r\n\r\nconst Title = styled.div`\r\n font-size: 22px;\r\n line-height: 64px;\r\n height: 64px;\r\n`;\r\n\r\nconst Extra = styled.div`\r\n\r\n`;\r\n","import { useCallback, useEffect, useMemo, useState } from 'react';\r\nimport { Pagination as BsPagination } from 'react-bootstrap';\r\n\r\nfunction noop() {\r\n}\r\n\r\n\r\nfunction isInteger(value: any): value is number {\r\n return (\r\n typeof value === 'number' && isFinite(value) && Math.floor(value) === value\r\n );\r\n}\r\n\r\nexport interface PaginationProps {\r\n className?: string\r\n total: number\r\n current?: number\r\n defaultCurrent?: number\r\n pageSize?: number\r\n defaultPageSize?: number,\r\n onChange?: (current: number, pageSize: number) => void\r\n}\r\n\r\nexport default function Pagination({\r\n total = 0,\r\n onChange = noop,\r\n defaultCurrent = 1,\r\n defaultPageSize = 10,\r\n className,\r\n ...props\r\n}: PaginationProps) {\r\n\r\n const [current, setCurrent] = useState(defaultCurrent);\r\n const [pageSize, setPageSize] = useState(defaultPageSize);\r\n\r\n useEffect(() => {\r\n if (isInteger(props.current)) {\r\n setCurrent(props.current);\r\n }\r\n }, [props.current]);\r\n\r\n useEffect(() => {\r\n if (isInteger(props.pageSize)) {\r\n setPageSize(props.pageSize);\r\n }\r\n }, [props.pageSize]);\r\n\r\n const allPages = useMemo(() => {\r\n return Math.floor((total - 1) / pageSize) + 1;\r\n }, [total, pageSize]);\r\n\r\n const handleChange = useCallback((p: number) => {\r\n return () => {\r\n if (p !== current) {\r\n setCurrent(p);\r\n onChange(p, pageSize);\r\n }\r\n };\r\n }, [onChange, current, pageSize]);\r\n\r\n const pageBufferSize = 2;\r\n const prevPage = current - 1 > 0 ? current - 1 : 0;\r\n const nextPage = current + 1 < allPages ? current + 1 : allPages;\r\n\r\n const pagerList = [];\r\n let jumpPrev = null;\r\n let jumpNext = null;\r\n let firstPager = null;\r\n let lastPager = null;\r\n\r\n if (allPages <= 3 + pageBufferSize * 2) {\r\n for (let i = 1; i <= allPages; i += 1) {\r\n const active = current === i;\r\n pagerList.push(\r\n <BsPagination.Item key={i} active={active} onClick={handleChange(i)}>{i}</BsPagination.Item>\r\n );\r\n }\r\n } else {\r\n lastPager = <BsPagination.Last key='last' onClick={handleChange(allPages)} />;\r\n firstPager = <BsPagination.First key='first' onClick={handleChange(1)} />;\r\n jumpPrev = <BsPagination.Prev key='prev' onClick={handleChange(prevPage)} />;\r\n jumpNext = <BsPagination.Next key='next' onClick={handleChange(nextPage)} />;\r\n\r\n let left = Math.max(1, current - pageBufferSize);\r\n let right = Math.min(current + pageBufferSize, allPages);\r\n\r\n if (current - 1 <= pageBufferSize) {\r\n right = 1 + pageBufferSize * 2;\r\n }\r\n\r\n if (allPages - current <= pageBufferSize) {\r\n left = allPages - pageBufferSize * 2;\r\n }\r\n\r\n for (let i = left; i <= right; i += 1) {\r\n const active = current === i;\r\n pagerList.push(\r\n <BsPagination.Item key={i} active={active} onClick={handleChange(i)}>{i}</BsPagination.Item>\r\n );\r\n }\r\n\r\n if (current - 1 >= pageBufferSize * 2 && current !== 1 + 2) {\r\n pagerList.unshift(jumpPrev);\r\n }\r\n if (\r\n allPages - current >= pageBufferSize * 2 &&\r\n current !== allPages - 2\r\n ) {\r\n pagerList.push(jumpNext);\r\n }\r\n\r\n if (left !== 1) {\r\n pagerList.unshift(firstPager);\r\n }\r\n if (right !== allPages) {\r\n pagerList.push(lastPager);\r\n }\r\n }\r\n\r\n return <BsPagination className={className}>\r\n {pagerList}\r\n </BsPagination>;\r\n\r\n}\r\n","import { Columns, TableProps, TableRowSelection } from './index';\r\nimport { InputHTMLAttributes, Key, useCallback, useEffect, useRef, useState } from 'react';\r\n\r\nconst Checkbox = function({\r\n indeterminate = false,\r\n ...props\r\n}: InputHTMLAttributes<HTMLInputElement> & { indeterminate?: boolean }) {\r\n\r\n const ref = useRef<HTMLInputElement>(null);\r\n\r\n useEffect(() => {\r\n if (ref.current) {\r\n ref.current.indeterminate = indeterminate;\r\n }\r\n }, [indeterminate]);\r\n\r\n return <input\r\n ref={ref}\r\n {...props}\r\n className='form-check-input'\r\n type='checkbox'\r\n />;\r\n};\r\n\r\nexport default function useSelection<T = any>(\r\n rowSelection: TableRowSelection<T> | undefined,\r\n rowKey: Required<TableProps<T>>['rowKey'],\r\n data: T[]\r\n) {\r\n const [keys, setKeys] = useState(() => new Set(rowSelection?.selectedRowKeys || []));\r\n\r\n const getRowKey = (record: T) => {\r\n if (typeof rowKey === 'string') {\r\n // @ts-ignore\r\n return record[rowKey];\r\n } else {\r\n return rowKey(record);\r\n }\r\n };\r\n\r\n const getRecordByKey = (key: Key) => {\r\n return data.find((record) => {\r\n return getRowKey(record) === key;\r\n })!;\r\n };\r\n\r\n const setSelectedKeys = useCallback((keys: Set<Key>) => {\r\n setKeys(keys);\r\n const changedKeys = Array.from(keys);\r\n\r\n const records = changedKeys.map(function(key) {\r\n return getRecordByKey(key);\r\n });\r\n\r\n if (rowSelection?.onChange) {\r\n rowSelection?.onChange(changedKeys, records);\r\n }\r\n }, [getRecordByKey]);\r\n\r\n const transformColumns = useCallback((columns: Columns): Columns => {\r\n if (!rowSelection) {\r\n return columns;\r\n }\r\n\r\n const recordKeys = data.map(getRowKey);\r\n\r\n const checkedCurrentAll = recordKeys.every(function(key) {\r\n return keys.has(key);\r\n });\r\n const checkedCurrentSome = recordKeys.some(function(key) {\r\n return keys.has(key);\r\n });\r\n\r\n return [{\r\n key: 'selection',\r\n title: <Checkbox\r\n checked={checkedCurrentAll}\r\n indeterminate={!checkedCurrentAll && checkedCurrentSome}\r\n onChange={() => {\r\n if (checkedCurrentAll) {\r\n recordKeys.forEach(function(key) {\r\n keys.delete(key);\r\n });\r\n } else {\r\n recordKeys.forEach(function(key) {\r\n keys.add(key);\r\n });\r\n }\r\n setSelectedKeys(new Set(keys));\r\n }}\r\n />,\r\n width: 30,\r\n align: 'center',\r\n render({ record }) {\r\n const key = getRowKey(record);\r\n const checked = keys.has(key);\r\n return <Checkbox\r\n checked={checked}\r\n onChange={() => {\r\n if (checked) {\r\n keys.delete(key);\r\n } else {\r\n keys.add(key);\r\n }\r\n setSelectedKeys(new Set(keys));\r\n }}\r\n />;\r\n }\r\n }, ...columns];\r\n }, [data, rowSelection, keys]);\r\n\r\n return [transformColumns];\r\n}\r\n","import RcTable from 'rc-table';\r\nimport { TableProps as RcTableProps } from 'rc-table/lib/Table';\r\nimport { ColumnGroupType, ColumnsType, ColumnType as BsColumnType, RenderedCell } from 'rc-table/lib/interface';\r\nimport { Form, Table as BsTable, TableProps as BsTableProps } from 'react-bootstrap';\r\nimport {\r\n ChangeEvent,\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n Key,\r\n PropsWithChildren,\r\n PropsWithoutRef,\r\n ReactNode,\r\n RefAttributes,\r\n useCallback,\r\n useEffect,\r\n useImperativeHandle,\r\n useMemo,\r\n useRef,\r\n useState\r\n} from 'react';\r\nimport Pagination from '../pagination';\r\nimport styled from 'styled-components';\r\nimport request from '../../request';\r\nimport Card from '../card';\r\nimport Loader from '../loader';\r\nimport Space from '../space';\r\nimport useDebounce from '../../hooks/use-debounce';\r\nimport useSelection from './use-selection';\r\nimport { PaginationType } from '../../utils/types';\r\n\r\nexport interface TableType {\r\n reload: () => void;\r\n}\r\n\r\ninterface ColumnType<RecordType> extends Omit<BsColumnType<RecordType>, 'render'> {\r\n render?: (data: { value: any, record: RecordType, index: number, action: TableType }) => ReactNode | RenderedCell<RecordType>;\r\n}\r\n\r\nexport type Columns<RecordType = any> = (ColumnGroupType<RecordType> | ColumnType<RecordType>)[]\r\n\r\nconst CustomTable = styled(BsTable)`\r\n .rc-table-thead {\r\n border-top: none;\r\n }\r\n`;\r\n\r\nconst components: RcTableProps['components'] = {\r\n table: (props: BsTableProps) => {\r\n return <CustomTable {...props} className='align-middle table-hover' />;\r\n },\r\n};\r\n\r\n\r\nconst CustomPagination = styled(Pagination)`\r\n margin-bottom: 0;\r\n justify-content: flex-end;\r\n`;\r\n\r\nfunction isPagination<T>(data: any): data is PaginationType<T> {\r\n return 'current_page' in data;\r\n}\r\n\r\nexport interface TableRowSelection<RecordType = any> {\r\n selectedRowKeys?: Key[];\r\n onChange?: (selectedRowKeys: Key[], selectedRows: RecordType[]) => void;\r\n}\r\n\r\nexport interface TableProps<RecordType = any> extends Omit<RcTableProps<RecordType>, 'children' | 'columns'> {\r\n source: string | (() => Promise<any>);\r\n paginate?: boolean;\r\n columns: Columns<RecordType>;\r\n toolBarRender?: ((action: TableType) => ReactNode) | false;\r\n search?: boolean | string;\r\n rowSelection?: TableRowSelection<RecordType>;\r\n card?: boolean;\r\n}\r\n\r\ntype Params = {\r\n page?: number;\r\n sortField?: string;\r\n sortOrder?: number;\r\n q?: string;\r\n [key: string]: any;\r\n};\r\n\r\ntype CustomTableType<T = any> = ForwardRefExoticComponent<PropsWithoutRef<PropsWithChildren<TableProps<T>>>\r\n & RefAttributes<TableType>>\r\n\r\nconst Table: CustomTableType = forwardRef((\r\n {\r\n source,\r\n rowKey = 'id',\r\n paginate = true,\r\n toolBarRender,\r\n columns = [],\r\n search,\r\n rowSelection,\r\n card = true,\r\n ...props\r\n },\r\n ref\r\n) => {\r\n const [data, setData] = useState<any[]>([]);\r\n const [pagination, setPagination] = useState(paginate ? { total: 0, current: 1, pageSize: 10 } : null);\r\n const [loading, setLoading] = useState(true);\r\n const [keyword, setKeyword] = useState('');\r\n\r\n const fetchData = useCallback(async (options: Params = {}) => {\r\n setLoading(true);\r\n try {\r\n let result;\r\n if (typeof source === 'string') {\r\n const params: Params = {\r\n q: keyword\r\n };\r\n if (pagination) {\r\n params.page = options.page || pagination.current;\r\n }\r\n result = await request({\r\n url: source,\r\n params,\r\n });\r\n } else {\r\n result = await source();\r\n }\r\n\r\n if (paginate && isPagination<any>(result)) {\r\n setPagination({\r\n total: result.total,\r\n current: result.current_page,\r\n pageSize: result.per_page\r\n });\r\n result = result.data;\r\n }\r\n setData(result);\r\n } catch (e) {\r\n\r\n } finally {\r\n setLoading(false);\r\n }\r\n }, [source, setData, pagination, keyword]);\r\n\r\n useEffect(() => {\r\n fetchData();\r\n }, [keyword]);\r\n\r\n const action = useRef<TableType>({\r\n reload: fetchData\r\n });\r\n\r\n useEffect(() => {\r\n action.current = {\r\n reload: fetchData\r\n };\r\n }, [fetchData]);\r\n\r\n useImperativeHandle(ref, () => action.current);\r\n\r\n //多选\r\n const [transformColumns] = useSelection(rowSelection, rowKey, data);\r\n\r\n const customColumns = useMemo(() => {\r\n return transformColumns(columns).map((column) => {\r\n const customColumn: BsColumnType<any> = { ...column, render: undefined };\r\n\r\n if ('render' in column && column.render) {\r\n const defaultRender = column.render;\r\n customColumn.render = (value, record, index) => {\r\n return defaultRender({ value, record, index, action: action.current });\r\n };\r\n }\r\n return customColumn;\r\n }) as ColumnsType<any>;\r\n }, [columns, transformColumns, action]);\r\n\r\n const handlePageChange = (current: number) => {\r\n fetchData({\r\n page: current\r\n });\r\n };\r\n\r\n const handleSearch = useDebounce((e: ChangeEvent<HTMLInputElement>) => {\r\n setKeyword(e.target.value);\r\n }, 500);\r\n\r\n const children = <>\r\n <Loader loading={loading} />\r\n {toolBarRender !== false && <Header>\r\n <LeftTools size={12}>\r\n {toolBarRender && toolBarRender(action.current)}\r\n </LeftTools>\r\n <RightTools size={12}>\r\n {search &&\r\n <Form.Control onChange={handleSearch} type={'search'} placeholder={'Search...'} />}\r\n <Action onClick={action.current.reload}><i className='bi bi-arrow-repeat' /></Action>\r\n </RightTools>\r\n </Header>}\r\n <RcTable {...props} rowKey={rowKey} columns={customColumns} components={components} data={data} />\r\n {pagination && <CustomPagination {...pagination} onChange={handlePageChange} />}\r\n </>;\r\n\r\n if (card) {\r\n return <Card>\r\n {children}\r\n </Card>;\r\n }\r\n return children;\r\n});\r\n\r\nexport default Table;\r\n\r\nconst Header = styled.div`\r\n display: flex;\r\n justify-content: space-between;\r\n padding-bottom: 1rem;\r\n height: 48px;\r\n`;\r\n\r\nconst RightTools = styled(Space)`\r\n\r\n`;\r\nconst LeftTools = styled(Space)`\r\n\r\n`;\r\n\r\nconst Action = styled.span`\r\n cursor: pointer;\r\n font-size: 20px;\r\n line-height: 1;\r\n\r\n &:hover {\r\n color: var(--bs-primary);\r\n }\r\n`;\r\n","import { debounce, DebouncedFunc } from 'lodash';\r\nimport { useEffect, useRef } from 'react';\r\n\r\nexport default function useDebounce<T extends (...args: any) => any>(callback: T, wait: number, options?: {}): DebouncedFunc<T> {\r\n const callbackRef = useRef<T>(callback);\r\n const debouncedCallbackRef = useRef<DebouncedFunc<T>>(\r\n debounce(callback, wait, options)\r\n );\r\n\r\n useEffect(() => {\r\n callbackRef.current = callback;\r\n });\r\n\r\n useEffect(() => {\r\n debouncedCallbackRef.current = debounce((...args: any) => {\r\n callbackRef.current(...args);\r\n }, wait, options);\r\n }, [wait, options]);\r\n\r\n return debouncedCallbackRef.current;\r\n}\r\n","import {\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n PropsWithChildren,\r\n PropsWithoutRef,\r\n RefAttributes,\r\n useImperativeHandle,\r\n useState\r\n} from 'react';\r\nimport { Button, ButtonProps, Modal, ModalProps } from 'react-bootstrap';\r\nimport LoadingButton from './loading-button';\r\n\r\nexport interface ModalButtonProps extends ModalProps {\r\n text: string;\r\n variant?: ButtonProps['variant'];\r\n header?: string;\r\n onOk?: () => any;\r\n footer?: boolean;\r\n}\r\n\r\nexport interface ModalType {\r\n close: () => void;\r\n}\r\n\r\ntype ModalButtonType = ForwardRefExoticComponent<PropsWithoutRef<PropsWithChildren<ModalButtonProps>>\r\n & RefAttributes<ModalType>>\r\n\r\nconst ModalButton: ModalButtonType = forwardRef(({\r\n text,\r\n variant = 'primary',\r\n header = text,\r\n footer = true,\r\n onOk,\r\n size,\r\n onShow,\r\n children\r\n}, ref) => {\r\n\r\n const [show, setShow] = useState(false);\r\n const [loading, setLoading] = useState(false);\r\n const handleClose = () => setShow(false);\r\n const handleShow = () => setShow(true);\r\n\r\n useImperativeHandle(ref, () => ({\r\n close: handleClose\r\n }));\r\n\r\n const handleOk = async () => {\r\n if (onOk) {\r\n setLoading(true);\r\n const result = await onOk();\r\n setLoading(false);\r\n if (result === false) {\r\n return;\r\n }\r\n }\r\n handleClose();\r\n };\r\n\r\n return <>\r\n <Button variant={variant} onClick={handleShow}>{text}</Button>\r\n <Modal size={size} show={show} onHide={handleClose} onShow={onShow}>\r\n {header && <Modal.Header closeButton>\r\n <Modal.Title as='h5'>{header}</Modal.Title>\r\n </Modal.Header>}\r\n <Modal.Body>{children}</Modal.Body>\r\n {footer && <Modal.Footer>\r\n <Button variant='secondary' onClick={handleClose}>\r\n 取消\r\n </Button>\r\n <LoadingButton loading={loading} variant='primary' onClick={handleOk}>\r\n 确定\r\n </LoadingButton>\r\n </Modal.Footer>}\r\n </Modal>\r\n </>;\r\n});\r\n\r\nexport default ModalButton;\r\n","import ModalButton, { ModalButtonProps, ModalType } from './modal-button';\r\nimport { Fragment, useCallback, useRef } from 'react';\r\nimport Form, { FormProps, FormType } from './form';\r\n\r\nexport type ModalFormProps<T = any> =\r\n Pick<ModalButtonProps, 'text' | 'variant' | 'header' | 'size'> &\r\n Pick<FormProps<T>, 'schema' | 'formData' | 'uiSchema' | 'action' | 'method' | 'onSuccess' | 'onChange' | 'fields' | 'formContext'>\r\n\r\nexport default function ModalForm<T = any>({\r\n text,\r\n header,\r\n schema,\r\n uiSchema,\r\n action,\r\n method,\r\n formData,\r\n variant,\r\n onSuccess,\r\n onChange,\r\n fields,\r\n size\r\n}: ModalFormProps<T>) {\r\n\r\n const form = useRef<FormType>(null);\r\n const modal = useRef<ModalType>(null);\r\n\r\n const handleOk = useCallback(async () => {\r\n try {\r\n await form.current?.submit();\r\n return true;\r\n } catch {\r\n return false;\r\n }\r\n }, []);\r\n\r\n return <ModalButton ref={modal} text={text} onOk={handleOk} header={header} variant={variant} size={size}>\r\n <Form\r\n ref={form}\r\n schema={schema}\r\n uiSchema={uiSchema}\r\n action={action}\r\n method={method}\r\n formData={formData}\r\n fields={fields}\r\n onChange={onChange}\r\n onSuccess={onSuccess}\r\n >\r\n <Fragment />\r\n </Form>\r\n </ModalButton>;\r\n}\r\n","import { useAsyncCallback, UseAsyncCallbackOptions } from 'react-async-hook';\r\nimport request, { isRequestError, RequestConfig } from '../request';\r\nimport { DependencyList, useCallback, useEffect } from 'react';\r\nimport { AxiosRequestConfig } from 'axios';\r\nimport { values } from 'lodash';\r\n\r\ntype UseRequestOptions<T> = {\r\n manual?: boolean\r\n refreshDeps?: DependencyList;\r\n} & UseAsyncCallbackOptions<T>;\r\n\r\nexport default function useRequest<T = any>(config: RequestConfig, {\r\n manual,\r\n refreshDeps,\r\n ...options\r\n}: UseRequestOptions<T> = {}) {\r\n let { execute, currentParams, error, ...others } = useAsyncCallback(async (params?: AxiosRequestConfig) => {\r\n\r\n config = typeof config === 'string' ? { url: config } : config;\r\n\r\n return await request<T>({\r\n ...config,\r\n ...params\r\n });\r\n }, options);\r\n\r\n useEffect(() => {\r\n if (!manual && !refreshDeps) {\r\n execute();\r\n }\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (refreshDeps) {\r\n refresh();\r\n }\r\n }, refreshDeps);\r\n\r\n const refresh = useCallback(() => {\r\n if (currentParams) {\r\n execute(...currentParams);\r\n } else {\r\n execute();\r\n }\r\n }, [execute, currentParams]);\r\n\r\n if (error && isRequestError(error)) {\r\n const errors = error.errors;\r\n error = new Error(typeof errors === 'string' ? errors : values(errors).join(''));\r\n }\r\n\r\n return {\r\n refresh,\r\n execute,\r\n error,\r\n ...others\r\n };\r\n}\r\n","import { useCallback, useState } from 'react';\r\n\r\ninterface Options {\r\n onHide?: () => void;\r\n onShow?: () => void;\r\n}\r\n\r\nlet id = 0;\r\n\r\nexport default function useOverlayState({ onHide, onShow }: Options = {}) {\r\n const [visible, setVisible] = useState(false);\r\n\r\n const [key, setKey] = useState(`visible-${id}`);\r\n\r\n const hide = useCallback(() => {\r\n setVisible(false);\r\n if (onHide) {\r\n onHide();\r\n }\r\n }, [setVisible, onHide]);\r\n\r\n const exit = useCallback(() => {\r\n setKey(`visible-${++id}`);\r\n }, [setKey, id]);\r\n\r\n const show = useCallback(() => {\r\n setVisible(true);\r\n if (onShow) {\r\n onShow();\r\n }\r\n }, [setVisible, onShow]);\r\n\r\n const state = {\r\n show: visible,\r\n onHide: hide,\r\n onExited: exit,\r\n key\r\n };\r\n\r\n return {\r\n visible,\r\n show,\r\n hide,\r\n state\r\n };\r\n}\r\n","import { OverlayTrigger, OverlayTriggerProps, Tooltip as BsTooltip } from 'react-bootstrap';\r\nimport { uniqueId } from 'lodash';\r\n\r\ninterface TooltipProps {\r\n tooltip: string;\r\n children: OverlayTriggerProps['children'];\r\n placement?: OverlayTriggerProps['placement'];\r\n}\r\n\r\nexport default function Tooltip({ tooltip, children, placement = 'bottom' }: TooltipProps) {\r\n\r\n return <OverlayTrigger\r\n placement={placement}\r\n overlay={\r\n <BsTooltip id={uniqueId()}>\r\n {tooltip}\r\n </BsTooltip>\r\n }\r\n >\r\n {children}\r\n </OverlayTrigger>;\r\n}\r\n"],"names":["_taggedTemplateLiteral","strings","raw","slice","Object","freeze","defineProperties","value","FooterWrapper","styled","footer","Footer","_jsx","className","formatRelativePath","routes","parent","menus","route","meta","_route$meta","hideInMenu","title","_route$meta2","path","replace","menu","children","_route$meta3","hideChildrenInMenu","length","push","renderMenuItems","items","map","item","SubMenu","MenuItem","Link","to","collapseNode","height","expandNode","node","scrollHeight","motion","motionName","motionAppear","onAppearStart","onAppearActive","onEnterStart","onEnterActive","onLeaveStart","onLeaveActive","SiderLayout","basename","useRoutes","useMemo","getMenuData","pathname","useLocation","selectedKeys","keys","split","reduce","pre","curr","join","openKeys","setOpenKeys","useState","useEffect","_jsxs","Container","Sidebar","Header","Menu","mode","onOpenChange","currentKey","filter","key","startsWith","Content","Main","div","nav","main","RcMenu","CustomSwal","withReactContent","Swal","defaultOptions","confirmButtonText","cancelButtonText","Message","confirm","async","isConfirmed","fire","icon","showCancelButton","options","error","toast","position","timer","showConfirmButton","Icon","Title","Extra","IconMap","success","info","warning","Result","status","extra","Dimmer","props","active","inverted","Loader","loading","variant","animation","wrap","Spinner","Wrap","UserContext","React","createContext","UserProvider","user","state","setState","Provider","useUser","setUser","useContext","Error","Avatar","a","href","src","Dropdown","navbar","Toggle","as","width","avatar","header","rax","attach","axios","defaults","raxConfig","retryDelay","backoffType","shouldRetry","err","config","method","toUpperCase","response","maxContentLength","Infinity","maxBodyLength","baseURL","interceptors","request","use","token","sessionStorage","getItem","headers","Authorization","Promise","reject","isRecord","data","location","window","undefined","e","isAxiosError","url","setItem","search","redirectUri","origin","queryString","stringifyUrl","query","redirect_uri","errors","isRequestError","paramsSerializer","params","stringify","sort","skipNull","skipEmptyString","Login","parsed","parse","hash","substr","access_token","removeItem","Navigate","Logout","catch","Root","BrowserRouter","Routes","Route","element","Card","BsCard","classNames","Alert","entries","_ref2","name","Access","require","fallback","passed","intersection","roles","Space","size","small","middle","large","Children","child","Item","_path","_extends","assign","target","i","arguments","source","prototype","hasOwnProperty","call","apply","this","SvgStepCheck","createElement","viewBox","xmlns","fill","d","Steps","CustomRcSteps","icons","finish","CheckIcon","Step","RcSteps","NumberFormat","locale","currency","formatter","style","minimumFractionDigits","Intl","format","LoadingButton","Button","disabled","RequestButton","onSuccess","fetching","setFetching","handleClick","useCallback","preventDefault","text","result","values","onClick","LinkButton","navigate","useNavigate","localize","widgets","upload","getRegistry","file","onUpload","Function","endpoint","FormData","set","Form","forwardRef","ref","action","formData","onSubmit","onChange","submitText","extraErrors","setExtraErrors","setLoading","setData","handleSubmit","nativeEvent","__errors","mapValues","toExtraErrors","handleChange","transformErrors","keyword","dataPath","property","submit","type","JsonForm","noHtml5Validate","noValidate","Body","noop","isInteger","isFinite","Math","floor","Checkbox","indeterminate","useRef","current","CustomTable","BsTable","components","table","CustomPagination","total","defaultCurrent","defaultPageSize","setCurrent","pageSize","setPageSize","allPages","p","prevPage","nextPage","pagerList","jumpPrev","jumpNext","firstPager","lastPager","BsPagination","Last","First","Prev","Next","left","max","right","min","pageBufferSize","unshift","isPagination","Table","rowKey","paginate","toolBarRender","columns","rowSelection","card","pagination","setPagination","setKeyword","fetchData","q","page","current_page","per_page","reload","useImperativeHandle","transformColumns","setKeys","Set","selectedRowKeys","getRowKey","record","getRecordByKey","find","setSelectedKeys","changedKeys","Array","from","records","recordKeys","checkedCurrentAll","every","has","checkedCurrentSome","some","checked","forEach","delete","add","align","render","useSelection","customColumns","column","customColumn","defaultRender","index","handleSearch","callback","wait","callbackRef","debouncedCallbackRef","debounce","useDebounce","LeftTools","RightTools","Control","placeholder","Action","RcTable","span","ModalButton","onOk","onShow","show","setShow","handleClose","close","Modal","onHide","closeButton","ModalForm","schema","uiSchema","fields","form","modal","handleOk","_form$current","Fragment","useRequest","manual","refreshDeps","execute","currentParams","others","useAsyncCallback","refresh","id","useOverlayState","visible","setVisible","setKey","hide","exit","onExited","Tooltip","tooltip","placement","OverlayTrigger","overlay","BsTooltip","uniqueId"],"mappings":"uqCAAe,SAASA,GAAuBC,EAASC,UACjDA,IACHA,EAAMD,EAAQE,MAAM,IAGfC,OAAOC,OAAOD,OAAOE,iBAAiBL,EAAS,CACpDC,IAAK,CACHK,MAAOH,OAAOC,OAAOH,cCL3B,MAAMM,GAAgBC,EAAOC,uCAKLC,YACbC,EAACJ,aACJI,SAAKC,UAAU,gBCDvB,MAAMC,GAAqB,SACvBC,OACAC,yDAAiB,UAGXC,EAAoB,OAErB,MAAMC,KAASH,EAAQ,wBAEpBG,EAAMC,mBAANC,EAAYC,0BAIVC,YAAQJ,EAAMC,yB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ACAD,KAAWC,GAEXD,MAEL,CAACA,EAASC,OAET9V,GAAS6F,GAAe7F,GAAQ,OAC1B4F,EAAS5F,EAAM4F,OACrB5F,EAAQ,IAAIqC,MAAwB,iBAAXuD,EAAsBA,EAASyF,EAAOzF,GAAQhI,KAAK,WAGzE,CACHqY,QAAAA,EACAJ,QAAAA,EACA7V,MAAAA,KACG+V,GChDX,IAAIG,GAAK,WAEeC,SAAgBpB,OAAEA,EAAFN,OAAUA,0DAAoB,SAC3D2B,EAASC,GAActY,GAAS,IAEhCW,EAAK4X,GAAUvY,oBAAoBmY,KAEpCK,EAAOtL,GAAY,KACrBoL,GAAW,GACPtB,GACAA,MAEL,CAACsB,EAAYtB,IAEVyB,EAAOvL,GAAY,KACrBqL,sBAAoBJ,OACrB,CAACI,EAAQJ,KAENxB,EAAOzJ,GAAY,KACrBoL,GAAW,GACP5B,GACAA,MAEL,CAAC4B,EAAY5B,IAEV1S,EAAQ,CACV2S,KAAM0B,EACNrB,OAAQwB,EACRE,SAAUD,EACV9X,IAAAA,SAGG,CACH0X,QAAAA,EACA1B,KAAAA,EACA6B,KAAAA,EACAxU,MAAAA,YClCgB2U,UAAQC,QAAEA,EAAFvb,SAAWA,EAAXwb,UAAqBA,EAAY,mBAEtDvc,EAACwc,GACJD,UAAWA,EACXE,QACIzc,EAAC0c,GAAUb,GAAIc,aACVL,aAIRvb"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topthink/common",
3
- "version": "1.0.26",
3
+ "version": "1.0.29",
4
4
  "scripts": {
5
5
  "build": "rollup -c --environment NODE_ENV:production",
6
6
  "build:dev": "rollup -c",
@@ -15,7 +15,7 @@
15
15
  "scss"
16
16
  ],
17
17
  "dependencies": {
18
- "@topthink/bootstrap": "^1.0.9",
18
+ "@topthink/bootstrap": "^1.0.10",
19
19
  "@topthink/json-form": "^1.0.8",
20
20
  "@types/lodash": "^4.14.161",
21
21
  "ajv-i18n": "^4.0.0",
@@ -66,5 +66,5 @@
66
66
  },
67
67
  "author": "yunwuxin <tzzhangyajun@qq.com> (https://github.com/yunwuxin)",
68
68
  "license": "MIT",
69
- "gitHead": "ae9c1fdcdde06cc593f1a2f8bc6e96593e69a269"
69
+ "gitHead": "503ab9cf4303e43faada5c2aedf4d3db99b89db5"
70
70
  }
@@ -14,4 +14,5 @@ export interface User {
14
14
  is_certified: boolean;
15
15
  is_enterprise: boolean;
16
16
  roles: [];
17
+ [key: string]: any;
17
18
  }