nextcloud/dist/files_trashbin-init.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

2 lines
48 KiB
JavaScript
Raw Permalink Normal View History

(()=>{"use strict";var e,t,r,n={21769:(e,t,r)=>{var n=r(35810),i=r(21777),a=r(65043),o=r(85168),s=r(61338),c=r(53334),l=r(71225),u=r(63814),d=r(35947);const p=(0,d.YK)().setApp("files").detectUser().build();var E=r(3153);const f=`/trashbin/${(0,i.HW)()?.uid}/trash`,h=(0,n.H4)(),m=`<?xml version="1.0"?>\n<d:propfind ${(0,n.CP)()}>\n\t<d:prop>\n\t\t<nc:trashbin-deletion-time />\n\t\t<nc:trashbin-original-location />\n\t\t<nc:trashbin-title />\n\t\t<nc:trashbin-deleted-by-id />\n\t\t<nc:trashbin-deleted-by-display-name />\n\t\t${(0,n.VX)()}\n\t</d:prop>\n</d:propfind>`;function g(e){const t=(0,n.Al)(e,f);return t.attributes.previewUrl=(0,u.Jv)("/apps/files_trashbin/preview?fileId={fileid}&x=32&y=32",{fileid:t.fileid}),t}var T=r(85471),I=r(77764);const N=new n.VP({id:"files_trashbin--original-location",title:(0,c.t)("files_trashbin","Original location"),render(e){const t=A(e),r=document.createElement("span");return r.title=t,r.textContent=t,r},sort(e,t){const r=A(e),n=A(t);return r.localeCompare(n,[(0,c.Z0)(),(0,c.lO)()],{numeric:!0,usage:"sort"})}}),_=new n.VP({id:"files_trashbin--deleted-by",title:(0,c.t)("files_trashbin","Deleted by"),render(e){const{userId:t,displayName:r,label:n}=b(e);if(n){const e=document.createElement("span");return e.textContent=n,e}return new(T.Ay.extend(I.A))({propsData:{size:32,user:t??void 0,displayName:r??t}}).$mount().$el},sort(e,t){const r=b(e),n=r.label??r.displayName??r.userId,i=b(t),a=i.label??i.displayName??i.userId;return n.localeCompare(a,[(0,c.Z0)(),(0,c.lO)()],{numeric:!0,usage:"sort"})}}),w=new n.VP({id:"files_trashbin--deleted",title:(0,c.t)("files_trashbin","Deleted"),render(e){const t=e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3,r=document.createElement("span");if(t){const e=Intl.DateTimeFormat([(0,c.lO)()],{dateStyle:"long",timeStyle:"short"}),n=new Date(1e3*t);return r.title=e.format(n),r.textContent=(0,c.fw)(n,{ignoreSeconds:(0,c.t)("files","few seconds ago")}),r}return r.textContent=(0,c.t)("files_trashbin","A long time ago"),r},sort(e,t){const r=e.attributes?.["trashbin-deletion-time"]||(e?.mtime?.getTime()??0)/1e3;return(t.attributes?.["trashbin-deletion-time"]||(t?.mtime?.getTime()??0)/1e3)-r}});function A(e){const t=v(e.attributes?.["trashbin-original-location"]);if(!t)return(0,c.t)("files_trashbin","Unknown");const r=(0,l.pD)(t);return r===t?(0,c.t)("files_trashbin","All files"):r.replace(/^\//,"")}function b(e){const t=v(e.attributes?.["trashbin-deleted-by-id"]),r=v(e.attributes?.["trashbin-deleted-by-display-name"]);let n;const a=(0,i.HW)()?.uid;return t===a&&(n=(0,c.t)("files_trashbin","You")),t||r||(n=(0,c.t)("files_trashbin","Unknown")),{userId:t,displayName:r,label:n}}function v(e){return e?String(e):null}const y="trashbin",O=new n.Ss({id:y,name:(0,c.t)("files_trashbin","Deleted files"),caption:(0,c.t)("files_trashbin","List of files that have been deleted."),emptyTitle:(0,c.t)("files_trashbin","No deleted files"),emptyCaption:(0,c.t)("files_trashbin","Files and folders you have deleted will show up here"),icon:E,order:50,sticky:!0,defaultSortKey:"deleted",columns:[N,_,w],getContents:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";const t=(await h.getDirectoryContents(`${f}${e}`,{details:!0,data:m,includeSelf:!0})).data.map(g),[r]=t.splice(t.findIndex(t=>t.path===e),1);return{folder:r,contents:t}}}),R=new n.hY({id:"restore",displayName:()=>(0,c.t)("files_trashbin","Restore"),iconSvgInline:()=>'<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>',enabled:(e,t)=>t.id===y&&e.length>0&&e.map(e=>e.permissions).every(e=>Boolean(e&n.aX.READ)),async exec(e){try{const t=(0,u.dC)((0,l.O0)(`dav/trashbin/${(0,i.HW)().uid}/restore/${e.basename}`));return await a.Ay.request({method:"MOVE",url:e.encodedSource,headers:{destination:t}}),(0,s.Ic)("files:n
//# sourceMappingURL=files_trashbin-init.js.map?v=02efe732bde2076ddf05