@topthink/components 1.1.24 → 1.2.0
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-SX99DbLN.js → image-D_ymzS-L.js} +1 -1
- package/es/{index-DQ5B1OmL.js → index-CgwVy3gH.js} +1 -1
- package/es/{index-sbmUp8FC.js → index-DRAtk4n3.js} +1 -1
- package/es/{index-QRjGJrZt.js → index-D_NRKsed.js} +2 -2
- package/es/{index-C97DS7ut.js → index-jgdI39w4.js} +1 -1
- package/es/index.js +1 -1
- package/es/{infinite-scroller-zConMfyx.js → infinite-scroller-BG-YNNrt.js} +1 -1
- package/package.json +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t,Fragment as r}from"react/jsx-runtime";import{memo as e,useContext as i,useState as o,useEffect as s}from"react";import{I as a}from"./index-
|
|
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-D_NRKsed.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&&e&&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 +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-
|
|
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-D_NRKsed.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};
|
|
@@ -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 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-
|
|
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-D_NRKsed.js";import M from"styled-components";import H from"./index-CgwVy3gH.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
2
|
margin-bottom: 1rem;
|
|
3
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
4
|
th {
|
|
@@ -67,12 +67,12 @@ import e from"sweetalert2/dist/sweetalert2.js";import n from"sweetalert2-react-c
|
|
|
67
67
|
margin-bottom: 4px;
|
|
68
68
|
color: rgba(0, 0, 0, .45);
|
|
69
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-
|
|
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-CgwVy3gH.js")),Cn=m((e,n)=>t(p,{fallback:null,children:t(Nn,{...e,ref:n})})),Sn=f(()=>import("./index-DRAtk4n3.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
71
|
|
|
72
72
|
`,Rn=G(yn)`
|
|
73
73
|
margin-bottom: 0;
|
|
74
74
|
justify-content: flex-end;
|
|
75
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-
|
|
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-jgdI39w4.js")),In=f(()=>import("./image-D_ymzS-L.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-BG-YNNrt.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
77
|
${ne.extractCss()}
|
|
78
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};
|
|
@@ -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,{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-
|
|
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-D_NRKsed.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};
|
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-D_NRKsed.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";
|
|
@@ -1 +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-
|
|
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-D_NRKsed.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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topthink/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"module": "es/index.js",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"@babel/runtime": "^7.11.2",
|
|
13
13
|
"@toast-ui/editor": "^3.2.2",
|
|
14
14
|
"@toast-ui/react-editor": "^3.2.3",
|
|
15
|
-
"@topthink/bootstrap": "
|
|
16
|
-
"@topthink/json-form": "
|
|
15
|
+
"@topthink/bootstrap": "1.0.27",
|
|
16
|
+
"@topthink/json-form": "1.0.69",
|
|
17
17
|
"@types/react-infinite-scroller": "^1.2.5",
|
|
18
18
|
"ajv-i18n": "^4.0.0",
|
|
19
19
|
"axios": "^0.27.2",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"rc-select": "^14.16.6",
|
|
30
30
|
"rc-slider": "^10.6.2",
|
|
31
31
|
"rc-steps": "^4.1.4",
|
|
32
|
-
"rc-table": "
|
|
32
|
+
"rc-table": "7.53.1",
|
|
33
33
|
"react-async-hook": "^4.0.0",
|
|
34
34
|
"react-infinite-scroller": "^1.2.6",
|
|
35
35
|
"react-intersection-observer": "^9.10.2",
|
|
36
36
|
"react-medium-image-zoom": "^5.1.6",
|
|
37
37
|
"retry-axios": "^2.6.0",
|
|
38
38
|
"styled-components": "^6.1.11",
|
|
39
|
-
"sweetalert2": "
|
|
39
|
+
"sweetalert2": "11.6.16",
|
|
40
40
|
"sweetalert2-react-content": "^4.1.0",
|
|
41
41
|
"use-url-search-params": "^2.5.1",
|
|
42
42
|
"yet-another-react-lightbox": "^3.17.5"
|
|
@@ -64,10 +64,11 @@
|
|
|
64
64
|
"@types/react-dom": "^17.0.0",
|
|
65
65
|
"react-bootstrap": "^2.1.2",
|
|
66
66
|
"rollup": "^4.8.0",
|
|
67
|
-
"typescript": "^5.
|
|
67
|
+
"typescript": "^5.9.2"
|
|
68
68
|
},
|
|
69
69
|
"author": "yunwuxin <tzzhangyajun@qq.com> (https://github.com/yunwuxin)",
|
|
70
70
|
"license": "MIT",
|
|
71
|
+
"gitHead": "4253c979c79485d87650d73049657e2889f36fe1",
|
|
71
72
|
"scripts": {
|
|
72
73
|
"prebuild": "rimraf es types",
|
|
73
74
|
"build": "rollup -c --environment NODE_ENV:production",
|