@spacecorexdev/shell 0.0.0-stage → 0.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/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ var pa=Object.defineProperty;var _=(e,t)=>()=>(e&&(t=e(e=0)),t);var Pe=(e,t)=>{for(var s in t)pa(e,s,{get:t[s],enumerable:!0})};import{Navigate as fa,Outlet as ga}from"react-router-dom";import{storage as ha}from"@spacecorexdev/core/utils";import{jsx as Ye}from"react/jsx-runtime";var va,qe,Je=_(()=>{"use strict";va=()=>ha.namespace("bp.ss").get("user")?Ye(ga,{}):Ye(fa,{to:"/login",replace:!0}),qe=va});import{API as Re}from"@spacecorexdev/core/api";import{useEffect as Ze,useRef as Ee,useState as G}from"react";import{useNavigate as ba}from"react-router-dom";import*as Ie from"febs-browser";import{ResponseCode as et}from"@spacecorexdev/core/api";import{CacheUserInfo as Xe}from"@spacecorexdev/core/utils";import{LockKeyhole as xa,RefreshCw as ya,ShieldCheck as wa,UserRound as Ca}from"lucide-react";import{Button as tt}from"antd";import{useEffectResize as Na}from"@spacecorexdev/core/utils";import{jsx as S,jsxs as U}from"react/jsx-runtime";function ka({captcha:e,onRefresh:t}){let s=Ee(null);return Ze(()=>{let n=s.current;if(!n)return;let i=154,a=54,y=window.devicePixelRatio||1,o=Sa(e.seed),c=n.getContext("2d");if(!c)return;n.width=i*y,n.height=a*y,n.style.width=`${i}px`,n.style.height=`${a}px`,c.setTransform(y,0,0,y,0,0),c.clearRect(0,0,i,a);let d=c.createLinearGradient(0,0,i,a);d.addColorStop(0,"#eff6ff"),d.addColorStop(.5,"#ecfeff"),d.addColorStop(1,"#f8fafc"),c.fillStyle=d,c.fillRect(0,0,i,a);for(let g=0;g<34;g++)c.fillStyle=`rgba(${60+o()*80}, ${90+o()*90}, ${130+o()*100}, ${.1+o()*.18})`,c.beginPath(),c.arc(o()*i,o()*a,1+o()*2.2,0,Math.PI*2),c.fill();for(let g=0;g<6;g++){c.beginPath(),c.lineWidth=.8+o()*1.4,c.strokeStyle=`rgba(${20+o()*80}, ${80+o()*110}, ${150+o()*80}, ${.28+o()*.3})`;let m=o()*a;c.moveTo(-8,m);for(let f=0;f<=i+8;f+=22)c.quadraticCurveTo(f+o()*14,o()*a,f+22,m+(o()-.5)*34);c.stroke()}let b=["Georgia","Times New Roman","Courier New","Verdana"];e.code.split("").forEach((g,m)=>{let f=17+m*34+o()*6,C=35+(o()-.5)*10,x=(o()-.5)*.72,k=.92+o()*.24,P=.9+o()*.26;c.save(),c.translate(f,C),c.rotate(x),c.transform(k,(o()-.5)*.28,(o()-.5)*.22,P,0,0),c.font=`700 ${24+o()*7}px ${b[Math.floor(o()*b.length)]}`,c.lineWidth=1.1,c.strokeStyle="rgba(15, 23, 42, 0.22)",c.fillStyle=`hsl(${200+o()*80}, ${45+o()*18}%, ${28+o()*20}%)`,c.strokeText(g,-8,0),c.fillText(g,-8,0),c.restore()});for(let g=0;g<95;g++)c.fillStyle=`rgba(15, 23, 42, ${.08+o()*.24})`,c.fillRect(o()*i,o()*a,.7+o()*1.2,.7+o()*1.2);c.strokeStyle="rgba(37, 99, 235, 0.18)",c.strokeRect(.5,.5,i-1,a-1)},[e]),U(tt,{onClick:t,className:"group relative flex min-w-[154px] items-center justify-center overflow-hidden rounded-2xl border border-slate-200 bg-white shadow-sm transition-all hover:border-blue-300 hover:shadow-md",title:"\u5237\u65B0\u9A8C\u8BC1\u7801","aria-label":"\u5237\u65B0\u9A8C\u8BC1\u7801",children:[S("canvas",{ref:s,className:"block"}),S(ya,{className:"absolute h-4 w-4 text-slate-500 opacity-0 transition-all group-hover:rotate-180 group-hover:opacity-80"})]})}var Qe,Sa,Ma,at,rt=_(()=>{"use strict";Qe=()=>{let e="ABCDEFGHJKLMNPQRSTUVWXYZ23456789";return{code:Array.from({length:4},()=>e[Math.floor(Math.random()*e.length)]).join(""),seed:Math.random()}},Sa=e=>{let t=Math.floor(e*1e9)||1;return()=>(t=(t*9301+49297)%233280,t/233280)};Ma=async()=>{let e=[Re.user.gateway,Re.user.user],t=["getWechatAuthUrl","getWeChatAuthUrl","getwechatAuthUrl"];for(let s of e)for(let n of t)if(s?.[n]){let i=await s[n]();if(i?.code===et.SUCCESS&&i.data?.authUrl)return i.data.authUrl}return"/api/oauth/wechat"},at=({themeMode:e})=>{let[t,s]=G(!1),[n,i]=G(""),[a,y]=G(""),[o,c]=G(""),[d,b]=G(()=>Qe()),[g,m]=G(""),[f,C]=G(!1),[x,k]=G(!1),P=ba(),[E,N]=G(!0),r=Ee(null),l=Ee(null),p=e==="dark"?"/images/logo-dark.png":"/images/logo.png";Na(()=>{s(!0)},()=>{s(!1)}),Ze(()=>(Xe.getUserInfo({forceRefresh:!0}).then(M=>{M?(N(!0),P("/",{replace:!0})):N(!1)}).catch(()=>{N(!1)}),()=>{l.current&&window.clearInterval(l.current),r.current&&!r.current.closed&&r.current.close()}),[P]);let v=()=>{b(Qe()),c("")},O=async M=>await Xe.getUserInfo({user_id:M,forceRefresh:!0})?(P("/"),!0):!1,$=M=>{if(M.preventDefault(),o.trim().toUpperCase()!==d.code){m("\u9A8C\u8BC1\u7801\u4E0D\u6B63\u786E\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165"),v();return}m(""),C(!0);let A=Math.random().toString();Re.user.gateway.login({phone:n,pwd:Ie.crypt.sha1(Ie.crypt.sha1(a)+A),pwdSN:A,smsCode:""}).then(B=>{B?.code===et.SUCCESS?O(B.data?.user_id).then(D=>{D||m("\u7528\u6237\u540D\u6216\u5BC6\u7801\u9519\u8BEF")}).catch(()=>{m("\u767B\u5F55\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}):(m("\u7528\u6237\u540D\u6216\u5BC6\u7801\u9519\u8BEF"),v())}).catch(()=>{m("\u767B\u5F55\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),v()}).finally(()=>{C(!1)})},j=async()=>{m(""),k(!0);try{let M=await Ma(),A=window.open(M,"wechat_login","width=720,height=820");if(r.current=A,!A){m("\u6D4F\u89C8\u5668\u963B\u6B62\u4E86\u5FAE\u4FE1\u767B\u5F55\u5F39\u7A97\uFF0C\u8BF7\u5141\u8BB8\u5F39\u7A97\u540E\u91CD\u8BD5"),k(!1);return}let B=()=>{l.current&&(window.clearInterval(l.current),l.current=null),window.removeEventListener("message",Z),k(!1)},D=async()=>{await O()||m("\u5FAE\u4FE1\u6388\u6743\u672A\u5B8C\u6210\u6216\u8D26\u53F7\u672A\u7ED1\u5B9A\uFF0C\u8BF7\u91CD\u8BD5")},Z=te=>{let Y=te.data||{};Y?.type!=="oauth"||Y?.provider!=="wechat"||(B(),Y.status==="success"?D():Y.status==="cancel"?m("\u5DF2\u53D6\u6D88\u5FAE\u4FE1\u767B\u5F55"):m("\u5FAE\u4FE1\u767B\u5F55\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),A&&!A.closed&&A.close())};window.addEventListener("message",Z);let ee=window.setInterval(()=>{r.current?.closed&&(B(),D())},1e3);l.current=ee}catch{k(!1),m("\u5FAE\u4FE1\u767B\u5F55\u6682\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5")}};return!E&&U("div",{className:"relative min-h-screen overflow-hidden bg-email-panel text-slate-900",children:[S("div",{className:"absolute inset-0",style:{background:"radial-gradient(circle at 20% 20%, rgb(var(--color-blue-700) / 0.18), transparent 30%), radial-gradient(circle at 82% 10%, rgb(var(--color-green-500) / 0.18), transparent 28%), linear-gradient(135deg, rgb(var(--color-primary-50)) 0%, rgb(var(--color-blue-50)) 46%, rgb(var(--color-green-50)) 100%)"}}),S("div",{className:"absolute left-[-120px] top-24 h-72 w-72 rounded-full border border-blue-200/70"}),S("div",{className:"absolute bottom-[-140px] right-[-80px] h-96 w-96 rounded-full bg-white/50 blur-3xl"}),U("div",{className:"relative mx-auto flex min-h-screen w-full max-w-6xl items-center justify-center px-4 py-8 lg:justify-between lg:px-8",children:[U("section",{className:"hidden max-w-xl lg:block",children:[U("div",{className:"mb-8 inline-flex items-center rounded-full border border-blue-200 bg-white/70 px-4 py-2 text-sm text-blue-700 shadow-sm backdrop-blur",children:[S(wa,{className:"mr-2 h-4 w-4"}),"Spacecore \u5B89\u5168\u5DE5\u4F5C\u53F0"]}),U("h1",{className:"text-5xl font-semibold leading-tight tracking-tight text-slate-950",children:["\u66F4\u5B89\u5168\u7684\u5165\u53E3\uFF0C",S("span",{className:"block text-blue-700",children:"\u66F4\u5FEB\u8FDB\u5165\u534F\u540C\u7A7A\u95F4\u3002"})]}),S("p",{className:"mt-5 max-w-lg text-base leading-7 text-slate-600",children:"\u767B\u5F55\u524D\u7F6E\u56FE\u5F62\u6821\u9A8C\u964D\u4F4E\u649E\u5E93\u98CE\u9669\uFF0C\u8D26\u53F7\u5BC6\u7801\u4E0E\u5FAE\u4FE1\u767B\u5F55\u5E76\u884C\u652F\u6301\uFF0C\u9002\u914D\u4F01\u4E1A\u6210\u5458\u4E0D\u540C\u767B\u5F55\u4E60\u60EF\u3002"}),S("div",{className:"mt-10 grid grid-cols-3 gap-3",children:["\u56FE\u5F62\u9A8C\u8BC1","\u5FAE\u4FE1\u6388\u6743","\u4F1A\u8BDD\u4FDD\u62A4"].map(M=>S("div",{className:"rounded-2xl border border-white/80 bg-white/60 p-4 text-sm font-medium text-slate-700 shadow-sm backdrop-blur",children:M},M))})]}),U("div",{className:"w-full max-w-md rounded-[28px] border border-white/80 bg-white/85 p-8 shadow-2xl shadow-blue-950/10 backdrop-blur-xl",children:[U("div",{className:"text-center",children:[S("div",{className:"mb-5 flex justify-center",children:S("img",{src:p,alt:"\u516C\u53F8Logo",className:"h-20 w-auto",onError:M=>{let A=M.target;A.onerror=null,A.style.display="none";let B=A.parentElement;if(B){let D=document.createElement("div");D.className="inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-blue-600 text-white",D.innerHTML='<span class="text-xl font-bold">SC</span>',B.appendChild(D)}}})}),S("h2",{className:"text-2xl font-semibold text-slate-950",children:"\u6B22\u8FCE\u767B\u5F55"})]}),U("form",{className:"mt-8 space-y-5",onSubmit:$,children:[U("div",{className:"space-y-4",children:[U("div",{children:[S("label",{htmlFor:"username",className:"mb-2 block text-sm font-medium text-slate-700",children:"\u8D26\u53F7"}),U("div",{className:"relative",children:[S(Ca,{className:"pointer-events-none absolute left-3 top-3.5 h-5 w-5 text-slate-400"}),S("input",{id:"username",name:"username",type:"text",required:!0,autoComplete:"username",value:n,onChange:M=>i(M.target.value),className:"block w-full rounded-2xl border border-slate-200 bg-white px-4 py-3 pl-11 text-slate-900 shadow-sm transition-all duration-200 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-4 focus:ring-blue-100",placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7\u6216\u7528\u6237\u540D"})]})]}),U("div",{children:[S("label",{htmlFor:"password",className:"mb-2 block text-sm font-medium text-slate-700",children:"\u5BC6\u7801"}),U("div",{className:"relative",children:[S(xa,{className:"pointer-events-none absolute left-3 top-3.5 h-5 w-5 text-slate-400"}),S("input",{id:"password",name:"password",type:"password",required:!0,autoComplete:"current-password",value:a,onChange:M=>y(M.target.value),className:"block w-full rounded-2xl border border-slate-200 bg-white px-4 py-3 pl-11 text-slate-900 shadow-sm transition-all duration-200 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-4 focus:ring-blue-100",placeholder:"\u8BF7\u8F93\u5165\u5BC6\u7801"})]})]}),U("div",{children:[S("label",{htmlFor:"captcha",className:"mb-2 block text-sm font-medium text-slate-700",children:"\u5B89\u5168\u9A8C\u8BC1"}),U("div",{className:t?"flex flex-col gap-3":"flex gap-3",children:[S("input",{id:"captcha",name:"captcha",type:"text",required:!0,maxLength:4,value:o,onChange:M=>c(M.target.value.toUpperCase()),className:"block min-w-0 flex-1 rounded-2xl border border-slate-200 bg-white px-4 py-3 text-slate-900 shadow-sm transition-all duration-200 placeholder:text-slate-400 focus:border-blue-500 focus:outline-none focus:ring-4 focus:ring-blue-100",placeholder:"\u8F93\u5165\u53F3\u4FA7\u9A8C\u8BC1\u7801"}),S(ka,{captcha:d,onRefresh:v})]}),S("p",{className:"mt-2 text-xs text-slate-400",children:"\u770B\u4E0D\u6E05\u53EF\u70B9\u51FB\u9A8C\u8BC1\u7801\u5237\u65B0"})]})]}),g&&S("div",{className:"rounded-2xl border border-red-100 bg-red-50 p-4",children:S("p",{className:"text-sm text-red-600",children:g})}),S("div",{className:"flex items-center justify-between"}),S(tt,{type:"primary",htmlType:"submit",disabled:f||x,className:"group relative flex w-full justify-center rounded-2xl border border-transparent bg-blue-600 px-4 py-3 text-sm font-medium text-white shadow-lg shadow-blue-600/20 transition-all duration-200 hover:-translate-y-0.5 hover:bg-blue-700 focus:outline-none focus:ring-4 focus:ring-blue-100 disabled:cursor-not-allowed disabled:opacity-60",children:f?"\u767B\u5F55\u4E2D...":"\u8D26\u53F7\u5BC6\u7801\u767B\u5F55"})]}),U("p",{className:"mt-8 text-center text-xs text-slate-400",children:["\xA9 ",new Date().getFullYear()," Spacecore, Inc. \u4FDD\u7559\u6240\u6709\u6743\u5229"]})]})]})]})}});import{useCallback as nt,useEffect as Ta,useState as st}from"react";import{HomeOutlined as Pa}from"@ant-design/icons";import{Menu as Ra}from"antd";import{useNavigate as Ea}from"react-router-dom";import{jsx as Ue}from"react/jsx-runtime";var Ae,Ia,xe,ot,it=_(()=>{"use strict";Ae=160,Ia=44,xe=8,ot=()=>{let e=Ea(),[t,s]=st(!1),[n,i]=st({x:0,y:0}),a=nt(()=>{s(!1)},[]),y=nt(()=>{a(),e("/")},[a,e]),o=[{key:"home",icon:Ue(Pa,{}),label:"\u56DE\u5230\u9996\u9875"}];return Ta(()=>{let c=f=>{if(f.defaultPrevented)return;let C=f.target;if(C?.closest('[data-global-context-menu="true"]')){f.preventDefault();return}if(C?.closest('[data-global-context-menu-ignore="true"]')||C?.tagName==="INPUT"||C?.tagName==="TEXTAREA"||C?.isContentEditable)return;let k=window.getSelection();k&&k.toString().trim().length>0||(f.preventDefault(),i({x:Math.min(f.clientX,window.innerWidth-Ae-xe),y:Math.min(f.clientY,window.innerHeight-Ia-xe)}),s(!0))},d=()=>a(),b=()=>a(),g=()=>a(),m=f=>{f.key==="Escape"&&a()};return document.addEventListener("contextmenu",c),document.addEventListener("click",d),window.addEventListener("scroll",b,!0),window.addEventListener("resize",g),document.addEventListener("keydown",m),()=>{document.removeEventListener("contextmenu",c),document.removeEventListener("click",d),window.removeEventListener("scroll",b,!0),window.removeEventListener("resize",g),document.removeEventListener("keydown",m)}},[a]),t?Ue("div",{"data-global-context-menu":"true",className:"fixed z-[10000]",style:{left:Math.max(xe,n.x),top:Math.max(xe,n.y),minWidth:Ae},children:Ue(Ra,{items:o,onClick:({key:c})=>{c==="home"&&y()},mode:"vertical",style:{borderRadius:6,boxShadow:"0 2px 8px rgb(var(--shadow-color) / 0.15)",background:"rgb(var(--color-surface))",border:"1px solid rgb(var(--color-border))",padding:"4px 0",fontSize:"14px",minWidth:Ae}})}):null}});var Le,lt=_(()=>{"use strict";Le="vendorsys:user-message-unread-change"});var _e=_(()=>{"use strict";lt()});import{HttpRequest as Aa}from"@spacecorexdev/core/api";var ct,dt=_(()=>{"use strict";ct={getPendingApprovalsCount:()=>Aa.get("/api/approval/instance/pendingCount",null,null).then(e=>e)}});import{HttpRequest as ut}from"@spacecorexdev/core/api";var mt,pt,ft=_(()=>{"use strict";mt={listAccounts:()=>ut.get("/api/email/account/list",null,null).then(e=>e)},pt={getFolders:e=>ut.get("/api/email/message/folders",{accountId:e.accountId},null).then(t=>t)}});import{useState as ne,useRef as _a,useEffect as gt,useMemo as Ba,useCallback as Fa}from"react";import{CacheUserInfo as ht}from"@spacecorexdev/core/utils";import{CacheDepartmentInfo as Oa,CacheRoleInfo as Da,clearFileViewerCache as Ha}from"@spacecorexdev/core/utils";import{Avatar as ja,Button as V,Modal as $a,Spin as vt,Empty as za}from"antd";import{useNavigate as Wa}from"react-router-dom";import{LogoutOutlined as Ga,MessageOutlined as Va,SettingOutlined as Ka,UserOutlined as Ya,DatabaseOutlined as qa,ClearOutlined as bt,QuestionCircleOutlined as Ja}from"@ant-design/icons";import{CachePermissionInfo as Xa}from"@spacecorexdev/core/utils";import{Fragment as Za,jsx as h,jsxs as L}from"react/jsx-runtime";function xt({onProfileClick:e,onMessageCenterClick:t,onLogout:s,unreadMessageCount:n}){let[i,a]=ne(!1),y=_a(null),[o,c]=ne(null),[d,b]=ne(""),[g,m]=ne(null),[f,C]=ne(!1),[x,k]=ne(null),[P,E]=ne(!1),N=Wa(),r=Ba(()=>g?Qa(g.displayModules||null):[],[g]),l=Fa(async()=>{E(!0);try{let{CacheFileContent:p}=await import("@spacecorexdev/filemanager"),[v]=await Promise.all([p.getCacheStats()]),O=[v?.oldestTime].filter(j=>typeof j=="number"&&j>0),$=[v?.newestTime].filter(j=>typeof j=="number"&&j>0);k({fileCount:v?.fileCount||0,totalSize:v?.totalSize||0,oldestTime:O.length?Math.min(...O):null,newestTime:$.length?Math.max(...$):null})}catch(p){console.error("\u52A0\u8F7D\u7F13\u5B58\u7EDF\u8BA1\u5931\u8D25:",p),k({fileCount:0,totalSize:0,oldestTime:null,newestTime:null})}E(!1)},[]);return gt(()=>{ht.getUserInfo({forceRefresh:!1,forceAvatar:!0}).then(v=>{m(v),b(v?.nickname||""),c(v?.avatar?.avatar_small||null)}).catch(()=>{});function p(v){y.current&&!y.current.contains(v.target)&&a(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]),gt(()=>{f&&l()},[f,l]),L("div",{className:"relative",ref:y,children:[h(V,{type:"text",onClick:()=>a(!i),className:"!flex !h-10 !w-10 items-center justify-center rounded-button !p-0 focus:outline-none",title:d,"aria-label":d?`${d} \u7684\u7528\u6237\u83DC\u5355`:"\u7528\u6237\u83DC\u5355",children:h("div",{className:"flex h-8 w-8 items-center justify-center rounded-full text-white",children:h(ja,{src:o,className:"w-full h-full rounded-full bg-blue-100 object-cover",children:h("span",{className:"text-black text-[18px] font-bold",children:d?.[0]||""})})})}),i&&h("div",{className:"absolute right-0 mt-2 w-48 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 z-50",children:L("div",{className:"py-1",children:[L(V,{type:"text",onClick:()=>{t(),a(!1)},className:"!flex !h-11 w-full !items-center !justify-start !px-6 !py-0 text-left text-sm text-gray-700 hover:bg-gray-100",children:[L("span",{className:"grid min-w-0 grid-cols-[24px_1fr] items-center gap-3",children:[h(Va,{className:"justify-self-center"}),h("span",{className:"leading-none",children:"\u6D88\u606F\u4E2D\u5FC3"})]}),n>0&&h("span",{className:"ml-auto flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-red-500 text-xs text-white",children:n>99?"99+":n})]}),r.includes("contacts")&&h(V,{type:"text",onClick:()=>{N("/contacts"),a(!1)},className:"!flex !h-11 w-full !items-center !justify-start !px-6 !py-0 text-left text-sm text-gray-700 hover:bg-gray-100",children:L("span",{className:"grid min-w-0 grid-cols-[24px_1fr] items-center gap-3",children:[h(Ya,{className:"justify-self-center"}),h("span",{className:"leading-none",children:"\u901A\u8BAF\u5F55"})]})}),h(V,{type:"text",onClick:()=>{e(),a(!1)},className:"!flex !h-11 w-full !items-center !justify-start !px-6 !py-0 text-left text-sm text-gray-700 hover:bg-gray-100",children:L("span",{className:"grid min-w-0 grid-cols-[24px_1fr] items-center gap-3",children:[h(Ka,{className:"justify-self-center"}),h("span",{className:"leading-none",children:"\u4E2A\u4EBA\u4E2D\u5FC3"})]})}),h(V,{type:"text",onClick:()=>{a(!1),C(!0)},className:"!flex !h-11 w-full !items-center !justify-start !px-6 !py-0 text-left text-sm text-gray-700 hover:bg-gray-100",children:L("span",{className:"grid min-w-0 grid-cols-[24px_1fr] items-center gap-3",children:[h(qa,{className:"justify-self-center"}),h("span",{className:"leading-none",children:"\u7F13\u5B58\u7BA1\u7406"})]})}),h(V,{type:"text",onClick:()=>{window.open(`${import.meta.env.BASE_URL}manual.html`,"_blank"),a(!1)},className:"!flex !h-11 w-full !items-center !justify-start !px-6 !py-0 text-left text-sm text-gray-700 hover:bg-gray-100",children:L("span",{className:"grid min-w-0 grid-cols-[24px_1fr] items-center gap-3",children:[h(Ja,{className:"justify-self-center"}),h("span",{className:"leading-none",children:"\u5E2E\u52A9\u624B\u518C"})]})}),h(V,{type:"text",onClick:()=>{s(),a(!1)},className:"!flex !h-11 w-full !items-center !justify-start !px-6 !py-0 text-left text-sm text-gray-700 hover:bg-gray-100",children:L("span",{className:"grid min-w-0 grid-cols-[24px_1fr] items-center gap-3",children:[h(Ga,{className:"justify-self-center"}),h("span",{className:"leading-none",children:"\u9000\u51FA"})]})})]})}),h($a,{title:"\u7F13\u5B58\u7BA1\u7406",open:f,onCancel:()=>C(!1),footer:null,width:400,children:P?h("div",{className:"flex justify-center py-8",children:h(vt,{})}):x?L("div",{className:"space-y-6",children:[x.fileCount>0?L(Za,{children:[L("div",{className:"grid grid-cols-2 gap-4",children:[L("div",{className:"bg-gray-50 rounded-lg p-4 text-center",children:[h("div",{className:"text-2xl font-bold text-blue-600",children:x.fileCount}),h("div",{className:"text-sm text-gray-500",children:"\u7F13\u5B58\u6587\u4EF6\u6570"})]}),L("div",{className:"bg-gray-50 rounded-lg p-4 text-center",children:[h("div",{className:"text-2xl font-bold text-green-600",children:x.totalSize<1024?`${x.totalSize} B`:x.totalSize<1024*1024?`${(x.totalSize/1024).toFixed(1)} KB`:`${(x.totalSize/(1024*1024)).toFixed(1)} MB`}),h("div",{className:"text-sm text-gray-500",children:"\u7F13\u5B58\u5927\u5C0F"})]})]}),L("div",{className:"space-y-2 text-sm text-gray-600",children:[x.oldestTime&&L("div",{className:"flex justify-between",children:[h("span",{children:"\u6700\u65E9\u7F13\u5B58\u65F6\u95F4\uFF1A"}),h("span",{children:new Date(x.oldestTime).toLocaleString()})]}),x.newestTime&&L("div",{className:"flex justify-between",children:[h("span",{children:"\u6700\u65B0\u7F13\u5B58\u65F6\u95F4\uFF1A"}),h("span",{children:new Date(x.newestTime).toLocaleString()})]})]}),h(V,{type:"primary",danger:!0,block:!0,icon:h(bt,{}),onClick:async()=>{E(!0);let{CacheFileContent:p,clearAllEditorCache:v}=await import("@spacecorexdev/filemanager");await p.clearAllCache(),await v(),await Ha(),await l(),E(!1)},children:"\u6E05\u7406\u6240\u6709\u6587\u4EF6\u7F13\u5B58"})]}):h(za,{description:"\u6682\u65E0\u6587\u4EF6\u7F13\u5B58"}),h(V,{type:"primary",danger:!0,block:!0,icon:h(bt,{}),onClick:async()=>{E(!0),await Xa.clearPermissionCache(),await ht.clearUserCache(),await Oa.clearDepartmentCache(),await Da.clearRoleCache(),await l(),E(!1)},children:"\u6E05\u7406\u6240\u6709\u6570\u636E\u7F13\u5B58"})]}):h("div",{className:"flex justify-center py-8",children:h(vt,{})})})]})}var Qa,yt=_(()=>{"use strict";Qa=e=>{if(!e)return["disk"];try{let t=JSON.parse(e);return Array.isArray(t)?t:["disk"]}catch{return["disk"]}}});import{useState as er}from"react";import{Badge as tr,Button as wt,Dropdown as ar}from"antd";import{ChevronDown as rr,Moon as nr,Sun as sr}from"lucide-react";import{useEffectResize as or}from"@spacecorexdev/core/utils";import{jsx as I,jsxs as q}from"react/jsx-runtime";function St({activeTab:e,navItems:t,activeNavItemOverride:s,onTabChange:n,onProfileClick:i,onLogout:a,onMessageCenterClick:y,pendingApprovalCount:o=0,unreadEmailCount:c=0,unreadMessageCount:d=0,setUnreadMessageCount:b,themeMode:g,onThemeToggle:m}){let[f,C]=er(!1),x=g==="dark"?"/images/logo-dark.png":"/images/logo.png";or(()=>{C(!0)},()=>{C(!1)},639);let k=t.find(N=>N.key===e)||s||t[0],P=t.map(N=>({key:N.key,label:q("div",{className:"flex items-center",children:[N.icon,I("span",{className:"ml-2",children:Ct(N,o,c)})]}),onClick:()=>n(N.key)})),E=N=>{let r=e===N.key,l=Nt(N.key,o,c);return q("button",{type:"button",onClick:()=>n(N.key),className:"group mr-2 inline-flex flex-col items-center justify-center gap-0.5 rounded-card px-1.5 py-1 outline-none transition-all duration-200 focus-visible:ring-2 focus-visible:ring-primary-200",children:[q("span",{className:`relative flex h-8 w-8 items-center justify-center rounded-[10px] transition-colors ${r?"bg-primary-500 text-white shadow-sm dark:bg-primary-300":"bg-[rgba(0,0,0,0.05)] text-gray-500 group-hover:bg-[rgba(0,0,0,0.10)] group-hover:text-gray-700 dark:bg-[rgba(255,255,255,0.10)] dark:group-hover:bg-[rgba(255,255,255,0.18)] dark:group-hover:text-gray-700"}`,children:[N.icon,l>0&&I("span",{className:"absolute -right-1.5 -top-1.5 z-10 flex h-4 min-w-4 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-medium leading-none text-white",children:l>99?"99+":l})]}),I("span",{className:`whitespace-nowrap text-[12px] leading-none ${r?"font-medium text-primary-600":"text-gray-500 group-hover:text-gray-700"}`,children:N.label})]},N.key)};return I("nav",{className:"bg-white border-b border-gray-200 fixed right-0 left-0 top-0 z-50",children:I("div",{className:"mx-auto",children:q("div",{className:"flex h-16 items-center",children:[q("div",{className:"flex flex-none items-center pl-3 sm:pl-4",children:[I("div",{className:"flex items-center",children:I("img",{src:x,alt:"logo",className:"h-8 sm:h-10"})}),I("div",{className:"border-l border-gray-200 h-8 mx-2 sm:mx-4"})]}),q("div",{className:"flex h-10 min-w-0 flex-1 items-center justify-between px-0 sm:px-3 lg:px-6",children:[f?I("div",{className:"min-w-0 flex-1 pr-2",children:I(ar,{menu:{items:P},trigger:["click"],children:q(wt,{type:"text",className:"inline-flex w-full max-w-full items-center justify-start px-2 py-2 border-b-2 text-sm font-medium transition-all duration-200 border-primary-500 text-primary-600 bg-primary-50/50 rounded-button",children:[k.icon,I("span",{className:"ml-2 min-w-0 flex-1 text-left font-semibold overflow-visible",children:Ct(k,o,c)}),I(rr,{className:"ml-1 h-4 w-4 flex-none"})]})})}):I("div",{className:"flex min-w-0 flex-1 justify-self-start overflow-x-scroll px-0 pt-1",style:{maxWidth:"calc(100vw - 220px)",scrollbarWidth:"none",msOverflowStyle:"none",paddingRight:"120px"},children:t.map(N=>E(N))}),q("div",{className:"relative flex flex-none items-center justify-center gap-1 border-l border-gray-200 bg-white px-2 sm:gap-2 sm:px-3",children:[I(wt,{type:"text",onClick:m,className:"inline-flex h-10 w-10 items-center justify-center",title:g==="dark"?"\u5207\u6362\u5230\u6D45\u8272\u4E3B\u9898":"\u5207\u6362\u5230\u6DF1\u8272\u4E3B\u9898","aria-label":g==="dark"?"\u5207\u6362\u5230\u6D45\u8272\u4E3B\u9898":"\u5207\u6362\u5230\u6DF1\u8272\u4E3B\u9898",icon:g==="dark"?I(sr,{className:"h-[18px] w-[18px]"}):I(nr,{className:"h-[18px] w-[18px]"})}),I(xt,{onProfileClick:i,onMessageCenterClick:y,onLogout:a,unreadMessageCount:d,setUnreadMessageCount:b}),d>0&&I("span",{className:"absolute -top-1 right-2 sm:right-0 bg-red-500 text-white text-xs rounded-full px-1.5 py-0.5 h-5 min-w-5 flex items-center justify-center z-10 shadow-sm",children:d>99?"99+":d})]})]})]})})})}var Nt,Ct,kt=_(()=>{"use strict";yt();Nt=(e,t,s)=>e==="approval"?t:e==="email"?s:0,Ct=(e,t,s)=>{let n=Nt(e.key,t,s);return n>0?I(tr,{count:n,offset:[8,0],size:"default",children:e.label}):e.label}});import{CloudOutlined as ir}from"@ant-design/icons";import{useOnlineStatus as lr}from"@spacecorexdev/core/hooks";import{jsx as Be,jsxs as cr}from"react/jsx-runtime";function Mt({isOnline:e}){let t=lr();return e??t?null:cr("div",{className:"fixed left-0 right-0 z-40 flex items-center justify-center gap-2 bg-orange-50 py-2 text-sm text-orange-700 border-b border-orange-200",style:{top:"64px"},children:[Be(ir,{className:"text-orange-500"}),Be("span",{className:"font-medium",children:"\u79BB\u7EBF\u6A21\u5F0F"}),Be("span",{className:"text-orange-500/70",children:"\xB7 \u7F51\u7EDC\u5DF2\u65AD\u5F00\uFF0C\u90E8\u5206\u529F\u80FD\u4E0D\u53EF\u7528"})]})}var Tt=_(()=>{"use strict"});import{API as se}from"@spacecorexdev/core/api";import{useState as me,useEffect as dr,useCallback as ur}from"react";import{useNavigate as mr}from"react-router-dom";import{ResponseCode as oe}from"@spacecorexdev/core/api";import{List as Fe,Avatar as pr,Button as ye,Pagination as fr,Tag as gr}from"antd";import{MessageSquare as hr,ArrowLeft as vr,Trash2 as br,Command as xr,ClipboardList as yr,BookOpen as wr,ListTodo as Cr,ChevronRight as Nr}from"lucide-react";import Pt from"dayjs";import{message as H}from"antd";import{htmlNoData as Sr}from"@spacecorexdev/core/utils";import{CheckOutlined as kr}from"@ant-design/icons";import{uiConfirm as Mr}from"@spacecorexdev/core/ui";import{MessageContentUtils as de}from"@spacecorexdev/core/utils";import{Fragment as Pr,jsx as T,jsxs as J}from"react/jsx-runtime";var Tr,Rt,Et=_(()=>{"use strict";Tr={project:{avatarClass:"bg-blue-50 text-blue-500",tagColor:"blue",Icon:xr},approval:{avatarClass:"bg-amber-50 text-amber-600",tagColor:"orange",Icon:yr},knowledge:{avatarClass:"bg-emerald-50 text-emerald-600",tagColor:"green",Icon:wr},todo:{avatarClass:"bg-purple-50 text-purple-500",tagColor:"purple",Icon:Cr},crm:{avatarClass:"bg-yellow-50 text-yellow-500",tagColor:"yellow",Icon:Nr}},Rt=({onBack:e,onUpdateUnreadCount:t})=>{let s=mr(),[n,i]=me([]),[a,y]=me(!1),[o,c]=me(1),[d]=me(8),[b,g]=me(0),m=ur(async(r=1)=>{y(!0);try{let l=await se.user.message.list({pageNum:r,pageSize:d,unread_only:!1});if(l?.code===oe.SUCCESS&&l.data){i(l.data);let p=await se.user.message.countUnread();p?.code===oe.SUCCESS&&g(p.data?.total||0)}}catch{H.error("\u83B7\u53D6\u6D88\u606F\u5217\u8868\u5931\u8D25")}finally{y(!1)}},[d]),f=async r=>{try{if((await se.user.message.markRead({messageIds:[r]}))?.code===oe.SUCCESS&&(i(p=>p.map(v=>v.id===r?{...v,is_read:!0}:v)),t)){let p=await se.user.message.countUnread();p?.code===oe.SUCCESS&&t(p.data?.unread||0)}}catch{H.error("\u6807\u8BB0\u5DF2\u8BFB\u5931\u8D25")}},C=async r=>{let l=de.parseContent(r.content),p=de.getJumpRoute(l);if(r.is_read||await f(r.id),l&&l.bizType==="file_download"){x(l);return}p&&s(p,{replace:!0})},x=async r=>{if(!r.url){H.info(r.text||"\u6682\u65E0\u53EF\u7528\u4E0B\u8F7D\u5730\u5740");return}if(r.expireAt&&Date.now()>r.expireAt){H.warning("\u4E0B\u8F7D\u5730\u5740\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u53D1\u8D77\u6587\u4EF6\u5939\u4E0B\u8F7D");return}let{uiFilePreview:l}=await import("@spacecorexdev/filemanager");l.downloadFile(r.url,r.fileName||"folder.zip").catch(()=>{})},k=async()=>{try{let r=n.filter(p=>!p.is_read).map(p=>p.id);if(r.length===0){H.info("\u6CA1\u6709\u672A\u8BFB\u6D88\u606F");return}(await se.user.message.markRead({messageIds:r}))?.code===oe.SUCCESS&&(i(p=>p.map(v=>({...v,is_read:!0}))),t&&t(0),H.success("\u5DF2\u5168\u90E8\u6807\u8BB0\u4E3A\u5DF2\u8BFB"))}catch{H.error("\u6279\u91CF\u6807\u8BB0\u5DF2\u8BFB\u5931\u8D25")}},P=async()=>{if(await Mr.confirm({title:"\u786E\u8BA4\u6E05\u7A7A\u5DF2\u8BFB\u6D88\u606F\u5417\uFF1F"}))try{if(n.filter(v=>v.is_read).map(v=>v.id).length===0){H.info("\u6CA1\u6709\u5DF2\u8BFB\u6D88\u606F");return}(await se.user.message.clearReaded({}))?.code===oe.SUCCESS&&(i(v=>v.filter(O=>O.is_read?null:O)),H.success("\u5DF2\u5168\u90E8\u6E05\u7A7A\u5DF2\u8BFB"))}catch{H.error("\u6279\u91CF\u6E05\u7A7A\u5DF2\u8BFB\u5931\u8D25")}},E=async r=>{try{(await se.user.message.clearReaded({messageIds:[r]}))?.code===oe.SUCCESS&&(i(p=>p.filter(v=>v.id!==r)),H.success("\u5220\u9664\u6210\u529F"))}catch{H.error("\u5220\u9664\u5931\u8D25")}};dr(()=>{m(o)},[o,m]);let N=r=>{let l=de.parseContent(r.content),p=l?Tr[l.type]:void 0,v=de.getJumpRoute(l),O=l?de.getBizTypeLabel(l.type,l.bizType):"",$=l?de.getDisplayText(l):r.content,j=p?.Icon,M=!!(l&&l.bizType==="file_download"),A=!r.is_read||!!v||M;return T(Fe.Item,{className:`relative p-4 border-b border-border hover:bg-surface transition-colors ${A?"cursor-pointer":"bg-background"}`,onClick:()=>C(r),extra:T(ye,{type:"text",onClick:B=>{B.stopPropagation(),E(r.id)},className:"text-muted hover:text-red-500 transition-colors p-1 absolute bottom-2 right-2",title:"\u5220\u9664",icon:T(br,{className:"w-4 h-4"})}),children:T(Fe.Item.Meta,{className:"pr-4 pl-4",avatar:T(pr,{className:p?`${p.avatarClass} bg-transparent`:`${r.is_read?"bg-gray-200 bg-transparent":"bg-gray-400 bg-transparent"}`,children:p&&j?T(j,{className:"w-4 h-4"}):r.is_read?T(kr,{className:"w-3 h-3 text-gray-500"}):T(hr,{className:"w-3 h-3 text-gray-500"})}),title:J("div",{className:"flex items-center justify-between",children:[T("span",{className:`${r.is_read?"text-muted font-normal":"text-foreground font-bold"}`,children:r.title}),!r.is_read&&T("span",{className:"w-2 h-2 bg-red-500 rounded-full ml-2"})]}),description:J("div",{className:"flex flex-col",children:[J("div",{className:"flex items-center gap-2",children:[l&&O&&T(gr,{color:p?.tagColor,className:"mr-0 shrink-0 my-0",children:O}),T("p",{className:`text-sm line-clamp-2 flex-1 m-0 ${r.is_read?"font-thin text-muted":"text-foreground/80"}`,children:$})]}),l&&l.bizType==="file_download"&&l.url&&J("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1",children:[J("a",{className:"text-xs text-blue-500 hover:text-blue-600",onClick:B=>{B.stopPropagation(),x(l)},children:["\u4E0B\u8F7D\u6253\u5305\u6587\u4EF6",l.fileName?`\uFF08${l.fileName}\uFF09`:""]}),l.expireAt&&J("span",{className:"text-muted text-xs font-thin",children:["\u4E0B\u8F7D\u94FE\u63A5\u6709\u6548\u671F\u81F3 ",Pt(l.expireAt).format("YYYY-MM-DD HH:mm")]})]}),T("span",{className:"text-muted text-xs mt-1 font-thin",children:Pt(r.created_at).format("YYYY-MM-DD HH:mm:ss")})]})})},r.id)};return J("div",{className:"max-w-[800px] h-[100vh] flex flex-col mx-auto py-8 pb-2",children:[J("div",{className:"flex items-center mb-6 px-4 sm:px-6 lg:px-8",children:[T(ye,{type:"text",onClick:e,className:"mr-4 text-muted hover:text-foreground",icon:T(vr,{className:"w-6 h-6"})}),T("h2",{className:"text-2xl font-bold text-foreground",children:"\u6D88\u606F\u4E2D\u5FC3"}),T(ye,{type:"primary",onClick:k,size:"small",disabled:n.filter(r=>!r.is_read).length===0,className:"ml-auto",children:"\u5168\u6807\u5DF2\u8BFB"}),T(ye,{type:"primary",onClick:P,size:"small",disabled:n.filter(r=>r.is_read).length===0,className:"ml-1",children:"\u6E05\u7A7A\u5DF2\u8BFB"})]}),T("div",{className:"bg-surface flex-1 md:shadow md:rounded-lg min-h-[calc(100vh-280px)] flex flex-row items-center justify-center overflow-y-auto",children:a?T("div",{className:"py-12 text-center",children:T("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-blue-500 border-t-transparent"})}):n.length===0?Sr():T(Pr,{children:T(Fe,{dataSource:n,renderItem:N,className:"flex-1 self-start"})})}),n.length!==0&&T("div",{className:"px-4 py-4 border-t border-border flex justify-center",children:T(fr,{current:o,pageSize:d,total:b,onChange:r=>c(r),showSizeChanger:!1})})]})}});import{API as Rr}from"@spacecorexdev/core/api";import{useCallback as It,useEffect as Er,useRef as Ir}from"react";import{useNavigate as Ar}from"react-router-dom";import{AuthorizationHandler as Ur}from"@spacecorexdev/core/api";import{useOnlineStatus as Lr}from"@spacecorexdev/core/hooks";import{jsx as we,jsxs as _r}from"react/jsx-runtime";function At({children:e,navItems:t,activeTab:s,activeNavItemOverride:n,showMessageCenter:i=!1,onTabChange:a,setUnreadMessageCount:y,pendingApprovalCount:o=0,unreadEmailCount:c=0,unreadMessageCount:d=0,themeMode:b,onThemeToggle:g,onWebSocketManagerClose:m}){let f=Ar(),C=Lr(),x=Ir(!1),k=()=>{Rr.user.gateway.logout().then(()=>{Ur.clearStoreToken(),m(),f("/login")})},P=It(()=>{i||(x.current=!0,f("/messages"))},[f,i]),E=It(()=>{if(x.current){x.current=!1,f(-1);return}f("/todo",{replace:!0})},[f]);return Er(()=>{i||(x.current=!1)},[i]),i?we(Rt,{onBack:E,onUpdateUnreadCount:y}):_r("div",{className:"max-h-screen bg-gray-50",children:[we(St,{navItems:t,activeTab:s,activeNavItemOverride:n,onTabChange:a,onProfileClick:()=>f("/profile"),onMessageCenterClick:P,onLogout:k,pendingApprovalCount:o,unreadEmailCount:c,unreadMessageCount:d,setUnreadMessageCount:y,themeMode:b,onThemeToggle:g}),we(Mt,{isOnline:C}),we("main",{className:s=="email"||s=="notes"?`mx-auto ${C?"pt-[65px]":"pt-[105px]"}`:`max-w-7xl mx-auto pb-0 sm:px-4 lg:px-6 ${C?"pt-[65px]":"pt-[105px]"}`,children:e})]})}var Ut=_(()=>{"use strict";kt();Tt();Et()});var Ot={};Pe(Ot,{MainPage:()=>Jr,parseDisplayModules:()=>Ft});import{API as Br}from"@spacecorexdev/core/api";import{Suspense as Fr,useCallback as pe,useEffect as ie,useMemo as Ce,useRef as Or,useState as K}from"react";import{useNavigate as Dr,useParams as Hr,useSearchParams as jr}from"react-router-dom";import{ResponseCode as Ne}from"@spacecorexdev/core/api";import{CacheUserInfo as Lt}from"@spacecorexdev/core/utils";import{ensurePromiseAllSettled as $r,ensureWebStreamsPolyfill as zr}from"@spacecorexdev/core/utils";import{Fragment as Xr,jsx as ue,jsxs as Bt}from"react/jsx-runtime";function qr({moduleKey:e,onReady:t}){return ie(()=>{t(e)},[e,t]),null}function Jr({themeMode:e,onThemeToggle:t,mainNavModuleKeys:s,moduleByKey:n,moduleByRoute:i,onWebSocketManagerClose:a,useGlobalSockets:y}){let o=Dr(),c=Hr(),[d]=jr(),[b,g]=K(null),[m,f]=K(!1),[C,x]=K(0),[k,P]=K(0),[E,N]=K([]),[r,l]=K(!0),[p,v]=K(0),[O,$]=K(null),[j,M]=K({}),A=c.tab||"todo",B=A==="messages",D=Ce(()=>m&&b?Ft(b.displayModules||null,s):[],[b,m,s]),Z=Ce(()=>new Set(D),[D]),ee=D[0]||"todo",te=i.get(A),Y=!!(m&&te&&s.includes(te.key)&&!Z.has(te.key)),ze=Y?n.get(ee):te||n.get(ee)||n.get("todo"),We=ze?.component,ae=ze?.key||ee,ra=d.get("id"),na=d.get("fileid"),sa=d.get("tab");ie(()=>{let u=!0;return Lt.getUserInfo({forceRefresh:!0}).then(R=>{u&&g(R)}).catch(()=>{u&&g(Lt.currentLocalUser())}).finally(()=>{u&&f(!0)}),()=>{u=!1}},[]),ie(()=>{ct.getPendingApprovalsCount().then(u=>{u?.code===Ne.SUCCESS&&x(u.data||0)}).catch(()=>{})},[]);let Ge=pe(u=>{let R=n.get(u)?.routes[0];R&&(u!==ae&&$(u),o(`/${R}`))},[ae,o]),oa=pe(u=>{$(R=>R===u?null:R)},[]);ie(()=>{if(!m||!Y)return;let u=n.get(ee)?.routes[0]||"todo";o(`/${u}`,{replace:!0})},[ee,m,o,Y]);let ia=u=>{x(u)},la=async()=>{try{let u=await Br.user.message.countUnread();u?.code===Ne.SUCCESS&&v(u.data?.unread||0)}catch(u){console.error("\u83B7\u53D6\u672A\u8BFB\u6D88\u606F\u6570\u91CF\u5931\u8D25:",u)}};ie(()=>{la()},[]),ie(()=>{let u=R=>{let ce=R.detail;v(ce?.unread||0)};return window.addEventListener(Le,u),()=>window.removeEventListener(Le,u)},[]);let be=Or({}),Ve=pe((u,R)=>{if(!R){P(Math.max(u,0));return}let ce=Math.max(u,0),re={...be.current,[R]:ce};be.current=re,M(re),P(Object.values(re).reduce((z,W)=>z+W,0))},[]),ca=pe(u=>{N(u)},[]),Ke=pe(async()=>{$r(),zr();try{l(!0);let u=await mt.listAccounts();if(u?.code!==Ne.SUCCESS)return;let R=_t(u.data);if(N(R),!R.length){be.current={},M({}),P(0),l(!1);return}let re=(await Promise.allSettled(R.map(async z=>{let W=await pt.getFolders({accountId:z.id}),Te=W?.code===Ne.SUCCESS?_t(W.data):[];return[z.id,Yr(Te)]}))).reduce((z,W)=>{if(W.status==="fulfilled"){let[Te,ma]=W.value;z[Te]=ma}return z},{});be.current=re,M(re),P(Object.values(re).reduce((z,W)=>z+W,0))}catch(u){console.error("\u83B7\u53D6\u672A\u8BFB\u90AE\u4EF6\u6570\u91CF\u5931\u8D25:",u)}finally{l(!1)}},[]);ie(()=>{Ke()},[Ke]),y({enabled:m&&!!b,visibleModules:Z,onEmailUnreadCount:Ve});let Me=Ce(()=>s.filter(u=>Z.has(u)&&n.get(u)?.topNav).map(u=>n.get(u)).filter(u=>!!u).map(({key:u,label:R,icon:ce})=>({key:u,label:R,icon:ce})),[Z]),da=Ce(()=>{if(Me.some(R=>R.key===ae))return;let u=n.get(ae);return u?{key:u.key,label:u.label,icon:u.icon}:void 0},[Me,ae]),ua={projectId:ra,fileId:na,tab:sa,onlyView:!1,onBack:()=>o(-1),onNavigate:Ge,onPendingCountChange:ia,onEmailUnreadCountChange:Ve,emailAccounts:E,emailAccountsLoading:r,emailUnreadCountByAccount:j,onEmailAccountsChange:ca};return m?ue(At,{navItems:Me,activeTab:ae,activeNavItemOverride:da,showMessageCenter:B,onTabChange:Ge,pendingApprovalCount:C,unreadEmailCount:k,unreadMessageCount:p,setUnreadMessageCount:v,themeMode:e,onThemeToggle:t,onWebSocketManagerClose:a,children:Bt("div",{className:"relative min-h-[320px]",children:[O&&ue(Gr,{}),ue(Fr,{fallback:ue(Wr,{}),children:We&&Bt(Xr,{children:[ue(We,{...ua}),ue(qr,{moduleKey:ae,onReady:oa})]})})]})}):X()}var Wr,Gr,_t,Vr,Kr,Oe,Yr,Ft,Dt=_(()=>{"use strict";dt();ft();Ut();Ht();_e();Wr=()=>X(),Gr=()=>X(),_t=e=>{if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e,s=t.list||t.records||t.items||t.rows||t.data;return Array.isArray(s)?s:[]}return[]},Vr=e=>{let t=`${e.path||""} ${e.name||""} ${e.specialUse||""}`.toLowerCase();return e.specialUse?.toLowerCase()==="\\inbox"||/inbox|收件/.test(t)},Kr=e=>{let t=`${e.path||""} ${e.name||""} ${e.specialUse||""}`.toLowerCase();return e.specialUse?.toLowerCase()==="unread"||/unread|未读/.test(t)},Oe=(e,t=!1)=>{let s=t?e.messages??e.unseen:e.unseen??e.messages;return typeof s=="number"&&Number.isFinite(s)?Math.max(s,0):0},Yr=e=>{let t=e.find(Kr);if(t&&(typeof t.messages=="number"||typeof t.unseen=="number"))return Oe(t,!0);let s=e.find(Vr);return s?Oe(s):e.reduce((n,i)=>n+Oe(i),0)};Ft=(e,t)=>{if(!e)return["disk"];try{let s=JSON.parse(e);return Array.isArray(s)?s.filter(i=>t.includes(i)):["disk"]}catch{return["disk"]}}});var jt={};Pe(jt,{FilePreview:()=>tn});import{useEffect as Qr,useState as fe}from"react";import{useSearchParams as Zr}from"react-router-dom";import{UIFilePreview as en}from"@spacecorexdev/filemanager";import{jsx as an}from"react/jsx-runtime";var tn,$t=_(()=>{"use strict";tn=()=>{let[e,t]=Zr(),[s,n]=fe(null),[i,a]=fe(!1),[y,o]=fe(void 0),[c,d]=fe(null),[b,g]=fe(void 0),m=e.get("path"),f=e.get("name"),C=e.get("fileid"),x=e.get("token");return Qr(()=>{m&&(d(decodeURIComponent(f||"")),n(decodeURIComponent(m)),a(!0),o(C||""),g(x||void 0))},[m,f,C,x]),an(en,{fileUrl:s,fileId:y,accessToken:b,visible:i,hiddenClose:!0,editable:!1,isCreate:!1,fileName:c||void 0,uploadPercent:1,uploadSuccess:!0,onClose:()=>{d(null),i&&(a(!1),t(k=>{let P=new URLSearchParams(k);return P.delete("fileid"),P},{replace:!0}))},onUploadBlob:void 0,onUploadMarkdown:void 0})}});var Yt={};Pe(Yt,{FolderSharePreview:()=>yn});import{API as rn}from"@spacecorexdev/core/api";import{useCallback as nn,useEffect as zt,useMemo as Wt,useState as ge}from"react";import{Alert as sn,Card as on,Empty as ln,Spin as cn,Typography as Gt,message as Vt}from"antd";import{FolderOpenOutlined as dn}from"@ant-design/icons";import{useSearchParams as un}from"react-router-dom";import{ResponseCode as mn}from"@spacecorexdev/core/api";import{buildFileTree as pn,sortFiles as fn}from"@spacecorexdev/filemanager";import{UIFilePreview as gn,uiFilePreview as hn}from"@spacecorexdev/filemanager";import{formatDatetime as vn,formatDisksize as bn}from"@spacecorexdev/core/utils";import{jsx as F,jsxs as Q}from"react/jsx-runtime";var xn,Kt,yn,qt=_(()=>{"use strict";xn=e=>{let t=e.get("path");return t?decodeURIComponent(t):""},Kt=(e,t,s=0)=>{let n=[];return e.forEach(i=>{n.push({file:i,level:s}),i.fileType==="folder"&&t.has(i.id)&&i.children?.length&&n.push(...Kt(i.children,t,s+1))}),n},yn=()=>{let[e]=un(),t=e.get("token")||"",s=decodeURIComponent(e.get("name")||"\u6587\u4EF6\u5939\u5206\u4EAB"),n=e.get("folderId")||"",i=xn(e),a=i.replace(/^\/+|\/+$/g,"")||s,[y,o]=ge(!1),[c,d]=ge([]),[b,g]=ge(new Set),[m,f]=ge(null),[C,x]=ge(!1);zt(()=>{let r=document.title;return document.title=a,()=>{document.title=r}},[a]);let k=nn(async()=>{if(t){o(!0);try{let r=await rn.project.file.listFilesByTempAccessToken({tempToken:t});if(r.code!==mn.SUCCESS){Vt.error(r.message||"\u5206\u4EAB\u94FE\u63A5\u4E0D\u53EF\u7528\u6216\u5DF2\u8FC7\u671F"),d([]);return}let l=(r.data||[]).filter(v=>n&&v.id===n?!1:i?v.filePath.startsWith(i):!0),p=fn(l);d(p),g(new Set)}catch(r){console.error("\u52A0\u8F7D\u5206\u4EAB\u6587\u4EF6\u5217\u8868\u5931\u8D25:",r),Vt.error("\u52A0\u8F7D\u5206\u4EAB\u6587\u4EF6\u5217\u8868\u5931\u8D25"),d([])}finally{o(!1)}}},[n,i,t]);zt(()=>{k()},[k]);let P=Wt(()=>pn(c),[c]),E=Wt(()=>Kt(P,b),[b,P]),N=r=>{if(r.fileType==="folder"){g(l=>{let p=new Set(l);return p.has(r.id)?p.delete(r.id):p.add(r.id),p});return}f(r),x(!0)};return Q("div",{className:"min-h-screen bg-gray-50 px-3 py-4 sm:px-6 sm:py-8",children:[Q(on,{className:"mx-auto max-w-5xl",styles:{body:{padding:0}},children:[Q("div",{className:"border-b border-gray-100 px-4 py-4 sm:px-6",children:[Q(Gt.Title,{level:4,className:"!mb-1 flex items-center gap-2",children:[F(dn,{}),s]}),F(Gt.Text,{type:"secondary",children:"\u53EF\u67E5\u770B\u6B64\u6587\u4EF6\u5939\u4E0B\u7684\u6587\u4EF6\u3002"})]}),t?y?Q("div",{className:"flex min-h-[260px] flex-col items-center justify-center",children:[F(cn,{}),F("span",{className:"mt-4 text-gray-500",children:"\u6B63\u5728\u52A0\u8F7D\u5206\u4EAB\u6587\u4EF6..."})]}):E.length===0?F("div",{className:"py-16",children:F(ln,{description:"\u6B64\u6587\u4EF6\u5939\u6682\u65E0\u53EF\u8BBF\u95EE\u6587\u4EF6\uFF0C\u6216\u5206\u4EAB\u94FE\u63A5\u5DF2\u8FC7\u671F"})}):F("div",{className:"divide-y divide-gray-100",children:E.map(({file:r,level:l})=>Q("div",{className:"flex cursor-pointer items-center gap-3 px-4 py-3 transition-colors hover:bg-blue-50 sm:px-6",style:{paddingLeft:16+l*24},onClick:()=>N(r),children:[F("div",{className:"text-xl",children:hn.getFileIcon({fileName:r.fileName,fileType:r.fileType,isExpanded:b.has(r.id),isSecure:r.isSecure})}),Q("div",{className:"min-w-0 flex-1",children:[F("div",{className:"truncate text-sm font-medium text-gray-900",children:r.fileName}),Q("div",{className:"mt-1 flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-500",children:[r.fileType!=="folder"&&F("span",{children:bn(r.fileSize)}),F("span",{children:vn(r.updateTime)})]})]})]},r.id))}):F("div",{className:"p-8",children:F(sn,{type:"error",message:"\u5206\u4EAB\u94FE\u63A5\u7F3A\u5C11\u8BBF\u95EE\u4EE4\u724C",showIcon:!0})})]}),F(gn,{fileUrl:m?.fileResourcePath||null,fileId:m?.id,accessToken:t,visible:C,hiddenClose:!1,editable:!1,isCreate:!1,fileName:m?.fileName,uploadPercent:1,uploadSuccess:!0,onClose:()=>{x(!1),f(null)},onUploadBlob:void 0,onUploadMarkdown:void 0})]})}});import{lazy as $e,Suspense as Se,useEffect as he,useMemo as wn,useState as Cn}from"react";import{BrowserRouter as Nn,Routes as Sn,Route as le,Navigate as kn,useNavigate as Mn,useLocation as Tn}from"react-router-dom";import{UIToastSingleProvider as Pn}from"@spacecorexdev/core/ui";import{buildEmailComposePathFromMailto as Rn}from"@spacecorexdev/core/utils/mailto";import{MacCommandOutlined as Zt}from"@ant-design/icons";import{ConfigProvider as En,theme as Jt}from"antd";import In from"antd/locale/zh_CN";import An from"dayjs";import"dayjs/locale/zh-cn";import{Fragment as zn,jsx as w,jsxs as ve}from"react/jsx-runtime";function Dn({children:e}){let t=Tn(),s=On.test(t.pathname);return he(()=>{if(!s)return;let n=t.pathname+t.search+t.hash;if(new URLSearchParams(t.search).has(Qt)){window.location.replace(import.meta.env.BASE_URL);return}let i=t.search?"&":"?";window.location.replace(`${n}${i}${Qt}=1`)},[s,t.pathname,t.search,t.hash]),s?w("div",{className:"flex h-screen items-center justify-center text-sm text-gray-500",children:ve("span",{children:[w(Zt,{style:{marginRight:3}}),"\u6B63\u5728\u6253\u5F00\u9875\u9762..."]})}):w(zn,{children:e})}function Hn(){let e=Mn();return he(()=>{let t=s=>{if(s.defaultPrevented||s.button!==0)return;let n=s.target instanceof Element?s.target.closest('a[href^="mailto:"]'):null;if(!n)return;let i=Rn(n.getAttribute("href")||"");i&&(s.preventDefault(),e(i))};return document.addEventListener("click",t),()=>document.removeEventListener("click",t)},[e]),null}function $n({mainNavModuleKeys:e,moduleByKey:t,moduleByRoute:s,onWebSocketManagerClose:n,useGlobalSockets:i}){let[a,y]=Cn(Fn);he(()=>{let d=document.documentElement;d.classList.toggle("dark",a==="dark"),d.dataset.theme=a,d.style.colorScheme=a,window.localStorage.setItem(_n,a)},[a]),he(()=>{let d=null,b=!1,g=()=>{if(b)return;let m=jn();d=setTimeout(()=>{if(b)return;je(null);let f=He();y(f),g()},m)};return g(),()=>{b=!0,d!==null&&(clearTimeout(d),d=null)}},[]);let o=wn(()=>({algorithm:a==="dark"?Jt.darkAlgorithm:Jt.defaultAlgorithm,token:{colorPrimary:a==="dark"?"#58a6ff":"#0c8ee9",borderRadius:8,colorBgBase:a==="dark"?"#0d1117":"#ffffff",colorBgContainer:a==="dark"?"#161b22":"#ffffff",colorBgElevated:a==="dark"?"#161b22":"#ffffff",colorBorder:a==="dark"?"#1f3a5f":"#e5e7eb",colorSplit:a==="dark"?"#1a3150":"#f0f0f0",colorTextBase:a==="dark"?"#f0f6fc":"#1f2937",colorTextSecondary:a==="dark"?"#b1bac4":"#6b7280"},components:{Button:{colorPrimary:a==="dark"?"#58a6ff":"#0c8ee9",colorPrimaryHover:a==="dark"?"#79c0ff":"#0071c7",colorPrimaryActive:a==="dark"?"#388bfd":"#0059a1",defaultBg:a==="dark"?"#21262d":"#ffffff",defaultBorderColor:a==="dark"?"#1f3a5f":"#d1d5db",defaultColor:a==="dark"?"#f0f6fc":"#374151",defaultHoverBg:a==="dark"?"#30363d":"#f9fafb",defaultHoverBorderColor:a==="dark"?"#2b5f96":"#0c8ee9",defaultHoverColor:a==="dark"?"#f0f6fc":"#0c8ee9"},Layout:{bodyBg:a==="dark"?"#0d1117":"#f9fafb"},Table:{rowHoverBg:a==="dark"?"#2d4363":"#f0f7ff"},Notification:{colorBgElevated:a==="dark"?"#161b22":"#ffffff",colorText:a==="dark"?"#f0f6fc":"#1f2937",colorTextHeading:a==="dark"?"#f0f6fc":"#1f2937",colorIcon:a==="dark"?"#b1bac4":"#6b7280",colorIconHover:a==="dark"?"#f0f6fc":"#1f2937"},Message:{contentBg:a==="dark"?"#161b22":"#ffffff",colorText:a==="dark"?"#f0f6fc":"#1f2937"}}}),[a]),c=()=>{y(d=>{let b=d==="dark"?"light":"dark";return je({mode:b,period:ke(),dateKey:aa()}),b})};return he(()=>{let d=()=>{c()};return window.addEventListener("vendorsys:toggle-theme",d),()=>window.removeEventListener("vendorsys:toggle-theme",d)},[]),w(En,{theme:o,locale:In,children:w(Nn,{children:ve(Pn,{children:[w(Hn,{}),w(ot,{}),w(Dn,{children:ve(Sn,{children:[w(le,{path:"/filepreview",element:w(Se,{fallback:w(X,{}),children:w(Un,{})})}),w(le,{path:"/fileshare",element:w(Se,{fallback:w(X,{}),children:w(Ln,{})})}),w(le,{path:"/login",element:w(at,{themeMode:a})}),ve(le,{element:w(qe,{}),children:[w(le,{path:"/",element:w(Se,{fallback:w(X,{}),children:w(Xt,{themeMode:a,onThemeToggle:c,mainNavModuleKeys:e,moduleByKey:t,moduleByRoute:s,onWebSocketManagerClose:n,useGlobalSockets:i})})}),w(le,{path:"/:tab",element:w(Se,{fallback:w(X,{}),children:w(Xt,{themeMode:a,onThemeToggle:c,mainNavModuleKeys:e,moduleByKey:t,moduleByRoute:s,onWebSocketManagerClose:n,useGlobalSockets:i})})}),w(le,{path:"*",element:w(kn,{to:"/login",replace:!0})})]})]})})]})})})}var Xt,Un,Ln,_n,De,ea,ta,ke,aa,He,Bn,je,Fn,X,On,Qt,jn,Ht=_(()=>{Je();rt();it();_e();An.locale("zh-cn");Xt=$e(()=>Promise.resolve().then(()=>(Dt(),Ot)).then(e=>({default:e.MainPage}))),Un=$e(()=>Promise.resolve().then(()=>($t(),jt)).then(e=>({default:e.FilePreview}))),Ln=$e(()=>Promise.resolve().then(()=>(qt(),Yt)).then(e=>({default:e.FolderSharePreview}))),_n="vendorsys-theme-mode",De="vendorsys-theme-override",ea=19,ta=7,ke=()=>{let e=new Date().getHours();return e>=ea||e<ta?"night":"day"},aa=()=>{let e=new Date;return`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`},He=()=>ke()==="night"?"dark":"light",Bn=()=>{if(typeof window>"u")return null;let e=window.localStorage.getItem(De);if(!e)return null;try{return JSON.parse(e)}catch{return null}},je=e=>{typeof window>"u"||(e===null?window.localStorage.removeItem(De):window.localStorage.setItem(De,JSON.stringify(e)))},Fn=()=>{if(typeof window>"u")return He();let e=He(),t=ke(),s=aa(),n=Bn();return n&&n.period===t&&n.dateKey===s?n.mode:(n&&je(null),e)},X=()=>w("div",{className:"flex h-screen items-center justify-center text-sm text-gray-500",children:ve("span",{children:[w(Zt,{style:{marginRight:3}}),"\u6A21\u5757\u52A0\u8F7D\u4E2D..."]})}),On=/\.(?:html|htm)$/i,Qt="_spa_static";jn=()=>{let e=new Date,t=e.getHours(),s=e.getMinutes(),n=e.getSeconds(),i=e.getMilliseconds(),a=t*3600*1e3+s*60*1e3+n*1e3+i,y=ta*3600*1e3,o=ea*3600*1e3,c=24*3600*1e3,d=ke(),b;return d==="day"?b=a<o?o:o+c:b=a<y?y:y+c,b-a}});Ht();export{X as RouteLoading,Le as USER_MESSAGE_UNREAD_CHANGE_EVENT,$n as default};
@@ -0,0 +1 @@
1
+ var n="vendorsys:user-message-unread-change";export{n as USER_MESSAGE_UNREAD_CHANGE_EVENT};
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
2
  "name": "@spacecorexdev/shell",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "description": "Vendorsys 壳层组件包",
