3 lines
5.1 KiB
JavaScript
3 lines
5.1 KiB
JavaScript
import{d as r,t as l,g as c}from"./vue.runtime.esm-Ct3_M7aQ.chunk.mjs";import{m as n}from"./index-XmYygNaN.chunk.mjs";import{U as d}from"./index-DdKmqUaK-BlSvvbCn.chunk.mjs";import{u as p}from"./video-rmrjCz0n.chunk.mjs";import{f as h,N as u,h as m}from"./index-BMeBqg0T.chunk.mjs";import{N as f}from"./NcDialog-CKgpZOiy-Yt0iPUKp.chunk.mjs";import{N as g}from"./NcNoteCard-B0DAcORy.chunk.mjs";import{N as _}from"./NcSelect-CjUzohn5-BzxyFHzp.chunk.mjs";import{w as M,n as y}from"./icons-VGG7keIQ.chunk.mjs";import{F as k}from"./FileComponent-Z0cvFFM3.chunk.mjs";import{F,a as b}from"./FilesSelectionMixin-JLsUiKnU.chunk.mjs";import{F as Y}from"./FetchFilesMixin-Dh0XuSuT.chunk.mjs";import{F as v}from"./FilesByMonthMixin-BmZxTSkI.chunk.mjs";const N=r({name:"PhotosPicker",components:{FileComponent:k,FilesListViewer:b,ImagePlusOutline:M,NcButton:u,NcDialog:f,NcLoadingIcon:h,NcSelect:_,NcNoteCard:g,UploadPicker:d},mixins:[Y,v,F],props:{open:{type:Boolean,default:!0},name:{type:String,required:!0},destination:{type:String,required:!0},blacklistIds:{type:Array,default:()=>[]},loading:{type:Boolean,default:!1}},emits:["files-picked","update:open"],setup(){return{isMobile:p()}},data(){return{allowedMimes:m,targetMonth:null,uploadContext:{route:"albumpicker"},currentUser:c()?.uid}},computed:{files(){return this.$store.state.files.files},photosLocationFolder(){return this.$store.state.userConfig.photosLocationFolder}},watch:{monthsList(t){this.targetMonth===null&&(this.targetMonth=t[0])}},methods:{onFocusOut(t){t.relatedTarget===null&&t.target?.focus({preventScroll:!0})},getFiles(){this.fetchFiles({},this.shouldShowFile)},refreshFiles(){this.fetchFiles({firstResult:0},this.shouldShowFile,!0)},shouldShowFile(t){return t.attributes["mount-type"]===""&&!this.blacklistIds.includes(t.fileid?.toString()??"")},emitPickedEvent(){this.$emit("files-picked",this.selectedFileIds),this.resetSelection()},dateMonthAndYear(t){return this.isMobile?n(t,"YYYYMM").format("MMM YYYY"):n(t,"YYYYMM").format("MMMM YYYY")},t:l}});var w=function(){var t=this,e=t._self._c;return t._self._setupProxy,e("NcDialog",{attrs:{"content-classes":"photos-picker",name:t.name,open:t.open,"out-transition":"",size:"large"},on:{"update:open":s=>t.$emit("update:open",s)},scopedSlots:t._u([t.monthsList.length>0?{key:"navigation",fn:function({isCollapsed:s}){return[s?e("NcSelect",{staticClass:"photos-picker__navigation__month-select",attrs:{"aria-label-listbox":t.t("photos","Dates"),clearable:!1,"input-label":t.t("photos","Jump to specific date in list"),options:t.monthsList},scopedSlots:t._u([{key:"selected-option",fn:function({label:o}){return[t._v(" "+t._s(t.dateMonthAndYear(o))+" ")]}},{key:"option",fn:function({label:o}){return[t._v(" "+t._s(t.dateMonthAndYear(o))+" ")]}}],null,!0),model:{value:t.targetMonth,callback:function(o){t.targetMonth=o},expression:"targetMonth"}}):e("ul",{attrs:{"aria-label":t.t("photos","Dates")}},t._l(t.monthsList,function(o){return e("li",{key:o,staticClass:"photos-picker__navigation__month"},[e("NcButton",{attrs:{type:t.targetMonth===o?"secondary":"tertiary","aria-label":t.t("photos","Jump to {date}",{date:t.dateMonthAndYear(o)})},on:{click:function(i){t.targetMonth=o}}},[t._v(" "+t._s(t.dateMonthAndYear(o))+" ")])],1)}),0)]}}:null,{key:"actions",fn:function(){return[e("div",{staticClass:"photos-picker__actions"},[e("div",{staticClass:"photos-picker__actions__buttons"},[e("UploadPicker",{attrs:{accept:t.allowedMimes,context:t.uploadContext,destination:t.photosLocationFolder,multiple:""},on:{uploaded:t.refreshFiles}}),e("NcButton",{attrs:{type:"primary",disabled:t.loading||t.selectedFileIds.length===0},on:{click:t.emitPickedEvent},scopedSlots:t._u([{key:"icon",fn:function(){return[t.loading?t._e():e("ImagePlusOutline"),t.loading?e("NcLoadingIcon"):t._e()]},proxy:!0}])},[t._v(" "+t._s(t.t("photos","Add to {destination}",{destination:t.destination},void 0,{escape:!1,sanitize:!1}))+" ")])],1),t.photosLocationFolder?.attributes["owner-id"]!==t.currentUser?e("NcNoteCard",{attrs:{type:"warning"}},[t._v(" "+t._s(t.t("photos","The destination folder is owned by {owner}",{owner:t.photosLocationFolder?.attributes["owner-id"]}))+" ")]):t._e()],1)]},proxy:!0}],null,!0)},[e("FilesListViewer",{staticClass:"photos-picker__file-list",class:{"photos-picker__file-list--placeholder":t.monthsList.length===0},attrs:{"file-ids-by-section":t.fileIdsByMonth,"empty-message":t.t("photos","There are no photos or videos yet!"),sections:t.monthsList,loading:t.loadingFiles,"base-height":100,"section-header-height":50,"scroll-to-section":t.targetMonth},on:{"need-content":t.getFiles},nativeOn:{focusout:function(s){return t.onFocusOut.apply(null,arguments)}},scopedSlots:t._u([{key:"default",fn:function({file:s,height:o,isHeader:i,distance:a}){return[i?e("h3",{staticClass:"section-header",style:{height:`${o}px`},attrs:{id:`photos-picker-section-header-${s.id}`}},[t._v(" "+t._s(t.dateMonthAndYear(s.id))+" ")]):e("FileComponent",{attrs:{file:t.files[s.id],"allow-selection":!0,selected:t.selection[s.id]===!0,distance:a},on:{"select-toggled":t.onFileSelectToggle}})]}}])})],1)},L=[],S=y(N,w,L,!1,null,"196403b4");const E=S.exports;export{E as P};
|
|
//# sourceMappingURL=PhotosPicker-Co0d4oE2.chunk.mjs.map
|