@europeana/portal
Version:
Europeana Portal
2 lines • 15.7 kB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{711:function(t,e,n){"use strict";n.r(e);var r=n(44),l=(n(10),n(43),n(46),n(250),n(47),n(21),n(52),n(58),n(62),n(30),n(41),n(67),n(34),n(107),n(60),n(13),n(50),n(104),n(176)),o=n.n(l),c=n(203),d=n(712),h=n(31),m=n(204),f={name:"ContentCard",components:{ClientOnly:o.a,SmartLink:c.a,MediaDefaultThumbnail:function(){return n.e(24).then(n.bind(null,1172))}},mixins:[d.a],props:{title:{type:[String,Object],default:""},subTitle:{type:String,default:null},texts:{type:Array,default:function(){return[]}},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:function(){return{}}},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:function(){return{cardImageUrl:this.imageUrl,displayLabelTypes:"exhibitions|galleries|blog|collections",themes:m.a.map((function(t){return t.id}))}},computed:{cardClass:function(){return"".concat(this.variant,"-card")},displayTitle:function(){if(this.title){if("string"==typeof this.title)return{value:this.title,code:null};var t=Object(h.h)(this.title,this.$i18n.locale);return{value:t.values[0],code:t.code}}return null},displaySubTitle:function(){return this.subTitle||this.displayLabel},displayLabel:function(){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:function(){return"object"===Object(r.a)(this.url)?this.url.params.type:this.url.split("/").slice(-2,-1)},displayLabelType:function(){return!!this.displayLabelMatch&&this.displayLabelMatch[1]},displayLabelMatch:function(){return"object"===Object(r.a)(this.url)?this.displayLabelMatchObject:this.displayLabelMatchString},displayLabelMatchObject:function(){return this.url.name.match(new RegExp("(".concat(this.displayLabelTypes,")")))},displayLabelMatchString:function(){return this.url.match(new RegExp("/(".concat(this.displayLabelTypes,")[/.]")))},displayTexts:function(){var t=this;return this.texts.filter(Boolean).map((function(e){return"string"==typeof e?{values:[e],code:null}:Array.isArray(e)?{values:e,code:null}:Object(h.h)(e,t.$i18n.locale,{omitUrisIfOtherValues:t.omitUrisIfOtherValues,omitAllUris:t.omitAllUris})}))},optimisedImageUrl:function(){return this.$options.filters.optimisedImageUrl(this.imageUrl,this.imageContentType,this.imageOptimisationOptions)}},watch:{imageUrl:function(){this.cardImageUrl=this.imageUrl}},methods:{cardText:function(t){var e=this.limitValuesWithinEachText>-1?t.slice(0,this.limitValuesWithinEachText):[].concat(t);t.length>e.length&&e.push(this.$t("formatting.ellipsis"));var n=e.join(this.$t("formatting.listSeperator")+" "),r=this.stripMarkdown(n);return this.$options.filters.truncate(r,255,this.$t("formatting.ellipsis"))},redrawMasonry:function(){var t=this;this.$redrawVueMasonry&&this.$nextTick((function(){t.$redrawVueMasonry()}))},imageNotFound:function(){this.cardImageUrl="",this.redrawMasonry()},imageLoaded:function(t){t.target.src.startsWith("data:")||this.redrawMasonry()}}},y=n(59),v=n(715),w=n.n(v),component=Object(y.a)(f,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("b-card",{staticClass:"text-left content-card",class:t.cardClass,attrs:{"data-qa":"content card","no-body":""}},[n("div",{staticClass:"card-wrapper"},[n("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?n("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?n("div",{staticClass:"card-img",class:{logo:t.logo}},[t.lazy?n("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)}}}):n("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?n("b-card-body",{attrs:{"data-qa":"card body"}},[t.displaySubTitle&&"mini"!==t.variant&&t.showSubtitle?n("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(" "),n("div",{staticClass:"title-texts-wrapper"},[t.displayTitle?n("b-card-title",{attrs:{"title-tag":"div","data-qa":"card title",lang:t.displayTitle.code}},[n("span",[t._v("\n "+t._s(t._f("truncate")(t.displayTitle.value,90,t.$t("formatting.ellipsis")))+"\n ")])]):t._e(),t._v(" "),t.hitsText?n("b-card-text",{attrs:{"text-tag":"div","data-qa":"highlighted search term"}},[n("p",[t._v("\n "+t._s(t.hitsText.prefix)),n("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 n("b-card-text",{key:e,attrs:{lang:text.code,"text-tag":"div"}},[n("p",{domProps:{innerHTML:t._s(t.cardText(text.values))}})])})):t._e()],2),t._v(" "),n("client-only",[t._t("footer")],2)],1):t._e()],1),t._v(" "),n("client-only",[t._t("image-overlay")],2)],1)}),[],!1,null,null,null);"function"==typeof w.a&&w()(component);e.default=component.exports},712:function(t,e,n){"use strict";n(30),n(47),n(107),n(21),n(60),n(37),n(41),n(10),n(34),n(68),n(43),n(15),n(64),n(71),n(46);var r=n(717);function l(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return o(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var l,c=!0,d=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return c=t.done,t},e:function(t){d=!0,l=t},f:function(){try{c||null==n.return||n.return()}finally{if(d)throw l}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var c=function(t){return[/\n$/].concat(t.map((function(t){return new RegExp("</?".concat(t,".*?>"),"gi")})))};e.a={methods:{stripMarkdown:function(text){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[""];text=r.marked.parse(text);var e,n=l(c(t));try{for(n.s();!(e=n.n()).done;){var pattern=e.value;text=text.replace(pattern,"")}}catch(t){n.e(t)}finally{n.f()}return text}}}},715:function(t,e){},738:function(t,e,n){"use strict";n(30),n(41),n(13),n(10),n(80);var r=n(839),l=n.n(r),o=n(2),c=(n(43),n(46),n(250),n(16),n(58),n(21),n(37),n(31)),d={name:"ItemPreviewCard",components:{ContentCard:n(711).default,RecommendationButtons:function(){return n.e(123).then(n.bind(null,1186))},UserButtons:function(){return n.e(22).then(n.bind(null,1177))},RightsStatement:function(){return n.e(114).then(n.bind(null,730))}},props:{item:{type:Object,required:!0},hitSelector:{type:Object,default:null},variant:{type:String,default:"default"},lazy:{type:Boolean,default:!0},showPins:{type:Boolean,default:!1},showMove:{type:Boolean,default:!1},enableAcceptRecommendation:{type:Boolean,default:!1},enableRejectRecommendation:{type:Boolean,default:!1},offset:{type:Number,default:null}},computed:{dcTitle:function(){return this.unpublishedItem?Object(o.a)({},this.$i18n.locale,[this.$t("record.status.unpublished")]):this.item.dcTitleLangAware},unpublishedItem:function(){var t=Object.keys(this.item);return 1===t.length&&"id"===t[0]},texts:function(){if(["explore","mosaic"].includes(this.variant))return[];var t=[];return"list"===this.variant?!this.hitSelector&&this.item.dcDescriptionLangAware&&t.unshift(this.item.dcDescriptionLangAware):(this.item.dcCreatorLangAware&&t.unshift(this.item.dcCreatorLangAware),t.push(this.item.dataProvider)),t},hitsText:function(){return"list"===this.variant?this.hitSelector:null},cardClass:function(){return"list"===this.variant?"mx-0":null},identifier:function(){return this.item.id.replace("http://data.europeana.eu/item/","")},url:function(){return{name:"item-all",params:{pathMatch:this.identifier.slice(1)}}},imageUrl:function(){var t;return this.$apis.thumbnail.edmPreview(null===(t=this.item.edmPreview)||void 0===t?void 0:t[0],{size:400,type:this.item.type})||this.$apis.thumbnail.generic(this.item.id,{size:400,type:this.item.type})},subTitle:function(){return"list"===this.variant?Object(c.h)(this.item.dataProvider,this.$i18n.locale).values[0]:null},rights:function(){var t;return"list"===this.variant?null===(t=this.item.rights)||void 0===t?void 0:t[0]:null},type:function(){return this.item.type}}},h=n(59),m=n(794),f=n.n(m),component=Object(h.a)(d,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("ContentCard",{class:t.cardClass,attrs:{title:t.dcTitle||t.item.dcDescriptionLangAware,url:t.url,"image-url":t.imageUrl,texts:t.texts,"hits-text":t.hitsText,"limit-values-within-each-text":3,"omit-all-uris":!0,"blank-image-height":280,variant:t.variant,lazy:t.lazy,"sub-title":t.subTitle,"media-type":t.type,offset:t.offset},scopedSlots:t._u(["list"===t.variant?{key:"footer",fn:function(){return[n("div",{staticClass:"data-and-buttons-wrapper d-flex"},[t.rights?n("RightsStatement",{attrs:{"rights-statement-url":t.rights,variant:"simple"}}):t._e(),t._v(" "),t.type?n("span",{staticClass:"d-inline-flex align-items-center text-uppercase"},[n("span",{staticClass:"icon-file"}),t._v(t._s(t.type)+"\n ")]):t._e(),t._v(" "),n("UserButtons",{attrs:{identifier:t.identifier,"show-pins":t.showPins,"show-move":t.showMove,"button-text":!0,"button-variant":"light-flat"},on:{like:function(e){return t.$emit("like",t.identifier)},unlike:function(e){return t.$emit("unlike",t.identifier)}}})],1)]},proxy:!0}:{key:"image-overlay",fn:function(){return[t.enableAcceptRecommendation||t.enableRejectRecommendation?n("RecommendationButtons",{attrs:{identifier:t.identifier,"enable-accept-button":t.enableAcceptRecommendation,"enable-reject-button":t.enableRejectRecommendation}}):n("UserButtons",{attrs:{identifier:t.identifier,"show-pins":t.showPins,"show-move":t.showMove},on:{like:function(e){return t.$emit("like",t.identifier)},unlike:function(e){return t.$emit("unlike",t.identifier)}}})]},proxy:!0}],null,!0)})}),[],!1,null,null,null);"function"==typeof f.a&&f()(component);var y=component.exports,v={name:"ItemPreviewCardGroup",components:{draggable:l.a,ItemPreviewCard:y},props:{items:{type:Array,default:function(){return[]}},hits:{type:Array,default:null},view:{type:String,default:"grid"},showPins:{type:Boolean,default:!1},showRelated:{type:Boolean,default:!1},draggableItems:{type:Boolean,default:!1},enableAcceptRecommendations:{type:Boolean,default:!1},enableRejectRecommendations:{type:Boolean,default:!1}},data:function(){return{cards:[]}},fetch:function(){this.cards=this.items.slice(0,4).concat("related").concat(this.items.slice(4))},computed:{cardGroupClass:function(){var t;switch(this.view){case"list":t="card-group-list mx-0";break;case"explore":t="card-deck-4-cols narrow-gutter explore-more"}return t},cardVariant:function(){return"grid"===this.view?"default":this.view},masonryActive:function(){return"grid"===this.view||"mosaic"===this.view}},watch:{"cards.length":"redrawMasonry",items:function(){this.$fetch()}},mounted:function(){this.redrawMasonry()},methods:{endItemDrag:function(){this.$emit("endItemDrag",this.cards.filter((function(t){return"related"!==t})))},itemHitSelector:function(t){if(!this.hits)return null;var e=this.hits.find((function(e){return t.id===e.scope}));return e?e.selectors[0]:null},redrawMasonry:function(){var t=this;"function"==typeof this.$redrawVueMasonry&&this.masonryActive&&this.$nextTick((function(){t.$redrawVueMasonry()}))}}},w=Object(h.a)(v,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.masonryActive?n("div",{directives:[{name:"masonry",rawName:"v-masonry"}],key:"searchResultsGrid"+t.view,staticClass:"masonry-container",attrs:{"transition-duration":"0.1","item-selector":".card","horizontal-order":"true","column-width":".masonry-container .card:not(.header-card)","data-qa":"item previews "+t.view}},[t._t("default"),t._v(" "),n(t.draggableItems?"draggable":"div",{tag:"component",attrs:{draggable:t.draggableItems&&".item",handle:".move-button"},on:{end:t.endItemDrag},model:{value:t.cards,callback:function(e){t.cards=e},expression:"cards"}},[t._l(t.cards,(function(e,r){return["related"===e?[n("b-card",{directives:[{name:"show",rawName:"v-show",value:t.showRelated,expression:"showRelated"}],key:r,staticClass:"text-left related-collections-card mb-4"},[t._t("related")],2)]:n("ItemPreviewCard",{key:r,staticClass:"item",attrs:{item:e,"hit-selector":t.itemHitSelector(e),variant:t.cardVariant,lazy:!0,"enable-accept-recommendation":t.enableAcceptRecommendations,"enable-reject-recommendation":t.enableRejectRecommendations,"show-pins":t.showPins,"show-move":t.draggableItems,offset:t.items.findIndex((function(t){return t.id===e.id})),"data-qa":"item preview"},on:{like:function(n){return t.$emit("like",e.id)},unlike:function(n){return t.$emit("unlike",e.id)}}})]}))],2)],2):n(t.draggableItems?"draggable":"b-card-group",{tag:"component",class:t.cardGroupClass,attrs:{draggable:t.draggableItems&&".item","data-qa":"item previews "+t.view,deck:""},on:{end:t.endItemDrag},model:{value:t.cards,callback:function(e){t.cards=e},expression:"cards"}},[t._t("default"),t._v(" "),t._l(t.cards,(function(e,r){return["related"===e?[n("b-card",{directives:[{name:"show",rawName:"v-show",value:t.showRelated,expression:"showRelated"}],key:r,staticClass:"text-left related-collections-card mb-4"},[t._t("related")],2)]:n("ItemPreviewCard",{key:e.id,staticClass:"item",attrs:{item:e,"hit-selector":t.itemHitSelector(e),variant:t.cardVariant,"show-pins":t.showPins,"show-move":t.draggableItems,offset:t.items.findIndex((function(t){return t.id===e.id})),"data-qa":"item preview"},on:{like:function(n){return t.$emit("like",e.id)},unlike:function(n){return t.$emit("unlike",e.id)}}})]}))],2)}),[],!1,null,null,null);e.a=w.exports},794:function(t,e){}}]);
//# sourceMappingURL=3dd9c57.js.map