UNPKG

@europeana/portal

Version:
809 lines (677 loc) 24 kB
exports.ids = [82]; exports.modules = { /***/ 203: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./src/components/generic/ContentCard.vue?vue&type=template&id=28c51dc4& var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-card',{staticClass:"text-left content-card",class:_vm.cardClass,attrs:{"data-qa":"content card","no-body":""}},[_c('div',{staticClass:"card-wrapper"},[_c('SmartLink',{attrs:{"destination":_vm.url,"link-class":"card-link","aria-label":_vm.displayTitle ? _vm.displayTitle.value : null,"title":(_vm.variant === 'mosaic' && _vm.displayTitle) ? _vm.displayTitle.value : null}}),_vm._v(" "),(_vm.variant !== 'mini')?_c('MediaDefaultThumbnail',{directives:[{name:"show",rawName:"v-show",value:(!_vm.cardImageUrl),expression:"!cardImageUrl"}],attrs:{"media-type":_vm.mediaType,"offset":_vm.offset}}):_vm._e(),_vm._v(" "),(_vm.cardImageUrl)?_c('div',{staticClass:"card-img",class:{ logo: _vm.logo }},[(_vm.lazy)?_c('b-img-lazy',{attrs:{"src":_vm.optimisedImageUrl,"blank-width":_vm.blankImageWidth,"blank-height":_vm.blankImageHeight,"width":_vm.imageWidth,"height":_vm.imageHeight,"alt":_vm.imageAlt},nativeOn:{"error":function($event){return _vm.imageNotFound.apply(null, arguments)},"load":function($event){return _vm.imageLoaded.apply(null, arguments)}}}):_c('b-img',{attrs:{"src":_vm.optimisedImageUrl,"width":_vm.imageWidth,"height":_vm.imageHeight,"alt":_vm.imageAlt},on:{"error":_vm.imageNotFound,"load":_vm.imageLoaded}})],1):_vm._e(),_vm._v(" "),(_vm.variant !== 'mosaic')?_c('b-card-body',{attrs:{"data-qa":"card body"}},[((_vm.displaySubTitle && _vm.variant !== 'mini') && _vm.showSubtitle)?_c('b-card-sub-title',{staticClass:"mt-0",attrs:{"sub-title-tag":"div","sub-title-text-variant":"default"}},[_vm._v("\n "+_vm._s(_vm.displaySubTitle)+"\n ")]):_vm._e(),_vm._v(" "),_c('div',{staticClass:"title-texts-wrapper"},[(_vm.displayTitle)?_c('b-card-title',{attrs:{"title-tag":"div","data-qa":"card title","lang":_vm.displayTitle.code}},[_c('span',[_vm._v("\n "+_vm._s(_vm._f("truncate")(_vm.displayTitle.value,90, _vm.$t('formatting.ellipsis')))+"\n ")])]):_vm._e(),_vm._v(" "),(_vm.hitsText)?_c('b-card-text',{attrs:{"text-tag":"div","data-qa":"highlighted search term"}},[_c('p',[_vm._v("\n "+_vm._s(_vm.hitsText.prefix)),_c('strong',{staticClass:"has-text-highlight"},[_vm._v(_vm._s(_vm.hitsText.exact))]),_vm._v(_vm._s(_vm.hitsText.suffix)+"\n ")])]):_vm._e(),_vm._v(" "),(_vm.displayTexts.length > 0)?_vm._l((_vm.displayTexts),function(text,index){return _c('b-card-text',{key:index,attrs:{"lang":text.code,"text-tag":"div"}},[_c('p',{domProps:{"innerHTML":_vm._s(_vm.cardText(text.values))}})])}):_vm._e()],2),_vm._v(" "),_c('client-only',[_vm._t("footer")],2)],1):_vm._e()],1),_vm._v(" "),_c('client-only',[_vm._t("image-overlay")],2)],1)} var staticRenderFns = [] // CONCATENATED MODULE: ./src/components/generic/ContentCard.vue?vue&type=template&id=28c51dc4& // EXTERNAL MODULE: external "vue-client-only" var external_vue_client_only_ = __webpack_require__(20); var external_vue_client_only_default = /*#__PURE__*/__webpack_require__.n(external_vue_client_only_); // EXTERNAL MODULE: ./src/components/generic/SmartLink.vue + 3 modules var SmartLink = __webpack_require__(26); // EXTERNAL MODULE: ./src/mixins/stripMarkdown.js var stripMarkdown = __webpack_require__(204); // EXTERNAL MODULE: ./src/plugins/europeana/utils.js var utils = __webpack_require__(2); // EXTERNAL MODULE: ./src/plugins/europeana/themes.js var themes = __webpack_require__(27); // CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/generic/ContentCard.vue?vue&type=script&lang=js& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var ContentCardvue_type_script_lang_js_ = ({ name: 'ContentCard', components: { ClientOnly: external_vue_client_only_default.a, SmartLink: SmartLink["a" /* default */], MediaDefaultThumbnail: () => __webpack_require__.e(/* import() */ 15).then(__webpack_require__.bind(null, 578)) }, mixins: [stripMarkdown["a" /* default */]], props: { /** * Card title * * If an object is supplied, it is expected to be a LangMap. */ title: { type: [String, Object], default: '' }, /** * Card subtitle */ subTitle: { type: String, default: null }, /** * Card texts * * Each element may be a string, an array of strings, or a LangMap */ texts: { type: Array, default: () => [] }, /** * Hits from a search to highlight in the card texts */ hitsText: { type: Object, default: null }, /** * URL for the card to link to * * An object should be a Vue route */ url: { type: [String, Object], default: '' }, /** * URL of an image to display */ imageUrl: { type: String, default: '' }, /** * Content type of the image */ imageContentType: { type: String, default: null }, /** * Width of the image */ imageWidth: { type: Number, default: null }, /** * Height of the image */ imageHeight: { type: Number, default: null }, /** * Image alt text */ imageAlt: { type: String, default: '' }, /** * Image optimisation options * * Passed to `optimisedImageUrl` filter */ imageOptimisationOptions: { type: Object, default: () => ({}) }, /** * If `true`, image will be lazy-loaded */ lazy: { type: Boolean, default: true }, /** * If `true`, subtitle will be shown */ showSubtitle: { type: Boolean, default: true }, /** * Style variant to use * @values default, entity, mini, list, mosaic */ variant: { type: String, default: 'default' }, /** * If `true`, will omit all URIs from texts */ omitAllUris: { type: Boolean, default: false }, /** * If `true`, will omit URIs from texts only if other values are present */ omitUrisIfOtherValues: { type: Boolean, default: false }, /** * For each element of `texts`, limit the number of values shown * * Default is no limit */ limitValuesWithinEachText: { type: Number, default: -1 }, /** * Height of image placeholder when lazy-loading image */ blankImageHeight: { type: Number, default: null }, /** * Width of image placeholder when lazy-loading image */ blankImageWidth: { type: Number, default: null }, /** * If `true`, the image is a logo and will be styled differently */ logo: { type: Boolean, default: false }, /** * Type of media */ mediaType: { type: String, default: null }, /** * Offset, used for random color picking */ offset: { type: Number, default: null } }, data() { return { cardImageUrl: this.imageUrl, displayLabelTypes: 'exhibitions|galleries|blog|collections', themes: themes["a" /* default */].map(theme => theme.id) }; }, computed: { cardClass() { return `${this.variant}-card`; }, displayTitle() { if (!this.title) { return null; } else if (typeof this.title === 'string') { return { value: this.title, code: null }; } else { const langMapValue = Object(utils["h" /* langMapValueForLocale */])(this.title, this.$i18n.locale); return { value: langMapValue.values[0], code: langMapValue.code }; } }, displaySubTitle() { return this.subTitle || this.displayLabel; }, displayLabel() { if (!this.displayLabelType) { return false; } if (this.displayLabelType === 'collections') { const entityId = typeof this.url === 'string' ? this.url.split('/').pop().split('-').shift() : this.url.params.pathMatch; // TODO: remove when thematic collections topics get their own 'theme' type return this.themes.includes(entityId) ? this.$t('cardLabels.theme') : this.$t(`cardLabels.${this.displayLabelTypeCollections}`); } if (this.displayLabelType === 'blog') { return this.$tc('blog.posts', 1); } return this.$tc(`${this.displayLabelType}.${this.displayLabelType}`, 1); }, displayLabelTypeCollections() { return typeof this.url === 'object' ? this.url.params.type : this.url.split('/').slice(-2, -1); }, displayLabelType() { return this.displayLabelMatch ? this.displayLabelMatch[1] : false; }, displayLabelMatch() { return typeof this.url === 'object' ? this.displayLabelMatchObject : this.displayLabelMatchString; }, displayLabelMatchObject() { return this.url.name.match(new RegExp(`(${this.displayLabelTypes})`)); }, displayLabelMatchString() { return this.url.match(new RegExp(`/(${this.displayLabelTypes})[/.]`)); }, displayTexts() { return this.texts.filter(Boolean).map(value => { if (typeof value === 'string') { return { values: [value], code: null }; } else if (Array.isArray(value)) { return { values: value, code: null }; } else { return Object(utils["h" /* langMapValueForLocale */])(value, 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(values) { const limited = this.limitValuesWithinEachText > -1 ? values.slice(0, this.limitValuesWithinEachText) : [].concat(values); if (values.length > limited.length) { limited.push(this.$t('formatting.ellipsis')); } const joined = limited.join(this.$t('formatting.listSeperator') + ' '); const stripped = this.stripMarkdown(joined); return this.$options.filters.truncate(stripped, 255, this.$t('formatting.ellipsis')); }, redrawMasonry() { if (this.$redrawVueMasonry) { this.$nextTick(() => { this.$redrawVueMasonry(); }); } }, imageNotFound() { this.cardImageUrl = ''; this.redrawMasonry(); }, imageLoaded(event) { // ignore b-img-lazy's blank placeholder images if (!event.target.src.startsWith('data:')) { this.redrawMasonry(); } } } }); // CONCATENATED MODULE: ./src/components/generic/ContentCard.vue?vue&type=script&lang=js& /* harmony default export */ var generic_ContentCardvue_type_script_lang_js_ = (ContentCardvue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(3); // EXTERNAL MODULE: ./src/components/generic/ContentCard.vue?vue&type=custom&index=0&blockType=docs&lang=md var ContentCardvue_type_custom_index_0_blockType_docs_lang_md = __webpack_require__(205); var ContentCardvue_type_custom_index_0_blockType_docs_lang_md_default = /*#__PURE__*/__webpack_require__.n(ContentCardvue_type_custom_index_0_blockType_docs_lang_md); // CONCATENATED MODULE: ./src/components/generic/ContentCard.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( generic_ContentCardvue_type_script_lang_js_, render, staticRenderFns, false, null, null, "473081f0" ) /* custom blocks */ if (typeof ContentCardvue_type_custom_index_0_blockType_docs_lang_md_default.a === 'function') ContentCardvue_type_custom_index_0_blockType_docs_lang_md_default()(component) /* harmony default export */ var ContentCard = __webpack_exports__["default"] = (component.exports); /***/ }), /***/ 204: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var marked__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(184); /* harmony import */ var marked__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(marked__WEBPACK_IMPORTED_MODULE_0__); const htmlRemovalPatternsFromTags = tags => { return [/\n$/].concat(tags.map(tag => new RegExp(`</?${tag}.*?>`, 'gi'))); }; /* harmony default export */ __webpack_exports__["a"] = ({ methods: { /** * Strip markdown from text. * This method FIRST converts markdown to HTML, then removes HTML tags. * WARNING: This also means any HTML tags already present before will be stripped. * * As an optional parameter specific HTML tag names can be supplied. In which case, * only these will be removed. * @param {string} text String containing mark1down * @param {string[]} tags the HTML tags to be removed. * @return {String} text value with HTML breaks */ stripMarkdown(text, tags = ['']) { text = marked__WEBPACK_IMPORTED_MODULE_0__["marked"].parse(text); // Marked adds newlines to the end of the string, and wraps it in a <p> tag. for (const pattern of htmlRemovalPatternsFromTags(tags)) { text = text.replace(pattern, ''); } return text; } } }); /***/ }), /***/ 205: /***/ (function(module, exports) { /***/ }), /***/ 348: /***/ (function(module, exports, __webpack_require__) { // style-loader: Adds some css to the DOM by adding a <style> tag // load the styles var content = __webpack_require__(457); if(content.__esModule) content = content.default; if(typeof content === 'string') content = [[module.i, content, '']]; if(content.locals) module.exports = content.locals; // add CSS to SSR context var add = __webpack_require__(13).default module.exports.__inject__ = function (context) { add("603076ec", content, true, context) }; /***/ }), /***/ 456: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_vue_loader_lib_index_js_vue_loader_options_LatestSection_vue_vue_type_style_index_0_id_0e30d20d_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(348); /* harmony import */ var _node_modules_vue_style_loader_index_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_vue_loader_lib_index_js_vue_loader_options_LatestSection_vue_vue_type_style_index_0_id_0e30d20d_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_vue_style_loader_index_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_vue_loader_lib_index_js_vue_loader_options_LatestSection_vue_vue_type_style_index_0_id_0e30d20d_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__); /* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_vue_style_loader_index_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_vue_loader_lib_index_js_vue_loader_options_LatestSection_vue_vue_type_style_index_0_id_0e30d20d_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_vue_style_loader_index_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_sass_loader_dist_cjs_js_ref_7_oneOf_1_2_node_modules_vue_loader_lib_index_js_vue_loader_options_LatestSection_vue_vue_type_style_index_0_id_0e30d20d_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__)); /***/ }), /***/ 457: /***/ (function(module, exports, __webpack_require__) { // Imports var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(12); var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(false); // Module ___CSS_LOADER_EXPORT___.push([module.i, ".latest-section h2[data-v-0e30d20d]{color:#4d4d4d;font-size:1.5rem;font-weight:600;letter-spacing:.1212rem;text-align:left}", ""]); // Exports module.exports = ___CSS_LOADER_EXPORT___; /***/ }), /***/ 580: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./src/components/browse/LatestSection.vue?vue&type=template&id=0e30d20d&scoped=true& var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('section',{staticClass:"latest-section row mb-5"},[_vm._ssrNode("<div class=\"col-12\" data-v-0e30d20d>","</div>",[_vm._ssrNode("<h2 data-v-0e30d20d>"+_vm._ssrEscape("\n "+_vm._s(_vm.contentType.name)+"\n ")+"</h2> "),_c('b-card-group',{staticClass:"card-deck-4-cols",attrs:{"deck":"","data-qa":("latest " + (_vm.contentType.name))}},_vm._l((_vm.cards),function(card){return _c('ContentCard',{key:card.identifier,attrs:{"title":card.name,"texts":[card.description],"url":_vm.cardData(card).cardLink,"image-url":_vm.cardData(card).imageUrl,"image-content-type":_vm.cardData(card).imageContentType,"image-optimisation-options":{ width: 510 },"image-alt":_vm.cardData(card).description}})}),1),_vm._ssrNode(" "),(_vm.total > 4)?_c('b-button',{attrs:{"variant":"light","to":_vm.localePath({ name: _vm.contentType.path })}},[_vm._v("\n "+_vm._s(_vm.showMoreLink)+"\n ")]):_vm._e()],2)])} var staticRenderFns = [] // CONCATENATED MODULE: ./src/components/browse/LatestSection.vue?vue&type=template&id=0e30d20d&scoped=true& // EXTERNAL MODULE: ./src/components/generic/ContentCard.vue + 4 modules var ContentCard = __webpack_require__(203); // CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/browse/LatestSection.vue?vue&type=script&lang=js& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var LatestSectionvue_type_script_lang_js_ = ({ components: { ContentCard: ContentCard["default"] }, props: { category: { type: String, required: true }, cards: { type: Array, default: () => [] }, total: { type: Number, default: 0 } }, computed: { contentType() { let contentType = {}; if (this.forExhibitions) { contentType = { type: 'exhibitionPage', name: this.$tc('exhibitions.exhibitions', this.total), path: 'exhibitions' }; } else if (this.forGalleries) { contentType = { type: 'imageGallery', name: this.$tc('galleries.galleries', this.total), path: 'galleries' }; } else if (this.forBlogPosts) { contentType = { type: 'blogPosting', name: this.$tc('blog.posts', this.total), path: 'blog' }; } return contentType; }, forGalleries() { return this.category === 'Galleries'; }, forExhibitions() { return this.category === 'Exhibitions'; }, forBlogPosts() { return this.category === 'Blog posts'; }, showMoreLink() { return `${this.$tc('showMore')} ${this.contentType.name.toLowerCase()} (${this.total})`; } }, methods: { cardData(card) { if (this.forExhibitions) { return this.defaultCardData(card, 'exhibitions-exhibition'); } else if (this.forGalleries) { return this.galleryCardData(card); } else if (this.forBlogPosts) { return this.defaultCardData(card, 'blog-all'); } return null; }, defaultCardData(card, name) { var _card$primaryImageOfP, _card$primaryImageOfP2, _card$primaryImageOfP3, _card$primaryImageOfP4; const key = name === 'exhibitions-exhibition' ? 'exhibition' : 'pathMatch'; return { cardLink: { name, params: { [key]: card.identifier } }, description: card.description ? card.description : '', imageUrl: (_card$primaryImageOfP = card.primaryImageOfPage) === null || _card$primaryImageOfP === void 0 ? void 0 : (_card$primaryImageOfP2 = _card$primaryImageOfP.image) === null || _card$primaryImageOfP2 === void 0 ? void 0 : _card$primaryImageOfP2.url, imageContentType: (_card$primaryImageOfP3 = card.primaryImageOfPage) === null || _card$primaryImageOfP3 === void 0 ? void 0 : (_card$primaryImageOfP4 = _card$primaryImageOfP3.image) === null || _card$primaryImageOfP4 === void 0 ? void 0 : _card$primaryImageOfP4.contentType }; }, galleryCardData(card) { var _card$hasPartCollecti, _card$hasPartCollecti2; const edmPreview = ((_card$hasPartCollecti = card.hasPartCollection.items[0].encoding) === null || _card$hasPartCollecti === void 0 ? void 0 : (_card$hasPartCollecti2 = _card$hasPartCollecti.edmPreview) === null || _card$hasPartCollecti2 === void 0 ? void 0 : _card$hasPartCollecti2[0]) || card.hasPartCollection.items[0].thumbnailUrl; return { cardLink: { name: 'galleries-all', params: { pathMatch: card.identifier } }, imageUrl: this.$apis.thumbnail.edmPreview(edmPreview, { size: 400 }) }; } } }); // CONCATENATED MODULE: ./src/components/browse/LatestSection.vue?vue&type=script&lang=js& /* harmony default export */ var browse_LatestSectionvue_type_script_lang_js_ = (LatestSectionvue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(3); // CONCATENATED MODULE: ./src/components/browse/LatestSection.vue function injectStyles (context) { var style0 = __webpack_require__(456) if (style0.__inject__) style0.__inject__(context) } /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( browse_LatestSectionvue_type_script_lang_js_, render, staticRenderFns, false, injectStyles, "0e30d20d", "114d6a52" ) /* harmony default export */ var LatestSection = __webpack_exports__["default"] = (component.exports); /***/ }) };; //# sourceMappingURL=82.js.map