You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud/dist/files-sidebar.js

3 lines
50 KiB
JavaScript

/*! For license information please see files-sidebar.js.LICENSE.txt */
(()=>{var e,s,i,n={5119:(t,e,s)=>{"use strict";const{XMLParser:i,XMLValidator:n}=s(16932),r=t=>{if(null==t)return!1;if(0===(t=t.toString().trim()).length)return!1;if(!0!==n.validate(t))return!1;let e;const s=new i;try{e=s.parse(t)}catch(t){return!1}return!!e&&"svg"in e};t.exports=r,t.exports.default=r},2818:(e,s,i)=>{"use strict";var n=i(20144),r=i(31352),o=i(69183),a=i(65358),l=i(5656),d=i(42515),c=i(77958),u=i(41922),h=i(19755),p=i.n(h),f=i(93664),m=i(80351),g=i.n(m),y=i(42899),b=i(99059),v=i(22175);const w={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))}}};var A=i(51900);const j=(0,A.Z)(w,(function(){return(0,this._self._c)("div")}),[],!1,null,null,null).exports,x={name:"SidebarTab",components:{NcAppSidebarTab:i(98445).Z,NcEmptyContent:v.Z},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()}},N=(0,A.Z)(x,(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;var I=i(20435),C=i(35380),_=i(64024),T=i(36906);const E={userVisible:!0,userAssignable:!0,canAssign:!0},S=t=>t.map((t=>{let{props:e}=t;return Object.fromEntries(Object.entries(e).map((t=>{let[e,s]=t;return[(0,T.Z)(e),"displayName"===(0,T.Z)(e)?String(s):s]})))})),O=t=>{const e={...t};return e.name&&!e.displayName||(e.name=e.displayName,delete e.displayName),e};var L=i(79753),F=i(14596);const D=(0,L.generateRemoteUrl)("dav"),P=(0,F.eI)(D,{headers:{requesttoken:(0,c.IH)()??""}}),M=(0,i(17499).IY)().setApp("systemtags").detectUser().build(),k='<?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>',R=async(e,s)=>{const i="/systemtags-relations/files/"+s+"/"+e.id,n=O(e);try{await P.customRequest(i,{method:"PUT",data:n})}catch(e){throw M.error(t("systemtags","Failed to set tag for file"),{error:e}),new Error(t("systemtags","Failed to set tag for file"))}},z=n.default.extend({name:"SystemTags",components:{NcLoadingIcon:I.Z,NcSelectTags:C.Z},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:k,details:!0,glob:"/systemtags/*"});return S(t)}catch(t){throw M.error((0,r.Iu)("systemtags","Failed to load tags"),{error:t}),new Error((0,r.Iu)("systemtags","Failed to load tags"))}})(),e=await(async()=>{const t=(0,L.generateUrl)("/apps/systemtags/lastused");try{const{data:e}=await f.Z.get(t);return e.map(Number)}catch(t){throw M.error((0,r.Iu)("systemtags","Failed to load last used tags"),{error:t}),new Error((0,r.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,_.x2)((
//# sourceMappingURL=files-sidebar.js.map?v=b1df0a437f2df2edcbc1