Files
Nexus/web/app/assets/FileDirectoryTree-BCxg2xNQ.js
T
Your Name 51948469c2 build(frontend): track Vite output in Git for Gitea deploy
- Stop ignoring web/app/index.html and web/app/assets/
- Bundle index-DBKIQT7H.js from current vite build (~101MB assets)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-03 00:52:44 +08:00

1 line
3.6 KiB
JavaScript

import{Ar as e,Er as t,Gn as n,J as r,Kn as i,L as a,Lt as o,M as s,N as c,Or as l,P as u,Qn as d,T as f,Un as p,Wn as m,Y as h,Yn as g,Zn as _,br as v,dr as y,er as b,gr as x,j as S,kr as C,lr as w,mr as T,q as E,qn as D}from"./index--Of8dBda.js";import{t as O}from"./fileBrowse-DPJUbvU6.js";import{i as k,r as A,t as j}from"./remotePath-Dnz5p3-E.js";import{t as M}from"./VSpacer-BLmqwQhb.js";import{t as N}from"./_plugin-vue_export-helper-BDNMzG2s.js";var P={key:0,class:`text-caption text-medium-emphasis pa-3`},F=[`onClick`],I=[`onClick`,`onContextmenu`],L=N(b({__name:`FileDirectoryTree`,props:{serverId:{},currentPath:{}},emits:[`navigate`,`paste-target`],setup(b,{emit:N}){let L=b,R=N,z=v(!1),B=v(null),V=v(new Set([j])),H=v(new Map),U=n(()=>{let e=[],t=(n,r)=>{let i=H.value.get(n)??[];for(let n of i)e.push({...n,depth:r}),V.value.has(n.path)&&t(n.path,r+1)};return t(j,0),e});async function W(e){if(!L.serverId)return[];let{items:t}=O(await o.post(`/sync/browse`,{server_id:L.serverId,path:k(e)}));return t.filter(e=>e.type===`directory`).sort((e,t)=>e.name.localeCompare(t.name)).map(t=>({path:A(e,t.name),name:t.name,depth:0,hasChildren:!0,loaded:!1}))}async function G(e){if(L.serverId){B.value=e;try{let t=await W(e);H.value.set(e,t);let n=H.value;t.forEach(e=>{n.has(e.path)||n.set(e.path,[])})}finally{B.value=null}}}async function K(){if(L.serverId){z.value=!0,H.value=new Map,V.value=new Set([j]);try{await G(j),H.value.get(j)?.forEach(e=>{H.value.set(e.path,[])})}finally{z.value=!1}}}async function q(e){if(V.value.has(e.path)){V.value.delete(e.path);return}H.value.has(e.path)||await G(e.path),V.value.add(e.path)}function J(e){let t=k(e);if(t===`/www/wwwroot`)return;let n=t.split(`/`).filter(Boolean),r=``;for(let e of n)r=r?`${r}/${e}`:`/${e}`,V.value.add(r);V.value.add(j)}T(()=>L.serverId,e=>{e?K():(H.value=new Map,V.value=new Set)},{immediate:!0});async function Y(e){if(!L.serverId)return;let t=k(e);if(J(t),H.value.has(`/www/wwwroot`)||await G(j),t===`/www/wwwroot`)return;let n=(`/www/wwwroot`.endsWith(`/`),j),r=(t.startsWith(n)?t.slice(n.length):t).split(`/`).filter(Boolean),i=j;for(let e of r)H.value.has(i)||await G(i),i=A(i,e)}return T(()=>L.currentPath,e=>{e&&Y(e)}),(n,o)=>(w(),D(s,{border:``,rounded:`lg`,class:`file-dir-tree d-flex flex-column`},{default:x(()=>[d(u,{class:`text-subtitle-2 py-2 px-3 d-flex align-center`},{default:x(()=>[d(h,{size:`18`,class:`mr-1`},{default:x(()=>[...o[0]||=[_(`mdi-file-tree`,-1)]]),_:1}),o[1]||=_(` 目录 `,-1),d(M),d(a,{icon:`mdi-refresh`,size:`x-small`,variant:`text`,disabled:!b.serverId,onClick:K},null,8,[`disabled`])]),_:1}),d(S),d(c,{class:`file-dir-tree-body pa-0 flex-grow-1`},{default:x(()=>[b.serverId?z.value?(w(),D(E,{key:1,indeterminate:``})):(w(),D(f,{key:2,density:`compact`,nav:``,class:`py-0`},{default:x(()=>[(w(!0),g(m,null,y(U.value,n=>(w(),g(`div`,{key:n.path,class:`file-dir-tree-row d-flex align-center`,style:C({paddingLeft:`${8+n.depth*14}px`})},[i(`button`,{type:`button`,class:`file-dir-tree-toggle`,onClick:p(e=>q(n),[`stop`])},[B.value===n.path?(w(),D(r,{key:0,indeterminate:``,size:`14`,width:`2`})):(w(),D(h,{key:1,size:`16`},{default:x(()=>[_(e(V.value.has(n.path)?`mdi-chevron-down`:`mdi-chevron-right`),1)]),_:2},1024))],8,F),i(`button`,{type:`button`,class:l([`file-dir-tree-label text-body-2 text-truncate`,{"file-dir-tree-label--active":t(k)(b.currentPath)===n.path}]),onClick:e=>R(`navigate`,n.path),onContextmenu:p(e=>R(`paste-target`,n.path),[`prevent`])},[d(h,{size:`14`,class:`mr-1`},{default:x(()=>[...o[2]||=[_(`mdi-folder-outline`,-1)]]),_:1}),_(` `+e(n.name),1)],42,I)],4))),128))]),_:1})):(w(),g(`div`,P,`请先选择服务器`))]),_:1})]),_:1}))}}),[[`__scopeId`,`data-v-d17e7cb9`]]);export{L as default};