mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
12 lines
9.8 KiB
JavaScript
12 lines
9.8 KiB
JavaScript
import{g as W,a as Y,b as Z,r as J,C as I,d as Q,V as X,F as G,e as ee,P as te,c as ae,f as se,h as ne,i as re,j as ie}from"./index-BYb1wNQz.chunk.mjs";import{m as U,C as le,A,n as o,O as oe,u as p,P as D,Q as S,R as ue,S as de,J as ce,c as H,o as b,w,T as C,U as N,V as fe,b as me,i as he,p as M,q as pe,W as be,t as ve,X as v,j as ge,f as r,Y as z,Z as $,h as ye,$ as we,e as R,a0 as O,a1 as _e,l as xe}from"./NcSettingsSection-BfK7eHNT-Cvwtv3xC.chunk.mjs";import{r as F,b as Ae,i as T,c as Ce,d as Ve,n as Ie,e as $e,f as ke,h as Se,g as He,s as P,j as Ne,k as Te}from"./Plus-DJQMY9d_.chunk.mjs";import"./TrashCanOutline-DlLXCK_h.chunk.mjs";const Ee='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-history" viewBox="0 0 24 24"><path d="M13.5,8H12V13L16.28,15.54L17,14.33L13.5,12.25V8M13,3A9,9 0 0,0 4,12H1L4.96,16.03L9,12H6A7,7 0 0,1 13,5A7,7 0 0,1 20,12A7,7 0 0,1 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0 0,0 22,12A9,9 0 0,0 13,3" /></svg>';function E(e){const t=A(F),a=A(Ae),s=o(()=>{const u=p(e.to);return t.resolve(u)}),n=o(()=>{const{matched:u}=s.value,{length:d}=u,h=u[d-1],c=a.matched;if(!h||!c.length)return-1;const i=c.findIndex(T.bind(null,h));if(i>-1)return i;const f=B(u[d-2]);return d>1&&B(h)===f&&c[c.length-1].path!==f?c.findIndex(T.bind(null,u[d-2])):i}),l=o(()=>n.value>-1&&Me(a.params,s.value.params)),m=o(()=>n.value>-1&&n.value===a.matched.length-1&&Ce(a.params,s.value.params));function g(u={}){if(De(u)){const d=t[p(e.replace)?"replace":"push"](p(e.to)).catch(Ie);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>d),d}return Promise.resolve()}return{route:s,href:o(()=>s.value.href),isActive:l,isExactActive:m,navigate:g}}function Be(e){return e.length===1?e[0]:e}const Le=U({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:E,setup(e,{slots:t}){const a=le(E(e)),{options:s}=A(F),n=o(()=>({[L(e.activeClass,s.linkActiveClass,"router-link-active")]:a.isActive,[L(e.exactActiveClass,s.linkExactActiveClass,"router-link-exact-active")]:a.isExactActive}));return()=>{const l=t.default&&Be(t.default(a));return e.custom?l:oe("a",{"aria-current":a.isExactActive?e.ariaCurrentValue:null,href:a.href,onClick:a.navigate,class:n.value},l)}}}),Ue=Le;function De(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Me(e,t){for(const a in t){const s=t[a],n=e[a];if(typeof s=="string"){if(s!==n)return!1}else if(!Ve(n)||n.length!==s.length||s.some((l,m)=>l!==n[m]))return!1}return!0}function B(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const L=(e,t,a)=>e??t??a,ze={};function Re(e,t){return b(),M("div",null,[C(e.$slots,"trigger")])}const Oe=D(ze,[["render",Re]]),Fe={class:"user-bubble__name"},Pe={key:0,class:"user-bubble__secondary"},Ke=U({__name:"NcUserBubble",props:S({avatarImage:{default:void 0},user:{default:void 0},displayName:{default:void 0},showUserStatus:{type:Boolean},url:{default:void 0},to:{default:void 0},primary:{type:Boolean},size:{default:20},margin:{default:2}},{open:{type:Boolean},openModifiers:{}}),emits:S(["click"],["update:open"]),setup(e,{emit:t}){const a=ue(e,"open"),s=e,n=t,l=o(()=>{if(!s.avatarImage)return!1;try{return!!new URL(s.avatarImage)}catch{return!1}}),m=o(()=>!!s.avatarImage),g=o(()=>({marginInlineStart:`${s.margin}px`})),u=o(()=>{if(!s.url||s.url.trim()==="")return!1;try{return!!new URL(s.url,s.url?.startsWith?.("/")?window.location.href:void 0)}catch{return de("[NcUserBubble] Invalid URL passed",{url:s.url}),!1}}),d=o(()=>u.value?s.url:void 0),h=o(()=>u.value?"a":s.to?Ue:"div"),c=o(()=>({height:`${s.size}px`,lineHeight:`${s.size}px`,borderRadius:`${s.size/2}px`}));return ce([()=>s.displayName,()=>s.user],()=>{!s.displayName&&s.user}),(i,f)=>(b(),H(N(i.$slots.default?p(ke):Oe),{shown:a.value,"onUpdate:shown":f[1]||(f[1]=y=>a.value=y),class:"user-bubble__wrapper",trigger:"hover focus"},{trigger:w(({attrs:y})=>[(b(),H(N(h.value),fe({class:["user-bubble__content",{"user-bubble__content--primary":i.primary}],style:c.value,to:i.to,href:d.value},y,{onClick:f[0]||(f[0]=q=>n("click",q))}),{default:w(()=>[me(p($e),{url:m.value&&l.value?i.avatarImage:void 0,"icon-class":m.value&&!l.value?i.avatarImage:void 0,user:i.user,"display-name":i.displayName,size:i.size-i.margin*2,style:be(g.value),"disable-tooltip":!0,"disable-menu":!0,"hide-status":!i.showUserStatus,class:"user-bubble__avatar"},null,8,["url","icon-class","user","display-name","size","style","hide-status"]),he("span",Fe,ve(i.displayName||i.user),1),i.$slots.name?(b(),M("span",Pe,[C(i.$slots,"name",{},void 0,!0)])):pe("",!0)]),_:2},1040,["class","style","to","href"]))]),default:w(()=>[C(i.$slots,"default",{},void 0,!0)]),_:3},40,["shown"]))}}),je=D(Ke,[["__scopeId","data-v-37bde6b7"]]),qe='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-trash-can-outline" viewBox="0 0 24 24"><path d="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" /></svg>',K=`/trashbin/${v()?.uid}/trash`,We=W(),Ye=`<?xml version="1.0"?>
|
|
<d:propfind ${Y()}>
|
|
<d:prop>
|
|
<nc:trashbin-deletion-time />
|
|
<nc:trashbin-original-location />
|
|
<nc:trashbin-title />
|
|
<nc:trashbin-deleted-by-id />
|
|
<nc:trashbin-deleted-by-display-name />
|
|
${Z()}
|
|
</d:prop>
|
|
</d:propfind>`;function Ze(e){const t=J(e,K);return t.attributes.previewUrl=ge("/apps/files_trashbin/preview?fileId={fileid}&x=32&y=32",{fileid:t.fileid}),t}async function Je(e="/"){const t=(await We.getDirectoryContents(`${K}${e}`,{details:!0,data:Ye,includeSelf:!0})).data.map(Ze),[a]=t.splice(t.findIndex(s=>s.path===e),1);return{folder:a,contents:t}}const Qe=new I({id:"files_trashbin--original-location",title:r("files_trashbin","Original location"),render(e){const t=_(e),a=document.createElement("span");return a.title=t,a.textContent=t,a},sort(e,t){const a=_(e),s=_(t);return a.localeCompare(s,[z(),$()],{numeric:!0,usage:"sort"})}}),Xe=new I({id:"files_trashbin--deleted-by",title:r("files_trashbin","Deleted by"),render(e){const{userId:t,displayName:a,label:s}=x(e);if(s){const l=document.createElement("span");return l.textContent=s,l}const n=document.createElement("div");return ye(je,{size:32,user:t??void 0,displayName:a??t}).mount(n),n},sort(e,t){const a=x(e),s=a.label??a.displayName??a.userId,n=x(t),l=n.label??n.displayName??n.userId;return s.localeCompare(l,[z(),$()],{numeric:!0,usage:"sort"})}}),Ge=new I({id:"files_trashbin--deleted",title:r("files_trashbin","Deleted"),render(e){const t=e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3,a=document.createElement("span");if(t){const s=Intl.DateTimeFormat([$()],{dateStyle:"long",timeStyle:"short"}),n=new Date(t*1e3);return a.title=s.format(n),a.textContent=Se(n,{ignoreSeconds:r("files","few seconds ago")}),a}return a.textContent=r("files_trashbin","A long time ago"),a},sort(e,t){const a=e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3;return(t.attributes?.["trashbin-deletion-time"]||(t?.mtime?.getTime()??0)/1e3)-a}});function _(e){const t=V(e.attributes?.["trashbin-original-location"]);if(!t)return r("files_trashbin","Unknown");const a=Q(t);return a===t?r("files_trashbin","All files"):a.replace(/^\//,"")}function x(e){const t=V(e.attributes?.["trashbin-deleted-by-id"]),a=V(e.attributes?.["trashbin-deleted-by-display-name"]);let s;const n=v()?.uid;return t===n&&(s=r("files_trashbin","You")),!t&&!a&&(s=r("files_trashbin","Unknown")),{userId:t,displayName:a,label:s}}function V(e){return e?String(e):null}const k="trashbin",et=new X({id:k,name:r("files_trashbin","Deleted files"),caption:r("files_trashbin","List of files that have been deleted."),emptyTitle:r("files_trashbin","No deleted files"),emptyCaption:r("files_trashbin","Files and folders you have deleted will show up here"),icon:qe,order:50,sticky:!0,defaultSortKey:"deleted",columns:[Qe,Xe,Ge],getContents:Je}),j=He().setApp("files_trashbin").detectUser().build(),tt=new G({id:"restore",displayName(){return r("files_trashbin","Restore")},iconSvgInline:()=>Ee,enabled(e,t){return t.id!==k?!1:e.length>0&&e.map(a=>a.permissions).every(a=>!!(a&te.READ))},async exec(e){try{const t=we(ee(`dav/trashbin/${v().uid}/restore/${e.basename}`));return await R.request({method:"MOVE",url:e.encodedSource,headers:{destination:t}}),O("files:node:deleted",e),!0}catch(t){return _e(t)&&t.response?.status===507&&P(r("files_trashbin","Not enough free space to restore the file/folder")),j.error("Failed to restore node",{error:t,node:e}),!1}},async execBatch(e,t,a){return Promise.all(e.map(s=>this.exec(s,t,a)))},order:1,inline:()=>!0});async function at(){try{return await R.delete(`${ae}/trashbin/${v().uid}/trash`),Ne(r("files_trashbin","All files have been permanently deleted")),!0}catch(e){return P(r("files_trashbin","Failed to empty deleted files")),j.error("Failed to empty deleted files",{error:e}),!1}}const st=new se({id:"empty-trash",displayName:()=>r("files_trashbin","Empty deleted files"),order:0,enabled(e,t,a){return e.id!==k||!xe("files_trashbin","config").allow_delete?!1:t.length>0&&a.path==="/"},async exec(e,t){return await new Promise(a=>{Te(r("files_trashbin","Confirm permanent deletion")).setSeverity("warning").setText(r("files_trashbin","Are you sure you want to permanently delete all files and folders in the trash? This cannot be undone.")).setButtons([{label:r("files_trashbin","Cancel"),variant:"secondary",callback:()=>a(!1)},{label:r("files_trashbin","Empty deleted files"),variant:"error",callback:()=>a(!0)}]).build().show().then(()=>{a(!1)})})===!0&&await at()&&t.forEach(a=>O("files:node:deleted",a)),null}}),nt=ne();nt.register(et),re(st),ie(tt);
|
|
//# sourceMappingURL=files_trashbin-init.mjs.map
|