@topthink/components 1.1.23 → 1.1.24
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/es/{cascader-pKgfaE9t.js → cascader-BQf3OIMo.js} +1 -1
- package/es/image-SX99DbLN.js +1 -0
- package/es/{index-qqtWKONG.js → index-C97DS7ut.js} +1 -1
- package/es/index-DQ5B1OmL.js +1 -0
- package/es/index-QRjGJrZt.js +78 -0
- package/es/index-sbmUp8FC.js +40 -0
- package/es/index.js +1 -1
- package/es/infinite-scroller-zConMfyx.js +1 -0
- package/es/{select-WnBtupzS.js → select-CwDOdXXH.js} +1 -1
- package/es/steps-DECts1pI.js +33 -0
- package/package.json +76 -78
- package/scss/app.scss +5 -5
- package/types/components/button.d.ts +0 -1
- package/types/components/card-list.d.ts +1 -1
- package/types/components/lazy/form/widgets/editor-widget.d.ts +0 -1
- package/types/components/lazy/infinite-scroller.d.ts +1 -1
- package/types/components/lazy/table/context.d.ts +0 -1
- package/types/components/lazy/table/index.d.ts +1 -1
- package/types/components/lazy/table/search.d.ts +0 -1
- package/types/components/lightbox.d.ts +1 -1
- package/types/components/steps.d.ts +2 -2
- package/types/hooks/use-unmounted-ref.d.ts +0 -1
- package/types/index.d.ts +1 -1
- package/types/request.d.ts +5 -5
- package/es/image-qSKcFPGU.js +0 -1
- package/es/index-So7TiG4o.js +0 -40
- package/es/index-kOIT3IUs.js +0 -1
- package/es/index-t5sPwmd8.js +0 -78
- package/es/infinite-scroller-_g5R4GSj.js +0 -1
- package/es/steps-b_BcYIwk.js +0 -33
- /package/es/{editor-widget-ZqrBTAWC.js → editor-widget-DiT2rVOW.js} +0 -0
- /package/es/{image-zoom-OrIPGqh0.js → image-zoom-He8CEHjx.js} +0 -0
- /package/es/{slider-KuqHu6UH.js → slider-DE41CkdN.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import o from"rc-cascader";import"rc-cascader/assets/index.less";import{useRef as e}from"react";import{CloseButton as c}from"react-bootstrap";import a,{css as d}from"styled-components";function s(
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import o from"rc-cascader";import"rc-cascader/assets/index.less";import{useRef as e}from"react";import{CloseButton as c}from"react-bootstrap";import a,{css as d}from"styled-components";function s({size:o,allowClear:a,...d}){a=a?{clearIcon:r(c,{})}:void 0;const s=e(null);return r(i,{$size:o,...d,ref:s,allowClear:a,dropdownClassName:"dropdown-menu",getPopupContainer:()=>s.current?.nativeElement||document.body,expandIcon:r("i",{className:"bi bi-chevron-right"})})}const i=a(o)`
|
|
2
2
|
&&& {
|
|
3
3
|
width: 100%;
|
|
4
4
|
font-size: 1rem;
|
|
@@ -0,0 +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-QRjGJrZt.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"react-async-hook";import"styled-components";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";var n=e(({lazy:e=!0,...n})=>{const{registerImage:p,setShow:c,setCurrent:l,getId:d}=i(a),[h,g]=o(),[u,w]=o(!1),{ref:f,inView:y}=m({threshold:.2,skip:!e,initialInView:!0}),[v]=o(d);if(s(()=>{if(n.src)return p(v,n.src)},[]),u)return t(r,{children:n.alt?`[图片加载失败:${n.alt}]`:" "});const j=!y&&e&&h?"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":n.src;return t("img",{width:h?.[0],height:h?.[1],onLoad:t=>{h||g([t.currentTarget.clientWidth,t.currentTarget.clientHeight])},onError:()=>{w(!0)},ref:f,...n,alt:void 0,src:j,onClick:()=>{l(v),c(!0)}})});export{n 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,{
|
|
1
|
+
import{jsxs as t,jsx as r}from"react/jsx-runtime";import{useState as o,useCallback as e}from"react";import i,{useLightboxState as n,useController 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{I as c}from"./index-QRjGJrZt.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"react-async-hook";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";const d={counter:s,zoom:m,download:l,thumbnails:p};let g=0;function h({children:i,render:s,zoom:l,toolbar:m,plugins:p=["counter","zoom","download"]}){const[u,h]=o(()=>new Map),[y,x]=o(),[f,w]=o(!1),_=e((t,r)=>(h(o=>new Map(o).set(t,r)),()=>{h(r=>{const o=new Map(r);return o.delete(t)?o:r})}),[]),j=Array.from(u.keys()),k=j.indexOf(y),v=j.map(t=>{const r=u.get(t);return"string"==typeof r?{src:r}:{render:r}}),z=e(()=>g++,[]);return t(c.Provider,{value:{images:u,current:y,setCurrent:x,setShow:w,registerImage:_,getId:z},children:[i,r(b,{plugins:p.map(t=>d[t]),open:f,index:k,close:()=>w(!1),slides:v,carousel:{finite:!0,preload:3},toolbar:m?.({useController:a,useLightboxState:n}),zoom:l,render:{...s,buttonPrev:v.length<=1?()=>null:void 0,buttonNext:v.length<=1?()=>null:void 0,slide:({slide:t})=>{if("render"in t)return t.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{h as default};
|
|
@@ -0,0 +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 i,useCallback as n}from"react";import s from"axios";import{c as p,r as m,B as d}from"./index-QRjGJrZt.js";import{mapValues as l}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"react-async-hook";import"styled-components";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";const c=require("ajv-i18n/localize/zh"),u=a.lazy(()=>import("./editor-widget-DiT2rVOW.js")),f=o=>t(a.Suspense,{fallback:null,children:t(u,{...o})}),y={upload:function({options:o,...a}){const{widgets:e}=r();return o.endpoint&&(o.onUpload=async t=>{const r=new FormData;r.set("file",t);const{url:a,value:e}=await m({url:o.endpoint,method:"post",data:r});return{url:a,value:e}}),t(e.upload,{...a,options:o})},avatar:function({options:o,...a}){const{widgets:e}=r();return o.endpoint&&(o.onUpload=async t=>{const r=new FormData;r.set("file",t);const{url:a}=await m({url:o.endpoint,method:"post",data:r});return a}),t(e.avatar,{...a,options:o})},editor:function({options:o,...r}){return o.endpoint&&(o.onUpload=async t=>{const r=new FormData;r.set("file",t);const{url:a}=await m({url:o.endpoint,method:"post",data:r});return a}),t(f,{...r,options:o})},typeahead:function({options:o,...a}){const{widgets:e}=r();return o.endpoint&&(o.onSearch=async({value:t,query:r})=>await m({url:o.endpoint,params:{value:t,query:r}})),t(e.typeahead,{...a,options:o})}},h=e(({action:r,method:a="post",onSuccess:e,formData:u,onSubmitting:f,onSubmit:h,onChange:w,submitText:b="保存",transformData:g,children:v,validate:j,disabled:x,...D},S)=>{const[k,q]=i(),[z,_]=p(!1),[E,F]=i(u),U=n(async(t,o)=>{if(!z)try{if(_(!0),f&&f(!0),r){let{formData:o}=t;g&&(o=g(o));try{const t=await m({url:r,method:a,data:o});return q(void 0),e&&await e(t),t}catch(t){if(!s.isAxiosError(t))throw t;q((t=>{const o=t.errors;return"string"==typeof o?{__errors:[o]}:l(o,t=>({__errors:[t]}))})(t))}}else if(h)return await h(t,o)}finally{_(!1),f&&f(!1)}},[r,a,h]),C=n(t=>{const{formData:o}=t;F(o),w&&w(t)},[F,w]),N=n(t=>(t=t.map(t=>({keyword:t.name,dataPath:t.property,...t})),c(t),t),[]),T=t(d,{className:"px-4",disabled:x,loading:z,type:"submit",variant:"primary",children:b});"function"==typeof v&&(v=v({submit:T,loading:z,disabled:x}));const V=!j;return!0===j&&(j=void 0),t(o,{ref:S,extraErrors:k,onSubmit:U,transformErrors:N,noHtml5Validate:!0,noValidate:V,validate:j,disabled:x,...D,formData:E,onChange:C,widgets:y,children:v||t("div",{className:"col-12",children:T})})});export{h as default};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import e from"sweetalert2/dist/sweetalert2.js";import n from"sweetalert2-react-content";import{jsx as t,jsxs as r,Fragment as o}from"react/jsx-runtime";import{useRef as a,useState as i,useEffect as s,createContext as c,useContext as l,useCallback as d,useMemo as u,Fragment as h,forwardRef as m,lazy as f,Suspense as p,Children as g,createElement as y,useImperativeHandle as w,memo as v}from"react";import{OverlayTrigger as b,Tooltip as x,Spinner as k,Button as N,Modal as C,ButtonGroup as S,ToggleButton as j,Card as z,Accordion as P,Stack as T,Alert as $,Pagination as H,Offcanvas as B,Row as E,Col as L}from"react-bootstrap";import{uniqueId as _,values as D,omit as R,debounce as M}from"lodash";import F from"axios";import O from"query-string";import*as U from"retry-axios";import{enqueueSnackbar as A,SnackbarProvider as I}from"notistack";import q from"path";import{useAsyncCallback as W}from"react-async-hook";import G,{css as K,createGlobalStyle as V}from"styled-components";import Y from"dayjs";import"dayjs/locale/zh-cn";import Q from"dayjs/plugin/relativeTime";import J from"dayjs/plugin/duration";import X from"classnames";import{useUrlSearchParams as Z}from"use-url-search-params";import ee from"copy-to-clipboard";import*as ne from"goober";import{freeze as te,produce as re}from"immer";import"react-intersection-observer";const oe=()=>{document.body.style.setProperty("--vh",window.innerHeight/100+"px"),document.body.style.setProperty("--100vh",window.innerHeight+"px")};window.addEventListener("resize",oe),oe();const ae=n(e),ie={confirmButtonText:"确定",cancelButtonText:"取消"},se={confirm:async e=>{const{isConfirmed:n}=await ae.fire({...ie,icon:"warning",showCancelButton:!0,...e,async preConfirm(n){if(e.preConfirm)try{return await e.preConfirm(n)}catch(e){return e instanceof Error&&ae.showValidationMessage(e.message),!1}return!0}});return n},success:e=>{ae.fire({...ie,toast:!0,position:"top",icon:"success",timer:2e3,showConfirmButton:!1,...e})},error:e=>{ae.fire({...ie,toast:!0,position:"top",icon:"error",timer:5e3,showConfirmButton:!1,...e})},close:e=>{ae.close(e)},defaults:ie};const ce=c({});function le(e){return({resolve:n,destroy:r,message:o})=>{const[c,h]=function(e){const n=a(null),[t,r]=i(e);return s(()=>{n.current&&(n.current(),n.current=null)},[t]),[t,(e,t)=>{n.current="function"==typeof t?t:null,r(e)}]}(!0),m=l(ce),f=d(e=>{h(!1,()=>{n(e)})},[h,n]),p=u(()=>({show:c,onHide:()=>f(),onExited:()=>r(),container:m.container}),[c,f,r]);return t(e,{resolve:f,state:p,message:o})}}function de(e){return n=>new Promise(r=>{const o=t(e,{resolve:r,destroy:()=>{fe(o)},message:n});me(o)})}let ue=()=>{},he=new Set;const me=e=>{he=new Set(he),he.add(e),ue(he)},fe=e=>{he=new Set(he),he.delete(e),ue(he)};function pe(e,n){return de(le(e))(n)}function ge({tooltip:e,children:n,placement:r="bottom"}){return t(b,{placement:r,overlay:t(x,{id:_(),children:e}),children:n})}const ye=c(!1),we=m(({loading:e,percent:n,disabled:a,children:i,tooltip:s,variant:c,...d},u)=>{l(ye)&&!c&&(c="link"),e&&(a=!0,i=r(o,{children:[t(k,{ref:u,as:"span",size:"sm",role:"status","aria-hidden":"true",animation:"border"}),n?r("span",{className:"ms-2",children:[n,"%"]}):null]}));const h=t(N,{ref:u,...d,variant:c,disabled:a,children:i});return s?t(ge,{tooltip:s,children:t("span",{className:"d-inline-block",children:h})}):h}),ve=function({state:e,message:{title:n,message:o,okText:a,cancelText:i},resolve:s}){return r(C,{...e,children:[t(C.Header,{children:t(C.Title,{as:"h5",children:n||"确认"})}),t(C.Body,{children:o}),r(C.Footer,{children:[t(we,{variant:"secondary",onClick:()=>s(),children:i||"取消"}),t(we,{onClick:()=>s(!0),children:a||"确定"})]})]})};const be=({header:e,children:n,footer:a,closable:s=!0,show:c,cancelText:l="取消",okText:d="确定",onOk:h,onCancel:m,onHide:f,okButtonProps:p,bodyAs:g,headerAs:y="h5",confirmLoading:w=!1,...v})=>{const[b,x]=i(!1),k=u(()=>t(we,{loading:b||w,variant:"primary",onClick:async e=>{x(!0);try{await(h?.(e)),e.defaultPrevented||f?.()}finally{x(!1)}},...p,children:d}),[p,d,h,f,b,w]),N=u(()=>t(we,{variant:"secondary",onClick:e=>{m?.(e),e.defaultPrevented||f?.()},children:l}),[m,f,l]),S={close:()=>{f?.()}};switch(typeof a){case"undefined":a=r(o,{children:[N,k]});break;case"function":a=a({okButton:k,cancelButton:N,action:S})}return r(C,{...v,onHide:f,show:c,children:[e&&t(C.Header,{closeButton:s,children:t(C.Title,{as:y,children:e})}),t(C.Body,{as:g,children:n}),a&&t(C.Footer,{children:a})]})};be.Message=function(e){const[n,r]=i(he);return s(()=>{ue=r},[]),t(ce.Provider,{value:e,children:Array.from(n).map((e,n)=>t(h,{children:e},`message-${n}`))})},be.confirm=function(e){return de(le(ve))(e)},be.show=pe;const xe=["default","error","warning","success","info"].reduce((e,n)=>(e[n]=(e,t)=>A(e,{variant:n,autoHideDuration:3e3,anchorOrigin:{vertical:"top",horizontal:"center"},...t}),e),{});function ke(e){return e&&"object"==typeof e}U.attach(),F.defaults.raxConfig={retryDelay:2e3,backoffType:"static",shouldRetry:({config:e,response:n})=>!(e.raxConfig?.retryDecider&&!e.raxConfig.retryDecider())&&("GET"===e.method?.toUpperCase()&&449===n?.status)},F.defaults.maxContentLength=1/0,F.defaults.maxBodyLength=1/0,F.defaults.baseURL="/api",F.defaults.authTokenName="authorization";const Ne=F.isAxiosError,Ce=e=>{if(!F.isAxiosError(e))throw e;xe.error(e.message)},Se=function(e){e?.baseURL&&(e.baseURL=q.resolve(F.defaults.baseURL||"/",e.baseURL));const n=F.create(e);return U.attach(n),n.interceptors.request.use(e=>{const n=e.authTokenName;if(n){const t=localStorage.getItem(n);t&&(e.headers={Authorization:`Bearer ${t}`,...e.headers})}return e},e=>Promise.reject(e)),n.interceptors.response.use(e=>(201===e.status&&e.data.location&&(window.location.href=e.data.location,e.data=void 0),e),e=>{if(F.isAxiosError(e)&&e.response){const{data:n,status:t}=e.response;401===t?e.errors="Unauthorized":ke(n)?422===t?e.errors=n:"message"in n&&(e.errors=n.message):e.errors=n,"string"!=typeof e.errors?e.message=Object.values(e.errors).join("<br />"):e.message=e.errors}return Promise.reject(e)}),n},je=async function(e,n){if(n||(n=Se()),e="string"==typeof e?{url:e}:e,(e={paramsSerializer:function(e){return O.stringify(e,{sort:!1,skipNull:!0,skipEmptyString:!0,arrayFormat:"bracket"})},...e}).onMessage){let n=0,t="",r=null;const o=e.onMessage;e.onDownloadProgress=e=>{const a=e.target,{responseText:i}=a;for(;n<e.loaded;){const e=i.substring(n,++n);if(t+=e,"\n"===e){if(r||(r={id:"",event:"",data:""}),"\n"===t)o(r),r=null;else{const e=t.match(/^data:(?<data>.*)/);e&&(r.data=e.groups.data.trim())}t=""}}}}const{data:t}=await n.request(e);return t};je.create=function(e){const n=Se(e),t=e=>je(e,n);return t.interceptors=n.interceptors,t},je.defaults=F.defaults,je.interceptors=F.interceptors;function ze(e){const n=(()=>{const e=a(!1);return s(()=>(e.current=!1,()=>{e.current=!0}),[]),e})(),[t,r]=i(e);return[t,d(e=>{n.current||r(e)},[])]}function Pe(e,n={}){const{locale:t="zh-CN",currency:r=!0,...o}=n;let a;a=r?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2};return new Intl.NumberFormat(t,{...a,...o}).format(e)}function Te(e,{manual:n,refreshDeps:t,...r}={}){let{execute:o,currentParams:a,error:i,...c}=W(async n=>(e="string"==typeof e?{url:e}:e,await je({...e,...n})),r);s(()=>{if(!n&&!t)try{o()}catch{}},[]),s(()=>{t&&l()},t);const l=d(async()=>{try{a?await o(...a):await o()}catch{}},[o,a]);if(i&&Ne(i)){const e=i.errors;i=new Error("string"==typeof e?e:D(e).join(""))}return{refresh:l,execute:o,error:i,...c}}function $e({active:e,inverted:n,...r}){return t(He,{$active:e,$inverted:n,...r})}G.div`
|
|
2
|
+
position: relative;
|
|
3
|
+
`;const He=G.div`
|
|
4
|
+
display: ${e=>e.$active?"flex":"none"};
|
|
5
|
+
position: absolute;
|
|
6
|
+
top: 0 !important;
|
|
7
|
+
left: 0 !important;
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
text-align: center;
|
|
11
|
+
vertical-align: middle;
|
|
12
|
+
padding: 1em;
|
|
13
|
+
background-color: ${e=>e.$inverted?"rgba(255, 255, 255, .85)":"rgba(0, 0, 0, .85)"};
|
|
14
|
+
opacity: ${e=>e.$active?1:0};
|
|
15
|
+
line-height: 1;
|
|
16
|
+
animation-fill-mode: both;
|
|
17
|
+
animation-duration: .5s;
|
|
18
|
+
transition: background-color .5s linear;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
user-select: none;
|
|
23
|
+
will-change: opacity;
|
|
24
|
+
z-index: 990;
|
|
25
|
+
`;function Be({loading:e=!0,children:n,variant:o="primary",animation:a="border",wrap:i,...s}){return e?(n&&(n=t("p",{className:"mt-3 text-secondary",children:n})),n=r($e,{inverted:!0,active:!0,children:[t(k,{animation:a,variant:o,...s}),n]}),i?t(Ee,{$height:"number"==typeof i?i:150,children:n}):n):null}const Ee=G.div`
|
|
26
|
+
position: relative;
|
|
27
|
+
height: ${e=>`${e.$height}px`};
|
|
28
|
+
`,Le=f(async()=>{const{QRCodeSVG:e}=await import("qrcode.react");return{default:e}});function _e(e){return t(p,{fallback:null,children:t(Le,{...e})})}const De=function({state:e,message:n,resolve:r}){const o=a(!0),{result:i,checkUrl:c,onComplete:l}=n,[d,u]=ze(!1);return s(()=>{je({url:c,method:"post",data:{order_no:i.order_no},raxConfig:{shouldRetry:e=>o.current&&449===e.response?.status}}).then(()=>{l?.(),r()}).catch(()=>null)},[]),t(be,{...e,centered:!0,onHide:()=>{o.current=!1,e.onHide()},backdrop:"static",header:"支付结果",okText:"已完成支付",okButtonProps:{loading:d},onOk:async e=>{e.preventDefault();try{u(!0),await je({url:c,method:"post",data:{order_no:i.order_no,force:!0},raxConfig:{shouldRetry:()=>!1}}),l?.(),r()}catch(e){Ne(e)&&xe.error(e.message)}finally{u(!1)}},cancelText:"取消",children:"请在新打开的页面上进行支付,支付完成后再关闭此窗口"})},Re=function({state:e,message:n,resolve:o}){const i=a(!0),{result:{pay_options:c,order_no:l},checkUrl:d,onComplete:u}=n,[h,m]=ze(c.channels.alipay?"alipay":"wechat"),[f,p]=ze(!1);s(()=>{je({url:d,method:"post",data:{order_no:l},raxConfig:{shouldRetry:e=>i.current&&449===e.response?.status}}).then(()=>{u?.(),o()}).catch(()=>null)},[]);const{loading:g,result:y}=Te({url:c.url,method:"POST",data:{channel:h,order_no:l}},{refreshDeps:[h]});return r(be,{...e,onHide:()=>{i.current=!1,e.onHide()},centered:!0,backdrop:"static",header:"收银台",okText:"已完成支付",okButtonProps:{loading:f},onOk:async e=>{e.preventDefault();try{p(!0),await je({url:d,method:"post",data:{order_no:l,force:{channel:h}},raxConfig:{shouldRetry:()=>!1}}),u?.(),o()}catch(e){Ne(e)&&xe.error(e.message)}finally{p(!1)}},cancelText:"取消",children:[r("dl",{className:"row",children:[t("dt",{className:"col-3",children:"商品名称"}),t("dd",{className:"col-9",children:c.subject})]}),r("dl",{className:"row",children:[t("dt",{className:"col-3",children:"支付金额"}),t("dd",{className:"col-9 text-success h3",children:Pe(c.amount/100)})]}),r("dl",{className:"row",children:[t("dt",{className:"col-3",children:"支付方式"}),t("dd",{className:"col-9",children:r(S,{children:[c.channels.alipay&&t(j,{id:"payment-alipay",type:"radio",variant:"alipay"===h?"primary":"outline-primary",name:"alipay",value:"alipay",checked:"alipay"===h,onChange:()=>m("alipay"),children:"支付宝"}),c.channels.alipay&&t(j,{id:"payment-wechat",type:"radio",variant:"wechat"===h?"primary":"outline-primary",name:"wechat",value:"wechat",checked:"wechat"===h,onChange:()=>m("wechat"),children:"微信支付"})]})})]}),r("dl",{className:"row mb-0",children:[t("dt",{className:"col-3",children:"扫码支付"}),r("dd",{className:"col-9",children:[t(Be,{loading:g,wrap:200}),y&&t(_e,{size:200,value:y.data})]})]})]})};function Me(e){const{result:n}=e;n.pay_url?(window.opener=null,window.innerWidth<992?location.href=n.pay_url:(window.open(n.pay_url),pe(De,e))):pe(Re,e)}function Fe(e,n=2){const t=["","K","M","G"];let r=0;for(;e>=1024&&r<t.length-1;)e/=1024,r++;return e%1==0&&(n=0),e.toFixed(n)+t[r]}function Oe(e,n=2){const t=["","K","M","G"];let r=0;for(;e>=1e3&&r<t.length-1;)e/=1e3,r++;return e%1==0&&(n=0),e.toFixed(n)+t[r]}function Ue(e){const n=q.extname(e);return!(!/^data:image\//.test(e)&&!/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(n))||!/^data:/.test(e)&&!n}function Ae(e){if(/^https?:\/\//.test(e))return e;const n=document.createElement("a");return n.href=e,n.href}Y.locale("zh-cn"),Y.extend(Q),Y.extend(J);const Ie={success:t("i",{className:"bi bi-check-circle-fill text-success"}),error:t("i",{className:"bi bi-exclamation-circle-fill text-danger"}),info:t("i",{className:"bi bi-info-circle-fill text-info"}),warning:t("i",{className:"bi bi-exclamation-triangle-fill text-warning"})};function qe({className:e,status:n,title:o,icon:a,extra:i}){return!a&&n&&(a=Ie[n]),r(We,{className:e,children:[a&&t(Ge,{children:a}),o&&t(Ke,{children:o}),i&&t(Ve,{children:i})]})}const We=G.div`
|
|
29
|
+
padding: 48px 32px;
|
|
30
|
+
`,Ge=G.div`
|
|
31
|
+
margin-bottom: 24px;
|
|
32
|
+
text-align: center;
|
|
33
|
+
font-size: 72px;
|
|
34
|
+
`,Ke=G.div`
|
|
35
|
+
color: rgba(0, 0, 0, .85);
|
|
36
|
+
font-size: 24px;
|
|
37
|
+
line-height: 1.8;
|
|
38
|
+
text-align: center;
|
|
39
|
+
`,Ve=G.div`
|
|
40
|
+
margin-top: 32px;
|
|
41
|
+
text-align: center;
|
|
42
|
+
`;function Ye({children:e,title:n,className:a,...i}){return t(Qe,{className:X("border-0 shadow-sm",a),...i,children:r("div",{className:"card-body",children:[n&&r(o,{children:[t("h5",{children:n}),t("hr",{})]}),e]})})}const Qe=G(z)`
|
|
43
|
+
&:not(:last-child) {
|
|
44
|
+
margin-bottom: 1rem;
|
|
45
|
+
}
|
|
46
|
+
`,Je=c(void 0);function Xe({children:e}){const[n,r]=i(new Set),o=d(e=>{e&&"string"==typeof e&&(e=[e]),r(new Set(e))},[r]);return t(Je.Provider,{value:[n,r],children:t(P,{activeKey:Array.from(n),onSelect:o,alwaysOpen:!0,children:e})})}const Ze=()=>{const e=l(Je);if(!e)throw new Error("usePanel must be used within a PanelGroup");return e};function en({title:e,action:n,children:a,eventKey:i,open:c}){if(i){const[,e]=Ze();s(()=>{void 0!==c&&e(e=>c?new Set([...e,i]):new Set([...e].filter(e=>e!==i)))},[c]),a=t(P.Collapse,{eventKey:i,children:r(o,{children:[t("hr",{}),a]})})}else a=r(o,{children:[t("hr",{}),a]});return r(Ye,{children:[r(T,{direction:"horizontal",children:[t("div",{className:"fs-5 me-auto",children:e}),n]}),a]})}function nn({errors:e}){return e?t($,{variant:"danger",children:t("ul",{className:"mb-0",children:"string"==typeof e?t("li",{children:e}):Object.entries(e).map(([e,n])=>t("li",{children:n},e))})}):null}function tn({children:e,className:n,size:r="small",direction:o="horizontal"}){"string"==typeof r&&(r={small:8,middle:16,large:24}[r]);const a=g.map(e,e=>{if(e)return t(on,{children:e})});return t(rn,{className:n,$direction:o,$size:r,children:a})}const rn=G.div`
|
|
47
|
+
display: inline-flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: ${e=>e.$size}px;
|
|
50
|
+
|
|
51
|
+
${e=>"vertical"===e.$direction&&K`
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
align-items: inherit;
|
|
55
|
+
`}
|
|
56
|
+
`,on=G.div`
|
|
57
|
+
|
|
58
|
+
`,an=f(()=>import("./steps-DECts1pI.js")),sn=f(()=>import("./steps-DECts1pI.js").then(({Step:e})=>({default:e})));function cn(e){return t(p,{fallback:null,children:t(an,{...e})})}const ln=function(e){return t(p,{fallback:null,children:t(sn,{...e})})};function dn({title:e,content:n,footer:o}){return r(Ye,{children:[t(mn,{children:e}),t(hn,{children:n}),o&&t(un,{children:o})]})}cn.Step=ln;const un=G.div`
|
|
59
|
+
margin-top: 9px;
|
|
60
|
+
padding-top: 10px;
|
|
61
|
+
border-top: 1px solid #f0f0f0;
|
|
62
|
+
color: rgba(0, 0, 0, .65);
|
|
63
|
+
`,hn=G.div`
|
|
64
|
+
color: rgba(0, 0, 0, .85);
|
|
65
|
+
font-size: 24px;
|
|
66
|
+
`,mn=G.div`
|
|
67
|
+
margin-bottom: 4px;
|
|
68
|
+
color: rgba(0, 0, 0, .45);
|
|
69
|
+
font-size: 1.1rem;
|
|
70
|
+
`;function fn(){}function pn(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function gn(e){return"current_page"in e}function yn({total:e=0,onChange:n=fn,defaultCurrent:o=1,defaultPageSize:a=10,className:c,...l}){const[h,m]=i(o),[f,p]=i(a);s(()=>{pn(l.current)&&m(l.current)},[l.current]),s(()=>{pn(l.pageSize)&&p(l.pageSize)},[l.pageSize]);const g=u(()=>Math.floor((e-1)/f)+1,[e,f]),y=d(e=>()=>{e!==h&&(m(e),n(e,f))},[n,h,f]),w=h-1>0?h-1:0,v=h+1<g?h+1:g,b=[];let x=null,k=null,N=null,C=null;if(g<=7)for(let e=1;e<=g;e+=1){const n=h===e;b.push(t(H.Item,{active:n,onClick:y(e),children:e},e))}else{C=t(H.Last,{onClick:y(g)},"last"),N=t(H.First,{onClick:y(1)},"first"),x=t(H.Prev,{onClick:y(w)},"prev"),k=t(H.Next,{onClick:y(v)},"next");let e=Math.max(1,h-2),n=Math.min(h+2,g);h-1<=2&&(n=5),g-h<=2&&(e=g-4);for(let r=e;r<=n;r+=1){const e=h===r;b.push(t(H.Item,{active:e,onClick:y(r),children:r},r))}h-1>=4&&3!==h&&b.unshift(x),g-h>=4&&h!==g-2&&b.push(k),1!==e&&b.unshift(N),n!==g&&b.push(C)}return r("div",{className:X("mb-3 d-flex align-column-center justify-content-between",c),children:[r("div",{className:"d-flex align-items-center",children:["共 ",e," 条"]}),t(H,{className:"mb-0",children:b})]})}function wn({className:e,value:n,locale:r="zh-CN",currency:a=!0,options:i={}}){const s=u(()=>{let e;return e=a?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2},new Intl.NumberFormat(r,{...e,...i})},[a,r,i]);return e?t("span",{className:e,children:s.format(n)}):t(o,{children:s.format(n)})}function vn({loading:e,disabled:n,children:r,...o}){return t(N,{...o,disabled:e||n,children:e?"Loading…":r})}const bn=f(()=>import("./image-zoom-He8CEHjx.js"));function xn(e){return t(p,{fallback:null,children:t(bn,{...e})})}const kn=m(({confirm:e,onSuccess:n,children:t,disabled:r,as:o=we,onError:a,...i},s)=>{const[c,l]=ze(!1),u=d(async t=>{t.preventDefault(),t.stopPropagation();try{if(l(!0),e&&!await be.confirm({message:e}))return;let t;if("onRequest"in i)t=await i.onRequest();else{const e="string"==typeof i.url?{url:i.url,method:i.method}:{method:i.method,...i.url};t=await je(e)}n&&n(t)}catch(t){if(!(t instanceof Error))throw t;a?a(t):xe.error(t.message,{preventDuplicate:!0})}finally{l(!1)}},[i,l]);return y(o,{...R(i,["onRequest","url","method"]),disabled:r||c,onClick:u,ref:s},t)}),Nn=f(()=>import("./index-DQ5B1OmL.js")),Cn=m((e,n)=>t(p,{fallback:null,children:t(Nn,{...e,ref:n})})),Sn=f(()=>import("./index-sbmUp8FC.js")),jn=m((e,n)=>t(p,{fallback:null,children:t(Sn,{...e,ref:n})}));let zn=0;function Pn({onHide:e,onShow:n}={}){const[t,r]=i(!1),[o,a]=i(`visible-${zn}`),s=d(()=>{r(!1),e&&e()},[r,e]),c=d(()=>{a("visible-"+ ++zn)},[a,zn]);return{visible:t,show:d(()=>{r(!0),n&&n()},[r,n]),hide:s,state:{show:t,onHide:s,onExited:c,key:o}}}const Tn=m(({text:e,onOk:n,modalProps:a,children:i,onShow:s,onHide:c,confirmLoading:l,as:d=we,...u},h)=>{const{state:m,show:f,hide:p}=Pn({onShow:s,onHide:c});w(h,()=>({close:p}));const g=y(d,{...u,onClick:e=>{e.preventDefault(),e.stopPropagation(),f()}},e);return r(o,{children:[g,t(be,{header:e,...a,...m,confirmLoading:l,onOk:async e=>{if(n){!1===await n()&&e.preventDefault()}},children:i})]})}),$n=m(({text:e,onSuccess:n,onSubmit:o,buttonProps:s,modalProps:c,children:l,...u},h)=>{const[m,f]=i(!1),p=a(null),g=a(null);w(h,()=>({close:()=>{p.current?.close()}}));const y=d(async()=>(g.current?.submit().catch(()=>{}),!1),[]),v=d(e=>{n&&n(e),p.current?.close()},[n]),b=d(async(e,n)=>{o&&await o(e,n)&&p.current?.close()},[o]);return t(Tn,{ref:p,text:e,...s,modalProps:c,onOk:y,confirmLoading:m,children:r(Cn,{...u,onSubmitting:f,ref:g,onSuccess:v,onSubmit:b,children:[l,t("input",{type:"submit",hidden:!0})]})})});function Hn({header:e,children:n,closable:o=!0,show:a,onHide:i,bodyAs:s,headerAs:c="h5",...l}){return r(B,{...l,onHide:i,show:a,children:[e&&t(B.Header,{closeButton:o,children:t(B.Title,{as:c,children:e})}),t(B.Body,{as:s,children:n})]})}const Bn=m(({text:e,offcanvasProps:n,children:a,onShow:i,onHide:s,as:c=we,...l},d)=>{const{state:u,show:h,hide:m}=Pn({onShow:i,onHide:s});w(d,()=>({close:m}));const f=y(c,{...l,onClick:h},e);return r(o,{children:[f,t(Hn,{header:e,...n,...u,children:a})]})});function En(e,n=[]){const t=a(e);return s(()=>{t.current=e}),d((...e)=>t.current?.(...e),n)}function Ln(e){const{value:n,defaultValue:t,onChange:r,shouldUpdate:o=(e,n)=>e!==n}=e,a=En(r),s=En(o),[c,l]=i(t),d=void 0!==n,u=d?n:c,h=En(e=>{const n="function"==typeof e?e(u):e;s(u,n)&&(d||l(n),a(n))},[d,a,u,s]);return[u,h]}const _n=m(({className:e,rowClassName:n,paginate:o=!0,sync:c=!1,columns:l=3,source:u,renderItem:h,renderEmpty:m},f)=>{const[p,g]=i([]),[y,v]=i(o?{total:0,current:1,pageSize:10}:null),[b,x]=i(!0),[k,N]=Z({}),[C,S]=Ln({value:c?k.page||1:void 0,defaultValue:1,onChange:e=>{c&&N({page:e||void 0})}}),j=d(async(e=!1)=>{e||x(!0);try{let e;const n={page:C>1?C:void 0};e="string"==typeof u?await je({url:u,params:n}):await u(n),o&&gn(e)?(e.last_page>1?v({total:e.total,current:e.current_page,pageSize:e.per_page}):v(null),e=e.data):v(null),g(e)}catch(e){}finally{x(!1)}},[u,g,C]);s(()=>{j()},[C]),s(()=>{z.current={reload:j}},[j]);const z=a({reload:j});return w(f,()=>z.current),r(Dn,{className:e,children:[t(Be,{wrap:!0,loading:b}),0===p.length&&!b&&m?.(),t(E,{className:X(n,"g-4"),children:p.map((e,n)=>t(L,{className:"d-flex",md:12/l,children:h(e)},`card-${n}`))}),y&&t(Rn,{...y,onChange:S})]})}),Dn=G.div`
|
|
71
|
+
|
|
72
|
+
`,Rn=G(yn)`
|
|
73
|
+
margin-bottom: 0;
|
|
74
|
+
justify-content: flex-end;
|
|
75
|
+
margin-top: 1rem;
|
|
76
|
+
`;var Mn=v(_n);function Fn(){const[e,n]=i(!1),t=a();return s(()=>()=>{t.current&&clearTimeout(t.current)},[]),{copied:e,copy:d(e=>{ee(e),n(!0),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{n(!1),t.current=void 0},3e3)},[])}}function On({as:e="div",className:n,content:r,tooltip:o=!0,placement:a}){const{copy:i,copied:s}=Fn(),c=o?t("i",s?{className:"bi bi-clipboard-check"}:{className:"bi bi-clipboard"}):s?"已复制":"复制",l=y(e,{role:"button",className:n,onClick:()=>{"function"==typeof r&&(r=r()),i(r)}},c);return o?t(ge,{tooltip:s?"已复制":"复制",placement:a,children:l}):l}const Un=c({images:new Map,current:0,setCurrent:()=>null,setShow:()=>null,registerImage:()=>()=>null,getId:()=>0}),An=f(()=>import("./index-C97DS7ut.js")),In=f(()=>import("./image-SX99DbLN.js"));function qn(e){return t(p,{fallback:null,children:t(An,{...e})})}qn.Image=function(e){return t(p,{fallback:null,children:t(In,{...e})})},qn.Context=Un;const Wn=f(()=>import("./infinite-scroller-zConMfyx.js")),Gn=m((e,n)=>t(p,{fallback:null,children:t(Wn,{...e,ref:n})})),Kn=f(()=>import("./slider-DE41CkdN.js"));function Vn(e){return t(p,{fallback:null,children:t(Kn,{...e})})}function Yn({children:e}){return r(I,{children:[t(Qn,{}),e]})}const Qn=V`
|
|
77
|
+
${ne.extractCss()}
|
|
78
|
+
`,Jn=f(()=>import("./cascader-BQf3OIMo.js"));function Xn(e){return t(p,{fallback:null,children:t(Jn,{...e})})}const Zn=f(()=>import("./select-CwDOdXXH.js"));function et(e){return t(p,{fallback:null,children:t(Zn,{...e})})}function nt(e,n,t){const r=a(e),o=a(M(e,n,t));return s(()=>{r.current=e}),s(()=>{o.current=M((...e)=>{r.current(...e)},n,t)},[n,t]),o.current}function tt(e){const[n,t]=i(()=>te("function"==typeof e?e():e,!0));return[n,d(e=>{t("function"==typeof e?re(e):te(e))},[])]}function rt(e="lg"){function n(){const n=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:!n(e),width:window.innerWidth,match:n}}const[t,r]=i(n),o=nt(()=>{r(n())},100);return s(()=>(window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)),[]),t}var ot;!function(e){e[e.init=0]="init",e[e.play=1]="play",e[e.pause=2]="pause",e[e.end=3]="end"}(ot||(ot={}));const at=(e,n)=>{let t=a(!1);const[r,o]=i(()=>{const{lang:e="default",name:t=""}=n.voice||{};return{isPlaying:!1,status:ot[ot.init],lang:n.lang||"default",voiceInfo:{lang:e,name:t},rate:n.rate||1,pitch:n.pitch||1,volume:n.volume||1}}),c=d(()=>{t.current&&o(e=>({...e,isPlaying:!0,status:ot[ot.play]}))},[]),l=d(()=>{t.current&&o(e=>({...e,isPlaying:!1,status:ot[ot.pause]}))},[]),u=d(()=>{t.current&&o(e=>({...e,isPlaying:!1,status:ot[ot.end]}))},[]);return s(()=>{t.current=!0;const r=new SpeechSynthesisUtterance(e);return n.lang&&(r.lang=n.lang),n.voice&&(r.voice=n.voice),r.rate=n.rate||1,r.pitch=n.pitch||1,r.volume=n.volume||1,r.onstart=c,r.onpause=l,r.onresume=c,r.onend=u,window.speechSynthesis.speak(r),()=>{t.current=!1}},[]),r};function it(e,n){s(()=>{const n=e();!async function(){await n}()},n)}export{Pn as $,Tn as A,we as B,Ye as C,be as D,nn as E,Cn as F,Hn as G,ge as H,Un as I,Mn as J,On as K,Be as L,se as M,wn as N,Bn as O,yn as P,qn as Q,qe as R,tn as S,ye as T,Gn as U,Vn as V,_e as W,Yn as X,Xn as Y,et as Z,Te as _,rt as a,Fn as a0,at as a1,it as a2,Ne as a3,Ce as a4,Ln as b,ze as c,tt as d,xe as e,ke as f,Fe as g,Pe as h,gn as i,Oe as j,Ue as k,Ae as l,en as m,Xe as n,Ze as o,cn as p,ln as q,je as r,dn as s,vn as t,nt as u,xn as v,Me as w,kn as x,jn as y,$n as z};
|
|
@@ -0,0 +1,40 @@
|
|
|
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 y,useImperativeHandle as v}from"react";import{B as b,u as x,a as w,b as j,r as C,i as k,N as S,L as E,T as z,C as V,S as N,P as O}from"./index-QRjGJrZt.js";import M from"styled-components";import H from"./index-DQ5B1OmL.js";import q from"dayjs";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"react-async-hook";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";import"@topthink/json-form";const K=function({indeterminate:t=!1,...r}){const n=m(null);return h(()=>{n.current&&(n.current.indeterminate=t)},[t]),e("input",{ref:n,...r,className:"form-check-input",type:"checkbox"})};var B;function D(){return D=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},D.apply(null,arguments)}const P=e=>d.createElement("svg",D({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),B||(B=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 T;function Y(){return Y=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Y.apply(null,arguments)}const F=e=>d.createElement("svg",Y({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),T||(T=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({data:r,options:n,columns:o,onSearch:a}){const[i,c]=p(0),[s,d]=p(r);h(()=>{l(r,s)||(d(r),c(e=>e+1))},[r]);const[m,g,y]=f(()=>{const e={"ui:col":10,"ui:order":n.order},t={},r={};n.fields.forEach(a=>{const i=o.find(e=>e.dataIndex===a);if(i){const o=i.title;if("string"==typeof o){if(e[a]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...n.ui?.[a]},i.valueEnum){const t=i.valueEnum;return e[a]["ui:placeholder"]="请选择",r[a]={title:o,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[a]=void 0,r[a]={title:o,type:"string"}}}}),n.extraFields&&Object.entries(n.extraFields).forEach(([o,a])=>{e[o]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...n.ui?.[o]},t[o]=void 0,r[o]={title:a,type:"string"}});return[{type:"object",properties:r},e,t]},[n.fields,n.extraFields]),v=u(({formData:e})=>{d(e),a({...y,...e})},[a,y]),x=u(()=>{a(y)},[a,y]);return e(R,{children:e(H,{formContext:{layout:"horizontal"},schema:m,uiSchema:g,onSubmit:v,formData:s,children:e("div",{className:"col-12 col-md-2 ms-auto mt-md-auto",children:t("div",{className:"justify-content-end d-flex gap-2 ",children:[e(b,{className:"px-4",onClick:x,variant:"secondary",children:"重置"}),e(b,{className:"px-4",type:"submit",variant:"primary",children:"查询"})]})})})},i)}const R=M.div`
|
|
2
|
+
margin-bottom: 1rem;
|
|
3
|
+
`;function _({keyword:t,onKeywordChange:r}){const[n,o]=p(t),i=x(r,500);h(()=>{o(t)},[t]);const c=u(e=>{o(e.target.value),i(e.target.value)},[i,o]);return e(a,{value:n,onChange:c,type:"search",placeholder:"Search..."})}const A=M.thead`
|
|
4
|
+
th {
|
|
5
|
+
padding: 0.5rem 0.5rem;
|
|
6
|
+
border-bottom-width: 1px;
|
|
7
|
+
border-color: var(--bs-border-color);
|
|
8
|
+
white-space: nowrap;
|
|
9
|
+
}
|
|
10
|
+
`,L={table:t=>e(i,{...t,className:"mb-0 align-middle table-hover"}),header:{wrapper:t=>e(A,{...t})}},$=M.a`
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
width: 28px;
|
|
13
|
+
height: 28px;
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
vertical-align: middle;
|
|
18
|
+
`,G=function({record:t,expanded:r,expandable:n,onExpand:o}){return e($,n?{onClick:e=>o(t,e),children:e(r?F:P,{})}:{})},J=M(O)`
|
|
19
|
+
margin-bottom: 0;
|
|
20
|
+
justify-content: flex-end;
|
|
21
|
+
margin-top: 1rem;
|
|
22
|
+
`,Q=y(({source:a,rowKey:i="id",paginate:l=!0,toolBarRender:d,columns:g=[],search:y,rowSelection:b,card:x=!0,expandable:N={},sync:O=!1,...M},H)=>{const[B,D]=p([]),[P,T]=p(l?{total:0,current:1,pageSize:10}:null),[Y,F]=p(!0),{match:R}=w(),[A,$]=c({}),[Q,U]=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(K,{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({record:t}){const r=i(t),n=o.has(r);return e(K,{checked:n,onChange:()=>{n?o.delete(r):o.add(r),l(new Set(o))}})}},...r]},[n,t,o]),l]}(b,i,B),te=f(()=>s(A,["q","page"]),[A]),[re,ne]=j({value:O?te:void 0,defaultValue:{},onChange:e=>{O&&$(e)}}),[oe,ae]=j({value:O?A.q||"":void 0,defaultValue:"",onChange:e=>{O&&$({q:e||void 0})}}),[ie,ce]=j({value:O?A.page||1:void 0,defaultValue:1,onChange:e=>{O&&$({page:e||void 0})}}),le=u(async(e=!1)=>{e||F(!0),U([]);try{let e;const t={...re,q:oe,page:ie>1?ie:void 0};e="string"==typeof a?await C({url:a,params:t}):await a(t),l&&k(e)?(T({total:e.total,current:e.current_page,pageSize:e.per_page}),e=e.data):T(null),D(e)}catch(e){}finally{F(!1)}},[a,D,oe,ie,re]);h(()=>{le()},[oe,ie,re]);const se=m({reload:le});h(()=>{se.current={reload:le}},[le]),v(H,()=>se.current);const de=f(()=>Q(g).flatMap(({render:t,valueType:r,valueEnum:n,display:o,...a})=>{const i={...a};if(o&&!R(o))return[];if(t?i.render=(e,r,n)=>t({value:e,record:r,index:n,action:se.current}):"currency"===r?i.render=t=>e(S,{value:t}):"date"===r?i.render=e=>q(e).format("YYYY-MM-DD"):n&&(i.render=t=>n[t]?n[t].status?e("span",{className:`text-${n[t].status}`,children:n[t].text}):n[t].text:t),a.empty){const e=i.render||(e=>e);i.render=function(t,r,n){return t?e(t,r,n):a.empty}}return[i]}),[g,Q,se,R]);"scroll"in M||R("xl")||(M.scroll={x:!0});const pe=t(r,{children:[e(E,{loading:Y}),"object"==typeof y&&e(I,{data:re,columns:g,options:y,onSearch:e=>{o(()=>{ce(1),ne(e)})}}),!1!==d&&t(W,{children:[e(Z,{size:12,children:d&&d(se.current)}),t(X,{size:12,children:[!0===y&&e(_,{keyword:oe,onKeywordChange:e=>{o(()=>{ce(1),ae(e)})}}),e(ee,{onClick:()=>{se.current.reload()},children:e("i",{className:"bi bi-arrow-repeat"})})]})]}),e(z.Provider,{value:!0,children:e(n,{...M,expandable:{expandIcon:G,...N},rowKey:i,columns:de,components:L,data:B})}),P&&e(J,{...P,onChange:ce})]});return x?e(V,{children:pe}):pe});var U=g(Q);const W=M.div`
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
padding-bottom: 1rem;
|
|
26
|
+
height: 48px;
|
|
27
|
+
border-bottom: 2px solid #212529;
|
|
28
|
+
`,X=M(N)`
|
|
29
|
+
|
|
30
|
+
`,Z=M(N)`
|
|
31
|
+
|
|
32
|
+
`,ee=M.span`
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
font-size: 20px;
|
|
35
|
+
line-height: 1;
|
|
36
|
+
|
|
37
|
+
&:hover {
|
|
38
|
+
color: var(--bs-primary);
|
|
39
|
+
}
|
|
40
|
+
`;export{U as default};
|
package/es/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{B as Button,C as Card,J as CardList,Y as Cascader,K as Clipboard,E as Error,F as Form,v as ImageZoom,U as InfiniteScroller,Q as Lightbox,L as Loader,t as LoadingButton,M as Message,D as Modal,A as ModalButton,z as ModalForm,N as NumberFormat,G as Offcanvas,O as OffcanvasButton,P as Pagination,m as Panel,n as PanelGroup,W as Qrcode,x as RequestButton,R as Result,Z as Select,V as Slider,S as Space,s as Statistic,q as Step,p as Steps,y as Table,e as Toast,X as ToastProvider,H as Tooltip,j as formatLongNumber,h as formatNumber,g as formatSize,l as getAbsoluteUrl,k as isImageUrl,f as isRecord,a3 as isRequestError,r as request,a4 as showRequestError,a2 as useAsyncEffect,a0 as useClipboard,b as useControllableState,u as useDebounce,d as useImmer,$ as useOverlayState,o as usePanel,_ as useRequest,c as useSafeState,a1 as useSpeech,a as useWindowSize,w as waitPayComplete}from"./index-
|
|
1
|
+
export{B as Button,C as Card,J as CardList,Y as Cascader,K as Clipboard,E as Error,F as Form,v as ImageZoom,U as InfiniteScroller,Q as Lightbox,L as Loader,t as LoadingButton,M as Message,D as Modal,A as ModalButton,z as ModalForm,N as NumberFormat,G as Offcanvas,O as OffcanvasButton,P as Pagination,m as Panel,n as PanelGroup,W as Qrcode,x as RequestButton,R as Result,Z as Select,V as Slider,S as Space,s as Statistic,q as Step,p as Steps,y as Table,e as Toast,X as ToastProvider,H as Tooltip,j as formatLongNumber,h as formatNumber,g as formatSize,l as getAbsoluteUrl,k as isImageUrl,f as isRecord,a3 as isRequestError,r as request,a4 as showRequestError,a2 as useAsyncEffect,a0 as useClipboard,b as useControllableState,u as useDebounce,d as useImmer,$ as useOverlayState,o as usePanel,_ as useRequest,c as useSafeState,a1 as useSpeech,a as useWindowSize,w as waitPayComplete}from"./index-QRjGJrZt.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{default as queryString}from"query-string";export{freeze,immerable,produce}from"immer";export{default as dayjs}from"dayjs";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"notistack";import"path";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{memo as a,forwardRef as r,useState as e,useCallback as o,useImperativeHandle as i}from"react";import s from"react-infinite-scroller";import{d as m,r as p,i as n}from"./index-QRjGJrZt.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"react-async-hook";import"styled-components";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";var c=a(r(({source:a,render:r,as:c,useWindow:l,className:u,getState:g,limit:y=10},f)=>{const[h,j]=e(!1),[w,x]=m({params:{},end:!1,data:[]}),b=o(async(t=!1)=>{if(!h){j(!0);try{let r;const e=t?{}:w.params;r="string"==typeof a?await p({url:a,params:e}):await a(e),g||(g=t=>n(t)?{params:{page:t.current_page+1},end:t.current_page>=t.last_page,data:t.data}:{params:{offset:d(t)?.id},end:t.length<y,data:t});const o=g(r);x({...o,data:t?o.data:[...w.data,...o.data]})}catch{x({...w,end:!0})}finally{j(!1)}}},[a,w,g,h]),v=o(()=>{b(!0)},[b]);i(f,()=>({reload:v}),[v]);const _=o(t=>{x(a=>{const r=t(a.data);r&&(a.data=r)})},[x]);return t(s,{className:u,hasMore:!w.end,pageStart:0,loadMore:()=>{b()},useWindow:l,element:c,children:r({data:w.data,setData:_,end:w.end,loading:h,action:{reload:v}})})}));export{c as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import e from"rc-select";import"rc-select/assets/index.less";import{useRef as o}from"react";import{CloseButton as t}from"react-bootstrap";import s,{css as c}from"styled-components";function i(
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import e from"rc-select";import"rc-select/assets/index.less";import{useRef as o}from"react";import{CloseButton as t}from"react-bootstrap";import s,{css as c}from"styled-components";function i({size:e,allowClear:s,...c}){s=s?{clearIcon:r(t,{})}:void 0;const i=o(null);return r(d,{$size:e,...c,ref:i,allowClear:s,dropdownClassName:"dropdown-menu",getPopupContainer:()=>i.current?.nativeElement||document.body})}const d=s(e)`
|
|
2
2
|
&&& {
|
|
3
3
|
width: 100%;
|
|
4
4
|
font-size: 1rem;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import{jsx as r,Fragment as t}from"react/jsx-runtime";import e,{Step as s}from"rc-steps";export{Step}from"rc-steps";import"rc-steps/assets/index.css";import o from"styled-components";import*as c from"react";var i;function n(){return n=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var s in e)({}).hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},n.apply(null,arguments)}const p=r=>c.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},r),i||(i=c.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.216"})));function a(e){return r(m,{icons:{finish:r(p,{}),error:r(t,{})},...e})}a.Step=s;const m=o(e)`
|
|
2
|
+
.rc-steps-item-icon {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
|
|
7
|
+
& > .rc-steps-icon {
|
|
8
|
+
top: 0;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.rc-steps-item-process {
|
|
13
|
+
.rc-steps-item-icon {
|
|
14
|
+
background: var(--bs-primary);
|
|
15
|
+
border-color: var(--bs-primary);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.rc-steps-item-finish {
|
|
20
|
+
.rc-steps-item-icon {
|
|
21
|
+
border-color: var(--bs-primary);
|
|
22
|
+
|
|
23
|
+
& > .rc-steps-icon {
|
|
24
|
+
color: var(--bs-primary);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.rc-steps-item-title:after {
|
|
29
|
+
background-color: var(--bs-primary);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
`;export{a as default};
|
package/package.json
CHANGED
|
@@ -1,79 +1,77 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"gitHead": "a3b55b29586394f73a1a16982d2f1c13901d5061"
|
|
79
|
-
}
|
|
2
|
+
"name": "@topthink/components",
|
|
3
|
+
"version": "1.1.24",
|
|
4
|
+
"module": "es/index.js",
|
|
5
|
+
"types": "types/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"es",
|
|
8
|
+
"types",
|
|
9
|
+
"scss"
|
|
10
|
+
],
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@babel/runtime": "^7.11.2",
|
|
13
|
+
"@toast-ui/editor": "^3.2.2",
|
|
14
|
+
"@toast-ui/react-editor": "^3.2.3",
|
|
15
|
+
"@topthink/bootstrap": "^1.0.27",
|
|
16
|
+
"@topthink/json-form": "^1.0.67",
|
|
17
|
+
"@types/react-infinite-scroller": "^1.2.5",
|
|
18
|
+
"ajv-i18n": "^4.0.0",
|
|
19
|
+
"axios": "^0.27.2",
|
|
20
|
+
"classnames": "^2.3.1",
|
|
21
|
+
"copy-to-clipboard": "^3.3.3",
|
|
22
|
+
"dayjs": "^1.10.7",
|
|
23
|
+
"goober": "^2.1.16",
|
|
24
|
+
"immer": "^9.0.6",
|
|
25
|
+
"notistack": "^3.0.1",
|
|
26
|
+
"qrcode.react": "^4.0.1",
|
|
27
|
+
"query-string": "^8.1.0",
|
|
28
|
+
"rc-cascader": "^3.33.1",
|
|
29
|
+
"rc-select": "^14.16.6",
|
|
30
|
+
"rc-slider": "^10.6.2",
|
|
31
|
+
"rc-steps": "^4.1.4",
|
|
32
|
+
"rc-table": "^7.47.1",
|
|
33
|
+
"react-async-hook": "^4.0.0",
|
|
34
|
+
"react-infinite-scroller": "^1.2.6",
|
|
35
|
+
"react-intersection-observer": "^9.10.2",
|
|
36
|
+
"react-medium-image-zoom": "^5.1.6",
|
|
37
|
+
"retry-axios": "^2.6.0",
|
|
38
|
+
"styled-components": "^6.1.11",
|
|
39
|
+
"sweetalert2": "^11.0.18",
|
|
40
|
+
"sweetalert2-react-content": "^4.1.0",
|
|
41
|
+
"use-url-search-params": "^2.5.1",
|
|
42
|
+
"yet-another-react-lightbox": "^3.17.5"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"lodash": "*",
|
|
46
|
+
"react": "^17||^18",
|
|
47
|
+
"react-bootstrap": "^2.1.2",
|
|
48
|
+
"react-dom": "^17||^18"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@babel/core": "^7.23.6",
|
|
52
|
+
"@babel/plugin-transform-runtime": "^7.23.6",
|
|
53
|
+
"@babel/preset-env": "^7.23.6",
|
|
54
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
55
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
56
|
+
"@rollup/plugin-image": "^3.0.3",
|
|
57
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
58
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
59
|
+
"@rollup/plugin-typescript": "^11.1.5",
|
|
60
|
+
"@svgr/rollup": "^8.1.0",
|
|
61
|
+
"@types/lodash": "^4.14.161",
|
|
62
|
+
"@types/node": "^18.11.18",
|
|
63
|
+
"@types/react": "^17.0.0",
|
|
64
|
+
"@types/react-dom": "^17.0.0",
|
|
65
|
+
"react-bootstrap": "^2.1.2",
|
|
66
|
+
"rollup": "^4.8.0",
|
|
67
|
+
"typescript": "^5.3.3"
|
|
68
|
+
},
|
|
69
|
+
"author": "yunwuxin <tzzhangyajun@qq.com> (https://github.com/yunwuxin)",
|
|
70
|
+
"license": "MIT",
|
|
71
|
+
"scripts": {
|
|
72
|
+
"prebuild": "rimraf es types",
|
|
73
|
+
"build": "rollup -c --environment NODE_ENV:production",
|
|
74
|
+
"build:dev": "rollup -c",
|
|
75
|
+
"watch": "rollup -c -w"
|
|
76
|
+
}
|
|
77
|
+
}
|
package/scss/app.scss
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
@import "~@topthink/bootstrap/scss/bootstrap";
|
|
2
|
-
|
|
3
|
-
.btn-link {
|
|
4
|
-
padding: 0;
|
|
5
|
-
}
|
|
1
|
+
@import "~@topthink/bootstrap/scss/bootstrap";
|
|
2
|
+
|
|
3
|
+
.btn-link {
|
|
4
|
+
padding: 0;
|
|
5
|
+
}
|
|
@@ -17,5 +17,5 @@ export interface CardListType {
|
|
|
17
17
|
reload: (silent?: boolean) => void;
|
|
18
18
|
}
|
|
19
19
|
export type CustomCardListType<T = any> = ForwardRefExoticComponent<PropsWithoutRef<PropsWithChildren<CardListProps<T>>> & RefAttributes<CardListType>>;
|
|
20
|
-
declare const _default: CustomCardListType
|
|
20
|
+
declare const _default: CustomCardListType;
|
|
21
21
|
export default _default;
|
|
@@ -27,5 +27,5 @@ interface Props<RecordType> {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
export type CustomInfiniteScrollerType<T = any> = ForwardRefExoticComponent<PropsWithoutRef<PropsWithChildren<Props<T>>> & RefAttributes<InfiniteScrollerType>>;
|
|
30
|
-
declare const _default: CustomInfiniteScrollerType
|
|
30
|
+
declare const _default: CustomInfiniteScrollerType;
|
|
31
31
|
export default _default;
|
|
@@ -43,5 +43,5 @@ type Params = {
|
|
|
43
43
|
[key: string]: any;
|
|
44
44
|
};
|
|
45
45
|
export type CustomTableType<T = any> = ForwardRefExoticComponent<PropsWithoutRef<PropsWithChildren<TableProps<T>>> & RefAttributes<TableType>>;
|
|
46
|
-
declare const _default: CustomTableType
|
|
46
|
+
declare const _default: CustomTableType;
|
|
47
47
|
export default _default;
|
|
@@ -4,7 +4,7 @@ declare const LazyLightbox: import("react").LazyExoticComponent<typeof import(".
|
|
|
4
4
|
declare const LazyImage: import("react").LazyExoticComponent<import("react").MemoExoticComponent<({ lazy, ...props }: import("./lazy/lightbox/image").Props) => import("react/jsx-runtime").JSX.Element>>;
|
|
5
5
|
declare function Lightbox(props: ComponentProps<typeof LazyLightbox>): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
declare namespace Lightbox {
|
|
7
|
-
var Image: (props:
|
|
7
|
+
var Image: (props: ComponentProps<typeof LazyImage>) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
var Context: import("react").Context<import("./lazy/lightbox/context").ImageContextType>;
|
|
9
9
|
}
|
|
10
10
|
export default Lightbox;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
2
|
declare const LazySteps: import("react").LazyExoticComponent<typeof import("./lazy/steps").default>;
|
|
3
|
-
declare const LazyStep: import("react").LazyExoticComponent<typeof import("rc-steps
|
|
3
|
+
declare const LazyStep: import("react").LazyExoticComponent<typeof import("rc-steps").Step>;
|
|
4
4
|
declare function Steps(props: ComponentProps<typeof LazySteps>): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
declare namespace Steps {
|
|
6
|
-
var Step: (props:
|
|
6
|
+
var Step: (props: ComponentProps<typeof LazyStep>) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
}
|
|
8
8
|
export default Steps;
|
|
9
9
|
declare const Step: (props: ComponentProps<typeof LazyStep>) => import("react/jsx-runtime").JSX.Element;
|
package/types/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export { default as useOverlayState } from './hooks/use-overlay-state';
|
|
|
46
46
|
export { default as useControllableState } from './hooks/use-controllable-state';
|
|
47
47
|
export { default as useDebounce } from './hooks/use-debounce';
|
|
48
48
|
export { default as useSafeState } from './hooks/use-safe-state';
|
|
49
|
-
export { default as useImmer } from './hooks/use-immer';
|
|
49
|
+
export { default as useImmer, Updater } from './hooks/use-immer';
|
|
50
50
|
export { default as useClipboard } from './hooks/use-clipboard';
|
|
51
51
|
export { default as useWindowSize } from './hooks/use-window-size';
|
|
52
52
|
export { default as useSpeech } from './hooks/use-speech';
|
package/types/request.d.ts
CHANGED
|
@@ -33,21 +33,21 @@ export interface RequestInstance<T = any> {
|
|
|
33
33
|
(config: RequestConfig): Promise<T>;
|
|
34
34
|
interceptors: AxiosInstance['interceptors'];
|
|
35
35
|
}
|
|
36
|
-
export declare const isRequestError: (payload: any) => payload is import("axios").AxiosError
|
|
36
|
+
export declare const isRequestError: (payload: any) => payload is import("axios").AxiosError;
|
|
37
37
|
export declare const showRequestError: (e: any) => void;
|
|
38
38
|
declare const request: {
|
|
39
39
|
<T = any>(config: RequestConfig, instance?: AxiosInstance): Promise<T>;
|
|
40
40
|
create(config?: AxiosRequestConfig): {
|
|
41
41
|
(config: RequestConfig): Promise<any>;
|
|
42
42
|
interceptors: {
|
|
43
|
-
request: import("axios").AxiosInterceptorManager<AxiosRequestConfig
|
|
44
|
-
response: import("axios").AxiosInterceptorManager<import("axios").AxiosResponse
|
|
43
|
+
request: import("axios").AxiosInterceptorManager<AxiosRequestConfig>;
|
|
44
|
+
response: import("axios").AxiosInterceptorManager<import("axios").AxiosResponse>;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
defaults: import("axios").AxiosDefaults<any>;
|
|
48
48
|
interceptors: {
|
|
49
|
-
request: import("axios").AxiosInterceptorManager<AxiosRequestConfig
|
|
50
|
-
response: import("axios").AxiosInterceptorManager<import("axios").AxiosResponse
|
|
49
|
+
request: import("axios").AxiosInterceptorManager<AxiosRequestConfig>;
|
|
50
|
+
response: import("axios").AxiosInterceptorManager<import("axios").AxiosResponse>;
|
|
51
51
|
};
|
|
52
52
|
};
|
|
53
53
|
export default request;
|
package/es/image-qSKcFPGU.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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-t5sPwmd8.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"react-async-hook";import"styled-components";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";var n=e((e=>{let{lazy:n=!0,...p}=e;const{registerImage:c,setShow:l,setCurrent:d,getId:h}=i(a),[g,u]=o(),[w,f]=o(!1),{ref:y,inView:v}=m({threshold:.2,skip:!n,initialInView:!0}),[j]=o(h);if(s((()=>{if(p.src)return c(j,p.src)}),[]),w)return t(r,{children:p.alt?`[图片加载失败:${p.alt}]`:" "});const x=!v&&n&&g?"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":p.src;return t("img",{width:g?.[0],height:g?.[1],onLoad:t=>{g||u([t.currentTarget.clientWidth,t.currentTarget.clientHeight])},onError:()=>{f(!0)},ref:y,...p,alt:void 0,src:x,onClick:()=>{d(j),l(!0)}})}));export{n as default};
|
package/es/index-So7TiG4o.js
DELETED
|
@@ -1,40 +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 m,useRef as u,useEffect as h,useMemo as f,memo as g,forwardRef as y,useImperativeHandle as v}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 z,T as O,C as V,S as N}from"./index-t5sPwmd8.js";import M from"styled-components";import H from"./index-kOIT3IUs.js";import q from"dayjs";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"react-async-hook";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";import"@topthink/json-form";const K=function(t){let{indeterminate:r=!1,...n}=t;const o=u(null);return h((()=>{o.current&&(o.current.indeterminate=r)}),[r]),e("input",{ref:o,...n,className:"form-check-input",type:"checkbox"})};var B;function D(){return D=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},D.apply(this,arguments)}const P=e=>d.createElement("svg",D({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),B||(B=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 T;function Y(){return Y=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},Y.apply(this,arguments)}const F=e=>d.createElement("svg",Y({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),T||(T=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,u]=p(n);h((()=>{l(n,d)||(u(n),s((e=>e+1)))}),[n]);const[g,y,v]=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=m((e=>{let{formData:t}=e;u(t),i({...v,...t})}),[i,v]),w=m((()=>{i(v)}),[i,v]);return e(R,{children:e(H,{formContext:{layout:"horizontal"},schema:g,uiSchema:y,onSubmit:x,formData:d,children:e("div",{className:"col-12 col-md-2 ms-auto mt-md-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=M.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=m((e=>{i(e.target.value),c(e.target.value)}),[c,i]);return e(a,{value:o,onChange:l,type:"search",placeholder:"Search..."})}const A=M.thead`
|
|
4
|
-
th {
|
|
5
|
-
padding: 0.5rem 0.5rem;
|
|
6
|
-
border-bottom-width: 1px;
|
|
7
|
-
border-color: var(--bs-border-color);
|
|
8
|
-
white-space: nowrap;
|
|
9
|
-
}
|
|
10
|
-
`,L={table:t=>e(i,{...t,className:"mb-0 align-middle table-hover"}),header:{wrapper:t=>e(A,{...t})}},$=M.a`
|
|
11
|
-
cursor: pointer;
|
|
12
|
-
width: 28px;
|
|
13
|
-
height: 28px;
|
|
14
|
-
display: inline-flex;
|
|
15
|
-
align-items: center;
|
|
16
|
-
justify-content: center;
|
|
17
|
-
vertical-align: middle;
|
|
18
|
-
`,G=function(t){let{record:r,expanded:n,expandable:o,onExpand:a}=t;return e($,o?{onClick:e=>a(r,e),children:e(n?F:P,{})}:{})},J=M(w)`
|
|
19
|
-
margin-bottom: 0;
|
|
20
|
-
justify-content: flex-end;
|
|
21
|
-
margin-top: 1rem;
|
|
22
|
-
`,Q=y(((a,i)=>{let{source:l,rowKey:d="id",paginate:g=!0,toolBarRender:y,columns:b=[],search:x,rowSelection:w,card:N=!0,expandable:M={},sync:H=!1,...B}=a;const[D,P]=p([]),[T,Y]=p(g?{total:0,current:1,pageSize:10}:null),[F,R]=p(!0),{match:A}=j(),[$,Q]=c({}),[U,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=m((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[m((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(K,{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(K,{checked:a,onChange:()=>{a?o.delete(n):o.add(n),l(new Set(o))}})}},...r]}),[n,t,o]),l]}(w,d,D),re=f((()=>s($,["q","page"])),[$]),[ne,oe]=C({value:H?re:void 0,defaultValue:{},onChange:e=>{H&&Q(e)}}),[ae,ie]=C({value:H?$.q||"":void 0,defaultValue:"",onChange:e=>{H&&Q({q:e||void 0})}}),[ce,le]=C({value:H?$.page||1:void 0,defaultValue:1,onChange:e=>{H&&Q({page:e||void 0})}}),se=m((async function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]||R(!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)?(Y({total:e.total,current:e.current_page,pageSize:e.per_page}),e=e.data):Y(null),P(e)}catch(e){}finally{R(!1)}}),[l,P,ae,ce,ne]);h((()=>{se()}),[ae,ce,ne]);const de=u({reload:se});h((()=>{de.current={reload:se}}),[se]),v(i,(()=>de.current));const pe=f((()=>U(b).flatMap((t=>{let{render:r,valueType:n,valueEnum:o,display:a,...i}=t;const c={...i};if(a&&!A(a))return[];if(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}):"date"===n?c.render=e=>q(e).format("YYYY-MM-DD"):o&&(c.render=t=>o[t]?o[t].status?e("span",{className:`text-${o[t].status}`,children:o[t].text}):o[t].text:t),i.empty){const e=c.render||(e=>e);c.render=function(t,r,n){return t?e(t,r,n):i.empty}}return[c]}))),[b,U,de,A]);"scroll"in B||A("xl")||(B.scroll={x:!0});const me=t(r,{children:[e(z,{loading:F}),"object"==typeof x&&e(I,{data:ne,columns:b,options:x,onSearch:e=>{o((()=>{le(1),oe(e)}))}}),!1!==y&&t(W,{children:[e(Z,{size:12,children:y&&y(de.current)}),t(X,{size:12,children:[!0===x&&e(_,{keyword:ae,onKeywordChange:e=>{o((()=>{le(1),ie(e)}))}}),e(ee,{onClick:()=>{de.current.reload()},children:e("i",{className:"bi bi-arrow-repeat"})})]})]}),e(O.Provider,{value:!0,children:e(n,{...B,expandable:{expandIcon:G,...M},rowKey:d,columns:pe,components:L,data:D})}),T&&e(J,{...T,onChange:le})]});return N?e(V,{children:me}):me}));var U=g(Q);const W=M.div`
|
|
23
|
-
display: flex;
|
|
24
|
-
justify-content: space-between;
|
|
25
|
-
padding-bottom: 1rem;
|
|
26
|
-
height: 48px;
|
|
27
|
-
border-bottom: 2px solid #212529;
|
|
28
|
-
`,X=M(N)`
|
|
29
|
-
|
|
30
|
-
`,Z=M(N)`
|
|
31
|
-
|
|
32
|
-
`,ee=M.span`
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
font-size: 20px;
|
|
35
|
-
line-height: 1;
|
|
36
|
-
|
|
37
|
-
&:hover {
|
|
38
|
-
color: var(--bs-primary);
|
|
39
|
-
}
|
|
40
|
-
`;export{U as default};
|
package/es/index-kOIT3IUs.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 i,useCallback as n}from"react";import s from"axios";import{c as p,r as l,B as m}from"./index-t5sPwmd8.js";import{mapValues as d}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"react-async-hook";import"styled-components";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";const c=require("ajv-i18n/localize/zh"),u=a.lazy((()=>import("./editor-widget-ZqrBTAWC.js"))),f=o=>t(a.Suspense,{fallback:null,children:t(u,{...o})}),y={upload:function(o){let{options:a,...e}=o;const{widgets:i}=r();return a.endpoint&&(a.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:r,value:e}=await l({url:a.endpoint,method:"post",data:o});return{url:r,value:e}}),t(i.upload,{...e,options:a})},avatar:function(o){let{options:a,...e}=o;const{widgets:i}=r();return a.endpoint&&(a.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:r}=await l({url:a.endpoint,method:"post",data:o});return r}),t(i.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 l({url:r.endpoint,method:"post",data:o});return a}),t(f,{...a,options:r})},typeahead:function(o){let{options:a,...e}=o;const{widgets:i}=r();return a.endpoint&&(a.onSearch=async t=>{let{value:o,query:r}=t;return await l({url:a.endpoint,params:{value:o,query:r}})}),t(i.typeahead,{...e,options:a})}},h=e(((r,a)=>{let{action:e,method:u="post",onSuccess:f,formData:h,onSubmitting:w,onSubmit:b,onChange:g,submitText:v="保存",transformData:j,children:x,validate:D,disabled:S,...k}=r;const[q,z]=i(),[_,E]=p(!1),[F,U]=i(h),C=n((async(t,o)=>{if(!_)try{if(E(!0),w&&w(!0),e){let{formData:o}=t;j&&(o=j(o));try{const t=await l({url:e,method:u,data:o});return z(void 0),f&&await f(t),t}catch(t){if(!s.isAxiosError(t))throw t;z((t=>{const o=t.errors;return"string"==typeof o?{__errors:[o]}:d(o,(t=>({__errors:[t]})))})(t))}}else if(b)return await b(t,o)}finally{E(!1),w&&w(!1)}}),[e,u,b]),N=n((t=>{const{formData:o}=t;U(o),g&&g(t)}),[U,g]),T=n((t=>(t=t.map((t=>({keyword:t.name,dataPath:t.property,...t}))),c(t),t)),[]),V=t(m,{className:"px-4",disabled:S,loading:_,type:"submit",variant:"primary",children:v});"function"==typeof x&&(x=x({submit:V,loading:_,disabled:S}));const A=!D;return!0===D&&(D=void 0),t(o,{ref:a,extraErrors:q,onSubmit:C,transformErrors:T,noHtml5Validate:!0,noValidate:A,validate:D,disabled:S,...k,formData:F,onChange:N,widgets:y,children:x||t("div",{className:"col-12",children:V})})}));export{h as default};
|
package/es/index-t5sPwmd8.js
DELETED
|
@@ -1,78 +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 a,useState as i,useEffect as s,createContext as c,Fragment as l,useContext as d,useCallback as u,useMemo as h,forwardRef as m,lazy as f,Suspense as p,Children as g,createElement as y,useImperativeHandle as w,memo as v}from"react";import{OverlayTrigger as b,Tooltip as x,Spinner as k,Button as N,Modal as C,ButtonGroup as S,ToggleButton as j,Card as z,Accordion as P,Stack as T,Alert as $,Pagination as H,Offcanvas as B,Row as E,Col as L}from"react-bootstrap";import{uniqueId as _,values as D,omit as R,debounce as M}from"lodash";import F from"axios";import O from"query-string";import*as A from"retry-axios";import{enqueueSnackbar as U,SnackbarProvider as I}from"notistack";import q from"path";import{useAsyncCallback as W}from"react-async-hook";import G,{css as K,createGlobalStyle as V}from"styled-components";import Y from"dayjs";import"dayjs/locale/zh-cn";import Q from"dayjs/plugin/relativeTime";import J from"dayjs/plugin/duration";import X from"classnames";import{useUrlSearchParams as Z}from"use-url-search-params";import ee from"copy-to-clipboard";import*as te from"goober";import{freeze as ne,produce as re}from"immer";import"react-intersection-observer";const oe=()=>{document.body.style.setProperty("--vh",window.innerHeight/100+"px"),document.body.style.setProperty("--100vh",window.innerHeight+"px")};window.addEventListener("resize",oe),oe();const ae=t(e),ie={confirmButtonText:"确定",cancelButtonText:"取消"},se={confirm:async e=>{const{isConfirmed:t}=await ae.fire({...ie,icon:"warning",showCancelButton:!0,...e,async preConfirm(t){if(e.preConfirm)try{return await e.preConfirm(t)}catch(e){return e instanceof Error&&ae.showValidationMessage(e.message),!1}return!0}});return t},success:e=>{ae.fire({...ie,toast:!0,position:"top",icon:"success",timer:2e3,showConfirmButton:!1,...e})},error:e=>{ae.fire({...ie,toast:!0,position:"top",icon:"error",timer:5e3,showConfirmButton:!1,...e})},close:e=>{ae.close(e)},defaults:ie};const ce=c({});function le(e){return t=>{let{resolve:r,destroy:o,message:c}=t;const[l,m]=function(e){const t=a(null),[n,r]=i(e);return s((()=>{t.current&&(t.current(),t.current=null)}),[n]),[n,(e,n)=>{t.current="function"==typeof n?n:null,r(e)}]}(!0),f=d(ce),p=u((e=>{m(!1,(()=>{r(e)}))}),[m,r]),g=h((()=>({show:l,onHide:()=>p(),onExited:()=>o(),container:f.container})),[l,p,o]);return n(e,{resolve:p,state:g,message:c})}}function de(e){return t=>new Promise((r=>{const o=n(e,{resolve:r,destroy:()=>{fe(o)},message:t});me(o)}))}let ue=()=>{},he=new Set;const me=e=>{he=new Set(he),he.add(e),ue(he)},fe=e=>{he=new Set(he),he.delete(e),ue(he)};function pe(e,t){return de(le(e))(t)}function ge(e){let{tooltip:t,children:r,placement:o="bottom"}=e;return n(b,{placement:o,overlay:n(x,{id:_(),children:t}),children:r})}const ye=c(!1),we=m(((e,t)=>{let{loading:a,percent:i,disabled:s,children:c,tooltip:l,variant:u,...h}=e;d(ye)&&!u&&(u="link"),a&&(s=!0,c=r(o,{children:[n(k,{ref:t,as:"span",size:"sm",role:"status","aria-hidden":"true",animation:"border"}),i?r("span",{className:"ms-2",children:[i,"%"]}):null]}));const m=n(N,{ref:t,...h,variant:u,disabled:s,children:c});return l?n(ge,{tooltip:l,children:n("span",{className:"d-inline-block",children:m})}):m})),ve=function(e){let{state:t,message:{title:o,message:a,okText:i,cancelText:s},resolve:c}=e;return r(C,{...t,children:[n(C.Header,{children:n(C.Title,{as:"h5",children:o||"确认"})}),n(C.Body,{children:a}),r(C.Footer,{children:[n(we,{variant:"secondary",onClick:()=>c(),children:s||"取消"}),n(we,{onClick:()=>c(!0),children:i||"确定"})]})]})};const be=e=>{let{header:t,children:a,footer:s,closable:c=!0,show:l,cancelText:d="取消",okText:u="确定",onOk:m,onCancel:f,onHide:p,okButtonProps:g,bodyAs:y,headerAs:w="h5",confirmLoading:v=!1,...b}=e;const[x,k]=i(!1),N=h((()=>n(we,{loading:x||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,x,v]),S=h((()=>n(we,{variant:"secondary",onClick:e=>{f?.(e),e.defaultPrevented||p?.()},children:d})),[f,p,d]),j={close:()=>{p?.()}};switch(typeof s){case"undefined":s=r(o,{children:[S,N]});break;case"function":s=s({okButton:N,cancelButton:S,action:j})}return r(C,{...b,onHide:p,show:l,children:[t&&n(C.Header,{closeButton:c,children:n(C.Title,{as:w,children:t})}),n(C.Body,{as:y,children:a}),s&&n(C.Footer,{children:s})]})};be.Message=function(e){const[t,r]=i(he);return s((()=>{ue=r}),[]),n(ce.Provider,{value:e,children:Array.from(t).map(((e,t)=>n(l,{children:e},`message-${t}`)))})},be.confirm=function(e){return de(le(ve))(e)},be.show=pe;const xe=["default","error","warning","success","info"].reduce(((e,t)=>(e[t]=(e,n)=>U(e,{variant:t,autoHideDuration:3e3,anchorOrigin:{vertical:"top",horizontal:"center"},...n}),e)),{});function ke(e){return e&&"object"==typeof e}A.attach(),F.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)}},F.defaults.maxContentLength=1/0,F.defaults.maxBodyLength=1/0,F.defaults.baseURL="/api",F.defaults.authTokenName="authorization";const Ne=F.isAxiosError,Ce=e=>{if(!F.isAxiosError(e))throw e;xe.error(e.message)},Se=function(e){e?.baseURL&&(e.baseURL=q.resolve(F.defaults.baseURL||"/",e.baseURL));const t=F.create(e);return A.attach(t),t.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))),t.interceptors.response.use((e=>(201===e.status&&e.data.location&&(window.location.href=e.data.location,e.data=void 0),e)),(e=>{if(F.isAxiosError(e)&&e.response){const{data:t,status:n}=e.response;401===n?e.errors="Unauthorized":ke(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)})),t},je=async function(e,t){if(t||(t=Se()),e="string"==typeof e?{url:e}:e,(e={paramsSerializer:function(e){return O.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 a=e.target,{responseText:i}=a;for(;t<e.loaded;){const e=i.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:n}=await t.request(e);return n};je.create=function(e){const t=Se(e),n=e=>je(e,t);return n.interceptors=t.interceptors,n},je.defaults=F.defaults,je.interceptors=F.interceptors;function ze(e){const t=(()=>{const e=a(!1);return s((()=>(e.current=!1,()=>{e.current=!0})),[]),e})(),[n,r]=i(e);return[n,u((e=>{t.current||r(e)}),[])]}function Pe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{locale:n="zh-CN",currency:r=!0,...o}=t;let a;a=r?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2};return new Intl.NumberFormat(n,{...a,...o}).format(e)}function Te(e){let{manual:t,refreshDeps:n,...r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{execute:o,currentParams:a,error:i,...c}=W((async t=>(e="string"==typeof e?{url:e}:e,await je({...e,...t}))),r);s((()=>{if(!t&&!n)try{o()}catch{}}),[]),s((()=>{n&&l()}),n);const l=u((async()=>{try{a?await o(...a):await o()}catch{}}),[o,a]);if(i&&Ne(i)){const e=i.errors;i=new Error("string"==typeof e?e:D(e).join(""))}return{refresh:l,execute:o,error:i,...c}}function $e(e){let{active:t,inverted:r,...o}=e;return n(He,{$active:t,$inverted:r,...o})}G.div`
|
|
2
|
-
position: relative;
|
|
3
|
-
`;const He=G.div`
|
|
4
|
-
display: ${e=>e.$active?"flex":"none"};
|
|
5
|
-
position: absolute;
|
|
6
|
-
top: 0 !important;
|
|
7
|
-
left: 0 !important;
|
|
8
|
-
width: 100%;
|
|
9
|
-
height: 100%;
|
|
10
|
-
text-align: center;
|
|
11
|
-
vertical-align: middle;
|
|
12
|
-
padding: 1em;
|
|
13
|
-
background-color: ${e=>e.$inverted?"rgba(255, 255, 255, .85)":"rgba(0, 0, 0, .85)"};
|
|
14
|
-
opacity: ${e=>e.$active?1:0};
|
|
15
|
-
line-height: 1;
|
|
16
|
-
animation-fill-mode: both;
|
|
17
|
-
animation-duration: .5s;
|
|
18
|
-
transition: background-color .5s linear;
|
|
19
|
-
flex-direction: column;
|
|
20
|
-
align-items: center;
|
|
21
|
-
justify-content: center;
|
|
22
|
-
user-select: none;
|
|
23
|
-
will-change: opacity;
|
|
24
|
-
z-index: 990;
|
|
25
|
-
`;function Be(e){let{loading:t=!0,children:o,variant:a="primary",animation:i="border",wrap:s,...c}=e;return t?(o&&(o=n("p",{className:"mt-3 text-secondary",children:o})),o=r($e,{inverted:!0,active:!0,children:[n(k,{animation:i,variant:a,...c}),o]}),s?n(Ee,{$height:"number"==typeof s?s:150,children:o}):o):null}const Ee=G.div`
|
|
26
|
-
position: relative;
|
|
27
|
-
height: ${e=>`${e.$height}px`};
|
|
28
|
-
`,Le=f((async()=>{const{QRCodeSVG:e}=await import("qrcode.react");return{default:e}}));function _e(e){return n(p,{fallback:null,children:n(Le,{...e})})}const De=function(e){let{state:t,message:r,resolve:o}=e;const i=a(!0),{result:c,checkUrl:l,onComplete:d}=r,[u,h]=ze(!1);return s((()=>{je({url:l,method:"post",data:{order_no:c.order_no},raxConfig:{shouldRetry:e=>i.current&&449===e.response?.status}}).then((()=>{d?.(),o()})).catch((()=>null))}),[]),n(be,{...t,centered:!0,onHide:()=>{i.current=!1,t.onHide()},backdrop:"static",header:"支付结果",okText:"已完成支付",okButtonProps:{loading:u},onOk:async e=>{e.preventDefault();try{h(!0),await je({url:l,method:"post",data:{order_no:c.order_no,force:!0},raxConfig:{shouldRetry:()=>!1}}),d?.(),o()}catch(e){Ne(e)&&xe.error(e.message)}finally{h(!1)}},cancelText:"取消",children:"请在新打开的页面上进行支付,支付完成后再关闭此窗口"})},Re=function(e){let{state:t,message:o,resolve:i}=e;const c=a(!0),{result:{pay_options:l,order_no:d},checkUrl:u,onComplete:h}=o,[m,f]=ze(l.channels.alipay?"alipay":"wechat"),[p,g]=ze(!1);s((()=>{je({url:u,method:"post",data:{order_no:d},raxConfig:{shouldRetry:e=>c.current&&449===e.response?.status}}).then((()=>{h?.(),i()})).catch((()=>null))}),[]);const{loading:y,result:w}=Te({url:l.url,method:"POST",data:{channel:m,order_no:d}},{refreshDeps:[m]});return r(be,{...t,onHide:()=>{c.current=!1,t.onHide()},centered:!0,backdrop:"static",header:"收银台",okText:"已完成支付",okButtonProps:{loading:p},onOk:async e=>{e.preventDefault();try{g(!0),await je({url:u,method:"post",data:{order_no:d,force:{channel:m}},raxConfig:{shouldRetry:()=>!1}}),h?.(),i()}catch(e){Ne(e)&&xe.error(e.message)}finally{g(!1)}},cancelText:"取消",children:[r("dl",{className:"row",children:[n("dt",{className:"col-3",children:"商品名称"}),n("dd",{className:"col-9",children:l.subject})]}),r("dl",{className:"row",children:[n("dt",{className:"col-3",children:"支付金额"}),n("dd",{className:"col-9 text-success h3",children:Pe(l.amount/100)})]}),r("dl",{className:"row",children:[n("dt",{className:"col-3",children:"支付方式"}),n("dd",{className:"col-9",children:r(S,{children:[l.channels.alipay&&n(j,{id:"payment-alipay",type:"radio",variant:"alipay"===m?"primary":"outline-primary",name:"alipay",value:"alipay",checked:"alipay"===m,onChange:()=>f("alipay"),children:"支付宝"}),l.channels.alipay&&n(j,{id:"payment-wechat",type:"radio",variant:"wechat"===m?"primary":"outline-primary",name:"wechat",value:"wechat",checked:"wechat"===m,onChange:()=>f("wechat"),children:"微信支付"})]})})]}),r("dl",{className:"row mb-0",children:[n("dt",{className:"col-3",children:"扫码支付"}),r("dd",{className:"col-9",children:[n(Be,{loading:y,wrap:200}),w&&n(_e,{size:200,value:w.data})]})]})]})};function Me(e){const{result:t}=e;t.pay_url?(window.opener=null,window.innerWidth<992?location.href=t.pay_url:(window.open(t.pay_url),pe(De,e))):pe(Re,e)}function Fe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const n=["","K","M","G"];let r=0;for(;e>=1024&&r<n.length-1;)e/=1024,r++;return e%1==0&&(t=0),e.toFixed(t)+n[r]}function Oe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const n=["","K","M","G"];let r=0;for(;e>=1e3&&r<n.length-1;)e/=1e3,r++;return e%1==0&&(t=0),e.toFixed(t)+n[r]}function Ae(e){const t=q.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 Ue(e){if(/^https?:\/\//.test(e))return e;const t=document.createElement("a");return t.href=e,t.href}Y.locale("zh-cn"),Y.extend(Q),Y.extend(J);const Ie={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 qe(e){let{className:t,status:o,title:a,icon:i,extra:s}=e;return!i&&o&&(i=Ie[o]),r(We,{className:t,children:[i&&n(Ge,{children:i}),a&&n(Ke,{children:a}),s&&n(Ve,{children:s})]})}const We=G.div`
|
|
29
|
-
padding: 48px 32px;
|
|
30
|
-
`,Ge=G.div`
|
|
31
|
-
margin-bottom: 24px;
|
|
32
|
-
text-align: center;
|
|
33
|
-
font-size: 72px;
|
|
34
|
-
`,Ke=G.div`
|
|
35
|
-
color: rgba(0, 0, 0, .85);
|
|
36
|
-
font-size: 24px;
|
|
37
|
-
line-height: 1.8;
|
|
38
|
-
text-align: center;
|
|
39
|
-
`,Ve=G.div`
|
|
40
|
-
margin-top: 32px;
|
|
41
|
-
text-align: center;
|
|
42
|
-
`;function Ye(e){let{children:t,title:a,className:i,...s}=e;return n(Qe,{className:X("border-0 shadow-sm",i),...s,children:r("div",{className:"card-body",children:[a&&r(o,{children:[n("h5",{children:a}),n("hr",{})]}),t]})})}const Qe=G(z)`
|
|
43
|
-
&:not(:last-child) {
|
|
44
|
-
margin-bottom: 1rem;
|
|
45
|
-
}
|
|
46
|
-
`,Je=c(void 0);function Xe(e){let{children:t}=e;const[r,o]=i(new Set),a=u((e=>{e&&"string"==typeof e&&(e=[e]),o(new Set(e))}),[o]);return n(Je.Provider,{value:[r,o],children:n(P,{activeKey:Array.from(r),onSelect:a,alwaysOpen:!0,children:t})})}const Ze=()=>{const e=d(Je);if(!e)throw new Error("usePanel must be used within a PanelGroup");return e};function et(e){let{title:t,action:a,children:i,eventKey:c,open:l}=e;if(c){const[,e]=Ze();s((()=>{void 0!==l&&e((e=>l?new Set([...e,c]):new Set([...e].filter((e=>e!==c)))))}),[l]),i=n(P.Collapse,{eventKey:c,children:r(o,{children:[n("hr",{}),i]})})}else i=r(o,{children:[n("hr",{}),i]});return r(Ye,{children:[r(T,{direction:"horizontal",children:[n("div",{className:"fs-5 me-auto",children:t}),a]}),i]})}function tt(e){let{errors:t}=e;return t?n($,{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 nt(e){let{children:t,className:r,size:o="small",direction:a="horizontal"}=e;"string"==typeof o&&(o={small:8,middle:16,large:24}[o]);const i=g.map(t,(e=>{if(e)return n(ot,{children:e})}));return n(rt,{className:r,$direction:a,$size:o,children:i})}const rt=G.div`
|
|
47
|
-
display: inline-flex;
|
|
48
|
-
align-items: center;
|
|
49
|
-
gap: ${e=>e.$size}px;
|
|
50
|
-
|
|
51
|
-
${e=>"vertical"===e.$direction&&K`
|
|
52
|
-
display: flex;
|
|
53
|
-
flex-direction: column;
|
|
54
|
-
align-items: inherit;
|
|
55
|
-
`}
|
|
56
|
-
`,ot=G.div`
|
|
57
|
-
|
|
58
|
-
`,at=f((()=>import("./steps-b_BcYIwk.js"))),it=f((()=>import("./steps-b_BcYIwk.js").then((e=>{let{Step:t}=e;return{default:t}}))));function st(e){return n(p,{fallback:null,children:n(at,{...e})})}const ct=function(e){return n(p,{fallback:null,children:n(it,{...e})})};function lt(e){let{title:t,content:o,footer:a}=e;return r(Ye,{children:[n(ht,{children:t}),n(ut,{children:o}),a&&n(dt,{children:a})]})}st.Step=ct;const dt=G.div`
|
|
59
|
-
margin-top: 9px;
|
|
60
|
-
padding-top: 10px;
|
|
61
|
-
border-top: 1px solid #f0f0f0;
|
|
62
|
-
color: rgba(0, 0, 0, .65);
|
|
63
|
-
`,ut=G.div`
|
|
64
|
-
color: rgba(0, 0, 0, .85);
|
|
65
|
-
font-size: 24px;
|
|
66
|
-
`,ht=G.div`
|
|
67
|
-
margin-bottom: 4px;
|
|
68
|
-
color: rgba(0, 0, 0, .45);
|
|
69
|
-
font-size: 1.1rem;
|
|
70
|
-
`;function mt(){}function ft(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function pt(e){return"current_page"in e}function gt(e){let{total:t=0,onChange:o=mt,defaultCurrent:a=1,defaultPageSize:c=10,className:l,...d}=e;const[m,f]=i(a),[p,g]=i(c);s((()=>{ft(d.current)&&f(d.current)}),[d.current]),s((()=>{ft(d.pageSize)&&g(d.pageSize)}),[d.pageSize]);const y=h((()=>Math.floor((t-1)/p)+1),[t,p]),w=u((e=>()=>{e!==m&&(f(e),o(e,p))}),[o,m,p]),v=m-1>0?m-1:0,b=m+1<y?m+1:y,x=[];let k=null,N=null,C=null,S=null;if(y<=7)for(let e=1;e<=y;e+=1){const t=m===e;x.push(n(H.Item,{active:t,onClick:w(e),children:e},e))}else{S=n(H.Last,{onClick:w(y)},"last"),C=n(H.First,{onClick:w(1)},"first"),k=n(H.Prev,{onClick:w(v)},"prev"),N=n(H.Next,{onClick:w(b)},"next");let e=Math.max(1,m-2),t=Math.min(m+2,y);m-1<=2&&(t=5),y-m<=2&&(e=y-4);for(let r=e;r<=t;r+=1){const e=m===r;x.push(n(H.Item,{active:e,onClick:w(r),children:r},r))}m-1>=4&&3!==m&&x.unshift(k),y-m>=4&&m!==y-2&&x.push(N),1!==e&&x.unshift(C),t!==y&&x.push(S)}return r("div",{className:X("mb-3 d-flex align-column-center justify-content-between",l),children:[r("div",{className:"d-flex align-items-center",children:["共 ",t," 条"]}),n(H,{className:"mb-0",children:x})]})}function yt(e){let{className:t,value:r,locale:a="zh-CN",currency:i=!0,options:s={}}=e;const c=h((()=>{let e;return e=i?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2},new Intl.NumberFormat(a,{...e,...s})}),[i,a,s]);return t?n("span",{className:t,children:c.format(r)}):n(o,{children:c.format(r)})}function wt(e){let{loading:t,disabled:r,children:o,...a}=e;return n(N,{...a,disabled:t||r,children:t?"Loading…":o})}const vt=f((()=>import("./image-zoom-OrIPGqh0.js")));function bt(e){return n(p,{fallback:null,children:n(vt,{...e})})}const xt=m(((e,t)=>{let{confirm:n,onSuccess:r,children:o,disabled:a,as:i=we,onError:s,...c}=e;const[l,d]=ze(!1),h=u((async e=>{e.preventDefault(),e.stopPropagation();try{if(d(!0),n&&!await be.confirm({message:n}))return;let e;if("onRequest"in c)e=await c.onRequest();else{const t="string"==typeof c.url?{url:c.url,method:c.method}:{method:c.method,...c.url};e=await je(t)}r&&r(e)}catch(e){if(!(e instanceof Error))throw e;s?s(e):xe.error(e.message,{preventDuplicate:!0})}finally{d(!1)}}),[c,d]);return y(i,{...R(c,["onRequest","url","method"]),disabled:a||l,onClick:h,ref:t},o)})),kt=f((()=>import("./index-kOIT3IUs.js"))),Nt=m(((e,t)=>n(p,{fallback:null,children:n(kt,{...e,ref:t})}))),Ct=f((()=>import("./index-So7TiG4o.js"))),St=m(((e,t)=>n(p,{fallback:null,children:n(Ct,{...e,ref:t})})));let jt=0;function zt(){let{onHide:e,onShow:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[n,r]=i(!1),[o,a]=i(`visible-${jt}`),s=u((()=>{r(!1),e&&e()}),[r,e]),c=u((()=>{a("visible-"+ ++jt)}),[a,jt]);return{visible:n,show:u((()=>{r(!0),t&&t()}),[r,t]),hide:s,state:{show:n,onHide:s,onExited:c,key:o}}}const Pt=m(((e,t)=>{let{text:a,onOk:i,modalProps:s,children:c,onShow:l,onHide:d,confirmLoading:u,as:h=we,...m}=e;const{state:f,show:p,hide:g}=zt({onShow:l,onHide:d});w(t,(()=>({close:g})));const v=y(h,{...m,onClick:e=>{e.preventDefault(),e.stopPropagation(),p()}},a);return r(o,{children:[v,n(be,{header:a,...s,...f,confirmLoading:u,onOk:async e=>{if(i){!1===await i()&&e.preventDefault()}},children:c})]})})),Tt=m(((e,t)=>{let{text:o,onSuccess:s,onSubmit:c,buttonProps:l,modalProps:d,children:h,...m}=e;const[f,p]=i(!1),g=a(null),y=a(null);w(t,(()=>({close:()=>{g.current?.close()}})));const v=u((async()=>(y.current?.submit().catch((()=>{})),!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(Pt,{ref:g,text:o,...l,modalProps:d,onOk:v,confirmLoading:f,children:r(Nt,{...m,onSubmitting:p,ref:y,onSuccess:b,onSubmit:x,children:[h,n("input",{type:"submit",hidden:!0})]})})}));function $t(e){let{header:t,children:o,closable:a=!0,show:i,onHide:s,bodyAs:c,headerAs:l="h5",...d}=e;return r(B,{...d,onHide:s,show:i,children:[t&&n(B.Header,{closeButton:a,children:n(B.Title,{as:l,children:t})}),n(B.Body,{as:c,children:o})]})}const Ht=m(((e,t)=>{let{text:a,offcanvasProps:i,children:s,onShow:c,onHide:l,as:d=we,...u}=e;const{state:h,show:m,hide:f}=zt({onShow:c,onHide:l});w(t,(()=>({close:f})));const p=y(d,{...u,onClick:m},a);return r(o,{children:[p,n($t,{header:a,...i,...h,children:s})]})}));function Bt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=a(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 Et(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=((e,t)=>e!==t)}=e,a=Bt(r),s=Bt(o),[c,l]=i(n),d=void 0!==t,u=d?t:c,h=Bt((e=>{const t="function"==typeof e?e(u):e;s(u,t)&&(d||l(t),a(t))}),[d,a,u,s]);return[u,h]}const Lt=m(((e,t)=>{let{className:o,rowClassName:c,paginate:l=!0,sync:d=!1,columns:h=3,source:m,renderItem:f,renderEmpty:p}=e;const[g,y]=i([]),[v,b]=i(l?{total:0,current:1,pageSize:10}:null),[x,k]=i(!0),[N,C]=Z({}),[S,j]=Et({value:d?N.page||1:void 0,defaultValue:1,onChange:e=>{d&&C({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 je({url:m,params:t}):await m(t),l&&pt(e)?(e.last_page>1?b({total:e.total,current:e.current_page,pageSize:e.per_page}):b(null),e=e.data):b(null),y(e)}catch(e){}finally{k(!1)}}),[m,y,S]);s((()=>{z()}),[S]),s((()=>{P.current={reload:z}}),[z]);const P=a({reload:z});return w(t,(()=>P.current)),r(_t,{className:o,children:[n(Be,{wrap:!0,loading:x}),0===g.length&&!x&&p?.(),n(E,{className:X(c,"g-4"),children:g.map(((e,t)=>n(L,{className:"d-flex",md:12/h,children:f(e)},`card-${t}`)))}),v&&n(Dt,{...v,onChange:j})]})})),_t=G.div`
|
|
71
|
-
|
|
72
|
-
`,Dt=G(gt)`
|
|
73
|
-
margin-bottom: 0;
|
|
74
|
-
justify-content: flex-end;
|
|
75
|
-
margin-top: 1rem;
|
|
76
|
-
`;var Rt=v(Lt);function Mt(){const[e,t]=i(!1),n=a();return s((()=>()=>{n.current&&clearTimeout(n.current)}),[]),{copied:e,copy:u((e=>{ee(e),t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout((()=>{t(!1),n.current=void 0}),3e3)}),[])}}function Ft(e){let{as:t="div",className:r,content:o,tooltip:a=!0,placement:i}=e;const{copy:s,copied:c}=Mt(),l=a?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 a?n(ge,{tooltip:c?"已复制":"复制",placement:i,children:d}):d}const Ot=c({images:new Map,current:0,setCurrent:()=>null,setShow:()=>null,registerImage:()=>()=>null,getId:()=>0}),At=f((()=>import("./index-qqtWKONG.js"))),Ut=f((()=>import("./image-qSKcFPGU.js")));function It(e){return n(p,{fallback:null,children:n(At,{...e})})}It.Image=function(e){return n(p,{fallback:null,children:n(Ut,{...e})})},It.Context=Ot;const qt=f((()=>import("./infinite-scroller-_g5R4GSj.js"))),Wt=m(((e,t)=>n(p,{fallback:null,children:n(qt,{...e,ref:t})}))),Gt=f((()=>import("./slider-KuqHu6UH.js")));function Kt(e){return n(p,{fallback:null,children:n(Gt,{...e})})}function Vt(e){let{children:t}=e;return r(I,{children:[n(Yt,{}),t]})}const Yt=V`
|
|
77
|
-
${te.extractCss()}
|
|
78
|
-
`,Qt=f((()=>import("./cascader-pKgfaE9t.js")));function Jt(e){return n(p,{fallback:null,children:n(Qt,{...e})})}const Xt=f((()=>import("./select-WnBtupzS.js")));function Zt(e){return n(p,{fallback:null,children:n(Xt,{...e})})}function en(e,t,n){const r=a(e),o=a(M(e,t,n));return s((()=>{r.current=e})),s((()=>{o.current=M((function(){r.current(...arguments)}),t,n)}),[t,n]),o.current}function tn(e){const[t,n]=i((()=>ne("function"==typeof e?e():e,!0)));return[t,u((e=>{n("function"==typeof e?re(e):ne(e))}),[])]}function nn(){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]=i(t),o=en((()=>{r(t())}),100);return s((()=>(window.addEventListener("resize",o),()=>window.removeEventListener("resize",o))),[]),n}var rn;!function(e){e[e.init=0]="init",e[e.play=1]="play",e[e.pause=2]="pause",e[e.end=3]="end"}(rn||(rn={}));const on=(e,t)=>{let n=a(!1);const[r,o]=i((()=>{const{lang:e="default",name:n=""}=t.voice||{};return{isPlaying:!1,status:rn[rn.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:rn[rn.play]})))}),[]),l=u((()=>{n.current&&o((e=>({...e,isPlaying:!1,status:rn[rn.pause]})))}),[]),d=u((()=>{n.current&&o((e=>({...e,isPlaying:!1,status:rn[rn.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};function an(e,t){s((()=>{const t=e();!async function(){await t}()}),t)}export{zt as $,Pt as A,we as B,Ye as C,be as D,tt as E,Nt as F,$t as G,ge as H,Ot as I,Rt as J,Ft as K,Be as L,se as M,yt as N,Ht as O,gt as P,It as Q,qe as R,nt as S,ye as T,Wt as U,Kt as V,_e as W,Vt as X,Jt as Y,Zt as Z,Te as _,nn as a,Mt as a0,on as a1,an as a2,Ne as a3,Ce as a4,Et as b,ze as c,tn as d,xe as e,ke as f,Fe as g,Pe as h,pt as i,Oe as j,Ae as k,Ue as l,et as m,Xe as n,Ze as o,st as p,ct as q,je as r,lt as s,wt as t,en as u,bt as v,Me as w,xt as x,St as y,Tt as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{memo as a,forwardRef as r,useState as e,useCallback as o,useImperativeHandle as i}from"react";import s from"react-infinite-scroller";import{d as n,r as m,i as p}from"./index-t5sPwmd8.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"react-async-hook";import"styled-components";import"dayjs";import"dayjs/locale/zh-cn";import"dayjs/plugin/relativeTime";import"dayjs/plugin/duration";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"goober";import"immer";import"react-intersection-observer";var c=a(r(((a,r)=>{let{source:c,render:l,as:u,useWindow:g,className:f,getState:y,limit:h=10}=a;const[j,w]=e(!1),[x,b]=n({params:{},end:!1,data:[]}),v=o((async function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!j){w(!0);try{let a;const r=t?{}:x.params;a="string"==typeof c?await m({url:c,params:r}):await c(r),y||(y=t=>p(t)?{params:{page:t.current_page+1},end:t.current_page>=t.last_page,data:t.data}:{params:{offset:d(t)?.id},end:t.length<h,data:t});const e=y(a);b({...e,data:t?e.data:[...x.data,...e.data]})}catch{b({...x,end:!0})}finally{w(!1)}}}),[c,x,y,j]),_=o((()=>{v(!0)}),[v]);i(r,(()=>({reload:_})),[_]);const k=o((t=>{b((a=>{const r=t(a.data);r&&(a.data=r)}))}),[b]);return t(s,{className:f,hasMore:!x.end,pageStart:0,loadMore:()=>{v()},useWindow:g,element:u,children:l({data:x.data,setData:k,end:x.end,loading:j,action:{reload:_}})})})));export{c as default};
|
package/es/steps-b_BcYIwk.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import{jsx as r,Fragment as t}from"react/jsx-runtime";import e,{Step as s}from"rc-steps";export{Step}from"rc-steps";import"rc-steps/assets/index.css";import o from"styled-components";import*as c from"react";var i;function n(){return n=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=e[s])}return r},n.apply(this,arguments)}const p=r=>c.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},r),i||(i=c.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.216"})));function a(e){return r(m,{icons:{finish:r(p,{}),error:r(t,{})},...e})}a.Step=s;const m=o(e)`
|
|
2
|
-
.rc-steps-item-icon {
|
|
3
|
-
display: inline-flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
|
|
7
|
-
& > .rc-steps-icon {
|
|
8
|
-
top: 0;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.rc-steps-item-process {
|
|
13
|
-
.rc-steps-item-icon {
|
|
14
|
-
background: var(--bs-primary);
|
|
15
|
-
border-color: var(--bs-primary);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.rc-steps-item-finish {
|
|
20
|
-
.rc-steps-item-icon {
|
|
21
|
-
border-color: var(--bs-primary);
|
|
22
|
-
|
|
23
|
-
& > .rc-steps-icon {
|
|
24
|
-
color: var(--bs-primary);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.rc-steps-item-title:after {
|
|
29
|
-
background-color: var(--bs-primary);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
`;export{a as default};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|