UNPKG

@europeana/portal

Version:
1,357 lines (1,105 loc) 48 kB
exports.ids = [85]; exports.modules = { /***/ 354: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var _plugins_europeana_themes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27); /* harmony import */ var _plugins_europeana_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); const translateWithFallbackOrNull = (scope, key, callback) => { let translation = null; // Needed because VueI18n's $te function does not take into account the fallback // locale, i.e. is always false if the active locale does not have the key. if (scope.$te(key)) { translation = callback(null); } else if (scope.$i18n.locale !== scope.$i18n.fallbackLocale) { if (scope.$te(key, scope.$i18n.fallbackLocale)) { translation = callback(scope.$i18n.fallbackLocale); } } return translation; }; /* harmony default export */ __webpack_exports__["a"] = ({ methods: { // I18n function to localise into active locale if translation exists, else // into app fallback locale, else return null. tNull(key, values) { return translateWithFallbackOrNull(this, key, locale => this.$t(key, locale, values)); }, // I18n pluralisation function to localise into active locale if translation // exists, else into app fallback locale, else return null. tcNull(key, count, values) { return translateWithFallbackOrNull(this, key, locale => this.$tc(key, count, locale, values)); }, tFacetKey(facetName, key, count = 1) { const facetNameKey = facetName.replace(/\..*$/, ''); const collection = this.$store.getters['search/collection']; if (collection) { const collectionLabel = this.tcNull(`collections.${collection}.facets.${facetNameKey}.${key}`, count); if (collectionLabel) { return collectionLabel; } } const genericLabel = this.tcNull(`facets.${facetNameKey}.${key}`, count); return genericLabel || facetNameKey; }, tFacetName(facetName, count = 1) { return this.tFacetKey(facetName, 'name', count); }, tFacetOption(facetName, fieldValue, escaped) { var _find; const MIME_TYPE = 'MIME_TYPE'; const collection = this.$store.getters['search/collection']; const selectedTheme = _plugins_europeana_themes__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].find(theme => theme.qf === collection); const themeSpecificFieldLabelPattern = (_find = ((selectedTheme === null || selectedTheme === void 0 ? void 0 : selectedTheme.facets) || []).find(facet => facet.field === facetName)) === null || _find === void 0 ? void 0 : _find.label; const genericLabel = () => { let fieldLabel = fieldValue; if (escaped) { fieldLabel = Object(_plugins_europeana_utils__WEBPACK_IMPORTED_MODULE_1__[/* unescapeLuceneSpecials */ "k"])(fieldLabel.replace(/^"(.*)"$/, '$1')); } if (themeSpecificFieldLabelPattern) { fieldLabel = fieldLabel.replace(themeSpecificFieldLabelPattern, ''); } const key = `facets.${facetName}.options.${fieldLabel}`; return this.tNull(key) || fieldLabel; }; const mediaTypeLabel = () => { const translated = genericLabel(); if (translated !== fieldValue) { return translated; } const subtype = fieldValue.split('/')[1]; return subtype.replace(/^x-/, '').toUpperCase(); }; return facetName === MIME_TYPE ? mediaTypeLabel() : genericLabel(); } } }); /***/ }), /***/ 355: /***/ (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__(473); 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("65be4708", content, true, context) }; /***/ }), /***/ 471: /***/ (function(module, exports) { /***/ }), /***/ 472: /***/ (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_SideFilters_vue_vue_type_style_index_0_id_34be82f6_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(355); /* 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_SideFilters_vue_vue_type_style_index_0_id_34be82f6_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_SideFilters_vue_vue_type_style_index_0_id_34be82f6_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_SideFilters_vue_vue_type_style_index_0_id_34be82f6_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_SideFilters_vue_vue_type_style_index_0_id_34be82f6_lang_scss_scoped_true___WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__)); /***/ }), /***/ 473: /***/ (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, "[class^=icon-][data-v-34be82f6],[class*=\" icon-\"][data-v-34be82f6]{font-family:\"icomoon\";speak:none;font-style:normal;font-weight:normal;font-variant:normal;text-transform:none;vertical-align:middle;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-accept[data-v-34be82f6]::before{content:\"\"}.icon-ic-add[data-v-34be82f6]::before{content:\"\"}.icon-arrow-down[data-v-34be82f6]::before{content:\"\"}.icon-back[data-v-34be82f6]::before{content:\"\"}.icon-cancel-circle[data-v-34be82f6]::before{content:\"\"}.icon-caret-down[data-v-34be82f6]::before{content:\"\"}.icon-check-circle[data-v-34be82f6]::before{content:\"\"}.icon-clear[data-v-34be82f6]::before{content:\"\"}.icon-close[data-v-34be82f6]::before{content:\"\"}.icon-ic-download[data-v-34be82f6]::before{content:\"\"}.icon-edit[data-v-34be82f6]::before{content:\"\"}.icon-external-link[data-v-34be82f6]::before{content:\"\"}.icon-facebook[data-v-34be82f6]::before{content:\"\"}.icon-ic-feedback[data-v-34be82f6]::before{content:\"\"}.icon-file[data-v-34be82f6]::before{content:\"\"}.icon-filter[data-v-34be82f6]::before{content:\"\"}.icon-globe[data-v-34be82f6]::before{content:\"\"}.icon-heart[data-v-34be82f6]::before{content:\"\"}.icon-info[data-v-34be82f6]::before{content:\"\"}.icon-info-outline[data-v-34be82f6]::before{content:\"\"}.icon-instagram[data-v-34be82f6]::before{content:\"\"}.icon-language[data-v-34be82f6]::before{content:\"\"}.icon-license[data-v-34be82f6]::before{content:\"\"}.icon-link[data-v-34be82f6]::before{content:\"\"}.icon-linkedin[data-v-34be82f6]::before{content:\"\"}.icon-pinterest[data-v-34be82f6]::before{content:\"\"}.icon-push-pin[data-v-34be82f6]::before{content:\"\"}.icon-reject[data-v-34be82f6]::before{content:\"\"}.icon-search[data-v-34be82f6]::before{content:\"\"}.icon-share[data-v-34be82f6]::before{content:\"\"}.icon-ic-tag[data-v-34be82f6]::before{content:\"\"}.icon-temporary-tag[data-v-34be82f6]::before{content:\"\"}.icon-translate[data-v-34be82f6]::before{content:\"\"}.icon-twitter[data-v-34be82f6]::before{content:\"\"}.icon-3d[data-v-34be82f6]::before{content:\"\"}.icon-sound[data-v-34be82f6]::before{content:\"\"}.icon-text[data-v-34be82f6]::before{content:\"\"}.icon-image[data-v-34be82f6]::before{content:\"\"}.icon-video[data-v-34be82f6]::before{content:\"\"}.icon-unavailable[data-v-34be82f6]::before{content:\"\"}.icon-ic-move-vert[data-v-34be82f6]::before{content:\"\"}.icon-ic-move-xy[data-v-34be82f6]::before{content:\"\"}.icon-menu[data-v-34be82f6]::before{content:\"\"}.filters-title[data-v-34be82f6]{font-size:.875rem;font-weight:600;line-height:1;margin:1.25rem 1rem}.col-filters[data-v-34be82f6]{flex-grow:0;padding:0;margin-top:-1rem}@media(max-width: 991px){.col-filters[data-v-34be82f6]{display:flex;position:fixed;right:0;top:0;bottom:0;padding-top:1rem;transition:right 300ms ease-in-out;z-index:1050;max-width:none;overflow:hidden}.col-filters .side-filters[data-v-34be82f6]{flex-shrink:0;margin-right:-320px;overflow-y:auto;width:320px;max-width:75vw;animation:appear-data-v-34be82f6 300ms ease-in-out;transition:margin-right 300ms ease-in-out}@keyframes appear-data-v-34be82f6{from{margin-right:-320px}to{margin-right:0}}.col-filters.hide[data-v-34be82f6]{display:none}.col-filters.open[data-v-34be82f6]{left:0}.col-filters.open .side-filters[data-v-34be82f6]{margin-right:0}.col-filters.open .filters-backdrop[data-v-34be82f6]{content:\"\";width:100%;height:100%;background-color:rgba(0,0,0,.7)}}@media(min-width: 992px){.col-filters[data-v-34be82f6]{max-width:320px;min-width:220px;min-height:31rem}.col-filters[data-v-34be82f6]::after{border-top:145px solid #fff;border-left:60px solid transparent;content:\"\";display:block;height:0;position:absolute;right:0;top:100%;width:0;z-index:1}.col-filters .filters-backdrop[data-v-34be82f6]{display:none}}.col-filters .side-filters[data-v-34be82f6]{background-color:#fff;height:100%}@media(min-width: 992px){.col-filters .icon-clear[data-v-34be82f6]{display:none}}.form-group[data-v-34be82f6]{margin-bottom:1.5rem}", ""]); // Exports module.exports = ___CSS_LOADER_EXPORT___; /***/ }), /***/ 531: /***/ (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/search/SideFilters.vue?vue&type=template&id=34be82f6&scoped=true& var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-col',{staticClass:"col-filters col-3",class:{ open: _vm.showFiltersSheet, hide: _vm.hideFilterSheet }},[_c('div',{staticClass:"filters-backdrop",on:{"click":_vm.toggleFilterSheet}}),_vm._v(" "),_c('b-container',{staticClass:"side-filters",attrs:{"data-qa":"side filters"}},[_c('client-only',[_c('b-row',{staticClass:"border-bottom border-top d-flex justify-content-between align-items-center flex-nowrap"},[(_vm.totalResults)?_c('div',{staticClass:"filters-title",attrs:{"data-qa":"total results"}},[_vm._v("\n "+_vm._s(_vm.$tc('items.itemCount', _vm.totalResultsLocalised, { count: _vm.totalResultsLocalised }))+"\n "),_c('div',{staticClass:"visually-hidden",attrs:{"role":"status"}},[_vm._v("\n "+_vm._s(_vm.$t('searchHasLoaded', [_vm.totalResultsLocalised]))+"\n ")])]):_c('h2',{staticClass:"filters-title"},[_vm._v("\n "+_vm._s(_vm.$t('filterResults'))+"\n ")]),_vm._v(" "),(_vm.hasResettableFilters())?_c('button',{staticClass:"btn btn-outline-primary mr-3",attrs:{"disabled":_vm.resetButtonDisabled,"data-qa":"reset filters button"},on:{"click":_vm.resetFilters}},[_vm._v("\n "+_vm._s(_vm.$t('reset'))+"\n ")]):_vm._e(),_vm._v(" "),_c('b-button',{staticClass:"button-icon-only icon-clear mx-3",attrs:{"data-qa":"close filters button","variant":"light-flat","aria-label":_vm.$t('header.closeSidebar')},on:{"click":_vm.toggleFilterSheet}})],1),_vm._v(" "),_c('b-row',{staticClass:"mb-3 mt-4"},[_c('b-col',{attrs:{"data-qa":"search filters"}},[_c('div',{staticClass:"position-relative"},[(_vm.enableApiFilter)?_c('SideSwitchFilter',{attrs:{"value":_vm.filters.api,"name":"api","label":_vm.$t('facets.api.switch'),"tooltip":_vm.$t('facets.api.switchMoreInfo'),"checked-value":"fulltext","unchecked-value":"metadata","default-value":_vm.apiFilterDefaultValue},on:{"changed":_vm.changeFacet}}):_vm._e(),_vm._v(" "),(_vm.enableDateFilter)?_c('SideDateFilter',{attrs:{"name":_vm.dateFilterField,"start":_vm.dateFilter.start,"end":_vm.dateFilter.end,"specific":_vm.dateFilter.specific},on:{"dateFilter":_vm.dateFilterSelected}}):_vm._e(),_vm._v(" "),_vm._l((_vm.filterableFacets),function(facet){return _c('SideFacetDropdown',{key:facet.name,attrs:{"name":facet.name,"type":_vm.facetDropdownType(facet.name),"selected":_vm.filters[facet.name],"static-fields":facet.staticFields,"search":facet.search,"group-by":_vm.sideFacetDropdownGroupBy(facet.name),"role":"search","aria-label":facet.name},on:{"changed":_vm.changeFacet}})}),_vm._v(" "),(_vm.contentTierFacetSwitch)?_c('SideSwitchFilter',{attrs:{"value":_vm.filters.contentTier,"name":"contentTier","label":_vm.$t('facets.contentTier.options.0'),"checked-value":"\"0\"","unchecked-value":null,"default-value":null},on:{"changed":_vm.changeFacet}}):_vm._e()],2)])],1)],1)],1)],1)} var staticRenderFns = [] // CONCATENATED MODULE: ./src/components/search/SideFilters.vue?vue&type=template&id=34be82f6&scoped=true& // 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: external "lodash/isEqual" var isEqual_ = __webpack_require__(190); var isEqual_default = /*#__PURE__*/__webpack_require__.n(isEqual_); // EXTERNAL MODULE: external "vuex" var external_vuex_ = __webpack_require__(8); // EXTERNAL MODULE: ./src/plugins/europeana/search.js var search = __webpack_require__(16); // EXTERNAL MODULE: ./src/plugins/europeana/themes.js var themes = __webpack_require__(27); // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./src/components/search/SideFacetDropdown.vue?vue&type=template&id=53d3fc95& var SideFacetDropdownvue_type_template_id_53d3fc95_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('b-form-tags',{staticClass:"side-filter-autosuggest",attrs:{"id":_vm.facetNameNoSpaces,"no-outer-focus":"","limit":_vm.isRadio ? 1 : null},scopedSlots:_vm._u([{key:"default",fn:function(ref){ var tags = ref.tags; var addTag = ref.addTag; var removeTag = ref.removeTag; return [_c('label',{staticClass:"facet-label",class:{ 'facet-label-active' : _vm.activeLabel }},[_vm._v("\n "+_vm._s(_vm.facetName)+"\n ")]),_vm._v(" "),(_vm.$fetchState.error)?_c('b-container',[_c('AlertMessage',{attrs:{"error":_vm.$fetchState.error.message}})],1):[(tags.length > 0)?_c('ul',_vm._l((tags),function(tag){return _c('li',{key:tag,staticClass:"list-inline-item mw-100"},[_c('b-form-tag',{staticClass:"remove-button",attrs:{"data-qa":"filter badge","pill":"","variant":"primary-light"},on:{"remove":function($event){return _vm.removeOption({ tag: tag, removeTag: removeTag })}}},[_c('span',[_vm._v("\n "+_vm._s(_vm.tFacetOption(_vm.name, tag, true))+"\n ")])])],1)}),0):_vm._e(),_vm._v(" "),_c('b-dropdown',{ref:"dropdown",attrs:{"block":"","no-flip":"","data-qa":(_vm.name + " side facet dropdown button")},on:{"show":_vm.prefetch,"shown":_vm.shownDropdown,"hidden":_vm.resetDropdown},nativeOn:{"mouseover":function($event){return _vm.prefetch.apply(null, arguments)},"focusin":function($event){return _vm.prefetch.apply(null, arguments)}},scopedSlots:_vm._u([{key:"button-content",fn:function(){return [_c('span',{staticClass:"select-label"},[_vm._v("\n "+_vm._s(_vm.tFacetKey(_vm.name, 'select'))+"\n ")])]},proxy:true}],null,true)},[_vm._v(" "),(_vm.searchable)?[_c('b-dropdown-form',{on:{"submit":function($event){$event.stopPropagation();$event.preventDefault();return (function () {}).apply(null, arguments)}}},[_c('b-form-group',{attrs:{"label-for":(_vm.facetNameNoSpaces + "-search-input")}},[_c('b-form-input',{ref:"search-input",attrs:{"id":(_vm.facetNameNoSpaces + "-search-input"),"type":"text","autocomplete":"off","placeholder":_vm.$t('sideFilters.search'),"data-qa":"side facet dropdown search input"},on:{"input":function($event){_vm.activeSearchInput = true},"blur":function($event){_vm.activeSearchInput = false}},model:{value:(_vm.searchFacet),callback:function ($$v) {_vm.searchFacet=$$v},expression:"searchFacet"}}),_vm._v(" "),_c('span',{staticClass:"icon-search"})],1)],1)]:_vm._e(),_vm._v(" "),_vm._l((_vm.availableSortedDisplayableOptions),function(option,index){return _c('b-dropdown-item-button',{key:index,attrs:{"data-qa":((_vm.isRadio ? option : option.label) + " " + _vm.name + " field")},on:{"click":function($event){return _vm.selectOption({ option: option, addTag: addTag, removeTag: removeTag })}}},[(_vm.isRadio)?_c('span',[_vm._v("\n "+_vm._s(_vm.tFacetOption(_vm.name, option))+"\n ")]):[(_vm.isColourPalette)?_c('ColourSwatch',{attrs:{"hex-code":option.label}}):_vm._e(),_vm._v(" "),_c('span',[_vm._v("\n "+_vm._s(_vm.tFacetOption(_vm.name, option.label))+"\n ")]),_vm._v(" "),_c('span',[_vm._v("("+_vm._s(_vm._f("localise")(option.count))+")")])]],2)}),_vm._v(" "),(_vm.truncated)?[_c('b-dropdown-divider'),_vm._v(" "),_c('b-dropdown-item-button',{staticClass:"more-facet-values-button",attrs:{"data-qa":"more facet values available button"},nativeOn:{"!click":function($event){$event.stopPropagation();return _vm.setSearchFocus.apply(null, arguments)}}},[_c('i18n',{attrs:{"path":"facets.moreOptions","tag":"span"}},[_c('span',{staticClass:"font-weight-bold"},[_vm._v("\n "+_vm._s(_vm._f("localise")(_vm.truncatedAmount))+"\n ")]),_vm._v("\n "+_vm._s(_vm.moreOptionsName))])],1)]:_vm._e(),_vm._v(" "),(_vm.$fetchState.pending)?_c('b-dropdown-text',{staticClass:"text-center"},[_c('LoadingSpinner')],1):(_vm.fetched && _vm.availableSortedDisplayableOptions.length === 0)?_c('b-dropdown-text',[_vm._v("\n "+_vm._s(_vm.$t('sideFilters.noOptions'))+"\n ")]):_vm._e()],2)]]}}]),model:{value:(_vm.selectedOptions),callback:function ($$v) {_vm.selectedOptions=$$v},expression:"selectedOptions"}})],1)} var SideFacetDropdownvue_type_template_id_53d3fc95_staticRenderFns = [] // CONCATENATED MODULE: ./src/components/search/SideFacetDropdown.vue?vue&type=template&id=53d3fc95& // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./src/components/generic/ColourSwatch.vue?vue&type=template&id=75b37648& var ColourSwatchvue_type_template_id_75b37648_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',{staticClass:"colour-palette",style:(("backgroundColor: " + _vm.hexCode)),attrs:{"data-qa":("colour swatch " + _vm.hexCode)}},[])} var ColourSwatchvue_type_template_id_75b37648_staticRenderFns = [] // CONCATENATED MODULE: ./src/components/generic/ColourSwatch.vue?vue&type=template&id=75b37648& // CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/generic/ColourSwatch.vue?vue&type=script&lang=js& // // // // // // // // /* harmony default export */ var ColourSwatchvue_type_script_lang_js_ = ({ name: 'ColourSwatch', props: { hexCode: { type: String, default: '' } } }); // CONCATENATED MODULE: ./src/components/generic/ColourSwatch.vue?vue&type=script&lang=js& /* harmony default export */ var generic_ColourSwatchvue_type_script_lang_js_ = (ColourSwatchvue_type_script_lang_js_); // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js var componentNormalizer = __webpack_require__(3); // CONCATENATED MODULE: ./src/components/generic/ColourSwatch.vue /* normalize component */ var component = Object(componentNormalizer["a" /* default */])( generic_ColourSwatchvue_type_script_lang_js_, ColourSwatchvue_type_template_id_75b37648_render, ColourSwatchvue_type_template_id_75b37648_staticRenderFns, false, null, null, "1e89c2d9" ) /* harmony default export */ var ColourSwatch = (component.exports); // EXTERNAL MODULE: external "bootstrap-vue" var external_bootstrap_vue_ = __webpack_require__(4); // EXTERNAL MODULE: ./src/plugins/europeana/utils.js var utils = __webpack_require__(2); // EXTERNAL MODULE: ./src/mixins/facets.js var mixins_facets = __webpack_require__(354); // CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/search/SideFacetDropdown.vue?vue&type=script&lang=js& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /** * Dropdown for search facet, with removable tags and optional search. */ /* harmony default export */ var SideFacetDropdownvue_type_script_lang_js_ = ({ name: 'SideFacetDropdown', components: { BFormTags: external_bootstrap_vue_["BFormTags"], BFormTag: external_bootstrap_vue_["BFormTag"], ColourSwatch: ColourSwatch, AlertMessage: () => __webpack_require__.e(/* import() */ 0).then(__webpack_require__.bind(null, 223)), LoadingSpinner: () => __webpack_require__.e(/* import() */ 2).then(__webpack_require__.bind(null, 221)) }, mixins: [mixins_facets["a" /* default */]], props: { /** * Name of filter */ name: { type: String, required: true }, /** * Selected option(s) */ selected: { type: [Array, String], default: () => [] }, /** * Type of input fields in dropdown, could be radio or checkbox * * @values radio, checkbox */ type: { type: String, required: true }, /** * Static fields, these fields need no fetching */ staticFields: { type: Array, default: null }, /** * If `true`, enable search of available fields. */ search: { type: Boolean, default: false }, /** * Array of strings to group fields by */ groupBy: { type: Array, default: null } }, data() { return { searchFacet: '', RADIO: 'radio', CHECKBOX: 'checkbox', MAXIMUM_VALUES_DISPLAY_COUNT: 50, MAXIMUM_VALUES_RETRIEVAL_COUNT: 125000, // Beyond 140000 we've seen solr errors. 125000 to have plenty of buffer before that happens. preSelected: null, fetched: !!this.staticFields, fields: this.staticFields || [], selectedOptions: this.selected || [], activeSearchInput: false, mayFetch: false, fetching: false }; }, fetch() { // Static fields need no fetching if (this.staticFields) { this.fields = this.staticFields; this.fetched = true; return Promise.resolve(); } if (!this.mayFetch || this.fetching) { return Promise.resolve(); } this.fetching = true; return this.queryFacet().then(fields => { this.fetching = false; this.fields = fields || []; this.fetched = true; }); }, computed: { searchable() { return this.search && this.fields.length > 0; }, selectedFilters() { return { [this.name]: [].concat(this.selected) }; }, groupedOptions() { if (!this.groupBy) { return this.fields; } const groups = this.groupBy.map(substring => ({ label: `*${substring}*`, substring, count: 0 })); for (const field of this.fields) { const fieldGroup = groups.find(group => field.label.includes(group.substring)); if (fieldGroup) { fieldGroup.count = fieldGroup.count + field.count; } else { groups.push(field); } } return groups.filter(group => group.count > 0).map(group => ({ label: group.label, count: group.count })); }, sortedOptions() { if (this.isRadio) { // Slice to make a copy, as sort occurs in place return this.fields.slice(0).sort((a, b) => this.tFacetOption(this.name, a).localeCompare(this.tFacetOption(this.name, b))); } const fields = this.groupedOptions; const sortByCount = (a, b) => b.count - a.count; const selected = fields.filter(field => this.selected.includes(field.label)).sort(sortByCount); const leftOver = fields.filter(field => !this.selected.includes(field.label)).sort(sortByCount); return selected.concat(leftOver); }, availableSortedOptions() { if (!this.fetched) { return []; } const criteria = this.criteria; const unquotedSelectedOptions = this.selectedOptions.map(option => Object(utils["k" /* unescapeLuceneSpecials */])(option.replace(/^"(.*)"$/, '$1'))); const options = this.sortedOptions.filter(option => unquotedSelectedOptions.indexOf(this.isRadio ? option : option.label) === -1); if (criteria) { return options.filter(option => { const optionLabel = this.isRadio ? option : option.label; const optionLocalisedLabel = this.tFacetOption(this.name, optionLabel); const exactMatch = optionLocalisedLabel.toLowerCase().indexOf(criteria) > -1; const facetValueMatch = optionLabel.toLowerCase().indexOf(criteria) > -1; return exactMatch || facetValueMatch; }); } return options; }, availableSortedDisplayableOptions() { if (this.search && this.availableSortedOptions.length > this.MAXIMUM_VALUES_DISPLAY_COUNT) { return this.availableSortedOptions.slice(0, this.MAXIMUM_VALUES_DISPLAY_COUNT); } return this.availableSortedOptions; }, truncated() { return this.search && this.availableSortedOptions.length - this.MAXIMUM_VALUES_DISPLAY_COUNT >= 0; }, truncatedAmount() { return this.truncated ? this.availableSortedOptions.length - this.MAXIMUM_VALUES_DISPLAY_COUNT : 0; }, isColourPalette() { return this.name === 'COLOURPALETTE'; }, facetName() { return this.tFacetName(this.name); }, facetNameNoSpaces() { return this.tFacetName(this.name).replace(/\s/g, '-').toLowerCase(); }, isRadio() { return this.type === this.RADIO; }, collection() { return this.$store.getters['search/collection']; }, theme() { return themes["a" /* default */].find(theme => theme.qf === this.collection); }, moreOptionsName() { return this.tFacetKey(this.name, 'moreName'); }, themeSpecificFieldLabelPattern() { var _find, _this$theme; return (_find = (((_this$theme = this.theme) === null || _this$theme === void 0 ? void 0 : _this$theme.facets) || []).find(facet => facet.field === this.name)) === null || _find === void 0 ? void 0 : _find.label; }, paramsForFacets() { const params = { ...this.apiParams, rows: 0, profile: 'facets', facet: this.name }; if (this.search) { params[`f.${this.name}.facet.limit`] = this.MAXIMUM_VALUES_RETRIEVAL_COUNT; } return params; }, criteria() { return this.searchFacet.trim().toLowerCase(); }, activeLabel() { return this.selectedFilters[this.name].length > 0 || this.activeSearchInput; }, ...Object(external_vuex_["mapState"])({ apiOptions: state => state.search.apiOptions, apiParams: state => state.search.apiParams }) }, watch: { selected() { // We watch selected property so when user clicks on browser back button, // facets properties are updated correctly this.init(); }, '$route.query.reusability': 'refetch', '$route.query.api': 'refetch', '$route.query.query': 'refetch', '$route.query.qf': 'refetch' }, mounted() { this.init(); }, methods: { queryFacet() { return this.$apis.record.search(this.paramsForFacets, { ...this.apiOptions, locale: this.$i18n.locale }).then(response => { var _response$facets, _response$facets$; return ((_response$facets = response.facets) === null || _response$facets === void 0 ? void 0 : (_response$facets$ = _response$facets[0]) === null || _response$facets$ === void 0 ? void 0 : _response$facets$.fields) || []; }).then(fields => this.filterFacetFields(fields)).catch(async error => { // TODO: refactor not to use store. rely on fetchState.error instead await this.$store.dispatch('search/updateForFailure', error); }); }, filterFacetFields(fields) { if (this.name === 'REUSABILITY') { fields = fields.filter(field => field.label !== 'uncategorized'); } else if (this.name === 'contentTier') { fields = this.filterContentTierFields(fields); } if (this.themeSpecificFieldLabelPattern) { fields = fields.filter(field => this.themeSpecificFieldLabelPattern.test(field.label)); } return fields; }, filterContentTierFields(fields) { // In general, only show option 0 let contentTierFilters = ['0']; if (this.collection) { // If searching within a thematic collection, only show options 2 to 4 contentTierFilters = ['2', '3', '4']; } else if (this.$store.getters['entity/id']) { // If searching with a non-thematic collection... if (this.$store.getters['entity/id'].includes('/organization/')) { // ... and it is an organization, do not limit the options contentTierFilters = null; } else { // ... and it is not an organization, only show options 1 to 4 contentTierFilters = ['1', '2', '3', '4']; } } if (contentTierFilters) { fields = fields.filter(field => contentTierFilters.includes(field.label)); } return fields; }, enquoteFacetFieldFilterValue(value) { if (search["e" /* unquotableFacets */].includes(this.name) || this.groupBy) { return value; } else { return `"${Object(utils["e" /* escapeLuceneSpecials */])(value)}"`; } }, refetch() { this.$nextTick(() => { this.fetched = false; this.$fetch(); }); }, prefetch() { if (this.fetched) { return Promise.resolve(); } this.mayFetch = true; return this.$fetch().then(() => { this.mayFetch = false; }); }, init() { if (this.isRadio && Array.isArray(this.selected)) { this.preSelected = this.selected[0]; } else { this.preSelected = this.selected; } this.selectedOptions = this.selected || []; }, removeOption({ tag, removeTag }) { removeTag(tag); this.$emit('changed', this.name, this.selected.filter(selection => selection !== tag)); }, selectOption({ option, addTag, removeTag }) { // when isRadio and already one option selected > replace if (this.isRadio && this.selectedOptions.length === 1) { removeTag(this.selectedOptions[0]); } const selected = this.isRadio ? option : option.label; addTag(selected); this.searchFacet = ''; this.$emit('changed', this.name, this.isRadio ? selected : this.selected.concat(this.enquoteFacetFieldFilterValue(selected))); }, shownDropdown() { this.searchable && this.setSearchFocus(); }, setSearchFocus() { this.$refs['search-input'].focus(); }, resetDropdown() { this.searchFacet = ''; this.$refs.dropdown.$refs.menu.scrollTop = 0; this.mayFetch = false; } } }); // CONCATENATED MODULE: ./src/components/search/SideFacetDropdown.vue?vue&type=script&lang=js& /* harmony default export */ var search_SideFacetDropdownvue_type_script_lang_js_ = (SideFacetDropdownvue_type_script_lang_js_); // EXTERNAL MODULE: ./src/components/search/SideFacetDropdown.vue?vue&type=custom&index=0&blockType=docs&lang=md var SideFacetDropdownvue_type_custom_index_0_blockType_docs_lang_md = __webpack_require__(471); var SideFacetDropdownvue_type_custom_index_0_blockType_docs_lang_md_default = /*#__PURE__*/__webpack_require__.n(SideFacetDropdownvue_type_custom_index_0_blockType_docs_lang_md); // CONCATENATED MODULE: ./src/components/search/SideFacetDropdown.vue /* normalize component */ var SideFacetDropdown_component = Object(componentNormalizer["a" /* default */])( search_SideFacetDropdownvue_type_script_lang_js_, SideFacetDropdownvue_type_template_id_53d3fc95_render, SideFacetDropdownvue_type_template_id_53d3fc95_staticRenderFns, false, null, null, "997f063a" ) /* custom blocks */ if (typeof SideFacetDropdownvue_type_custom_index_0_blockType_docs_lang_md_default.a === 'function') SideFacetDropdownvue_type_custom_index_0_blockType_docs_lang_md_default()(SideFacetDropdown_component) /* harmony default export */ var SideFacetDropdown = (SideFacetDropdown_component.exports); // CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/search/SideFilters.vue?vue&type=script&lang=js& // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ var SideFiltersvue_type_script_lang_js_ = ({ name: 'SideFilters', components: { ClientOnly: external_vue_client_only_default.a, SideFacetDropdown: SideFacetDropdown, SideDateFilter: () => __webpack_require__.e(/* import() */ 100).then(__webpack_require__.bind(null, 594)), SideSwitchFilter: () => __webpack_require__.e(/* import() */ 90).then(__webpack_require__.bind(null, 595)) }, props: { route: { type: Object, default: () => { return { name: 'search' }; } } }, data() { return { DEFAULT_FACET_NAMES: ['TYPE', 'REUSABILITY', 'COUNTRY', 'LANGUAGE', 'PROVIDER', 'DATA_PROVIDER', 'COLOURPALETTE', 'IMAGE_ASPECTRATIO', 'IMAGE_SIZE', 'MIME_TYPE', 'RIGHTS', 'contentTier'], SEARCHABLE_FACETS: ['COUNTRY', 'LANGUAGE', 'PROVIDER', 'DATA_PROVIDER', 'COLOURPALETTE', 'MIME_TYPE', 'CREATOR', 'proxy_dc_type.en', 'proxy_dc_format.en', 'proxy_dcterms_medium.en'], hideFilterSheet: true }; }, computed: { ...Object(external_vuex_["mapState"])({ collectionFacetEnabled: state => state.search.collectionFacetEnabled, showFiltersSheet: state => state.search.showFiltersSheet, totalResults: state => state.search.totalResults, userParams: state => state.search.userParams }), ...Object(external_vuex_["mapGetters"])({ collection: 'search/collection' }), // TODO: do not assume filters are fielded, e.g. `qf=whale` filters() { var _this$$store$state$se, _this$$store$state$se2, _this$$store$state$se3; const filters = Object(search["b" /* filtersFromQf */])((_this$$store$state$se = this.$store.state.search.userParams) === null || _this$$store$state$se === void 0 ? void 0 : _this$$store$state$se.qf); if ((_this$$store$state$se2 = this.$store.state.search.userParams) !== null && _this$$store$state$se2 !== void 0 && _this$$store$state$se2.reusability) { filters['REUSABILITY'] = this.$store.state.search.userParams.reusability.split(','); } if ((_this$$store$state$se3 = this.$store.state.search.apiParams) !== null && _this$$store$state$se3 !== void 0 && _this$$store$state$se3.api) { filters['api'] = this.$store.state.search.apiParams.api; } return filters; }, resettableFilters() { const filters = this.filterableFacets.map(facet => facet.name).filter(name => this.filters[name]); if (this.contentTierFacetSwitch && this.filters.contentTier) { filters.push('contentTier'); } if (this.enableApiFilter && this.filters.api !== this.apiFilterDefaultValue) { filters.push('api'); } if (this.enableDateFilter && this.filters[this.dateFilterField]) { filters.push(this.dateFilterField); } return filters; }, theme() { return themes["a" /* default */].find(theme => theme.qf === this.collection); }, themeSpecificFacetNames() { var _this$theme; return (((_this$theme = this.theme) === null || _this$theme === void 0 ? void 0 : _this$theme.facets) || []).map(facet => facet.field); }, facetNames() { return this.themeSpecificFacetNames.concat(this.DEFAULT_FACET_NAMES); }, resetButtonDisabled() { // Disable reset button while queries are running return this.$store.state.search.liveQueries.length > 0; }, filterableFacets() { let facets = this.facetNames.map(facetName => ({ name: facetName, search: this.SEARCHABLE_FACETS.includes(facetName) })); if (this.collectionFacetEnabled) { facets.unshift({ name: 'collection', staticFields: themes["a" /* default */].map(theme => theme.qf) }); } if (this.contentTierFacetSwitch) { facets = facets.filter(facet => facet.name !== 'contentTier'); } return facets; }, contentTierFacetSwitch() { return !this.$store.getters['search/collection'] && !this.$store.getters['entity/id']; }, boost() { return this.userParams.boost; }, qf() { return this.userParams.qf; }, query() { return this.userParams.query; }, reusability() { return this.userParams.reusability; }, api() { return this.userParams.api; }, view() { return this.userParams.view; }, page() { // This causes double jumps on pagination when using the > arrow, for some reason // return this.userParams.page; // This is a workaround return Number(this.$route.query.page || 1); }, enableApiFilter() { var _this$theme2, _this$theme2$filters; return !!((_this$theme2 = this.theme) !== null && _this$theme2 !== void 0 && (_this$theme2$filters = _this$theme2.filters) !== null && _this$theme2$filters !== void 0 && _this$theme2$filters.api); }, apiFilterDefaultValue() { var _this$theme3, _this$theme3$filters, _this$theme3$filters$; return ((_this$theme3 = this.theme) === null || _this$theme3 === void 0 ? void 0 : (_this$theme3$filters = _this$theme3.filters) === null || _this$theme3$filters === void 0 ? void 0 : (_this$theme3$filters$ = _this$theme3$filters.api) === null || _this$theme3$filters$ === void 0 ? void 0 : _this$theme3$filters$.default) || null; }, enableDateFilter() { var _this$theme4, _this$theme4$filters; return !!((_this$theme4 = this.theme) !== null && _this$theme4 !== void 0 && (_this$theme4$filters = _this$theme4.filters) !== null && _this$theme4$filters !== void 0 && _this$theme4$filters.date); }, dateFilterField() { var _this$theme5, _this$theme5$filters, _this$theme5$filters$; return ((_this$theme5 = this.theme) === null || _this$theme5 === void 0 ? void 0 : (_this$theme5$filters = _this$theme5.filters) === null || _this$theme5$filters === void 0 ? void 0 : (_this$theme5$filters$ = _this$theme5$filters.date) === null || _this$theme5$filters$ === void 0 ? void 0 : _this$theme5$filters$.field) || null; }, dateFilter() { const dateFilterValue = this.filters[this.dateFilterField]; if (!dateFilterValue || dateFilterValue.length < 1) { return { start: null, end: null, specific: this.isCheckedSpecificDate }; } const range = Object(search["c" /* rangeFromQueryParam */])(dateFilterValue[0]); return range ? { ...range, specific: false } : { start: dateFilterValue[0], end: null, specific: true }; }, totalResultsLocalised() { return this.$options.filters.localise(this.totalResults); } }, watch: { showFiltersSheet(newVal) { if (newVal) { this.hideFilterSheet = false; } else { setTimeout(() => this.hideFilterSheet = true, 300); } } }, created() { this.$store.commit('search/setShowFiltersToggle', true); }, beforeDestroy() { this.$store.commit('search/setShowFiltersToggle', false); }, methods: { facetDropdownType(name) { return name === 'collection' || name === 'api' ? 'radio' : 'checkbox'; }, changeFacet(name, selected) { if (typeof this.filters[name] === 'undefined') { if (Array.isArray(selected) && selected.length === 0 || !selected) { return; } } if (isEqual_default()(this.filters[name], selected)) { return; } this.rerouteSearch(this.queryUpdatesForFacetChanges({ [name]: selected })); }, queryUpdatesForFacetChanges(selected = {}) { const filters = Object.assign({}, this.filters); for (const name in selected) { filters[name] = selected[name]; } // Remove collection-specific filters when collection is changed if (Object.prototype.hasOwnProperty.call(selected, 'collection') || !this.collection) { for (const name in filters) { if (name !== 'collection' && !this.DEFAULT_FACET_NAMES.includes(name) && this.resettableFilters.includes(name)) { filters[name] = []; } } } // Remove filters incompatible with change of collection filter if (Object.prototype.hasOwnProperty.call(selected, 'collection') && Object.prototype.hasOwnProperty.call(filters, 'contentTier')) { filters['contentTier'] = []; } return this.queryUpdatesForFilters(filters); }, queryUpdatesForFilters(filters) { const queryUpdates = { qf: [], page: 1 }; for (const name in filters) { switch (name) { case 'REUSABILITY': // `reusability` has its own API parameter and can not be queried in `qf` queryUpdates.reusability = filters[name].length > 0 ? filters[name].join(',') : null; break; case 'api': // `api` is an option to /plugins/europeana/search/search() queryUpdates.api = filters[name]; break; default: // Everything else goes in `qf` queryUpdates.qf = queryUpdates.qf.concat(this.queryUpdatesForFilter(name, filters[name])); } } return queryUpdates; }, queryUpdatesForFilter(name, values) { return [].concat(values).filter(value => value !== undefined && value !== null).map(value => `${name}:${value}`); }, rerouteSearch(queryUpdates) { const query = this.updateCurrentSearchQuery(queryUpdates); this.$goto(this.$path({ ...this.route, ...{ query } })); if (queryUpdates.qf) { queryUpdates.qf.forEach(filter => this.$matomo && this.$matomo.trackEvent('Filters', 'Filter selected', filter)); } if (queryUpdates.reusability) { this.$matomo && this.$matomo.trackEvent('Filters', 'Reusability filter selected', queryUpdates.reusability); } }, updateCurrentSearchQuery(updates = {}) { const current = { boost: this.boost, page: this.page, qf: this.qf, query: this.query, reusability: this.reusability, view: this.view, api: this.api }; const updated = { ...current, ...updates }; for (const key in updated) { // If any updated values are `null`, remove them from the query if (updated[key] === null) { delete updated[key]; } } return updated; }, resetFilters() { const filters = Object.assign({}, this.filters); for (const filterName of this.resettableFilters) { filters[filterName] = []; } return this.rerouteSearch(this.queryUpdatesForFilters(filters)); }, hasResettableFilters() { return this.resettableFilters.length > 0; }, dateFilterSelected(facetName, dateRange) { let dateQuery = []; if (dateRange.specific) { if (dateRange.start) { dateQuery = [dateRange.start]; } } else if (dateRange.start || dateRange.end) { dateQuery = [Object(search["d" /* rangeToQueryParam */])(dateRange)]; } this.isCheckedSpecificDate = dateRange.specific; this.changeFacet(facetName, dateQuery); }, toggleFilterSheet() { this.$store.commit('search/setShowFiltersSheet', !this.$store.state.search.showFiltersSheet); }, sideFacetDropdownGroupBy(facetName) { if (facetName === 'RIGHTS') { return ['/CNE/', '/InC-EDU/', '/InC-OW-EU/', '/InC/', '/licenses/by-nc-nd/', '/licenses/by-nc-sa/', '/licenses/by-nc/', '/licenses/by-nd/', '/licenses/by-sa/', '/licenses/by/', '/NoC-NC/', '/NoC-OKLR/', '/publicdomain/mark/', '/publicdomain/zero/', '/rights/out-of-copyright-non-commercial/', '/rights/rr-f/', '/rights/unknown/']; } else { return null; } } } }); // CONCATENATED MODULE: ./src/components/search/SideFilters.vue?vue&type=script&lang=js& /* harmony default export */ var search_SideFiltersvue_type_script_lang_js_ = (SideFiltersvue_type_script_lang_js_); // CONCATENATED MODULE: ./src/components/search/SideFilters.vue function injectStyles (context) { var style0 = __webpack_require__(472) if (style0.__inject__) style0.__inject__(context) } /* normalize component */ var SideFilters_component = Object(componentNormalizer["a" /* default */])( search_SideFiltersvue_type_script_lang_js_, render, staticRenderFns, false, injectStyles, "34be82f6", "2df96eb6" ) /* harmony default export */ var SideFilters = __webpack_exports__["default"] = (SideFilters_component.exports); /***/ }) };; //# sourceMappingURL=85.js.map