UNPKG

@europeana/portal

Version:
2 lines 9.72 kB
(window.webpackJsonp=window.webpackJsonp||[]).push([[94],{1103:function(t,e,l){"use strict";l.r(e);l(250);var r={components:{ContentCard:l(641).default},props:{category:{type:String,required:!0},cards:{type:Array,default:()=>[]},total:{type:Number,default:0}},computed:{contentType(){var t={};return this.forExhibitions?t={type:"exhibitionPage",name:this.$tc("exhibitions.exhibitions",this.total),path:"exhibitions"}:this.forGalleries?t={type:"imageGallery",name:this.$tc("galleries.galleries",this.total),path:"galleries"}:this.forBlogPosts&&(t={type:"blogPosting",name:this.$tc("blog.posts",this.total),path:"blog"}),t},forGalleries(){return"Galleries"===this.category},forExhibitions(){return"Exhibitions"===this.category},forBlogPosts(){return"Blog posts"===this.category},showMoreLink(){return"".concat(this.$tc("showMore")," ").concat(this.contentType.name.toLowerCase()," (").concat(this.total,")")}},methods:{cardData(t){return this.forExhibitions?this.defaultCardData(t,"exhibitions-exhibition"):this.forGalleries?this.galleryCardData(t):this.forBlogPosts?this.defaultCardData(t,"blog-all"):null},defaultCardData(t,e){var l,r,n,o;return{cardLink:{name:e,params:{["exhibitions-exhibition"===e?"exhibition":"pathMatch"]:t.identifier}},description:t.description?t.description:"",imageUrl:null===(l=t.primaryImageOfPage)||void 0===l||null===(r=l.image)||void 0===r?void 0:r.url,imageContentType:null===(n=t.primaryImageOfPage)||void 0===n||null===(o=n.image)||void 0===o?void 0:o.contentType}},galleryCardData(t){var e,l,r=(null===(e=t.hasPartCollection.items[0].encoding)||void 0===e||null===(l=e.edmPreview)||void 0===l?void 0:l[0])||t.hasPartCollection.items[0].thumbnailUrl;return{cardLink:{name:"galleries-all",params:{pathMatch:t.identifier}},imageUrl:this.$apis.thumbnail.edmPreview(r,{size:400})}}}},n=(l(940),l(40)),component=Object(n.a)(r,(function(){var t=this,e=t.$createElement,l=t._self._c||e;return l("section",{staticClass:"latest-section row mb-5"},[l("div",{staticClass:"col-12"},[l("h2",[t._v("\n "+t._s(t.contentType.name)+"\n ")]),t._v(" "),l("b-card-group",{staticClass:"card-deck-4-cols",attrs:{deck:"","data-qa":"latest "+t.contentType.name}},t._l(t.cards,(function(e){return l("ContentCard",{key:e.identifier,attrs:{title:e.name,texts:[e.description],url:t.cardData(e).cardLink,"image-url":t.cardData(e).imageUrl,"image-content-type":t.cardData(e).imageContentType,"image-optimisation-options":{width:510},"image-alt":t.cardData(e).description}})})),1),t._v(" "),t.total>4?l("b-button",{attrs:{variant:"light",to:t.localePath({name:t.contentType.path})}},[t._v("\n "+t._s(t.showMoreLink)+"\n ")]):t._e()],1)])}),[],!1,null,"0e30d20d",null);e.default=component.exports},641:function(t,e,l){"use strict";l.r(e);l(21),l(42),l(22),l(14),l(38),l(43),l(48),l(80),l(41),l(76);var r=l(141),n=l.n(r),o=l(159),d=l(642),c=l(24),h=l(160),m={name:"ContentCard",components:{ClientOnly:n.a,SmartLink:o.a,MediaDefaultThumbnail:()=>l.e(23).then(l.bind(null,1101))},mixins:[d.a],props:{title:{type:[String,Object],default:""},subTitle:{type:String,default:null},texts:{type:Array,default:()=>[]},hitsText:{type:Object,default:null},url:{type:[String,Object],default:""},imageUrl:{type:String,default:""},imageContentType:{type:String,default:null},imageWidth:{type:Number,default:null},imageHeight:{type:Number,default:null},imageAlt:{type:String,default:""},imageOptimisationOptions:{type:Object,default:()=>({})},lazy:{type:Boolean,default:!0},showSubtitle:{type:Boolean,default:!0},variant:{type:String,default:"default"},omitAllUris:{type:Boolean,default:!1},omitUrisIfOtherValues:{type:Boolean,default:!1},limitValuesWithinEachText:{type:Number,default:-1},blankImageHeight:{type:Number,default:null},blankImageWidth:{type:Number,default:null},logo:{type:Boolean,default:!1},mediaType:{type:String,default:null},offset:{type:Number,default:null}},data(){return{cardImageUrl:this.imageUrl,displayLabelTypes:"exhibitions|galleries|blog|collections",themes:h.a.map((t=>t.id))}},computed:{cardClass(){return"".concat(this.variant,"-card")},displayTitle(){if(this.title){if("string"==typeof this.title)return{value:this.title,code:null};var t=Object(c.h)(this.title,this.$i18n.locale);return{value:t.values[0],code:t.code}}return null},displaySubTitle(){return this.subTitle||this.displayLabel},displayLabel(){if(!this.displayLabelType)return!1;if("collections"===this.displayLabelType){var t="string"==typeof this.url?this.url.split("/").pop().split("-").shift():this.url.params.pathMatch;return this.themes.includes(t)?this.$t("cardLabels.theme"):this.$t("cardLabels.".concat(this.displayLabelTypeCollections))}return"blog"===this.displayLabelType?this.$tc("blog.posts",1):this.$tc("".concat(this.displayLabelType,".").concat(this.displayLabelType),1)},displayLabelTypeCollections(){return"object"==typeof this.url?this.url.params.type:this.url.split("/").slice(-2,-1)},displayLabelType(){return!!this.displayLabelMatch&&this.displayLabelMatch[1]},displayLabelMatch(){return"object"==typeof this.url?this.displayLabelMatchObject:this.displayLabelMatchString},displayLabelMatchObject(){return this.url.name.match(new RegExp("(".concat(this.displayLabelTypes,")")))},displayLabelMatchString(){return this.url.match(new RegExp("/(".concat(this.displayLabelTypes,")[/.]")))},displayTexts(){return this.texts.filter(Boolean).map((t=>"string"==typeof t?{values:[t],code:null}:Array.isArray(t)?{values:t,code:null}:Object(c.h)(t,this.$i18n.locale,{omitUrisIfOtherValues:this.omitUrisIfOtherValues,omitAllUris:this.omitAllUris})))},optimisedImageUrl(){return this.$options.filters.optimisedImageUrl(this.imageUrl,this.imageContentType,this.imageOptimisationOptions)}},watch:{imageUrl(){this.cardImageUrl=this.imageUrl}},methods:{cardText(t){var e=this.limitValuesWithinEachText>-1?t.slice(0,this.limitValuesWithinEachText):[].concat(t);t.length>e.length&&e.push(this.$t("formatting.ellipsis"));var l=e.join(this.$t("formatting.listSeperator")+" "),r=this.stripMarkdown(l);return this.$options.filters.truncate(r,255,this.$t("formatting.ellipsis"))},redrawMasonry(){this.$redrawVueMasonry&&this.$nextTick((()=>{this.$redrawVueMasonry()}))},imageNotFound(){this.cardImageUrl="",this.redrawMasonry()},imageLoaded(t){t.target.src.startsWith("data:")||this.redrawMasonry()}}},y=l(40),f=l(643),v=l.n(f),component=Object(y.a)(m,(function(){var t=this,e=t.$createElement,l=t._self._c||e;return l("b-card",{staticClass:"text-left content-card",class:t.cardClass,attrs:{"data-qa":"content card","no-body":""}},[l("div",{staticClass:"card-wrapper"},[l("SmartLink",{attrs:{destination:t.url,"link-class":"card-link","aria-label":t.displayTitle?t.displayTitle.value:null,title:"mosaic"===t.variant&&t.displayTitle?t.displayTitle.value:null}}),t._v(" "),"mini"!==t.variant?l("MediaDefaultThumbnail",{directives:[{name:"show",rawName:"v-show",value:!t.cardImageUrl,expression:"!cardImageUrl"}],attrs:{"media-type":t.mediaType,offset:t.offset}}):t._e(),t._v(" "),t.cardImageUrl?l("div",{staticClass:"card-img",class:{logo:t.logo}},[t.lazy?l("b-img-lazy",{attrs:{src:t.optimisedImageUrl,"blank-width":t.blankImageWidth,"blank-height":t.blankImageHeight,width:t.imageWidth,height:t.imageHeight,alt:t.imageAlt},nativeOn:{error:function(e){return t.imageNotFound.apply(null,arguments)},load:function(e){return t.imageLoaded.apply(null,arguments)}}}):l("b-img",{attrs:{src:t.optimisedImageUrl,width:t.imageWidth,height:t.imageHeight,alt:t.imageAlt},on:{error:t.imageNotFound,load:t.imageLoaded}})],1):t._e(),t._v(" "),"mosaic"!==t.variant?l("b-card-body",{attrs:{"data-qa":"card body"}},[t.displaySubTitle&&"mini"!==t.variant&&t.showSubtitle?l("b-card-sub-title",{staticClass:"mt-0",attrs:{"sub-title-tag":"div","sub-title-text-variant":"default"}},[t._v("\n "+t._s(t.displaySubTitle)+"\n ")]):t._e(),t._v(" "),l("div",{staticClass:"title-texts-wrapper"},[t.displayTitle?l("b-card-title",{attrs:{"title-tag":"div","data-qa":"card title",lang:t.displayTitle.code}},[l("span",[t._v("\n "+t._s(t._f("truncate")(t.displayTitle.value,90,t.$t("formatting.ellipsis")))+"\n ")])]):t._e(),t._v(" "),t.hitsText?l("b-card-text",{attrs:{"text-tag":"div","data-qa":"highlighted search term"}},[l("p",[t._v("\n "+t._s(t.hitsText.prefix)),l("strong",{staticClass:"has-text-highlight"},[t._v(t._s(t.hitsText.exact))]),t._v(t._s(t.hitsText.suffix)+"\n ")])]):t._e(),t._v(" "),t.displayTexts.length>0?t._l(t.displayTexts,(function(text,e){return l("b-card-text",{key:e,attrs:{lang:text.code,"text-tag":"div"}},[l("p",{domProps:{innerHTML:t._s(t.cardText(text.values))}})])})):t._e()],2),t._v(" "),l("client-only",[t._t("footer")],2)],1):t._e()],1),t._v(" "),l("client-only",[t._t("image-overlay")],2)],1)}),[],!1,null,null,null);"function"==typeof v.a&&v()(component);e.default=component.exports},642:function(t,e,l){"use strict";l(80),l(14),l(41),l(21),l(22),l(28);var r=l(645);e.a={methods:{stripMarkdown(text){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[""];for(var pattern of(text=r.marked.parse(text),(t=>[/\n$/].concat(t.map((t=>new RegExp("</?".concat(t,".*?>"),"gi")))))(t)))text=text.replace(pattern,"");return text}}}},643:function(t,e){},804:function(t,e,l){var content=l(941);content.__esModule&&(content=content.default),"string"==typeof content&&(content=[[t.i,content,""]]),content.locals&&(t.exports=content.locals);(0,l(106).default)("603076ec",content,!0,{sourceMap:!1})},940:function(t,e,l){"use strict";l(804)},941:function(t,e,l){var r=l(105)(!1);r.push([t.i,".latest-section h2[data-v-0e30d20d]{color:#4d4d4d;font-size:1.5rem;font-weight:600;letter-spacing:.1212rem;text-align:left}",""]),t.exports=r}}]); //# sourceMappingURL=8e93d61.modern.js.map