@topthink/components 1.0.61 → 1.0.63
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/{index-Aog03FGz.js → index-QKKZyZmF.js} +1 -1
- package/es/index-dJuiTP5C.js +39 -0
- package/es/{index-njrIc1C9.js → index-ez2qbmgg.js} +1 -1
- package/es/index.js +1 -1
- package/package.json +2 -2
- package/scss/app.scss +7 -7
- package/scss/notification.scss +92 -92
- package/es/index-145NOArE.js +0 -39
|
@@ -63,4 +63,4 @@ import e from"sweetalert2/dist/sweetalert2.js";import t from"sweetalert2-react-c
|
|
|
63
63
|
margin-bottom: 4px;
|
|
64
64
|
color: rgba(0, 0, 0, .45);
|
|
65
65
|
font-size: 1.1rem;
|
|
66
|
-
`;function Fe(){}function He(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function Ae(e){let{total:t=0,onChange:r=Fe,defaultCurrent:o=1,defaultPageSize:i=10,className:c,...l}=e;const[d,h]=a(o),[m,p]=a(i);s((()=>{He(l.current)&&h(l.current)}),[l.current]),s((()=>{He(l.pageSize)&&p(l.pageSize)}),[l.pageSize]);const g=f((()=>Math.floor((t-1)/m)+1),[t,m]),y=u((e=>()=>{e!==d&&(h(e),r(e,m))}),[r,d,m]),x=d-1>0?d-1:0,b=d+1<g?d+1:g,v=[];let w=null,k=null,C=null,N=null;if(g<=7)for(let e=1;e<=g;e+=1){const t=d===e;v.push(n(S.Item,{active:t,onClick:y(e),children:e},e))}else{N=n(S.Last,{onClick:y(g)},"last"),C=n(S.First,{onClick:y(1)},"first"),w=n(S.Prev,{onClick:y(x)},"prev"),k=n(S.Next,{onClick:y(b)},"next");let e=Math.max(1,d-2),t=Math.min(d+2,g);d-1<=2&&(t=5),g-d<=2&&(e=g-4);for(let r=e;r<=t;r+=1){const e=d===r;v.push(n(S.Item,{active:e,onClick:y(r),children:r},r))}d-1>=4&&3!==d&&v.unshift(w),g-d>=4&&d!==g-2&&v.push(k),1!==e&&v.unshift(C),t!==g&&v.push(N)}return n(S,{className:c,children:v})}function De(e){let{className:t,value:r,locale:i="zh-CN",currency:a=!0,options:s={}}=e;const c=f((()=>{let e;return e=a?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2},new Intl.NumberFormat(i,{...e,...s})}),[a,i,s]);return t?n("span",{className:t,children:c.format(r)}):n(o,{children:c.format(r)})}function Me(e){let{loading:t,disabled:r,children:o,...i}=e;return n(k,{...i,disabled:t||r,children:t?"Loading…":o})}const Oe=p((()=>import("./image-zoom-OrIPGqh0.js")));function Ie(e){return n(g,{fallback:null,children:n(Oe,{...e})})}function Ue(e){let{url:t,method:n,confirm:r,onSuccess:o,children:i,disabled:a,as:s=W,...c}=e;const[l,d]=le(!1),f=u((async e=>{e.preventDefault();try{if(d(!0),r&&!await Z.confirm({message:r}))return;const e="string"==typeof t?{url:t,method:n}:{method:n,...t},i=await se(e);o&&o(i)}catch(e){ae(e)}finally{d(!1)}}),[t,n,d]);return y(s,{...c,disabled:a||l,onClick:f},i)}const Re=p((()=>import("./index-
|
|
66
|
+
`;function Fe(){}function He(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function Ae(e){let{total:t=0,onChange:r=Fe,defaultCurrent:o=1,defaultPageSize:i=10,className:c,...l}=e;const[d,h]=a(o),[m,p]=a(i);s((()=>{He(l.current)&&h(l.current)}),[l.current]),s((()=>{He(l.pageSize)&&p(l.pageSize)}),[l.pageSize]);const g=f((()=>Math.floor((t-1)/m)+1),[t,m]),y=u((e=>()=>{e!==d&&(h(e),r(e,m))}),[r,d,m]),x=d-1>0?d-1:0,b=d+1<g?d+1:g,v=[];let w=null,k=null,C=null,N=null;if(g<=7)for(let e=1;e<=g;e+=1){const t=d===e;v.push(n(S.Item,{active:t,onClick:y(e),children:e},e))}else{N=n(S.Last,{onClick:y(g)},"last"),C=n(S.First,{onClick:y(1)},"first"),w=n(S.Prev,{onClick:y(x)},"prev"),k=n(S.Next,{onClick:y(b)},"next");let e=Math.max(1,d-2),t=Math.min(d+2,g);d-1<=2&&(t=5),g-d<=2&&(e=g-4);for(let r=e;r<=t;r+=1){const e=d===r;v.push(n(S.Item,{active:e,onClick:y(r),children:r},r))}d-1>=4&&3!==d&&v.unshift(w),g-d>=4&&d!==g-2&&v.push(k),1!==e&&v.unshift(C),t!==g&&v.push(N)}return n(S,{className:c,children:v})}function De(e){let{className:t,value:r,locale:i="zh-CN",currency:a=!0,options:s={}}=e;const c=f((()=>{let e;return e=a?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2},new Intl.NumberFormat(i,{...e,...s})}),[a,i,s]);return t?n("span",{className:t,children:c.format(r)}):n(o,{children:c.format(r)})}function Me(e){let{loading:t,disabled:r,children:o,...i}=e;return n(k,{...i,disabled:t||r,children:t?"Loading…":o})}const Oe=p((()=>import("./image-zoom-OrIPGqh0.js")));function Ie(e){return n(g,{fallback:null,children:n(Oe,{...e})})}function Ue(e){let{url:t,method:n,confirm:r,onSuccess:o,children:i,disabled:a,as:s=W,...c}=e;const[l,d]=le(!1),f=u((async e=>{e.preventDefault();try{if(d(!0),r&&!await Z.confirm({message:r}))return;const e="string"==typeof t?{url:t,method:n}:{method:n,...t},i=await se(e);o&&o(i)}catch(e){ae(e)}finally{d(!1)}}),[t,n,d]);return y(s,{...c,disabled:a||l,onClick:f},i)}const Re=p((()=>import("./index-ez2qbmgg.js"))),_e=h(((e,t)=>n(g,{fallback:null,children:n(Re,{...e,ref:t})}))),qe=p((()=>import("./index-dJuiTP5C.js"))),Ve=h(((e,t)=>n(g,{fallback:null,children:n(qe,{...e,ref:t})})));let Ge=0;function Ye(){let{onHide:e,onShow:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[n,r]=a(!1),[o,i]=a(`visible-${Ge}`),s=u((()=>{r(!1),e&&e()}),[r,e]),c=u((()=>{i("visible-"+ ++Ge)}),[i,Ge]);return{visible:n,show:u((()=>{r(!0),t&&t()}),[r,t]),hide:s,state:{show:n,onHide:s,onExited:c,key:o}}}const Je=h(((e,t)=>{let{text:i,onOk:a,modalProps:s,children:c,onShow:l,confirmLoading:d,as:u=W,...f}=e;const{state:h,show:m,hide:p}=Ye({onShow:l});x(t,(()=>({close:p})));const g=y(u,{...f,onClick:m},i);return r(o,{children:[g,n(Z,{header:i,...s,...h,confirmLoading:d,onOk:async e=>{if(a){!1===await a()&&e.preventDefault()}},children:c})]})}));function Ke(e){let{text:t,onSuccess:o,buttonProps:s,modalProps:c,children:l,...d}=e;const[f,h]=a(!1),m=i(null),p=i(null),g=u((()=>(p.current?.submit(),!1)),[]),y=u((e=>{o&&o(e),m.current?.close()}),[o]);return n(Je,{ref:m,text:t,...s,modalProps:c,onOk:g,confirmLoading:f,children:r(_e,{...d,onSubmitting:h,ref:p,onSuccess:y,children:[l,n("input",{type:"submit",hidden:!0})]})})}function Qe(e){let{manual:t,refreshDeps:n,...r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{execute:o,currentParams:i,error:a,...c}=D((async t=>(e="string"==typeof e?{url:e}:e,await se({...e,...t}))),r);s((()=>{if(!t&&!n)try{o()}catch{}}),[]),s((()=>{n&&l()}),n);const l=u((async()=>{try{i?await o(...i):await o()}catch{}}),[o,i]);if(a&&ie(a)){const e=a.errors;a=new Error("string"==typeof e?e:j(e).join(""))}return{refresh:l,execute:o,error:a,...c}}function We(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=i(e);return s((()=>{n.current=e})),u((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.current?.(...t)}),t)}function Xe(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=((e,t)=>e!==t)}=e,i=We(r),s=We(o),[c,l]=a(n),d=void 0!==t,u=d?t:c,f=We((e=>{const t="function"==typeof e?e(u):e;s(u,t)&&(d||l(t),i(t))}),[d,i,u,s]);return[u,f]}function Ze(e,t,n){const r=i(e),o=i(B(e,t,n));return s((()=>{r.current=e})),s((()=>{o.current=B((function(){r.current(...arguments)}),t,n)}),[t,n]),o.current}export{W as B,we as C,ke as E,_e as F,Ie as I,be as L,I as M,De as N,Ae as P,ye as R,Ce as S,Q as T,Xe as a,le as b,re as c,je as d,Be as e,Te as f,Me as g,Ue as h,oe as i,Ve as j,Ke as k,Je as l,Z as m,K as n,Qe as o,Ye as p,ie as q,se as r,ae as s,Ze as u,ue as w};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"rc-table";import{unstable_batchedUpdates as o}from"react-dom";import{FormControl as a,Table as i}from"react-bootstrap";import{useUrlSearchParams as c}from"use-url-search-params";import{isEqual as l,omit as s}from"lodash";import*as d from"react";import{useState as u,useCallback as p,useRef as m,useEffect as h,useMemo as f,memo as g,forwardRef as v,useImperativeHandle as y}from"react";import{B as b,u as x,P as w,a as j,r as C,N as k,L as S,T as E,C as O,S as V}from"./index-QKKZyZmF.js";import z from"styled-components";import N from"./index-ez2qbmgg.js";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"axios";import"query-string";import"retry-axios";import"rc-notification";import"classnames";import"react-async-hook";import"@topthink/json-form";const H=function(t){let{indeterminate:r=!1,...n}=t;const o=m(null);return h((()=>{o.current&&(o.current.indeterminate=r)}),[r]),e("input",{ref:o,...n,className:"form-check-input",type:"checkbox"})};var q;function K(){return K=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},K.apply(this,arguments)}const M=e=>d.createElement("svg",K({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),q||(q=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 B;function P(){return P=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},P.apply(this,arguments)}const F=e=>d.createElement("svg",P({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.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 T(r){let{data:n,options:o,columns:a,onSearch:i}=r;const[c,s]=u(0),[d,m]=u(n);h((()=>{l(n,d)||(m(n),s((e=>e+1)))}),[n]);const[g,v,y]=f((()=>{const e={"ui:col":10,"ui:order":o.order},t={},r={};o.fields.forEach((n=>{const i=a.find((e=>e.dataIndex===n));if(i){const a=i.title;if("string"==typeof a){if(e[n]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...o.ui?.[n]},i.valueEnum){const t=i.valueEnum;return e[n]["ui:placeholder"]="请选择",r[n]={title:a,type:"string",enum:Object.keys(t).flatMap((e=>"string"==typeof t[e].text?[e]:[])),enumNames:Object.keys(t).flatMap((e=>{const r=t[e].text;return"string"==typeof r?[r]:[]}))}}t[n]=void 0,r[n]={title:a,type:"string"}}}})),o.extraFields&&Object.entries(o.extraFields).forEach((n=>{let[a,i]=n;e[a]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...o.ui?.[a]},t[a]=void 0,r[a]={title:i,type:"string"}}));return[{type:"object",properties:r},e,t]}),[o.fields,o.extraFields]),x=p((e=>{let{formData:t}=e;m(t),i({...y,...t})}),[i,y]),w=p((()=>{i(y)}),[i,y]);return e(_,{children:e(N,{formContext:{layout:"horizontal"},schema:g,uiSchema:v,onSubmit:x,formData:d,children:e("div",{className:"col-2 ms-auto mt-auto",children:t("div",{className:"justify-content-end d-flex gap-2 ",children:[e(b,{className:"px-4",onClick:w,variant:"secondary",children:"重置"}),e(b,{className:"px-4",type:"submit",variant:"primary",children:"查询"})]})})})},c)}const _=z.div`
|
|
2
|
+
margin-bottom: 1rem;
|
|
3
|
+
`;function D(t){let{keyword:r,onKeywordChange:n}=t;const[o,i]=u(r),c=x(n,500);h((()=>{i(r)}),[r]);const l=p((e=>{i(e.target.value),c(e.target.value)}),[c,i]);return e(a,{value:o,onChange:l,type:"search",placeholder:"Search..."})}const I=z.thead`
|
|
4
|
+
th {
|
|
5
|
+
padding: 0.5rem 0.5rem;
|
|
6
|
+
border-bottom-width: 1px;
|
|
7
|
+
border-color: var(--bs-border-color);
|
|
8
|
+
}
|
|
9
|
+
`,R={table:t=>e(i,{...t,className:"mb-0 align-middle table-hover"}),header:{wrapper:t=>e(I,{...t})}},A=z.a`
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
width: 28px;
|
|
12
|
+
height: 28px;
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
vertical-align: middle;
|
|
17
|
+
`,L=function(t){let{record:r,expanded:n,expandable:o,onExpand:a}=t;return e(A,o?{onClick:e=>a(r,e),children:e(n?F:M,{})}:{})},$=z(w)`
|
|
18
|
+
margin-bottom: 0;
|
|
19
|
+
justify-content: flex-end;
|
|
20
|
+
margin-top: 1rem;
|
|
21
|
+
`;const G=v(((a,i)=>{let{source:l,rowKey:d="id",paginate:g=!0,toolBarRender:v,columns:b=[],search:x,rowSelection:w,card:V=!0,expandable:z={},sync:N=!1,...q}=a;const[K,M]=u([]),[B,P]=u(g?{total:0,current:1,pageSize:10}:null),[F,_]=u(!0),[I,A]=c({}),[G,J]=function(t,r,n){const[o,a]=u((()=>new Set(t?.selectedRowKeys||[]))),i=e=>"string"==typeof r?e[r]:r(e),c=e=>n.find((t=>i(t)===e)),l=p((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[p((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(H,{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(H,{checked:a,onChange:()=>{a?o.delete(n):o.add(n),l(new Set(o))}})}},...r]}),[n,t,o]),l]}(w,d,K),Y=f((()=>s(I,["q","page"])),[I]),[Z,ee]=j({value:N?Y:void 0,defaultValue:{},onChange:e=>{N&&A(e)}}),[te,re]=j({value:N?I.q||"":void 0,defaultValue:"",onChange:e=>{N&&A({q:e||void 0})}}),[ne,oe]=j({value:N?I.page||1:void 0,defaultValue:1,onChange:e=>{N&&A({page:e||void 0})}}),ae=p((async()=>{_(!0),J([]);try{let e;const t={...Z,q:te,page:ne>1?ne:void 0};e="string"==typeof l?await C({url:l,params:t}):await l(t),g&&function(e){return"current_page"in e}(e)&&(P({total:e.total,current:e.current_page,pageSize:e.per_page}),e=e.data),M(e)}catch(e){}finally{_(!1)}}),[l,M,te,ne,Z]);h((()=>{ae()}),[te,ne,Z]);const ie=m({reload:ae});h((()=>{ie.current={reload:ae}}),[ae]),y(i,(()=>ie.current));const ce=f((()=>G(b).map((t=>{let{render:r,valueType:n,valueEnum:o,...a}=t;const i={...a};return r?i.render=(e,t,n)=>r({value:e,record:t,index:n,action:ie.current}):"currency"===n?i.render=t=>e(k,{value:t}):o&&(i.render=t=>o[t]?o[t].status?e("span",{className:`text-${o[t].status}`,children:o[t].text}):o[t].text:t),i}))),[b,G,ie]),le=t(r,{children:[e(S,{loading:F}),"object"==typeof x&&e(T,{data:Z,columns:b,options:x,onSearch:e=>{o((()=>{oe(1),ee(e)}))}}),!1!==v&&t(Q,{children:[e(W,{size:12,children:v&&v(ie.current)}),t(U,{size:12,children:[!0===x&&e(D,{keyword:te,onKeywordChange:e=>{o((()=>{oe(1),re(e)}))}}),e(X,{onClick:ie.current.reload,children:e("i",{className:"bi bi-arrow-repeat"})})]})]}),e(E.Provider,{value:!0,children:e(n,{...q,expandable:{expandIcon:L,...z},rowKey:d,columns:ce,components:R,data:K})}),B&&e($,{...B,onChange:oe})]});return V?e(O,{children:le}):le}));var J=g(G);const Q=z.div`
|
|
22
|
+
display: flex;
|
|
23
|
+
justify-content: space-between;
|
|
24
|
+
padding-bottom: 1rem;
|
|
25
|
+
height: 48px;
|
|
26
|
+
border-bottom: 2px solid #212529;
|
|
27
|
+
`,U=z(V)`
|
|
28
|
+
|
|
29
|
+
`,W=z(V)`
|
|
30
|
+
|
|
31
|
+
`,X=z.span`
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
font-size: 20px;
|
|
34
|
+
line-height: 1;
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
color: var(--bs-primary);
|
|
38
|
+
}
|
|
39
|
+
`;export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import o,{getRegistry as r}from"@topthink/json-form";import*as a from"react";import{forwardRef as e,useState as n,useCallback as i}from"react";import s from"axios";import{b as l,r as m,B as p}from"./index-
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import o,{getRegistry as r}from"@topthink/json-form";import*as a from"react";import{forwardRef as e,useState as n,useCallback as i}from"react";import s from"axios";import{b as l,r as m,B as p}from"./index-QKKZyZmF.js";import{mapValues as c}from"lodash";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"query-string";import"retry-axios";import"rc-notification";import"styled-components";import"classnames";import"react-async-hook";const d=require("ajv-i18n/localize/zh"),u=a.lazy((()=>import("./editor-widget-CQ3zv-Xu.js"))),f=o=>t(a.Suspense,{fallback:null,children:t(u,{...o})}),y={upload:function(o){let{options:a,...e}=o;const{widgets:n}=r();return a.endpoint&&(a.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:r,value:e}=await m({url:a.endpoint,method:"post",data:o});return{url:r,value:e}}),t(n.upload,{...e,options:a})},editor:function(o){let{options:r,...a}=o;return r.endpoint&&(r.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:a}=await m({url:r.endpoint,method:"post",data:o});return a}),t(f,{...a,options:r})},typeahead:function(o){let{options:a,...e}=o;const{widgets:n}=r();return a.endpoint&&(a.onSearch=async t=>{let{value:o,query:r}=t;return await m({url:a.endpoint,params:{value:o,query:r}})}),t(n.typeahead,{...e,options:a})}},h=e(((r,a)=>{let{action:e,method:u="post",onSuccess:f,formData:h,onSubmitting:w,onSubmit:g,onChange:b,submitText:x="提交",transformData:v,children:D,...j}=r;const[S,k]=n(),[q,_]=l(!1),[z,E]=n(h),C=i((async(t,o)=>{if(!q)try{if(_(!0),w&&w(!0),e){let{formData:o}=t;v&&(o=v(o));try{const t=await m({url:e,method:u,data:o});return k(void 0),f&&await f(t),t}catch(t){if(!s.isAxiosError(t))throw t;k((t=>{const o=t.errors;return"string"==typeof o?{__errors:[o]}:c(o,(t=>({__errors:[t]})))})(t))}}else if(g)return await g(t,o)}finally{_(!1),w&&w(!1)}}),[e,u,g]),F=i((t=>{const{formData:o}=t;E(o),b&&b(t)}),[E,b]),N=i((t=>(t=t.map((t=>({keyword:t.name,dataPath:t.property,...t}))),d(t),t)),[]),U=t(p,{className:"px-4",loading:q,type:"submit",variant:"primary",children:x});return"function"==typeof D&&(D=D({submit:U,loading:q})),t(o,{ref:a,extraErrors:S,onSubmit:C,transformErrors:N,noHtml5Validate:!0,noValidate:!0,...j,formData:z,onChange:F,widgets:y,children:D||t("div",{className:"col-12",children:U})})}));export{h as default};
|
package/es/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{B as Button,C as Card,E as Error,F as Form,I as ImageZoom,L as Loader,g as LoadingButton,M as Message,m as Modal,l as ModalButton,k as ModalForm,N as NumberFormat,P as Pagination,h as RequestButton,R as Result,S as Space,f as Statistic,e as Step,d as Steps,j as Table,c as Toast,n as Tooltip,i as isRecord,q as isRequestError,r as request,s as showRequestError,
|
|
1
|
+
export{B as Button,C as Card,E as Error,F as Form,I as ImageZoom,L as Loader,g as LoadingButton,M as Message,m as Modal,l as ModalButton,k as ModalForm,N as NumberFormat,P as Pagination,h as RequestButton,R as Result,S as Space,f as Statistic,e as Step,d as Steps,j as Table,c as Toast,n as Tooltip,i as isRecord,q as isRequestError,r as request,s as showRequestError,a as useControllableState,u as useDebounce,p as useOverlayState,o as useRequest,b as useSafeState,w as waitPayComplete}from"./index-QKKZyZmF.js";export{StyleSheetManager,ThemeProvider,createGlobalStyle,css,keyframes,default as styled}from"styled-components";export{useAsync,useAsyncCallback}from"react-async-hook";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react/jsx-runtime";import"react";import"react-bootstrap";import"lodash";import"axios";import"query-string";import"retry-axios";import"rc-notification";import"classnames";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topthink/components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.63",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prebuild": "rimraf es types",
|
|
6
6
|
"build": "rollup -c --environment NODE_ENV:production",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
},
|
|
65
65
|
"author": "yunwuxin <tzzhangyajun@qq.com> (https://github.com/yunwuxin)",
|
|
66
66
|
"license": "MIT",
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "5d9acee026e26f86641f1a1f69a7620c7b42a429"
|
|
68
68
|
}
|
package/scss/app.scss
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
@import "~@topthink/bootstrap/scss/bootstrap";
|
|
2
|
-
@import "notification";
|
|
3
|
-
|
|
4
|
-
.btn-link {
|
|
5
|
-
padding: 0;
|
|
6
|
-
}
|
|
7
|
-
|
|
1
|
+
@import "~@topthink/bootstrap/scss/bootstrap";
|
|
2
|
+
@import "notification";
|
|
3
|
+
|
|
4
|
+
.btn-link {
|
|
5
|
+
padding: 0;
|
|
6
|
+
}
|
|
7
|
+
|
package/scss/notification.scss
CHANGED
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
.notification {
|
|
2
|
-
position: fixed;
|
|
3
|
-
z-index: 1100;
|
|
4
|
-
|
|
5
|
-
&-notice {
|
|
6
|
-
border-radius: 3px 3px;
|
|
7
|
-
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
|
8
|
-
border: 0 solid rgba(0, 0, 0, 0);;
|
|
9
|
-
background: #fff;
|
|
10
|
-
display: block;
|
|
11
|
-
width: auto;
|
|
12
|
-
line-height: 1.5;
|
|
13
|
-
position: relative;
|
|
14
|
-
margin: 10px 0;
|
|
15
|
-
max-width: 300px;
|
|
16
|
-
white-space: pre-wrap;
|
|
17
|
-
|
|
18
|
-
&-close {
|
|
19
|
-
position: absolute;
|
|
20
|
-
right: 5px;
|
|
21
|
-
top: 3px;
|
|
22
|
-
color: #000;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
outline: none;
|
|
25
|
-
font-size: 16px;
|
|
26
|
-
font-weight: 700;
|
|
27
|
-
line-height: 1;
|
|
28
|
-
text-shadow: 0 1px 0 #fff;
|
|
29
|
-
filter: alpha(opacity=20);
|
|
30
|
-
opacity: .2;
|
|
31
|
-
text-decoration: none;
|
|
32
|
-
|
|
33
|
-
&-x:after {
|
|
34
|
-
content: '×';
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&:hover {
|
|
38
|
-
opacity: 1;
|
|
39
|
-
filter: alpha(opacity=100);
|
|
40
|
-
text-decoration: none;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@mixin fade-effect {
|
|
46
|
-
animation-duration: 0.3s;
|
|
47
|
-
animation-fill-mode: both;
|
|
48
|
-
animation-timing-function: cubic-bezier(0.55, 0, 0.55, 0.2);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&-fade-appear,
|
|
52
|
-
&-fade-enter {
|
|
53
|
-
opacity: 0;
|
|
54
|
-
|
|
55
|
-
@include fade-effect;
|
|
56
|
-
animation-play-state: paused;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&-fade-leave {
|
|
60
|
-
@include fade-effect;
|
|
61
|
-
animation-play-state: paused;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
&-fade-appear#{&}-fade-appear-active,
|
|
65
|
-
&-fade-enter#{&}-fade-enter-active {
|
|
66
|
-
animation-name: rcNotificationFadeIn;
|
|
67
|
-
animation-play-state: running;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&-fade-leave#{&}-fade-leave-active {
|
|
71
|
-
animation-name: rcDialogFadeOut;
|
|
72
|
-
animation-play-state: running;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@keyframes rcNotificationFadeIn {
|
|
76
|
-
0% {
|
|
77
|
-
opacity: 0;
|
|
78
|
-
}
|
|
79
|
-
100% {
|
|
80
|
-
opacity: 1;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
@keyframes rcDialogFadeOut {
|
|
85
|
-
0% {
|
|
86
|
-
opacity: 1;
|
|
87
|
-
}
|
|
88
|
-
100% {
|
|
89
|
-
opacity: 0;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
1
|
+
.notification {
|
|
2
|
+
position: fixed;
|
|
3
|
+
z-index: 1100;
|
|
4
|
+
|
|
5
|
+
&-notice {
|
|
6
|
+
border-radius: 3px 3px;
|
|
7
|
+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
|
8
|
+
border: 0 solid rgba(0, 0, 0, 0);;
|
|
9
|
+
background: #fff;
|
|
10
|
+
display: block;
|
|
11
|
+
width: auto;
|
|
12
|
+
line-height: 1.5;
|
|
13
|
+
position: relative;
|
|
14
|
+
margin: 10px 0;
|
|
15
|
+
max-width: 300px;
|
|
16
|
+
white-space: pre-wrap;
|
|
17
|
+
|
|
18
|
+
&-close {
|
|
19
|
+
position: absolute;
|
|
20
|
+
right: 5px;
|
|
21
|
+
top: 3px;
|
|
22
|
+
color: #000;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
outline: none;
|
|
25
|
+
font-size: 16px;
|
|
26
|
+
font-weight: 700;
|
|
27
|
+
line-height: 1;
|
|
28
|
+
text-shadow: 0 1px 0 #fff;
|
|
29
|
+
filter: alpha(opacity=20);
|
|
30
|
+
opacity: .2;
|
|
31
|
+
text-decoration: none;
|
|
32
|
+
|
|
33
|
+
&-x:after {
|
|
34
|
+
content: '×';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:hover {
|
|
38
|
+
opacity: 1;
|
|
39
|
+
filter: alpha(opacity=100);
|
|
40
|
+
text-decoration: none;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@mixin fade-effect {
|
|
46
|
+
animation-duration: 0.3s;
|
|
47
|
+
animation-fill-mode: both;
|
|
48
|
+
animation-timing-function: cubic-bezier(0.55, 0, 0.55, 0.2);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&-fade-appear,
|
|
52
|
+
&-fade-enter {
|
|
53
|
+
opacity: 0;
|
|
54
|
+
|
|
55
|
+
@include fade-effect;
|
|
56
|
+
animation-play-state: paused;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&-fade-leave {
|
|
60
|
+
@include fade-effect;
|
|
61
|
+
animation-play-state: paused;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&-fade-appear#{&}-fade-appear-active,
|
|
65
|
+
&-fade-enter#{&}-fade-enter-active {
|
|
66
|
+
animation-name: rcNotificationFadeIn;
|
|
67
|
+
animation-play-state: running;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&-fade-leave#{&}-fade-leave-active {
|
|
71
|
+
animation-name: rcDialogFadeOut;
|
|
72
|
+
animation-play-state: running;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@keyframes rcNotificationFadeIn {
|
|
76
|
+
0% {
|
|
77
|
+
opacity: 0;
|
|
78
|
+
}
|
|
79
|
+
100% {
|
|
80
|
+
opacity: 1;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@keyframes rcDialogFadeOut {
|
|
85
|
+
0% {
|
|
86
|
+
opacity: 1;
|
|
87
|
+
}
|
|
88
|
+
100% {
|
|
89
|
+
opacity: 0;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
package/es/index-145NOArE.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"rc-table";import{unstable_batchedUpdates as a}from"react-dom";import{FormControl as o,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 u,useCallback as p,useRef as m,useEffect as h,useMemo as f,memo as g,forwardRef as v,useImperativeHandle as y}from"react";import{u as b,B as x,a as w,P as C,r as j,N as k,L as S,T as E,C as V,S as O}from"./index-Aog03FGz.js";import z from"styled-components";import N from"./index-njrIc1C9.js";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"axios";import"query-string";import"retry-axios";import"rc-notification";import"classnames";import"react-async-hook";import"@topthink/json-form";const H=function(t){let{indeterminate:r=!1,...n}=t;const a=m(null);return h((()=>{a.current&&(a.current.indeterminate=r)}),[r]),e("input",{ref:a,...n,className:"form-check-input",type:"checkbox"})};var q;function K(){return K=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},K.apply(this,arguments)}const M=e=>d.createElement("svg",K({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),q||(q=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 B;function P(){return P=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},P.apply(this,arguments)}const F=e=>d.createElement("svg",P({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.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 T(r){let{data:n,options:a,columns:o,onSearch:i}=r;const[c,s]=u(0),[d,m]=b({value:n,defaultValue:n,onChange:()=>{s((e=>e+1))},shouldUpdate:l}),[h,g,v]=f((()=>{const e={"ui:col":10,"ui:order":a.order},t={},r={};a.fields.forEach((n=>{const i=o.find((e=>e.dataIndex===n));if(i){const o=i.title;if("string"==typeof o){if(e[n]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...a.ui?.[n]},i.valueEnum){const t=i.valueEnum;return e[n]["ui:placeholder"]="请选择",r[n]={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[n]=void 0,r[n]={title:o,type:"string"}}}})),a.extraFields&&Object.entries(a.extraFields).forEach((n=>{let[o,i]=n;e[o]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...a.ui?.[o]},t[o]=void 0,r[o]={title:i,type:"string"}}));return[{type:"object",properties:r},e,t]}),[a.fields,a.extraFields]),y=p((e=>{let{formData:t}=e;m(t),i({...v,...t})}),[i,v]),w=p((()=>{m({}),i(v)}),[i,v]);return e(_,{children:e(N,{formContext:{layout:"horizontal"},schema:h,uiSchema:g,onSubmit:y,formData:d,children:e("div",{className:"col-2 ms-auto mt-auto",children:t("div",{className:"justify-content-end d-flex gap-2 ",children:[e(x,{className:"px-4",onClick:w,variant:"secondary",children:"重置"}),e(x,{className:"px-4",type:"submit",variant:"primary",children:"查询"})]})})})},c)}const _=z.div`
|
|
2
|
-
margin-bottom: 1rem;
|
|
3
|
-
`;function D(t){let{keyword:r,onKeywordChange:n}=t;const[a,i]=u(r),c=w(n,500);h((()=>{i(r)}),[r]);const l=p((e=>{i(e.target.value),c(e.target.value)}),[c,i]);return e(o,{value:a,onChange:l,type:"search",placeholder:"Search..."})}const I=z.thead`
|
|
4
|
-
th {
|
|
5
|
-
padding: 0.5rem 0.5rem;
|
|
6
|
-
border-bottom-width: 1px;
|
|
7
|
-
border-color: var(--bs-border-color);
|
|
8
|
-
}
|
|
9
|
-
`,R={table:t=>e(i,{...t,className:"mb-0 align-middle table-hover"}),header:{wrapper:t=>e(I,{...t})}},A=z.a`
|
|
10
|
-
cursor: pointer;
|
|
11
|
-
width: 28px;
|
|
12
|
-
height: 28px;
|
|
13
|
-
display: inline-flex;
|
|
14
|
-
align-items: center;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
vertical-align: middle;
|
|
17
|
-
`,L=function(t){let{record:r,expanded:n,expandable:a,onExpand:o}=t;return e(A,a?{onClick:e=>o(r,e),children:e(n?F:M,{})}:{})},U=z(C)`
|
|
18
|
-
margin-bottom: 0;
|
|
19
|
-
justify-content: flex-end;
|
|
20
|
-
margin-top: 1rem;
|
|
21
|
-
`;const $=v(((o,i)=>{let{source:l,rowKey:d="id",paginate:g=!0,toolBarRender:v,columns:x=[],search:w,rowSelection:C,card:O=!0,expandable:z={},sync:N=!1,...q}=o;const[K,M]=u([]),[B,P]=u(g?{total:0,current:1,pageSize:10}:null),[F,_]=u(!0),[I,A]=c({}),[$,G]=function(t,r,n){const[a,o]=u((()=>new Set(t?.selectedRowKeys||[]))),i=e=>"string"==typeof r?e[r]:r(e),c=e=>n.find((t=>i(t)===e)),l=p((e=>{e instanceof Set||(e=new Set(e)),o(e);const r=Array.from(e),n=r.map((function(e){return c(e)}));t?.onChange&&t?.onChange(r,n)}),[c]);return[p((r=>{if(!t)return r;const o=n.map(i),c=o.every((function(e){return a.has(e)})),s=o.some((function(e){return a.has(e)}));return[{key:"selection",title:e(H,{checked:c&&n.length>0,indeterminate:!c&&s,onChange:()=>{c?o.forEach((function(e){a.delete(e)})):o.forEach((function(e){a.add(e)})),l(new Set(a))}}),width:30,align:"center",render(t){let{record:r}=t;const n=i(r),o=a.has(n);return e(H,{checked:o,onChange:()=>{o?a.delete(n):a.add(n),l(new Set(a))}})}},...r]}),[n,t,a]),l]}(C,d,K),[Y,Z]=b({value:N?s(I,["q","page"]):void 0,defaultValue:{},onChange:e=>{N&&A(e)}}),[ee,te]=b({value:N?I.q||"":void 0,defaultValue:"",onChange:e=>{N&&A({q:e||void 0})}}),[re,ne]=b({value:N?I.page||1:void 0,defaultValue:1,onChange:e=>{N&&A({page:e||void 0})}}),ae=p((async()=>{_(!0),G([]);try{let e;const t={...Y,q:ee,page:re>1?re:void 0};e="string"==typeof l?await j({url:l,params:t}):await l(t),g&&function(e){return"current_page"in e}(e)&&(P({total:e.total,current:e.current_page,pageSize:e.per_page}),e=e.data),M(e)}catch(e){}finally{_(!1)}}),[l,M,ee,re,Y]);h((()=>{ae()}),[ee,re,Y]);const oe=m({reload:ae});h((()=>{oe.current={reload:ae}}),[ae]),y(i,(()=>oe.current));const ie=f((()=>$(x).map((t=>{let{render:r,valueType:n,valueEnum:a,...o}=t;const i={...o};return r?i.render=(e,t,n)=>r({value:e,record:t,index:n,action:oe.current}):"currency"===n?i.render=t=>e(k,{value:t}):a&&(i.render=t=>a[t]?a[t].status?e("span",{className:`text-${a[t].status}`,children:a[t].text}):a[t].text:t),i}))),[x,$,oe]),ce=t(r,{children:[e(S,{loading:F}),"object"==typeof w&&e(T,{data:Y,columns:x,options:w,onSearch:e=>{a((()=>{ne(1),Z(e)}))}}),!1!==v&&t(J,{children:[e(W,{size:12,children:v&&v(oe.current)}),t(Q,{size:12,children:[!0===w&&e(D,{keyword:ee,onKeywordChange:e=>{a((()=>{ne(1),te(e)}))}}),e(X,{onClick:oe.current.reload,children:e("i",{className:"bi bi-arrow-repeat"})})]})]}),e(E.Provider,{value:!0,children:e(n,{...q,expandable:{expandIcon:L,...z},rowKey:d,columns:ie,components:R,data:K})}),B&&e(U,{...B,onChange:ne})]});return O?e(V,{children:ce}):ce}));var G=g($);const J=z.div`
|
|
22
|
-
display: flex;
|
|
23
|
-
justify-content: space-between;
|
|
24
|
-
padding-bottom: 1rem;
|
|
25
|
-
height: 48px;
|
|
26
|
-
border-bottom: 2px solid #212529;
|
|
27
|
-
`,Q=z(O)`
|
|
28
|
-
|
|
29
|
-
`,W=z(O)`
|
|
30
|
-
|
|
31
|
-
`,X=z.span`
|
|
32
|
-
cursor: pointer;
|
|
33
|
-
font-size: 20px;
|
|
34
|
-
line-height: 1;
|
|
35
|
-
|
|
36
|
-
&:hover {
|
|
37
|
-
color: var(--bs-primary);
|
|
38
|
-
}
|
|
39
|
-
`;export{G as default};
|