diff --git a/bundle/Resources/public/js/remotemedia.js b/bundle/Resources/public/js/remotemedia.js index 68a4c172..3b4ff135 100644 --- a/bundle/Resources/public/js/remotemedia.js +++ b/bundle/Resources/public/js/remotemedia.js @@ -1,2 +1,2 @@ -(function(e){function t(t){for(var i,o,l=t[0],r=t[1],c=t[2],f=0,u=[];f0?e.config.allowedTags:e.allTags,multiple:"",taggable:0===e.config.allowedTags.length},on:{input:e.handleTagsInput},model:{value:e.selectedImage.tags,callback:function(t){e.$set(e.selectedImage,"tags",t)},expression:"selectedImage.tags"}}),a("select",{directives:[{name:"model",rawName:"v-model",value:e.selectedImage.tags,expression:"selectedImage.tags"}],staticClass:"ngremotemedia-newtags",attrs:{hidden:"",name:this.config.inputFields.tags,multiple:"multiple"},on:{change:function(t){var a=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){var t="_value"in e?e._value:e.value;return t}));e.$set(e.selectedImage,"tags",t.target.multiple?a:a[0])}}},e._l(e.allTags,(function(t){return a("option",{key:t},[e._v(e._s(t))])})),0)],1),a("div",{staticClass:"ngremotemedia-watermark-text"},[a("span",{staticClass:"help-block description"},[e._v("\n "+e._s(this.config.translations.preview_watermark_text)+"\n "),a("i",{staticClass:"fa fa-info-circle",attrs:{"data-toggle":"tooltip","data-placement":"right",title:this.config.translations.preview_watermark_text_info}})]),a("input",{directives:[{name:"model",rawName:"v-model",value:e.selectedImage.watermarkText,expression:"selectedImage.watermarkText"}],staticClass:"media-watermarktext data",attrs:{type:"text",name:this.config.inputFields.watermarkText},domProps:{value:e.selectedImage.watermarkText},on:{input:function(t){t.target.composing||e.$set(e.selectedImage,"watermarkText",t.target.value)}}})])])])]):a("div",[a("i",[e._v(e._s(this.config.translations.interactions_no_media_selected))])])}),f=[],u=(a("5df3"),a("4f7f"),a("75fc")),p=(a("28a5"),a("01c8")),h=function(e){var t=[];for(var a in e)t.push(encodeURIComponent(a)+"="+encodeURIComponent(e[a]));return t.join("&")},m=function(e){return e[0].toUpperCase()+e.slice(1)},g=function(e){var t=e.split("-"),a=Object(p["a"])(t),i=a[0],n=a.slice(1);return[i].concat(Object(u["a"])(n.map(m))).join("")},v=function(e,t){var a=Math.pow(10,t);return parseFloat(Math.round(e*a)/a).toFixed(t)},b={B:"KB",KB:"MB",MB:"GB",GB:"TB"},_=function e(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"B",i=b[a];return!i||t<1024?"".concat(v(t,2)," ").concat(a):e(t/1024,i)},y=a("4a7a"),w=a.n(y),C={name:"Preview",props:["config","fieldId","selectedImage"],data:function(){return{allTags:[]}},components:{"v-select":w.a},computed:{nonImagePreviewClass:function(){return"video"===this.selectedImage.type?"ng-video":"ng-book"},formattedSize:function(){return _(this.selectedImage.size)}},methods:{handleTagsInput:function(e){this.allTags=Object(u["a"])(new Set([].concat(Object(u["a"])(this.allTags),Object(u["a"])(e)))),this.dispatchChangeEvent()},dispatchChangeEvent:function(){this.$emit("preview-change")}},mounted:function(){this.allTags=Object(u["a"])(this.selectedImage.tags)},watch:{selectedImage:function(){this.allTags=Object(u["a"])(this.selectedImage.tags)}}},x=C,O=(a("ab1a"),a("2877")),F=Object(O["a"])(x,d,f,!1,null,"633dac33",null),I=F.exports,V=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("modal",{attrs:{title:this.config.translations.browse_title},on:{close:function(t){return e.$emit("close")}}},[a("media-facets",{attrs:{config:e.config,tags:e.tags,types:e.types,visibilities:e.visibilities,facets:e.facets,"facets-loading":e.facetsLoading},on:{change:e.handleFacetsChange}}),a("media-gallery",{attrs:{translations:e.config.translations,media:e.media,canLoadMore:e.canLoadMore,selectedMediaId:e.selectedMediaId,loading:e.loading},on:{loadMore:e.handleLoadMore,"media-selected":function(t){return e.$emit("media-selected",t)}}}),e.loading?a("i",{staticClass:"ng-icon ng-spinner"}):e._e()],1)},k=[],j=a("768b"),S=(a("ffc1"),function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"mediaFacets"},[a("div",{staticClass:"body"},[e.types.length>1?a("div",{staticClass:"form-field"},[a("label",{attrs:{for:"type"}},[e._v(e._s(this.config.translations.browse_select_type))]),a("v-select",{attrs:{options:e.types,label:"name",reduce:function(e){return e.id},placeholder:e.facetsLoading?this.config.translations.browse_loading_types:this.config.translations.browse_all_types},on:{input:e.handleTypeChange},model:{value:e.selectedType,callback:function(t){e.selectedType=t},expression:"selectedType"}})],1):e._e(),e.folders&&!this.config.folder?a("div",{staticClass:"form-field"},[a("label",{attrs:{for:"folder"}},[e._v(e._s(this.config.translations.browse_select_folder))]),a("treeselect",{attrs:{multiple:!1,options:e.folders,"load-options":e.loadSubFolders,value:this.config.parentFolder?this.config.parentFolder.id:"",placeholder:e.facetsLoading?this.config.translations.browse_loading_folders:this.config.translations.browse_all_folders,disabled:e.facetsLoading,clearable:!0,beforeClearAll:e.clearFolderField,defaultExpandLevel:1},on:{input:e.handleFolderChange},model:{value:e.selectedFolder,callback:function(t){e.selectedFolder=t},expression:"selectedFolder"}})],1):e._e(),e.tags.length>1?a("div",{staticClass:"form-field"},[a("label",{attrs:{for:"tag"}},[e._v(e._s(this.config.translations.browse_select_tag))]),a("v-select",{attrs:{options:e.tags,label:"name",reduce:function(e){return e.id},placeholder:e.facetsLoading?this.config.translations.browse_loading_tags:this.config.translations.browse_all_tags,disabled:e.facetsLoading},on:{input:e.handleTagChange},model:{value:e.tag,callback:function(t){e.tag=t},expression:"tag"}})],1):e._e(),e.visibilities.length>1?a("div",{staticClass:"form-field"},[a("label",{attrs:{for:"visibilities"}},[e._v(e._s(this.config.translations.browse_select_visibility))]),a("v-select",{attrs:{options:e.visibilities,label:"name",reduce:function(e){return e.id},placeholder:e.facetsLoading?this.config.translations.browse_loading_visibilities:this.config.translations.browse_all_visibilities,disabled:e.facetsLoading},on:{input:e.handleVisibilityChange},model:{value:e.visibility,callback:function(t){e.visibility=t},expression:"visibility"}})],1):e._e(),a("div",{staticClass:"search-wrapper"},[a("span",{staticClass:"search-label"},[e._v(e._s(this.config.translations.search))]),a("div",{staticClass:"search"},[a("input",{directives:[{name:"model",rawName:"v-model",value:e.query,expression:"query"}],attrs:{type:"text",placeholder:this.config.translations.search_placeholder},domProps:{value:e.query},on:{keyup:e.handleQueryChange,keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.preventDefault(),null(t))},input:function(t){t.target.composing||(e.query=t.target.value)}}})])])])])}),M=[],T="all",$="image",E="video",P="raw",z="(all)",R="(root)",L="all",A=a("ca17"),D=a.n(A),B=(a("542c"),{name:"MediaFacets",props:["config","tags","types","visibilities","facets","facetsLoading"],data:function(){return{TYPE_ALL:T,TYPE_IMAGE:$,TYPE_VIDEO:E,TYPE_RAW:P,FOLDER_ALL:z,FOLDER_ROOT:R,TAG_ALL:L,folders:[{id:this.config.parentFolder?this.config.parentFolder.id:R,label:this.config.parentFolder?this.config.parentFolder.label:R,children:null}],selectedFolder:this.facets.folder,selectedType:this.facets.type,query:this.facets.query,tag:this.facets.tag,visibility:this.facets.visibility}},methods:{clearFolderField:function(){return!this.config.parentFolder||(this.selectedFolder=this.config.parentFolder.id,!1)},handleTypeChange:function(e){this.$emit("change",{type:e})},handleFolderChange:function(e){this.selectedFolder=e,"undefined"!==typeof e&&e||(this.selectedFolder=this.config.parentFolder?this.config.parentFolder.id:e),this.$emit("change",{folder:this.selectedFolder})},handleQueryChange:function(){this.$emit("change",{query:this.query})},handleTagChange:function(){this.$emit("change",{tag:this.tag})},handleVisibilityChange:function(){this.$emit("change",{visibility:this.visibility})},loadSubFolders:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(t){var a,i,n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return a=t.parentNode,i={folder:"(root)"===a.id?"":a.id},e.next=4,fetch(this.config.paths.load_folders+"?"+h(i));case 4:return n=e.sent,e.next=7,n.json();case 7:a.children=e.sent,t.callback();case 9:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},components:{"v-select":w.a,treeselect:D.a}}),U=B,N=(a("c345"),Object(O["a"])(U,S,M,!1,null,"278bb214",null)),q=N.exports,G=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"media-gallery"},[a("div",{class:e.loading?"items loading":"items"},[e.media.length?e._e():a("div",{staticClass:"folder-empty"},[a("span",{staticClass:"ngrm-icon-folder"}),a("span",[a("strong",[e._v(e._s(this.translations.media_gallery_empty_folder))]),e._v(e._s(this.translations.media_gallery_upload_media))])]),e._l(e.media,(function(t){return a("div",{key:t.id,staticClass:"media",class:{selected:t.remoteId===e.selectedMediaId}},["image"===t.type||"video"===t.type&&""!==t.browseUrl?a("div",{staticClass:"media-container"},[a("img",{staticClass:"img",attrs:{src:t.browseUrl,alt:t.filename}}),a("Label",{staticClass:"filename"},[e._v(e._s(t.filename))]),a("div",{staticClass:"size-description"},["public"===t.visibility?a("i",{staticClass:"fa fa-solid fa-globe"},[e._v("  ")]):e._e(),"private"===t.visibility?a("i",{staticClass:"fa fa-eye-slash"},[e._v("  ")]):e._e(),"protected"===t.visibility?a("i",{staticClass:"fa fa-lock"},[e._v("  ")]):e._e(),a("span",{staticClass:"format"},[e._v(e._s(t.format))]),e._v(" - "+e._s(t.width)+" x "+e._s(t.height)+" - "+e._s(e.showFilesize(t))+"\n ")])],1):a("div",{staticClass:"media-container"},[a("span",{staticClass:"file-placeholder"},[a("span",{staticClass:"icon-doc"},["pdf"===t.format?a("i",{staticClass:"fa fa-file-pdf-o"}):"zip"===t.format||"rar"===t.format?a("i",{staticClass:"fa fa-file-archive-o"}):"ppt"===t.format||"pptx"===t.format?a("i",{staticClass:"fa fa-file-powerpoint-o"}):"doc"===t.format||"docx"===t.format?a("i",{staticClass:"fa fa-file-word-o"}):"xls"===t.format||"xlsx"===t.format?a("i",{staticClass:"fa fa-file-excel-o"}):"aac"===t.format||"aiff"===t.format||"amr"===t.format||"flac"===t.format||"m4a"===t.format||"mp3"===t.format||"ogg"===t.format||"opus"===t.format||"wav"===t.format?a("i",{staticClass:"fa fa-file-audio-o"}):"txt"===t.format?a("i",{staticClass:"fa fa-lg fa-file-text"}):a("i",{staticClass:"fa fa-file"})])]),a("Label",{staticClass:"filename"},[e._v(e._s(t.filename))]),a("div",{staticClass:"size-description"},["public"===t.visibility?a("i",{staticClass:"fa fa-solid fa-globe"},[e._v("  ")]):e._e(),"private"===t.visibility?a("i",{staticClass:"fa fa-eye-slash"},[e._v("  ")]):e._e(),"protected"===t.visibility?a("i",{staticClass:"fa fa-lock"},[e._v("  ")]):e._e(),a("span",{staticClass:"format"},[e._v(e._s(t.format))]),e._v(" - "+e._s(e.showFilesize(t))+"\n ")])],1),a("button",{staticClass:"btn btn-blue select-btn",attrs:{type:"button"},on:{click:function(a){return e.$emit("media-selected",t)}}},[e._v(e._s(e._self.translations.media_gallery_select))])])}))],2),e.canLoadMore?a("div",{staticClass:"load-more-wrapper"},[a("button",{staticClass:"btn btn-blue",attrs:{type:"button"},on:{click:function(t){return e.$emit("loadMore")}}},[e._v(e._s(this.translations.media_gallery_load_more))])]):e._e()])},W=[],Y=a("94df"),J=a.n(Y),K={name:"MediaGallery",props:["translations","media","canLoadMore","onLoadMore","selectedMediaId","loading"],methods:{showFilesize:function(e){return J()(e.size)}}},Q=K,H=(a("bdf2"),Object(O["a"])(Q,G,W,!1,null,"5aa52c90",null)),X=H.exports,Z=a("b012"),ee=a.n(Z),te=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"ngrm-overlay"},[a("div",{staticClass:"media-modal"},[a("div",{staticClass:"title"},[e._v("\n "+e._s(e.title)+"\n "),a("span",{staticClass:"close",on:{click:e.close}},[a("span",{staticClass:"ngrm-icon-cancel"})])]),a("div",{staticClass:"body"},[e._t("default")],2)])])},ae=[],ie={name:"Modal",props:["title"],methods:{close:function(){this.$emit("close")}}},ne=ie,se=(a("11ef"),a("a301"),Object(O["a"])(ne,te,ae,!1,null,"9d33d07a",null)),oe=se.exports;function le(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,i)}return a}function re(e){for(var t=1;t0&&void 0!==p[0]?p[0]:{patch:!1},a=t.patch,this.loading=!0,this.abortController&&this.abortController.abort(),this.abortController=new AbortController,i={limit:ce,offset:a?this.media.length:0},this.facets.query&&(i["query"]=this.facets.query),this.config.allowedTypes.length>0&&(i["type"]=this.config.allowedTypes),this.facets.type&&(i["type"]=this.facets.type),this.facets.folder&&(i["folder"]=this.facets.folder===R?"":this.facets.folder),this.config.allowedTags.length>0&&(i["tag"]=this.config.allowedTags),this.facets.tag&&(i["tag"]=this.facets.tag),this.config.allowedVisibilities.length>0&&(i["visibility"]=this.config.allowedVisibilities),this.facets.visibility&&(i["visibility"]=this.facets.visibility),a&&this.nextCursor&&(i["next_cursor"]=this.nextCursor),n="",s=0,o=Object.entries(i);s-1:e.newSelection},on:{change:function(a){var i=e.newSelection,n=a.target,s=!!n.checked;if(Array.isArray(i)){var o=t,l=e._i(i,o);n.checked?l<0&&(e.newSelection=i.concat([o])):l>-1&&(e.newSelection=i.slice(0,l).concat(i.slice(l+1)))}else e.newSelection=s}}}),a("label",{attrs:{for:t}},[a("span",{staticClass:"name"},[e._v(e._s(t))]),a("span",{staticClass:"formatted-size"},[e._v(e._s(e.formattedSize(t)))])]),e.isVariationSelectable(t)?e._e():a("div",{staticClass:"legend-not-selectable"},[a("span",[e._v(e._s(e._self.translations.crop_media_too_small))])])])})),0),a("div",{staticClass:"selectedVariations"},[a("ul",e._l(e.selectedVariations,(function(t){return a("li",{key:t,class:{set:!!e.allVariationValues[t],selected:e.selectedVariation===t,disabled:!e.isVariationSelectable(t)},on:{click:function(a){return e.handleVariationClicked(t)}}},[a("div",[a("span",{staticClass:"name"},[e._v(e._s(t))]),a("span",{staticClass:"formatted-size"},[e._v(e._s(e.formattedSize(t)))])]),e.addingVariations?e._e():a("a",[a("span",{staticClass:"circle-orange"}),a("span",{staticClass:"ngrm-icon-trash",on:{click:function(a){return e.removeItem(t)}}})])])})),0)])])},ve=[],be=(a("7f7f"),{name:"CropSizes",props:["translations","availableVariations","allVariationValues","imageSize","selectedVariation"],data:function(){return{newSelection:[],addingVariations:!1}},computed:{unselectedVariations:function(){var e=Object.keys(this.availableVariations),t=Object.keys(this.allVariationValues);return e.difference(t)},selectedVariations:function(){return Object.getOwnPropertyNames(this.allVariationValues)}},methods:{handleAddCropSize:function(){this.addingVariations=!0},handleCancel:function(){this.addingVariations=!1,this.newSelection=[]},handleAdd:function(){this.$emit("addedVariations",this.newSelection),this.newSelection=[],this.addingVariations=!1},removeItem:function(e){this.$emit("removedVariation",e)},formattedSize:function(e){return"".concat(this.availableVariations[e][0]," x ").concat(this.availableVariations[e][1])},isVariationSelectable:function(e){var t=Object(j["a"])(this.availableVariations[e],2),a=t[0],i=t[1];return this.imageSize.width>=a&&this.imageSize.height>=i},handleVariationClicked:function(e){this.isVariationSelectable(e)&&this.$emit("selected",e)}}}),_e=be,ye=(a("bdd7"),Object(O["a"])(_e,ge,ve,!1,null,"ad171770",null)),we=ye.exports,Ce=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"crop"},[a("div",{ref:"cropper",staticClass:"cropper",style:e.cropperStyle},[a("img",{ref:"image",attrs:{src:e.src}}),a("div",{ref:"buttons",staticClass:"buttons",style:e.applyButtonStyle},[a("button",{staticClass:"btn btn-blue",attrs:{type:"button"},on:{click:e.handleReset}},[a("span",{staticClass:"ngrm-icon-ccw"}),a("span",[e._v(e._s(this.translations.crop_reset))])]),a("button",{staticClass:"btn btn-blue",attrs:{type:"button"},on:{click:e.handleApply}},[a("span",{staticClass:"ngrm-icon-ok"}),a("span",[e._v(e._s(this.translations.crop_apply))])])])]),a("div",[a("h4",[e._v(e._s(this.translations.crop_preview))]),a("div",{ref:"preview",staticClass:"preview"})])])},xe=[],Oe=a("5435"),Fe={name:"Crop",props:["translations","value","variation","src","imageSize"],mounted:function(){this.setCropper()},beforeDestroy:function(){this.destroyCropper()},data:function(){return{crop:{},cropper:null}},methods:{setCropper:function(){var e,t=this.value||{},a=t.x,i=t.y,n=t.w,s=t.h,o={x:a,y:i,width:n,height:s},l=Object(j["a"])(this.variation,2),r=l[0],d=l[1],f=r>0&&d>0?r/d:void 0;this.destroyCropper();this.$refs.cropper.clientWidth,this.imageSize.width;this.cropper=new Oe["a"](this.$refs.image,(e={viewMode:2,dragMode:"none",autoCrop:!0,data:o,aspectRatio:f,guides:!0,movable:!1,rotatable:!1},Object(c["a"])(e,"guides",!1),Object(c["a"])(e,"center",!1),Object(c["a"])(e,"zoomable",!1),Object(c["a"])(e,"scalable",!0),Object(c["a"])(e,"minCropBoxWidth",50),Object(c["a"])(e,"minCropBoxHeight",50),Object(c["a"])(e,"crop",this.handleCrop),Object(c["a"])(e,"preview",this.$refs.preview),e)),this.cropper.setData(o)},handleCrop:function(e){this.crop=this.cropper.getData(!0)},destroyCropper:function(){this.cropper&&this.cropper.destroy()},handleReset:function(){this.cropper.reset()},handleApply:function(){var e=this.cropper.getData(!0),t=e.x,a=e.y,i=e.width,n=e.height;this.$emit("change",{x:t,y:a,w:i,h:n})}},computed:{applyButtonStyle:function(){var e=this.crop,t=e.x,a=e.y,i=e.width,n=e.height,s=this.$refs.buttons?this.$refs.buttons.clientWidth:0,o=this.$refs.cropper?this.$refs.cropper.clientWidth/this.imageSize.width:1;return{top:"".concat((a+n)*o+10,"px"),left:"".concat((t+i)*o-s-1,"px")}},cropperStyle:function(){var e=this.imageSize.height/this.imageSize.width*100;return{"padding-bottom":"".concat(e,"%"),height:"0px",width:"100%"}}}},Ie=Fe,Ve=(a("c66d"),Object(O["a"])(Ie,Ce,xe,!1,null,"5f73791e",null)),ke=Ve.exports,je=function(e){return function(t){return Object.keys(t).reduce((function(a,i){return e(t[i],i)&&(a[i]=t[i]),a}),{})}},Se=function(e){return function(t){return!e(t)}},Me=function(e){return function(t){return e===t}},Te=function(e){return!!e},$e=Se(Me(void 0));function Ee(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,i)}return a}function Pe(e){for(var t=1;t1?a("v-select",{attrs:{options:e.visibilities,label:"name",reduce:function(e){return e.id},clearable:!1},model:{value:e.visibility,callback:function(t){e.visibility=t},expression:"visibility"}}):e._e(),a("input",{directives:[{name:"model",rawName:"v-model",value:e.overwrite,expression:"overwrite"}],attrs:{type:"checkbox",id:"ngrm-upload-overwrite"},domProps:{checked:Array.isArray(e.overwrite)?e._i(e.overwrite,null)>-1:e.overwrite},on:{change:function(t){var a=e.overwrite,i=t.target,n=!!i.checked;if(Array.isArray(a)){var s=null,o=e._i(a,s);i.checked?o<0&&(e.overwrite=a.concat([s])):o>-1&&(e.overwrite=a.slice(0,o).concat(a.slice(o+1)))}else e.overwrite=n}}}),a("label",{attrs:{for:"ngrm-upload-overwrite"}},[e._v(e._s(this.config.translations.upload_checkbox_overwrite))]),a("button",{staticClass:"btn btn-blue",attrs:{type:"button",disabled:""===e.filename||""===e.visibility},on:{click:e.upload}},[e._v("\n "+e._s(this.config.translations.upload_button_upload)+"\n ")])],1)],1),e.loading?a("i",{staticClass:"ng-icon ng-spinner"}):e._e()])},Be=[],Ue=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"folder-gallery"},[a("div",{class:e.loading?"items loading":"items"},[a("div",{staticClass:"breadcrumbs"},[a("span",[e._v(e._s(this.config.translations.upload_breadcrumbs_info)+" ")]),e._l(e.breadcrumbs,(function(t,i){return a("span",{key:i},[0!==i?a("span",[e._v(" / ")]):e._e(),i!==e.breadcrumbs.length-1?a("a",{attrs:{href:"#"},on:{click:function(a){return e.openFolder(t.id)}}},[e._v("\n "+e._s(t.label)+"\n ")]):a("span",[e._v(e._s(t.label))])])}))],2),e.folders.length>0||e.allowCreate?a("div",{staticClass:"info"},[a("i",{staticClass:"fa fa-info-circle"}),e._v("\n "+e._s(this.config.translations.upload_info_text)+"\n ")]):e._e(),e._l(e.folders,(function(t){return a("div",{key:t.id,staticClass:"media",class:{selected:t.id===e._self.folder}},[a("div",{staticClass:"media-container",on:{dblclick:function(a){return e.openFolder(t.id)}}},[e._m(0,!0),a("Label",{staticClass:"filename"},[e._v(e._s(t.label))])],1),a("button",{staticClass:"btn btn-blue select-btn",attrs:{type:"button"},on:{click:function(a){return e.$emit("select",t.id)}}},[e._v("\n "+e._s(e._self.config.translations.upload_button_select)+"\n ")])])})),e.allowCreate?a("div",{staticClass:"media new-folder"},[a("div",{staticClass:"media-container"},[e._m(1),a("input",{directives:[{name:"model",rawName:"v-model",value:e.newFolder,expression:"newFolder"}],attrs:{type:"text",placeholder:this.config.translations.upload_placeholder_new_folder},domProps:{value:e.newFolder},on:{input:function(t){t.target.composing||(e.newFolder=t.target.value)}}})]),a("button",{staticClass:"btn btn-blue select-btn",attrs:{type:"button",disabled:null===e.newFolder},on:{click:e.createNewFolder}},[e._v("\n "+e._s(this.config.translations.upload_button_create)+"\n ")])]):e._e()],2),e.loading?a("i",{staticClass:"ng-icon ng-spinner"}):e._e()])},Ne=[function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("span",{staticClass:"file-placeholder"},[a("span",{staticClass:"icon-doc"},[a("i",{staticClass:"fa fa-folder"})])])},function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("span",{staticClass:"file-placeholder"},[a("span",{staticClass:"icon-doc"},[a("i",{staticClass:"fa fa-folder"})])])}],qe=a("bc3a"),Ge=a.n(qe),We={name:"SelectFolder",props:["config","selectedFolder"],data:function(){return{folders:[],newFolder:null,breadcrumbs:[],loading:!1,allowCreate:!0,folder:this.selectedFolder}},methods:{openFolder:function(e){this.folder=e,this.$emit("change",this.folder),this.loadSubFolders(e)},loadSubFolders:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(t){var a,i,n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.loading=!0,a=this.config.paths.load_folders,t&&(i={folder:t===R?"":t},a+="?"+h(i)),e.next=5,fetch(a);case 5:return n=e.sent,e.next=8,n.json();case 8:this.folders=e.sent,this.generateBreadcrumbs(t),this.newFolder=null,this.loading=!1;case 12:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}(),generateBreadcrumbs:function(e){var t=this;this.breadcrumbs=[];var a={id:null,label:this.config.translations.upload_root_folder};if(null!==e){var i=e.split("/"),n=[],s=[];this.config.parentFolder&&(s=this.config.parentFolder.id.split("/"),a={id:this.config.parentFolder.id,label:this.config.parentFolder.label}),this.config.folder&&(s=this.config.folder.id.split("/"),a={id:this.config.folder.id,label:this.config.folder.label}),this.breadcrumbs.push(a),i.forEach((function(e,a){n.push(e),s.indexOf(e)<0&&t.breadcrumbs.push({id:n.join("/"),label:e})}))}else this.breadcrumbs.push(a)},createNewFolder:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.loading=!0,t=new FormData,this.folder&&t.append("parent",this.folder),t.append("folder",this.newFolder),e.next=6,Ge.a.post(this.config.paths.create_folder,t);case 6:this.folders.push({id:null!==this.folder?this.folder+"/"+this.newFolder:this.newFolder,label:this.newFolder}),this.newFolder=null,this.loading=!1;case 9:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},created:function(){if(this.config.folder)return e=this.config.folder.id,this.allowCreate=!1,this.folder=e,this.$emit("change",this.folder),void this.generateBreadcrumbs(e);var e=null;this.config.parentFolder&&(e=this.config.parentFolder.id),this.openFolder(e)}},Ye=We,Je=(a("9ea2"),Object(O["a"])(Ye,Ue,Ne,!1,null,"7c5b0504",null)),Ke=Je.exports,Qe={name:"UploadModal",props:["config","file","visibilities"],data:function(){return{loading:!1,selectedFolder:"",filename:this.file.name,visibility:this.visibilities.length>0?this.visibilities[0].id:"",overwrite:!1,error:"",existingResourceButton:!1,existingResource:null}},components:{"select-folder":Ke,modal:oe,"v-select":w.a},methods:{handleFolderChange:function(e){this.selectedFolder=e},upload:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(){var t,a,i,n,s,o,l=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:for(this.loading=!0,t=new FormData,t.append("file",this.file),t.append("filename",this.filename),t.append("folder",this.selectedFolder),t.append("overwrite",this.overwrite),t.append("visibility",this.visibility),a=0,i=Object.entries(this.config.uploadContext);a0&&-1===l.config.allowedTypes.indexOf(e.data.type)?(l.error=l.config.translations.upload_error_unsupported_resource_type+l.config.allowedTypes.join(", "),l.loading=!1):l.$emit("uploaded",e.data)})).catch((function(e){409===e.response.status?(l.error=l.config.translations.upload_error_existing_resource,l.existingResourceButton=!0,l.existingResource=e.response.data,l.loading=!1):(l.error=e.response.data.detail?e.response.data.detail:"Error "+e.response.status+" - "+e.response.statusText,l.loading=!1)}));case 10:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},watch:{visibilities:function(){this.visibility=this.visibilities.length>0?this.visibilities[0].id:""}}},He=Qe,Xe=(a("20d1"),Object(O["a"])(He,De,Be,!1,null,"30bcedc5",null)),Ze=Xe.exports;function et(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,i)}return a}function tt(e){for(var t=1;t0},stringifiedVariations:function(){return JSON.stringify(je(Te)(this.selectedImage.variations))}},data:function(){return{mediaModalOpen:!1,cropModalOpen:!1,uploadModalOpen:!1,types:[],folders:[],tags:[],visibilities:[],facetsLoading:!0,newFile:null}},methods:{dispatchVanillaChangeEvent:function(){this.$nextTick((function(){this.$el.dispatchEvent(new CustomEvent("ngrm-change",{detail:{inputFields:this.config.inputFields}}))}))},prepareDomForModal:function(){var e=document.querySelector(".ez-page-builder-wrapper");e&&(e.style.transform="none")},resetDomAfterModal:function(){var e=document.querySelector(".ez-page-builder-wrapper");e&&e.removeAttribute("style")},handleMediaModalClose:function(){this.mediaModalOpen=!1,this.resetDomAfterModal(),this.dispatchVanillaChangeEvent()},handleCropModalClose:function(){this.cropModalOpen=!1,this.resetDomAfterModal(),this.dispatchVanillaChangeEvent()},handleUploadModalClose:function(){this.uploadModalOpen=!1,this.dispatchVanillaChangeEvent()},handleMediaSelected:function(e){this.selectedImage={id:e.remoteId,name:e.filename,type:e.type,format:e.format,url:e.url,previewUrl:e.previewUrl,alternateText:e.altText,caption:e.caption,watermarkText:this.selectedImage.watermarkText,tags:e.tags,size:e.size,variations:{},height:e.height,width:e.width},this.mediaModalOpen=!1,this.dispatchVanillaChangeEvent()},handleVariationCropChange:function(e){this.selectedImage=tt({},this.selectedImage,{variations:tt({},this.selectedImage.variations,{},e)}),this.dispatchVanillaChangeEvent()},handleResourceUploaded:function(e){this.selectedImage={id:e.remoteId,name:e.filename,type:e.type,format:e.format,url:e.url,previewUrl:e.previewUrl,alternateText:e.altText,caption:e.caption,watermarkText:this.selectedImage.watermarkText,tags:e.tags,size:e.size,variations:{},height:e.height,width:e.width},this.uploadModalOpen=!1,this.dispatchVanillaChangeEvent()},handleCropClicked:function(){this.cropModalOpen=!0,this.prepareDomForModal()},handleRemoveMediaClicked:function(){this.selectedImage={id:"",name:"",type:"image",format:"",url:"",previewUrl:"",alternateText:"",caption:"",watermarkText:this.selectedImage.watermarkText,tags:[],size:0,variations:{},height:0,width:0},this.$refs.fileUploadInput.value=null,this.dispatchVanillaChangeEvent()},fetchFacets:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(){var t,a,i=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,fetch(this.config.paths.load_facets);case 2:return t=e.sent,e.next=5,t.json();case 5:a=e.sent,this.types=[],this.tags=[],this.visibilities=[],a.types.forEach((function(e){-1===i.config.allowedTypes.indexOf(e.id)&&0!==i.config.allowedTypes.length||i.types.push(e)})),a.tags.forEach((function(e){-1===i.config.allowedTags.indexOf(e.id)&&0!==i.config.allowedTags.length||i.tags.push(e)})),a.visibilities.forEach((function(e){-1===i.config.allowedVisibilities.indexOf(e.id)&&0!==i.config.allowedVisibilities.length||i.visibilities.push(e)})),this.facetsLoading=!1;case 13:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),handleBrowseMediaClicked:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:this.mediaModalOpen=!0,this.prepareDomForModal(),this.fetchFacets();case 3:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),handleFileInputChange:function(){this.fetchFacets(),this.uploadModalOpen=!0,this.newFile=this.$refs.fileUploadInput.files.item(0)}},watch:{selectedImage:function(){this.$emit("selectedImageChanged",this.selectedImage)}},mounted:function(){this.$nextTick((function(){var e=document.querySelector(".ngrm-model-portal");document.body.prepend(e)}))}},it=at,nt=Object(O["a"])(it,o,l,!1,null,null,null),st=nt.exports,ot={bind:function(e,t,a){var i=g(t.arg);a.context[i]=t.value}},lt=(a("b39d"),function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("input",{directives:[{name:"model",rawName:"v-model",value:e.selectedFolder,expression:"selectedFolder"}],attrs:{type:"hidden",name:e.config.inputFields.folder},domProps:{value:e.selectedFolder},on:{input:function(t){t.target.composing||(e.selectedFolder=t.target.value)}}}),e.selectedFolder?a("span",[a("i",{staticClass:"fa fa-folder"}),e._v(" "+e._s(this.selectedFolder))]):a("span",[a("i",[e._v("No folder selected")])]),a("div",{staticClass:"ngremotemedia-buttons"},[e.selectedFolder?a("input",{attrs:{type:"button",value:"Remove folder"},on:{click:e.handleFolderRemove}}):e._e(),a("input",{attrs:{type:"button",value:"Select folder"},on:{click:e.handleSelectFolderModalOpen}})]),e.selectFolderModalOpen?a("modal",{attrs:{title:"Select folder"},on:{close:e.handleSelectFolderModalClose}},[a("select-folder",{attrs:{config:e.config,"selected-folder":e.selectedFolder},on:{select:e.handleFolderSelect}})],1):e._e()],1)}),rt=[],ct={name:"SelectFolderInteraction",props:["config","selectedFolder"],components:{"select-folder":Ke,modal:oe},data:function(){return{selectFolderModalOpen:!1}},methods:{handleSelectFolderModalOpen:function(){console.log(this.selectedFolder),this.selectFolderModalOpen=!0},handleSelectFolderModalClose:function(){this.selectFolderModalOpen=!1},handleFolderSelect:function(e){this.selectedFolder=e,this.handleSelectFolderModalClose()},handleFolderRemove:function(){this.selectedFolder=null}}},dt=ct,ft=Object(O["a"])(dt,lt,rt,!1,null,null,null),ut=ft.exports;i["default"].config.productionTip=!1,i["default"].use(s.a);var pt=function(e){window["ngrm_interactions_vue_".concat(e.dataset.id)]=new i["default"]({el:e,directives:{init:ot},data:{config:{paths:{browse_resources:"/resource/browse",upload_resources:"/resource/upload",load_facets:"/facets/load",load_folders:"/folder/load",create_folder:"/folder/create"},translations:{},inputFields:{locationId:"locationId",remoteId:"remoteId",type:"type",altText:"altText",caption:"caption",tags:"tags[]",cropSettings:"cropSettings",source:"source",watermarkText:"watermarkText"},availableVariations:[],allowedVisibilities:[],allowedTypes:[],allowedTags:[],parentFolder:null,folder:null,uploadContext:{},disableUpload:!1},selectedImage:{id:"",name:"",type:"image",format:"",url:"",browse_url:"",previewUrl:"",alternateText:"",caption:"",watermarkText:"",tags:[],size:"",variations:{},height:0,width:0}},components:{interactions:st}})},ht=function(e){window["ngrm_select_folder_vue_".concat(e.dataset.id)]=new i["default"]({el:e,directives:{init:ot},data:{config:{paths:{load_folders:"/folder/load",create_folder:"/folder/create"},translations:{},inputFields:{folder:"folder"}},selectedFolder:null},components:{"select-folder-interaction":ut}})},mt=function(){for(var e=document.getElementsByClassName("ngremotemedia-container"),t=0;t0?e.config.allowedTags:e.allTags,multiple:"",taggable:0===e.config.allowedTags.length},on:{input:e.handleTagsInput},model:{value:e.selectedImage.tags,callback:function(t){e.$set(e.selectedImage,"tags",t)},expression:"selectedImage.tags"}}),a("select",{directives:[{name:"model",rawName:"v-model",value:e.selectedImage.tags,expression:"selectedImage.tags"}],staticClass:"ngremotemedia-newtags",attrs:{hidden:"",name:this.config.inputFields.tags,multiple:"multiple"},on:{change:function(t){var a=Array.prototype.filter.call(t.target.options,(function(e){return e.selected})).map((function(e){var t="_value"in e?e._value:e.value;return t}));e.$set(e.selectedImage,"tags",t.target.multiple?a:a[0])}}},e._l(e.allTags,(function(t){return a("option",{key:t},[e._v(e._s(t))])})),0)],1),a("div",{staticClass:"ngremotemedia-watermark-text"},[a("span",{staticClass:"help-block description"},[e._v("\n "+e._s(this.config.translations.preview_watermark_text)+"\n "),a("i",{staticClass:"fa fa-info-circle",attrs:{"data-toggle":"tooltip","data-placement":"right",title:this.config.translations.preview_watermark_text_info}})]),a("input",{directives:[{name:"model",rawName:"v-model",value:e.selectedImage.watermarkText,expression:"selectedImage.watermarkText"}],staticClass:"media-watermarktext data",attrs:{type:"text",name:this.config.inputFields.watermarkText},domProps:{value:e.selectedImage.watermarkText},on:{input:function(t){t.target.composing||e.$set(e.selectedImage,"watermarkText",t.target.value)}}})])])])]):a("div",[a("i",[e._v(e._s(this.config.translations.interactions_no_media_selected))])])}),f=[],u=(a("5df3"),a("4f7f"),a("75fc")),p=(a("28a5"),a("01c8")),h=function(e){var t=[];for(var a in e)t.push(encodeURIComponent(a)+"="+encodeURIComponent(e[a]));return t.join("&")},m=function(e){return e[0].toUpperCase()+e.slice(1)},g=function(e){var t=e.split("-"),a=Object(p["a"])(t),i=a[0],n=a.slice(1);return[i].concat(Object(u["a"])(n.map(m))).join("")},v=function(e,t){var a=Math.pow(10,t);return parseFloat(Math.round(e*a)/a).toFixed(t)},b={B:"KB",KB:"MB",MB:"GB",GB:"TB"},_=function e(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"B",i=b[a];return!i||t<1024?"".concat(v(t,2)," ").concat(a):e(t/1024,i)},y=a("4a7a"),w=a.n(y),C={name:"Preview",props:["config","fieldId","selectedImage"],data:function(){return{allTags:[]}},components:{"v-select":w.a},computed:{nonImagePreviewClass:function(){return"video"===this.selectedImage.type?"ng-video":"ng-book"},formattedSize:function(){return _(this.selectedImage.size)}},methods:{handleTagsInput:function(e){this.allTags=Object(u["a"])(new Set([].concat(Object(u["a"])(this.allTags),Object(u["a"])(e)))),this.dispatchChangeEvent()},dispatchChangeEvent:function(){this.$emit("preview-change")}},mounted:function(){this.allTags=Object(u["a"])(this.selectedImage.tags)},watch:{selectedImage:function(){this.allTags=Object(u["a"])(this.selectedImage.tags)}}},x=C,O=(a("ab1a"),a("2877")),I=Object(O["a"])(x,d,f,!1,null,"633dac33",null),F=I.exports,V=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("modal",{attrs:{title:this.config.translations.browse_title},on:{close:function(t){return e.$emit("close")}}},[a("media-facets",{attrs:{config:e.config,tags:e.tags,types:e.types,visibilities:e.visibilities,facets:e.facets,"facets-loading":e.facetsLoading},on:{change:e.handleFacetsChange}}),a("media-gallery",{attrs:{translations:e.config.translations,media:e.media,canLoadMore:e.canLoadMore,selectedMediaId:e.selectedMediaId,loading:e.loading},on:{loadMore:e.handleLoadMore,"media-selected":function(t){return e.$emit("media-selected",t)}}}),e.loading?a("i",{staticClass:"ng-icon ng-spinner"}):e._e()],1)},k=[],j=a("768b"),S=(a("ffc1"),function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"mediaFacets"},[a("div",{staticClass:"body"},[e.types.length>1?a("div",{staticClass:"form-field"},[a("label",{attrs:{for:"type"}},[e._v(e._s(this.config.translations.browse_select_type))]),a("v-select",{attrs:{options:e.types,label:"name",reduce:function(e){return e.id},placeholder:e.facetsLoading?this.config.translations.browse_loading_types:this.config.translations.browse_all_types},on:{input:e.handleTypeChange},model:{value:e.selectedType,callback:function(t){e.selectedType=t},expression:"selectedType"}})],1):e._e(),e.folders&&!this.config.folder?a("div",{staticClass:"form-field"},[a("label",{attrs:{for:"folder"}},[e._v(e._s(this.config.translations.browse_select_folder))]),a("treeselect",{attrs:{multiple:!1,options:e.folders,"load-options":e.loadSubFolders,value:this.config.parentFolder?this.config.parentFolder.id:"",placeholder:e.facetsLoading?this.config.translations.browse_loading_folders:this.config.translations.browse_all_folders,disabled:e.facetsLoading,clearable:!0,beforeClearAll:e.clearFolderField,defaultExpandLevel:1},on:{input:e.handleFolderChange},model:{value:e.selectedFolder,callback:function(t){e.selectedFolder=t},expression:"selectedFolder"}})],1):e._e(),e.tags.length>1?a("div",{staticClass:"form-field"},[a("label",{attrs:{for:"tag"}},[e._v(e._s(this.config.translations.browse_select_tag))]),a("v-select",{attrs:{options:e.tags,label:"name",reduce:function(e){return e.id},placeholder:e.facetsLoading?this.config.translations.browse_loading_tags:this.config.translations.browse_all_tags,disabled:e.facetsLoading},on:{input:e.handleTagChange},model:{value:e.tag,callback:function(t){e.tag=t},expression:"tag"}})],1):e._e(),e.visibilities.length>1?a("div",{staticClass:"form-field"},[a("label",{attrs:{for:"visibilities"}},[e._v(e._s(this.config.translations.browse_select_visibility))]),a("v-select",{attrs:{options:e.visibilities,label:"name",reduce:function(e){return e.id},placeholder:e.facetsLoading?this.config.translations.browse_loading_visibilities:this.config.translations.browse_all_visibilities,disabled:e.facetsLoading},on:{input:e.handleVisibilityChange},model:{value:e.visibility,callback:function(t){e.visibility=t},expression:"visibility"}})],1):e._e(),a("div",{staticClass:"search-wrapper"},[a("span",{staticClass:"search-label"},[e._v(e._s(this.config.translations.search))]),a("div",{staticClass:"search"},[a("input",{directives:[{name:"model",rawName:"v-model",value:e.query,expression:"query"}],attrs:{type:"text",placeholder:this.config.translations.search_placeholder},domProps:{value:e.query},on:{keyup:e.handleQueryChange,keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.preventDefault(),null(t))},input:function(t){t.target.composing||(e.query=t.target.value)}}})])])])])}),M=[],T="all",$="image",E="video",P="raw",z="(all)",R="(root)",L="all",A=a("ca17"),D=a.n(A),U=(a("542c"),{name:"MediaFacets",props:["config","tags","types","visibilities","facets","facetsLoading"],data:function(){return{TYPE_ALL:T,TYPE_IMAGE:$,TYPE_VIDEO:E,TYPE_RAW:P,FOLDER_ALL:z,FOLDER_ROOT:R,TAG_ALL:L,folders:[{id:this.config.parentFolder?this.config.parentFolder.id:R,label:this.config.parentFolder?this.config.parentFolder.label:R,children:null}],selectedFolder:this.facets.folder,selectedType:this.facets.type,query:this.facets.query,tag:this.facets.tag,visibility:this.facets.visibility}},methods:{clearFolderField:function(){return!this.config.parentFolder||(this.selectedFolder=this.config.parentFolder.id,!1)},handleTypeChange:function(e){this.$emit("change",{type:e})},handleFolderChange:function(e){this.selectedFolder=e,"undefined"!==typeof e&&e||(this.selectedFolder=this.config.parentFolder?this.config.parentFolder.id:e),this.$emit("change",{folder:this.selectedFolder})},handleQueryChange:function(){this.$emit("change",{query:this.query})},handleTagChange:function(){this.$emit("change",{tag:this.tag})},handleVisibilityChange:function(){this.$emit("change",{visibility:this.visibility})},loadSubFolders:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(t){var a,i,n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return a=t.parentNode,i={folder:"(root)"===a.id?"":a.id},e.next=4,fetch(this.config.paths.load_folders+"?"+h(i));case 4:return n=e.sent,e.next=7,n.json();case 7:a.children=e.sent,t.callback();case 9:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},components:{"v-select":w.a,treeselect:D.a}}),B=U,N=(a("c345"),Object(O["a"])(B,S,M,!1,null,"278bb214",null)),q=N.exports,G=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"media-gallery"},[a("div",{class:e.loading?"items loading":"items"},[e.media.length?e._e():a("div",{staticClass:"folder-empty"},[a("span",{staticClass:"ngrm-icon-folder"}),a("span",[a("strong",[e._v(e._s(this.translations.media_gallery_empty_folder))]),e._v(e._s(this.translations.media_gallery_upload_media))])]),e._l(e.media,(function(t){return a("div",{key:t.id,staticClass:"media",class:{selected:t.remoteId===e.selectedMediaId}},["image"===t.type||"video"===t.type&&""!==t.browseUrl?a("div",{staticClass:"media-container"},[a("img",{staticClass:"img",attrs:{src:t.browseUrl,alt:t.filename}}),a("Label",{staticClass:"filename"},[e._v(e._s(t.filename))]),a("div",{staticClass:"size-description"},["public"===t.visibility?a("i",{staticClass:"fa fa-solid fa-globe"},[e._v("  ")]):e._e(),"private"===t.visibility?a("i",{staticClass:"fa fa-eye-slash"},[e._v("  ")]):e._e(),"protected"===t.visibility?a("i",{staticClass:"fa fa-lock"},[e._v("  ")]):e._e(),a("span",{staticClass:"format"},[e._v(e._s(t.format))]),e._v(" - "+e._s(t.width)+" x "+e._s(t.height)+" - "+e._s(e.showFilesize(t))+"\n ")])],1):a("div",{staticClass:"media-container"},[a("span",{staticClass:"file-placeholder"},[a("span",{staticClass:"icon-doc"},["pdf"===t.format?a("i",{staticClass:"fa fa-file-pdf-o"}):"zip"===t.format||"rar"===t.format?a("i",{staticClass:"fa fa-file-archive-o"}):"ppt"===t.format||"pptx"===t.format?a("i",{staticClass:"fa fa-file-powerpoint-o"}):"doc"===t.format||"docx"===t.format?a("i",{staticClass:"fa fa-file-word-o"}):"xls"===t.format||"xlsx"===t.format?a("i",{staticClass:"fa fa-file-excel-o"}):"aac"===t.format||"aiff"===t.format||"amr"===t.format||"flac"===t.format||"m4a"===t.format||"mp3"===t.format||"ogg"===t.format||"opus"===t.format||"wav"===t.format?a("i",{staticClass:"fa fa-file-audio-o"}):"txt"===t.format?a("i",{staticClass:"fa fa-lg fa-file-text"}):a("i",{staticClass:"fa fa-file"})])]),a("Label",{staticClass:"filename"},[e._v(e._s(t.filename))]),a("div",{staticClass:"size-description"},["public"===t.visibility?a("i",{staticClass:"fa fa-solid fa-globe"},[e._v("  ")]):e._e(),"private"===t.visibility?a("i",{staticClass:"fa fa-eye-slash"},[e._v("  ")]):e._e(),"protected"===t.visibility?a("i",{staticClass:"fa fa-lock"},[e._v("  ")]):e._e(),a("span",{staticClass:"format"},[e._v(e._s(t.format))]),e._v(" - "+e._s(e.showFilesize(t))+"\n ")])],1),a("button",{staticClass:"btn btn-blue select-btn",attrs:{type:"button"},on:{click:function(a){return e.$emit("media-selected",t)}}},[e._v(e._s(e._self.translations.media_gallery_select))])])}))],2),e.canLoadMore?a("div",{staticClass:"load-more-wrapper"},[a("button",{staticClass:"btn btn-blue",attrs:{type:"button"},on:{click:function(t){return e.$emit("loadMore")}}},[e._v(e._s(this.translations.media_gallery_load_more))])]):e._e()])},W=[],Y=a("94df"),J=a.n(Y),K={name:"MediaGallery",props:["translations","media","canLoadMore","onLoadMore","selectedMediaId","loading"],methods:{showFilesize:function(e){return J()(e.size)}}},Q=K,H=(a("bdf2"),Object(O["a"])(Q,G,W,!1,null,"5aa52c90",null)),X=H.exports,Z=a("b012"),ee=a.n(Z),te=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"ngrm-overlay"},[a("div",{staticClass:"media-modal"},[a("div",{staticClass:"title"},[e._v("\n "+e._s(e.title)+"\n "),a("span",{staticClass:"close",on:{click:e.close}},[a("span",{staticClass:"ngrm-icon-cancel"})])]),a("div",{staticClass:"body"},[e._t("default")],2)])])},ae=[],ie={name:"Modal",props:["title"],methods:{close:function(){this.$emit("close")}}},ne=ie,se=(a("11ef"),a("a301"),Object(O["a"])(ne,te,ae,!1,null,"9d33d07a",null)),oe=se.exports;function le(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,i)}return a}function re(e){for(var t=1;t0&&void 0!==p[0]?p[0]:{patch:!1},a=t.patch,this.loading=!0,this.abortController&&this.abortController.abort(),this.abortController=new AbortController,i={limit:ce,offset:a?this.media.length:0},this.facets.query&&(i["query"]=this.facets.query),this.config.allowedTypes.length>0&&(i["type"]=this.config.allowedTypes),this.facets.type&&(i["type"]=this.facets.type),this.facets.folder&&(i["folder"]=this.facets.folder===R?"":this.facets.folder),this.config.allowedTags.length>0&&(i["tag"]=this.config.allowedTags),this.facets.tag&&(i["tag"]=this.facets.tag),this.config.allowedVisibilities.length>0&&(i["visibility"]=this.config.allowedVisibilities),this.facets.visibility&&(i["visibility"]=this.facets.visibility),a&&this.nextCursor&&(i["next_cursor"]=this.nextCursor),n="",s=0,o=Object.entries(i);s-1:e.newSelection},on:{change:function(a){var i=e.newSelection,n=a.target,s=!!n.checked;if(Array.isArray(i)){var o=t,l=e._i(i,o);n.checked?l<0&&(e.newSelection=i.concat([o])):l>-1&&(e.newSelection=i.slice(0,l).concat(i.slice(l+1)))}else e.newSelection=s}}}),a("label",{attrs:{for:t}},[a("span",{staticClass:"name"},[e._v(e._s(t))]),a("span",{staticClass:"formatted-size"},[e._v(e._s(e.formattedSize(t)))])]),e.isVariationSelectable(t)?e._e():a("div",{staticClass:"legend-not-selectable"},[a("span",[e._v(e._s(e._self.translations.crop_media_too_small))])])])})),0),a("div",{staticClass:"selectedVariations"},[a("ul",e._l(e.selectedVariations,(function(t){return a("li",{key:t,class:{set:!!e.allVariationValues[t],selected:e.selectedVariation===t,disabled:!e.isVariationSelectable(t)},on:{click:function(a){return e.handleVariationClicked(t)}}},[a("div",[a("span",{staticClass:"name"},[e._v(e._s(t))]),a("span",{staticClass:"formatted-size"},[e._v(e._s(e.formattedSize(t)))])]),e.addingVariations?e._e():a("a",[a("span",{staticClass:"circle-orange"}),a("span",{staticClass:"ngrm-icon-trash",on:{click:function(a){return e.removeItem(t)}}})])])})),0)])])},ve=[],be=(a("7f7f"),{name:"CropSizes",props:["translations","availableVariations","allVariationValues","imageSize","selectedVariation"],data:function(){return{newSelection:[],addingVariations:!1}},computed:{unselectedVariations:function(){var e=Object.keys(this.availableVariations),t=Object.keys(this.allVariationValues);return e.difference(t)},selectedVariations:function(){return Object.getOwnPropertyNames(this.allVariationValues)}},methods:{handleAddCropSize:function(){this.addingVariations=!0},handleCancel:function(){this.addingVariations=!1,this.newSelection=[]},handleAdd:function(){this.$emit("addedVariations",this.newSelection),this.newSelection=[],this.addingVariations=!1},removeItem:function(e){this.$emit("removedVariation",e)},formattedSize:function(e){return"".concat(this.availableVariations[e][0]," x ").concat(this.availableVariations[e][1])},isVariationSelectable:function(e){var t=Object(j["a"])(this.availableVariations[e],2),a=t[0],i=t[1];return this.imageSize.width>=a&&this.imageSize.height>=i},handleVariationClicked:function(e){this.isVariationSelectable(e)&&this.$emit("selected",e)}}}),_e=be,ye=(a("bdd7"),Object(O["a"])(_e,ge,ve,!1,null,"ad171770",null)),we=ye.exports,Ce=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"crop"},[a("div",{ref:"cropper",staticClass:"cropper",style:e.cropperStyle},[a("img",{ref:"image",attrs:{src:e.src}}),a("div",{ref:"buttons",staticClass:"buttons",style:e.applyButtonStyle},[a("button",{staticClass:"btn btn-blue",attrs:{type:"button"},on:{click:e.handleReset}},[a("span",{staticClass:"ngrm-icon-ccw"}),a("span",[e._v(e._s(this.translations.crop_reset))])]),a("button",{staticClass:"btn btn-blue",attrs:{type:"button"},on:{click:e.handleApply}},[a("span",{staticClass:"ngrm-icon-ok"}),a("span",[e._v(e._s(this.translations.crop_apply))])])])]),a("div",[a("h4",[e._v(e._s(this.translations.crop_preview))]),a("div",{ref:"preview",staticClass:"preview"})])])},xe=[],Oe=a("5435"),Ie={name:"Crop",props:["translations","value","variation","src","imageSize"],mounted:function(){this.setCropper()},beforeDestroy:function(){this.destroyCropper()},data:function(){return{crop:{},cropper:null}},methods:{setCropper:function(){var e,t=this.value||{},a=t.x,i=t.y,n=t.w,s=t.h,o={x:a,y:i,width:n,height:s},l=Object(j["a"])(this.variation,2),r=l[0],d=l[1],f=r>0&&d>0?r/d:void 0;this.destroyCropper();this.$refs.cropper.clientWidth,this.imageSize.width;this.cropper=new Oe["a"](this.$refs.image,(e={viewMode:2,dragMode:"none",autoCrop:!0,data:o,aspectRatio:f,guides:!0,movable:!1,rotatable:!1},Object(c["a"])(e,"guides",!1),Object(c["a"])(e,"center",!1),Object(c["a"])(e,"zoomable",!1),Object(c["a"])(e,"scalable",!0),Object(c["a"])(e,"minCropBoxWidth",50),Object(c["a"])(e,"minCropBoxHeight",50),Object(c["a"])(e,"crop",this.handleCrop),Object(c["a"])(e,"preview",this.$refs.preview),e)),this.cropper.setData(o)},handleCrop:function(e){this.crop=this.cropper.getData(!0)},destroyCropper:function(){this.cropper&&this.cropper.destroy()},handleReset:function(){this.cropper.reset()},handleApply:function(){var e=this.cropper.getData(!0),t=e.x,a=e.y,i=e.width,n=e.height;this.$emit("change",{x:t,y:a,w:i,h:n})}},computed:{applyButtonStyle:function(){var e=this.crop,t=e.x,a=e.y,i=e.width,n=e.height,s=this.$refs.buttons?this.$refs.buttons.clientWidth:0,o=this.$refs.cropper?this.$refs.cropper.clientWidth/this.imageSize.width:1;return{top:"".concat((a+n)*o+10,"px"),left:"".concat((t+i)*o-s-1,"px")}},cropperStyle:function(){var e=this.imageSize.height/this.imageSize.width*100;return{"padding-bottom":"".concat(e,"%"),height:"0px",width:"100%"}}}},Fe=Ie,Ve=(a("c66d"),Object(O["a"])(Fe,Ce,xe,!1,null,"5f73791e",null)),ke=Ve.exports,je=function(e){return function(t){return Object.keys(t).reduce((function(a,i){return e(t[i],i)&&(a[i]=t[i]),a}),{})}},Se=function(e){return function(t){return!e(t)}},Me=function(e){return function(t){return e===t}},Te=function(e){return!!e},$e=Se(Me(void 0));function Ee(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,i)}return a}function Pe(e){for(var t=1;t1?a("v-select",{attrs:{options:e.visibilities,label:"name",reduce:function(e){return e.id},clearable:!1},model:{value:e.visibility,callback:function(t){e.visibility=t},expression:"visibility"}}):e._e(),a("input",{directives:[{name:"model",rawName:"v-model",value:e.overwrite,expression:"overwrite"}],attrs:{type:"checkbox",id:"ngrm-upload-overwrite"},domProps:{checked:Array.isArray(e.overwrite)?e._i(e.overwrite,null)>-1:e.overwrite},on:{change:function(t){var a=e.overwrite,i=t.target,n=!!i.checked;if(Array.isArray(a)){var s=null,o=e._i(a,s);i.checked?o<0&&(e.overwrite=a.concat([s])):o>-1&&(e.overwrite=a.slice(0,o).concat(a.slice(o+1)))}else e.overwrite=n}}}),a("label",{attrs:{for:"ngrm-upload-overwrite"}},[e._v(e._s(this.config.translations.upload_checkbox_overwrite))]),a("button",{staticClass:"btn btn-blue",attrs:{type:"button",disabled:""===e.filename||""===e.visibility},on:{click:e.upload}},[e._v("\n "+e._s(this.config.translations.upload_button_upload)+"\n ")])],1)],1),e.loading?a("i",{staticClass:"ng-icon ng-spinner"}):e._e()])},Ue=[],Be=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"folder-gallery"},[a("div",{class:e.loading?"items loading":"items"},[a("div",{staticClass:"breadcrumbs"},[a("span",[e._v(e._s(this.config.translations.upload_breadcrumbs_info)+" ")]),e._l(e.breadcrumbs,(function(t,i){return a("span",{key:i},[0!==i?a("span",[e._v(" / ")]):e._e(),i!==e.breadcrumbs.length-1?a("a",{attrs:{href:"#"},on:{click:function(a){return e.openFolder(t.id)}}},[e._v("\n "+e._s(t.label)+"\n ")]):a("span",[e._v(e._s(t.label))])])}))],2),e.folders.length>0||e.allowCreate?a("div",{staticClass:"info"},[a("i",{staticClass:"fa fa-info-circle"}),e._v("\n "+e._s(this.config.translations.upload_info_text)+"\n ")]):e._e(),e._l(e.folders,(function(t){return a("div",{key:t.id,staticClass:"media",class:{selected:t.id===e._self.folder}},[a("div",{staticClass:"media-container",on:{dblclick:function(a){return e.openFolder(t.id)}}},[e._m(0,!0),a("Label",{staticClass:"filename"},[e._v(e._s(t.label))])],1),a("button",{staticClass:"btn btn-blue select-btn",attrs:{type:"button"},on:{click:function(a){return e.$emit("select",t.id)}}},[e._v("\n "+e._s(e._self.config.translations.upload_button_select)+"\n ")])])})),e.allowCreate?a("div",{staticClass:"media new-folder"},[a("div",{staticClass:"media-container"},[e._m(1),a("input",{directives:[{name:"model",rawName:"v-model",value:e.newFolder,expression:"newFolder"}],attrs:{type:"text",placeholder:this.config.translations.upload_placeholder_new_folder},domProps:{value:e.newFolder},on:{input:function(t){t.target.composing||(e.newFolder=t.target.value)}}})]),a("button",{staticClass:"btn btn-blue select-btn",attrs:{type:"button",disabled:null===e.newFolder},on:{click:e.createNewFolder}},[e._v("\n "+e._s(this.config.translations.upload_button_create)+"\n ")])]):e._e()],2),e.loading?a("i",{staticClass:"ng-icon ng-spinner"}):e._e()])},Ne=[function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("span",{staticClass:"file-placeholder"},[a("span",{staticClass:"icon-doc"},[a("i",{staticClass:"fa fa-folder"})])])},function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("span",{staticClass:"file-placeholder"},[a("span",{staticClass:"icon-doc"},[a("i",{staticClass:"fa fa-folder"})])])}],qe=a("bc3a"),Ge=a.n(qe),We={name:"SelectFolder",props:["config","selectedFolder"],data:function(){return{folders:[],newFolder:null,breadcrumbs:[],loading:!1,allowCreate:!0,folder:this.selectedFolder}},methods:{openFolder:function(e){this.folder=e,this.$emit("change",this.folder),this.loadSubFolders(e)},loadSubFolders:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(t){var a,i,n;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.loading=!0,a=this.config.paths.load_folders,t&&(i={folder:t===R?"":t},a+="?"+h(i)),e.next=5,fetch(a);case 5:return n=e.sent,e.next=8,n.json();case 8:this.folders=e.sent,this.generateBreadcrumbs(t),this.newFolder=null,this.loading=!1;case 12:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}(),generateBreadcrumbs:function(e){var t=this;this.breadcrumbs=[];var a={id:null,label:this.config.translations.upload_root_folder};if(null!==e){var i=e.split("/"),n=[],s=[];this.config.parentFolder&&(s=this.config.parentFolder.id.split("/"),a={id:this.config.parentFolder.id,label:this.config.parentFolder.label}),this.config.folder&&(s=this.config.folder.id.split("/"),a={id:this.config.folder.id,label:this.config.folder.label}),this.breadcrumbs.push(a),i.forEach((function(e,a){n.push(e),s.indexOf(e)<0&&t.breadcrumbs.push({id:n.join("/"),label:e})}))}else this.breadcrumbs.push(a)},createNewFolder:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return this.loading=!0,t=new FormData,this.folder&&t.append("parent",this.folder),t.append("folder",this.newFolder),e.next=6,Ge.a.post(this.config.paths.create_folder,t);case 6:this.folders.push({id:null!==this.folder?this.folder+"/"+this.newFolder:this.newFolder,label:this.newFolder}),this.newFolder=null,this.loading=!1;case 9:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},created:function(){if(this.config.folder)return e=this.config.folder.id,this.allowCreate=!1,this.folder=e,this.$emit("change",this.folder),void this.generateBreadcrumbs(e);var e=null;this.config.parentFolder&&(e=this.config.parentFolder.id),this.openFolder(e)}},Ye=We,Je=(a("9ea2"),Object(O["a"])(Ye,Be,Ne,!1,null,"7c5b0504",null)),Ke=Je.exports,Qe={name:"UploadModal",props:["config","file","visibilities"],data:function(){return{loading:!1,selectedFolder:"",filename:this.file.name,visibility:this.visibilities.length>0?this.visibilities[0].id:"",overwrite:!1,error:"",existingResourceButton:!1,existingResource:null}},components:{"select-folder":Ke,modal:oe,"v-select":w.a},methods:{handleFolderChange:function(e){this.selectedFolder=e},upload:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(){var t,a,i,n,s,o,l=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:for(this.loading=!0,t=new FormData,t.append("file",this.file),t.append("filename",this.filename),t.append("folder",this.selectedFolder),t.append("overwrite",this.overwrite),t.append("visibility",this.visibility),a=0,i=Object.entries(this.config.uploadContext);a0&&-1===l.config.allowedTypes.indexOf(e.data.type)?(l.error=l.config.translations.upload_error_unsupported_resource_type+l.config.allowedTypes.join(", "),l.loading=!1):l.$emit("uploaded",e.data)})).catch((function(e){409===e.response.status?(l.error=l.config.translations.upload_error_existing_resource,l.existingResourceButton=!0,l.existingResource=e.response.data,l.loading=!1):(l.error=e.response.data.detail?e.response.data.detail:"Error "+e.response.status+" - "+e.response.statusText,l.loading=!1)}));case 10:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},watch:{visibilities:function(){this.visibility=this.visibilities.length>0?this.visibilities[0].id:""}}},He=Qe,Xe=(a("20d1"),Object(O["a"])(He,De,Ue,!1,null,"30bcedc5",null)),Ze=Xe.exports;function et(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,i)}return a}function tt(e){for(var t=1;t0},stringifiedVariations:function(){return JSON.stringify(je(Te)(this.selectedImage.variations))}},data:function(){return{mediaModalOpen:!1,cropModalOpen:!1,uploadModalOpen:!1,types:[],folders:[],tags:[],visibilities:[],facetsLoading:!0,newFile:null}},methods:{dispatchVanillaChangeEvent:function(){this.$nextTick((function(){this.$el.dispatchEvent(new CustomEvent("ngrm-change",{detail:{inputFields:this.config.inputFields,selectedImage:this.selectedImage,fieldId:this.fieldId}}))}))},prepareDomForModal:function(){var e=document.querySelector(".ez-page-builder-wrapper");e&&(e.style.transform="none")},resetDomAfterModal:function(){var e=document.querySelector(".ez-page-builder-wrapper");e&&e.removeAttribute("style")},handleMediaModalClose:function(){this.mediaModalOpen=!1,this.resetDomAfterModal(),this.dispatchVanillaChangeEvent()},handleCropModalClose:function(){this.cropModalOpen=!1,this.resetDomAfterModal(),this.dispatchVanillaChangeEvent()},handleUploadModalClose:function(){this.uploadModalOpen=!1,this.dispatchVanillaChangeEvent()},handleMediaSelected:function(e){this.selectedImage={id:e.remoteId,name:e.filename,type:e.type,format:e.format,url:e.url,previewUrl:e.previewUrl,browseUrl:e.browseUrl,alternateText:e.altText,caption:e.caption,watermarkText:this.selectedImage.watermarkText,tags:e.tags,size:e.size,variations:{},height:e.height,width:e.width},this.mediaModalOpen=!1,this.dispatchVanillaChangeEvent()},handleVariationCropChange:function(e){this.selectedImage=tt({},this.selectedImage,{variations:tt({},this.selectedImage.variations,{},e)}),this.dispatchVanillaChangeEvent()},handleResourceUploaded:function(e){this.selectedImage={id:e.remoteId,name:e.filename,type:e.type,format:e.format,url:e.url,previewUrl:e.previewUrl,browseUrl:e.browseUrl,alternateText:e.altText,caption:e.caption,watermarkText:this.selectedImage.watermarkText,tags:e.tags,size:e.size,variations:{},height:e.height,width:e.width},this.uploadModalOpen=!1,this.dispatchVanillaChangeEvent()},handleCropClicked:function(){this.cropModalOpen=!0,this.prepareDomForModal()},handleRemoveMediaClicked:function(){this.selectedImage={id:"",name:"",type:"image",format:"",url:"",previewUrl:"",browseUrl:"",alternateText:"",caption:"",watermarkText:this.selectedImage.watermarkText,tags:[],size:0,variations:{},height:0,width:0},this.$refs.fileUploadInput.value=null,this.dispatchVanillaChangeEvent()},fetchFacets:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(){var t,a,i=this;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return e.next=2,fetch(this.config.paths.load_facets);case 2:return t=e.sent,e.next=5,t.json();case 5:a=e.sent,this.types=[],this.tags=[],this.visibilities=[],a.types.forEach((function(e){-1===i.config.allowedTypes.indexOf(e.id)&&0!==i.config.allowedTypes.length||i.types.push(e)})),a.tags.forEach((function(e){-1===i.config.allowedTags.indexOf(e.id)&&0!==i.config.allowedTags.length||i.tags.push(e)})),a.visibilities.forEach((function(e){-1===i.config.allowedVisibilities.indexOf(e.id)&&0!==i.config.allowedVisibilities.length||i.visibilities.push(e)})),this.facetsLoading=!1;case 13:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),handleBrowseMediaClicked:function(){var e=Object(r["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:this.mediaModalOpen=!0,this.prepareDomForModal(),this.fetchFacets();case 3:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}(),handleFileInputChange:function(){this.fetchFacets(),this.uploadModalOpen=!0,this.newFile=this.$refs.fileUploadInput.files.item(0)}},watch:{selectedImage:function(){this.$emit("selectedImageChanged",this.selectedImage)}},mounted:function(){this.$nextTick((function(){var e=document.querySelector(".ngrm-model-portal-".concat(this.fieldId));document.body.prepend(e)}))}},it=at,nt=Object(O["a"])(it,o,l,!1,null,null,null),st=nt.exports,ot={bind:function(e,t,a){var i=g(t.arg);a.context[i]=t.value}},lt=(a("b39d"),function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",[a("input",{directives:[{name:"model",rawName:"v-model",value:e.selectedFolder,expression:"selectedFolder"}],attrs:{type:"hidden",name:e.config.inputFields.folder},domProps:{value:e.selectedFolder},on:{input:function(t){t.target.composing||(e.selectedFolder=t.target.value)}}}),e.selectedFolder?a("span",[a("i",{staticClass:"fa fa-folder"}),e._v(" "+e._s(this.selectedFolder))]):a("span",[a("i",[e._v(e._s(this.config.translations.select_folder_interaction_empty))])]),a("div",{staticClass:"ngremotemedia-buttons"},[e.selectedFolder?a("input",{attrs:{type:"button",value:"Remove folder"},on:{click:e.handleFolderRemove}}):e._e(),a("input",{attrs:{type:"button",value:this.config.translations.select_folder_interaction_button},on:{click:e.handleSelectFolderModalOpen}})]),e.selectFolderModalOpen?a("modal",{attrs:{title:"Select folder"},on:{close:e.handleSelectFolderModalClose}},[a("select-folder",{attrs:{config:e.config,"selected-folder":e.selectedFolder},on:{select:e.handleFolderSelect}})],1):e._e()],1)}),rt=[],ct={name:"SelectFolderInteraction",props:["config","selectedFolder"],components:{"select-folder":Ke,modal:oe},data:function(){return{selectFolderModalOpen:!1}},methods:{handleSelectFolderModalOpen:function(){this.selectFolderModalOpen=!0},handleSelectFolderModalClose:function(){this.selectFolderModalOpen=!1},handleFolderSelect:function(e){this.selectedFolder=e,this.handleSelectFolderModalClose()},handleFolderRemove:function(){this.selectedFolder=null}}},dt=ct,ft=Object(O["a"])(dt,lt,rt,!1,null,null,null),ut=ft.exports;i["default"].config.productionTip=!1,i["default"].use(s.a);var pt=function(e){window["ngrm_interactions_vue_".concat(e.dataset.id)]=new i["default"]({el:e,directives:{init:ot},data:{config:{paths:{browse_resources:"/resource/browse",upload_resources:"/resource/upload",load_facets:"/facets/load",load_folders:"/folder/load",create_folder:"/folder/create"},translations:{},inputFields:{locationId:"locationId",remoteId:"remoteId",type:"type",altText:"altText",caption:"caption",tags:"tags[]",cropSettings:"cropSettings",source:"source",watermarkText:"watermarkText"},availableVariations:[],allowedVisibilities:[],allowedTypes:[],allowedTags:[],parentFolder:null,folder:null,uploadContext:{},disableUpload:!1},selectedImage:{id:"",name:"",type:"image",format:"",url:"",browse_url:"",previewUrl:"",alternateText:"",caption:"",watermarkText:"",tags:[],size:"",variations:{},height:0,width:0}},components:{interactions:st}})},ht=function(e){window["ngrm_select_folder_vue_".concat(e.dataset.id)]=new i["default"]({el:e,directives:{init:ot},data:{config:{paths:{load_folders:"/folder/load",create_folder:"/folder/create"},translations:{},inputFields:{folder:"folder"}},selectedFolder:null},components:{"select-folder-interaction":ut}})},mt=function(){for(var e=document.getElementsByClassName("ngremotemedia-container"),t=0;t - + - + @@ -103,6 +103,8 @@ export default { { detail: { inputFields: this.config.inputFields, + selectedImage: this.selectedImage, + fieldId: this.fieldId, } } ) @@ -143,6 +145,7 @@ export default { format: item.format, url: item.url, previewUrl: item.previewUrl, + browseUrl: item.browseUrl, alternateText: item.altText, caption: item.caption, watermarkText: this.selectedImage.watermarkText, @@ -175,6 +178,7 @@ export default { format: item.format, url: item.url, previewUrl: item.previewUrl, + browseUrl: item.browseUrl, alternateText: item.altText, caption: item.caption, watermarkText: this.selectedImage.watermarkText, @@ -200,6 +204,7 @@ export default { format: '', url: '', previewUrl: '', + browseUrl: '', alternateText: '', caption: '', watermarkText: this.selectedImage.watermarkText, @@ -259,7 +264,7 @@ export default { }, mounted() { this.$nextTick(function () { - const modalPortal = document.querySelector('.ngrm-model-portal'); + const modalPortal = document.querySelector(`.ngrm-model-portal-${this.fieldId}`); document.body.prepend(modalPortal); }) diff --git a/frontend/src/components/SelectFolderInteraction.vue b/frontend/src/components/SelectFolderInteraction.vue index 2053c2ff..43ae8a24 100644 --- a/frontend/src/components/SelectFolderInteraction.vue +++ b/frontend/src/components/SelectFolderInteraction.vue @@ -35,7 +35,6 @@ export default { }, methods: { handleSelectFolderModalOpen() { - console.log(this.selectedFolder); this.selectFolderModalOpen = true; }, handleSelectFolderModalClose() {