files_trashbin-init.js 8.1 KB

12
  1. (()=>{var e,t={79462:(e,t,n)=>{"use strict";var i=n(85072),r=n.n(i),l=n(97825),o=n.n(l),s=n(77659),a=n.n(s),d=n(55056),u=n.n(d),c=n(10540),v=n.n(c),b=n(41113),p=n.n(b),h=n(98290),f={};f.styleTagTransform=p(),f.setAttributes=u(),f.insert=a().bind(null,"head"),f.domAPI=o(),f.insertStyleElement=v(),r()(h.A,f),h.A&&h.A.locals&&h.A.locals;var m,y=n(53334),w=n(26304),g=n(63814),A=n(21777),x=n(63623);const _="/trashbin/".concat(null===(m=(0,A.HW)())||void 0===m?void 0:m.uid,"/trash"),T=(0,g.dC)("dav"+_),C=(0,x.UU)(T),H=e=>{C.setHeaders({"X-Requested-With":"XMLHttpRequest",requesttoken:null!=e?e:""})};(0,A.zo)(H),H((0,A.do)());const L=C,P='<?xml version="1.0"?>\n<d:propfind '.concat((0,w.CP)(),">\n\t<d:prop>\n\t\t<nc:trashbin-filename />\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").concat((0,w.VX)(),"\n\t</d:prop>\n</d:propfind>"),S=function(e){var t,n,i,r,l;const o=(0,w.vb)(null===(t=e.props)||void 0===t?void 0:t.permissions),s=null===(n=(0,A.HW)())||void 0===n?void 0:n.uid,a=(0,g.Jv)("/apps/files_trashbin/preview?fileId={fileid}&x=32&y=32",e.props),d={id:(null===(i=e.props)||void 0===i?void 0:i.fileid)||0,source:(0,g.dC)("dav"+_+e.filename),mime:e.mime,size:(null===(r=e.props)||void 0===r?void 0:r.size)||0,permissions:o,owner:s,root:_,attributes:{...e,...e.props,displayName:null===(l=e.props)||void 0===l?void 0:l["trashbin-filename"],previewUrl:a}};return delete d.attributes.props,"file"===e.type?new w.ZH(d):new w.vd(d)};var O=n(51651),N=n(71089),k=n(85471),D=n(66646);const I=e=>{var t,n;const i=void 0!==(null===(t=e.attributes)||void 0===t?void 0:t["trashbin-original-location"])?String(null===(n=e.attributes)||void 0===n?void 0:n["trashbin-original-location"]):null;if(!i)return(0,y.Tl)("files_trashbin","Unknown");const r=(0,N.pD)(i);return r===i?(0,y.Tl)("files_trashbin","All files"):r.replace(/^\//,"")},U=e=>{var t,n,i,r;const l=void 0!==(null===(t=e.attributes)||void 0===t?void 0:t["trashbin-deleted-by-id"])?String(null===(n=e.attributes)||void 0===n?void 0:n["trashbin-deleted-by-id"]):null,o=void 0!==(null===(i=e.attributes)||void 0===i?void 0:i["trashbin-deleted-by-display-name"])?String(null===(r=e.attributes)||void 0===r?void 0:r["trashbin-deleted-by-display-name"]):null,s=((e,t)=>{var n;return e===(null===(n=(0,A.HW)())||void 0===n?void 0:n.uid)?(0,y.Tl)("files_trashbin","You"):e||t?null:(0,y.Tl)("files_trashbin","Unknown")})(l,o);return{userId:l,displayName:o,label:s}},V=new w.VP({id:"original-location",title:(0,y.Tl)("files_trashbin","Original location"),render(e){const t=I(e),n=document.createElement("span");return n.title=t,n.textContent=t,n},sort(e,t){const n=I(e),i=I(t);return n.localeCompare(i)}}),j=new w.VP({id:"deleted-by",title:(0,y.Tl)("files_trashbin","Deleted by"),render(e){const{userId:t,displayName:n,label:i}=U(e);if(i){const e=document.createElement("span");return e.textContent=i,e}return new(k.Ay.extend(D.N))({propsData:{size:32,user:null!=t?t:void 0,displayName:null!=n?n:(0,y.Tl)("files_trashbin","Unknown")}}).$mount().$el},sort(e,t){var n,i,r,l;const o=null!==(n=null!==(i=U(e).label)&&void 0!==i?i:U(e).displayName)&&void 0!==n?n:(0,y.Tl)("files_trashbin","Unknown"),s=null!==(r=null!==(l=U(t).label)&&void 0!==l?l:U(t).displayName)&&void 0!==r?r:(0,y.Tl)("files_trashbin","Unknown");return o.localeCompare(s)}}),E=new w.VP({id:"deleted",title:(0,y.Tl)("files_trashbin","Deleted"),render(e){var t;const n=null===(t=e.attributes)||void 0===t?void 0:t["trashbin-deletion-time"],i=document.createElement("span");return n?(i.title=O.A.unix(n).format("LLL"),i.textContent=O.A.unix(n).fromNow(),i):(i.textContent=(0,y.Tl)("files_trashbin","A long time ago"),i)},sort(e,t){var n,i;const r=(null===(n=e.attributes)||void 0===n?void 0:n["trashbin-deletion-time"])||(null==e?void 0:e.mtime)||0;return((null===(i=t.attributes)||void 0===i?void 0:i["trashbin-deletion-time"])||(null==t?void 0:t.mtime)||0)-r}}),M=[V,j,E];var X=n(61338),R=n(65043);const G=(0,n(35947).YK)().setApp("files").detectUser().build();(0,w.Gg)(new w.hY({id:"restore",displayName:()=>(0,y.Tl)("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)=>"trashbin"===t.id&&e.length>0&&e.map((e=>e.permissions)).every((e=>0!=(e&w.aX.READ))),async exec(e){try{var t;const n=(0,g.dC)((0,N.O0)("dav/trashbin/".concat(null===(t=(0,A.HW)())||void 0===t?void 0:t.uid,"/restore/").concat(e.basename)));return await(0,R.Ay)({method:"MOVE",url:e.encodedSource,headers:{destination:n}}),(0,X.Ic)("files:node:deleted",e),!0}catch(e){return G.error(e),!1}},async execBatch(e,t,n){return Promise.all(e.map((e=>this.exec(e,t,n))))},order:1,inline:()=>!0})),(0,w.bh)().register(new w.Ss({id:"trashbin",name:(0,y.Tl)("files_trashbin","Deleted files"),caption:(0,y.Tl)("files_trashbin","List of files that have been deleted."),emptyTitle:(0,y.Tl)("files_trashbin","No deleted files"),emptyCaption:(0,y.Tl)("files_trashbin","Files and folders you have deleted will show up here"),icon:'<svg xmlns="http://www.w3.org/2000/svg" id="mdi-delete" viewBox="0 0 24 24"><path d="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z" /></svg>',order:50,sticky:!0,defaultSortKey:"deleted",columns:M,getContents:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/";const t=await L.stat(e,{details:!0,data:P}),n=await L.getDirectoryContents(e,{details:!0,data:P});return{folder:S(t.data),contents:n.data.map(S)}}}))},98290:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var i=n(71354),r=n.n(i),l=n(76314),o=n.n(l)()(r());o.push([e.id,"/*!\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */.files-list__row-trashbin-original-location{width:150px !important}","",{version:3,sources:["webpack://./apps/files_trashbin/src/trashbin.scss"],names:[],mappings:"AAAA;;;EAAA,CAIA,4CACE,sBAAA",sourcesContent:["/*!\n * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n.files-list__row-trashbin-original-location {\n width: 150px !important;\n}\n"],sourceRoot:""}]);const s=o},42634:()=>{},15340:()=>{},79838:()=>{}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var l=n[e]={id:e,loaded:!1,exports:{}};return t[e].call(l.exports,l,l.exports,i),l.loaded=!0,l.exports}i.m=t,e=[],i.O=(t,n,r,l)=>{if(!n){var o=1/0;for(u=0;u<e.length;u++){n=e[u][0],r=e[u][1],l=e[u][2];for(var s=!0,a=0;a<n.length;a++)(!1&l||o>=l)&&Object.keys(i.O).every((e=>i.O[e](n[a])))?n.splice(a--,1):(s=!1,l<o&&(o=l));if(s){e.splice(u--,1);var d=r();void 0!==d&&(t=d)}}return t}l=l||0;for(var u=e.length;u>0&&e[u-1][2]>l;u--)e[u]=e[u-1];e[u]=[n,r,l]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.e=()=>Promise.resolve(),i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),i.j=2573,(()=>{i.b=document.baseURI||self.location.href;var e={2573:0};i.O.j=t=>0===e[t];var t=(t,n)=>{var r,l,o=n[0],s=n[1],a=n[2],d=0;if(o.some((t=>0!==e[t]))){for(r in s)i.o(s,r)&&(i.m[r]=s[r]);if(a)var u=a(i)}for(t&&t(n);d<o.length;d++)l=o[d],i.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return i.O(u)},n=self.webpackChunknextcloud=self.webpackChunknextcloud||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),i.nc=void 0;var r=i.O(void 0,[4208],(()=>i(79462)));r=i.O(r)})();
  2. //# sourceMappingURL=files_trashbin-init.js.map?v=abb09db530175d5e2e80