nextcloud/dist/files-sidebar.js

3 lines
30 KiB
JavaScript
Raw Permalink Normal View History

/*! For license information please see files-sidebar.js.LICENSE.txt */
(()=>{var e,s,i,n={35090:(e,s,i)=>{"use strict";var n=i(20144),a=i(31352),r=i(65358),o=i(19755),l=i.n(o),d=i(4820),c=i(69183),u=i(80351),h=i.n(u),p=i(41922),f=i(10250),g=i.n(f),m=i(45400),y=i.n(m),b=i(93455),v=i.n(b),A=i(62574);const w={name:"SidebarTab",components:{NcAppSidebarTab:i.n(A)(),NcEmptyContent:v()},props:{fileInfo:{type:Object,default:()=>{},required:!0},id:{type:String,required:!0},name:{type:String,required:!0},icon:{type:String,required:!1},onMount:{type:Function,required:!0},onUpdate:{type:Function,required:!0},onDestroy:{type:Function,required:!0},onScrollBottomReached:{type:Function,default:()=>{}}},data:()=>({loading:!0}),computed:{activeTab(){return this.$parent.activeTab}},watch:{async fileInfo(t,e){t.id!==e.id&&(this.loading=!0,await this.onUpdate(this.fileInfo),this.loading=!1)}},async mounted(){this.loading=!0,await this.onMount(this.$refs.mount,this.fileInfo,this.$refs.tab),this.loading=!1},async beforeDestroy(){await this.onDestroy()}};var j=i(51900);const C=(0,j.Z)(w,(function(){var t=this,e=t._self._c;return e("NcAppSidebarTab",{ref:"tab",attrs:{id:t.id,name:t.name,icon:t.icon},on:{bottomReached:t.onScrollBottomReached},scopedSlots:t._u([{key:"icon",fn:function(){return[t._t("icon")]},proxy:!0}],null,!0)},[t._v(" "),t.loading?e("NcEmptyContent",{attrs:{icon:"icon-loading"}}):t._e(),t._v(" "),e("div",{ref:"mount"})],1)}),[],!1,null,null,null).exports,_={name:"LegacyView",props:{component:{type:Object,required:!0},fileInfo:{type:Object,default:()=>{},required:!0}},watch:{fileInfo(t){this.setFileInfo(t)}},mounted(){this.component.$el.replaceAll(this.$el),this.setFileInfo(this.fileInfo)},methods:{setFileInfo(t){this.component.setFileInfo(new OCA.Files.FileInfoModel(t))}}},T=(0,j.Z)(_,(function(){return(0,this._self._c)("div")}),[],!1,null,null,null).exports;var I,S=i(64192),x=i.n(S),O=i(11677),F=i.n(O),k=i(64024),E=i(79753),z=i(14596),L=i(77958);const N=(0,E.generateRemoteUrl)("dav"),P=(0,z.eI)(N,{headers:{requesttoken:null!==(I=(0,L.IH)())&&void 0!==I?I:""}});var D=i(23204),M=i.n(D);const R=t=>t.map((t=>{let{props:e}=t;return Object.fromEntries(Object.entries(e).map((t=>{let[e,s]=t;return[M()(e),s]})))})),U=t=>{const e=t.indexOf("?");e>0&&(t=t.substring(0,e));const s=t.split("/");let i;do{i=s[s.length-1],s.pop()}while(!i&&s.length>0);return Number(i)},B=t=>{const e={...t};return e.name&&!e.displayName||(e.name=e.displayName,delete e.displayName),e},q=(0,i(17499).IY)().setApp("systemtags").detectUser().build(),$='<?xml version="1.0"?>\n<d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">\n\t<d:prop>\n\t\t<oc:id />\n\t\t<oc:display-name />\n\t\t<oc:user-visible />\n\t\t<oc:user-assignable />\n\t\t<oc:can-assign />\n\t</d:prop>\n</d:propfind>',Z=async(t,e)=>{const s="/systemtags-relations/files/"+t+"/"+e.id,i=B(e);try{await P.customRequest(s,{method:"PUT",data:i})}catch(t){throw q.error((0,a.Iu)("systemtags","Failed to select tag"),{error:t}),new Error((0,a.Iu)("systemtags","Failed to select tag"))}},H={userVisible:!0,userAssignable:!0,canAssign:!0},V=n.default.extend({name:"SystemTags",components:{NcLoadingIcon:x(),NcSelectTags:F()},props:{fileId:{type:Number,required:!0}},data:()=>({sortedTags:[],selectedTags:[],loadingTags:!1,loading:!1}),async created(){try{const t=await(async()=>{try{const{data:t}=await P.getDirectoryContents("/systemtags",{data:$,details:!0,glob:"/systemtags/*"});return R(t)}catch(t){throw q.error((0,a.Iu)("systemtags","Failed to load tags"),{error:t}),new Error((0,a.Iu)("systemtags","Failed to load tags"))}})(),e=await(async()=>{const t=(0,E.generateUrl)("/apps/systemtags/lastused");try{const{data:e}=await d.default.get(t);return e.map(Number)}catch(t){throw q.error((0,a.Iu)("systemtags","Failed to load last used tags"),{error:t}),new Error((0,a.Iu)("systemtags","Failed to load last used tags"))}})(),s=[],i=[];for(const n of t)e.includes(n.id)?s.push(n):i.push(n);const n=(t,s)=>e.indexOf(t.id)-e.indexOf(s.id);s.sort(n),this.sortedTags=[...s,...i]}catch(t){(0,k.x2)((0,a.Iu)("systemtags","Failed to load tags"))}},watch:{fileId:{immediate:!0,async handler(){this.loadi
//# sourceMappingURL=files-sidebar.js.map?v=04e88730c6c1bac3c2f3