@topthink/components 1.0.94 → 1.0.96

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.
@@ -1 +1 @@
1
- import{jsx as t,Fragment as r}from"react/jsx-runtime";import{memo as e,useContext as i,useState as o,useEffect as s}from"react";import{I as a}from"./index-m6pAadP4.js";import{useInView as m}from"react-intersection-observer";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"lodash";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"styled-components";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"react-async-hook";import"immer";var n=e((e=>{let{lazy:n=!0,...c}=e;const{registerImage:p,setShow:l,setCurrent:h,getId:g}=i(a),[d,w]=o(),[u,f]=o(!1),{ref:v,inView:x}=m({threshold:.2,skip:!n,initialInView:!0}),[y]=o(g);if(s((()=>{if(c.src)return p(y,c.src)}),[]),u)return t(r,{children:c.alt?`[图片加载失败:${c.alt}]`:" "});const k=!x&&n&&d?"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3e %3crect width='1' height='1' fill='none'/%3e%3c/svg%3e":c.src;return t("img",{width:d?.[0],height:d?.[1],onLoad:t=>{d||w([t.currentTarget.clientWidth,t.currentTarget.clientHeight])},onError:()=>{f(!0)},ref:v,...c,alt:void 0,src:k,onClick:()=>{h(y),l(!0)}})}));export{n as default};
1
+ import{jsx as t,Fragment as r}from"react/jsx-runtime";import{memo as e,useContext as i,useState as o,useEffect as s}from"react";import{I as a}from"./index-J7csAYoa.js";import{useInView as m}from"react-intersection-observer";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"lodash";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"styled-components";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"react-async-hook";import"immer";var n=e((e=>{let{lazy:n=!0,...c}=e;const{registerImage:p,setShow:l,setCurrent:h,getId:g}=i(a),[d,w]=o(),[u,f]=o(!1),{ref:v,inView:x}=m({threshold:.2,skip:!n,initialInView:!0}),[y]=o(g);if(s((()=>{if(c.src)return p(y,c.src)}),[]),u)return t(r,{children:c.alt?`[图片加载失败:${c.alt}]`:" "});const k=!x&&n&&d?"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3e %3crect width='1' height='1' fill='none'/%3e%3c/svg%3e":c.src;return t("img",{width:d?.[0],height:d?.[1],onLoad:t=>{d||w([t.currentTarget.clientWidth,t.currentTarget.clientHeight])},onError:()=>{f(!0)},ref:v,...c,alt:void 0,src:k,onClick:()=>{h(y),l(!0)}})}));export{n as default};
@@ -0,0 +1,76 @@
1
+ import e from"sweetalert2/dist/sweetalert2.js";import t from"sweetalert2-react-content";import{jsx as n,jsxs as r,Fragment as o}from"react/jsx-runtime";import{useRef as i,useState as a,useEffect as s,createContext as c,Fragment as l,useContext as d,useCallback as u,useMemo as h,forwardRef as f,Children as m,lazy as p,Suspense as g,createElement as y,useImperativeHandle as v,memo as w}from"react";import{OverlayTrigger as b,Tooltip as x,Spinner as k,Button as C,Modal as N,Card as S,Alert as z,Pagination as P,Offcanvas as j,Row as $,Col as T}from"react-bootstrap";import{uniqueId as H,values as B,debounce as E}from"lodash";import L from"axios";import M from"query-string";import*as D from"retry-axios";import{enqueueSnackbar as F}from"notistack";import A from"path";import _,{css as I}from"styled-components";import O from"classnames";import{useUrlSearchParams as U}from"use-url-search-params";import W from"copy-to-clipboard";import{useAsyncCallback as q}from"react-async-hook";import{freeze as R,produce as V}from"immer";import"react-intersection-observer";const G=()=>{document.body.style.setProperty("--vh",window.innerHeight/100+"px"),document.body.style.setProperty("--100vh",window.innerHeight+"px")};window.addEventListener("resize",G),G();const K=t(e),J={confirmButtonText:"确定",cancelButtonText:"取消"},Q={confirm:async e=>{const{isConfirmed:t}=await K.fire({...J,icon:"warning",showCancelButton:!0,...e,async preConfirm(t){if(e.preConfirm)try{return await e.preConfirm(t)}catch(e){return e instanceof Error&&K.showValidationMessage(e.message),!1}return!0}});return t},success:e=>{K.fire({...J,toast:!0,position:"top",icon:"success",timer:2e3,showConfirmButton:!1,...e})},error:e=>{K.fire({...J,toast:!0,position:"top",icon:"error",timer:5e3,showConfirmButton:!1,...e})},close:e=>{K.close(e)},defaults:J};const Y=c({});function X(e){return t=>{let{resolve:r,destroy:o,message:c}=t;const[l,f]=function(e){const t=i(null),[n,r]=a(e);return s((()=>{t.current&&(t.current(),t.current=null)}),[n]),[n,(e,n)=>{t.current="function"==typeof n?n:null,r(e)}]}(!0),m=d(Y),p=u((e=>{f(!1,(()=>{r(e)}))}),[f,r]),g=h((()=>({show:l,onHide:()=>p(),onExited:()=>o(),container:m.container})),[l,p,o]);return n(e,{resolve:p,state:g,message:c})}}function Z(e){return t=>new Promise((r=>{const o=n(e,{resolve:r,destroy:()=>{re(o)},message:t});ne(o)}))}let ee=()=>{},te=new Set;const ne=e=>{te=new Set(te),te.add(e),ee(te)},re=e=>{te=new Set(te),te.delete(e),ee(te)};function oe(e,t){return Z(X(e))(t)}function ie(e){let{tooltip:t,children:r,placement:o="bottom"}=e;return n(b,{placement:o,overlay:n(x,{id:H(),children:t}),children:r})}const ae=c(!1),se=f(((e,t)=>{let{loading:i,percent:a,disabled:s,children:c,tooltip:l,variant:u,...h}=e;d(ae)&&!u&&(u="link"),i&&(s=!0,c=r(o,{children:[n(k,{ref:t,as:"span",size:"sm",role:"status","aria-hidden":"true",animation:"border"}),a?r("span",{className:"ms-2",children:[a,"%"]}):null]}));const f=n(C,{ref:t,...h,variant:u,disabled:s,children:c});return l?n(ie,{tooltip:l,children:n("span",{className:"d-inline-block",children:f})}):f})),ce=function(e){let{state:t,message:{title:o,message:i,okText:a,cancelText:s},resolve:c}=e;return r(N,{...t,children:[n(N.Header,{children:n(N.Title,{as:"h5",children:o||"确认"})}),n(N.Body,{children:i}),r(N.Footer,{children:[n(se,{variant:"secondary",onClick:()=>c(),children:s||"取消"}),n(se,{onClick:()=>c(!0),children:a||"确定"})]})]})};const le=e=>{let{header:t,children:i,footer:s,closable:c=!0,show:l,cancelText:d="取消",okText:u="确定",onOk:f,onCancel:m,onHide:p,okButtonProps:g,bodyAs:y,headerAs:v="h5",confirmLoading:w=!1,...b}=e;const[x,k]=a(!1),C=h((()=>n(se,{loading:x||w,variant:"primary",onClick:async e=>{k(!0);try{await(f?.(e)),e.defaultPrevented||p?.()}finally{k(!1)}},...g,children:u})),[g,u,f,p,x,w]),S=h((()=>n(se,{variant:"secondary",onClick:e=>{m?.(e),e.defaultPrevented||p?.()},children:d})),[m,p,d]),z={close:()=>{p?.()}};switch(typeof s){case"undefined":s=r(o,{children:[S,C]});break;case"function":s=s({okButton:C,cancelButton:S,action:z})}return r(N,{...b,onHide:p,show:l,children:[t&&n(N.Header,{closeButton:c,children:n(N.Title,{as:v,children:t})}),n(N.Body,{as:y,children:i}),s&&n(N.Footer,{children:s})]})};le.Message=function(e){const[t,r]=a(te);return s((()=>{ee=r}),[]),n(Y.Provider,{value:e,children:Array.from(t).map(((e,t)=>n(l,{children:e},`message-${t}`)))})},le.confirm=function(e){return Z(X(ce))(e)},le.show=oe;const de=["default","error","warning","success","info"].reduce(((e,t)=>(e[t]=(e,n)=>F(e,{variant:t,autoHideDuration:3e3,anchorOrigin:{vertical:"top",horizontal:"center"},...n}),e)),{});function ue(e){return e&&"object"==typeof e}D.attach(),L.defaults.raxConfig={retryDelay:2e3,backoffType:"static",shouldRetry:e=>{let{config:t,response:n}=e;return!(t.raxConfig?.retryDecider&&!t.raxConfig.retryDecider())&&("GET"===t.method?.toUpperCase()&&449===n?.status)}},L.defaults.maxContentLength=1/0,L.defaults.maxBodyLength=1/0,L.defaults.baseURL="/api",L.defaults.authTokenName="authorization",L.interceptors.request.use((e=>{const t=e.authTokenName;if(t){const n=localStorage.getItem(t);n&&(e.headers={Authorization:`Bearer ${n}`,...e.headers})}return e}),(e=>Promise.reject(e))),L.interceptors.response.use((e=>(201===e.status&&e.data.location&&(window.location.href=e.data.location,e.data=void 0),e)),(e=>{if(L.isAxiosError(e)&&e.response){const{data:t,status:n}=e.response;401===n?e.errors="Unauthorized":ue(t)?422===n?e.errors=t:"message"in t&&(e.errors=t.message):e.errors=t,"string"!=typeof e.errors?e.message=Object.values(e.errors).join("<br />"):e.message=e.errors}return Promise.reject(e)}));const he=L.isAxiosError,fe=e=>{if(!L.isAxiosError(e))throw e;de.error(e.message)},me=async function(e){if(e="string"==typeof e?{url:e}:e,(e={paramsSerializer:function(e){return M.stringify(e,{sort:!1,skipNull:!0,skipEmptyString:!0,arrayFormat:"bracket"})},...e}).onMessage){let t=0,n="",r=null;const o=e.onMessage;e.onDownloadProgress=e=>{const i=e.target,{responseText:a}=i;for(;t<e.loaded;){const e=a.substring(t,++t);if(n+=e,"\n"===e){if(r||(r={id:"",event:"",data:""}),"\n"===n)o(r),r=null;else{const e=n.match(/^data:(?<data>.*)/);e&&(r.data=e.groups.data.trim())}n=""}}}}const{data:t}=await L.request(e);return t};me.defaults=L.defaults,me.interceptors=L.interceptors;function pe(e){const t=(()=>{const e=i(!1);return s((()=>(e.current=!1,()=>{e.current=!0})),[]),e})(),[n,r]=a(e);return[n,u((e=>{t.current||r(e)}),[])]}function ge(e){const t=document.createElement("a");return t.href=e,t.href}const ye=function(e){let{state:t,message:r,resolve:o}=e;const a=i(!0),{result:c,checkUrl:l,onComplete:d}=r,[u,h]=pe(!1);return s((()=>{me({url:l,method:"post",data:{order_no:c.order_no},raxConfig:{shouldRetry:e=>a.current&&449===e.response?.status}}).then((()=>{d?.(),o()})).catch((()=>null))}),[]),n(le,{...t,centered:!0,onHide:()=>{a.current=!1,t.onHide()},backdrop:"static",header:"支付结果",okText:"已完成支付",okButtonProps:{loading:u},onOk:async e=>{e.preventDefault();try{h(!0),await me({url:l,method:"post",data:{order_no:c.order_no},raxConfig:{shouldRetry:()=>!1}}),d?.(),o()}catch{}finally{h(!1)}},cancelText:"取消",children:"请在新打开的页面上进行支付,支付完成后再关闭此窗口"})};function ve(e){const{result:t,returnUrl:n=location.href}=e;window.innerWidth<992?location.href=M.stringifyUrl({url:t.pay_url,query:{redirect_uri:ge(n)}}):(window.open(t.pay_url),oe(ye,e))}function we(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return e>=1024**3?(e/1024**3).toFixed(t)+"G":e>=1048576?(e/1048576).toFixed(t)+"M":(e/1024).toFixed(t)+"K"}function be(e){const t=A.extname(e);return!(!/^data:image\//.test(e)&&!/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(t))||!/^data:/.test(e)&&!t}const xe=_.div`
2
+ padding: 48px 32px;
3
+ `,ke=_.div`
4
+ margin-bottom: 24px;
5
+ text-align: center;
6
+ font-size: 72px;
7
+ `,Ce=_.div`
8
+ color: rgba(0, 0, 0, .85);
9
+ font-size: 24px;
10
+ line-height: 1.8;
11
+ text-align: center;
12
+ `,Ne=_.div`
13
+ margin-top: 32px;
14
+ text-align: center;
15
+ `,Se={success:n("i",{className:"bi bi-check-circle-fill text-success"}),error:n("i",{className:"bi bi-exclamation-circle-fill text-danger"}),info:n("i",{className:"bi bi-info-circle-fill text-info"}),warning:n("i",{className:"bi bi-exclamation-triangle-fill text-warning"})};function ze(e){let{status:t,title:o,icon:i,extra:a}=e;return!i&&t&&(i=Se[t]),r(xe,{children:[i&&n(ke,{children:i}),o&&n(Ce,{children:o}),a&&n(Ne,{children:a})]})}function Pe(e){let{active:t,inverted:r,...o}=e;return n(je,{$active:t,$inverted:r,...o})}_.div`
16
+ position: relative;
17
+ `;const je=_.div`
18
+ display: ${e=>e.$active?"flex":"none"};
19
+ position: absolute;
20
+ top: 0 !important;
21
+ left: 0 !important;
22
+ width: 100%;
23
+ height: 100%;
24
+ text-align: center;
25
+ vertical-align: middle;
26
+ padding: 1em;
27
+ background-color: ${e=>e.$inverted?"rgba(255, 255, 255, .85)":"rgba(0, 0, 0, .85)"};
28
+ opacity: ${e=>e.$active?1:0};
29
+ line-height: 1;
30
+ animation-fill-mode: both;
31
+ animation-duration: .5s;
32
+ transition: background-color .5s linear;
33
+ flex-direction: column;
34
+ align-items: center;
35
+ justify-content: center;
36
+ user-select: none;
37
+ will-change: opacity;
38
+ z-index: 990;
39
+ `;function $e(e){let{loading:t=!0,children:o,variant:i="primary",animation:a="border",wrap:s,...c}=e;return t?(o&&(o=n("p",{className:"mt-3 text-secondary",children:o})),o=r(Pe,{inverted:!0,active:!0,children:[n(k,{animation:a,variant:i,...c}),o]}),s?n(Te,{$height:"number"==typeof s?s:150,children:o}):o):null}const Te=_.div`
40
+ position: relative;
41
+ height: ${e=>`${e.$height}px`};
42
+ `;function He(e){let{children:t,title:i,className:a,...s}=e;return n(Be,{className:O("border-0 shadow-sm",a),...s,children:r("div",{className:"card-body",children:[i&&r(o,{children:[n("h5",{children:i}),n("hr",{})]}),t]})})}const Be=_(S)`
43
+ &:not(:last-child) {
44
+ margin-bottom: 1rem;
45
+ }
46
+ `;function Ee(e){let{errors:t}=e;return t?n(z,{variant:"danger",children:n("ul",{className:"mb-0",children:"string"==typeof t?n("li",{children:t}):Object.entries(t).map((e=>{let[t,r]=e;return n("li",{children:r},t)}))})}):null}function Le(e){let{children:t,className:r,size:o="small",direction:i="horizontal"}=e;"string"==typeof o&&(o={small:8,middle:16,large:24}[o]);const a=m.map(t,(e=>{if(e)return n(De,{children:e})}));return n(Me,{className:r,$direction:i,$size:o,children:a})}const Me=_.div`
47
+ display: inline-flex;
48
+ align-items: center;
49
+ gap: ${e=>e.$size}px;
50
+
51
+ ${e=>"vertical"===e.$direction&&I`
52
+ display: flex;
53
+ flex-direction: column;
54
+ align-items: inherit;
55
+ `}
56
+ `,De=_.div`
57
+
58
+ `,Fe=p((()=>import("./steps-b_BcYIwk.js"))),Ae=p((()=>import("./steps-b_BcYIwk.js").then((e=>{let{Step:t}=e;return{default:t}}))));function _e(e){return n(g,{fallback:null,children:n(Fe,{...e})})}const Ie=function(e){return n(g,{fallback:null,children:n(Ae,{...e})})};function Oe(e){let{title:t,content:o,footer:i}=e;return r(He,{children:[n(qe,{children:t}),n(We,{children:o}),i&&n(Ue,{children:i})]})}_e.Step=Ie;const Ue=_.div`
59
+ margin-top: 9px;
60
+ padding-top: 10px;
61
+ border-top: 1px solid #f0f0f0;
62
+ color: rgba(0, 0, 0, .65);
63
+ `,We=_.div`
64
+ color: rgba(0, 0, 0, .85);
65
+ font-size: 24px;
66
+ `,qe=_.div`
67
+ margin-bottom: 4px;
68
+ color: rgba(0, 0, 0, .45);
69
+ font-size: 1.1rem;
70
+ `;function Re(){}function Ve(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function Ge(e){return"current_page"in e}function Ke(e){let{total:t=0,onChange:r=Re,defaultCurrent:o=1,defaultPageSize:i=10,className:c,...l}=e;const[d,f]=a(o),[m,p]=a(i);s((()=>{Ve(l.current)&&f(l.current)}),[l.current]),s((()=>{Ve(l.pageSize)&&p(l.pageSize)}),[l.pageSize]);const g=h((()=>Math.floor((t-1)/m)+1),[t,m]),y=u((e=>()=>{e!==d&&(f(e),r(e,m))}),[r,d,m]),v=d-1>0?d-1:0,w=d+1<g?d+1:g,b=[];let x=null,k=null,C=null,N=null;if(g<=7)for(let e=1;e<=g;e+=1){const t=d===e;b.push(n(P.Item,{active:t,onClick:y(e),children:e},e))}else{N=n(P.Last,{onClick:y(g)},"last"),C=n(P.First,{onClick:y(1)},"first"),x=n(P.Prev,{onClick:y(v)},"prev"),k=n(P.Next,{onClick:y(w)},"next");let e=Math.max(1,d-2),t=Math.min(d+2,g);d-1<=2&&(t=5),g-d<=2&&(e=g-4);for(let r=e;r<=t;r+=1){const e=d===r;b.push(n(P.Item,{active:e,onClick:y(r),children:r},r))}d-1>=4&&3!==d&&b.unshift(x),g-d>=4&&d!==g-2&&b.push(k),1!==e&&b.unshift(C),t!==g&&b.push(N)}return n(P,{className:c,children:b})}function Je(e){let{className:t,value:r,locale:i="zh-CN",currency:a=!0,options:s={}}=e;const c=h((()=>{let e;return e=a?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2},new Intl.NumberFormat(i,{...e,...s})}),[a,i,s]);return t?n("span",{className:t,children:c.format(r)}):n(o,{children:c.format(r)})}function Qe(e){let{loading:t,disabled:r,children:o,...i}=e;return n(C,{...i,disabled:t||r,children:t?"Loading…":o})}const Ye=p((()=>import("./image-zoom-OrIPGqh0.js")));function Xe(e){return n(g,{fallback:null,children:n(Ye,{...e})})}const Ze=f(((e,t)=>{let{url:n,method:r,confirm:o,onSuccess:i,children:a,disabled:s,as:c=se,onError:l,...d}=e;const[h,f]=pe(!1),m=u((async e=>{e.preventDefault(),e.stopPropagation();try{if(f(!0),o&&!await le.confirm({message:o}))return;const e="string"==typeof n?{url:n,method:r}:{method:r,...n},t=await me(e);i&&i(t)}catch(e){if(!(e instanceof Error))throw e;l?l(e):de.error(e.message,{preventDuplicate:!0})}finally{f(!1)}}),[n,r,f]);return y(c,{...d,disabled:s||h,onClick:m,ref:t},a)})),et=p((()=>import("./index-RsyB6rNE.js"))),tt=f(((e,t)=>n(g,{fallback:null,children:n(et,{...e,ref:t})}))),nt=p((()=>import("./index-hGPlpT1_.js"))),rt=f(((e,t)=>n(g,{fallback:null,children:n(nt,{...e,ref:t})})));let ot=0;function it(){let{onHide:e,onShow:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[n,r]=a(!1),[o,i]=a(`visible-${ot}`),s=u((()=>{r(!1),e&&e()}),[r,e]),c=u((()=>{i("visible-"+ ++ot)}),[i,ot]);return{visible:n,show:u((()=>{r(!0),t&&t()}),[r,t]),hide:s,state:{show:n,onHide:s,onExited:c,key:o}}}const at=f(((e,t)=>{let{text:i,onOk:a,modalProps:s,children:c,onShow:l,onHide:d,confirmLoading:u,as:h=se,...f}=e;const{state:m,show:p,hide:g}=it({onShow:l,onHide:d});v(t,(()=>({close:g})));const w=y(h,{...f,onClick:p},i);return r(o,{children:[w,n(le,{header:i,...s,...m,confirmLoading:u,onOk:async e=>{if(a){!1===await a()&&e.preventDefault()}},children:c})]})})),st=f(((e,t)=>{let{text:o,onSuccess:s,onSubmit:c,buttonProps:l,modalProps:d,children:h,...f}=e;const[m,p]=a(!1),g=i(null),y=i(null);v(t,(()=>({close:()=>{g.current?.close()}})));const w=u((()=>(y.current?.submit(),!1)),[]),b=u((e=>{s&&s(e),g.current?.close()}),[s]),x=u((async(e,t)=>{c&&await c(e,t)&&g.current?.close()}),[c]);return n(at,{ref:g,text:o,...l,modalProps:d,onOk:w,confirmLoading:m,children:r(tt,{...f,onSubmitting:p,ref:y,onSuccess:b,onSubmit:x,children:[h,n("input",{type:"submit",hidden:!0})]})})}));function ct(e){let{header:t,children:o,closable:i=!0,show:a,onHide:s,bodyAs:c,headerAs:l="h5",...d}=e;return r(j,{...d,onHide:s,show:a,children:[t&&n(j.Header,{closeButton:i,children:n(j.Title,{as:l,children:t})}),n(j.Body,{as:c,children:o})]})}const lt=f(((e,t)=>{let{text:i,offcanvasProps:a,children:s,onShow:c,onHide:l,as:d=se,...u}=e;const{state:h,show:f,hide:m}=it({onShow:c,onHide:l});v(t,(()=>({close:m})));const p=y(d,{...u,onClick:f},i);return r(o,{children:[p,n(ct,{header:i,...a,...h,children:s})]})}));function dt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=i(e);return s((()=>{n.current=e})),u((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.current?.(...t)}),t)}function ut(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=((e,t)=>e!==t)}=e,i=dt(r),s=dt(o),[c,l]=a(n),d=void 0!==t,u=d?t:c,h=dt((e=>{const t="function"==typeof e?e(u):e;s(u,t)&&(d||l(t),i(t))}),[d,i,u,s]);return[u,h]}const ht=f(((e,t)=>{let{className:o,rowClassName:c,paginate:l=!0,sync:d=!1,columns:h=3,source:f,renderItem:m,renderEmpty:p}=e;const[g,y]=a([]),[w,b]=a(l?{total:0,current:1,pageSize:10}:null),[x,k]=a(!0),[C,N]=U({}),[S,z]=ut({value:d?C.page||1:void 0,defaultValue:1,onChange:e=>{d&&N({page:e||void 0})}}),P=u((async function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]||k(!0);try{let e;const t={page:S>1?S:void 0};e="string"==typeof f?await me({url:f,params:t}):await f(t),l&&Ge(e)&&(e.last_page>1&&b({total:e.total,current:e.current_page,pageSize:e.per_page}),e=e.data),y(e)}catch(e){}finally{k(!1)}}),[f,y,S]);s((()=>{P()}),[S]),s((()=>{j.current={reload:P}}),[P]);const j=i({reload:P});return v(t,(()=>j.current)),r(ft,{className:o,children:[n($e,{wrap:!0,loading:x}),0===g.length&&!x&&p?.(),n($,{className:c,children:g.map(((e,t)=>n(T,{className:"d-flex",md:12/h,children:m(e)},`card-${t}`)))}),w&&n(mt,{...w,onChange:z})]})})),ft=_.div`
71
+
72
+ `,mt=_(Ke)`
73
+ margin-bottom: 0;
74
+ justify-content: flex-end;
75
+ margin-top: 1rem;
76
+ `;var pt=w(ht);function gt(){const[e,t]=a(!1),n=i();return s((()=>()=>{n.current&&clearTimeout(n.current)}),[]),{copied:e,copy:u((e=>{W(e),t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout((()=>{t(!1),n.current=void 0}),3e3)}),[])}}function yt(e){let{as:t="div",className:r,content:o,tooltip:i=!0,placement:a}=e;const{copy:s,copied:c}=gt(),l=i?n("i",c?{className:"bi bi-clipboard-check"}:{className:"bi bi-clipboard"}):c?"已复制":"复制",d=y(t,{role:"button",className:r,onClick:()=>{"function"==typeof o&&(o=o()),s(o)}},l);return i?n(ie,{tooltip:c?"已复制":"复制",placement:a,children:d}):d}const vt=c({images:new Map,current:0,setCurrent:()=>null,setShow:()=>null,registerImage:()=>()=>null,getId:()=>0}),wt=p((()=>import("./index-r7u3jB8x.js"))),bt=p((()=>import("./image-PbUBAue-.js")));function xt(e){return n(g,{fallback:null,children:n(wt,{...e})})}xt.Image=function(e){return n(g,{fallback:null,children:n(bt,{...e})})},xt.Context=vt;const kt=p((()=>import("./infinite-scroller-w4QFOKyZ.js"))),Ct=f(((e,t)=>n(g,{fallback:null,children:n(kt,{...e,ref:t})}))),Nt=p((()=>import("./slider-KuqHu6UH.js")));function St(e){return n(g,{fallback:null,children:n(Nt,{...e})})}function zt(e){let{manual:t,refreshDeps:n,...r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{execute:o,currentParams:i,error:a,...c}=q((async t=>(e="string"==typeof e?{url:e}:e,await me({...e,...t}))),r);s((()=>{if(!t&&!n)try{o()}catch{}}),[]),s((()=>{n&&l()}),n);const l=u((async()=>{try{i?await o(...i):await o()}catch{}}),[o,i]);if(a&&he(a)){const e=a.errors;a=new Error("string"==typeof e?e:B(e).join(""))}return{refresh:l,execute:o,error:a,...c}}function Pt(e,t,n){const r=i(e),o=i(E(e,t,n));return s((()=>{r.current=e})),s((()=>{o.current=E((function(){r.current(...arguments)}),t,n)}),[t,n]),o.current}function jt(e){const[t,n]=a((()=>R("function"==typeof e?e():e,!0)));return[t,u((e=>{n("function"==typeof e?V(e):R(e))}),[])]}function $t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lg";function t(){const t=e=>{switch(e){case"xxl":return window.innerWidth>=1400;case"xl":return window.innerWidth>=1200;case"lg":return window.innerWidth>=992;case"md":return window.innerWidth>=768;case"sm":return window.innerWidth>=576;default:return!0}};return{isMobile:!t(e),width:window.innerWidth,match:t}}const[n,r]=a(t),o=Pt((()=>{r(t())}),100);return s((()=>(window.addEventListener("resize",o),()=>window.removeEventListener("resize",o))),[]),n}var Tt;!function(e){e[e.init=0]="init",e[e.play=1]="play",e[e.pause=2]="pause",e[e.end=3]="end"}(Tt||(Tt={}));const Ht=(e,t)=>{let n=i(!1);const[r,o]=a((()=>{const{lang:e="default",name:n=""}=t.voice||{};return{isPlaying:!1,status:Tt[Tt.init],lang:t.lang||"default",voiceInfo:{lang:e,name:n},rate:t.rate||1,pitch:t.pitch||1,volume:t.volume||1}})),c=u((()=>{n.current&&o((e=>({...e,isPlaying:!0,status:Tt[Tt.play]})))}),[]),l=u((()=>{n.current&&o((e=>({...e,isPlaying:!1,status:Tt[Tt.pause]})))}),[]),d=u((()=>{n.current&&o((e=>({...e,isPlaying:!1,status:Tt[Tt.end]})))}),[]);return s((()=>{n.current=!0;const r=new SpeechSynthesisUtterance(e);return t.lang&&(r.lang=t.lang),t.voice&&(r.voice=t.voice),r.rate=t.rate||1,r.pitch=t.pitch||1,r.volume=t.volume||1,r.onstart=c,r.onpause=l,r.onresume=c,r.onend=d,window.speechSynthesis.speak(r),()=>{n.current=!1}}),[]),r};export{yt as A,se as B,He as C,xt as D,Ee as E,tt as F,Ct as G,St as H,vt as I,zt as J,it as K,$e as L,Q as M,Je as N,lt as O,Ke as P,gt as Q,ze as R,Le as S,ae as T,Ht as U,he as V,fe as W,$t as a,ut as b,pe as c,jt as d,de as e,ue as f,we as g,be as h,Ge as i,ge as j,_e as k,Ie as l,Oe as m,Qe as n,Xe as o,Ze as p,rt as q,me as r,st as s,at as t,Pt as u,le as v,ve as w,ct as x,ie as y,pt as z};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import o,{getRegistry as r}from"@topthink/json-form";import*as a from"react";import{forwardRef as e,useState as n,useCallback as i}from"react";import s from"axios";import{b as p,r as m,B as l}from"./index-m6pAadP4.js";import{mapValues as c}from"lodash";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"query-string";import"retry-axios";import"notistack";import"path";import"styled-components";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"react-async-hook";import"immer";import"react-intersection-observer";const d=require("ajv-i18n/localize/zh"),u=a.lazy((()=>import("./editor-widget-CQ3zv-Xu.js"))),f=o=>t(a.Suspense,{fallback:null,children:t(u,{...o})}),h={upload:function(o){let{options:a,...e}=o;const{widgets:n}=r();return a.endpoint&&(a.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:r,value:e}=await m({url:a.endpoint,method:"post",data:o});return{url:r,value:e}}),t(n.upload,{...e,options:a})},avatar:function(o){let{options:a,...e}=o;const{widgets:n}=r();return a.endpoint&&(a.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:r}=await m({url:a.endpoint,method:"post",data:o});return r}),t(n.avatar,{...e,options:a})},editor:function(o){let{options:r,...a}=o;return r.endpoint&&(r.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:a}=await m({url:r.endpoint,method:"post",data:o});return a}),t(f,{...a,options:r})},typeahead:function(o){let{options:a,...e}=o;const{widgets:n}=r();return a.endpoint&&(a.onSearch=async t=>{let{value:o,query:r}=t;return await m({url:a.endpoint,params:{value:o,query:r}})}),t(n.typeahead,{...e,options:a})}},y=e(((r,a)=>{let{action:e,method:u="post",onSuccess:f,formData:y,onSubmitting:w,onSubmit:g,onChange:b,submitText:v="提交",transformData:x,children:D,...j}=r;const[S,k]=n(),[q,_]=p(!1),[z,E]=n(y),F=i((async(t,o)=>{if(!q)try{if(_(!0),w&&w(!0),e){let{formData:o}=t;x&&(o=x(o));try{const t=await m({url:e,method:u,data:o});return k(void 0),f&&await f(t),t}catch(t){if(!s.isAxiosError(t))throw t;k((t=>{const o=t.errors;return"string"==typeof o?{__errors:[o]}:c(o,(t=>({__errors:[t]})))})(t))}}else if(g)return await g(t,o)}finally{_(!1),w&&w(!1)}}),[e,u,g]),U=i((t=>{const{formData:o}=t;E(o),b&&b(t)}),[E,b]),C=i((t=>(t=t.map((t=>({keyword:t.name,dataPath:t.property,...t}))),d(t),t)),[]),N=t(l,{className:"px-4",loading:q,type:"submit",variant:"primary",children:v});return"function"==typeof D&&(D=D({submit:N,loading:q})),t(o,{ref:a,extraErrors:S,onSubmit:F,transformErrors:C,noHtml5Validate:!0,noValidate:!0,...j,formData:z,onChange:U,widgets:h,children:D||t("div",{className:"col-12",children:N})})}));export{y as default};
1
+ import{jsx as t}from"react/jsx-runtime";import o,{getRegistry as r}from"@topthink/json-form";import*as a from"react";import{forwardRef as e,useState as n,useCallback as i}from"react";import s from"axios";import{c as p,r as m,B as l}from"./index-J7csAYoa.js";import{mapValues as c}from"lodash";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"query-string";import"retry-axios";import"notistack";import"path";import"styled-components";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"react-async-hook";import"immer";import"react-intersection-observer";const d=require("ajv-i18n/localize/zh"),u=a.lazy((()=>import("./editor-widget-CQ3zv-Xu.js"))),f=o=>t(a.Suspense,{fallback:null,children:t(u,{...o})}),h={upload:function(o){let{options:a,...e}=o;const{widgets:n}=r();return a.endpoint&&(a.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:r,value:e}=await m({url:a.endpoint,method:"post",data:o});return{url:r,value:e}}),t(n.upload,{...e,options:a})},avatar:function(o){let{options:a,...e}=o;const{widgets:n}=r();return a.endpoint&&(a.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:r}=await m({url:a.endpoint,method:"post",data:o});return r}),t(n.avatar,{...e,options:a})},editor:function(o){let{options:r,...a}=o;return r.endpoint&&(r.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:a}=await m({url:r.endpoint,method:"post",data:o});return a}),t(f,{...a,options:r})},typeahead:function(o){let{options:a,...e}=o;const{widgets:n}=r();return a.endpoint&&(a.onSearch=async t=>{let{value:o,query:r}=t;return await m({url:a.endpoint,params:{value:o,query:r}})}),t(n.typeahead,{...e,options:a})}},y=e(((r,a)=>{let{action:e,method:u="post",onSuccess:f,formData:y,onSubmitting:w,onSubmit:g,onChange:v,submitText:b="提交",transformData:x,children:D,...j}=r;const[S,k]=n(),[q,_]=p(!1),[z,E]=n(y),F=i((async(t,o)=>{if(!q)try{if(_(!0),w&&w(!0),e){let{formData:o}=t;x&&(o=x(o));try{const t=await m({url:e,method:u,data:o});return k(void 0),f&&await f(t),t}catch(t){if(!s.isAxiosError(t))throw t;k((t=>{const o=t.errors;return"string"==typeof o?{__errors:[o]}:c(o,(t=>({__errors:[t]})))})(t))}}else if(g)return await g(t,o)}finally{_(!1),w&&w(!1)}}),[e,u,g]),U=i((t=>{const{formData:o}=t;E(o),v&&v(t)}),[E,v]),C=i((t=>(t=t.map((t=>({keyword:t.name,dataPath:t.property,...t}))),d(t),t)),[]),N=t(l,{className:"px-4",loading:q,type:"submit",variant:"primary",children:b});return"function"==typeof D&&(D=D({submit:N,loading:q})),t(o,{ref:a,extraErrors:S,onSubmit:F,transformErrors:C,noHtml5Validate:!0,noValidate:!0,...j,formData:z,onChange:U,widgets:h,children:D||t("div",{className:"col-12",children:N})})}));export{y as default};
@@ -0,0 +1,39 @@
1
+ import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"rc-table";import{unstable_batchedUpdates as o}from"react-dom";import{FormControl as a,Table as i}from"react-bootstrap";import{useUrlSearchParams as c}from"use-url-search-params";import{isEqual as l,omit as s}from"lodash";import*as d from"react";import{useState as p,useCallback as u,useRef as m,useEffect as h,useMemo as f,memo as g,forwardRef as v,useImperativeHandle as y}from"react";import{B as b,u as x,P as w,a as j,b as C,r as k,i as S,N as E,L as O,T as V,C as z,S as N}from"./index-J7csAYoa.js";import H from"styled-components";import M from"./index-RsyB6rNE.js";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"classnames";import"copy-to-clipboard";import"react-async-hook";import"immer";import"react-intersection-observer";import"@topthink/json-form";const q=function(t){let{indeterminate:r=!1,...n}=t;const o=m(null);return h((()=>{o.current&&(o.current.indeterminate=r)}),[r]),e("input",{ref:o,...n,className:"form-check-input",type:"checkbox"})};var K;function B(){return B=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},B.apply(this,arguments)}const P=e=>d.createElement("svg",B({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),K||(K=d.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.704"})));var F;function T(){return T=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},T.apply(this,arguments)}const D=e=>d.createElement("svg",T({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),F||(F=d.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.566"})));function I(r){let{data:n,options:o,columns:a,onSearch:i}=r;const[c,s]=p(0),[d,m]=p(n);h((()=>{l(n,d)||(m(n),s((e=>e+1)))}),[n]);const[g,v,y]=f((()=>{const e={"ui:col":10,"ui:order":o.order},t={},r={};o.fields.forEach((n=>{const i=a.find((e=>e.dataIndex===n));if(i){const a=i.title;if("string"==typeof a){if(e[n]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...o.ui?.[n]},i.valueEnum){const t=i.valueEnum;return e[n]["ui:placeholder"]="请选择",r[n]={title:a,type:"string",enum:Object.keys(t).flatMap((e=>"string"==typeof t[e].text?[e]:[])),enumNames:Object.keys(t).flatMap((e=>{const r=t[e].text;return"string"==typeof r?[r]:[]}))}}t[n]=void 0,r[n]={title:a,type:"string"}}}})),o.extraFields&&Object.entries(o.extraFields).forEach((n=>{let[a,i]=n;e[a]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...o.ui?.[a]},t[a]=void 0,r[a]={title:i,type:"string"}}));return[{type:"object",properties:r},e,t]}),[o.fields,o.extraFields]),x=u((e=>{let{formData:t}=e;m(t),i({...y,...t})}),[i,y]),w=u((()=>{i(y)}),[i,y]);return e(R,{children:e(M,{formContext:{layout:"horizontal"},schema:g,uiSchema:v,onSubmit:x,formData:d,children:e("div",{className:"col-2 ms-auto mt-auto",children:t("div",{className:"justify-content-end d-flex gap-2 ",children:[e(b,{className:"px-4",onClick:w,variant:"secondary",children:"重置"}),e(b,{className:"px-4",type:"submit",variant:"primary",children:"查询"})]})})})},c)}const R=H.div`
2
+ margin-bottom: 1rem;
3
+ `;function _(t){let{keyword:r,onKeywordChange:n}=t;const[o,i]=p(r),c=x(n,500);h((()=>{i(r)}),[r]);const l=u((e=>{i(e.target.value),c(e.target.value)}),[c,i]);return e(a,{value:o,onChange:l,type:"search",placeholder:"Search..."})}const A=H.thead`
4
+ th {
5
+ padding: 0.5rem 0.5rem;
6
+ border-bottom-width: 1px;
7
+ border-color: var(--bs-border-color);
8
+ }
9
+ `,L={table:t=>e(i,{...t,className:"mb-0 align-middle table-hover"}),header:{wrapper:t=>e(A,{...t})}},$=H.a`
10
+ cursor: pointer;
11
+ width: 28px;
12
+ height: 28px;
13
+ display: inline-flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ vertical-align: middle;
17
+ `,G=function(t){let{record:r,expanded:n,expandable:o,onExpand:a}=t;return e($,o?{onClick:e=>a(r,e),children:e(n?D:P,{})}:{})},J=H(w)`
18
+ margin-bottom: 0;
19
+ justify-content: flex-end;
20
+ margin-top: 1rem;
21
+ `,Q=v(((a,i)=>{let{source:l,rowKey:d="id",paginate:g=!0,toolBarRender:v,columns:b=[],search:x,rowSelection:w,card:N=!0,expandable:H={},sync:M=!1,ref:K,...B}=a;const[P,F]=p([]),[T,D]=p(g?{total:0,current:1,pageSize:10}:null),[R,A]=p(!0),{match:$}=j(),[Q,U]=c({}),[ee,te]=function(t,r,n){const[o,a]=p((()=>new Set(t?.selectedRowKeys||[]))),i=e=>"function"==typeof r?r(e):e[r],c=e=>n.find((t=>i(t)===e)),l=u((e=>{e instanceof Set||(e=new Set(e)),a(e);const r=Array.from(e),n=r.map((function(e){return c(e)}));t?.onChange&&t?.onChange(r,n)}),[c]);return[u((r=>{if(!t)return r;const a=n.map(i),c=a.every((function(e){return o.has(e)})),s=a.some((function(e){return o.has(e)}));return[{key:"selection",title:e(q,{checked:c&&n.length>0,indeterminate:!c&&s,onChange:()=>{c?a.forEach((function(e){o.delete(e)})):a.forEach((function(e){o.add(e)})),l(new Set(o))}}),width:30,align:"center",render(t){let{record:r}=t;const n=i(r),a=o.has(n);return e(q,{checked:a,onChange:()=>{a?o.delete(n):o.add(n),l(new Set(o))}})}},...r]}),[n,t,o]),l]}(w,d,P),re=f((()=>s(Q,["q","page"])),[Q]),[ne,oe]=C({value:M?re:void 0,defaultValue:{},onChange:e=>{M&&U(e)}}),[ae,ie]=C({value:M?Q.q||"":void 0,defaultValue:"",onChange:e=>{M&&U({q:e||void 0})}}),[ce,le]=C({value:M?Q.page||1:void 0,defaultValue:1,onChange:e=>{M&&U({page:e||void 0})}}),se=u((async function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]||A(!0),te([]);try{let e;const t={...ne,q:ae,page:ce>1?ce:void 0};e="string"==typeof l?await k({url:l,params:t}):await l(t),g&&S(e)&&(D({total:e.total,current:e.current_page,pageSize:e.per_page}),e=e.data),F(e)}catch(e){}finally{A(!1)}}),[l,F,ae,ce,ne]);h((()=>{se()}),[ae,ce,ne]);const de=m({reload:se});h((()=>{de.current={reload:se}}),[se]),y(i,(()=>de.current));const pe=f((()=>ee(b).flatMap((t=>{let{render:r,valueType:n,valueEnum:o,display:a,...i}=t;const c={...i};return a&&!$(a)?[]:(r?c.render=(e,t,n)=>r({value:e,record:t,index:n,action:de.current}):"currency"===n?c.render=t=>e(E,{value:t}):o&&(c.render=t=>o[t]?o[t].status?e("span",{className:`text-${o[t].status}`,children:o[t].text}):o[t].text:t),[c])}))),[b,ee,de,$]),ue=t(r,{children:[e(O,{loading:R}),"object"==typeof x&&e(I,{data:ne,columns:b,options:x,onSearch:e=>{o((()=>{le(1),oe(e)}))}}),!1!==v&&t(W,{children:[e(Y,{size:12,children:v&&v(de.current)}),t(X,{size:12,children:[!0===x&&e(_,{keyword:ae,onKeywordChange:e=>{o((()=>{le(1),ie(e)}))}}),e(Z,{onClick:()=>{de.current.reload()},children:e("i",{className:"bi bi-arrow-repeat"})})]})]}),e(V.Provider,{value:!0,children:e(n,{...B,expandable:{expandIcon:G,...H},rowKey:d,columns:pe,components:L,data:P})}),T&&e(J,{...T,onChange:le})]});return N?e(z,{children:ue}):ue}));var U=g(Q);const W=H.div`
22
+ display: flex;
23
+ justify-content: space-between;
24
+ padding-bottom: 1rem;
25
+ height: 48px;
26
+ border-bottom: 2px solid #212529;
27
+ `,X=H(N)`
28
+
29
+ `,Y=H(N)`
30
+
31
+ `,Z=H.span`
32
+ cursor: pointer;
33
+ font-size: 20px;
34
+ line-height: 1;
35
+
36
+ &:hover {
37
+ color: var(--bs-primary);
38
+ }
39
+ `;export{U as default};
@@ -1,4 +1,4 @@
1
- import{jsxs as t,jsx as r}from"react/jsx-runtime";import{useState as o,useCallback as e}from"react";import i,{useController as n,useLightboxState as a}from"yet-another-react-lightbox";import s from"yet-another-react-lightbox/plugins/counter";import l from"yet-another-react-lightbox/plugins/download";import m from"yet-another-react-lightbox/plugins/zoom";import p from"yet-another-react-lightbox/plugins/thumbnails";import"yet-another-react-lightbox/styles.css";import"yet-another-react-lightbox/plugins/counter.css";import"yet-another-react-lightbox/plugins/thumbnails.css";import"yet-another-react-lightbox/plugins/captions.css";import{I as c}from"./index-m6pAadP4.js";import u from"styled-components";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"lodash";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"react-async-hook";import"immer";import"react-intersection-observer";const d={counter:s,zoom:m,download:l,thumbnails:p};let h=0;function g(i){let{children:s,toolbar:l,plugins:m=["counter","zoom","download"]}=i;const[p,u]=o((()=>new Map)),[g,y]=o(),[x,f]=o(!1),w=e(((t,r)=>(u((o=>new Map(o).set(t,r))),()=>{u((r=>{const o=new Map(r);return o.delete(t)?o:r}))})),[]),_=Array.from(p.keys()),k=_.indexOf(g),v=_.map((t=>{const r=p.get(t);return"string"==typeof r?{src:r}:{render:r}})),j=e((()=>h++),[]);return t(c.Provider,{value:{images:p,current:g,setCurrent:y,setShow:f,registerImage:w,getId:j},children:[s,r(b,{plugins:m.map((t=>d[t])),open:x,index:k,close:()=>f(!1),slides:v,carousel:{finite:!0,preload:3},toolbar:l?.({useController:n,useLightboxState:a}),render:{buttonPrev:v.length<=1?()=>null:void 0,buttonNext:v.length<=1?()=>null:void 0,slide:t=>{let{slide:r}=t;if("render"in r)return r.render()}},controller:{closeOnBackdropClick:!0}})]})}const b=u(i)`
1
+ import{jsxs as t,jsx as r}from"react/jsx-runtime";import{useState as o,useCallback as e}from"react";import i,{useController as n,useLightboxState as a}from"yet-another-react-lightbox";import s from"yet-another-react-lightbox/plugins/counter";import l from"yet-another-react-lightbox/plugins/download";import m from"yet-another-react-lightbox/plugins/zoom";import p from"yet-another-react-lightbox/plugins/thumbnails";import"yet-another-react-lightbox/styles.css";import"yet-another-react-lightbox/plugins/counter.css";import"yet-another-react-lightbox/plugins/thumbnails.css";import"yet-another-react-lightbox/plugins/captions.css";import{I as c}from"./index-J7csAYoa.js";import u from"styled-components";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"lodash";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"react-async-hook";import"immer";import"react-intersection-observer";const d={counter:s,zoom:m,download:l,thumbnails:p};let h=0;function g(i){let{children:s,toolbar:l,plugins:m=["counter","zoom","download"]}=i;const[p,u]=o((()=>new Map)),[g,y]=o(),[x,f]=o(!1),w=e(((t,r)=>(u((o=>new Map(o).set(t,r))),()=>{u((r=>{const o=new Map(r);return o.delete(t)?o:r}))})),[]),_=Array.from(p.keys()),k=_.indexOf(g),v=_.map((t=>{const r=p.get(t);return"string"==typeof r?{src:r}:{render:r}})),j=e((()=>h++),[]);return t(c.Provider,{value:{images:p,current:g,setCurrent:y,setShow:f,registerImage:w,getId:j},children:[s,r(b,{plugins:m.map((t=>d[t])),open:x,index:k,close:()=>f(!1),slides:v,carousel:{finite:!0,preload:3},toolbar:l?.({useController:n,useLightboxState:a}),render:{buttonPrev:v.length<=1?()=>null:void 0,buttonNext:v.length<=1?()=>null:void 0,slide:t=>{let{slide:r}=t;if("render"in r)return r.render()}},controller:{closeOnBackdropClick:!0}})]})}const b=u(i)`
2
2
  --yarl__color_backdrop: rgba(0, 0, 0, .7);
3
3
  --yarl__thumbnails_container_background_color: rgba(0, 0, 0, .9);
4
4
  `;export{g as default};
package/es/index.js CHANGED
@@ -1 +1 @@
1
- export{B as Button,C as Card,y as CardList,z as Clipboard,E as Error,F as Form,n as ImageZoom,D as InfiniteScroller,A as Lightbox,L as Loader,m as LoadingButton,M as Message,t as Modal,s as ModalButton,q as ModalForm,N as NumberFormat,v as Offcanvas,O as OffcanvasButton,P as Pagination,o as RequestButton,R as Result,G as Slider,S as Space,l as Statistic,k as Step,j as Steps,p as Table,d as Toast,x as Tooltip,f as formatSize,h as getAbsoluteUrl,g as isImageUrl,e as isRecord,Q as isRequestError,r as request,U as showRequestError,K as useClipboard,a as useControllableState,u as useDebounce,c as useImmer,J as useOverlayState,H as useRequest,b as useSafeState,w as waitPayComplete}from"./index-m6pAadP4.js";export{StyleSheetManager,ThemeProvider,createGlobalStyle,css,keyframes,default as styled}from"styled-components";export{useAsync,useAsyncCallback}from"react-async-hook";export{useInView}from"react-intersection-observer";export{SnackbarProvider as ToastProvider}from"notistack";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react/jsx-runtime";import"react";import"react-bootstrap";import"lodash";import"axios";import"query-string";import"retry-axios";import"path";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"immer";
1
+ export{B as Button,C as Card,z as CardList,A as Clipboard,E as Error,F as Form,o as ImageZoom,G as InfiniteScroller,D as Lightbox,L as Loader,n as LoadingButton,M as Message,v as Modal,t as ModalButton,s as ModalForm,N as NumberFormat,x as Offcanvas,O as OffcanvasButton,P as Pagination,p as RequestButton,R as Result,H as Slider,S as Space,m as Statistic,l as Step,k as Steps,q as Table,e as Toast,y as Tooltip,g as formatSize,j as getAbsoluteUrl,h as isImageUrl,f as isRecord,V as isRequestError,r as request,W as showRequestError,Q as useClipboard,b as useControllableState,u as useDebounce,d as useImmer,K as useOverlayState,J as useRequest,c as useSafeState,U as useSpeech,a as useWindowSize,w as waitPayComplete}from"./index-J7csAYoa.js";export{StyleSheetManager,ThemeProvider,createGlobalStyle,css,keyframes,default as styled}from"styled-components";export{useAsync,useAsyncCallback}from"react-async-hook";export{useInView}from"react-intersection-observer";export{SnackbarProvider as ToastProvider}from"notistack";export{default as queryString}from"query-string";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react/jsx-runtime";import"react";import"react-bootstrap";import"lodash";import"axios";import"retry-axios";import"path";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"immer";
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import{memo as e,forwardRef as a,useState as o,useCallback as r,useImperativeHandle as s}from"react";import i from"react-infinite-scroller";import{c as n,r as m}from"./index-m6pAadP4.js";import{last as d}from"lodash";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"styled-components";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"react-async-hook";import"immer";import"react-intersection-observer";var c=e(a(((e,a)=>{let{source:c,render:p,as:l,useWindow:f,className:u,getState:h,limit:y=10}=e;const[g,w]=o(!1),[v,x]=n({offset:void 0,end:!1,data:[]}),b=r((async function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!g){w(!0);try{let e;const a={offset:t?void 0:v.offset};e="string"==typeof c?await m({url:c,params:a}):await c(a),h||(h=t=>({offset:d(t)?.id,end:t.length<y,data:t}));const{offset:o,end:r,data:s}=h(e);x({offset:o,end:r,data:t?s:[...v.data,...s]})}catch{x({...v,end:!0})}finally{w(!1)}}}),[c,v,h,g]),j=r((()=>{b(!0)}),[b]);s(a,(()=>({reload:j})),[j]);const k=r((t=>{x((e=>{const a=t(e.data);a&&(e.data=a)}))}),[x]);return t(i,{className:u,hasMore:!v.end,pageStart:0,loadMore:()=>{b()},useWindow:f,element:l,children:p({data:v.data,setData:k,end:v.end,loading:g,action:{reload:j}})})})));export{c as default};
1
+ import{jsx as t}from"react/jsx-runtime";import{memo as e,forwardRef as a,useState as o,useCallback as r,useImperativeHandle as s}from"react";import i from"react-infinite-scroller";import{d as n,r as d}from"./index-J7csAYoa.js";import{last as m}from"lodash";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"styled-components";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"react-async-hook";import"immer";import"react-intersection-observer";var c=e(a(((e,a)=>{let{source:c,render:p,as:l,useWindow:f,className:u,getState:h,limit:y=10}=e;const[g,w]=o(!1),[v,x]=n({offset:void 0,end:!1,data:[]}),b=r((async function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!g){w(!0);try{let e;const a={offset:t?void 0:v.offset};e="string"==typeof c?await d({url:c,params:a}):await c(a),h||(h=t=>({offset:m(t)?.id,end:t.length<y,data:t}));const{offset:o,end:r,data:s}=h(e);x({offset:o,end:r,data:t?s:[...v.data,...s]})}catch{x({...v,end:!0})}finally{w(!1)}}}),[c,v,h,g]),j=r((()=>{b(!0)}),[b]);s(a,(()=>({reload:j})),[j]);const k=r((t=>{x((e=>{const a=t(e.data);a&&(e.data=a)}))}),[x]);return t(i,{className:u,hasMore:!v.end,pageStart:0,loadMore:()=>{b()},useWindow:f,element:l,children:p({data:v.data,setData:k,end:v.end,loading:g,action:{reload:j}})})})));export{c as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topthink/components",
3
- "version": "1.0.94",
3
+ "version": "1.0.96",
4
4
  "scripts": {
5
5
  "prebuild": "rimraf es types",
6
6
  "build": "rollup -c --environment NODE_ENV:production",
@@ -19,10 +19,9 @@
19
19
  "@babel/runtime": "^7.11.2",
20
20
  "@toast-ui/editor": "^3.2.2",
21
21
  "@toast-ui/react-editor": "^3.2.3",
22
- "@topthink/bootstrap": "^1.0.25",
23
- "@topthink/json-form": "^1.0.54",
22
+ "@topthink/bootstrap": "^1.0.26",
23
+ "@topthink/json-form": "^1.0.55",
24
24
  "@types/react-infinite-scroller": "^1.2.5",
25
- "@types/styled-components": "^5.1.11",
26
25
  "ajv-i18n": "^4.0.0",
27
26
  "axios": "^0.27.2",
28
27
  "classnames": "^2.3.1",
@@ -32,13 +31,13 @@
32
31
  "query-string": "^8.1.0",
33
32
  "rc-slider": "^10.6.2",
34
33
  "rc-steps": "^4.1.4",
35
- "rc-table": "^7.31.1",
34
+ "rc-table": "^7.47.1",
36
35
  "react-async-hook": "^4.0.0",
37
36
  "react-infinite-scroller": "^1.2.6",
38
37
  "react-intersection-observer": "^9.10.2",
39
38
  "react-medium-image-zoom": "^5.1.6",
40
39
  "retry-axios": "^2.6.0",
41
- "styled-components": "^5.3.0",
40
+ "styled-components": "^6.1.11",
42
41
  "sweetalert2": "^11.0.18",
43
42
  "sweetalert2-react-content": "^4.1.0",
44
43
  "use-url-search-params": "^2.5.1",
@@ -71,5 +70,5 @@
71
70
  },
72
71
  "author": "yunwuxin <tzzhangyajun@qq.com> (https://github.com/yunwuxin)",
73
72
  "license": "MIT",
74
- "gitHead": "cc4e5acc920c6df3eb51177e96553526c21875e4"
73
+ "gitHead": "363c317dc9452f6546c1142ebbb789c3eb7fe24e"
75
74
  }
