@topthink/components 1.0.17 → 1.0.19
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 +18 -18
- package/lib/index.js.map +1 -1
- package/package.json +5 -4
- package/types/components/table/index.d.ts +2 -1
- package/types/components/table/search.d.ts +7 -0
- package/types/hooks/use-callback-ref.d.ts +2 -0
- package/types/hooks/use-controllable-state.d.ts +8 -0
- package/types/index.d.ts +2 -0
package/lib/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import e from"sweetalert2/dist/sweetalert2.js";import t from"sweetalert2-react-content";import{jsx as r,jsxs as n,Fragment as o}from"react/jsx-runtime";import{Alert as i,Spinner as a,Card as c,Pagination as s,Button as l,Form as d,Table as u,Modal as h,OverlayTrigger as m,Tooltip as p}from"react-bootstrap";import f from"rc-notification";import g,{css as y}from"styled-components";export{createGlobalStyle,css,keyframes,default as styled}from"styled-components";import
|
|
1
|
+
import e from"sweetalert2/dist/sweetalert2.js";import t from"sweetalert2-react-content";import{jsx as r,jsxs as n,Fragment as o}from"react/jsx-runtime";import{Alert as i,Spinner as a,Card as c,Pagination as s,Button as l,Form as d,Table as u,Modal as h,OverlayTrigger as m,Tooltip as p}from"react-bootstrap";import f from"rc-notification";import g,{css as y}from"styled-components";export{createGlobalStyle,css,keyframes,default as styled}from"styled-components";import v from"classnames";import*as b from"react";import{Children as w,useState as x,useEffect as C,useMemo as k,useCallback as z,createElement as S,forwardRef as N,useRef as j,useImperativeHandle as E}from"react";import B from"rc-steps";import"rc-steps/assets/index.css";import O from"axios";import $ from"query-string";import*as D from"retry-axios";import V from"@babel/runtime/helpers/defineProperty";import H,{getRegistry as P}from"@topthink/json-form";import{mapValues as T,debounce as A,uniqueId as F,values as M}from"lodash";import U from"rc-table";import{unstable_batchedUpdates as q}from"react-dom";import{useUrlSearchParams as L}from"use-url-search-params";import{useAsyncCallback as _}from"react-async-hook";export{useAsync,useAsyncCallback}from"react-async-hook";const I=t(e),K={confirmButtonText:"确定",cancelButtonText:"取消"},R={confirm:async e=>{const{isConfirmed:t}=await I.fire({...K,icon:"warning",showCancelButton:!0,...e,async preConfirm(t){if(e.preConfirm)try{return await e.preConfirm(t)}catch(e){return e instanceof Error&&I.showValidationMessage(e.message),!1}return!0}});return t},success:e=>{I.fire({...K,toast:!0,position:"top",icon:"success",timer:2e3,showConfirmButton:!1,...e})},error:e=>{I.fire({...K,toast:!0,position:"top",icon:"error",timer:5e3,showConfirmButton:!1,...e})},close:e=>{I.close(e)}};let G;const Y=e=>{let{type:t,...n}=e;!function(e){if(G)return e(G);f.newInstance({prefixCls:"notification",maxCount:5,style:{top:20,right:20}},(t=>{G?e(G):(G=t,e(t))}))}((e=>{n.duration=3;let o=t;if("error"===t)o="danger",n.duration=n.closable?0:5;n.content=r(i,{variant:o,children:n.content}),e.notice(n)}))};let J={};["error","success","info"].forEach((e=>{J[e]=(t,r)=>{Y({...r,type:e,content:t})}}));const Q=g.div`
|
|
2
2
|
padding: 48px 32px;
|
|
3
|
-
`,
|
|
3
|
+
`,W=g.div`
|
|
4
4
|
margin-bottom: 24px;
|
|
5
5
|
text-align: center;
|
|
6
6
|
font-size: 72px;
|
|
7
|
-
`,
|
|
7
|
+
`,X=g.div`
|
|
8
8
|
color: rgba(0, 0, 0, .85);
|
|
9
9
|
font-size: 24px;
|
|
10
10
|
line-height: 1.8;
|
|
11
11
|
text-align: center;
|
|
12
|
-
`,
|
|
12
|
+
`,Z=g.div`
|
|
13
13
|
margin-top: 32px;
|
|
14
14
|
text-align: center;
|
|
15
|
-
`,
|
|
15
|
+
`,ee={success:r("i",{className:"bi bi-check-circle-fill text-success"}),error:r("i",{className:"bi bi-exclamation-circle-fill text-danger"}),info:r("i",{className:"bi bi-info-circle-fill text-info"}),warning:r("i",{className:"bi bi-exclamation-triangle-fill text-warning"})};function te(e){let{status:t,title:o,icon:i,extra:a}=e;return!i&&t&&(i=ee[t]),n(Q,{children:[i&&r(W,{children:i}),o&&r(X,{children:o}),a&&r(Z,{children:a})]})}g.div`
|
|
16
16
|
position: relative;
|
|
17
|
-
`;const
|
|
17
|
+
`;const re=g.div`
|
|
18
18
|
display: ${e=>e.active?"flex":"none"};
|
|
19
19
|
position: absolute;
|
|
20
20
|
top: 0 !important;
|
|
@@ -36,10 +36,10 @@ import e from"sweetalert2/dist/sweetalert2.js";import t from"sweetalert2-react-c
|
|
|
36
36
|
user-select: none;
|
|
37
37
|
will-change: opacity;
|
|
38
38
|
z-index: 990;
|
|
39
|
-
`;function
|
|
39
|
+
`;function ne(e){let{loading:t=!0,children:o,variant:i="primary",animation:c="border",wrap:s,...l}=e;return t?(o&&(o=r("p",{className:"mt-3 text-secondary",children:o})),o=n(re,{inverted:!0,active:!0,children:[r(a,{animation:c,variant:i,...l}),o]}),s?r(oe,{$height:"number"==typeof s?s:150,children:o}):o):null}const oe=g.div`
|
|
40
40
|
position: relative;
|
|
41
41
|
height: ${e=>`${e.$height}px`};
|
|
42
|
-
`;function
|
|
42
|
+
`;function ie(e){let{children:t,title:i,className:a,...s}=e;return r(c,{className:v("border-0 shadow-sm mb-3",a),...s,children:n("div",{className:"card-body",children:[i&&n(o,{children:[r("h5",{children:i}),r("hr",{})]}),t]})})}function ae(e){let{errors:t}=e;return t?r(i,{variant:"danger",children:r("ul",{className:"mb-0",children:"string"==typeof t?r("li",{children:t}):Object.entries(t).map((e=>{let[t,n]=e;return r("li",{children:n},t)}))})}):null}function ce(e){let{children:t,className:n,size:o="small",direction:i="horizontal"}=e;"string"==typeof o&&(o={small:8,middle:16,large:24}[o]);const a=w.map(t,(e=>{if(e)return r(le,{children:e})}));return r(se,{className:n,$direction:i,$size:o,children:a})}const se=g.div`
|
|
43
43
|
display: inline-flex;
|
|
44
44
|
align-items: center;
|
|
45
45
|
gap: ${e=>e.$size}px;
|
|
@@ -49,9 +49,9 @@ import e from"sweetalert2/dist/sweetalert2.js";import t from"sweetalert2-react-c
|
|
|
49
49
|
flex-direction: column;
|
|
50
50
|
align-items: inherit;
|
|
51
51
|
`}
|
|
52
|
-
`,
|
|
52
|
+
`,le=g.div`
|
|
53
53
|
|
|
54
|
-
`;var
|
|
54
|
+
`;var de;function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ue.apply(this,arguments)}const he=e=>b.createElement("svg",ue({viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor"},e),de||(de=b.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"})));function me(e){return r(pe,{icons:{finish:r(he,{}),error:r(o,{})},...e})}me.Step=B.Step;const pe=g(B)`
|
|
55
55
|
.rc-steps-item-icon {
|
|
56
56
|
display: inline-flex;
|
|
57
57
|
align-items: center;
|
|
@@ -83,13 +83,13 @@ import e from"sweetalert2/dist/sweetalert2.js";import t from"sweetalert2-react-c
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
`;function
|
|
86
|
+
`;function fe(){}function ge(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function ye(e){let{total:t=0,onChange:n=fe,defaultCurrent:o=1,defaultPageSize:i=10,className:a,...c}=e;const[l,d]=x(o),[u,h]=x(i);C((()=>{ge(c.current)&&d(c.current)}),[c.current]),C((()=>{ge(c.pageSize)&&h(c.pageSize)}),[c.pageSize]);const m=k((()=>Math.floor((t-1)/u)+1),[t,u]),p=z((e=>()=>{e!==l&&(d(e),n(e,u))}),[n,l,u]),f=l-1>0?l-1:0,g=l+1<m?l+1:m,y=[];let v=null,b=null,w=null,S=null;if(m<=7)for(let e=1;e<=m;e+=1){const t=l===e;y.push(r(s.Item,{active:t,onClick:p(e),children:e},e))}else{S=r(s.Last,{onClick:p(m)},"last"),w=r(s.First,{onClick:p(1)},"first"),v=r(s.Prev,{onClick:p(f)},"prev"),b=r(s.Next,{onClick:p(g)},"next");let e=Math.max(1,l-2),t=Math.min(l+2,m);l-1<=2&&(t=5),m-l<=2&&(e=m-4);for(let n=e;n<=t;n+=1){const e=l===n;y.push(r(s.Item,{active:e,onClick:p(n),children:n},n))}l-1>=4&&3!==l&&y.unshift(v),m-l>=4&&l!==m-2&&y.push(b),1!==e&&y.unshift(w),t!==m&&y.push(S)}return r(s,{className:a,children:y})}function ve(e){let{className:t,value:n,locale:i="zh-CN",currency:a=!0,options:c={}}=e;const s=k((()=>{let e;return e=a?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2},new Intl.NumberFormat(i,{...e,...c})}),[a,i,c]);return t?r("span",{className:t,children:s.format(n)}):r(o,{children:s.format(n)})}function be(e){let{loading:t,disabled:n,children:o,...i}=e;return r(l,{...i,disabled:t||n,children:t?"Loading…":o})}class we extends Error{constructor(e){super("Unauthorized"),V(this,"url",void 0),this.url=e}}D.attach(),O.defaults.raxConfig={retryDelay:2e3,backoffType:"static",shouldRetry:e=>{var t,r;let{config:n,response:o}=e;return!(null!==(t=n.raxConfig)&&void 0!==t&&t.retryDecider&&!n.raxConfig.retryDecider())&&("GET"===(null===(r=n.method)||void 0===r?void 0:r.toUpperCase())&&449===(null==o?void 0:o.status))}},O.defaults.maxContentLength=1/0,O.defaults.maxBodyLength=1/0,O.defaults.baseURL="/api",O.interceptors.request.use((e=>{const t=localStorage.getItem("authorization");return t&&(e.headers={...e.headers,Authorization:`Bearer ${t}`}),e}),(e=>Promise.reject(e)));const xe=e=>e&&"object"==typeof e;O.interceptors.response.use((e=>(201===e.status&&e.data.location&&(window.location.href=e.data.location,e.data=void 0),e)),(e=>{if(O.isAxiosError(e)&&e.response){const{data:t,status:r}=e.response;401===r?(e.errors="Unauthorized",xe(t)&&t.url&&(e=new we(t.url)),J.error("Unauthorized")):xe(t)?422===r?e.errors=t:"message"in t&&(e.errors=t.message):e.errors=t}return Promise.reject(e)}));const Ce=O.isAxiosError,ke=e=>{if(!O.isAxiosError(e))throw e;{let t=e.errors;"string"!=typeof e.errors&&(t=Object.values(e.errors).join("<br />")),R.error({title:t})}},ze=async function(e){e="string"==typeof e?{url:e}:e;const{data:t}=await O.request({paramsSerializer:function(e){return $.stringify(e,{sort:!1,skipNull:!0,skipEmptyString:!0})},...e});return t};function Se(e){let{url:t,method:r,confirm:n,onSuccess:o,children:i,disabled:a,as:c=l,...s}=e;const[d,u]=x(!1),h=z((async e=>{e.preventDefault();try{if(u(!0),n&&!await R.confirm({text:n}))return;const e="string"==typeof t?{url:t,method:r}:{method:r,...t},i=await ze(e);o&&o(i)}catch(e){ke(e)}finally{u(!1)}}),[t,r,u]);return S(c,{...s,disabled:a||d,onClick:h},i)}ze.defaults=O.defaults,ze.interceptors=O.interceptors;const Ne=require("ajv-i18n/localize/zh"),je={upload:function(e){let{options:t,...n}=e;const{widgets:o}=P();return t.endpoint&&(t.onUpload=async e=>{const r=new FormData;r.set("file",e);const{url:n}=await ze({url:t.endpoint,method:"post",data:r});return n}),r(o.upload,{...n,options:t})},editor:function(e){let{options:t,...n}=e;const{widgets:o}=P();return t.endpoint&&(t.onUpload=async e=>{const t=new FormData;t.set("file",e);const{url:r}=await ze({url:n.options.endpoint,method:"post",data:t});return r}),r(o.editor,{...n,options:t})}},Ee=N(((e,t)=>{let{action:n,method:o="post",onSuccess:i,formData:a,onSubmitting:c,onSubmit:s,onChange:l,submitText:d="提交",children:u,...h}=e;const[m,p]=x(),[f,g]=x(!1),[y,v]=x(a),b=z((async(e,t)=>{if(!f)try{if(g(!0),c&&c(!0),n){const{formData:t}=e;try{const e=await ze({url:n,method:o,data:t});return p(void 0),i&&await i(e),e}catch(e){if(!O.isAxiosError(e))throw e;p((e=>{const t=e.errors;return"string"==typeof t?{__errors:[t]}:T(t,(e=>({__errors:[e]})))})(e))}}else if(s)return await s(e,t)}finally{g(!1),c&&c(!1)}}),[n,o,s]),w=z((e=>{const{formData:t}=e;v(t),l&&l(e)}),[v,l]),C=z((e=>(e=e.map((e=>({keyword:e.name,dataPath:e.property,...e}))),Ne(e),e)),[]),k=r(be,{className:"px-4",loading:f,type:"submit",variant:"primary",children:d});return"function"==typeof u&&(u=u({submit:k,loading:f})),r(H,{ref:t,extraErrors:m,onSubmit:b,transformErrors:C,noHtml5Validate:!0,noValidate:!0,...h,formData:y,onChange:w,widgets:je,children:u||r("div",{className:"col-12",children:k})})})),Be=function(e){let{indeterminate:t=!1,...n}=e;const o=j(null);return C((()=>{o.current&&(o.current.indeterminate=t)}),[t]),r("input",{ref:o,...n,className:"form-check-input",type:"checkbox"})};var Oe;function $e(){return $e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$e.apply(this,arguments)}const De=e=>b.createElement("svg",$e({viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor"},e),Oe||(Oe=b.createElement("path",{d:"M252.069 906.496h520.283c89.582 0 134.144-44.562 134.144-132.846V250.331c0-88.283-44.562-132.845-134.144-132.845H252.069c-89.143 0-134.583 44.141-134.583 132.845V773.67c0 88.704 45.44 132.845 134.583 132.845zm1.28-68.992c-42.844 0-66.853-22.71-66.853-67.291V253.806c0-44.58 24.01-67.292 66.853-67.292h517.723c42.423 0 66.432 22.711 66.432 67.292v516.388c0 44.58-24.01 67.292-66.432 67.292zM511.78 714.496c22.71 0 36.425-15.854 36.425-40.704V547.365H682.35c24.009 0 40.722-12.874 40.722-35.584 0-23.132-15.854-36.426-40.722-36.426H548.206V340.773c0-24.85-13.715-40.704-36.425-40.704s-35.566 16.713-35.566 40.722v134.583H342.49c-24.85 0-41.142 13.275-41.142 36.407 0 22.71 17.152 35.584 41.142 35.584h133.724v126.427c0 23.99 12.855 40.704 35.566 40.704z"})));var Ve;function He(){return He=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},He.apply(this,arguments)}const Pe=e=>b.createElement("svg",He({viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor"},e),Ve||(Ve=b.createElement("path",{d:"M252.069 906.496h520.283c89.582 0 134.144-44.562 134.144-132.846V250.331c0-88.283-44.562-132.845-134.144-132.845H252.069c-89.143 0-134.583 44.141-134.583 132.845V773.67c0 88.704 45.44 132.845 134.583 132.845zm1.28-68.992c-42.844 0-66.853-22.71-66.853-67.291V253.806c0-44.58 24.01-67.292 66.853-67.292h517.723c42.423 0 66.432 22.711 66.432 67.292v516.388c0 44.58-24.01 67.292-66.432 67.292zm86.582-289.719h344.576c23.991 0 40.704-12.855 40.704-35.566 0-23.15-15.433-36.425-40.704-36.425H339.931c-24.868 0-40.722 13.276-40.722 36.425 0 22.711 16.713 35.566 40.722 35.566z"})));function Te(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const r=j(e);return C((()=>{r.current=e})),z((function(){for(var e,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return null===(e=r.current)||void 0===e?void 0:e.call(r,...n)}),t)}function Ae(e){const{value:t,defaultValue:r,onChange:n,shouldUpdate:o=((e,t)=>e!==t)}=e,i=Te(n),a=Te(o),[c,s]=x(r),l=void 0!==t,d=l?t:c,u=Te((e=>{const t="function"==typeof e?e(d):e;a(d,t)&&(l||s(t),i(t))}),[l,i,d,a]);return[d,u]}function Fe(e,t,r){const n=j(e),o=j(A(e,t,r));return C((()=>{n.current=e})),C((()=>{o.current=A((function(){n.current(...arguments)}),t,r)}),[t,r]),o.current}function Me(e){let{keyword:t,onKeywordChange:n}=e;const[o,i]=x(t),a=Fe(n,500);C((()=>{i(t)}),[t]);const c=z((e=>{i(e.target.value),a(e.target.value)}),[a,i]);return r(d.Control,{value:o,onChange:c,type:"search",placeholder:"Search..."})}const Ue=g.thead`
|
|
87
87
|
th {
|
|
88
88
|
padding: 0.5rem 0.5rem;
|
|
89
89
|
border-bottom-width: 1px;
|
|
90
90
|
border-color: var(--bs-border-color);
|
|
91
91
|
}
|
|
92
|
-
`,
|
|
92
|
+
`,qe={table:e=>r(u,{...e,className:"mb-0 align-middle table-hover"}),header:{wrapper:e=>r(Ue,{...e})}},Le=g.a`
|
|
93
93
|
cursor: pointer;
|
|
94
94
|
width: 28px;
|
|
95
95
|
height: 28px;
|
|
@@ -97,21 +97,21 @@ import e from"sweetalert2/dist/sweetalert2.js";import t from"sweetalert2-react-c
|
|
|
97
97
|
align-items: center;
|
|
98
98
|
justify-content: center;
|
|
99
99
|
vertical-align: middle;
|
|
100
|
-
`,
|
|
100
|
+
`,_e=function(e){let{record:t,expanded:n,expandable:o,onExpand:i}=e;return r(Le,o?{onClick:e=>i(t,e),children:r(n?Pe:De,{})}:{})},Ie=g(ye)`
|
|
101
101
|
margin-bottom: 0;
|
|
102
102
|
justify-content: flex-end;
|
|
103
103
|
margin-top: 1rem;
|
|
104
|
-
`;
|
|
104
|
+
`;const Ke=N(((e,t)=>{let{source:i,rowKey:a="id",paginate:c=!0,toolBarRender:s,columns:l=[],search:d,rowSelection:u,card:h=!0,expandable:m={},sync:p=!1,...f}=e;const[g,y]=x([]),[v,b]=x(c?{total:0,current:1,pageSize:10}:null),[w,S]=x(!0),[N,B]=L({}),[O,$]=Ae({value:p?N.q||"":void 0,defaultValue:"",onChange:e=>{p&&B({q:e||void 0})}}),[D,V]=Ae({value:p?N.page||1:void 0,defaultValue:1,onChange:e=>{p&&B({page:e||void 0})}}),H=z((async()=>{S(!0);try{let e;const t={q:O,page:D>1?D:void 0};e="string"==typeof i?await ze({url:i,params:t}):await i(t),c&&function(e){return"current_page"in e}(e)&&(b({total:e.total,current:e.current_page,pageSize:e.per_page}),e=e.data),y(e)}catch(e){}finally{S(!1)}}),[i,y,O,D]);C((()=>{H()}),[O,D]);const P=j({reload:H});C((()=>{P.current={reload:H}}),[H]),E(t,(()=>P.current));const[T]=function(e,t,n){const[o,i]=x((()=>new Set((null==e?void 0:e.selectedRowKeys)||[]))),a=e=>"string"==typeof t?e[t]:t(e),c=e=>n.find((t=>a(t)===e)),s=z((t=>{i(t);const r=Array.from(t),n=r.map((function(e){return c(e)}));null!=e&&e.onChange&&(null==e||e.onChange(r,n))}),[c]);return[z((t=>{if(!e)return t;const i=n.map(a),c=i.every((function(e){return o.has(e)})),l=i.some((function(e){return o.has(e)}));return[{key:"selection",title:r(Be,{checked:c,indeterminate:!c&&l,onChange:()=>{c?i.forEach((function(e){o.delete(e)})):i.forEach((function(e){o.add(e)})),s(new Set(o))}}),width:30,align:"center",render(e){let{record:t}=e;const n=a(t),i=o.has(n);return r(Be,{checked:i,onChange:()=>{i?o.delete(n):o.add(n),s(new Set(o))}})}},...t]}),[n,e,o])]}(u,a,g),A=k((()=>T(l).map((e=>{const t={...e,render:void 0};if("render"in e&&e.render){const r=e.render;t.render=(e,t,n)=>r({value:e,record:t,index:n,action:P.current})}return t}))),[l,T,P]),F=n(o,{children:[r(ne,{loading:w}),!1!==s&&n(Re,{children:[r(Ye,{size:12,children:s&&s(P.current)}),n(Ge,{size:12,children:[d&&r(Me,{keyword:O,onKeywordChange:e=>{q((()=>{V(1),$(e)}))}}),r(Je,{onClick:P.current.reload,children:r("i",{className:"bi bi-arrow-repeat"})})]})]}),r(U,{...f,expandable:{expandIcon:_e,...m},rowKey:a,columns:A,components:qe,data:g}),v&&r(Ie,{...v,onChange:V})]});return h?r(ie,{children:F}):F})),Re=g.div`
|
|
105
105
|
display: flex;
|
|
106
106
|
justify-content: space-between;
|
|
107
107
|
padding-bottom: 1rem;
|
|
108
108
|
height: 48px;
|
|
109
109
|
border-bottom: 2px solid #212529;
|
|
110
|
-
`,
|
|
110
|
+
`,Ge=g(ce)`
|
|
111
111
|
|
|
112
|
-
`,
|
|
112
|
+
`,Ye=g(ce)`
|
|
113
113
|
|
|
114
|
-
`,
|
|
114
|
+
`,Je=g.span`
|
|
115
115
|
cursor: pointer;
|
|
116
116
|
font-size: 20px;
|
|
117
117
|
line-height: 1;
|
|
@@ -119,5 +119,5 @@ import e from"sweetalert2/dist/sweetalert2.js";import t from"sweetalert2-react-c
|
|
|
119
119
|
&:hover {
|
|
120
120
|
color: var(--bs-primary);
|
|
121
121
|
}
|
|
122
|
-
`;let
|
|
122
|
+
`;let Qe=0;function We(){let{onHide:e,onShow:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[r,n]=x(!1),[o,i]=x(`visible-${Qe}`),a=z((()=>{n(!1),e&&e()}),[n,e]),c=z((()=>{i("visible-"+ ++Qe)}),[i,Qe]),s=z((()=>{n(!0),t&&t()}),[n,t]),l={show:r,onHide:a,onExited:c,key:o};return{visible:r,show:s,hide:a,state:l}}function Xe(e){let{text:t,variant:i,header:a=t,schema:c,uiSchema:s,action:d,method:u,formData:m,onSuccess:p,onChange:f,fields:g,size:y,onShow:v,okText:b="确定",formContext:w,className:C,backdrop:k,as:N=l}=e;const[E,B]=x(!1),O=j(null),$=z((()=>{var e;null===(e=O.current)||void 0===e||e.submit()}),[]),{state:D,show:V,hide:H}=We(),P=S(N,{className:C,variant:i,onClick:V},t),T=z((e=>{p&&p(e),H()}),[p]);return n(o,{children:[P,n(h,{size:y,backdrop:k,...D,onShow:v,children:[r(h.Header,{closeButton:!0,children:r(h.Title,{as:"h5",children:a})}),r(h.Body,{children:r(Ee,{onSubmitting:B,ref:O,schema:c,uiSchema:s,action:d,method:u,formData:m,fields:g,onChange:f,onSuccess:T,formContext:w,children:r("input",{type:"submit",hidden:!0})})}),n(h.Footer,{children:[r(l,{variant:"secondary",onClick:H,children:"取消"}),r(be,{loading:E,variant:"primary",onClick:$,children:b})]})]})]})}const Ze=N(((e,t)=>{let{text:i,variant:a,header:c=i,footer:s=!0,onOk:d,size:u,okText:m="确定",onShow:p,children:f,backdrop:g,as:y=l}=e;const[v,b]=x(!1),{state:w,show:C,hide:k}=We({onShow:p});E(t,(()=>({close:k})));const z=S(y,{variant:a,onClick:C},i);return n(o,{children:[z,n(h,{size:u,backdrop:g,...w,children:[c&&r(h.Header,{closeButton:!0,children:r(h.Title,{as:"h5",children:c})}),r(h.Body,{children:f}),s&&n(h.Footer,{children:[r(l,{variant:"secondary",onClick:k,children:"取消"}),r(be,{loading:v,variant:"primary",onClick:async()=>{if(d){b(!0);const e=await d();if(b(!1),!1===e)return}k()},children:m})]})]})]})}));function et(e){let{tooltip:t,children:n,placement:o="bottom"}=e;return r(m,{placement:o,overlay:r(p,{id:F(),children:t}),children:n})}function tt(e){let{manual:t,refreshDeps:r,...n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{execute:o,currentParams:i,error:a,...c}=_((async t=>(e="string"==typeof e?{url:e}:e,await ze({...e,...t}))),n);C((()=>{t||r||o()}),[]),C((()=>{r&&s()}),r);const s=z((()=>{i?o(...i):o()}),[o,i]);if(a&&Ce(a)){const e=a.errors;a=new Error("string"==typeof e?e:M(e).join(""))}return{refresh:s,execute:o,error:a,...c}}export{ie as Card,ae as Error,Ee as Form,ne as Loader,be as LoadingButton,R as Message,Ze as ModalButton,Xe as ModalForm,ve as NumberFormat,ye as Pagination,Se as RequestButton,te as Result,ce as Space,me as Steps,Ke as Table,J as Toast,et as Tooltip,we as Unauthorized,Ce as isRequestError,ze as request,ke as showRequestError,Ae as useControllableState,Fe as useDebounce,We as useOverlayState,tt as useRequest};
|
|
123
123
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/utils/message.ts","../src/utils/toast.tsx","../src/components/result.tsx","../src/components/dimmer.tsx","../src/components/loader.tsx","../src/components/card.tsx","../src/components/error.tsx","../src/components/space.tsx","../src/images/step_check.svg","../src/components/steps.tsx","../src/components/pagination.tsx","../src/components/number-format.tsx","../src/components/loading-button.tsx","../src/errors/unauthorized.ts","../src/request.ts","../src/components/request-button.tsx","../src/components/form.tsx","../src/components/table/use-selection.tsx","../src/images/plus_square.svg","../src/images/minus_square.svg","../src/components/table/index.tsx","../src/hooks/use-debounce.ts","../src/hooks/use-overlay-state.ts","../src/components/modal-form.tsx","../src/components/modal-button.tsx","../src/components/tooltip.tsx","../src/hooks/use-request.ts"],"sourcesContent":["import Swal from 'sweetalert2/dist/sweetalert2.js';\r\nimport withReactContent from 'sweetalert2-react-content';\r\nimport { SweetAlertOptions, SweetAlertResult } from 'sweetalert2';\r\n\r\nconst CustomSwal = withReactContent(Swal);\r\n\r\ninterface MessageOptions<T = any> extends SweetAlertOptions<T> {\r\n\r\n}\r\n\r\nconst defaultOptions = {\r\n confirmButtonText: '确定',\r\n cancelButtonText: '取消'\r\n};\r\n\r\nconst Message = {\r\n confirm: async <T = any>(options: MessageOptions<T>) => {\r\n const { isConfirmed } = await CustomSwal.fire({\r\n ...defaultOptions,\r\n icon: 'warning',\r\n showCancelButton: true,\r\n ...options,\r\n async preConfirm(data) {\r\n if (options.preConfirm) {\r\n try {\r\n return await options.preConfirm(data);\r\n } catch (e) {\r\n if (e instanceof Error) {\r\n CustomSwal.showValidationMessage(e.message);\r\n }\r\n return false;\r\n }\r\n }\r\n return true;\r\n },\r\n });\r\n\r\n return isConfirmed;\r\n },\r\n success: (options: MessageOptions) => {\r\n CustomSwal.fire({\r\n ...defaultOptions,\r\n toast: true,\r\n position: 'top',\r\n icon: 'success',\r\n timer: 2000,\r\n showConfirmButton: false,\r\n ...options\r\n });\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: 5000,\r\n showConfirmButton: false,\r\n ...options\r\n });\r\n },\r\n close: (result?: SweetAlertResult) => {\r\n CustomSwal.close(result);\r\n }\r\n};\r\n\r\nexport default Message;\r\n","import { Alert } from 'react-bootstrap';\r\nimport { NoticeContent, NotificationInstance } from 'rc-notification/lib/Notification';\r\nimport Notification from 'rc-notification';\r\n\r\nlet noticeInstance: NotificationInstance | null;\r\n\r\nfunction getNoticeInstance(callback: (instance: NotificationInstance) => void) {\r\n if (noticeInstance) {\r\n return callback(noticeInstance);\r\n }\r\n\r\n Notification.newInstance({\r\n prefixCls: 'notification',\r\n maxCount: 5,\r\n style: {\r\n top: 20,\r\n right: 20\r\n }\r\n }, (instance) => {\r\n if (noticeInstance) {\r\n callback(noticeInstance);\r\n return;\r\n }\r\n noticeInstance = instance;\r\n callback(instance);\r\n });\r\n}\r\n\r\nconst types = ['error', 'success', 'info'];\r\n\r\nconst notice = ({ type, ...options }: { type: string } & NoticeContent) => {\r\n getNoticeInstance((instance) => {\r\n options.duration = 3;\r\n let variant = type;\r\n switch (type) {\r\n case 'error':\r\n variant = 'danger';\r\n options.duration = options.closable ? 0 : 5;\r\n break;\r\n }\r\n\r\n options.content = <Alert variant={variant}>{options.content}</Alert>;\r\n\r\n instance.notice(options);\r\n });\r\n};\r\n\r\n\r\nlet Toast: {\r\n [index in typeof types[number]]: (content: string, options?: NoticeContent) => void\r\n} = {};\r\n\r\ntypes.forEach((type) => {\r\n Toast[type] = (content, options) => {\r\n notice({\r\n ...options,\r\n type,\r\n content\r\n });\r\n };\r\n});\r\n\r\nexport default Toast;\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","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 | number;\r\n}\r\n\r\nexport default function Loader({\r\n loading = true,\r\n children,\r\n variant = 'primary',\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 { 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 { Children, ReactNode } from 'react';\r\nimport styled, { css } from 'styled-components';\r\n\r\ninterface SpaceProps {\r\n children: ReactNode;\r\n size?: 'small' | 'middle' | 'large' | number;\r\n direction?: 'vertical' | 'horizontal';\r\n className?: string;\r\n}\r\n\r\n\r\nexport default function Space({ children, className, size = 'small', direction = 'horizontal' }: 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 className={className} $direction={direction} $size={size}>\r\n {items}\r\n </Container>;\r\n}\r\n\r\nconst Container = styled.div<{ $size: number, $direction: string }>`\r\n display: inline-flex;\r\n align-items: center;\r\n gap: ${props => props.$size}px;\r\n\r\n ${props => props.$direction === 'vertical' && css`\r\n display: flex;\r\n flex-direction: column;\r\n align-items: inherit;\r\n `}\r\n`;\r\n\r\nconst Item = styled.div`\r\n\r\n`;\r\n","var img = \"data:image/svg+xml,%3csvg t='1651217947509' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='2548' width='16' height='16' 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 { ReactNode, 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: ReactNode[] = [];\r\n let jumpPrev: ReactNode = null;\r\n let jumpNext: ReactNode = null;\r\n let firstPager: ReactNode = null;\r\n let lastPager: ReactNode = 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 { useMemo } from 'react';\r\n\r\ninterface Props {\r\n value: number;\r\n currency?: boolean;\r\n locale?: string;\r\n className?: string;\r\n options?: Intl.NumberFormatOptions;\r\n}\r\n\r\nexport default function NumberFormat({ className, value, locale = 'zh-CN', currency = true, options = {} }: Props) {\r\n\r\n const formatter = useMemo(() => {\r\n\r\n let opt;\r\n\r\n if (currency) {\r\n opt = {\r\n style: 'currency',\r\n currency: 'CNY'\r\n };\r\n } else {\r\n opt = {\r\n minimumFractionDigits: 2,\r\n };\r\n }\r\n\r\n return new Intl.NumberFormat(locale, { ...opt, ...options });\r\n }, [currency, locale, options]);\r\n\r\n if (className) {\r\n return <span className={className}>{formatter.format(value)}</span>;\r\n }\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, disabled, children, ...props }: CustomButtonProps) {\r\n\r\n return <Button {...props} disabled={loading || disabled}>\r\n {loading ? 'Loading…' : children}\r\n </Button>;\r\n}\r\n","export default class Unauthorized extends Error {\r\n\r\n url: string;\r\n\r\n constructor(url: string) {\r\n super('Unauthorized');\r\n this.url = url;\r\n }\r\n}\r\n","import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';\r\nimport queryString from 'query-string';\r\nimport * as rax from 'retry-axios';\r\nimport { RetryConfig } from 'retry-axios';\r\nimport Unauthorized from './errors/unauthorized';\r\nimport Toast from './utils/toast';\r\nimport Message from './utils/message';\r\n\r\nexport type Errors = string | {\r\n [key: string]: string\r\n}\r\n\r\ndeclare module 'retry-axios' {\r\n interface RetryConfig {\r\n retryDecider?: () => boolean;\r\n }\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: ({ config, response }) => {\r\n if (config.raxConfig?.retryDecider && !config.raxConfig.retryDecider()) {\r\n return false;\r\n }\r\n return config.method?.toUpperCase() === 'GET' && response?.status === 449;\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 = localStorage.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 e.errors = 'Unauthorized';\r\n if (isRecord(data) && data.url) {\r\n e = new Unauthorized(data.url);\r\n }\r\n Toast.error('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\nexport const showRequestError = (e: any) => {\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({ title: errors as string });\r\n } else {\r\n throw e;\r\n }\r\n};\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\nrequest.defaults = axios.defaults;\r\nrequest.interceptors = axios.interceptors;\r\n\r\nexport default request;\r\n","import { Button, ButtonProps } from 'react-bootstrap';\r\nimport request, { RequestConfig, showRequestError } from '../request';\r\nimport { createElement, ElementType, MouseEvent, useCallback, useState } from 'react';\r\nimport Message from '../utils/message';\r\nimport { 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 showRequestError(e);\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 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 onSubmitting?: (submitting: boolean) => void;\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({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onUpload = async (file: File) => {\r\n\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: 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 return <widgets.upload {...props} options={options} />;\r\n },\r\n editor: function({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onUpload = async (file: File) => {\r\n\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 return <widgets.editor {...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 onSubmitting,\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 if (!loading) {\r\n try {\r\n setLoading(true);\r\n if (onSubmitting) {\r\n onSubmitting(true);\r\n }\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 return result;\r\n } catch (e) {\r\n if (axios.isAxiosError(e)) {\r\n setExtraErrors(toExtraErrors(e));\r\n } else {\r\n throw e;\r\n }\r\n }\r\n } else if (onSubmit) {\r\n return await onSubmit(e, nativeEvent);\r\n }\r\n } finally {\r\n setLoading(false);\r\n if (onSubmitting) {\r\n onSubmitting(false);\r\n }\r\n }\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 className={'px-4'} 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 { 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","var img = \"data:image/svg+xml,%3csvg t='1681378941268' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='11434' width='16' height='16' fill='currentColor'%3e %3cpath d='M252.068571 906.496h520.283429c89.581714 0 134.144-44.562286 134.144-132.845714V250.331429c0-88.283429-44.562286-132.845714-134.144-132.845715H252.068571c-89.142857 0-134.582857 44.141714-134.582857 132.845715V773.668571c0 88.704 45.44 132.845714 134.582857 132.845715z m1.28-68.992c-42.843429 0-66.852571-22.710857-66.852571-67.291429V253.805714c0-44.580571 24.009143-67.291429 66.852571-67.291428h517.723429c42.422857 0 66.432 22.710857 66.432 67.291428V770.194286c0 44.580571-24.009143 67.291429-66.432 67.291428z m258.432-123.008c22.710857 0 36.425143-15.853714 36.425143-40.704v-126.427429h134.144c24.009143 0 40.722286-12.873143 40.722286-35.584 0-23.131429-15.853714-36.425143-40.722286-36.425142H548.205714v-134.582858c0-24.850286-13.714286-40.704-36.425143-40.704s-35.565714 16.713143-35.565714 40.722286v134.582857H342.491429c-24.850286 0-41.142857 13.275429-41.142858 36.406857 0 22.710857 17.152 35.584 41.142858 35.584h133.723428v126.427429c0 23.990857 12.854857 40.704 35.565714 40.704z' p-id='11435'%3e%3c/path%3e%3c/svg%3e\";\n export default img;","var img = \"data:image/svg+xml,%3csvg t='1681378996359' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='12821' width='16' height='16' fill='currentColor'%3e %3cpath d='M252.068571 906.496h520.283429c89.581714 0 134.144-44.562286 134.144-132.845714V250.331429c0-88.283429-44.562286-132.845714-134.144-132.845715H252.068571c-89.142857 0-134.582857 44.141714-134.582857 132.845715V773.668571c0 88.704 45.44 132.845714 134.582857 132.845715z m1.28-68.992c-42.843429 0-66.852571-22.710857-66.852571-67.291429V253.805714c0-44.580571 24.009143-67.291429 66.852571-67.291428h517.723429c42.422857 0 66.432 22.710857 66.432 67.291428V770.194286c0 44.580571-24.009143 67.291429-66.432 67.291428z m86.582858-289.718857h344.576c23.990857 0 40.704-12.854857 40.704-35.565714 0-23.149714-15.433143-36.425143-40.704-36.425143H339.931429c-24.868571 0-40.722286 13.275429-40.722286 36.425143 0 22.710857 16.713143 35.565714 40.722286 35.565714z' p-id='12822'%3e%3c/path%3e%3c/svg%3e\";\n export default img;","import RcTable, { TableProps as RcTableProps } from 'rc-table';\r\nimport {\r\n ColumnGroupType,\r\n ColumnsType,\r\n ColumnType as BsColumnType,\r\n RenderedCell,\r\n RenderExpandIconProps\r\n} from 'rc-table/es/interface';\r\nimport { Form, Table as BsTable } 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\nimport { ReactComponent as PlusIcon } from '../../images/plus_square.svg';\r\nimport { ReactComponent as MinusIcon } from '../../images/minus_square.svg';\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: {\r\n value: any,\r\n record: RecordType,\r\n index: number,\r\n action: TableType\r\n }) => ReactNode | RenderedCell<RecordType>;\r\n}\r\n\r\nexport type Columns<RecordType = any> = (ColumnGroupType<RecordType> | ColumnType<RecordType>)[]\r\n\r\nconst CustomTHead = styled.thead`\r\n th {\r\n padding: 0.5rem 0.5rem;\r\n border-bottom-width: 1px;\r\n border-color: var(--bs-border-color);\r\n }\r\n`;\r\n\r\nconst components: RcTableProps['components'] = {\r\n table: (props) => {\r\n return <BsTable {...props} className='mb-0 align-middle table-hover' />;\r\n },\r\n header: {\r\n wrapper(props) {\r\n return <CustomTHead {...props} />;\r\n }\r\n }\r\n};\r\n\r\nconst ExpandIconContainer = styled.a`\r\n cursor: pointer;\r\n width: 28px;\r\n height: 28px;\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n vertical-align: middle;\r\n`;\r\n\r\nconst ExpandIcon = function <RecordType>({\r\n record,\r\n expanded,\r\n expandable,\r\n onExpand\r\n}: RenderExpandIconProps<RecordType>) {\r\n if (!expandable) return <ExpandIconContainer />;\r\n return <ExpandIconContainer onClick={e => onExpand(record, e)}>\r\n {expanded ? <MinusIcon /> : <PlusIcon />}\r\n </ExpandIconContainer>;\r\n};\r\n\r\nconst CustomPagination = styled(Pagination)`\r\n margin-bottom: 0;\r\n justify-content: flex-end;\r\n margin-top: 1rem;\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 | ((params: Params) => Promise<RecordType>);\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 expandable = {},\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 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 if (typeof source === 'string') {\r\n result = await request({\r\n url: source,\r\n params,\r\n });\r\n } else {\r\n result = await source(params);\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} expandable={{ expandIcon: ExpandIcon, ...expandable }} 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 border-bottom: 2px solid #212529;\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 { 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 { ModalButtonProps } from './modal-button';\r\nimport { createElement, useCallback, useRef, useState } from 'react';\r\nimport Form, { FormProps, FormType } from './form';\r\nimport { Button, Modal } from 'react-bootstrap';\r\nimport LoadingButton from './loading-button';\r\nimport useOverlayState from '../hooks/use-overlay-state';\r\n\r\nexport type ModalFormProps<T = any> =\r\n Pick<ModalButtonProps, 'text' | 'variant' | 'header' | 'size' | 'as' | 'okText' | 'className' | 'onShow' | 'backdrop'>\r\n &\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 variant,\r\n header = text,\r\n schema,\r\n uiSchema,\r\n action,\r\n method,\r\n formData,\r\n onSuccess,\r\n onChange,\r\n fields,\r\n size,\r\n onShow,\r\n okText = '确定',\r\n formContext,\r\n className,\r\n backdrop,\r\n as = Button\r\n}: ModalFormProps<T>) {\r\n\r\n const [loading, setLoading] = useState(false);\r\n const form = useRef<FormType>(null);\r\n\r\n const handleOk = useCallback(() => {\r\n form.current?.submit();\r\n }, []);\r\n\r\n const { state, show, hide } = useOverlayState();\r\n\r\n const button = createElement(as, {\r\n className,\r\n variant,\r\n onClick: show\r\n }, text);\r\n\r\n const handleSuccess = useCallback((data) => {\r\n if (onSuccess) {\r\n onSuccess(data);\r\n }\r\n hide();\r\n }, [onSuccess]);\r\n\r\n return <>\r\n {button}\r\n <Modal size={size} backdrop={backdrop} {...state} onShow={onShow}>\r\n <Modal.Header closeButton>\r\n <Modal.Title as='h5'>{header}</Modal.Title>\r\n </Modal.Header>\r\n <Modal.Body>\r\n <Form\r\n onSubmitting={setLoading}\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={handleSuccess}\r\n formContext={formContext}\r\n >\r\n <input type='submit' hidden />\r\n </Form>\r\n </Modal.Body>\r\n <Modal.Footer>\r\n <Button variant='secondary' onClick={hide}>\r\n 取消\r\n </Button>\r\n <LoadingButton loading={loading} variant='primary' onClick={handleOk}>\r\n {okText}\r\n </LoadingButton>\r\n </Modal.Footer>\r\n </Modal>\r\n </>;\r\n}\r\n","import {\r\n createElement,\r\n ElementType,\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n PropsWithChildren,\r\n PropsWithoutRef,\r\n ReactNode,\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\nimport useOverlayState from '../hooks/use-overlay-state';\r\n\r\nexport interface ModalButtonProps extends ModalProps {\r\n text: ReactNode;\r\n variant?: ButtonProps['variant'];\r\n header?: ReactNode;\r\n onOk?: () => any;\r\n okText?: ReactNode;\r\n footer?: boolean;\r\n as?: ElementType | ButtonProps['as'];\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,\r\n header = text,\r\n footer = true,\r\n onOk,\r\n size,\r\n okText = '确定',\r\n onShow,\r\n children,\r\n backdrop,\r\n as = Button\r\n}, ref) => {\r\n\r\n const [loading, setLoading] = useState(false);\r\n\r\n const { state, show, hide } = useOverlayState({ onShow });\r\n\r\n useImperativeHandle(ref, () => ({\r\n close: hide\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 hide();\r\n };\r\n\r\n const button = createElement(as, {\r\n variant,\r\n onClick: show\r\n }, text);\r\n\r\n return <>\r\n {button}\r\n <Modal size={size} backdrop={backdrop} {...state}>\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={hide}>\r\n 取消\r\n </Button>\r\n <LoadingButton loading={loading} variant='primary' onClick={handleOk}>\r\n {okText}\r\n </LoadingButton>\r\n </Modal.Footer>}\r\n </Modal>\r\n </>;\r\n});\r\n\r\nexport default ModalButton;\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","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"],"names":["CustomSwal","withReactContent","Swal","defaultOptions","confirmButtonText","cancelButtonText","Message","confirm","async","isConfirmed","fire","icon","showCancelButton","options","data","preConfirm","e","Error","showValidationMessage","message","success","toast","position","timer","showConfirmButton","error","close","result","noticeInstance","notice","_ref","type","callback","Notification","newInstance","prefixCls","maxCount","style","top","right","instance","getNoticeInstance","duration","variant","closable","content","_jsx","Alert","children","Toast","forEach","Container","styled","div","Icon","Title","Extra","IconMap","className","info","warning","Result","status","title","extra","_jsxs","Dimmer","props","active","inverted","Loader","loading","animation","wrap","Spinner","Wrap","$height","Card","BsCard","classNames","_Fragment","errors","Object","entries","map","_ref2","name","Space","size","direction","small","middle","large","items","Children","child","Item","$direction","$size","css","_path","_extends","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","this","SvgStepCheck","React","createElement","viewBox","xmlns","width","height","fill","d","Steps","CustomRcSteps","icons","finish","CheckIcon","Step","RcSteps","noop","isInteger","value","isFinite","Math","floor","Pagination","total","onChange","defaultCurrent","defaultPageSize","current","setCurrent","useState","pageSize","setPageSize","useEffect","allPages","useMemo","handleChange","useCallback","p","prevPage","nextPage","pagerList","jumpPrev","jumpNext","firstPager","lastPager","push","BsPagination","onClick","Last","First","Prev","Next","left","max","min","pageBufferSize","unshift","NumberFormat","locale","currency","formatter","opt","minimumFractionDigits","Intl","format","LoadingButton","disabled","Button","Unauthorized","constructor","url","super","_defineProperty","rax","attach","axios","defaults","raxConfig","retryDelay","backoffType","shouldRetry","_config$raxConfig","_config$method","config","response","retryDecider","method","toUpperCase","maxContentLength","Infinity","maxBodyLength","baseURL","interceptors","request","use","token","localStorage","getItem","headers","Authorization","Promise","reject","isRecord","location","window","href","undefined","isAxiosError","isRequestError","showRequestError","values","join","paramsSerializer","params","queryString","stringify","sort","skipNull","skipEmptyString","RequestButton","onSuccess","as","fetching","setFetching","handleClick","preventDefault","text","localize","require","widgets","upload","getRegistry","endpoint","onUpload","FormData","set","file","editor","Form","forwardRef","_ref3","ref","action","formData","onSubmitting","onSubmit","submitText","extraErrors","setExtraErrors","setLoading","setData","handleSubmit","nativeEvent","__errors","mapValues","toExtraErrors","transformErrors","keyword","dataPath","property","submit","JsonForm","noHtml5Validate","noValidate","Checkbox","indeterminate","useRef","SvgPlusSquare","SvgMinusSquare","CustomTHead","thead","components","table","BsTable","header","wrapper","ExpandIconContainer","a","ExpandIcon","record","expanded","expandable","onExpand","MinusIcon","PlusIcon","CustomPagination","isPagination","Table","rowKey","paginate","toolBarRender","columns","search","rowSelection","card","pagination","setPagination","setKeyword","fetchData","q","page","current_page","per_page","reload","useImperativeHandle","transformColumns","keys","setKeys","Set","selectedRowKeys","getRowKey","getRecordByKey","find","setSelectedKeys","changedKeys","Array","from","records","recordKeys","checkedCurrentAll","every","has","checkedCurrentSome","some","checked","delete","add","align","render","useSelection","customColumns","column","customColumn","defaultRender","index","handleSearch","wait","callbackRef","debouncedCallbackRef","debounce","useDebounce","Header","LeftTools","RightTools","Control","placeholder","Action","RcTable","expandIcon","span","id","useOverlayState","onHide","onShow","visible","setVisible","setKey","hide","exit","show","state","onExited","ModalForm","schema","uiSchema","fields","okText","formContext","backdrop","form","handleOk","_form$current","button","handleSuccess","Modal","closeButton","Body","hidden","Footer","ModalButton","footer","onOk","Tooltip","tooltip","placement","OverlayTrigger","overlay","BsTooltip","uniqueId","useRequest","manual","refreshDeps","execute","currentParams","others","useAsyncCallback","refresh"],"mappings":"umCAIA,MAAMA,EAAaC,EAAiBC,GAM9BC,EAAiB,CACnBC,kBAAmB,KACnBC,iBAAkB,MAGhBC,EAAU,CACZC,QAASC,UACL,MAAMC,YAAEA,SAAsBT,EAAWU,KAAK,IACvCP,EACHQ,KAAM,UACNC,kBAAkB,KACfC,EACHL,iBAAiBM,GACb,GAAID,EAAQE,WACR,IACI,aAAaF,EAAQE,WAAWD,EAMnC,CALC,MAAOE,GAIL,OAHIA,aAAaC,OACbjB,EAAWkB,sBAAsBF,EAAEG,UAEhC,CACV,CAEL,OAAO,CACX,IAGJ,OAAOV,CAAW,EAEtBW,QAAUP,IACNb,EAAWU,KAAK,IACTP,EACHkB,OAAO,EACPC,SAAU,MACVX,KAAM,UACNY,MAAO,IACPC,mBAAmB,KAChBX,GACL,EAENY,MAAQZ,IACJb,EAAWU,KAAK,IACTP,EACHkB,OAAO,EACPC,SAAU,MACVX,KAAM,QACNY,MAAO,IACPC,mBAAmB,KAChBX,GACL,EAENa,MAAQC,IACJ3B,EAAW0B,MAAMC,EAAO,GC1DhC,IAAIC,EAwBJ,MAEMC,EAASC,IAA2D,IAA1DC,KAAEA,KAASlB,GAA2CiB,GAxBtE,SAA2BE,GACvB,GAAIJ,EACA,OAAOI,EAASJ,GAGpBK,EAAaC,YAAY,CACrBC,UAAW,eACXC,SAAU,EACVC,MAAO,CACHC,IAAK,GACLC,MAAO,MAEXC,IACIZ,EACAI,EAASJ,IAGbA,EAAiBY,EACjBR,EAASQ,GAAS,GAE1B,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wD,OACrBxD,EAAQ,IAAIR,MAAwB,iBAAXgE,EAAsBA,EAASgJ,EAAOhJ,GAAQiJ,KAAK,IAC/E,CAED,MAAO,CACHyL,UACAJ,UACA9X,WACGgY,EAEX"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/utils/message.ts","../src/utils/toast.tsx","../src/components/result.tsx","../src/components/dimmer.tsx","../src/components/loader.tsx","../src/components/card.tsx","../src/components/error.tsx","../src/components/space.tsx","../src/images/step_check.svg","../src/components/steps.tsx","../src/components/pagination.tsx","../src/components/number-format.tsx","../src/components/loading-button.tsx","../src/errors/unauthorized.ts","../src/request.ts","../src/components/request-button.tsx","../src/components/form.tsx","../src/components/table/use-selection.tsx","../src/images/plus_square.svg","../src/images/minus_square.svg","../src/hooks/use-callback-ref.ts","../src/hooks/use-controllable-state.ts","../src/hooks/use-debounce.ts","../src/components/table/search.tsx","../src/components/table/index.tsx","../src/hooks/use-overlay-state.ts","../src/components/modal-form.tsx","../src/components/modal-button.tsx","../src/components/tooltip.tsx","../src/hooks/use-request.ts"],"sourcesContent":["import Swal from 'sweetalert2/dist/sweetalert2.js';\r\nimport withReactContent from 'sweetalert2-react-content';\r\nimport { SweetAlertOptions, SweetAlertResult } from 'sweetalert2';\r\n\r\nconst CustomSwal = withReactContent(Swal);\r\n\r\ninterface MessageOptions<T = any> extends SweetAlertOptions<T> {\r\n\r\n}\r\n\r\nconst defaultOptions = {\r\n confirmButtonText: '确定',\r\n cancelButtonText: '取消'\r\n};\r\n\r\nconst Message = {\r\n confirm: async <T = any>(options: MessageOptions<T>) => {\r\n const { isConfirmed } = await CustomSwal.fire({\r\n ...defaultOptions,\r\n icon: 'warning',\r\n showCancelButton: true,\r\n ...options,\r\n async preConfirm(data) {\r\n if (options.preConfirm) {\r\n try {\r\n return await options.preConfirm(data);\r\n } catch (e) {\r\n if (e instanceof Error) {\r\n CustomSwal.showValidationMessage(e.message);\r\n }\r\n return false;\r\n }\r\n }\r\n return true;\r\n },\r\n });\r\n\r\n return isConfirmed;\r\n },\r\n success: (options: MessageOptions) => {\r\n CustomSwal.fire({\r\n ...defaultOptions,\r\n toast: true,\r\n position: 'top',\r\n icon: 'success',\r\n timer: 2000,\r\n showConfirmButton: false,\r\n ...options\r\n });\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: 5000,\r\n showConfirmButton: false,\r\n ...options\r\n });\r\n },\r\n close: (result?: SweetAlertResult) => {\r\n CustomSwal.close(result);\r\n }\r\n};\r\n\r\nexport default Message;\r\n","import { Alert } from 'react-bootstrap';\r\nimport { NoticeContent, NotificationInstance } from 'rc-notification/lib/Notification';\r\nimport Notification from 'rc-notification';\r\n\r\nlet noticeInstance: NotificationInstance | null;\r\n\r\nfunction getNoticeInstance(callback: (instance: NotificationInstance) => void) {\r\n if (noticeInstance) {\r\n return callback(noticeInstance);\r\n }\r\n\r\n Notification.newInstance({\r\n prefixCls: 'notification',\r\n maxCount: 5,\r\n style: {\r\n top: 20,\r\n right: 20\r\n }\r\n }, (instance) => {\r\n if (noticeInstance) {\r\n callback(noticeInstance);\r\n return;\r\n }\r\n noticeInstance = instance;\r\n callback(instance);\r\n });\r\n}\r\n\r\nconst types = ['error', 'success', 'info'];\r\n\r\nconst notice = ({ type, ...options }: { type: string } & NoticeContent) => {\r\n getNoticeInstance((instance) => {\r\n options.duration = 3;\r\n let variant = type;\r\n switch (type) {\r\n case 'error':\r\n variant = 'danger';\r\n options.duration = options.closable ? 0 : 5;\r\n break;\r\n }\r\n\r\n options.content = <Alert variant={variant}>{options.content}</Alert>;\r\n\r\n instance.notice(options);\r\n });\r\n};\r\n\r\n\r\nlet Toast: {\r\n [index in typeof types[number]]: (content: string, options?: NoticeContent) => void\r\n} = {};\r\n\r\ntypes.forEach((type) => {\r\n Toast[type] = (content, options) => {\r\n notice({\r\n ...options,\r\n type,\r\n content\r\n });\r\n };\r\n});\r\n\r\nexport default Toast;\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","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 | number;\r\n}\r\n\r\nexport default function Loader({\r\n loading = true,\r\n children,\r\n variant = 'primary',\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 { 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 { Children, ReactNode } from 'react';\r\nimport styled, { css } from 'styled-components';\r\n\r\ninterface SpaceProps {\r\n children: ReactNode;\r\n size?: 'small' | 'middle' | 'large' | number;\r\n direction?: 'vertical' | 'horizontal';\r\n className?: string;\r\n}\r\n\r\n\r\nexport default function Space({ children, className, size = 'small', direction = 'horizontal' }: 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 className={className} $direction={direction} $size={size}>\r\n {items}\r\n </Container>;\r\n}\r\n\r\nconst Container = styled.div<{ $size: number, $direction: string }>`\r\n display: inline-flex;\r\n align-items: center;\r\n gap: ${props => props.$size}px;\r\n\r\n ${props => props.$direction === 'vertical' && css`\r\n display: flex;\r\n flex-direction: column;\r\n align-items: inherit;\r\n `}\r\n`;\r\n\r\nconst Item = styled.div`\r\n\r\n`;\r\n","var img = \"data:image/svg+xml,%3csvg t='1651217947509' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='2548' width='16' height='16' 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 { ReactNode, 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: ReactNode[] = [];\r\n let jumpPrev: ReactNode = null;\r\n let jumpNext: ReactNode = null;\r\n let firstPager: ReactNode = null;\r\n let lastPager: ReactNode = 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 { useMemo } from 'react';\r\n\r\ninterface Props {\r\n value: number;\r\n currency?: boolean;\r\n locale?: string;\r\n className?: string;\r\n options?: Intl.NumberFormatOptions;\r\n}\r\n\r\nexport default function NumberFormat({ className, value, locale = 'zh-CN', currency = true, options = {} }: Props) {\r\n\r\n const formatter = useMemo(() => {\r\n\r\n let opt;\r\n\r\n if (currency) {\r\n opt = {\r\n style: 'currency',\r\n currency: 'CNY'\r\n };\r\n } else {\r\n opt = {\r\n minimumFractionDigits: 2,\r\n };\r\n }\r\n\r\n return new Intl.NumberFormat(locale, { ...opt, ...options });\r\n }, [currency, locale, options]);\r\n\r\n if (className) {\r\n return <span className={className}>{formatter.format(value)}</span>;\r\n }\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, disabled, children, ...props }: CustomButtonProps) {\r\n\r\n return <Button {...props} disabled={loading || disabled}>\r\n {loading ? 'Loading…' : children}\r\n </Button>;\r\n}\r\n","export default class Unauthorized extends Error {\r\n\r\n url: string;\r\n\r\n constructor(url: string) {\r\n super('Unauthorized');\r\n this.url = url;\r\n }\r\n}\r\n","import axios, { AxiosInstance, AxiosRequestConfig } from 'axios';\r\nimport queryString from 'query-string';\r\nimport * as rax from 'retry-axios';\r\nimport { RetryConfig } from 'retry-axios';\r\nimport Unauthorized from './errors/unauthorized';\r\nimport Toast from './utils/toast';\r\nimport Message from './utils/message';\r\n\r\nexport type Errors = string | {\r\n [key: string]: string\r\n}\r\n\r\ndeclare module 'retry-axios' {\r\n interface RetryConfig {\r\n retryDecider?: () => boolean;\r\n }\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: ({ config, response }) => {\r\n if (config.raxConfig?.retryDecider && !config.raxConfig.retryDecider()) {\r\n return false;\r\n }\r\n return config.method?.toUpperCase() === 'GET' && response?.status === 449;\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 = localStorage.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 e.errors = 'Unauthorized';\r\n if (isRecord(data) && data.url) {\r\n e = new Unauthorized(data.url);\r\n }\r\n Toast.error('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\nexport const showRequestError = (e: any) => {\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({ title: errors as string });\r\n } else {\r\n throw e;\r\n }\r\n};\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\nrequest.defaults = axios.defaults;\r\nrequest.interceptors = axios.interceptors;\r\n\r\nexport default request;\r\n","import { Button, ButtonProps } from 'react-bootstrap';\r\nimport request, { RequestConfig, showRequestError } from '../request';\r\nimport { createElement, ElementType, MouseEvent, useCallback, useState } from 'react';\r\nimport Message from '../utils/message';\r\nimport { 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 showRequestError(e);\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 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 onSubmitting?: (submitting: boolean) => void;\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({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onUpload = async (file: File) => {\r\n\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: 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 return <widgets.upload {...props} options={options} />;\r\n },\r\n editor: function({ options, ...props }: WidgetProps) {\r\n const { widgets } = getRegistry();\r\n\r\n if (options.endpoint) {\r\n options.onUpload = async (file: File) => {\r\n\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 return <widgets.editor {...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 onSubmitting,\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 if (!loading) {\r\n try {\r\n setLoading(true);\r\n if (onSubmitting) {\r\n onSubmitting(true);\r\n }\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 return result;\r\n } catch (e) {\r\n if (axios.isAxiosError(e)) {\r\n setExtraErrors(toExtraErrors(e));\r\n } else {\r\n throw e;\r\n }\r\n }\r\n } else if (onSubmit) {\r\n return await onSubmit(e, nativeEvent);\r\n }\r\n } finally {\r\n setLoading(false);\r\n if (onSubmitting) {\r\n onSubmitting(false);\r\n }\r\n }\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 className={'px-4'} 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 { 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","var img = \"data:image/svg+xml,%3csvg t='1681378941268' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='11434' width='16' height='16' fill='currentColor'%3e %3cpath d='M252.068571 906.496h520.283429c89.581714 0 134.144-44.562286 134.144-132.845714V250.331429c0-88.283429-44.562286-132.845714-134.144-132.845715H252.068571c-89.142857 0-134.582857 44.141714-134.582857 132.845715V773.668571c0 88.704 45.44 132.845714 134.582857 132.845715z m1.28-68.992c-42.843429 0-66.852571-22.710857-66.852571-67.291429V253.805714c0-44.580571 24.009143-67.291429 66.852571-67.291428h517.723429c42.422857 0 66.432 22.710857 66.432 67.291428V770.194286c0 44.580571-24.009143 67.291429-66.432 67.291428z m258.432-123.008c22.710857 0 36.425143-15.853714 36.425143-40.704v-126.427429h134.144c24.009143 0 40.722286-12.873143 40.722286-35.584 0-23.131429-15.853714-36.425143-40.722286-36.425142H548.205714v-134.582858c0-24.850286-13.714286-40.704-36.425143-40.704s-35.565714 16.713143-35.565714 40.722286v134.582857H342.491429c-24.850286 0-41.142857 13.275429-41.142858 36.406857 0 22.710857 17.152 35.584 41.142858 35.584h133.723428v126.427429c0 23.990857 12.854857 40.704 35.565714 40.704z' p-id='11435'%3e%3c/path%3e%3c/svg%3e\";\n export default img;","var img = \"data:image/svg+xml,%3csvg t='1681378996359' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='12821' width='16' height='16' fill='currentColor'%3e %3cpath d='M252.068571 906.496h520.283429c89.581714 0 134.144-44.562286 134.144-132.845714V250.331429c0-88.283429-44.562286-132.845714-134.144-132.845715H252.068571c-89.142857 0-134.582857 44.141714-134.582857 132.845715V773.668571c0 88.704 45.44 132.845714 134.582857 132.845715z m1.28-68.992c-42.843429 0-66.852571-22.710857-66.852571-67.291429V253.805714c0-44.580571 24.009143-67.291429 66.852571-67.291428h517.723429c42.422857 0 66.432 22.710857 66.432 67.291428V770.194286c0 44.580571-24.009143 67.291429-66.432 67.291428z m86.582858-289.718857h344.576c23.990857 0 40.704-12.854857 40.704-35.565714 0-23.149714-15.433143-36.425143-40.704-36.425143H339.931429c-24.868571 0-40.722286 13.275429-40.722286 36.425143 0 22.710857 16.713143 35.565714 40.722286 35.565714z' p-id='12822'%3e%3c/path%3e%3c/svg%3e\";\n export default img;","import { DependencyList, useCallback, useEffect, useRef } from 'react';\r\n\r\nexport default function useCallbackRef<T extends (...args: any[]) => any>(\r\n callback: T | undefined,\r\n deps: DependencyList = [],\r\n) {\r\n const callbackRef = useRef(callback);\r\n\r\n useEffect(() => {\r\n callbackRef.current = callback;\r\n });\r\n\r\n return useCallback(((...args) => callbackRef.current?.(...args)) as T, deps);\r\n}\r\n","import { Dispatch, SetStateAction, useState } from 'react';\r\nimport useCallbackRef from './use-callback-ref';\r\n\r\nexport interface UseControllableStateProps<T> {\r\n value?: T;\r\n defaultValue?: T | (() => T);\r\n onChange?: (value: T) => void;\r\n shouldUpdate?: (prev: T, next: T) => boolean;\r\n}\r\n\r\nexport default function useControllableState<T>(props: UseControllableStateProps<T>) {\r\n const {\r\n value: valueProp,\r\n defaultValue,\r\n onChange,\r\n shouldUpdate = (prev, next) => prev !== next,\r\n } = props;\r\n\r\n const onChangeProp = useCallbackRef(onChange);\r\n const shouldUpdateProp = useCallbackRef(shouldUpdate);\r\n\r\n const [uncontrolledState, setUncontrolledState] = useState(defaultValue as T);\r\n const controlled = valueProp !== undefined;\r\n const value = controlled ? valueProp : uncontrolledState;\r\n\r\n const setValue = useCallbackRef(\r\n (next: SetStateAction<T>) => {\r\n const setter = next as (prevState?: T) => T;\r\n const nextValue = typeof next === 'function' ? setter(value) : next;\r\n\r\n if (!shouldUpdateProp(value, nextValue)) {\r\n return;\r\n }\r\n\r\n if (!controlled) {\r\n setUncontrolledState(nextValue);\r\n }\r\n\r\n onChangeProp(nextValue);\r\n },\r\n [controlled, onChangeProp, value, shouldUpdateProp],\r\n );\r\n\r\n return [value, setValue] as [T, Dispatch<SetStateAction<T>>];\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 { Form } from 'react-bootstrap';\r\nimport { ChangeEvent, useCallback, useEffect, useState } from 'react';\r\nimport useDebounce from '../../hooks/use-debounce';\r\n\r\ninterface Props {\r\n keyword: string;\r\n onKeywordChange: (value: string) => void;\r\n}\r\n\r\nexport default function Search({ keyword, onKeywordChange }: Props) {\r\n\r\n const [value, setValue] = useState(keyword);\r\n\r\n const debouncedOnKeywordChange = useDebounce(onKeywordChange, 500);\r\n\r\n useEffect(() => {\r\n setValue(keyword);\r\n }, [keyword]);\r\n\r\n const onChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\r\n setValue(e.target.value);\r\n debouncedOnKeywordChange(e.target.value);\r\n }, [debouncedOnKeywordChange, setValue]);\r\n\r\n return <Form.Control value={value} onChange={onChange} type={'search'} placeholder={'Search...'} />;\r\n}\r\n","import RcTable, { TableProps as RcTableProps } from 'rc-table';\r\nimport { unstable_batchedUpdates } from 'react-dom';\r\nimport {\r\n ColumnGroupType,\r\n ColumnsType,\r\n ColumnType as BsColumnType,\r\n RenderedCell,\r\n RenderExpandIconProps\r\n} from 'rc-table/es/interface';\r\nimport { Table as BsTable } from 'react-bootstrap';\r\nimport { useUrlSearchParams } from 'use-url-search-params';\r\nimport {\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 useSelection from './use-selection';\r\nimport { PaginationType } from '../../utils/types';\r\nimport { ReactComponent as PlusIcon } from '../../images/plus_square.svg';\r\nimport { ReactComponent as MinusIcon } from '../../images/minus_square.svg';\r\nimport useControllableState from '../../hooks/use-controllable-state';\r\nimport Search from './search';\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: {\r\n value: any,\r\n record: RecordType,\r\n index: number,\r\n action: TableType\r\n }) => ReactNode | RenderedCell<RecordType>;\r\n}\r\n\r\nexport type Columns<RecordType = any> = (ColumnGroupType<RecordType> | ColumnType<RecordType>)[]\r\n\r\nconst CustomTHead = styled.thead`\r\n th {\r\n padding: 0.5rem 0.5rem;\r\n border-bottom-width: 1px;\r\n border-color: var(--bs-border-color);\r\n }\r\n`;\r\n\r\nconst components: RcTableProps['components'] = {\r\n table: (props) => {\r\n return <BsTable {...props} className='mb-0 align-middle table-hover' />;\r\n },\r\n header: {\r\n wrapper(props) {\r\n return <CustomTHead {...props} />;\r\n }\r\n }\r\n};\r\n\r\nconst ExpandIconContainer = styled.a`\r\n cursor: pointer;\r\n width: 28px;\r\n height: 28px;\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n vertical-align: middle;\r\n`;\r\n\r\nconst ExpandIcon = function <RecordType>({\r\n record,\r\n expanded,\r\n expandable,\r\n onExpand\r\n}: RenderExpandIconProps<RecordType>) {\r\n if (!expandable) return <ExpandIconContainer />;\r\n return <ExpandIconContainer onClick={e => onExpand(record, e)}>\r\n {expanded ? <MinusIcon /> : <PlusIcon />}\r\n </ExpandIconContainer>;\r\n};\r\n\r\nconst CustomPagination = styled(Pagination)`\r\n margin-bottom: 0;\r\n justify-content: flex-end;\r\n margin-top: 1rem;\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 | ((params: Params) => Promise<RecordType>);\r\n paginate?: boolean;\r\n columns: Columns<RecordType>;\r\n toolBarRender?: ((action: TableType) => ReactNode) | false;\r\n search?: boolean;\r\n rowSelection?: TableRowSelection<RecordType>;\r\n card?: boolean;\r\n sync?: 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 expandable = {},\r\n sync = false,\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\r\n const [params, setParams] = useUrlSearchParams({});\r\n\r\n const [keyword, setKeyword] = useControllableState<string>({\r\n value: sync ? (params.q as string || '') : undefined,\r\n defaultValue: '',\r\n onChange: (value) => {\r\n if (sync) {\r\n setParams({ q: value || undefined });\r\n }\r\n }\r\n });\r\n\r\n const [page, setPage] = useControllableState<number>({\r\n value: sync ? (params.page as number || 1) : undefined,\r\n defaultValue: 1,\r\n onChange: (value) => {\r\n if (sync) {\r\n setParams({ page: value || undefined });\r\n }\r\n }\r\n });\r\n\r\n const fetchData = useCallback(async () => {\r\n setLoading(true);\r\n try {\r\n let result;\r\n const params: Params = {\r\n q: keyword,\r\n page: page > 1 ? page : undefined,\r\n };\r\n\r\n if (typeof source === 'string') {\r\n result = await request({\r\n url: source,\r\n params,\r\n });\r\n } else {\r\n result = await source(params);\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, keyword, page]);\r\n\r\n useEffect(() => {\r\n fetchData();\r\n }, [keyword, page]);\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 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 && <Search keyword={keyword} onKeywordChange={(value) => {\r\n unstable_batchedUpdates(() => {\r\n setPage(1);\r\n setKeyword(value);\r\n });\r\n }} />}\r\n <Action onClick={action.current.reload}><i className='bi bi-arrow-repeat' /></Action>\r\n </RightTools>\r\n </Header>}\r\n <RcTable {...props} expandable={{ expandIcon: ExpandIcon, ...expandable }} rowKey={rowKey} columns={customColumns} components={components} data={data} />\r\n {pagination && <CustomPagination {...pagination} onChange={setPage} />}\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 border-bottom: 2px solid #212529;\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 { 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 { ModalButtonProps } from './modal-button';\r\nimport { createElement, useCallback, useRef, useState } from 'react';\r\nimport Form, { FormProps, FormType } from './form';\r\nimport { Button, Modal } from 'react-bootstrap';\r\nimport LoadingButton from './loading-button';\r\nimport useOverlayState from '../hooks/use-overlay-state';\r\n\r\nexport type ModalFormProps<T = any> =\r\n Pick<ModalButtonProps, 'text' | 'variant' | 'header' | 'size' | 'as' | 'okText' | 'className' | 'onShow' | 'backdrop'>\r\n &\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 variant,\r\n header = text,\r\n schema,\r\n uiSchema,\r\n action,\r\n method,\r\n formData,\r\n onSuccess,\r\n onChange,\r\n fields,\r\n size,\r\n onShow,\r\n okText = '确定',\r\n formContext,\r\n className,\r\n backdrop,\r\n as = Button\r\n}: ModalFormProps<T>) {\r\n\r\n const [loading, setLoading] = useState(false);\r\n const form = useRef<FormType>(null);\r\n\r\n const handleOk = useCallback(() => {\r\n form.current?.submit();\r\n }, []);\r\n\r\n const { state, show, hide } = useOverlayState();\r\n\r\n const button = createElement(as, {\r\n className,\r\n variant,\r\n onClick: show\r\n }, text);\r\n\r\n const handleSuccess = useCallback((data) => {\r\n if (onSuccess) {\r\n onSuccess(data);\r\n }\r\n hide();\r\n }, [onSuccess]);\r\n\r\n return <>\r\n {button}\r\n <Modal size={size} backdrop={backdrop} {...state} onShow={onShow}>\r\n <Modal.Header closeButton>\r\n <Modal.Title as='h5'>{header}</Modal.Title>\r\n </Modal.Header>\r\n <Modal.Body>\r\n <Form\r\n onSubmitting={setLoading}\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={handleSuccess}\r\n formContext={formContext}\r\n >\r\n <input type='submit' hidden />\r\n </Form>\r\n </Modal.Body>\r\n <Modal.Footer>\r\n <Button variant='secondary' onClick={hide}>\r\n 取消\r\n </Button>\r\n <LoadingButton loading={loading} variant='primary' onClick={handleOk}>\r\n {okText}\r\n </LoadingButton>\r\n </Modal.Footer>\r\n </Modal>\r\n </>;\r\n}\r\n","import {\r\n createElement,\r\n ElementType,\r\n forwardRef,\r\n ForwardRefExoticComponent,\r\n PropsWithChildren,\r\n PropsWithoutRef,\r\n ReactNode,\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\nimport useOverlayState from '../hooks/use-overlay-state';\r\n\r\nexport interface ModalButtonProps extends ModalProps {\r\n text: ReactNode;\r\n variant?: ButtonProps['variant'];\r\n header?: ReactNode;\r\n onOk?: () => any;\r\n okText?: ReactNode;\r\n footer?: boolean;\r\n as?: ElementType | ButtonProps['as'];\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,\r\n header = text,\r\n footer = true,\r\n onOk,\r\n size,\r\n okText = '确定',\r\n onShow,\r\n children,\r\n backdrop,\r\n as = Button\r\n}, ref) => {\r\n\r\n const [loading, setLoading] = useState(false);\r\n\r\n const { state, show, hide } = useOverlayState({ onShow });\r\n\r\n useImperativeHandle(ref, () => ({\r\n close: hide\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 hide();\r\n };\r\n\r\n const button = createElement(as, {\r\n variant,\r\n onClick: show\r\n }, text);\r\n\r\n return <>\r\n {button}\r\n <Modal size={size} backdrop={backdrop} {...state}>\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={hide}>\r\n 取消\r\n </Button>\r\n <LoadingButton loading={loading} variant='primary' onClick={handleOk}>\r\n {okText}\r\n </LoadingButton>\r\n </Modal.Footer>}\r\n </Modal>\r\n </>;\r\n});\r\n\r\nexport default ModalButton;\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","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"],"names":["CustomSwal","withReactContent","Swal","defaultOptions","confirmButtonText","cancelButtonText","Message","confirm","async","isConfirmed","fire","icon","showCancelButton","options","data","preConfirm","e","Error","showValidationMessage","message","success","toast","position","timer","showConfirmButton","error","close","result","noticeInstance","notice","_ref","type","callback","Notification","newInstance","prefixCls","maxCount","style","top","right","instance","getNoticeInstance","duration","variant","closable","content","_jsx","Alert","children","Toast","forEach","Container","styled","div","Icon","Title","Extra","IconMap","className","info","warning","Result","status","title","extra","_jsxs","Dimmer","props","active","inverted","Loader","loading","animation","wrap","Spinner","Wrap","$height","Card","BsCard","classNames","_Fragment","errors","Object","entries","map","_ref2","name","Space","size","direction","small","middle","large","items","Children","child","Item","$direction","$size","css","_path","_extends","assign","bind","target","i","arguments","length","source","key","prototype","hasOwnProperty","call","apply","this","SvgStepCheck","React","createElement","viewBox","xmlns","width","height","fill","d","Steps","CustomRcSteps","icons","finish","CheckIcon","Step","RcSteps","noop","isInteger","value","isFinite","Math","floor","Pagination","total","onChange","defaultCurrent","defaultPageSize","current","setCurrent","useState","pageSize","setPageSize","useEffect","allPages","useMemo","handleChange","useCallback","p","prevPage","nextPage","pagerList","jumpPrev","jumpNext","firstPager","lastPager","push","BsPagination","onClick","Last","First","Prev","Next","left","max","min","pageBufferSize","unshift","NumberFormat","locale","currency","formatter","opt","minimumFractionDigits","Intl","format","LoadingButton","disabled","Button","Unauthorized","constructor","url","super","_defineProperty","rax","attach","axios","defaults","raxConfig","retryDelay","backoffType","shouldRetry","_config$raxConfig","_config$method","config","response","retryDecider","method","toUpperCase","maxContentLength","Infinity","maxBodyLength","baseURL","interceptors","request","use","token","localStorage","getItem","headers","Authorization","Promise","reject","isRecord","location","window","href","undefined","isAxiosError","isRequestError","showRequestError","values","join","paramsSerializer","params","queryString","stringify","sort","skipNull","skipEmptyString","RequestButton","onSuccess","as","fetching","setFetching","handleClick","preventDefault","text","localize","require","widgets","upload","getRegistry","endpoint","onUpload","FormData","set","file","editor","Form","forwardRef","_ref3","ref","action","formData","onSubmitting","onSubmit","submitText","extraErrors","setExtraErrors","setLoading","setData","handleSubmit","nativeEvent","__errors","mapValues","toExtraErrors","transformErrors","keyword","dataPath","property","submit","JsonForm","noHtml5Validate","noValidate","Checkbox","indeterminate","useRef","SvgPlusSquare","SvgMinusSquare","useCallbackRef","deps","callbackRef","_callbackRef$current","_len","args","Array","_key","useControllableState","valueProp","defaultValue","shouldUpdate","prev","next","onChangeProp","shouldUpdateProp","uncontrolledState","setUncontrolledState","controlled","setValue","nextValue","useDebounce","wait","debouncedCallbackRef","debounce","Search","onKeywordChange","debouncedOnKeywordChange","Control","placeholder","CustomTHead","thead","components","table","BsTable","header","wrapper","ExpandIconContainer","a","ExpandIcon","record","expanded","expandable","onExpand","MinusIcon","PlusIcon","CustomPagination","Table","rowKey","paginate","toolBarRender","columns","search","rowSelection","card","sync","pagination","setPagination","setParams","useUrlSearchParams","setKeyword","q","page","setPage","fetchData","isPagination","current_page","per_page","reload","useImperativeHandle","transformColumns","keys","setKeys","Set","selectedRowKeys","getRowKey","getRecordByKey","find","setSelectedKeys","changedKeys","from","records","recordKeys","checkedCurrentAll","every","has","checkedCurrentSome","some","checked","delete","add","align","render","useSelection","customColumns","column","customColumn","defaultRender","index","Header","LeftTools","RightTools","unstable_batchedUpdates","Action","RcTable","expandIcon","span","id","useOverlayState","onHide","onShow","visible","setVisible","setKey","hide","exit","show","state","onExited","ModalForm","schema","uiSchema","fields","okText","formContext","backdrop","form","handleOk","_form$current","button","handleSuccess","Modal","closeButton","Body","hidden","Footer","ModalButton","footer","onOk","Tooltip","tooltip","placement","OverlayTrigger","overlay","BsTooltip","uniqueId","useRequest","manual","refreshDeps","execute","currentParams","others","useAsyncCallback","refresh"],"mappings":"stC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,EAAQ,IAAIR,MAAwB,iBAAXgE,EAAsBA,EAASgJ,EAAOhJ,GAAQiJ,KAAK,IAC/E,CAED,MAAO,CACHmN,UACAJ,UACAxZ,WACG0Z,EAEX"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topthink/components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prebuild": "rimraf lib types",
|
|
6
6
|
"build": "rollup -c --environment NODE_ENV:production",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.11.2",
|
|
20
20
|
"@topthink/bootstrap": "^1.0.18",
|
|
21
|
-
"@topthink/json-form": "^1.0.
|
|
21
|
+
"@topthink/json-form": "^1.0.28",
|
|
22
22
|
"@types/styled-components": "^5.1.11",
|
|
23
23
|
"ajv-i18n": "^4.0.0",
|
|
24
24
|
"axios": "^0.27.2",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"retry-axios": "^2.6.0",
|
|
32
32
|
"styled-components": "^5.3.0",
|
|
33
33
|
"sweetalert2": "^11.0.18",
|
|
34
|
-
"sweetalert2-react-content": "^4.1.0"
|
|
34
|
+
"sweetalert2-react-content": "^4.1.0",
|
|
35
|
+
"use-url-search-params": "^2.5.1"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
38
|
"lodash": "*",
|
|
@@ -60,5 +61,5 @@
|
|
|
60
61
|
},
|
|
61
62
|
"author": "yunwuxin <tzzhangyajun@qq.com> (https://github.com/yunwuxin)",
|
|
62
63
|
"license": "MIT",
|
|
63
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "33995899546d5d3bb31668d52fe29e4eb9e1ab2b"
|
|
64
65
|
}
|
|
@@ -22,9 +22,10 @@ export interface TableProps<RecordType = any> extends Omit<RcTableProps<RecordTy
|
|
|
22
22
|
paginate?: boolean;
|
|
23
23
|
columns: Columns<RecordType>;
|
|
24
24
|
toolBarRender?: ((action: TableType) => ReactNode) | false;
|
|
25
|
-
search?: boolean
|
|
25
|
+
search?: boolean;
|
|
26
26
|
rowSelection?: TableRowSelection<RecordType>;
|
|
27
27
|
card?: boolean;
|
|
28
|
+
sync?: boolean;
|
|
28
29
|
}
|
|
29
30
|
type Params = {
|
|
30
31
|
page?: number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
export interface UseControllableStateProps<T> {
|
|
3
|
+
value?: T;
|
|
4
|
+
defaultValue?: T | (() => T);
|
|
5
|
+
onChange?: (value: T) => void;
|
|
6
|
+
shouldUpdate?: (prev: T, next: T) => boolean;
|
|
7
|
+
}
|
|
8
|
+
export default function useControllableState<T>(props: UseControllableStateProps<T>): [T, Dispatch<SetStateAction<T>>];
|
package/types/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ export { default as ModalButton, ModalType, ModalButtonProps } from './component
|
|
|
18
18
|
export { default as Tooltip } from './components/tooltip';
|
|
19
19
|
export { default as useRequest } from './hooks/use-request';
|
|
20
20
|
export { default as useOverlayState } from './hooks/use-overlay-state';
|
|
21
|
+
export { default as useControllableState } from './hooks/use-controllable-state';
|
|
22
|
+
export { default as useDebounce } from './hooks/use-debounce';
|
|
21
23
|
export { default as Unauthorized } from './errors/unauthorized';
|
|
22
24
|
export { default as request, RequestConfig, RequestInstance, isRequestError, showRequestError } from './request';
|
|
23
25
|
export { UiSchema as FormUiSchema, Schema as FormSchema, WidgetProps as FormWidgetProps, Widget as FormWidget, IChangeEvent as FormChangeEvent, ISubmitEvent as FormSubmitEvent } from '@topthink/json-form';
|