7
+ "sideEffects": [
8
+ "**/*.css",
9
+ "**/*.scss"
10
+ ],
11
+ "scripts": {
12
+ "build": "tsup && tsc -p tsconfig.decl.json",
13
+ "build:code": "tsup",
14
+ "build:types": "tsc -p tsconfig.decl.json",
15
+ "build:watch": "tsup --watch",
16
+ "dev": "tsup --watch"
17
+ },
18
+ "main": "./dist/index.js",
19
+ "module": "./dist/index.js",
20
+ "types": "./types/index.d.ts",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./types/index.d.ts",
24
+ "import": "./dist/index.js"
25
+ },
26
+ "./websocket/manager": {
27
+ "types": "./types/websocket/manager.d.ts",
28
+ "import": "./dist/websocket/manager.js"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "types",
34
+ "package.json"
35
+ ],
36
+ "dependencies": {
37
+ "@spacecorexdev/core": "^0.2.0",
38
+ "@spacecorexdev/filemanager": "^0.2.0"
39
+ },
40
+ "devDependencies": {
41
+ "tsup": "^8.3.5",
42
+ "typescript": "^5.5.3"
43
+ },
44
+ "maintainers": [
45
+ {
46
+ "name": "brainpoint",
47
+ "email": "bpoint.lee@live.com"
48
+ }
49
+ ]
50
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) 2025 SPACECORE Co.,Ltd. All Rights Reserved.
3
+ * Author: brian.li
4
+ * Desc:
5
+ */
6
+ import { ResponseCode } from '@spacecorexdev/core/api';
7
+ export declare const approval: {
8
+ getPendingApprovalsCount: () => Promise<{
9
+ code: ResponseCode;
10
+ message?: string;
11
+ data?: number;
12
+ }>;
13
+ };
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Copyright (c) 2025 SPACECORE Co.,Ltd. All Rights Reserved.
3
+ * Author: brian.li
4
+ * Desc:
5
+ */
6
+ import { ResponseCode } from '@spacecorexdev/core/api';
7
+ /**
8
+ * 邮箱服务商枚举
9
+ *
10
+ * - GOOGLE: Google Gmail
11
+ * - MICROSOFT: Microsoft Outlook/Office 365
12
+ * - IMAP: 通用 IMAP 协议邮箱(如网易邮箱、QQ邮箱等)
13
+ */
14
+ export declare enum EmailProvider {
15
+ GOOGLE = "google",
16
+ MICROSOFT = "microsoft",
17
+ IMAP = "imap"
18
+ }
19
+ export declare const emailaccount: {
20
+ listAccounts: () => Promise<{
21
+ code: ResponseCode;
22
+ message?: string;
23
+ data?: {
24
+ id: string;
25
+ user_id: string;
26
+ email: string;
27
+ provider: EmailProvider;
28
+ sync_enabled: boolean;
29
+ sync_interval: number;
30
+ last_sync_time: Date;
31
+ token_expire_time: Date;
32
+ createTime: Date;
33
+ updateTime: Date;
34
+ }[];
35
+ }>;
36
+ };
37
+ export declare const emailmessage: {
38
+ getFolders: (params: {
39
+ accountId: string;
40
+ }) => Promise<{
41
+ code: ResponseCode;
42
+ message?: string;
43
+ data?: {
44
+ path: string;
45
+ name: string;
46
+ delimiter: string;
47
+ parentPath: string;
48
+ flags: string[];
49
+ specialUse: string;
50
+ listed: boolean;
51
+ subscribed: boolean;
52
+ messages: number;
53
+ unseen: number;
54
+ icon: string;
55
+ iconColor: string;
56
+ }[];
57
+ }>;
58
+ };
@@ -0,0 +1,21 @@
1
+ import 'dayjs/locale/zh-cn';
2
+ import { AppModule } from './types';
3
+ import { WebSocketUseGlobalSocketsOptions } from './types';
4
+ export * from './types';
5
+ export declare const RouteLoading: () => import("react").JSX.Element;
6
+ interface AppProps {
7
+ /** 主导航模块键列表 */
8
+ mainNavModuleKeys: string[];
9
+ /** 模块键到模块的映射 */
10
+ moduleByKey: Map<string, AppModule>;
11
+ /** 路由到模块的映射 */
12
+ moduleByRoute: Map<string, AppModule>;
13
+ /** WebSocket 管理器关闭 */
14
+ onWebSocketManagerClose: () => void;
15
+ /**
16
+ * 全局 WebSocket 订阅聚合入口,由布局层挂载一次。
17
+ * 保证各业务模块即使页面未懒加载,其后台通知(新邮件/待办到期/站内消息)也能实时生效。
18
+ */
19
+ useGlobalSockets: (props: WebSocketUseGlobalSocketsOptions) => void;
20
+ }
21
+ export default function App({ mainNavModuleKeys, moduleByKey, moduleByRoute, onWebSocketManagerClose, useGlobalSockets }: AppProps): import("react").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare const Login: ({ themeMode }: {
2
+ themeMode: string;
3
+ }) => false | import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import type { ThemeMode } from '@spacecorexdev/core/types';
2
+ import { AppModule } from '@/types';
3
+ import { WebSocketUseGlobalSocketsOptions } from '@/types';
4
+ /**
5
+ * 解析显示模块列表
6
+ */
7
+ export declare const parseDisplayModules: (displayModules: string | null, mainNavModuleKeys: string[]) => string[];
8
+ interface MainPageProps {
9
+ themeMode: ThemeMode;
10
+ onThemeToggle: () => void;
11
+ /** 主导航模块键列表 */
12
+ mainNavModuleKeys: string[];
13
+ /** 模块键到模块的映射 */
14
+ moduleByKey: Map<string, AppModule>;
15
+ /** 路由到模块的映射 */
16
+ moduleByRoute: Map<string, AppModule>;
17
+ /** WebSocket 管理器关闭 */
18
+ onWebSocketManagerClose: () => void;
19
+ /**
20
+ * 全局 WebSocket 订阅聚合入口,由布局层挂载一次。
21
+ * 保证各业务模块即使页面未懒加载,其后台通知(新邮件/待办到期/站内消息)也能实时生效。
22
+ */
23
+ useGlobalSockets: (props: WebSocketUseGlobalSocketsOptions) => void;
24
+ }
25
+ export declare function MainPage({ themeMode, onThemeToggle, mainNavModuleKeys, moduleByKey, moduleByRoute, onWebSocketManagerClose, useGlobalSockets }: MainPageProps): import("react").JSX.Element;
26
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface MessageCenterPageProps {
3
+ onBack: () => void;
4
+ onUpdateUnreadCount?: React.Dispatch<React.SetStateAction<number>>;
5
+ }
6
+ export declare const MessageCenterPage: React.FC<MessageCenterPageProps>;
7
+ export {};
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { NavItem } from './components/TopNav';
3
+ import type { ThemeMode } from '@spacecorexdev/core/types';
4
+ interface PageContainerProps {
5
+ children: React.ReactNode;
6
+ activeTab: string;
7
+ /** 消息中心是否打开,完全由 /messages 路由推导,保证浏览器后退可关闭 */
8
+ showMessageCenter?: boolean;
9
+ onTabChange: (key: string) => void;
10
+ pendingApprovalCount?: number;
11
+ unreadEmailCount?: number;
12
+ unreadMessageCount?: number;
13
+ setUnreadMessageCount?: React.Dispatch<React.SetStateAction<number>>;
14
+ navItems: NavItem[];
15
+ /** 当前路由不在主导航中时,用于移动端展示正确的模块名 */
16
+ activeNavItemOverride?: NavItem;
17
+ themeMode: ThemeMode;
18
+ onThemeToggle: () => void;
19
+ /** WebSocket 管理器关闭 */
20
+ onWebSocketManagerClose: () => void;
21
+ }
22
+ export declare function PageContainer({ children, navItems, activeTab, activeNavItemOverride, showMessageCenter, onTabChange, setUnreadMessageCount, pendingApprovalCount, unreadEmailCount, unreadMessageCount, themeMode, onThemeToggle, onWebSocketManagerClose }: PageContainerProps): React.JSX.Element;
23
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const ProtectedRoute: () => import("react").JSX.Element;
2
+ export default ProtectedRoute;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const GlobalContextMenu: React.FC;
@@ -0,0 +1,5 @@
1
+ interface OfflineBannerProps {
2
+ isOnline?: boolean;
3
+ }
4
+ export declare function OfflineBanner({ isOnline: isOnlineProp }: OfflineBannerProps): import("react").JSX.Element | null;
5
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import './TimeDisplay.css';
3
+ interface TimeDisplayProps {
4
+ className?: string;
5
+ }
6
+ export declare const TimeDisplay: React.FC<TimeDisplayProps>;
7
+ export {};
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import type { ThemeMode } from '@spacecorexdev/core/types';
3
+ export interface NavItem {
4
+ key: string;
5
+ label: string;
6
+ icon: React.ReactNode;
7
+ }
8
+ interface TopNavProps {
9
+ activeTab: string;
10
+ onTabChange: (key: string) => void;
11
+ onProfileClick: () => void;
12
+ onLogout: () => void;
13
+ onMessageCenterClick: () => void;
14
+ pendingApprovalCount?: number;
15
+ unreadEmailCount?: number;
16
+ unreadMessageCount?: number;
17
+ setUnreadMessageCount?: React.Dispatch<React.SetStateAction<number>>;
18
+ navItems: NavItem[];
19
+ /** 当前路由不在主导航中(如通讯录、个人中心)时,用于移动端展示正确的模块名 */
20
+ activeNavItemOverride?: NavItem;
21
+ themeMode: ThemeMode;
22
+ onThemeToggle: () => void;
23
+ }
24
+ export declare function TopNav({ activeTab, navItems, activeNavItemOverride, onTabChange, onProfileClick, onLogout, onMessageCenterClick, pendingApprovalCount, unreadEmailCount, unreadMessageCount, setUnreadMessageCount, themeMode, onThemeToggle }: TopNavProps): React.JSX.Element;
25
+ export {};
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ /**
3
+ * 解析显示模块列表
4
+ */
5
+ export declare const parseDisplayModules: (displayModules: string | null) => string[];
6
+ interface UserMenuProps {
7
+ onProfileClick: () => void;
8
+ onMessageCenterClick: () => void;
9
+ onLogout: () => void;
10
+ unreadMessageCount: number;
11
+ setUnreadMessageCount?: React.Dispatch<React.SetStateAction<number>>;
12
+ }
13
+ export declare function UserMenu({ onProfileClick, onMessageCenterClick, onLogout, unreadMessageCount }: UserMenuProps): React.JSX.Element;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const FilePreview: React.FC;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const FolderSharePreview: React.FC;
@@ -0,0 +1,108 @@
1
+ import { ComponentType, LazyExoticComponent, ReactElement, ReactNode } from "react";
2
+ export * from './websocket';
3
+ /**
4
+ * 模块运行时属性
5
+ */
6
+ export interface ModuleRuntimeProps {
7
+ /**
8
+ * 项目ID
9
+ */
10
+ projectId?: string | null;
11
+ /**
12
+ * 文件ID
13
+ */
14
+ fileId?: string | null;
15
+ /**
16
+ * 成员ID
17
+ */
18
+ memberId?: string | null;
19
+ /**
20
+ * 选项卡
21
+ */
22
+ tab?: string | null;
23
+ /**
24
+ * 是否只读
25
+ */
26
+ onlyView?: boolean;
27
+ /**
28
+ * 返回上一页
29
+ */
30
+ onBack?: () => void;
31
+ /**
32
+ * 导航到指定路由
33
+ */
34
+ onNavigate?: (key: string) => void;
35
+ /**
36
+ * 待办事项数量变化
37
+ */
38
+ onPendingCountChange?: (count: number) => void;
39
+ /**
40
+ * 未读邮件数量变化
41
+ */
42
+ onEmailUnreadCountChange?: (count: number, accountId?: string) => void;
43
+ /**
44
+ * 邮件账号变化
45
+ */
46
+ onEmailAccountsChange?: (accounts: Array<{
47
+ id: string;
48
+ email: string;
49
+ provider: string;
50
+ }>) => void;
51
+ /**
52
+ * 邮件账号
53
+ */
54
+ emailAccounts?: Array<{
55
+ id: string;
56
+ email: string;
57
+ provider: string;
58
+ sync_enabled?: boolean;
59
+ sync_interval?: number;
60
+ last_sync_time?: string;
61
+ token_expire_time?: string;
62
+ imapHost?: string;
63
+ imapPort?: number;
64
+ imapSsl?: boolean;
65
+ smtpHost?: string;
66
+ smtpPort?: number;
67
+ smtpSsl?: boolean;
68
+ createTime?: string;
69
+ updateTime?: string;
70
+ }>;
71
+ }
72
+ /**
73
+ * 模块应用
74
+ */
75
+ export interface AppModule {
76
+ /**
77
+ * 模块键
78
+ */
79
+ key: string;
80
+ /**
81
+ * 模块标签
82
+ */
83
+ label: string;
84
+ /**
85
+ * 模块图标
86
+ */
87
+ icon: ReactElement | ReactNode;
88
+ /**
89
+ * 是否在顶部导航栏显示
90
+ */
91
+ topNav: boolean;
92
+ /**
93
+ * 模块组件
94
+ */
95
+ component: LazyExoticComponent<ComponentType<any>>;
96
+ /**
97
+ * 模块路由
98
+ */
99
+ routes: string[];
100
+ /**
101
+ * 模块权限
102
+ */
103
+ permissions: string[];
104
+ /**
105
+ * 是否不是主模块
106
+ */
107
+ isNotMainModule?: boolean;
108
+ }
@@ -0,0 +1,13 @@
1
+ /** 站内消息未读数变化事件,detail 为 { total: number; unread: number } */
2
+ export declare const USER_MESSAGE_UNREAD_CHANGE_EVENT = "vendorsys:user-message-unread-change";
3
+ /**
4
+ * 全局 WebSocket 订阅聚合入口,由布局层挂载一次。
5
+ */
6
+ export interface WebSocketUseGlobalSocketsOptions {
7
+ /** 总开关(模块配置就绪且已登录) */
8
+ enabled: boolean;
9
+ /** 当前用户可见模块集合;仅对可见模块注册对应通道 */
10
+ visibleModules: ReadonlySet<string>;
11
+ /** 邮件未读数变化回调,同步导航角标(count, accountId) */
12
+ onEmailUnreadCount?: (count: number, accountId?: string) => void;
13
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.