mirror of
https://github.com/nextcloud/server.git
synced 2026-04-24 23:59:27 -04:00
12 lines
8.4 KiB
JavaScript
12 lines
8.4 KiB
JavaScript
import{C as v,V as R,c as T,P as F,d as P,g as O,e as j,f as q}from"./index-DrvHWPwa.chunk.mjs";import{j as K,m as $,u as W,s as o,a1 as X,k as Y,c as H,o as u,w as f,x as h,a0 as I,z as Z,b as G,H as J,E as N,F as Q,X as ee,f as te,B as c,t as r,a2 as V,a3 as g,h as se,a4 as ae,g as re,a5 as ne,a6 as C,l as ie}from"./mdi-B9XVyi7B.chunk.mjs";import{c as A,i as le}from"./index-BOuI_nzB.chunk.mjs";import{e as oe,f as de,s as S,d as ue,g as ce}from"./index-JpgrUA2Z-ClfXhQGo.chunk.mjs";import{a as U,d as me,b as fe}from"./_plugin-vue_export-helper-CDPKodk-.chunk.mjs";import{g as pe,a as be,b as he,r as ye,d as ve}from"./dav-T2u8vZJg.chunk.mjs";/* empty css */import{R as ge}from"./colors-Go3zmZRD-COThczpI.chunk.mjs";import{N as we}from"./NcAvatar-DmUGApWA-CajOq8xc.chunk.mjs";import"./string_decoder-mL5xNZ9K.chunk.mjs";import"./NcNoteCard-CVhtNL04-BSciYEDO.chunk.mjs";import"./PencilOutline-BWbwYeLs.chunk.mjs";import"./index-DGc3S-5s.chunk.mjs";import"./NcUserStatusIcon-CGEf7fej-CrSZFJV_.chunk.mjs";import"./NcActionRouter-oT-YU_jf-MmX7C-nb.chunk.mjs";const _e={};function xe(s,e){return u(),N("div",null,[h(s.$slots,"trigger")])}const $e=U(_e,[["render",xe]]),He={class:"user-bubble__name"},Ie={key:0,class:"user-bubble__secondary"},Ne=K({__name:"NcUserBubble",props:$({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:$(["click"],["update:open"]),setup(s,{emit:e}){const t=W(s,"open"),a=s,n=e,l=o(()=>{if(!a.avatarImage)return!1;try{return!!new URL(a.avatarImage)}catch{return!1}}),_=o(()=>!!a.avatarImage),E=o(()=>({marginInlineStart:`${a.margin}px`})),x=o(()=>{if(!a.url||a.url.trim()==="")return!1;try{return!!new URL(a.url,a.url?.startsWith?.("/")?window.location.href:void 0)}catch{return X("[NcUserBubble] Invalid URL passed",{url:a.url}),!1}}),L=o(()=>x.value?a.url:void 0),z=o(()=>x.value?"a":a.to?ge:"div"),M=o(()=>({height:`${a.size}px`,lineHeight:`${a.size}px`,borderRadius:`${a.size/2}px`}));return Y([()=>a.displayName,()=>a.user],()=>{!a.displayName&&a.user}),(i,d)=>(u(),H(I(i.$slots.default?oe:$e),{shown:t.value,"onUpdate:shown":d[1]||(d[1]=m=>t.value=m),class:"user-bubble__wrapper",trigger:"hover focus"},{trigger:f(({attrs:m})=>[(u(),H(I(z.value),Z({class:["user-bubble__content",{"user-bubble__content--primary":i.primary}],style:M.value,to:i.to,href:L.value},m,{onClick:d[0]||(d[0]=D=>n("click",D))}),{default:f(()=>[G(we,{url:_.value&&l.value?i.avatarImage:void 0,"icon-class":_.value&&!l.value?i.avatarImage:void 0,user:i.user,"display-name":i.displayName,size:i.size-i.margin*2,style:ee(E.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"]),J("span",He,te(i.displayName||i.user),1),i.$slots.name?(u(),N("span",Ie,[h(i.$slots,"name",{},void 0,!0)])):Q("",!0)]),_:2},1040,["class","style","to","href"]))]),default:f(()=>[h(i.$slots,"default",{},void 0,!0)]),_:3},40,["shown"]))}}),Ve=U(Ne,[["__scopeId","data-v-ad356e41"]]),Ce='<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>',Ae='<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/${c()?.uid}/trash`,Se=pe(),Ue=`<?xml version="1.0"?>
|
|
<d:propfind ${be()}>
|
|
<d:prop>
|
|
<nc:trashbin-deletion-time />
|
|
<nc:trashbin-original-location />
|
|
<nc:trashbin-title />
|
|
<nc:trashbin-deleted-by-id />
|
|
<nc:trashbin-deleted-by-display-name />
|
|
${he()}
|
|
</d:prop>
|
|
</d:propfind>`;function ke(s){const e=ye(s,k);return e.attributes.previewUrl=me("/apps/files_trashbin/preview?fileId={fileid}&x=32&y=32",{fileid:e.fileid}),e}async function Be(s="/"){const e=(await Se.getDirectoryContents(`${k}${s}`,{details:!0,data:Ue,includeSelf:!0})).data.map(ke),[t]=e.splice(e.findIndex(a=>a.path===s),1);return{folder:t,contents:e}}const Ee=new v({id:"files_trashbin--original-location",title:r("files_trashbin","Original location"),render(s){const e=p(s),t=document.createElement("span");return t.title=e,t.textContent=e,t},sort(s,e){const t=p(s),a=p(e);return t.localeCompare(a,[V(),g()],{numeric:!0,usage:"sort"})}}),Le=new v({id:"files_trashbin--deleted-by",title:r("files_trashbin","Deleted by"),render(s){const{userId:e,displayName:t,label:a}=b(s);if(a){const l=document.createElement("span");return l.textContent=a,l}const n=document.createElement("div");return se(Ve,{size:32,user:e??void 0,displayName:t??e}).mount(n),n},sort(s,e){const t=b(s),a=t.label??t.displayName??t.userId,n=b(e),l=n.label??n.displayName??n.userId;return a.localeCompare(l,[V(),g()],{numeric:!0,usage:"sort"})}}),ze=new v({id:"files_trashbin--deleted",title:r("files_trashbin","Deleted"),render(s){const e=s.attributes?.["trashbin-deletion-time"]||(s?.mtime?.getTime()??0)/1e3,t=document.createElement("span");if(e){const a=Intl.DateTimeFormat([g()],{dateStyle:"long",timeStyle:"short"}),n=new Date(e*1e3);return t.title=a.format(n),t.textContent=de(n,{ignoreSeconds:r("files","few seconds ago")}),t}return t.textContent=r("files_trashbin","A long time ago"),t},sort(s,e){const t=s.attributes?.["trashbin-deletion-time"]||(s?.mtime?.getTime()??0)/1e3;return(e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3)-t}});function p(s){const e=y(s.attributes?.["trashbin-original-location"]);if(!e)return r("files_trashbin","Unknown");const t=ae(e);return t==="/"||t==="."?r("files_trashbin","All files"):t.replace(/^\//,"")}function b(s){const e=y(s.attributes?.["trashbin-deleted-by-id"]),t=y(s.attributes?.["trashbin-deleted-by-display-name"]);let a;const n=c()?.uid;return e===n&&(a=r("files_trashbin","You")),!e&&!t&&(a=r("files_trashbin","Unknown")),{userId:e,displayName:t,label:a}}function y(s){return s?String(s):null}const w="trashbin",Me=new R({id:w,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:Ae,order:50,sticky:!0,defaultSortKey:"deleted",columns:[Ee,Le,ze],getContents:Be}),B=re().setApp("files_trashbin").detectUser().build(),De=new T({id:"restore",displayName(){return r("files_trashbin","Restore")},iconSvgInline:()=>Ce,enabled({nodes:s,view:e}){return e.id!==w?!1:s.length>0&&s.map(t=>t.permissions).every(t=>!!(t&F.READ))},async exec({nodes:s}){const e=s[0];try{const t=fe(ne(`dav/trashbin/${c().uid}/restore/${e.basename}`));return await A.request({method:"MOVE",url:e.encodedSource,headers:{destination:t}}),C("files:node:deleted",e),!0}catch(t){return le(t)&&t.response?.status===507&&S(r("files_trashbin","Not enough free space to restore the file/folder")),B.error("Failed to restore node",{error:t,node:e}),!1}},async execBatch({nodes:s,view:e,folder:t,contents:a}){return Promise.all(s.map(n=>this.exec({nodes:[n],view:e,folder:t,contents:a})))},order:1,inline:()=>!0});async function Re(){try{return await A.delete(`${ve}/trashbin/${c().uid}/trash`),ue(r("files_trashbin","All files have been permanently deleted")),!0}catch(s){return S(r("files_trashbin","Failed to empty deleted files")),B.error("Failed to empty deleted files",{error:s}),!1}}const Te=new P({id:"empty-trash",displayName:()=>r("files_trashbin","Empty deleted files"),order:0,enabled({view:s,folder:e,contents:t}){return s.id!==w||!ie("files_trashbin","config").allow_delete?!1:t.length>0&&e.path==="/"},async exec({contents:s}){return await new Promise(e=>{ce(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:()=>e(!1)},{label:r("files_trashbin","Empty deleted files"),variant:"error",callback:()=>e(!0)}]).build().show().then(()=>{e(!1)})})===!0&&await Re()&&s.forEach(e=>C("files:node:deleted",e)),null}}),Fe=O();Fe.register(Me),j(Te),q(De);
|
|
//# sourceMappingURL=files_trashbin-init.mjs.map
|