@topthink/components 1.0.87 → 1.0.88
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/image-cFS0t5Lt.js +1 -0
- package/es/{index-mE2hsM4Z.js → index-2q4VlhKF.js} +1 -1
- package/es/{index-KojD0eD1.js → index-ysp5QSKH.js} +1 -1
- package/es/{index-xR-071mp.js → index-zK-PnErC.js} +2 -2
- package/es/index.js +1 -1
- package/es/{infinite-scroller-5a8SFflx.js → infinite-scroller-OLfsSwK4.js} +1 -1
- package/package.json +2 -2
- package/types/components/lazy/lightbox/image.d.ts +2 -1
- package/types/components/lightbox.d.ts +1 -1
- package/es/image-dGVTfSpy.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as t,Fragment as r}from"react/jsx-runtime";import{memo as e,useContext as i,useState as n,useEffect as o}from"react";import{I as s}from"./context-jiLXU49j.js";import{useInView as c}from"react-intersection-observer";let a=0;var l=e((e=>{let{lazy:l=!0,...h}=e;const{registerImage:g,setShow:m,setCurrent:d}=i(s),[f,w]=n(),[p,u]=n(!1),{ref:v,inView:x}=c({threshold:.2,skip:!l,initialInView:!0}),[b]=n((()=>(a+=1,a)));if(o((()=>{if(h.src)return g(b,h.src)}),[]),p)return t(r,{children:h.alt?`[图片加载失败:${h.alt}]`:" "});const I=!x&&l&&f?"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":h.src;return t("img",{width:f?.[0],height:f?.[1],onLoad:t=>{f||w([t.currentTarget.clientWidth,t.currentTarget.clientHeight])},onError:()=>{u(!0)},ref:v,...h,alt:void 0,src:I,onClick:()=>{d(b),m(!0)}})}));export{l 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 p,r as m,B as l}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 p,r as m,B as l}from"./index-zK-PnErC.js";import{mapValues as c}from"lodash";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"query-string";import"retry-axios";import"notistack";import"path";import"styled-components";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"react-async-hook";import"immer";import"react-intersection-observer";const d=require("ajv-i18n/localize/zh"),u=a.lazy((()=>import("./editor-widget-CQ3zv-Xu.js"))),f=o=>t(a.Suspense,{fallback:null,children:t(u,{...o})}),h={upload:function(o){let{options:a,...e}=o;const{widgets:n}=r();return a.endpoint&&(a.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:r,value:e}=await m({url:a.endpoint,method:"post",data:o});return{url:r,value:e}}),t(n.upload,{...e,options:a})},avatar:function(o){let{options:a,...e}=o;const{widgets:n}=r();return a.endpoint&&(a.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:r}=await m({url:a.endpoint,method:"post",data:o});return r}),t(n.avatar,{...e,options:a})},editor:function(o){let{options:r,...a}=o;return r.endpoint&&(r.onUpload=async t=>{const o=new FormData;o.set("file",t);const{url:a}=await m({url:r.endpoint,method:"post",data:o});return a}),t(f,{...a,options:r})},typeahead:function(o){let{options:a,...e}=o;const{widgets:n}=r();return a.endpoint&&(a.onSearch=async t=>{let{value:o,query:r}=t;return await m({url:a.endpoint,params:{value:o,query:r}})}),t(n.typeahead,{...e,options:a})}},y=e(((r,a)=>{let{action:e,method:u="post",onSuccess:f,formData:y,onSubmitting:w,onSubmit:g,onChange:b,submitText:v="提交",transformData:x,children:D,...j}=r;const[S,k]=n(),[q,_]=p(!1),[z,E]=n(y),F=i((async(t,o)=>{if(!q)try{if(_(!0),w&&w(!0),e){let{formData:o}=t;x&&(o=x(o));try{const t=await m({url:e,method:u,data:o});return k(void 0),f&&await f(t),t}catch(t){if(!s.isAxiosError(t))throw t;k((t=>{const o=t.errors;return"string"==typeof o?{__errors:[o]}:c(o,(t=>({__errors:[t]})))})(t))}}else if(g)return await g(t,o)}finally{_(!1),w&&w(!1)}}),[e,u,g]),U=i((t=>{const{formData:o}=t;E(o),b&&b(t)}),[E,b]),C=i((t=>(t=t.map((t=>({keyword:t.name,dataPath:t.property,...t}))),d(t),t)),[]),N=t(l,{className:"px-4",loading:q,type:"submit",variant:"primary",children:v});return"function"==typeof D&&(D=D({submit:N,loading:q})),t(o,{ref:a,extraErrors:S,onSubmit:F,transformErrors:C,noHtml5Validate:!0,noValidate:!0,...j,formData:z,onChange:U,widgets:h,children:D||t("div",{className:"col-12",children:N})})}));export{y as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"rc-table";import{unstable_batchedUpdates as o}from"react-dom";import{FormControl as a,Table as i}from"react-bootstrap";import{useUrlSearchParams as c}from"use-url-search-params";import{isEqual as l,omit as s}from"lodash";import*as d from"react";import{useState as p,useCallback as u,useRef as m,useEffect as h,useMemo as f,memo as g,forwardRef as v,useImperativeHandle as y}from"react";import{B as b,u as x,P as w,a as j,r as C,i as k,N as S,L as E,T as O,C as V,S as z}from"./index-
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as r}from"react/jsx-runtime";import n from"rc-table";import{unstable_batchedUpdates as o}from"react-dom";import{FormControl as a,Table as i}from"react-bootstrap";import{useUrlSearchParams as c}from"use-url-search-params";import{isEqual as l,omit as s}from"lodash";import*as d from"react";import{useState as p,useCallback as u,useRef as m,useEffect as h,useMemo as f,memo as g,forwardRef as v,useImperativeHandle as y}from"react";import{B as b,u as x,P as w,a as j,r as C,i as k,N as S,L as E,T as O,C as V,S as z}from"./index-zK-PnErC.js";import N from"styled-components";import H from"./index-2q4VlhKF.js";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"classnames";import"copy-to-clipboard";import"react-async-hook";import"immer";import"react-intersection-observer";import"@topthink/json-form";const q=function(t){let{indeterminate:r=!1,...n}=t;const o=m(null);return h((()=>{o.current&&(o.current.indeterminate=r)}),[r]),e("input",{ref:o,...n,className:"form-check-input",type:"checkbox"})};var K;function M(){return M=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},M.apply(this,arguments)}const B=e=>d.createElement("svg",M({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),K||(K=d.createElement("path",{d:"M252.069 906.496h520.283c89.582 0 134.144-44.562 134.144-132.846V250.331c0-88.283-44.562-132.845-134.144-132.845H252.069c-89.143 0-134.583 44.141-134.583 132.845V773.67c0 88.704 45.44 132.845 134.583 132.845zm1.28-68.992c-42.844 0-66.853-22.71-66.853-67.291V253.806c0-44.58 24.01-67.292 66.853-67.292h517.723c42.423 0 66.432 22.711 66.432 67.292v516.388c0 44.58-24.01 67.292-66.432 67.292zM511.78 714.496c22.71 0 36.425-15.854 36.425-40.704V547.365H682.35c24.009 0 40.722-12.874 40.722-35.584 0-23.132-15.854-36.426-40.722-36.426H548.206V340.773c0-24.85-13.715-40.704-36.425-40.704s-35.566 16.713-35.566 40.722v134.583H342.49c-24.85 0-41.142 13.275-41.142 36.407 0 22.71 17.152 35.584 41.142 35.584h133.724v126.427c0 23.99 12.855 40.704 35.566 40.704"})));var P;function F(){return F=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},F.apply(this,arguments)}const T=e=>d.createElement("svg",F({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 1024 1024"},e),P||(P=d.createElement("path",{d:"M252.069 906.496h520.283c89.582 0 134.144-44.562 134.144-132.846V250.331c0-88.283-44.562-132.845-134.144-132.845H252.069c-89.143 0-134.583 44.141-134.583 132.845V773.67c0 88.704 45.44 132.845 134.583 132.845zm1.28-68.992c-42.844 0-66.853-22.71-66.853-67.291V253.806c0-44.58 24.01-67.292 66.853-67.292h517.723c42.423 0 66.432 22.711 66.432 67.292v516.388c0 44.58-24.01 67.292-66.432 67.292zm86.582-289.719h344.576c23.991 0 40.704-12.855 40.704-35.566 0-23.15-15.433-36.425-40.704-36.425H339.931c-24.868 0-40.722 13.276-40.722 36.425 0 22.711 16.713 35.566 40.722 35.566"})));function D(r){let{data:n,options:o,columns:a,onSearch:i}=r;const[c,s]=p(0),[d,m]=p(n);h((()=>{l(n,d)||(m(n),s((e=>e+1)))}),[n]);const[g,v,y]=f((()=>{const e={"ui:col":10,"ui:order":o.order},t={},r={};o.fields.forEach((n=>{const i=a.find((e=>e.dataIndex===n));if(i){const a=i.title;if("string"==typeof a){if(e[n]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...o.ui?.[n]},i.valueEnum){const t=i.valueEnum;return e[n]["ui:placeholder"]="请选择",r[n]={title:a,type:"string",enum:Object.keys(t).flatMap((e=>"string"==typeof t[e].text?[e]:[])),enumNames:Object.keys(t).flatMap((e=>{const r=t[e].text;return"string"==typeof r?[r]:[]}))}}t[n]=void 0,r[n]={title:a,type:"string"}}}})),o.extraFields&&Object.entries(o.extraFields).forEach((n=>{let[a,i]=n;e[a]={"ui:col":4,"ui:labelCol":3,"ui:placeholder":"请输入",...o.ui?.[a]},t[a]=void 0,r[a]={title:i,type:"string"}}));return[{type:"object",properties:r},e,t]}),[o.fields,o.extraFields]),x=u((e=>{let{formData:t}=e;m(t),i({...y,...t})}),[i,y]),w=u((()=>{i(y)}),[i,y]);return e(I,{children:e(H,{formContext:{layout:"horizontal"},schema:g,uiSchema:v,onSubmit:x,formData:d,children:e("div",{className:"col-2 ms-auto mt-auto",children:t("div",{className:"justify-content-end d-flex gap-2 ",children:[e(b,{className:"px-4",onClick:w,variant:"secondary",children:"重置"}),e(b,{className:"px-4",type:"submit",variant:"primary",children:"查询"})]})})})},c)}const I=N.div`
|
|
2
2
|
margin-bottom: 1rem;
|
|
3
3
|
`;function R(t){let{keyword:r,onKeywordChange:n}=t;const[o,i]=p(r),c=x(n,500);h((()=>{i(r)}),[r]);const l=u((e=>{i(e.target.value),c(e.target.value)}),[c,i]);return e(a,{value:o,onChange:l,type:"search",placeholder:"Search..."})}const _=N.thead`
|
|
4
4
|
th {
|
|
@@ -63,10 +63,10 @@ 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 Re(){}function Ue(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function qe(e){return"current_page"in e}function Ge(e){let{total:t=0,onChange:r=Re,defaultCurrent:o=1,defaultPageSize:i=10,className:c,...l}=e;const[d,m]=a(o),[h,p]=a(i);s((()=>{Ue(l.current)&&m(l.current)}),[l.current]),s((()=>{Ue(l.pageSize)&&p(l.pageSize)}),[l.pageSize]);const g=f((()=>Math.floor((t-1)/h)+1),[t,h]),y=u((e=>()=>{e!==d&&(m(e),r(e,h))}),[r,d,h]),b=d-1>0?d-1:0,v=d+1<g?d+1:g,x=[];let w=null,k=null,C=null,N=null;if(g<=7)for(let e=1;e<=g;e+=1){const t=d===e;x.push(n(z.Item,{active:t,onClick:y(e),children:e},e))}else{N=n(z.Last,{onClick:y(g)},"last"),C=n(z.First,{onClick:y(1)},"first"),w=n(z.Prev,{onClick:y(b)},"prev"),k=n(z.Next,{onClick:y(v)},"next");let e=Math.max(1,d-2),t=Math.min(d+2,g);d-1<=2&&(t=5),g-d<=2&&(e=g-4);for(let r=e;r<=t;r+=1){const e=d===r;x.push(n(z.Item,{active:e,onClick:y(r),children:r},r))}d-1>=4&&3!==d&&x.unshift(w),g-d>=4&&d!==g-2&&x.push(k),1!==e&&x.unshift(C),t!==g&&x.push(N)}return n(z,{className:c,children:x})}function Ve(e){let{className:t,value:r,locale:i="zh-CN",currency:a=!0,options:s={}}=e;const c=f((()=>{let e;return e=a?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2},new Intl.NumberFormat(i,{...e,...s})}),[a,i,s]);return t?n("span",{className:t,children:c.format(r)}):n(o,{children:c.format(r)})}function Ke(e){let{loading:t,disabled:r,children:o,...i}=e;return n(C,{...i,disabled:t||r,children:t?"Loading…":o})}const Je=p((()=>import("./image-zoom-OrIPGqh0.js")));function Ye(e){return n(g,{fallback:null,children:n(Je,{...e})})}const Qe=m(((e,t)=>{let{url:n,method:r,confirm:o,onSuccess:i,children:a,disabled:s,as:c=ae,onError:l,...d}=e;const[f,m]=he(!1),h=u((async e=>{e.preventDefault();try{if(m(!0),o&&!await ce.confirm({message:o}))return;const e="string"==typeof n?{url:n,method:r}:{method:r,...n},t=await me(e);i&&i(t)}catch(e){if(!(e instanceof Error))throw e;l?l(e):le.error(e.message,{preventDuplicate:!0})}finally{m(!1)}}),[n,r,m]);return y(c,{...d,disabled:s||f,onClick:h,ref:t},a)})),We=p((()=>import("./index-
|
|
66
|
+
`;function Re(){}function Ue(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}function qe(e){return"current_page"in e}function Ge(e){let{total:t=0,onChange:r=Re,defaultCurrent:o=1,defaultPageSize:i=10,className:c,...l}=e;const[d,m]=a(o),[h,p]=a(i);s((()=>{Ue(l.current)&&m(l.current)}),[l.current]),s((()=>{Ue(l.pageSize)&&p(l.pageSize)}),[l.pageSize]);const g=f((()=>Math.floor((t-1)/h)+1),[t,h]),y=u((e=>()=>{e!==d&&(m(e),r(e,h))}),[r,d,h]),b=d-1>0?d-1:0,v=d+1<g?d+1:g,x=[];let w=null,k=null,C=null,N=null;if(g<=7)for(let e=1;e<=g;e+=1){const t=d===e;x.push(n(z.Item,{active:t,onClick:y(e),children:e},e))}else{N=n(z.Last,{onClick:y(g)},"last"),C=n(z.First,{onClick:y(1)},"first"),w=n(z.Prev,{onClick:y(b)},"prev"),k=n(z.Next,{onClick:y(v)},"next");let e=Math.max(1,d-2),t=Math.min(d+2,g);d-1<=2&&(t=5),g-d<=2&&(e=g-4);for(let r=e;r<=t;r+=1){const e=d===r;x.push(n(z.Item,{active:e,onClick:y(r),children:r},r))}d-1>=4&&3!==d&&x.unshift(w),g-d>=4&&d!==g-2&&x.push(k),1!==e&&x.unshift(C),t!==g&&x.push(N)}return n(z,{className:c,children:x})}function Ve(e){let{className:t,value:r,locale:i="zh-CN",currency:a=!0,options:s={}}=e;const c=f((()=>{let e;return e=a?{style:"currency",currency:"CNY"}:{minimumFractionDigits:2},new Intl.NumberFormat(i,{...e,...s})}),[a,i,s]);return t?n("span",{className:t,children:c.format(r)}):n(o,{children:c.format(r)})}function Ke(e){let{loading:t,disabled:r,children:o,...i}=e;return n(C,{...i,disabled:t||r,children:t?"Loading…":o})}const Je=p((()=>import("./image-zoom-OrIPGqh0.js")));function Ye(e){return n(g,{fallback:null,children:n(Je,{...e})})}const Qe=m(((e,t)=>{let{url:n,method:r,confirm:o,onSuccess:i,children:a,disabled:s,as:c=ae,onError:l,...d}=e;const[f,m]=he(!1),h=u((async e=>{e.preventDefault();try{if(m(!0),o&&!await ce.confirm({message:o}))return;const e="string"==typeof n?{url:n,method:r}:{method:r,...n},t=await me(e);i&&i(t)}catch(e){if(!(e instanceof Error))throw e;l?l(e):le.error(e.message,{preventDuplicate:!0})}finally{m(!1)}}),[n,r,m]);return y(c,{...d,disabled:s||f,onClick:h,ref:t},a)})),We=p((()=>import("./index-2q4VlhKF.js"))),Xe=m(((e,t)=>n(g,{fallback:null,children:n(We,{...e,ref:t})}))),Ze=p((()=>import("./index-ysp5QSKH.js"))),et=m(((e,t)=>n(g,{fallback:null,children:n(Ze,{...e,ref:t})})));let tt=0;function nt(){let{onHide:e,onShow:t}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[n,r]=a(!1),[o,i]=a(`visible-${tt}`),s=u((()=>{r(!1),e&&e()}),[r,e]),c=u((()=>{i("visible-"+ ++tt)}),[i,tt]);return{visible:n,show:u((()=>{r(!0),t&&t()}),[r,t]),hide:s,state:{show:n,onHide:s,onExited:c,key:o}}}const rt=m(((e,t)=>{let{text:i,onOk:a,modalProps:s,children:c,onShow:l,onHide:d,confirmLoading:u,as:f=ae,...m}=e;const{state:h,show:p,hide:g}=nt({onShow:l,onHide:d});b(t,(()=>({close:g})));const v=y(f,{...m,onClick:p},i);return r(o,{children:[v,n(ce,{header:i,...s,...h,confirmLoading:u,onOk:async e=>{if(a){!1===await a()&&e.preventDefault()}},children:c})]})})),ot=m(((e,t)=>{let{text:o,onSuccess:s,onSubmit:c,buttonProps:l,modalProps:d,children:f,...m}=e;const[h,p]=a(!1),g=i(null),y=i(null);b(t,(()=>({close:()=>{g.current?.close()}})));const v=u((()=>(y.current?.submit(),!1)),[]),x=u((e=>{s&&s(e),g.current?.close()}),[s]),w=u((async(e,t)=>{c&&await c(e,t)&&g.current?.close()}),[c]);return n(rt,{ref:g,text:o,...l,modalProps:d,onOk:v,confirmLoading:h,children:r(Xe,{...m,onSubmitting:p,ref:y,onSuccess:x,onSubmit:w,children:[f,n("input",{type:"submit",hidden:!0})]})})}));function it(e){let{header:t,children:o,closable:i=!0,show:a,onHide:s,bodyAs:c,headerAs:l="h5",...d}=e;return r(T,{...d,onHide:s,show:a,children:[t&&n(T.Header,{closeButton:i,children:n(T.Title,{as:l,children:t})}),n(T.Body,{as:c,children:o})]})}const at=m(((e,t)=>{let{text:i,offcanvasProps:a,children:s,onShow:c,onHide:l,as:d=ae,...u}=e;const{state:f,show:m,hide:h}=nt({onShow:c,onHide:l});b(t,(()=>({close:h})));const p=y(d,{...u,onClick:m},i);return r(o,{children:[p,n(it,{header:i,...a,...f,children:s})]})}));function st(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n=i(e);return s((()=>{n.current=e})),u((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.current?.(...t)}),t)}function ct(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=((e,t)=>e!==t)}=e,i=st(r),s=st(o),[c,l]=a(n),d=void 0!==t,u=d?t:c,f=st((e=>{const t="function"==typeof e?e(u):e;s(u,t)&&(d||l(t),i(t))}),[d,i,u,s]);return[u,f]}const lt=m(((e,t)=>{let{className:o,rowClassName:c,paginate:l=!0,sync:d=!1,columns:f=3,source:m,renderItem:h,renderEmpty:p}=e;const[g,y]=a([]),[v,x]=a(l?{total:0,current:1,pageSize:10}:null),[w,k]=a(!0),[C,N]=R({}),[S,j]=ct({value:d?C.page||1:void 0,defaultValue:1,onChange:e=>{d&&N({page:e||void 0})}}),z=u((async function(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]||k(!0);try{let e;const t={page:S>1?S:void 0};e="string"==typeof m?await me({url:m,params:t}):await m(t),l&&qe(e)&&(e.last_page>1&&x({total:e.total,current:e.current_page,pageSize:e.per_page}),e=e.data),y(e)}catch(e){}finally{k(!1)}}),[m,y,S]);s((()=>{z()}),[S]),s((()=>{T.current={reload:z}}),[z]);const T=i({reload:z});return b(t,(()=>T.current)),r(dt,{className:o,children:[n(ze,{wrap:!0,loading:w}),0===g.length&&!w&&p?.(),n(P,{className:c,children:g.map(((e,t)=>n(B,{className:"d-flex",md:12/f,children:h(e)},`card-${t}`)))}),v&&n(ut,{...v,onChange:j})]})})),dt=O.div`
|
|
67
67
|
|
|
68
68
|
`,ut=O(Ge)`
|
|
69
69
|
margin-bottom: 0;
|
|
70
70
|
justify-content: flex-end;
|
|
71
71
|
margin-top: 1rem;
|
|
72
|
-
`;var ft=v(lt);function mt(e){let{as:t="div",className:r,content:o,tooltip:c=!0,placement:l}=e;const[d,u]=a(!1),f=i();s((()=>()=>{f.current&&clearTimeout(f.current)}),[]);const m=c?n("i",d?{className:"bi bi-clipboard-check"}:{className:"bi bi-clipboard"}):d?"已复制":"复制",h=y(t,{role:"button",className:r,onClick:()=>{"function"==typeof o&&(o=o()),U(o),u(!0),f.current&&clearTimeout(f.current),f.current=setTimeout((()=>{u(!1),f.current=void 0}),3e3)}},m);return c?n(oe,{tooltip:d?"已复制":"复制",placement:l,children:h}):h}const ht=p((()=>import("./index-G1E7EOIF.js"))),pt=p((()=>import("./image-
|
|
72
|
+
`;var ft=v(lt);function mt(e){let{as:t="div",className:r,content:o,tooltip:c=!0,placement:l}=e;const[d,u]=a(!1),f=i();s((()=>()=>{f.current&&clearTimeout(f.current)}),[]);const m=c?n("i",d?{className:"bi bi-clipboard-check"}:{className:"bi bi-clipboard"}):d?"已复制":"复制",h=y(t,{role:"button",className:r,onClick:()=>{"function"==typeof o&&(o=o()),U(o),u(!0),f.current&&clearTimeout(f.current),f.current=setTimeout((()=>{u(!1),f.current=void 0}),3e3)}},m);return c?n(oe,{tooltip:d?"已复制":"复制",placement:l,children:h}):h}const ht=p((()=>import("./index-G1E7EOIF.js"))),pt=p((()=>import("./image-cFS0t5Lt.js")));function gt(e){return n(g,{fallback:null,children:n(ht,{...e})})}gt.Image=function(e){return n(g,{fallback:null,children:n(pt,{...e})})};const yt=p((()=>import("./infinite-scroller-OLfsSwK4.js"))),bt=m(((e,t)=>n(g,{fallback:null,children:n(yt,{...e,ref:t})}))),vt=p((()=>import("./slider-KuqHu6UH.js")));function xt(e){return n(g,{fallback:null,children:n(vt,{...e})})}function wt(e){let{manual:t,refreshDeps:n,...r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{execute:o,currentParams:i,error:a,...c}=q((async t=>(e="string"==typeof e?{url:e}:e,await me({...e,...t}))),r);s((()=>{if(!t&&!n)try{o()}catch{}}),[]),s((()=>{n&&l()}),n);const l=u((async()=>{try{i?await o(...i):await o()}catch{}}),[o,i]);if(a&&ue(a)){const e=a.errors;a=new Error("string"==typeof e?e:$(e).join(""))}return{refresh:l,execute:o,error:a,...c}}function kt(e,t,n){const r=i(e),o=i(E(e,t,n));return s((()=>{r.current=e})),s((()=>{o.current=E((function(){r.current(...arguments)}),t,n)}),[t,n]),o.current}function Ct(e){const[t,n]=a((()=>G("function"==typeof e?e():e,!0)));return[t,u((e=>{n("function"==typeof e?V(e):G(e))}),[])]}export{bt as A,ae as B,Pe as C,xt as D,Be as E,Xe as F,wt as G,nt as H,Ye as I,ue as J,fe as K,ze as L,Y as M,Ve as N,at as O,Ge as P,Se as R,He as S,ie as T,ct as a,he as b,Ct as c,le as d,de as e,ye as f,be as g,ve as h,qe as i,Ae as j,Me as k,Le as l,Ke as m,Qe as n,et as o,ot as p,rt as q,me as r,ce as s,it as t,kt as u,oe as v,ge as w,ft as x,mt as y,gt as z};
|
package/es/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{B as Button,C as Card,x as CardList,y as Clipboard,E as Error,F as Form,I as ImageZoom,A as InfiniteScroller,z as Lightbox,L as Loader,m as LoadingButton,M as Message,s as Modal,q as ModalButton,p as ModalForm,N as NumberFormat,t as Offcanvas,O as OffcanvasButton,P as Pagination,n as RequestButton,R as Result,D as Slider,S as Space,l as Statistic,k as Step,j as Steps,o as Table,d as Toast,v as Tooltip,f as formatSize,h as getAbsoluteUrl,g as isImageUrl,e as isRecord,J as isRequestError,r as request,K as showRequestError,a as useControllableState,u as useDebounce,c as useImmer,H as useOverlayState,G as useRequest,b as useSafeState,w as waitPayComplete}from"./index-
|
|
1
|
+
export{B as Button,C as Card,x as CardList,y as Clipboard,E as Error,F as Form,I as ImageZoom,A as InfiniteScroller,z as Lightbox,L as Loader,m as LoadingButton,M as Message,s as Modal,q as ModalButton,p as ModalForm,N as NumberFormat,t as Offcanvas,O as OffcanvasButton,P as Pagination,n as RequestButton,R as Result,D as Slider,S as Space,l as Statistic,k as Step,j as Steps,o as Table,d as Toast,v as Tooltip,f as formatSize,h as getAbsoluteUrl,g as isImageUrl,e as isRecord,J as isRequestError,r as request,K as showRequestError,a as useControllableState,u as useDebounce,c as useImmer,H as useOverlayState,G as useRequest,b as useSafeState,w as waitPayComplete}from"./index-zK-PnErC.js";export{StyleSheetManager,ThemeProvider,createGlobalStyle,css,keyframes,default as styled}from"styled-components";export{useAsync,useAsyncCallback}from"react-async-hook";export{useInView}from"react-intersection-observer";export{SnackbarProvider as ToastProvider}from"notistack";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react/jsx-runtime";import"react";import"react-bootstrap";import"lodash";import"axios";import"query-string";import"retry-axios";import"path";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"immer";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{memo as r,forwardRef as e,useState as a,useRef as o,useCallback as i,useImperativeHandle as s}from"react";import m from"react-infinite-scroller";import{c as p,r as c,i as n}from"./index-
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{memo as r,forwardRef as e,useState as a,useRef as o,useCallback as i,useImperativeHandle as s}from"react";import m from"react-infinite-scroller";import{c as p,r as c,i as n}from"./index-zK-PnErC.js";import"sweetalert2/dist/sweetalert2.js";import"sweetalert2-react-content";import"react-bootstrap";import"lodash";import"axios";import"query-string";import"retry-axios";import"notistack";import"path";import"styled-components";import"classnames";import"use-url-search-params";import"copy-to-clipboard";import"react-async-hook";import"immer";import"react-intersection-observer";var l=r(e(((r,e)=>{let{source:l,render:d,as:u,useWindow:f,className:y}=r;const[g,h]=a(!1),[w,x]=a(!1),[b,j]=p([]),v=o(0),k=i((async t=>{if(!g){h(!0),v.current=t;try{let r;const e={page:t>1?t:void 0};r="string"==typeof l?await c({url:l,params:e}):await l(e),n(r)?(x(r.current_page>=r.last_page),r=r.data):x(!0),j(1==t?r:[...b,...r])}catch{x(!0)}finally{h(!1)}}}),[l,b,v,g]),M=i((()=>{k(1)}),[k]);return s(e,(()=>({reload:M})),[M]),t(m,{className:y,hasMore:!w,pageStart:0,loadMore:()=>{k(v.current+1)},useWindow:f,element:u,children:d({data:b,setData:j,end:w,loading:g,action:{reload:M}})})})));export{l as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topthink/components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.88",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"prebuild": "rimraf es types",
|
|
6
6
|
"build": "rollup -c --environment NODE_ENV:production",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
},
|
|
72
72
|
"author": "yunwuxin <tzzhangyajun@qq.com> (https://github.com/yunwuxin)",
|
|
73
73
|
"license": "MIT",
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "0077f543f70ddf30ca19dbf281152c54813cce8f"
|
|
75
75
|
}
|
|
@@ -2,4 +2,5 @@ import { ImgHTMLAttributes } from 'react';
|
|
|
2
2
|
export interface Props extends ImgHTMLAttributes<HTMLImageElement> {
|
|
3
3
|
lazy?: boolean;
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
declare const _default: import("react").MemoExoticComponent<({ lazy, ...props }: Props) => JSX.Element>;
|
|
6
|
+
export default _default;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
2
|
declare const LazyLightbox: import("react").LazyExoticComponent<typeof import("./lazy/lightbox").default>;
|
|
3
|
-
declare const LazyImage: import("react").LazyExoticComponent<
|
|
3
|
+
declare const LazyImage: import("react").LazyExoticComponent<import("react").MemoExoticComponent<({ lazy, ...props }: import("./lazy/lightbox/image").Props) => JSX.Element>>;
|
|
4
4
|
declare function Lightbox(props: ComponentProps<typeof LazyLightbox>): JSX.Element;
|
|
5
5
|
declare namespace Lightbox {
|
|
6
6
|
var Image: (props: import("./lazy/lightbox/image").Props) => JSX.Element;
|
package/es/image-dGVTfSpy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useContext as r,useState as t,useEffect as i}from"react";import{I as s}from"./context-jiLXU49j.js";import{useInView as o}from"react-intersection-observer";let c=0;function n(n){let{lazy:m=!0,...a}=n;const{registerImage:g,setShow:f,setCurrent:h}=r(s),{ref:l,inView:w}=o({threshold:.1,skip:!m}),[p]=t((()=>(c+=1,c)));return i((()=>{if(a.src)return g(p,a.src)}),[]),e("img",{ref:l,...a,src:!w&&m?"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='1' height='1'%3e %3crect width='1' height='1' fill='none'/%3e%3c/svg%3e":a.src,onClick:()=>{h(p),f(!0)}})}export{n as default};
|