photos/js/photos-src_views_FaceConten...

2 lines
14 KiB
JavaScript

"use strict";(self.webpackChunkphotos=self.webpackChunkphotos||[]).push([["src_views_FaceContent_vue"],{59593:(t,e,n)=>{n.d(e,{Z:()=>c});var o=n(87537),a=n.n(o),i=n(23645),s=n.n(i)()(a());s.push([t.id,".face[data-v-35997606]{display:flex;flex-direction:column}.face__empty[data-v-35997606]{display:flex;flex-direction:column;align-items:center}.face__empty__button[data-v-35997606]{margin-top:32px}.face__header[data-v-35997606]{display:flex;min-height:60px;align-items:center;justify-content:space-between;position:-webkit-sticky;position:sticky;z-index:3;background:var(--color-main-background);padding:0 64px}@media only screen and (max-width: 1020px){.face__header[data-v-35997606]{padding:0;padding-left:64px}}.face__header__left[data-v-35997606]{height:100%;display:flex;align-items:center}.face__header__title[data-v-35997606]{margin-left:10px}.face__header__title h2[data-v-35997606]{margin-bottom:0}.face__header__loader[data-v-35997606]{margin-left:32px}.face__header__actions[data-v-35997606]{display:flex;align-items:center}.face__header__actions button[data-v-35997606]{margin-left:16px}.face__photos[data-v-35997606]{margin-top:16px;height:100%;min-height:0;padding:0 64px}@media only screen and (max-width: 1020px){.face__photos[data-v-35997606]{padding:0}}.empty-content-with-illustration[data-v-35997606] .empty-content__icon{width:200px;height:200px}.empty-content-with-illustration[data-v-35997606] .empty-content__icon svg{width:200px;height:200px}.rename-form[data-v-35997606]{display:flex;flex-direction:row;align-items:center;height:70px;padding:16px}.rename-form input[data-v-35997606]{width:80%}","",{version:3,sources:["webpack://./src/mixins/FaceContent.scss"],names:[],mappings:"AAqBA,uBACC,YAAA,CACA,qBAAA,CAEA,8BACC,YAAA,CACA,qBAAA,CACA,kBAAA,CAEA,sCACC,eAAA,CAKF,+BACC,YAAA,CACA,eAAA,CACA,kBAAA,CACA,6BAAA,CACA,uBAAA,CAAA,eAAA,CACA,SAAA,CACA,uCAAA,CACA,cAAA,CAEA,2CAVD,+BAWE,SAAA,CACA,iBAAA,CAAA,CAGD,qCACC,WAAA,CACA,YAAA,CACA,kBAAA,CAGD,sCACC,gBAAA,CACA,yCACC,eAAA,CAIF,uCACC,gBAAA,CAGD,wCACC,YAAA,CACA,kBAAA,CAEA,+CACC,gBAAA,CAKH,+BACC,eAAA,CACA,WAAA,CACA,YAAA,CACA,cAAA,CAEA,2CAND,+BAOE,SAAA,CAAA,CAKH,uEACC,WAAA,CACA,YAAA,CAEA,2EACC,WAAA,CACA,YAAA,CAIF,8BACC,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,WAAA,CACA,YAAA,CAEA,oCACC,SAAA",sourcesContent:["/**\n * @copyright Copyright (c) 2023 Marcel Klehr <mklehr@gmx.net>\n *\n * @author Marcel Klehr <mklehr@gmx.net>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\n.face {\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t&__empty {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\talign-items: center;\n\n\t\t&__button {\n\t\t\tmargin-top: 32px;\n\t\t}\n\n\t}\n\n\t&__header {\n\t\tdisplay: flex;\n\t\tmin-height: 60px;\n\t\talign-items: center;\n\t\tjustify-content: space-between;\n\t\tposition: sticky;\n\t\tz-index: 3;\n\t\tbackground: var(--color-main-background);\n\t\tpadding: 0 64px;\n\n\t\t@media only screen and (max-width: 1020px) {\n\t\t\tpadding: 0;\n\t\t\tpadding-left: 64px;\n\t\t}\n\n\t\t&__left {\n\t\t\theight: 100%;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t}\n\n\t\t&__title {\n\t\t\tmargin-left: 10px;\n\t\t\th2 {\n\t\t\t\tmargin-bottom: 0;\n\t\t\t}\n\t\t}\n\n\t\t&__loader {\n\t\t\tmargin-left: 32px;\n\t\t}\n\n\t\t&__actions {\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\n\t\t\tbutton {\n\t\t\t\tmargin-left: 16px;\n\t\t\t}\n\t\t}\n\t}\n\n\t&__photos {\n\t\tmargin-top: 16px;\n\t\theight: 100%;\n\t\tmin-height: 0; // Prevent it from overflowing in a flex context.\n\t\tpadding: 0 64px;\n\n\t\t@media only screen and (max-width: 1020px) {\n\t\t\tpadding: 0;\n\t\t}\n\t}\n}\n\n.empty-content-with-illustration :deep .empty-content__icon {\n\twidth: 200px;\n\theight: 200px;\n\n\tsvg {\n\t\twidth: 200px;\n\t\theight: 200px;\n\t}\n}\n\n.rename-form {\n\tdisplay: flex;\n\tflex-direction: row;\n\talign-items: center;\n\theight: 70px;\n\tpadding: 16px;\n\n\tinput {\n\t\twidth: 80%;\n\t}\n}"],sourceRoot:""}]);const c=s},2041:(t,e,n)=>{n.r(e),n.d(e,{default:()=>Y});var o=n(20629),a=n(77531),i=n(44893),s=n(84320),c=n(58613),l=n(34020),r=n(56855),d=n(18667),A=n(69254),h=n(73981),f=n(39337),p=n(12806),u=n(66951),m=n(98171),C=n(91408),_=n(36591),g=n(59537),v=n(99751),y=n(20144),F=n(35406);const w={name:"FaceContent",components:{Pencil:a.Z,Star:c.Z,Download:l.Z,Close:i.Z,AlertCircle:s.Z,Send:r.Z,Merge:d.Z,ArrowLeft:A.Z,AccountBoxMultipleOutline:f.Z,FaceMergeForm:F.Z,FilesListViewer:C.Z,File:_.Z,NcLoadingIcon:p.lb,NcEmptyContent:p.SL,NcActions:p.O3,NcActionButton:p.Js,NcModal:p.Jc,NcButton:p.P2,AccountSwitch:h.Z},directives:{focus(t){y.ZP.nextTick((()=>t.focus()))}},mixins:[v.Z,u.Z,m.Z],props:{faceName:{type:String,default:"/"}},data:()=>({showMoveModal:!1,showMergeModal:!1,showRenameModal:!1,loadingCount:0,appContent:document.getElementById("app-content-vue")}),computed:{...(0,o.Se)(["files","facesFiles"]),face(){return this.faces[this.faceName]},faceFileIds(){return this.facesFiles[this.faceName]||[]},shouldFavoriteSelection(){return this.selectedFileIds.some((t=>0===this.$store.state.files.files[t].favorite))}},watch:{face(){this.face&&this.fetchFaceContent(this.faceName)}},mounted(){this.fetchFaceContent(this.faceName)},methods:{...(0,o.nv)(["appendFiles","deleteFace","renameFace","downloadFiles","toggleFavoriteForFiles","removeFilesFromFace","moveFilesToFace"]),openViewer(t){const e=this.files[t];OCA.Viewer.open({path:"/"+e.filename.split("/").slice(3).join("/"),list:this.faceFileIds.map((t=>({...this.files[t],basename:this.files[t].basename.split("-").slice(1).join("-")}))).filter((t=>!t.sectionHeader)),loadMore:e.loadMore?async()=>await e.loadMore(!0):()=>[],canLoop:e.canLoop})},async handleRemoveFilesFromFace(t){try{this.loadingCount++,await this.removeFilesFromFace({faceName:this.faceName,fileIdsToRemove:t}),this.resetSelection()}catch(t){g.Z.error(t)}finally{this.loadingCount--}},async handleDeleteFace(){try{this.loadingCount++,await this.deleteFace({faceName:this.faceName}),this.$router.push("/faces")}catch(t){g.Z.error(t)}finally{this.loadingCount--}},async handleRenameFace(t){try{this.loadingCount++,this.showRenameModal=!1;const e=this.faceName;await this.renameFace({oldName:e,faceName:t}),this.$router.push({name:"facecontent",params:{faceName:t}})}catch(t){g.Z.error(t)}finally{this.loadingCount--}},async handleMerge(t){try{this.loadingCount++,await this.moveFilesToFace({oldFace:this.faceName,faceName:t,fileIdsToMove:this.facesFiles[this.faceName]}),await this.deleteFace({faceName:this.faceName}),this.showMergeModal=!1,this.$router.push({name:"facecontent",params:{faceName:t}})}catch(t){g.Z.error(t)}finally{this.loadingCount--}},async handleMove(t,e){try{this.loadingCount++,await this.moveFilesToFace({oldFace:this.faceName,faceName:t,fileIdsToMove:e}),this.showMoveModal=!1}catch(t){g.Z.error(t)}finally{this.loadingCount--}},async favoriteSelection(){try{this.loadingCount++,await this.toggleFavoriteForFiles({fileIds:this.selectedFileIds,favoriteState:!0})}catch(t){g.Z.error(t)}finally{this.loadingCount--}},async unFavoriteSelection(){try{this.loadingCount++,await this.toggleFavoriteForFiles({fileIds:this.selectedFileIds,favoriteState:!1})}catch(t){g.Z.error(t)}finally{this.loadingCount--}},async downloadSelection(){try{this.loadingCount++,await this.downloadFiles(this.selectedFileIds)}catch(t){g.Z.error(t)}finally{this.loadingCount--}}}};var x=n(93379),N=n.n(x),k=n(7795),M=n.n(k),S=n(90569),b=n.n(S),B=n(3565),I=n.n(B),Z=n(19216),R=n.n(Z),E=n(44589),T=n.n(E),L=n(59593),P={};P.styleTagTransform=T(),P.setAttributes=I(),P.insert=b().bind(null,"head"),P.domAPI=M(),P.insertStyleElement=R();N()(L.Z,P);L.Z&&L.Z.locals&&L.Z.locals;const Y=(0,n(51900).Z)(w,(function(){var t=this,e=t._self._c;return void 0!==t.face||t.loadingFiles||t.loadingFaces?t.errorFetchingFiles||t.errorFetchingFaces?e("NcEmptyContent",{scopedSlots:t._u([{key:"icon",fn:function(){return[e("AlertCircle")]},proxy:!0}])},[t._v("\n\t"+t._s(t.t("photos","An error occurred"))+"\n")]):e("div",{staticClass:"face"},[e("div",{staticClass:"face__header"},[e("div",{staticClass:"face__header__left"},[e("NcActions",[e("NcActionButton",{on:{click:function(e){return t.$router.push("/faces/")}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("ArrowLeft")]},proxy:!0}])},[t._v(t._s(t.t("photos","Back"))+"\n\t\t\t\t")])],1),t._v(" "),e("div",{staticClass:"face__header__title"},[void 0!==t.face?e("h2",{class:{"face-name":!0,"hidden-visually":t.face.basename.match(/^[0-9]+$/)}},[t._v("\n\t\t\t\t\t"+t._s(t.face.basename)+"\n\t\t\t\t")]):t._e()]),t._v(" "),t.loadingCount>0||t.loadingFaces?e("NcLoadingIcon"):t._e()],1),t._v(" "),void 0!==t.face?e("div",{staticClass:"face__header__actions"},[e("NcActions",[e("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":t.t("photos","Rename person")},on:{click:function(e){t.showRenameModal=!0}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("Pencil")]},proxy:!0}],null,!1,514409694)},[t._v("\n\t\t\t\t\t"+t._s(t.t("photos","Rename person"))+"\n\t\t\t\t")])],1),t._v(" "),e("NcActions",{attrs:{"force-menu":!0}},[Object.keys(t.faces).length>1?e("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":t.t("photos","Merge with different person")},on:{click:function(e){t.showMergeModal=!0}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("Merge")]},proxy:!0}],null,!1,3117189691)},[t._v("\n\t\t\t\t\t"+t._s(t.t("photos","Merge with different person"))+"\n\t\t\t\t")]):t._e(),t._v(" "),t.selectedFileIds.length?[e("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":t.t("photos","Download selected files")},on:{click:t.downloadSelection}},[e("Download",{attrs:{slot:"icon"},slot:"icon"}),t._v("\n\t\t\t\t\t\t"+t._s(t.t("photos","Download selected photos"))+"\n\t\t\t\t\t")],1),t._v(" "),t.shouldFavoriteSelection?e("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":t.t("photos","Mark selection as favorite")},on:{click:t.favoriteSelection}},[e("Star",{attrs:{slot:"icon"},slot:"icon"}),t._v("\n\t\t\t\t\t\t"+t._s(t.t("photos","Favorite"))+"\n\t\t\t\t\t")],1):e("NcActionButton",{attrs:{"close-after-click":!0,"aria-label":t.t("photos","Remove selection from favorites")},on:{click:t.unFavoriteSelection}},[e("Star",{attrs:{slot:"icon"},slot:"icon"}),t._v("\n\t\t\t\t\t\t"+t._s(t.t("photos","Remove from favorites"))+"\n\t\t\t\t\t")],1),t._v(" "),e("NcActionButton",{attrs:{"close-after-click":!0},on:{click:function(e){t.showMoveModal=!0}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("AccountSwitch")]},proxy:!0}],null,!1,2937983280)},[t._v("\n\t\t\t\t\t\t"+t._s(t.n("photos","Move photo to a different person","Move photos to a different person",t.selectedFileIds.length))+"\n\t\t\t\t\t")]),t._v(" "),e("NcActionButton",{attrs:{"close-after-click":!0},on:{click:function(e){return t.handleRemoveFilesFromFace(t.selectedFileIds)}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("Close")]},proxy:!0}],null,!1,1051939733)},[t._v("\n\t\t\t\t\t\t"+t._s(t.n("photos","Remove photo from person","Remove photos from person",t.selectedFileIds.length))+"\n\t\t\t\t\t")])]:t._e(),t._v(" "),e("NcActionButton",{attrs:{"close-after-click":!0},on:{click:t.handleDeleteFace},scopedSlots:t._u([{key:"icon",fn:function(){return[e("Close")]},proxy:!0}],null,!1,1051939733)},[t._v("\n\t\t\t\t\t"+t._s(t.t("photos","Remove person"))+"\n\t\t\t\t")])],2)],1):t._e()]),t._v(" "),void 0!==t.face?e("FilesListViewer",{staticClass:"face__photos",attrs:{"container-element":t.appContent,"file-ids":t.faceFileIds,loading:t.loadingFiles||t.loadingFaces},scopedSlots:t._u([{key:"default",fn:function(n){let{file:o,distance:a}=n;return e("File",{attrs:{file:t.files[o.id],"allow-selection":!0,selected:!0===t.selection[o.id],distance:a},on:{click:t.openViewer,"select-toggled":t.onFileSelectToggle}})}}],null,!1,2716306842)}):t._e(),t._v(" "),t.showRenameModal?e("NcModal",{attrs:{name:t.t("photos","Rename person")},on:{close:function(e){t.showRenameModal=!1}}},[e("div",{staticClass:"rename-form"},[e("input",{directives:[{name:"focus",rawName:"v-focus"}],ref:"nameInput",attrs:{type:"text",name:"name",required:"",placeholder:t.t("photos","Name of this person")},domProps:{value:t.faceName},on:{keydown:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleRenameFace(t.$refs.nameInput.value)}}}),t._v(" "),e("NcButton",{attrs:{"aria-label":t.t("photos","Save."),type:"primary",disabled:t.$refs.nameInput&&""===t.$refs.nameInput.value.trim()},on:{click:function(e){return t.handleRenameFace(t.$refs.nameInput.value)}},scopedSlots:t._u([{key:"icon",fn:function(){return[t.loadingCount?e("NcLoadingIcon"):e("Send")]},proxy:!0}],null,!1,564208483)},[t._v("\n\t\t\t\t"+t._s(t.t("photos","Save"))+"\n\t\t\t")])],1)]):t._e(),t._v(" "),t.showMergeModal?e("NcModal",{attrs:{name:t.t("photos","Merge person")},on:{close:function(e){t.showMergeModal=!1}}},[e("FaceMergeForm",{attrs:{"first-face":t.faceName},on:{select:function(e){return t.handleMerge(e)}}})],1):t._e(),t._v(" "),t.showMoveModal?e("NcModal",{attrs:{name:t.t("photos","Move to different person")},on:{close:function(e){t.showMoveModal=!1}}},[e("FaceMergeForm",{attrs:{"first-face":t.faceName},on:{select:function(e){return t.handleMove(e,t.selectedFileIds)}}})],1):t._e()],1):e("NcEmptyContent",{staticClass:"empty-content-with-illustration",scopedSlots:t._u([{key:"icon",fn:function(){return[e("AccountBoxMultipleOutline")]},proxy:!0}],null,!1,2861705255)},[t._v("\n\t"+t._s(t.t("photos","This person could not be found"))+"\n")])}),[],!1,null,"35997606",null).exports}}]);
//# sourceMappingURL=photos-src_views_FaceContent_vue.js.map?v=360bf77df578487de651