зеркало из https://github.com/nextcloud/photos.git
2 строки
11 KiB
JavaScript
2 строки
11 KiB
JavaScript
"use strict";(self.webpackChunkphotos=self.webpackChunkphotos||[]).push([["src_mixins_FetchCollectionContentMixin_js-src_components_HeaderNavigation_vue"],{19326:(t,n,o)=>{o.d(n,{A:()=>c});var e=o(95353),i=o(85168),a=o(58637),r=o(32041),l=o(63360),s=o(31445);const c={name:"FetchCollectionContentMixin",data:()=>({fetchSemaphore:new s.A(1),loadingCollection:!1,loadingCollectionFiles:!1,errorFetchingCollection:null,errorFetchingCollectionFiles:null}),mixins:[a.A],methods:{...(0,e.i0)(["appendFiles","addCollections","setCollectionFiles"]),async fetchCollection(t,n,o){if(this.loadingCollection)return null;try{this.loadingCollection=!0,this.errorFetchingCollection=null;const e=await(0,r.t9)(t,{signal:this.abortController.signal},n,o);return this.addCollections({collections:[e]}),e}catch(t){if(404===t.response?.status)return this.errorFetchingCollection=404,null;this.errorFetchingCollection=t,l.A.error("[PublicCollectionContent] Error fetching collection",{error:t}),(0,i.Qg)(this.t("photos","Failed to fetch collection."))}finally{this.loadingCollection=!1}return null},async fetchCollectionFiles(t,n,o){let e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(this.loadingCollectionFiles)return[];const a=await this.fetchSemaphore.acquire();try{this.errorFetchingCollectionFiles=null,this.loadingCollectionFiles=!0;let i=await(0,r.et)(t,{signal:this.abortController.signal},n,o);const a=i.map((t=>t.fileid.toString()));return e.forEach((t=>i=i.map(t))),this.appendFiles(i),i.length>0&&await this.$store.commit("setCollectionFiles",{collectionFileName:t,fileIds:a}),i}catch(t){if(404===t.response?.status)return this.errorFetchingCollectionFiles=404,[];this.errorFetchingCollectionFiles=t,(0,i.Qg)(this.t("photos","Failed to fetch collections list.")),l.A.error("[PublicCollectionContent] Error fetching collection files",{error:t})}finally{this.loadingCollectionFiles=!1,this.fetchSemaphore.release(a)}return[]}}}},32041:(t,n,o)=>{o.d(n,{An:()=>A,et:()=>g,t9:()=>d});var e=o(67057),i=o.n(e),a=o(53334),r=o(59006),l=o(63360),s=o(83984);function c(){return`<?xml version="1.0"?>\n\t\t\t<d:propfind xmlns:d="DAV:"\n\t\t\t\txmlns:oc="http://owncloud.org/ns"\n\t\t\t\txmlns:nc="http://nextcloud.org/ns"\n\t\t\t\txmlns:ocs="http://open-collaboration-services.org/ns">\n\t\t\t\t<d:prop>\n\t\t\t\t\t<nc:last-photo />\n\t\t\t\t\t<nc:nbItems />\n\t\t\t\t\t${(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).join("")}\n\t\t\t\t</d:prop>\n\t\t\t</d:propfind>`}function p(){return`<?xml version="1.0"?>\n\t\t\t<d:propfind xmlns:d="DAV:"\n\t\t\t\txmlns:oc="http://owncloud.org/ns"\n\t\t\t\txmlns:nc="http://nextcloud.org/ns"\n\t\t\t\txmlns:ocs="http://open-collaboration-services.org/ns">\n\t\t\t\t<d:prop>\n\t\t\t\t\t<d:getcontentlength />\n\t\t\t\t\t<d:getcontenttype />\n\t\t\t\t\t<d:getetag />\n\t\t\t\t\t<d:getlastmodified />\n\t\t\t\t\t<d:resourcetype />\n\t\t\t\t\t<nc:metadata-photos-size />\n\t\t\t\t\t<nc:metadata-photos-original_date_time />\n\t\t\t\t\t<nc:metadata-files-live-photo />\n\t\t\t\t\t<nc:has-preview />\n\t\t\t\t\t<nc:hidden />\n\t\t\t\t\t<oc:favorite />\n\t\t\t\t\t<oc:fileid />\n\t\t\t\t\t<oc:permissions />\n\t\t\t\t\t${(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).join("")}\n\t\t\t\t</d:prop>\n\t\t\t</d:propfind>`}async function d(t,n){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r.Ay;try{const i=await e.stat(t,{data:c(o),details:!0,...n});return l.A.debug("[Collections] Fetched a collection: ",{data:i.data}),h(i.data)}catch(t){if("ERR_CANCELED"===t.code)return null;throw t}}async function A(t,n){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r.Ay;try{const i=await e.getDirectoryContents(t,{data:c(o),details:!0,...n});return l.A.debug(`[Collections] Fetched ${i.data.length} collections: `,{data:i.data}),i.data.filter((n=>n.filename!==t)).map(h)}catch(t){if("ERR_CANCELED"===t.code)return[];throw t}}function h(t){void 0===t.props.collaborators||""===t.props.collaborators?t.props.collaborators=[]:"object"==typeof t.props.collaborators.collaborator&&(Array.isArray(t.props.collaborators.collaborator)?t.props.collaborators=t.props.collaborators.collaborator:t.props.collaborators=[t.props.collaborators.collaborator]),t=(0,s.JR)(t);const n=JSON.parse(t.dateRange?.replace(/"/g,'"')??"{}");null===n.start&&(n.start=i()().unix(),n.end=i()().unix());const o={startDate:i().unix(n.start).format("MMMM YYYY"),endDate:i().unix(n.end).format("MMMM YYYY")};return t.date=o.startDate===o.endDate?o.startDate:(0,a.Tl)("photos","{startDate} to {endDate}",o),t}async function g(t,n){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:r.Ay;try{const i=(await e.getDirectoryContents(t,{data:p(o),details:!0,...n})).data.map((t=>(0,s.JR)(t))).filter((t=>t.fileid));return l.A.debug(`[Collections] Fetched ${i.length} new files: `,i),i}catch(t){if("ERR_CANCELED"===t.code)return[];throw l.A.error("Error fetching collection files",{error:t}),console.error(t),t}}},8351:(t,n,o)=>{o.d(n,{A:()=>l});var e=o(71354),i=o.n(e),a=o(76314),r=o.n(a)()(i());r.push([t.id,".photos-navigation[data-v-544b8840]{position:sticky;z-index:20;top:0;display:flex;flex-wrap:wrap;gap:calc(2*var(--app-navigation-padding));align-items:center;justify-content:flex-start;width:100%;padding-inline:calc(var(--default-clickable-area) + 2*var(--app-navigation-padding)) var(--app-navigation-padding);padding-block:var(--app-navigation-padding);background:var(--color-main-background)}.photos-navigation__back[data-v-544b8840]{position:absolute !important;left:var(--app-navigation-padding)}.photos-navigation__title[data-v-544b8840]{max-width:45%;display:flex;flex-direction:column}.photos-navigation__title__main[data-v-544b8840]{cursor:pointer;font-weight:700;font-size:20px;line-height:44px}.photos-navigation__title__main[data-v-544b8840],.photos-navigation__title__sub[data-v-544b8840]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.photos-navigation__loader[data-v-544b8840]{margin-inline-start:32px}.photos-navigation__content-right[data-v-544b8840]{display:flex;align-items:center;justify-content:center;margin-inline-start:auto}","",{version:3,sources:["webpack://./src/components/HeaderNavigation.vue"],names:[],mappings:"AAEA,oCACC,eAAA,CACA,UAAA,CACA,KAAA,CACA,YAAA,CAEA,cAAA,CACA,yCAAA,CACA,kBAAA,CACA,0BAAA,CACA,UAAA,CAEA,kHAAA,CAEA,2CAAA,CACA,uCAAA,CAEA,0CAEC,4BAAA,CACA,kCAAA,CAGD,2CACC,aAAA,CACA,YAAA,CACA,qBAAA,CAEA,iDACC,cAAA,CACA,eAAA,CACA,cAAA,CACA,gBAAA,CAGD,iGACC,eAAA,CACA,kBAAA,CACA,sBAAA,CAIF,4CACC,wBAAA,CAGD,mDACC,YAAA,CACA,kBAAA,CACA,sBAAA,CACA,wBAAA",sourcesContent:['$sizes: ("400": ("count": 3, "marginTop": 66, "marginW": 8), "700": ("count": 4, "marginTop": 66, "marginW": 8), "1024": ("count": 5, "marginTop": 66, "marginW": 44), "1280": ("count": 4, "marginTop": 66, "marginW": 44), "1440": ("count": 5, "marginTop": 88, "marginW": 66), "1600": ("count": 6, "marginTop": 88, "marginW": 66), "2048": ("count": 7, "marginTop": 88, "marginW": 66), "2560": ("count": 8, "marginTop": 88, "marginW": 88), "3440": ("count": 9, "marginTop": 88, "marginW": 88), "max": ("count": 10, "marginTop": 88, "marginW": 88));\n\n.photos-navigation {\n\tposition: sticky;\n\tz-index: 20;\n\ttop: 0;\n\tdisplay: flex;\n\t// We need to wrap on small devices for accessibility\n\tflex-wrap: wrap;\n\tgap: calc(2 * var(--app-navigation-padding));\n\talign-items: center;\n\tjustify-content: flex-start;\n\twidth: 100%;\n\t// Ensure to not overlap with app navigation toggle\n\tpadding-inline: calc(var(--default-clickable-area) + 2 * var(--app-navigation-padding)) var(--app-navigation-padding);\n\t// Align with app navigation toggle\n\tpadding-block: var(--app-navigation-padding);\n\tbackground: var(--color-main-background);\n\n\t&__back {\n\t\t// Replaces the app navigation button\n\t\tposition: absolute !important;\n\t\tleft: var(--app-navigation-padding);\n\t}\n\n\t&__title {\n\t\tmax-width: 45%;\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\n\t\t&__main {\n\t\t\tcursor: pointer;\n\t\t\tfont-weight: 700;\n\t\t\tfont-size: 20px;\n\t\t\tline-height: 44px;\n\t\t}\n\n\t\t&__main, &__sub {\n\t\t\toverflow: hidden;\n\t\t\twhite-space: nowrap;\n\t\t\ttext-overflow: ellipsis;\n\t\t}\n\t}\n\n\t&__loader {\n\t\tmargin-inline-start: 32px;\n\t}\n\n\t&__content-right {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tmargin-inline-start: auto;\n\t}\n}\n\n'],sourceRoot:""}]);const l=r},16482:(n,o,e)=>{e.d(o,{A:()=>b});var i=e(55028),a=e(76333);const r={name:"HeaderNavigation",components:{ArrowLeft:i.A,NcButton:a.x1,NcLoadingIcon:a.ne},inheritAttrs:!1,props:{loading:{type:Boolean,default:!1},path:{type:String,default:"/"},title:{type:String,required:!0},rootTitle:{type:String,default:t("photos","Photos")},params:{type:Object,default:null}},computed:{isRoot(){const t="/"===this.path;return this.toggleNavigationButton(!t),t},name(){return this.isRoot?this.rootTitle:this.title},parentPath(){const t=this.path.split("/");t.pop();const n=t.join("/");return this.isRoot||""===n.trim()?"/":t.join("/")},parentName(){return this.parentPath&&this.parentPath.split("/").pop()},backToText(){return"/"===this.parentPath?t("photos","Back to {folder}",{folder:this.rootTitle}):t("photos","Back to {folder}",{folder:this.parentName})},to(){const t=/^\/?(.*)/i.exec(this.parentPath)[1],{name:n,params:o}=Object.assign({},this.$route,{params:this.params||{path:t}});return""===t?{name:n}:decodeURIComponent(this.$router.resolve({name:n,params:o}).resolved.path)}},methods:{folderUp(){this.$router.push(this.to)},refresh(){this.$emit("refresh")},toggleNavigationButton(t){const n=document.querySelector("button.app-navigation-toggle");null!==n&&(n.style.display=t?"none":null)}}};var l=e(85072),s=e.n(l),c=e(97825),p=e.n(c),d=e(77659),A=e.n(d),h=e(55056),g=e.n(h),u=e(10540),C=e.n(u),v=e(41113),m=e.n(v),f=e(8351),_={};_.styleTagTransform=m(),_.setAttributes=g(),_.insert=A().bind(null,"head"),_.domAPI=p(),_.insertStyleElement=C();s()(f.A,_);f.A&&f.A.locals&&f.A.locals;const b=(0,e(14486).A)(r,(function(){var t=this,n=t._self._c;return n("div",{staticClass:"photos-navigation",class:{"photos-navigation--root":t.isRoot},attrs:{role:"toolbar"}},[t.isRoot?t._e():n("NcButton",{staticClass:"photos-navigation__back",attrs:{"aria-label":t.t("photos","Go back"),type:"tertiary"},on:{click:t.folderUp},scopedSlots:t._u([{key:"icon",fn:function(){return[n("ArrowLeft",{attrs:{size:20}})]},proxy:!0}],null,!1,1821202730)}),t._v(" "),n("div",{staticClass:"photos-navigation__title"},[n("h1",{staticClass:"photos-navigation__title__main",on:{click:t.refresh}},[t._v("\n\t\t\t"+t._s(t.name)+"\n\t\t")]),t._v(" "),n("div",{staticClass:"photos-navigation__title__sub"}),t._v(" "),t._t("subtitle")],2),t._v(" "),t.$slots.default?n("div",{staticClass:"photos-navigation__content"},[t._t("default")],2):t._e(),t._v(" "),n("NcLoadingIcon",{directives:[{name:"show",rawName:"v-show",value:t.loading,expression:"loading"}],staticClass:"photos-navigation__loader"}),t._v(" "),n("div",{staticClass:"photos-navigation__content-right"},[t._t("right")],2)],1)}),[],!1,null,"544b8840",null).exports}}]);
|
|
//# sourceMappingURL=photos-src_mixins_FetchCollectionContentMixin_js-src_components_HeaderNavigation_vue.js.map?v=9b402c317d0e2d05749a
|