xmirror-components 1.0.26-alpha.2 → 1.0.26-alpha.3
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/build/dist/index.cjs +16 -18
- package/build/dist/index.mjs +17 -19
- package/build/es/components/GlobalLoading/index.js +2 -2
- package/build/es/components/IconButton/index.js +2 -2
- package/build/lib/components/GlobalLoading/index.js +2 -2
- package/build/lib/components/IconButton/index.js +2 -2
- package/build/package.json +1 -1
- package/package.json +1 -1
package/build/dist/index.cjs
CHANGED
|
@@ -100,7 +100,7 @@ Valid keys: `+JSON.stringify(Object.keys(y),null," "));var v=re(M,F,O,q,$+"."+F
|
|
|
100
100
|
display: flex;
|
|
101
101
|
justify-content: center;
|
|
102
102
|
align-items: center;
|
|
103
|
-
`,He=Ye.div(({size:e,delay:r})=>({position:"absolute",margin:"auto",borderRadius:"50%",backgroundImage:" linear-gradient(
|
|
103
|
+
`,He=Ye.div(({size:e,delay:r})=>({position:"absolute",margin:"auto",borderRadius:"50%",backgroundImage:" linear-gradient(var(--color-primary) 10%, var(--color-primary-hover) 100%)",transform:"rotate(0deg) translateX(35px) rotate(0deg)",width:e,height:e,animation:`${vo} 4s ease-in-out infinite`,animationDelay:r||"0s"}));function Mn(){const e=_.useRef(null),[r,n]=_.useState(!1);return _.useEffect(()=>{exports.setGlobalLoading=t=>{n(t)}},[]),X.jsx(st,{in:r,nodeRef:e,timeout:500,classNames:"global-loading-transition",unmountOnExit:!0,children:()=>X.jsxs(mo,{ref:e,className:"global-loading",children:[X.jsxs(ho,{className:"global-loading-container",children:[X.jsx(He,{className:"dot dot-1",size:15,delay:"0.0s"}),X.jsx(He,{className:"dot dot-2",size:13,delay:"0.2s"}),X.jsx(He,{className:"dot dot-3",size:11,delay:"0.4s"}),X.jsx(He,{className:"dot dot-4",size:9,delay:"0.6s"}),X.jsx(He,{className:"dot dot-5",size:7,delay:"0.8s"})]}),X.jsx("svg",{style:{visibility:"hidden",position:"absolute"},children:X.jsx("defs",{children:X.jsxs("filter",{id:"goo",children:[X.jsx("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"3",result:"blur"}),X.jsx("feColorMatrix",{in:"blur",type:"matrix",values:`
|
|
104
104
|
1 0 0 0 0
|
|
105
105
|
0 1 0 0 0
|
|
106
106
|
0 0 1 0 0
|
|
@@ -109,24 +109,22 @@ Valid keys: `+JSON.stringify(Object.keys(y),null," "));var v=re(M,F,O,q,$+"."+F
|
|
|
109
109
|
Licensed under the MIT License (MIT), see
|
|
110
110
|
http://jedwatson.github.io/classnames
|
|
111
111
|
*/var Xt;function bo(){return Xt||(Xt=1,function(e){(function(){var r={}.hasOwnProperty;function n(){for(var a="",i=0;i<arguments.length;i++){var s=arguments[i];s&&(a=o(a,t(s)))}return a}function t(a){if(typeof a=="string"||typeof a=="number")return a;if(typeof a!="object")return"";if(Array.isArray(a))return n.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var i="";for(var s in a)r.call(a,s)&&a[s]&&(i=o(i,s));return i}function o(a,i){return i?a?a+" "+i:a+i:a}e.exports?(n.default=n,e.exports=n):window.classNames=n})()}(Ir)),Ir.exports}var Eo=bo();const at=br(Eo),Dn=_.forwardRef(({type:e="",className:r="",symbol:n=!1,style:t,...o},a)=>{const{iconFont:i}=_.useContext(Sr);return n?X.jsx("svg",{className:at(["iconfont-symbol",i.className||"",e,r]),"aria-hidden":"true",ref:a,style:{...i.style,...t||{}},...o,children:X.jsx("use",{xlinkHref:`#${e}`})}):X.jsx("i",{className:at(["iconfont",i.className||"",e,r]),ref:a,style:{...i.style,...t||{}},...o})}),xo=({checked:e,onChange:r,trueValue:n=!0,falseValue:t=!1,trueLabel:o="",falseLabel:a="",children:i,...s})=>{const f=e===n,u=d=>{r==null||r(d.target.checked?n:t,d)};return X.jsx(Ae.Checkbox,{checked:f,onChange:u,...s,children:i||(f?o:a)})},To=({checked:e,onChange:r,trueValue:n=!0,falseValue:t=!1,...o})=>{const a=e===n,i=(s,f)=>{r==null||r(s?n:t,f)};return X.jsx(Ae.Switch,{checked:a,onChange:i,...o})};var So=typeof global=="object"&&global&&global.Object===Object&&global,wo=typeof self=="object"&&self&&self.Object===Object&&self,Co=So||wo||Function("return this")(),gr=Co.Symbol,Fn=Object.prototype,Ro=Fn.hasOwnProperty,Oo=Fn.toString,Xe=gr?gr.toStringTag:void 0;function _o(e){var r=Ro.call(e,Xe),n=e[Xe];try{e[Xe]=void 0;var t=!0}catch{}var o=Oo.call(e);return t&&(r?e[Xe]=n:delete e[Xe]),o}var Po=Object.prototype,Ao=Po.toString;function jo(e){return Ao.call(e)}var No="[object Null]",ko="[object Undefined]",Jt=gr?gr.toStringTag:void 0;function $o(e){return e==null?e===void 0?ko:No:Jt&&Jt in Object(e)?_o(e):jo(e)}function Mo(e){return e!=null&&typeof e=="object"}var Io=Array.isArray;function Lo(){}var qo="[object String]";function Do(e){return typeof e=="string"||!Io(e)&&Mo(e)&&$o(e)==qo}const Fo=_.forwardRef((e,r)=>X.jsx(Ae.Button,{ref:r,...e})),Wo=Ye(Fo)`
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
border: none;
|
|
116
|
-
box-shadow: initial;
|
|
117
|
-
transition: background-color 0.2s;
|
|
118
|
-
|
|
119
|
-
&[disabled], &[aria-disabled='true'] {
|
|
120
|
-
color: #9da2a6 !important;
|
|
121
|
-
cursor: not-allowed;
|
|
112
|
+
&&.icon-button {
|
|
113
|
+
font-size: 18px;
|
|
114
|
+
color: var(--color-primary);
|
|
122
115
|
background-color: transparent;
|
|
123
|
-
|
|
116
|
+
border: none;
|
|
117
|
+
box-shadow: initial;
|
|
118
|
+
transition: background-color 0.2s;
|
|
124
119
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
120
|
+
&[disabled], &[aria-disabled='true'] {
|
|
121
|
+
color: #9da2a6 !important;
|
|
122
|
+
cursor: not-allowed;
|
|
123
|
+
background-color: transparent;
|
|
124
|
+
}
|
|
128
125
|
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
&:hover, &:active, &:focus {
|
|
127
|
+
background: var(--color-primary-bg);
|
|
128
|
+
}
|
|
131
129
|
}
|
|
132
|
-
`,Yo=({children:e,tooltipDisabled:r,disabled:n,disabledReason:t,title:o,...a})=>r?e:X.jsx(Ae.Tooltip,{title:n&&t||o,...a,children:e}),zo=_.forwardRef((e,r)=>{const{iconButton:n}=_.useContext(Sr),{icon:t,tooltipDisabled:o=!1,title:a,hide:i=!1,disabledReason:s,onClick:f=Lo,disabled:u,size:d=n.size||"small",style:p={},className:b,loading:g=!1,...m}=e,h=()=>Do(t)?X.jsx(Dn,{type:t}):t,x=n.render;return t||console.warn("Icon props not found"),X.jsx(x,{...e,children:X.jsx(Yo,{tooltipDisabled:o,hide:i,disabled:u,disabledReason:s,title:a,...m,children:X.jsx(Wo,{ref:r,icon:h(),size:d,className:at([n.className,b]),disabled:u,style:{...n.style,...p},loading:g,onClick:f})})})});var Uo=function(e){return function(r,n){var t=_.useRef(!1);e(function(){return function(){t.current=!1}},[]),e(function(){if(!t.current)t.current=!0;else return r()},n)}},xe=function(){return xe=Object.assign||function(r){for(var n,t=1,o=arguments.length;t<o;t++){n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])}return r},xe.apply(this,arguments)};function Wn(e,r){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++)r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(n[t[o]]=e[t[o]]);return n}function Go(e,r,n,t){function o(a){return a instanceof n?a:new n(function(i){i(a)})}return new(n||(n=Promise))(function(a,i){function s(d){try{u(t.next(d))}catch(p){i(p)}}function f(d){try{u(t.throw(d))}catch(p){i(p)}}function u(d){d.done?a(d.value):o(d.value).then(s,f)}u((t=t.apply(e,r||[])).next())})}function Bo(e,r){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},t,o,a,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(u){return function(d){return f([u,d])}}function f(u){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(n=0)),n;)try{if(t=1,o&&(a=u[0]&2?o.return:u[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,u[1])).done)return a;switch(o=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,o=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1],a=u;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(u);break}a[2]&&n.ops.pop(),n.trys.pop();continue}u=r.call(e,n)}catch(d){u=[6,d],o=0}finally{t=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function ue(e,r){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var t=n.call(e),o,a=[],i;try{for(;(r===void 0||r-- >0)&&!(o=t.next()).done;)a.push(o.value)}catch(s){i={error:s}}finally{try{o&&!o.done&&(n=t.return)&&n.call(t)}finally{if(i)throw i.error}}return a}function ce(e,r,n){if(n||arguments.length===2)for(var t=0,o=r.length,a;t<o;t++)(a||!(t in r))&&(a||(a=Array.prototype.slice.call(r,0,t)),a[t]=r[t]);return e.concat(a||Array.prototype.slice.call(r))}var wr=function(e){return typeof e=="function"},Cr=process.env.NODE_ENV==="development"||process.env.NODE_ENV==="test";function qe(e){Cr&&(wr(e)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof e)));var r=_.useRef(e);r.current=_.useMemo(function(){return e},[e]);var n=_.useRef();return n.current||(n.current=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return r.current.apply(this,t)}),n.current}const ot=Uo(_.useEffect);var Yn=function(e,r){var n=r.manual,t=r.ready,o=t===void 0?!0:t,a=r.defaultParams,i=a===void 0?[]:a,s=r.refreshDeps,f=s===void 0?[]:s,u=r.refreshDepsAction,d=_.useRef(!1);return d.current=!1,ot(function(){!n&&o&&(d.current=!0,e.run.apply(e,ce([],ue(i),!1)))},[o]),ot(function(){d.current||n||(d.current=!0,u?u():e.refresh())},ce([],ue(f),!1)),{onBefore:function(){if(!o)return{stopNow:!0}}}};Yn.onInit=function(e){var r=e.ready,n=r===void 0?!0:r,t=e.manual;return{loading:!t&&n}};function Vo(e,r){if(e===r)return!0;for(var n=0;n<e.length;n++)if(!Object.is(e[n],r[n]))return!1;return!0}function zn(e,r){var n=_.useRef({deps:r,obj:void 0,initialized:!1}).current;return(n.initialized===!1||!Vo(n.deps,r))&&(n.deps=r,n.obj=e(),n.initialized=!0),n.obj}function Un(e){var r=_.useRef(e);return r.current=e,r}var vt=function(e){Cr&&(wr(e)||console.error("useUnmount expected parameter is a function, got ".concat(typeof e)));var r=Un(e);_.useEffect(function(){return function(){r.current()}},[])},mr=new Map,Ho=function(e,r,n){var t=mr.get(e);t!=null&&t.timer&&clearTimeout(t.timer);var o=void 0;r>-1&&(o=setTimeout(function(){mr.delete(e)},r)),mr.set(e,xe(xe({},n),{timer:o}))},Xo=function(e){return mr.get(e)},hr=new Map,Jo=function(e){return hr.get(e)},Ko=function(e,r){hr.set(e,r),r.then(function(n){return hr.delete(e),n}).catch(function(){hr.delete(e)})},Me={},Zo=function(e,r){Me[e]&&Me[e].forEach(function(n){return n(r)})},Lr=function(e,r){return Me[e]||(Me[e]=[]),Me[e].push(r),function(){var t=Me[e].indexOf(r);Me[e].splice(t,1)}},Qo=function(e,r){var n=r.cacheKey,t=r.cacheTime,o=t===void 0?5*60*1e3:t,a=r.staleTime,i=a===void 0?0:a,s=r.setCache,f=r.getCache,u=_.useRef(),d=_.useRef(),p=function(g,m){s?s(m):Ho(g,o,m),Zo(g,m.data)},b=function(g,m){return m===void 0&&(m=[]),f?f(m):Xo(g)};return zn(function(){if(n){var g=b(n);g&&Object.hasOwnProperty.call(g,"data")&&(e.state.data=g.data,e.state.params=g.params,(i===-1||new Date().getTime()-g.time<=i)&&(e.state.loading=!1)),u.current=Lr(n,function(m){e.setState({data:m})})}},[]),vt(function(){var g;(g=u.current)===null||g===void 0||g.call(u)}),n?{onBefore:function(g){var m=b(n,g);return!m||!Object.hasOwnProperty.call(m,"data")?{}:i===-1||new Date().getTime()-m.time<=i?{loading:!1,data:m==null?void 0:m.data,error:void 0,returnNow:!0}:{data:m==null?void 0:m.data,error:void 0}},onRequest:function(g,m){var h=Jo(n);return h&&h!==d.current?{servicePromise:h}:(h=g.apply(void 0,ce([],ue(m),!1)),d.current=h,Ko(n,h),{servicePromise:h})},onSuccess:function(g,m){var h;n&&((h=u.current)===null||h===void 0||h.call(u),p(n,{data:g,params:m,time:new Date().getTime()}),u.current=Lr(n,function(x){e.setState({data:x})}))},onMutate:function(g){var m;n&&((m=u.current)===null||m===void 0||m.call(u),p(n,{data:g,params:e.state.params,time:new Date().getTime()}),u.current=Lr(n,function(h){e.setState({data:h})}))}}:{}},qr,Kt;function mt(){if(Kt)return qr;Kt=1;function e(r){var n=typeof r;return r!=null&&(n=="object"||n=="function")}return qr=e,qr}var Dr,Zt;function ei(){if(Zt)return Dr;Zt=1;var e=typeof ir=="object"&&ir&&ir.Object===Object&&ir;return Dr=e,Dr}var Fr,Qt;function Gn(){if(Qt)return Fr;Qt=1;var e=ei(),r=typeof self=="object"&&self&&self.Object===Object&&self,n=e||r||Function("return this")();return Fr=n,Fr}var Wr,en;function ri(){if(en)return Wr;en=1;var e=Gn(),r=function(){return e.Date.now()};return Wr=r,Wr}var Yr,rn;function ti(){if(rn)return Yr;rn=1;var e=/\s/;function r(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}return Yr=r,Yr}var zr,tn;function ni(){if(tn)return zr;tn=1;var e=ti(),r=/^\s+/;function n(t){return t&&t.slice(0,e(t)+1).replace(r,"")}return zr=n,zr}var Ur,nn;function Bn(){if(nn)return Ur;nn=1;var e=Gn(),r=e.Symbol;return Ur=r,Ur}var Gr,an;function ai(){if(an)return Gr;an=1;var e=Bn(),r=Object.prototype,n=r.hasOwnProperty,t=r.toString,o=e?e.toStringTag:void 0;function a(i){var s=n.call(i,o),f=i[o];try{i[o]=void 0;var u=!0}catch{}var d=t.call(i);return u&&(s?i[o]=f:delete i[o]),d}return Gr=a,Gr}var Br,on;function oi(){if(on)return Br;on=1;var e=Object.prototype,r=e.toString;function n(t){return r.call(t)}return Br=n,Br}var Vr,sn;function ii(){if(sn)return Vr;sn=1;var e=Bn(),r=ai(),n=oi(),t="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function i(s){return s==null?s===void 0?o:t:a&&a in Object(s)?r(s):n(s)}return Vr=i,Vr}var Hr,un;function si(){if(un)return Hr;un=1;function e(r){return r!=null&&typeof r=="object"}return Hr=e,Hr}var Xr,cn;function ui(){if(cn)return Xr;cn=1;var e=ii(),r=si(),n="[object Symbol]";function t(o){return typeof o=="symbol"||r(o)&&e(o)==n}return Xr=t,Xr}var Jr,fn;function ci(){if(fn)return Jr;fn=1;var e=ni(),r=mt(),n=ui(),t=NaN,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,i=/^0o[0-7]+$/i,s=parseInt;function f(u){if(typeof u=="number")return u;if(n(u))return t;if(r(u)){var d=typeof u.valueOf=="function"?u.valueOf():u;u=r(d)?d+"":d}if(typeof u!="string")return u===0?u:+u;u=e(u);var p=a.test(u);return p||i.test(u)?s(u.slice(2),p?2:8):o.test(u)?t:+u}return Jr=f,Jr}var Kr,ln;function Vn(){if(ln)return Kr;ln=1;var e=mt(),r=ri(),n=ci(),t="Expected a function",o=Math.max,a=Math.min;function i(s,f,u){var d,p,b,g,m,h,x=0,w=!1,P=!1,T=!0;if(typeof s!="function")throw new TypeError(t);f=n(f)||0,e(u)&&(w=!!u.leading,P="maxWait"in u,b=P?o(n(u.maxWait)||0,f):b,T="trailing"in u?!!u.trailing:T);function S(J){var Q=d,de=p;return d=p=void 0,x=J,g=s.apply(de,Q),g}function l(J){return x=J,m=setTimeout(K,f),w?S(J):g}function j(J){var Q=J-h,de=J-x,ne=f-Q;return P?a(ne,b-de):ne}function A(J){var Q=J-h,de=J-x;return h===void 0||Q>=f||Q<0||P&&de>=b}function K(){var J=r();if(A(J))return me(J);m=setTimeout(K,j(J))}function me(J){return m=void 0,T&&d?S(J):(d=p=void 0,g)}function le(){m!==void 0&&clearTimeout(m),x=0,d=h=p=m=void 0}function te(){return m===void 0?g:me(r())}function he(){var J=r(),Q=A(J);if(d=arguments,p=this,h=J,Q){if(m===void 0)return l(h);if(P)return clearTimeout(m),m=setTimeout(K,f),S(h)}return m===void 0&&(m=setTimeout(K,f)),g}return he.cancel=le,he.flush=te,he}return Kr=i,Kr}var fi=Vn();const li=br(fi);var di=function(e,r){var n=r.debounceWait,t=r.debounceLeading,o=r.debounceTrailing,a=r.debounceMaxWait,i=_.useRef(),s=_.useMemo(function(){var f={};return t!==void 0&&(f.leading=t),o!==void 0&&(f.trailing=o),a!==void 0&&(f.maxWait=a),f},[t,o,a]);return _.useEffect(function(){if(n){var f=e.runAsync.bind(e);return i.current=li(function(u){u()},n,s),e.runAsync=function(){for(var u=[],d=0;d<arguments.length;d++)u[d]=arguments[d];return new Promise(function(p,b){var g;(g=i.current)===null||g===void 0||g.call(i,function(){f.apply(void 0,ce([],ue(u),!1)).then(p).catch(b)})})},function(){var u;(u=i.current)===null||u===void 0||u.cancel(),e.runAsync=f}}},[n,s]),n?{onCancel:function(){var f;(f=i.current)===null||f===void 0||f.cancel()}}:{}},pi=function(e,r){var n=r.loadingDelay,t=r.ready,o=_.useRef();if(!n)return{};var a=function(){o.current&&clearTimeout(o.current)};return{onBefore:function(){return a(),t!==!1&&(o.current=setTimeout(function(){e.setState({loading:!0})},n)),{loading:!1}},onFinally:function(){a()},onCancel:function(){a()}}},Rr=!!(typeof window<"u"&&window.document&&window.document.createElement);function ht(){return Rr?document.visibilityState!=="hidden":!0}var Ke=[];function vi(e){return Ke.push(e),function(){var n=Ke.indexOf(e);Ke.splice(n,1)}}if(Rr){var mi=function(){if(ht())for(var e=0;e<Ke.length;e++){var r=Ke[e];r()}};window.addEventListener("visibilitychange",mi,!1)}var hi=function(e,r){var n=r.pollingInterval,t=r.pollingWhenHidden,o=t===void 0?!0:t,a=r.pollingErrorRetryCount,i=a===void 0?-1:a,s=_.useRef(),f=_.useRef(),u=_.useRef(0),d=function(){var p;s.current&&clearTimeout(s.current),(p=f.current)===null||p===void 0||p.call(f)};return ot(function(){n||d()},[n]),n?{onBefore:function(){d()},onError:function(){u.current+=1},onSuccess:function(){u.current=0},onFinally:function(){i===-1||i!==-1&&u.current<=i?s.current=setTimeout(function(){!o&&!ht()?f.current=vi(function(){e.refresh()}):e.refresh()},n):u.current=0},onCancel:function(){d()}}:{}};function yi(e,r){var n=!1;return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];n||(n=!0,e.apply(void 0,ce([],ue(t),!1)),setTimeout(function(){n=!1},r))}}function gi(){return Rr&&typeof navigator.onLine<"u"?navigator.onLine:!0}var Ze=[];function bi(e){return Ze.push(e),function(){var n=Ze.indexOf(e);n>-1&&Ze.splice(n,1)}}if(Rr){var dn=function(){if(!(!ht()||!gi()))for(var e=0;e<Ze.length;e++){var r=Ze[e];r()}};window.addEventListener("visibilitychange",dn,!1),window.addEventListener("focus",dn,!1)}var Ei=function(e,r){var n=r.refreshOnWindowFocus,t=r.focusTimespan,o=t===void 0?5e3:t,a=_.useRef(),i=function(){var s;(s=a.current)===null||s===void 0||s.call(a)};return _.useEffect(function(){if(n){var s=yi(e.refresh.bind(e),o);a.current=bi(function(){s()})}return function(){i()}},[n,o]),vt(function(){i()}),{}},xi=function(e,r){var n=r.retryInterval,t=r.retryCount,o=_.useRef(),a=_.useRef(0),i=_.useRef(!1);return t?{onBefore:function(){i.current||(a.current=0),i.current=!1,o.current&&clearTimeout(o.current)},onSuccess:function(){a.current=0},onError:function(){if(a.current+=1,t===-1||a.current<=t){var s=n??Math.min(1e3*Math.pow(2,a.current),3e4);o.current=setTimeout(function(){i.current=!0,e.refresh()},s)}else a.current=0},onCancel:function(){a.current=0,o.current&&clearTimeout(o.current)}}:{}},Zr,pn;function Ti(){if(pn)return Zr;pn=1;var e=Vn(),r=mt(),n="Expected a function";function t(o,a,i){var s=!0,f=!0;if(typeof o!="function")throw new TypeError(n);return r(i)&&(s="leading"in i?!!i.leading:s,f="trailing"in i?!!i.trailing:f),e(o,a,{leading:s,maxWait:a,trailing:f})}return Zr=t,Zr}var Si=Ti();const wi=br(Si);var Ci=function(e,r){var n=r.throttleWait,t=r.throttleLeading,o=r.throttleTrailing,a=_.useRef(),i={};return t!==void 0&&(i.leading=t),o!==void 0&&(i.trailing=o),_.useEffect(function(){if(n){var s=e.runAsync.bind(e);return a.current=wi(function(f){f()},n,i),e.runAsync=function(){for(var f=[],u=0;u<arguments.length;u++)f[u]=arguments[u];return new Promise(function(d,p){var b;(b=a.current)===null||b===void 0||b.call(a,function(){s.apply(void 0,ce([],ue(f),!1)).then(d).catch(p)})})},function(){var f;e.runAsync=s,(f=a.current)===null||f===void 0||f.cancel()}}},[n,t,o]),n?{onCancel:function(){var s;(s=a.current)===null||s===void 0||s.cancel()}}:{}},Ri=function(e){Cr&&(wr(e)||console.error('useMount: parameter `fn` expected to be a function, but got "'.concat(typeof e,'".'))),_.useEffect(function(){e==null||e()},[])},Oi=function(){var e=ue(_.useState({}),2),r=e[1];return _.useCallback(function(){return r({})},[])},_i=function(){function e(r,n,t,o){o===void 0&&(o={}),this.serviceRef=r,this.options=n,this.subscribe=t,this.initState=o,this.count=0,this.state={loading:!1,params:void 0,data:void 0,error:void 0},this.state=xe(xe(xe({},this.state),{loading:!n.manual}),o)}return e.prototype.setState=function(r){r===void 0&&(r={}),this.state=xe(xe({},this.state),r),this.subscribe()},e.prototype.runPluginHandler=function(r){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];var o=this.pluginImpls.map(function(a){var i;return(i=a[r])===null||i===void 0?void 0:i.call.apply(i,ce([a],ue(n),!1))}).filter(Boolean);return Object.assign.apply(Object,ce([{}],ue(o),!1))},e.prototype.runAsync=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return Go(this,void 0,void 0,function(){var t,o,a,i,s,f,u,d,p,b,g,m,h,x,w,P,T,S,l,j,A;return Bo(this,function(K){switch(K.label){case 0:if(this.count+=1,t=this.count,o=this.runPluginHandler("onBefore",r),a=o.stopNow,i=a===void 0?!1:a,s=o.returnNow,f=s===void 0?!1:s,u=Wn(o,["stopNow","returnNow"]),i)return[2,new Promise(function(){})];if(this.setState(xe({loading:!0,params:r},u)),f)return[2,Promise.resolve(u.data)];(h=(m=this.options).onBefore)===null||h===void 0||h.call(m,r),K.label=1;case 1:return K.trys.push([1,3,,4]),d=this.runPluginHandler("onRequest",this.serviceRef.current,r).servicePromise,d||(d=(g=this.serviceRef).current.apply(g,ce([],ue(r),!1))),[4,d];case 2:return p=K.sent(),t!==this.count?[2,new Promise(function(){})]:(this.setState({data:p,error:void 0,loading:!1}),(w=(x=this.options).onSuccess)===null||w===void 0||w.call(x,p,r),this.runPluginHandler("onSuccess",p,r),(T=(P=this.options).onFinally)===null||T===void 0||T.call(P,r,p,void 0),t===this.count&&this.runPluginHandler("onFinally",r,p,void 0),[2,p]);case 3:if(b=K.sent(),t!==this.count)return[2,new Promise(function(){})];throw this.setState({error:b,loading:!1}),(l=(S=this.options).onError)===null||l===void 0||l.call(S,b,r),this.runPluginHandler("onError",b,r),(A=(j=this.options).onFinally)===null||A===void 0||A.call(j,r,void 0,b),t===this.count&&this.runPluginHandler("onFinally",r,void 0,b),b;case 4:return[2]}})})},e.prototype.run=function(){for(var r=this,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.runAsync.apply(this,ce([],ue(n),!1)).catch(function(o){r.options.onError||console.error(o)})},e.prototype.cancel=function(){this.count+=1,this.setState({loading:!1}),this.runPluginHandler("onCancel")},e.prototype.refresh=function(){this.run.apply(this,ce([],ue(this.state.params||[]),!1))},e.prototype.refreshAsync=function(){return this.runAsync.apply(this,ce([],ue(this.state.params||[]),!1))},e.prototype.mutate=function(r){var n=wr(r)?r(this.state.data):r;this.runPluginHandler("onMutate",n),this.setState({data:n})},e}();function Pi(e,r,n){r===void 0&&(r={}),n===void 0&&(n=[]);var t=r.manual,o=t===void 0?!1:t,a=r.ready,i=a===void 0?!0:a,s=Wn(r,["manual","ready"]);Cr&&r.defaultParams&&!Array.isArray(r.defaultParams)&&console.warn("expected defaultParams is array, got ".concat(typeof r.defaultParams));var f=xe({manual:o,ready:i},s),u=Un(e),d=Oi(),p=zn(function(){var b=n.map(function(g){var m;return(m=g==null?void 0:g.onInit)===null||m===void 0?void 0:m.call(g,f)}).filter(Boolean);return new _i(u,f,d,Object.assign.apply(Object,ce([{}],ue(b),!1)))},[]);return p.options=f,p.pluginImpls=n.map(function(b){return b(p,f)}),Ri(function(){if(!o&&i){var b=p.state.params||r.defaultParams||[];p.run.apply(p,ce([],ue(b),!1))}}),vt(function(){p.cancel()}),{loading:p.state.loading,data:p.state.data,error:p.state.error,params:p.state.params||[],cancel:qe(p.cancel.bind(p)),refresh:qe(p.refresh.bind(p)),refreshAsync:qe(p.refreshAsync.bind(p)),run:qe(p.run.bind(p)),runAsync:qe(p.runAsync.bind(p)),mutate:qe(p.mutate.bind(p))}}function Ai(e,r,n){return Pi(e,r,ce(ce([],ue(n||[]),!1),[di,pi,hi,Ei,Ci,Yn,Qo,xi],!1))}function ji(e,r,n){const t=Ai(e,{...r,onError(a,i){var s;((r==null?void 0:r.errorMessage)??!0)&&exports.message.error(a.message),(s=r==null?void 0:r.onError)==null||s.call(r,a,i)}},n),o=t.data&&typeof t.data=="object"&&"data"in t.data?t.data.data:t.data;return{...t,data:o}}exports.App=go;exports.CheckboxValue=xo;exports.ConfigContext=Sr;exports.ConfigProvider=qn;exports.GlobalLoading=Mn;exports.IconButton=zo;exports.IconFont=Dn;exports.SwitchValue=To;exports.useRequest=ji;
|
|
130
|
+
`,Yo=({children:e,tooltipDisabled:r,disabled:n,disabledReason:t,title:o,...a})=>r?e:X.jsx(Ae.Tooltip,{title:n&&t||o,...a,children:e}),zo=_.forwardRef((e,r)=>{const{iconButton:n}=_.useContext(Sr),{icon:t,tooltipDisabled:o=!1,title:a,hide:i=!1,disabledReason:s,onClick:f=Lo,disabled:u,size:d=n.size||"small",style:p={},className:b,loading:g=!1,...m}=e,h=()=>Do(t)?X.jsx(Dn,{type:t}):t,x=n.render;return t||console.warn("Icon props not found"),X.jsx(x,{...e,children:X.jsx(Yo,{tooltipDisabled:o,hide:i,disabled:u,disabledReason:s,title:a,...m,children:X.jsx(Wo,{ref:r,icon:h(),size:d,className:at(["icon-button",n.className,b]),disabled:u,style:{...n.style,...p},loading:g,onClick:f})})})});var Uo=function(e){return function(r,n){var t=_.useRef(!1);e(function(){return function(){t.current=!1}},[]),e(function(){if(!t.current)t.current=!0;else return r()},n)}},xe=function(){return xe=Object.assign||function(r){for(var n,t=1,o=arguments.length;t<o;t++){n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])}return r},xe.apply(this,arguments)};function Wn(e,r){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++)r.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(n[t[o]]=e[t[o]]);return n}function Go(e,r,n,t){function o(a){return a instanceof n?a:new n(function(i){i(a)})}return new(n||(n=Promise))(function(a,i){function s(d){try{u(t.next(d))}catch(p){i(p)}}function f(d){try{u(t.throw(d))}catch(p){i(p)}}function u(d){d.done?a(d.value):o(d.value).then(s,f)}u((t=t.apply(e,r||[])).next())})}function Bo(e,r){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},t,o,a,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(u){return function(d){return f([u,d])}}function f(u){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(n=0)),n;)try{if(t=1,o&&(a=u[0]&2?o.return:u[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,u[1])).done)return a;switch(o=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,o=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){n.label=u[1];break}if(u[0]===6&&n.label<a[1]){n.label=a[1],a=u;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(u);break}a[2]&&n.ops.pop(),n.trys.pop();continue}u=r.call(e,n)}catch(d){u=[6,d],o=0}finally{t=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function ue(e,r){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var t=n.call(e),o,a=[],i;try{for(;(r===void 0||r-- >0)&&!(o=t.next()).done;)a.push(o.value)}catch(s){i={error:s}}finally{try{o&&!o.done&&(n=t.return)&&n.call(t)}finally{if(i)throw i.error}}return a}function ce(e,r,n){if(n||arguments.length===2)for(var t=0,o=r.length,a;t<o;t++)(a||!(t in r))&&(a||(a=Array.prototype.slice.call(r,0,t)),a[t]=r[t]);return e.concat(a||Array.prototype.slice.call(r))}var wr=function(e){return typeof e=="function"},Cr=process.env.NODE_ENV==="development"||process.env.NODE_ENV==="test";function qe(e){Cr&&(wr(e)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof e)));var r=_.useRef(e);r.current=_.useMemo(function(){return e},[e]);var n=_.useRef();return n.current||(n.current=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return r.current.apply(this,t)}),n.current}const ot=Uo(_.useEffect);var Yn=function(e,r){var n=r.manual,t=r.ready,o=t===void 0?!0:t,a=r.defaultParams,i=a===void 0?[]:a,s=r.refreshDeps,f=s===void 0?[]:s,u=r.refreshDepsAction,d=_.useRef(!1);return d.current=!1,ot(function(){!n&&o&&(d.current=!0,e.run.apply(e,ce([],ue(i),!1)))},[o]),ot(function(){d.current||n||(d.current=!0,u?u():e.refresh())},ce([],ue(f),!1)),{onBefore:function(){if(!o)return{stopNow:!0}}}};Yn.onInit=function(e){var r=e.ready,n=r===void 0?!0:r,t=e.manual;return{loading:!t&&n}};function Vo(e,r){if(e===r)return!0;for(var n=0;n<e.length;n++)if(!Object.is(e[n],r[n]))return!1;return!0}function zn(e,r){var n=_.useRef({deps:r,obj:void 0,initialized:!1}).current;return(n.initialized===!1||!Vo(n.deps,r))&&(n.deps=r,n.obj=e(),n.initialized=!0),n.obj}function Un(e){var r=_.useRef(e);return r.current=e,r}var vt=function(e){Cr&&(wr(e)||console.error("useUnmount expected parameter is a function, got ".concat(typeof e)));var r=Un(e);_.useEffect(function(){return function(){r.current()}},[])},mr=new Map,Ho=function(e,r,n){var t=mr.get(e);t!=null&&t.timer&&clearTimeout(t.timer);var o=void 0;r>-1&&(o=setTimeout(function(){mr.delete(e)},r)),mr.set(e,xe(xe({},n),{timer:o}))},Xo=function(e){return mr.get(e)},hr=new Map,Jo=function(e){return hr.get(e)},Ko=function(e,r){hr.set(e,r),r.then(function(n){return hr.delete(e),n}).catch(function(){hr.delete(e)})},Me={},Zo=function(e,r){Me[e]&&Me[e].forEach(function(n){return n(r)})},Lr=function(e,r){return Me[e]||(Me[e]=[]),Me[e].push(r),function(){var t=Me[e].indexOf(r);Me[e].splice(t,1)}},Qo=function(e,r){var n=r.cacheKey,t=r.cacheTime,o=t===void 0?5*60*1e3:t,a=r.staleTime,i=a===void 0?0:a,s=r.setCache,f=r.getCache,u=_.useRef(),d=_.useRef(),p=function(g,m){s?s(m):Ho(g,o,m),Zo(g,m.data)},b=function(g,m){return m===void 0&&(m=[]),f?f(m):Xo(g)};return zn(function(){if(n){var g=b(n);g&&Object.hasOwnProperty.call(g,"data")&&(e.state.data=g.data,e.state.params=g.params,(i===-1||new Date().getTime()-g.time<=i)&&(e.state.loading=!1)),u.current=Lr(n,function(m){e.setState({data:m})})}},[]),vt(function(){var g;(g=u.current)===null||g===void 0||g.call(u)}),n?{onBefore:function(g){var m=b(n,g);return!m||!Object.hasOwnProperty.call(m,"data")?{}:i===-1||new Date().getTime()-m.time<=i?{loading:!1,data:m==null?void 0:m.data,error:void 0,returnNow:!0}:{data:m==null?void 0:m.data,error:void 0}},onRequest:function(g,m){var h=Jo(n);return h&&h!==d.current?{servicePromise:h}:(h=g.apply(void 0,ce([],ue(m),!1)),d.current=h,Ko(n,h),{servicePromise:h})},onSuccess:function(g,m){var h;n&&((h=u.current)===null||h===void 0||h.call(u),p(n,{data:g,params:m,time:new Date().getTime()}),u.current=Lr(n,function(x){e.setState({data:x})}))},onMutate:function(g){var m;n&&((m=u.current)===null||m===void 0||m.call(u),p(n,{data:g,params:e.state.params,time:new Date().getTime()}),u.current=Lr(n,function(h){e.setState({data:h})}))}}:{}},qr,Kt;function mt(){if(Kt)return qr;Kt=1;function e(r){var n=typeof r;return r!=null&&(n=="object"||n=="function")}return qr=e,qr}var Dr,Zt;function ei(){if(Zt)return Dr;Zt=1;var e=typeof ir=="object"&&ir&&ir.Object===Object&&ir;return Dr=e,Dr}var Fr,Qt;function Gn(){if(Qt)return Fr;Qt=1;var e=ei(),r=typeof self=="object"&&self&&self.Object===Object&&self,n=e||r||Function("return this")();return Fr=n,Fr}var Wr,en;function ri(){if(en)return Wr;en=1;var e=Gn(),r=function(){return e.Date.now()};return Wr=r,Wr}var Yr,rn;function ti(){if(rn)return Yr;rn=1;var e=/\s/;function r(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}return Yr=r,Yr}var zr,tn;function ni(){if(tn)return zr;tn=1;var e=ti(),r=/^\s+/;function n(t){return t&&t.slice(0,e(t)+1).replace(r,"")}return zr=n,zr}var Ur,nn;function Bn(){if(nn)return Ur;nn=1;var e=Gn(),r=e.Symbol;return Ur=r,Ur}var Gr,an;function ai(){if(an)return Gr;an=1;var e=Bn(),r=Object.prototype,n=r.hasOwnProperty,t=r.toString,o=e?e.toStringTag:void 0;function a(i){var s=n.call(i,o),f=i[o];try{i[o]=void 0;var u=!0}catch{}var d=t.call(i);return u&&(s?i[o]=f:delete i[o]),d}return Gr=a,Gr}var Br,on;function oi(){if(on)return Br;on=1;var e=Object.prototype,r=e.toString;function n(t){return r.call(t)}return Br=n,Br}var Vr,sn;function ii(){if(sn)return Vr;sn=1;var e=Bn(),r=ai(),n=oi(),t="[object Null]",o="[object Undefined]",a=e?e.toStringTag:void 0;function i(s){return s==null?s===void 0?o:t:a&&a in Object(s)?r(s):n(s)}return Vr=i,Vr}var Hr,un;function si(){if(un)return Hr;un=1;function e(r){return r!=null&&typeof r=="object"}return Hr=e,Hr}var Xr,cn;function ui(){if(cn)return Xr;cn=1;var e=ii(),r=si(),n="[object Symbol]";function t(o){return typeof o=="symbol"||r(o)&&e(o)==n}return Xr=t,Xr}var Jr,fn;function ci(){if(fn)return Jr;fn=1;var e=ni(),r=mt(),n=ui(),t=NaN,o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,i=/^0o[0-7]+$/i,s=parseInt;function f(u){if(typeof u=="number")return u;if(n(u))return t;if(r(u)){var d=typeof u.valueOf=="function"?u.valueOf():u;u=r(d)?d+"":d}if(typeof u!="string")return u===0?u:+u;u=e(u);var p=a.test(u);return p||i.test(u)?s(u.slice(2),p?2:8):o.test(u)?t:+u}return Jr=f,Jr}var Kr,ln;function Vn(){if(ln)return Kr;ln=1;var e=mt(),r=ri(),n=ci(),t="Expected a function",o=Math.max,a=Math.min;function i(s,f,u){var d,p,b,g,m,h,x=0,w=!1,P=!1,T=!0;if(typeof s!="function")throw new TypeError(t);f=n(f)||0,e(u)&&(w=!!u.leading,P="maxWait"in u,b=P?o(n(u.maxWait)||0,f):b,T="trailing"in u?!!u.trailing:T);function S(J){var Q=d,de=p;return d=p=void 0,x=J,g=s.apply(de,Q),g}function l(J){return x=J,m=setTimeout(K,f),w?S(J):g}function j(J){var Q=J-h,de=J-x,ne=f-Q;return P?a(ne,b-de):ne}function A(J){var Q=J-h,de=J-x;return h===void 0||Q>=f||Q<0||P&&de>=b}function K(){var J=r();if(A(J))return me(J);m=setTimeout(K,j(J))}function me(J){return m=void 0,T&&d?S(J):(d=p=void 0,g)}function le(){m!==void 0&&clearTimeout(m),x=0,d=h=p=m=void 0}function te(){return m===void 0?g:me(r())}function he(){var J=r(),Q=A(J);if(d=arguments,p=this,h=J,Q){if(m===void 0)return l(h);if(P)return clearTimeout(m),m=setTimeout(K,f),S(h)}return m===void 0&&(m=setTimeout(K,f)),g}return he.cancel=le,he.flush=te,he}return Kr=i,Kr}var fi=Vn();const li=br(fi);var di=function(e,r){var n=r.debounceWait,t=r.debounceLeading,o=r.debounceTrailing,a=r.debounceMaxWait,i=_.useRef(),s=_.useMemo(function(){var f={};return t!==void 0&&(f.leading=t),o!==void 0&&(f.trailing=o),a!==void 0&&(f.maxWait=a),f},[t,o,a]);return _.useEffect(function(){if(n){var f=e.runAsync.bind(e);return i.current=li(function(u){u()},n,s),e.runAsync=function(){for(var u=[],d=0;d<arguments.length;d++)u[d]=arguments[d];return new Promise(function(p,b){var g;(g=i.current)===null||g===void 0||g.call(i,function(){f.apply(void 0,ce([],ue(u),!1)).then(p).catch(b)})})},function(){var u;(u=i.current)===null||u===void 0||u.cancel(),e.runAsync=f}}},[n,s]),n?{onCancel:function(){var f;(f=i.current)===null||f===void 0||f.cancel()}}:{}},pi=function(e,r){var n=r.loadingDelay,t=r.ready,o=_.useRef();if(!n)return{};var a=function(){o.current&&clearTimeout(o.current)};return{onBefore:function(){return a(),t!==!1&&(o.current=setTimeout(function(){e.setState({loading:!0})},n)),{loading:!1}},onFinally:function(){a()},onCancel:function(){a()}}},Rr=!!(typeof window<"u"&&window.document&&window.document.createElement);function ht(){return Rr?document.visibilityState!=="hidden":!0}var Ke=[];function vi(e){return Ke.push(e),function(){var n=Ke.indexOf(e);Ke.splice(n,1)}}if(Rr){var mi=function(){if(ht())for(var e=0;e<Ke.length;e++){var r=Ke[e];r()}};window.addEventListener("visibilitychange",mi,!1)}var hi=function(e,r){var n=r.pollingInterval,t=r.pollingWhenHidden,o=t===void 0?!0:t,a=r.pollingErrorRetryCount,i=a===void 0?-1:a,s=_.useRef(),f=_.useRef(),u=_.useRef(0),d=function(){var p;s.current&&clearTimeout(s.current),(p=f.current)===null||p===void 0||p.call(f)};return ot(function(){n||d()},[n]),n?{onBefore:function(){d()},onError:function(){u.current+=1},onSuccess:function(){u.current=0},onFinally:function(){i===-1||i!==-1&&u.current<=i?s.current=setTimeout(function(){!o&&!ht()?f.current=vi(function(){e.refresh()}):e.refresh()},n):u.current=0},onCancel:function(){d()}}:{}};function yi(e,r){var n=!1;return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];n||(n=!0,e.apply(void 0,ce([],ue(t),!1)),setTimeout(function(){n=!1},r))}}function gi(){return Rr&&typeof navigator.onLine<"u"?navigator.onLine:!0}var Ze=[];function bi(e){return Ze.push(e),function(){var n=Ze.indexOf(e);n>-1&&Ze.splice(n,1)}}if(Rr){var dn=function(){if(!(!ht()||!gi()))for(var e=0;e<Ze.length;e++){var r=Ze[e];r()}};window.addEventListener("visibilitychange",dn,!1),window.addEventListener("focus",dn,!1)}var Ei=function(e,r){var n=r.refreshOnWindowFocus,t=r.focusTimespan,o=t===void 0?5e3:t,a=_.useRef(),i=function(){var s;(s=a.current)===null||s===void 0||s.call(a)};return _.useEffect(function(){if(n){var s=yi(e.refresh.bind(e),o);a.current=bi(function(){s()})}return function(){i()}},[n,o]),vt(function(){i()}),{}},xi=function(e,r){var n=r.retryInterval,t=r.retryCount,o=_.useRef(),a=_.useRef(0),i=_.useRef(!1);return t?{onBefore:function(){i.current||(a.current=0),i.current=!1,o.current&&clearTimeout(o.current)},onSuccess:function(){a.current=0},onError:function(){if(a.current+=1,t===-1||a.current<=t){var s=n??Math.min(1e3*Math.pow(2,a.current),3e4);o.current=setTimeout(function(){i.current=!0,e.refresh()},s)}else a.current=0},onCancel:function(){a.current=0,o.current&&clearTimeout(o.current)}}:{}},Zr,pn;function Ti(){if(pn)return Zr;pn=1;var e=Vn(),r=mt(),n="Expected a function";function t(o,a,i){var s=!0,f=!0;if(typeof o!="function")throw new TypeError(n);return r(i)&&(s="leading"in i?!!i.leading:s,f="trailing"in i?!!i.trailing:f),e(o,a,{leading:s,maxWait:a,trailing:f})}return Zr=t,Zr}var Si=Ti();const wi=br(Si);var Ci=function(e,r){var n=r.throttleWait,t=r.throttleLeading,o=r.throttleTrailing,a=_.useRef(),i={};return t!==void 0&&(i.leading=t),o!==void 0&&(i.trailing=o),_.useEffect(function(){if(n){var s=e.runAsync.bind(e);return a.current=wi(function(f){f()},n,i),e.runAsync=function(){for(var f=[],u=0;u<arguments.length;u++)f[u]=arguments[u];return new Promise(function(d,p){var b;(b=a.current)===null||b===void 0||b.call(a,function(){s.apply(void 0,ce([],ue(f),!1)).then(d).catch(p)})})},function(){var f;e.runAsync=s,(f=a.current)===null||f===void 0||f.cancel()}}},[n,t,o]),n?{onCancel:function(){var s;(s=a.current)===null||s===void 0||s.cancel()}}:{}},Ri=function(e){Cr&&(wr(e)||console.error('useMount: parameter `fn` expected to be a function, but got "'.concat(typeof e,'".'))),_.useEffect(function(){e==null||e()},[])},Oi=function(){var e=ue(_.useState({}),2),r=e[1];return _.useCallback(function(){return r({})},[])},_i=function(){function e(r,n,t,o){o===void 0&&(o={}),this.serviceRef=r,this.options=n,this.subscribe=t,this.initState=o,this.count=0,this.state={loading:!1,params:void 0,data:void 0,error:void 0},this.state=xe(xe(xe({},this.state),{loading:!n.manual}),o)}return e.prototype.setState=function(r){r===void 0&&(r={}),this.state=xe(xe({},this.state),r),this.subscribe()},e.prototype.runPluginHandler=function(r){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];var o=this.pluginImpls.map(function(a){var i;return(i=a[r])===null||i===void 0?void 0:i.call.apply(i,ce([a],ue(n),!1))}).filter(Boolean);return Object.assign.apply(Object,ce([{}],ue(o),!1))},e.prototype.runAsync=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return Go(this,void 0,void 0,function(){var t,o,a,i,s,f,u,d,p,b,g,m,h,x,w,P,T,S,l,j,A;return Bo(this,function(K){switch(K.label){case 0:if(this.count+=1,t=this.count,o=this.runPluginHandler("onBefore",r),a=o.stopNow,i=a===void 0?!1:a,s=o.returnNow,f=s===void 0?!1:s,u=Wn(o,["stopNow","returnNow"]),i)return[2,new Promise(function(){})];if(this.setState(xe({loading:!0,params:r},u)),f)return[2,Promise.resolve(u.data)];(h=(m=this.options).onBefore)===null||h===void 0||h.call(m,r),K.label=1;case 1:return K.trys.push([1,3,,4]),d=this.runPluginHandler("onRequest",this.serviceRef.current,r).servicePromise,d||(d=(g=this.serviceRef).current.apply(g,ce([],ue(r),!1))),[4,d];case 2:return p=K.sent(),t!==this.count?[2,new Promise(function(){})]:(this.setState({data:p,error:void 0,loading:!1}),(w=(x=this.options).onSuccess)===null||w===void 0||w.call(x,p,r),this.runPluginHandler("onSuccess",p,r),(T=(P=this.options).onFinally)===null||T===void 0||T.call(P,r,p,void 0),t===this.count&&this.runPluginHandler("onFinally",r,p,void 0),[2,p]);case 3:if(b=K.sent(),t!==this.count)return[2,new Promise(function(){})];throw this.setState({error:b,loading:!1}),(l=(S=this.options).onError)===null||l===void 0||l.call(S,b,r),this.runPluginHandler("onError",b,r),(A=(j=this.options).onFinally)===null||A===void 0||A.call(j,r,void 0,b),t===this.count&&this.runPluginHandler("onFinally",r,void 0,b),b;case 4:return[2]}})})},e.prototype.run=function(){for(var r=this,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.runAsync.apply(this,ce([],ue(n),!1)).catch(function(o){r.options.onError||console.error(o)})},e.prototype.cancel=function(){this.count+=1,this.setState({loading:!1}),this.runPluginHandler("onCancel")},e.prototype.refresh=function(){this.run.apply(this,ce([],ue(this.state.params||[]),!1))},e.prototype.refreshAsync=function(){return this.runAsync.apply(this,ce([],ue(this.state.params||[]),!1))},e.prototype.mutate=function(r){var n=wr(r)?r(this.state.data):r;this.runPluginHandler("onMutate",n),this.setState({data:n})},e}();function Pi(e,r,n){r===void 0&&(r={}),n===void 0&&(n=[]);var t=r.manual,o=t===void 0?!1:t,a=r.ready,i=a===void 0?!0:a,s=Wn(r,["manual","ready"]);Cr&&r.defaultParams&&!Array.isArray(r.defaultParams)&&console.warn("expected defaultParams is array, got ".concat(typeof r.defaultParams));var f=xe({manual:o,ready:i},s),u=Un(e),d=Oi(),p=zn(function(){var b=n.map(function(g){var m;return(m=g==null?void 0:g.onInit)===null||m===void 0?void 0:m.call(g,f)}).filter(Boolean);return new _i(u,f,d,Object.assign.apply(Object,ce([{}],ue(b),!1)))},[]);return p.options=f,p.pluginImpls=n.map(function(b){return b(p,f)}),Ri(function(){if(!o&&i){var b=p.state.params||r.defaultParams||[];p.run.apply(p,ce([],ue(b),!1))}}),vt(function(){p.cancel()}),{loading:p.state.loading,data:p.state.data,error:p.state.error,params:p.state.params||[],cancel:qe(p.cancel.bind(p)),refresh:qe(p.refresh.bind(p)),refreshAsync:qe(p.refreshAsync.bind(p)),run:qe(p.run.bind(p)),runAsync:qe(p.runAsync.bind(p)),mutate:qe(p.mutate.bind(p))}}function Ai(e,r,n){return Pi(e,r,ce(ce([],ue(n||[]),!1),[di,pi,hi,Ei,Ci,Yn,Qo,xi],!1))}function ji(e,r,n){const t=Ai(e,{...r,onError(a,i){var s;((r==null?void 0:r.errorMessage)??!0)&&exports.message.error(a.message),(s=r==null?void 0:r.onError)==null||s.call(r,a,i)}},n),o=t.data&&typeof t.data=="object"&&"data"in t.data?t.data.data:t.data;return{...t,data:o}}exports.App=go;exports.CheckboxValue=xo;exports.ConfigContext=Sr;exports.ConfigProvider=qn;exports.GlobalLoading=Mn;exports.IconButton=zo;exports.IconFont=Dn;exports.SwitchValue=To;exports.useRequest=ji;
|
package/build/dist/index.mjs
CHANGED
|
@@ -3092,8 +3092,8 @@ const Oo = yo`
|
|
|
3092
3092
|
position: "absolute",
|
|
3093
3093
|
margin: "auto",
|
|
3094
3094
|
borderRadius: "50%",
|
|
3095
|
-
backgroundImage:
|
|
3096
|
-
|
|
3095
|
+
// backgroundImage: ' linear-gradient(#0060a7 10%, #1d77b3 100%)',
|
|
3096
|
+
backgroundImage: " linear-gradient(var(--color-primary) 10%, var(--color-primary-hover) 100%)",
|
|
3097
3097
|
transform: "rotate(0deg) translateX(35px) rotate(0deg)",
|
|
3098
3098
|
width: e,
|
|
3099
3099
|
height: e,
|
|
@@ -3357,25 +3357,23 @@ function Qo(e) {
|
|
|
3357
3357
|
return typeof e == "string" || !Jo(e) && Xo(e) && Ho(e) == Zo;
|
|
3358
3358
|
}
|
|
3359
3359
|
const ei = Te.forwardRef((e, r) => /* @__PURE__ */ H.jsx(oa, { ref: r, ...e })), ri = ze(ei)`
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
border: none;
|
|
3364
|
-
box-shadow: initial;
|
|
3365
|
-
transition: background-color 0.2s;
|
|
3366
|
-
|
|
3367
|
-
&[disabled], &[aria-disabled='true'] {
|
|
3368
|
-
color: #9da2a6 !important;
|
|
3369
|
-
cursor: not-allowed;
|
|
3360
|
+
&&.icon-button {
|
|
3361
|
+
font-size: 18px;
|
|
3362
|
+
color: var(--color-primary);
|
|
3370
3363
|
background-color: transparent;
|
|
3371
|
-
|
|
3364
|
+
border: none;
|
|
3365
|
+
box-shadow: initial;
|
|
3366
|
+
transition: background-color 0.2s;
|
|
3372
3367
|
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3368
|
+
&[disabled], &[aria-disabled='true'] {
|
|
3369
|
+
color: #9da2a6 !important;
|
|
3370
|
+
cursor: not-allowed;
|
|
3371
|
+
background-color: transparent;
|
|
3372
|
+
}
|
|
3376
3373
|
|
|
3377
|
-
|
|
3378
|
-
|
|
3374
|
+
&:hover, &:active, &:focus {
|
|
3375
|
+
background: var(--color-primary-bg);
|
|
3376
|
+
}
|
|
3379
3377
|
}
|
|
3380
3378
|
`, ti = ({
|
|
3381
3379
|
children: e,
|
|
@@ -3425,7 +3423,7 @@ const ei = Te.forwardRef((e, r) => /* @__PURE__ */ H.jsx(oa, { ref: r, ...e })),
|
|
|
3425
3423
|
ref: r,
|
|
3426
3424
|
icon: h(),
|
|
3427
3425
|
size: d,
|
|
3428
|
-
className: at([n.className, b]),
|
|
3426
|
+
className: at(["icon-button", n.className, b]),
|
|
3429
3427
|
disabled: c,
|
|
3430
3428
|
style: {
|
|
3431
3429
|
...n.style,
|
|
@@ -18,8 +18,8 @@ var Dot = styled.div(function (_a) {
|
|
|
18
18
|
position: 'absolute',
|
|
19
19
|
margin: 'auto',
|
|
20
20
|
borderRadius: '50%',
|
|
21
|
-
backgroundImage: ' linear-gradient(#0060a7 10%, #1d77b3 100%)',
|
|
22
|
-
|
|
21
|
+
// backgroundImage: ' linear-gradient(#0060a7 10%, #1d77b3 100%)',
|
|
22
|
+
backgroundImage: ' linear-gradient(var(--color-primary) 10%, var(--color-primary-hover) 100%)',
|
|
23
23
|
transform: 'rotate(0deg) translateX(35px) rotate(0deg)',
|
|
24
24
|
width: size,
|
|
25
25
|
height: size,
|
|
@@ -34,7 +34,7 @@ import styled from '@emotion/styled';
|
|
|
34
34
|
// 1. 先用 forwardRef 包裹 antd Button,确保 ref 类型
|
|
35
35
|
var BaseButton = React.forwardRef(function (props, ref) { return (React.createElement(Button, __assign({ ref: ref }, props))); });
|
|
36
36
|
// 2. 用 styled/emotion 包裹 BaseButton
|
|
37
|
-
var StyledButton = styled(BaseButton)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: 18px;\n
|
|
37
|
+
var StyledButton = styled(BaseButton)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &&.icon-button {\n font-size: 18px;\n color: var(--color-primary);\n background-color: transparent;\n border: none;\n box-shadow: initial;\n transition: background-color 0.2s;\n\n &[disabled], &[aria-disabled='true'] {\n color: #9da2a6 !important;\n cursor: not-allowed;\n background-color: transparent;\n }\n\n &:hover, &:active, &:focus {\n background: var(--color-primary-bg);\n }\n }\n"], ["\n &&.icon-button {\n font-size: 18px;\n color: var(--color-primary);\n background-color: transparent;\n border: none;\n box-shadow: initial;\n transition: background-color 0.2s;\n\n &[disabled], &[aria-disabled='true'] {\n color: #9da2a6 !important;\n cursor: not-allowed;\n background-color: transparent;\n }\n\n &:hover, &:active, &:focus {\n background: var(--color-primary-bg);\n }\n }\n"])));
|
|
38
38
|
var ButtonTooltip = function (_a) {
|
|
39
39
|
var children = _a.children, tooltipDisabled = _a.tooltipDisabled, disabled = _a.disabled, disabledReason = _a.disabledReason, title = _a.title, attrs = __rest(_a, ["children", "tooltipDisabled", "disabled", "disabledReason", "title"]);
|
|
40
40
|
if (tooltipDisabled) {
|
|
@@ -61,7 +61,7 @@ export var IconButton = React.forwardRef(function (props, ref) {
|
|
|
61
61
|
}
|
|
62
62
|
return (React.createElement(IconButtonRender, __assign({}, props),
|
|
63
63
|
React.createElement(ButtonTooltip, __assign({ tooltipDisabled: tooltipDisabled, hide: hide, disabled: disabled, disabledReason: disabledReason, title: title }, attrs),
|
|
64
|
-
React.createElement(StyledButton, { ref: ref, icon: createIcon(), size: size, className: classNames([iconButton.className, className]), disabled: disabled, style: __assign(__assign({}, iconButton.style), style), loading: loading, onClick: onClick }))));
|
|
64
|
+
React.createElement(StyledButton, { ref: ref, icon: createIcon(), size: size, className: classNames(['icon-button', iconButton.className, className]), disabled: disabled, style: __assign(__assign({}, iconButton.style), style), loading: loading, onClick: onClick }))));
|
|
65
65
|
});
|
|
66
66
|
export default IconButton;
|
|
67
67
|
var templateObject_1;
|
|
@@ -58,8 +58,8 @@ var Dot = styled_1.default.div(function (_a) {
|
|
|
58
58
|
position: 'absolute',
|
|
59
59
|
margin: 'auto',
|
|
60
60
|
borderRadius: '50%',
|
|
61
|
-
backgroundImage: ' linear-gradient(#0060a7 10%, #1d77b3 100%)',
|
|
62
|
-
|
|
61
|
+
// backgroundImage: ' linear-gradient(#0060a7 10%, #1d77b3 100%)',
|
|
62
|
+
backgroundImage: ' linear-gradient(var(--color-primary) 10%, var(--color-primary-hover) 100%)',
|
|
63
63
|
transform: 'rotate(0deg) translateX(35px) rotate(0deg)',
|
|
64
64
|
width: size,
|
|
65
65
|
height: size,
|
|
@@ -73,7 +73,7 @@ var styled_1 = __importDefault(require("@emotion/styled"));
|
|
|
73
73
|
// 1. 先用 forwardRef 包裹 antd Button,确保 ref 类型
|
|
74
74
|
var BaseButton = react_1.default.forwardRef(function (props, ref) { return (react_1.default.createElement(antd_1.Button, __assign({ ref: ref }, props))); });
|
|
75
75
|
// 2. 用 styled/emotion 包裹 BaseButton
|
|
76
|
-
var StyledButton = (0, styled_1.default)(BaseButton)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: 18px;\n
|
|
76
|
+
var StyledButton = (0, styled_1.default)(BaseButton)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &&.icon-button {\n font-size: 18px;\n color: var(--color-primary);\n background-color: transparent;\n border: none;\n box-shadow: initial;\n transition: background-color 0.2s;\n\n &[disabled], &[aria-disabled='true'] {\n color: #9da2a6 !important;\n cursor: not-allowed;\n background-color: transparent;\n }\n\n &:hover, &:active, &:focus {\n background: var(--color-primary-bg);\n }\n }\n"], ["\n &&.icon-button {\n font-size: 18px;\n color: var(--color-primary);\n background-color: transparent;\n border: none;\n box-shadow: initial;\n transition: background-color 0.2s;\n\n &[disabled], &[aria-disabled='true'] {\n color: #9da2a6 !important;\n cursor: not-allowed;\n background-color: transparent;\n }\n\n &:hover, &:active, &:focus {\n background: var(--color-primary-bg);\n }\n }\n"])));
|
|
77
77
|
var ButtonTooltip = function (_a) {
|
|
78
78
|
var children = _a.children, tooltipDisabled = _a.tooltipDisabled, disabled = _a.disabled, disabledReason = _a.disabledReason, title = _a.title, attrs = __rest(_a, ["children", "tooltipDisabled", "disabled", "disabledReason", "title"]);
|
|
79
79
|
if (tooltipDisabled) {
|
|
@@ -100,7 +100,7 @@ exports.IconButton = react_1.default.forwardRef(function (props, ref) {
|
|
|
100
100
|
}
|
|
101
101
|
return (react_1.default.createElement(IconButtonRender, __assign({}, props),
|
|
102
102
|
react_1.default.createElement(ButtonTooltip, __assign({ tooltipDisabled: tooltipDisabled, hide: hide, disabled: disabled, disabledReason: disabledReason, title: title }, attrs),
|
|
103
|
-
react_1.default.createElement(StyledButton, { ref: ref, icon: createIcon(), size: size, className: (0, classnames_1.default)([iconButton.className, className]), disabled: disabled, style: __assign(__assign({}, iconButton.style), style), loading: loading, onClick: onClick }))));
|
|
103
|
+
react_1.default.createElement(StyledButton, { ref: ref, icon: createIcon(), size: size, className: (0, classnames_1.default)(['icon-button', iconButton.className, className]), disabled: disabled, style: __assign(__assign({}, iconButton.style), style), loading: loading, onClick: onClick }))));
|
|
104
104
|
});
|
|
105
105
|
exports.default = exports.IconButton;
|
|
106
106
|
var templateObject_1;
|
package/build/package.json
CHANGED