@@ -1,7 +1,8 @@
1
- export declare const Dimmable: import("styled-components").StyledComponent<"div", any, {}, never>;
1
+ import { PropsWithChildren } from 'react';
2
+ export declare const Dimmable: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
3
  interface DimmerProps {
3
4
  active?: boolean;
4
5
  inverted?: boolean;
5
6
  }
6
- declare const Dimmer: import("styled-components").StyledComponent<"div", any, DimmerProps, never>;
7
- export default Dimmer;
7
+ export default function Dimmer({ active, inverted, ...props }: PropsWithChildren<DimmerProps>): JSX.Element;
8
+ export {};
@@ -17,6 +17,7 @@ interface ColumnType<RecordType> extends BsColumnType<RecordType> {
17
17
  text: ReactNode;
18
18
  status?: string;
19
19
  }>;
20
+ display?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
20
21
  }
21
22
  export type Columns<RecordType = any> = ColumnType<RecordType>[];
22
23
  export interface TableRowSelection<RecordType = any> {
@@ -0,0 +1,16 @@
1
+ type SpeechOptions = {
2
+ lang: string;
3
+ voice?: SpeechSynthesisVoice;
4
+ rate: number;
5
+ pitch: number;
6
+ volume: number;
7
+ };
8
+ export type ISpeechOptions = Partial<SpeechOptions>;
9
+ export type VoiceInfo = Pick<SpeechSynthesisVoice, 'lang' | 'name'>;
10
+ export type ISpeechState = SpeechOptions & {
11
+ isPlaying: boolean;
12
+ status: string;
13
+ voiceInfo: VoiceInfo;
14
+ };
15
+ declare const useSpeech: (text: string, options: ISpeechOptions) => ISpeechState;
16
+ export default useSpeech;
@@ -0,0 +1,12 @@
1
+ export declare const DEVICES: {
2
+ readonly desktop: "desktop";
3
+ readonly mobile: "mobile";
4
+ };
5
+ type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
6
+ type WindowSize = {
7
+ isMobile: boolean;
8
+ width: number;
9
+ match: (breakpoint: Breakpoint) => boolean;
10
+ };
11
+ export default function useWindowSize(breakpoint?: Breakpoint): WindowSize;
12
+ export {};
package/types/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import './utils/update-vh';
1
2
  export { default as Message } from './utils/message';
2
3
  export { default as waitPayComplete } from './utils/wait-pay-complete';
3
4
  export { default as Toast } from './utils/toast';
@@ -39,9 +40,12 @@ export { default as useDebounce } from './hooks/use-debounce';
39
40
  export { default as useSafeState } from './hooks/use-safe-state';
40
41
  export { default as useImmer } from './hooks/use-immer';
41
42
  export { default as useClipboard } from './hooks/use-clipboard';
43
+ export { default as useWindowSize } from './hooks/use-window-size';
44
+ export { default as useSpeech } from './hooks/use-speech';
42
45
  export { default as request, RequestConfig, RequestInstance, isRequestError, showRequestError } from './request';
43
46
  export type { UiSchema as FormUiSchema, Schema as FormSchema, WidgetProps as FormWidgetProps, Widget as FormWidget, IChangeEvent as FormChangeEvent, ISubmitEvent as FormSubmitEvent } from '@topthink/json-form';
44
47
  export { default as styled, css, keyframes, createGlobalStyle, StyleSheetManager, ThemeProvider } from 'styled-components';
45
48
  export { useAsync, useAsyncCallback } from 'react-async-hook';
46
49
  export { useInView } from 'react-intersection-observer';
47
50
  export { SnackbarProvider as ToastProvider } from 'notistack';
51
+ export { default as queryString } from 'query-string';
@@ -0,0 +1 @@
1
+ declare const updateVH: () => void;
@@ -5,6 +5,7 @@ interface PayResult {
5
5
  interface Options {
6
6
  result: PayResult;
7
7
  checkUrl: string;
8
+ returnUrl?: string;
8
9
  onComplete?: () => void;
9
10
  }
10
11
  export default function waitPayComplete(options: Options): void;
@@ -1,72 +0,0 @@
1
- import e from"sweetalert2/dist/sweetalert2.js";import t from"sweetalert2-react-content";import{jsx as n,jsxs as r,Fragment as o}from"react/jsx-runtime";import{useRef as i,useState as a,useEffect as s,createContext as c,Fragment as l,useContext as d,useCallback as u,useMemo as f,forwardRef as m,Children as h,lazy as p,Suspense as g,createElement as y,useImperativeHandle as b,memo as v}from"react";import{OverlayTrigger as x,Tooltip as w,Spinner as k,Button as C,Modal as N,Card as S,Alert as j,Pagination as z,Offcanvas as T,Row as P,Col as B}from"react-bootstrap";import{uniqueId as H,values as $,debounce as E}from"lodash";import D from"axios";import F from"query-string";import*as M from"retry-axios";import{enqueueSnackbar as A}from"notistack";import L from"path";import O,{css as I}from"styled-components";import _ from"classnames";import{useUrlSearchParams as U}from"use-url-search-params";import R from"copy-to-clipboard";import{useAsyncCallback as q}from"react-async-hook";import{freeze as G,produce as V}from"immer";import"react-intersection-observer";const K=t(e),J={confirmButtonText:"确定",cancelButtonText:"取消"},Q={confirm:async e=>{const{isConfirmed:t}=await K.fire({...J,icon:"warning",showCancelButton:!0,...e,async preConfirm(t){if(e.preConfirm)try{return await e.preConfirm(t)}catch(e){return e instanceof Error&&K.showValidationMessage(e.message),!1}return!0}});return t},success:e=>{K.fire({...J,toast:!0,position:"top",icon:"success",timer:2e3,showConfirmButton:!1,...e})},error:e=>{K.fire({...J,toast:!0,position:"top",icon:"error",timer:5e3,showConfirmButton:!1,...e})},close:e=>{K.close(e)},defaults:J};const Y=c({});function W(e){return t=>{let{resolve:r,destroy:o,message:c}=t;const[l,m]=function(e){const t=i(null),[n,r]=a(e);return s((()=>{t.current&&(t.current(),t.current=null)}),[n]),[n,(e,n)=>{t.current="function"==typeof n?n:null,r(e)}]}(!0),h=d(Y),p=u((e=>{m(!1,(()=>{r(e)}))}),[m,r]),g=f((()=>({show:l,onHide:()=>p(),onExited:()=>o(),container:h.container})),[l,p,o]);return n(e,{resolve:p,state:g,message:c})}}function X(e){return t=>new Promise((r=>{const o=n(e,{resolve:r,destroy:()=>{ne(o)},message:t});te(o)}))}let Z=()=>{},ee=new Set;const te=e=>{ee=new Set(ee),ee.add(e),Z(ee)},ne=e=>{ee=new Set(ee),ee.delete(e),Z(ee)};function re(e,t){return X(W(e))(t)}function oe(e){let{tooltip:t,children:r,placement:o="bottom"}=e;return n(x,{placement:o,overlay:n(w,{id:H(),children:t}),children:r})}const ie=c(!1),ae=m(((e,t)=>{let{loading:i,percent:a,disabled:s,children:c,tooltip:l,variant:u,...f}=e;d(ie)&&!u&&(u="link"),i&&(s=!0,c=r(o,{children:[n(k,{ref:t,as:"span",size:"sm",role:"status","aria-hidden":"true",animation:"border"}),a?r("span",{className:"ms-2",children:[a,"%"]}):null]}));const m=n(C,{ref:t,...f,variant:u,disabled:s,children:c});return l?n(oe,{tooltip:l,children:n("span",{className:"d-inline-block",children:m})}):m})),se=function(e){let{state:t,message:{title:o,message:i,okText:a,cancelText:s},resolve:c}=e;return r(N,{...t,children:[n(N.Header,{children:n(N.Title,{as:"h5",children:o||"确认"})}),n(N.Body,{children:i}),r(N.Footer,{children:[n(ae,{variant:"secondary",onClick:()=>c(),children:s||"取消"}),n(ae,{onClick:()=>c(!0),children:a||"确定"})]})]})};const ce=e=>{let{header:t,children:i,footer:s,closable:c=!0,show:l,cancelText:d="取消",okText:u="确定",onOk:m,onCancel:h,onHide:p,okButtonProps:g,bodyAs:y,headerAs:b="h5",confirmLoading:v=!1,...x}=e;const[w,k]=a(!1),C=f((()=>n(ae,{loading:w||v,variant:"primary",onClick:async e=>{k(!0);try{await(m?.(e)),e.defaultPrevented||p?.()}finally{k(!1)}},...g,children:u})),[g,u,m,p,w,v]),S=f((()=>n(ae,{variant:"secondary",onClick:e=>{h?.(e),e.defaultPrevented||p?.()},children:d})),[h,p,d]),j={close:()=>{p?.()}};switch(typeof s){case"undefined":s=r(o,{children:[S,C]});break;case"function":s=s({okButton:C,cancelButton:S,action:j})}return r(N,{...x,onHide:p,show:l,children:[t&&n(N.Header,{closeButton:c,children:n(N.Title,{as:b,children:t})}),n(N.Body,{as:y,children:i}),s&&n(N.Footer,{children:s})]})};ce.Message=function(e){const[t,r]=a(ee);return s((()=>{Z=r}),[]),n(Y.Provider,{value:e,children:Array.from(t).map(((e,t)=>n(l,{children:e},`message-${t}`)))})},ce.confirm=function(e){return X(W(se))(e)},ce.show=re;const le=["default","error","warning","success","info"].reduce(((e,t)=>(e[t]=(e,n)=>A(e,{variant:t,autoHideDuration:3e3,anchorOrigin:{vertical:"top",horizontal:"center"},...n}),e)),{});function de(e){return e&&"object"==typeof e}M.attach(),D.defaults.raxConfig={retryDelay:2e3,backoffType:"static",shouldRetry:e=>{let{config:t,response:n}=e;return!(t.raxConfig?.retryDecider&&!t.raxConfig.retryDecider())&&("GET"===t.method?.toUpperCase()&&449===n?.status)}},D.defaults.maxContentLength=1/0,D.defaults.maxBodyLength=1/0,D.defaults.baseURL="/api",D.defaults.authTokenName="authorization",D.interceptors.request.use((e=>{const t=e.authTokenName;if(t){const n=localStorage.getItem(t);n&&(e.headers={Authorization:`Bearer ${n}`,...e.headers})}return e}),(e=>Promise.reject(e))),D.interceptors.response.use((e=>(201===e.status&&e.data.location&&(window.location.href=e.data.location,e.data=void 0),e)),(e=>{if(D.isAxiosError(e)&&e.response){const{data:t,status:n}=e.response;401===n?e.errors="Unauthorized":de(t)?422===n?e.errors=t:"message"in t&&(e.errors=t.message):e.errors=t,"string"!=typeof e.errors?e.message=Object.values(e.errors).join("<br />"):e.message=e.errors}return Promise.reject(e)}));const ue=D.isAxiosError,fe=e=>{if(!D.isAxiosError(e))throw e;le.error(e.message)},me=async function(e){if(e="string"==typeof e?{url:e}:e,(e={paramsSerializer:function(e){return F.stringify(e,{sort:!1,skipNull:!0,skipEmptyString:!0,arrayFormat:"bracket"})},...e}).onMessage){let t=0,n="",r=null;const o=e.onMessage;e.onDownloadProgress=e=>{const i=e.target,{responseText:a}=i;for(;t<e.loaded;){const e=a.substring(t,++t);if(n+=e,"\n"===e){if(r||(r={id:"",event:"",data:""}),"\n"===n)o(r),r=null;else{const e=n.match(/^data:(?<data>.*)/);e&&(r.data=e.groups.data.trim())}n=""}}}}const{data:t}=await D.request(e);return t};me.defaults=D.defaults,me.interceptors=D.interceptors;function he(e){const t=(()=>{const e=i(!1);return s((()=>(e.current=!1,()=>{e.current=!0})),[]),e})(),[n,r]=a(e);return[n,u((e=>{t.current||r(e)}),[])]}const pe=function(e){let{state:t,message:r,resolve:o}=e;const a=i(!0),{result:c,checkUrl:l,onComplete:d}=r,[u,f]=he(!1);return s((()=>{me({url:l,method:"post",data:{order_no:c.order_no},raxConfig:{shouldRetry:e=>a.current&&449===e.response?.status}}).then((()=>{d?.(),o()})).catch((()=>null))}),[]),n(ce,{...t,centered:!0,onHide:()=>{a.current=!1,t.onHide()},backdrop:"static",header:"支付结果",okText:"已完成支付",okButtonProps:{loading:u},onOk:async e=>{e.preventDefault();try{f(!0),await me({url:l,method:"post",data:{order_no:c.order_no},raxConfig:{shouldRetry:()=>!1}}),d?.(),o()}catch{}finally{f(!1)}},cancelText:"取消",children:"请在新打开的页面上进行支付,支付完成后再关闭此窗口"})};function ge(e){const{result:t}=e;window.open(t.pay_url),re(pe,e)}function ye(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return e>=1024**3?(e/1024**3).toFixed(t)+"G":e>=1048576?(e/1048576).toFixed(t)+"M":(e/1024).toFixed(t)+"K"}function be(e){const t=L.extname(e);return!(!/^data:image\//.test(e)&&!/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(t))||!/^data:/.test(e)&&!t}function ve(e){const t=document.createElement("a");return t.href=e,t.href}const xe=O.div`
2
- padding: 48px 32px;
3
- `,we=O.div`
4
- margin-bottom: 24px;
5
- text-align: center;
6
- font-size: 72px;
7
- `,ke=O.div`
8
- color: rgba(0, 0, 0, .85);
9
- font-size: 24px;
10
- line-height: 1.8;
11
- text-align: center;
12
- `,Ce=O.div`
13
- margin-top: 32px;
14
- text-align: center;
15
- `,Ne={success:n("i",{className:"bi bi-check-circle-fill text-success"}),error:n("i",{className:"bi bi-exclamation-circle-fill text-danger"}),info:n("i",{className:"bi bi-info-circle-fill text-info"}),warning:n("i",{className:"bi bi-exclamation-triangle-fill text-warning"})};function Se(e){let{status:t,title:o,icon:i,extra:a}=e;return!i&&t&&(i=Ne[t]),r(xe,{children:[i&&n(we,{children:i}),o&&n(ke,{children:o}),a&&n(Ce,{children:a})]})}O.div`
16
- position: relative;
17
- `;const je=O.div`
18
- display: ${e=>e.active?"flex":"none"};
19
- position: absolute;
20
- top: 0 !important;
21
- left: 0 !important;
22
- width: 100%;
23
- height: 100%;
24
- text-align: center;
25
- vertical-align: middle;
26
- padding: 1em;
27
- background-color: ${e=>e.inverted?"rgba(255, 255, 255, .85)":"rgba(0, 0, 0, .85)"};
28
- opacity: ${e=>e.active?1:0};
29
- line-height: 1;
30
- animation-fill-mode: both;
31
- animation-duration: .5s;
32
- transition: background-color .5s linear;
33
- flex-direction: column;
34
- align-items: center;
35
- justify-content: center;
36
- user-select: none;
37
- will-change: opacity;
38
- z-index: 990;
39
- `;function ze(e){let{loading:t=!0,children:o,variant:i="primary",animation:a="border",wrap:s,...c}=e;return t?(o&&(o=n("p",{className:"mt-3 text-secondary",children:o})),o=r(je,{inverted:!0,active:!0,children:[n(k,{animation:a,variant:i,...c}),o]}),s?n(Te,{$height:"number"==typeof s?s:150,children:o}):o):null}const Te=O.div`
40
- position: relative;
41
- height: ${e=>`${e.$height}px`};
42
- `;function Pe(e){let{children:t,title:i,className:a,...s}=e;return n(S,{className:_("border-0 shadow-sm mb-3",a),...s,children:r("div",{className:"card-body",children:[i&&r(o,{children:[n("h5",{children:i}),n("hr",{})]}),t]})})}function Be(e){let{errors:t}=e;return t?n(j,{variant:"danger",children:n("ul",{className:"mb-0",children:"string"==typeof t?n("li",{children:t}):Object.entries(t).map((e=>{let[t,r]=e;return n("li",{children:r},t)}))})}):null}function He(e){let{children:t,className:r,size:o="small",direction:i="horizontal"}=e;"string"==typeof o&&(o={small:8,middle:16,large:24}[o]);const a=h.map(t,(e=>{if(e)return n(Ee,{children:e})}));return n($e,{className:r,$direction:i,$size:o,children:a})}const $e=O.div`
43
- display: inline-flex;
44
- align-items: center;
45
- gap: ${e=>e.$size}px;
46
-
47
- ${e=>"vertical"===e.$direction&&I`
48
- display: flex;
49
- flex-direction: column;
50
- align-items: inherit;
51
- `}
52
- `,Ee=O.div`
53
-
54
- `,De=p((()=>import("./steps-b_BcYIwk.js"))),Fe=p((()=>import("./steps-b_BcYIwk.js").then((e=>{let{Step:t}=e;return{default:t}}))));function Me(e){return n(g,{fallback:null,children:n(De,{...e})})}const Ae=function(e){return n(g,{fallback:null,children:n(Fe,{...e})})};function Le(e){let{title:t,content:o,footer:i}=e;return r(Pe,{children:[n(_e,{children:t}),n(Ie,{children:o}),i&&n(Oe,{children:i})]})}Me.Step=Ae;const Oe=O.div`
55
- margin-top: 9px;
56
- padding-top: 10px;
57
- border-top: 1px solid #f0f0f0;
58
- color: rgba(0, 0, 0, .65);
59
- `,Ie=O.div`
60
- color: rgba(0, 0, 0, .85);
61
- font-size: 24px;
62
- `,_e=O.div`
63
- margin-bottom: 4px;
64
- color: rgba(0, 0, 0, .45);
65
- font-size: 1.1rem;
66
- `;function Ue(){}function Re(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function qe(e){return"current_page"in e}function Ge(e){let{total:t=0,onChange:r=Ue,defaultCurrent:o=1,defaultPageSize:i=10,className:c,...l}=e;const[d,m]=a(o),[h,p]=a(i);s((()=>{Re(l.current)&&m(l.current)}),[l.current]),s((()=>{Re(l.pageSize)&&p(l.pageSize)}),[l.pageSize]);const g=f((()=>Math.floor((t-1)/h)+1),[t,h]),y=u((e=>()=>{e!==d&&(m(e),r(e,h))}),[r,d,h]),b=d-1>0?d-1:0,v=d+1<g?d+1:g,x=[];let w=null,k=null,C=null,N=null;if(g<=7)for(let e=1;e<=g;e+=1){const t=d===e;x.push(n(z.Item,{active:t,onClick:y(e),children:e},e))}else{N=n(z.Last,{onClick:y(g)},"last"),C=n(z.First,{onClick:y(1)},"first"),w=n(z.Prev,{onClick:y(b)},"prev"),k=n(z.Next,{onClick:y(v)},"next");let e=Math.max(1,d-2),t=Math.min(d+2,g);d-1<=2&&(t=5),g-d<=2&&(e=g-4);for(let r=e;r<=t;r+=1){const e=d===r;x.push(n(z.Item,{active:e,onClick:y(r),children:r},r))}d-1>=4&&3!==d&&x.unshift(w),g-d>=4&&d!==g-2&&x.push(k),1!==e&&x.unshift(C),t!==g&&x.push(N)}return n(z,{className:c,children:x})}function Ve(e){let{className:t,value:r,locale:i="zh-CN",currency:a=!0,options:s={}}=e;const c=f((()=>{let e;return e=a?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2},new Intl.NumberFormat(i,{...e,...s})}),[a,i,s]);return t?n("span",{className:t,children:c.format(r)}):n(o,{children:c.format(r)})}function Ke(e){let{loading:t,disabled:r,children:o,...i}=e;return n(C,{...i,disabled:t||r,children:t?"Loading…":o})}const Je=p((()=>import("./image-zoom-OrIPGqh0.js")));function Qe(e){return n(g,{fallback:null,children:n(Je,{...e})})}const Ye=m(((e,t)=>{let{url:n,method:r,confirm:o,onSuccess:i,children:a,disabled:s,as:c=ae,onError:l,...d}=e;const[f,m]=he(!1),h=u((async e=>{e.preventDefault(),e.stopPropagation();try{if(m(!0),o&&!await ce.confirm({message:o}))return;const e="string"==typeof n?{url:n,method:r}:{method:r,...n},t=await me(e);i&&i(t)}catch(e){if(!(e instanceof Error))throw e;l?l(e):le.error(e.message,{preventDuplicate:!0})}finally{m(!1)}}),[n,r,m]);return y(c,{...d,disabled:s||f,onClick:h,ref:t},a)})),We=p((()=>import("./index-euR0AgSF.js"))),Xe=m(((e,t)=>n(g,{fallback:null,children:n(We,{...e,ref:t})}))),Ze=p((()=>import("./index-qakColgP.js"))),et=m(((e,t)=>n(g,{fallback:null,children:n(Ze,{...e,ref:t})})));let tt=0;function nt(){let{onHide:e,onShow:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[n,r]=a(!1),[o,i]=a(`visible-${tt}`),s=u((()=>{r(!1),e&&e()}),[r,e]),c=u((()=>{i("visible-"+ ++tt)}),[i,tt]);return{visible:n,show:u((()=>{r(!0),t&&t()}),[r,t]),hide:s,state:{show:n,onHide:s,onExited:c,key:o}}}const rt=m(((e,t)=>{let{text:i,onOk:a,modalProps:s,children:c,onShow:l,onHide:d,confirmLoading:u,as:f=ae,...m}=e;const{state:h,show:p,hide:g}=nt({onShow:l,onHide:d});b(t,(()=>({close:g})));const v=y(f,{...m,onClick:p},i);return r(o,{children:[v,n(ce,{header:i,...s,...h,confirmLoading:u,onOk:async e=>{if(a){!1===await a()&&e.preventDefault()}},children:c})]})})),ot=m(((e,t)=>{let{text:o,onSuccess:s,onSubmit:c,buttonProps:l,modalProps:d,children:f,...m}=e;const[h,p]=a(!1),g=i(null),y=i(null);b(t,(()=>({close:()=>{g.current?.close()}})));const v=u((()=>(y.current?.submit(),!1)),[]),x=u((e=>{s&&s(e),g.current?.close()}),[s]),w=u((async(e,t)=>{c&&await c(e,t)&&g.current?.close()}),[c]);return n(rt,{ref:g,text:o,...l,modalProps:d,onOk:v,confirmLoading:h,children:r(Xe,{...m,onSubmitting:p,ref:y,onSuccess:x,onSubmit:w,children:[f,n("input",{type:"submit",hidden:!0})]})})}));function it(e){let{header:t,children:o,closable:i=!0,show:a,onHide:s,bodyAs:c,headerAs:l="h5",...d}=e;return r(T,{...d,onHide:s,show:a,children:[t&&n(T.Header,{closeButton:i,children:n(T.Title,{as:l,children:t})}),n(T.Body,{as:c,children:o})]})}const at=m(((e,t)=>{let{text:i,offcanvasProps:a,children:s,onShow:c,onHide:l,as:d=ae,...u}=e;const{state:f,show:m,hide:h}=nt({onShow:c,onHide:l});b(t,(()=>({close:h})));const p=y(d,{...u,onClick:m},i);return r(o,{children:[p,n(it,{header:i,...a,...f,children:s})]})}));function st(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=i(e);return s((()=>{n.current=e})),u((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.current?.(...t)}),t)}function ct(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=((e,t)=>e!==t)}=e,i=st(r),s=st(o),[c,l]=a(n),d=void 0!==t,u=d?t:c,f=st((e=>{const t="function"==typeof e?e(u):e;s(u,t)&&(d||l(t),i(t))}),[d,i,u,s]);return[u,f]}const lt=m(((e,t)=>{let{className:o,rowClassName:c,paginate:l=!0,sync:d=!1,columns:f=3,source:m,renderItem:h,renderEmpty:p}=e;const[g,y]=a([]),[v,x]=a(l?{total:0,current:1,pageSize:10}:null),[w,k]=a(!0),[C,N]=U({}),[S,j]=ct({value:d?C.page||1:void 0,defaultValue:1,onChange:e=>{d&&N({page:e||void 0})}}),z=u((async function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]||k(!0);try{let e;const t={page:S>1?S:void 0};e="string"==typeof m?await me({url:m,params:t}):await m(t),l&&qe(e)&&(e.last_page>1&&x({total:e.total,current:e.current_page,pageSize:e.per_page}),e=e.data),y(e)}catch(e){}finally{k(!1)}}),[m,y,S]);s((()=>{z()}),[S]),s((()=>{T.current={reload:z}}),[z]);const T=i({reload:z});return b(t,(()=>T.current)),r(dt,{className:o,children:[n(ze,{wrap:!0,loading:w}),0===g.length&&!w&&p?.(),n(P,{className:c,children:g.map(((e,t)=>n(B,{className:"d-flex",md:12/f,children:h(e)},`card-${t}`)))}),v&&n(ut,{...v,onChange:j})]})})),dt=O.div`
67
-
68
- `,ut=O(Ge)`
69
- margin-bottom: 0;
70
- justify-content: flex-end;
71
- margin-top: 1rem;
72
- `;var ft=v(lt);function mt(){const[e,t]=a(!1),n=i();return s((()=>()=>{n.current&&clearTimeout(n.current)}),[]),{copied:e,copy:u((e=>{R(e),t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout((()=>{t(!1),n.current=void 0}),3e3)}),[])}}function ht(e){let{as:t="div",className:r,content:o,tooltip:i=!0,placement:a}=e;const{copy:s,copied:c}=mt(),l=i?n("i",c?{className:"bi bi-clipboard-check"}:{className:"bi bi-clipboard"}):c?"已复制":"复制",d=y(t,{role:"button",className:r,onClick:()=>{"function"==typeof o&&(o=o()),s(o)}},l);return i?n(oe,{tooltip:c?"已复制":"复制",placement:a,children:d}):d}const pt=c({images:new Map,current:0,setCurrent:()=>null,setShow:()=>null,registerImage:()=>()=>null,getId:()=>0}),gt=p((()=>import("./index-dAECzHXf.js"))),yt=p((()=>import("./image-_Jr3Q4qn.js")));function bt(e){return n(g,{fallback:null,children:n(gt,{...e})})}bt.Image=function(e){return n(g,{fallback:null,children:n(yt,{...e})})},bt.Context=pt;const vt=p((()=>import("./infinite-scroller-zWxvOaJZ.js"))),xt=m(((e,t)=>n(g,{fallback:null,children:n(vt,{...e,ref:t})}))),wt=p((()=>import("./slider-KuqHu6UH.js")));function kt(e){return n(g,{fallback:null,children:n(wt,{...e})})}function Ct(e){let{manual:t,refreshDeps:n,...r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{execute:o,currentParams:i,error:a,...c}=q((async t=>(e="string"==typeof e?{url:e}:e,await me({...e,...t}))),r);s((()=>{if(!t&&!n)try{o()}catch{}}),[]),s((()=>{n&&l()}),n);const l=u((async()=>{try{i?await o(...i):await o()}catch{}}),[o,i]);if(a&&ue(a)){const e=a.errors;a=new Error("string"==typeof e?e:$(e).join(""))}return{refresh:l,execute:o,error:a,...c}}function Nt(e,t,n){const r=i(e),o=i(E(e,t,n));return s((()=>{r.current=e})),s((()=>{o.current=E((function(){r.current(...arguments)}),t,n)}),[t,n]),o.current}function St(e){const[t,n]=a((()=>G("function"==typeof e?e():e,!0)));return[t,u((e=>{n("function"==typeof e?V(e):G(e))}),[])]}export{bt as A,ae as B,Pe as C,xt as D,Be as E,Xe as F,kt as G,Ct as H,pt as I,nt as J,mt as K,ze as L,Q as M,Ve as N,at as O,Ge as P,ue as Q,Se as R,He as S,ie as T,fe as U,ct as a,he as b,St as c,le as d,de as e,ye as f,be as g,ve as h,qe as i,Me as j,Ae as k,Le as l,Ke as m,Qe as n,Ye as o,et as p,ot as q,me as r,rt as s,ce as t,Nt as u,it as v,ge as w,oe as x,ft as y,ht as z};
@@ -1,39 +0,0 @@
1
- import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"rc-table";import{unstable_batchedUpdates as o}from"react-dom";import{FormControl as a,Table as i}from"react-bootstrap";import{useUrlSearchParams as c}from"use-url-search-params";import{isEqual as l,omit as s}from"lodash";import*as d from"react";import{useState as p,useCallback as u,useRef as m,useEffect as h,useMemo as f,memo as g,forwardRef as v,useImperativeHandle as y}from"react";import{B as b,u as x,P as w,a as j,r as C,i as k,N as S,L as E,T as O,C as V,S as z}from"./index-m6pAadP4.js";import N from"styled-components";import H from"./index-euR0AgSF.js";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"classnames";import"copy-to-clipboard";import"react-async-hook";import"immer";import"react-intersection-observer";import"@topthink/json-form";const q=function(t){let{indeterminate:r=!1,...n}=t;const o=m(null);return h((()=>{o.current&&(o.current.indeterminate=r)}),[r]),e("input",{ref:o,...n,className:"form-check-input",type:"checkbox"})};var K;function M(){return M=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},M.apply(this,arguments)}const B=e=>d.createElement("svg",M({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),K||(K=d.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.704"})));var P;function F(){return F=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},F.apply(this,arguments)}const T=e=>d.createElement("svg",F({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),P||(P=d.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.566"})));function D(r){let{data:n,options:o,columns:a,onSearch:i}=r;const[c,s]=p(0),[d,m]=p(n);h((()=>{l(n,d)||(m(n),s((e=>e+1)))}),[n]);const[g,v,y]=f((()=>{const e={"ui:col":10,"ui:order":o.order},t={},r={};o.fields.forEach((n=>{const i=a.find((e=>e.dataIndex===n));if(i){const a=i.title;if("string"==typeof a){if(e[n]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...o.ui?.[n]},i.valueEnum){const t=i.valueEnum;return e[n]["ui:placeholder"]="请选择",r[n]={title:a,type:"string",enum:Object.keys(t).flatMap((e=>"string"==typeof t[e].text?[e]:[])),enumNames:Object.keys(t).flatMap((e=>{const r=t[e].text;return"string"==typeof r?[r]:[]}))}}t[n]=void 0,r[n]={title:a,type:"string"}}}})),o.extraFields&&Object.entries(o.extraFields).forEach((n=>{let[a,i]=n;e[a]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...o.ui?.[a]},t[a]=void 0,r[a]={title:i,type:"string"}}));return[{type:"object",properties:r},e,t]}),[o.fields,o.extraFields]),x=u((e=>{let{formData:t}=e;m(t),i({...y,...t})}),[i,y]),w=u((()=>{i(y)}),[i,y]);return e(I,{children:e(H,{formContext:{layout:"horizontal"},schema:g,uiSchema:v,onSubmit:x,formData:d,children:e("div",{className:"col-2 ms-auto mt-auto",children:t("div",{className:"justify-content-end d-flex gap-2 ",children:[e(b,{className:"px-4",onClick:w,variant:"secondary",children:"重置"}),e(b,{className:"px-4",type:"submit",variant:"primary",children:"查询"})]})})})},c)}const I=N.div`
2
- margin-bottom: 1rem;
3
- `;function R(t){let{keyword:r,onKeywordChange:n}=t;const[o,i]=p(r),c=x(n,500);h((()=>{i(r)}),[r]);const l=u((e=>{i(e.target.value),c(e.target.value)}),[c,i]);return e(a,{value:o,onChange:l,type:"search",placeholder:"Search..."})}const _=N.thead`
4
- th {
5
- padding: 0.5rem 0.5rem;
6
- border-bottom-width: 1px;
7
- border-color: var(--bs-border-color);
8
- }
9
- `,A={table:t=>e(i,{...t,className:"mb-0 align-middle table-hover"}),header:{wrapper:t=>e(_,{...t})}},L=N.a`
10
- cursor: pointer;
11
- width: 28px;
12
- height: 28px;
13
- display: inline-flex;
14
- align-items: center;
15
- justify-content: center;
16
- vertical-align: middle;
17
- `,$=function(t){let{record:r,expanded:n,expandable:o,onExpand:a}=t;return e(L,o?{onClick:e=>a(r,e),children:e(n?T:B,{})}:{})},G=N(w)`
18
- margin-bottom: 0;
19
- justify-content: flex-end;
20
- margin-top: 1rem;
21
- `,J=v(((a,i)=>{let{source:l,rowKey:d="id",paginate:g=!0,toolBarRender:v,columns:b=[],search:x,rowSelection:w,card:z=!0,expandable:N={},sync:H=!1,...K}=a;const[M,B]=p([]),[P,F]=p(g?{total:0,current:1,pageSize:10}:null),[T,I]=p(!0),[_,L]=c({}),[J,Q]=function(t,r,n){const[o,a]=p((()=>new Set(t?.selectedRowKeys||[]))),i=e=>"string"==typeof r?e[r]:r(e),c=e=>n.find((t=>i(t)===e)),l=u((e=>{e instanceof Set||(e=new Set(e)),a(e);const r=Array.from(e),n=r.map((function(e){return c(e)}));t?.onChange&&t?.onChange(r,n)}),[c]);return[u((r=>{if(!t)return r;const a=n.map(i),c=a.every((function(e){return o.has(e)})),s=a.some((function(e){return o.has(e)}));return[{key:"selection",title:e(q,{checked:c&&n.length>0,indeterminate:!c&&s,onChange:()=>{c?a.forEach((function(e){o.delete(e)})):a.forEach((function(e){o.add(e)})),l(new Set(o))}}),width:30,align:"center",render(t){let{record:r}=t;const n=i(r),a=o.has(n);return e(q,{checked:a,onChange:()=>{a?o.delete(n):o.add(n),l(new Set(o))}})}},...r]}),[n,t,o]),l]}(w,d,M),Z=f((()=>s(_,["q","page"])),[_]),[ee,te]=j({value:H?Z:void 0,defaultValue:{},onChange:e=>{H&&L(e)}}),[re,ne]=j({value:H?_.q||"":void 0,defaultValue:"",onChange:e=>{H&&L({q:e||void 0})}}),[oe,ae]=j({value:H?_.page||1:void 0,defaultValue:1,onChange:e=>{H&&L({page:e||void 0})}}),ie=u((async function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]||I(!0),Q([]);try{let e;const t={...ee,q:re,page:oe>1?oe:void 0};e="string"==typeof l?await C({url:l,params:t}):await l(t),g&&k(e)&&(F({total:e.total,current:e.current_page,pageSize:e.per_page}),e=e.data),B(e)}catch(e){}finally{I(!1)}}),[l,B,re,oe,ee]);h((()=>{ie()}),[re,oe,ee]);const ce=m({reload:ie});h((()=>{ce.current={reload:ie}}),[ie]),y(i,(()=>ce.current));const le=f((()=>J(b).map((t=>{let{render:r,valueType:n,valueEnum:o,...a}=t;const i={...a};return r?i.render=(e,t,n)=>r({value:e,record:t,index:n,action:ce.current}):"currency"===n?i.render=t=>e(S,{value:t}):o&&(i.render=t=>o[t]?o[t].status?e("span",{className:`text-${o[t].status}`,children:o[t].text}):o[t].text:t),i}))),[b,J,ce]),se=t(r,{children:[e(E,{loading:T}),"object"==typeof x&&e(D,{data:ee,columns:b,options:x,onSearch:e=>{o((()=>{ae(1),te(e)}))}}),!1!==v&&t(U,{children:[e(X,{size:12,children:v&&v(ce.current)}),t(W,{size:12,children:[!0===x&&e(R,{keyword:re,onKeywordChange:e=>{o((()=>{ae(1),ne(e)}))}}),e(Y,{onClick:()=>{ce.current.reload()},children:e("i",{className:"bi bi-arrow-repeat"})})]})]}),e(O.Provider,{value:!0,children:e(n,{...K,expandable:{expandIcon:$,...N},rowKey:d,columns:le,components:A,data:M})}),P&&e(G,{...P,onChange:ae})]});return z?e(V,{children:se}):se}));var Q=g(J);const U=N.div`
22
- display: flex;
23
- justify-content: space-between;
24
- padding-bottom: 1rem;
25
- height: 48px;
26
- border-bottom: 2px solid #212529;
27
- `,W=N(z)`
28
-
29
- `,X=N(z)`
30
-
31
- `,Y=N.span`
32
- cursor: pointer;
33
- font-size: 20px;
34
- line-height: 1;
35
-
36
- &:hover {
37
- color: var(--bs-primary);
38
- }
39
- `;export{Q as default};