@europeana/portal
Version:
Europeana Portal
318 lines (259 loc) • 9.56 kB
JavaScript
exports.ids = [101,2];
exports.modules = {
/***/ 219:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
;
const ENGLISH_LOCALE_CODE = 'en';
/* harmony default export */ __webpack_exports__["a"] = ({
methods: {
isNamedOrganizationEntity(entity) {
return (entity === null || entity === void 0 ? void 0 : entity.type) === 'Organization' && !!entity.prefLabel;
},
organizationEntityNativeName(entity) {
if (!this.isNamedOrganizationEntity(entity)) {
return null;
}
const nativeLocale = Object.keys(entity.prefLabel).find(locale => locale !== ENGLISH_LOCALE_CODE) || ENGLISH_LOCALE_CODE;
return {
[nativeLocale]: entity.prefLabel[nativeLocale]
};
},
organizationEntityNonNativeEnglishName(entity) {
if (!this.isNamedOrganizationEntity(entity) || Object.keys(entity.prefLabel).length < 2) {
return null;
}
return {
[ENGLISH_LOCALE_CODE]: entity.prefLabel[ENGLISH_LOCALE_CODE]
};
}
}
});
/***/ }),
/***/ 221:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
;
// 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/LoadingSpinner.vue?vue&type=template&id=4e2c4536&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',{attrs:{"role":"status","data-qa":"loading spinner"}},[_vm._ssrNode("<span class=\"visually-hidden\">"+_vm._ssrEscape("\n "+_vm._s(_vm.statusMessage || _vm.$t('loading'))+"\n ")+"</span> <span aria-hidden=\"true\" class=\"spinner-border spinner-border-sm\"></span>")])}
var staticRenderFns = []
// CONCATENATED MODULE: ./src/components/generic/LoadingSpinner.vue?vue&type=template&id=4e2c4536&
// CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/generic/LoadingSpinner.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var LoadingSpinnervue_type_script_lang_js_ = ({
name: 'LoadingSpinner',
props: {
statusMessage: {
type: String,
default: null
}
}
});
// CONCATENATED MODULE: ./src/components/generic/LoadingSpinner.vue?vue&type=script&lang=js&
/* harmony default export */ var generic_LoadingSpinnervue_type_script_lang_js_ = (LoadingSpinnervue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(3);
// CONCATENATED MODULE: ./src/components/generic/LoadingSpinner.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
generic_LoadingSpinnervue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
"5acae62e"
)
/* harmony default export */ var LoadingSpinner = __webpack_exports__["default"] = (component.exports);
/***/ }),
/***/ 570:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
;
// 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/entity/EntityTable.vue?vue&type=template&id=731745a1&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(_vm.$fetchState.error)?_c('b-row',{staticClass:"flex-md-row py-4"},[_c('b-col',{attrs:{"cols":"12"}},[_c('AlertMessage',{attrs:{"error":_vm.$fetchState.error.message}})],1)],1):_vm._e(),_vm._ssrNode(" "),_c('b-table',{staticClass:"borderless",attrs:{"fields":_vm.fields,"items":_vm.collections,"sort-by":_vm.sortBy,"busy":_vm.$fetchState.pending,"striped":""},on:{"update:sortBy":function($event){_vm.sortBy=$event},"update:sort-by":function($event){_vm.sortBy=$event}},scopedSlots:_vm._u([{key:"table-busy",fn:function(){return [_c('div',{staticClass:"text-center my-2"},[_c('LoadingSpinner'),_vm._v("\n "+_vm._s(_vm.$t('loading'))+"\n ")],1)]},proxy:true},{key:"cell(prefLabel)",fn:function(data){return [_c('SmartLink',{attrs:{"destination":_vm.entityRoute(data.item.slug)}},[(_vm.type === 'organisations')?[_c('strong',{attrs:{"lang":data.item.prefLabelLang}},[_vm._v(_vm._s(data.item.prefLabel))]),_vm._v(" "),(data.item.altLabel)?_c('span',{attrs:{"lang":data.item.altLabelLang}},[_vm._v("\n "+_vm._s(data.item.altLabel)+"\n ")]):_vm._e()]:_c('span',[_vm._v("\n "+_vm._s(data.item.prefLabel)+"\n ")])],2)]}},(_vm.type === 'organisations')?{key:"cell(recordCount)",fn:function(data){return [_c('span',[_vm._v("\n "+_vm._s(_vm._f("localise")(data.item.recordCount))+"\n ")])]}}:null],null,true)})],2)}
var staticRenderFns = []
// CONCATENATED MODULE: ./src/components/entity/EntityTable.vue?vue&type=template&id=731745a1&
// EXTERNAL MODULE: external "bootstrap-vue"
var external_bootstrap_vue_ = __webpack_require__(4);
// EXTERNAL MODULE: ./src/components/generic/LoadingSpinner.vue + 4 modules
var LoadingSpinner = __webpack_require__(221);
// EXTERNAL MODULE: ./src/components/generic/SmartLink.vue + 3 modules
var SmartLink = __webpack_require__(26);
// EXTERNAL MODULE: ./src/mixins/europeana/entities/organizations.js
var organizations = __webpack_require__(219);
// EXTERNAL MODULE: ./src/plugins/europeana/utils.js
var utils = __webpack_require__(2);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/entity/EntityTable.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var EntityTablevue_type_script_lang_js_ = ({
name: 'EntityTable',
components: {
AlertMessage: () => __webpack_require__.e(/* import() */ 0).then(__webpack_require__.bind(null, 223)),
BTable: external_bootstrap_vue_["BTable"],
LoadingSpinner: LoadingSpinner["default"],
SmartLink: SmartLink["a" /* default */]
},
mixins: [organizations["a" /* default */]],
props: {
type: {
type: String,
required: true
}
},
data() {
return {
collections: null,
sortBy: 'prefLabel',
fields: [{
key: 'prefLabel',
sortable: true,
label: this.$t('pages.collections.table.name')
}, this.type === 'organisations' && {
key: 'recordCount',
sortable: true,
sortDirection: 'desc',
label: this.$t('pages.collections.table.items'),
class: 'text-right'
}],
typeSingular: this.type.slice(0, -1)
};
},
async fetch() {
try {
const response = await this.$axios.get(this.apiEndpoint, {
baseURL: window.location.origin
});
let collections = response.data;
if (this.type === 'organisations') {
collections = collections.map(this.organisationData);
}
this.collections = collections.map(Object.freeze);
} catch (e) {
// TODO: set fetch state error from message
console.error({
statusCode: 500,
message: e.toString()
});
}
},
fetchOnServer: false,
computed: {
apiEndpoint() {
// For organisations, get unlocalised labels, for both English and native.
return this.type === 'organisations' ? '/_api/cache/collections/organisations' : `/_api/cache/${this.$i18n.locale}/collections/${this.type}`;
}
},
methods: {
organisationData(org) {
const nativeName = this.organizationEntityNativeName({ ...org,
type: 'Organization'
});
const nativeNameLangMapValue = Object(utils["h" /* langMapValueForLocale */])(nativeName, this.$i18n.locale);
const englishName = this.organizationEntityNonNativeEnglishName({ ...org,
type: 'Organization'
});
const englishNameLangMapValue = englishName && Object(utils["h" /* langMapValueForLocale */])(englishName, this.$i18n.locale);
return { ...org,
prefLabel: nativeNameLangMapValue.values[0],
prefLabelLang: nativeNameLangMapValue.code,
altLabel: englishNameLangMapValue === null || englishNameLangMapValue === void 0 ? void 0 : englishNameLangMapValue.values[0],
altLabelLang: englishNameLangMapValue === null || englishNameLangMapValue === void 0 ? void 0 : englishNameLangMapValue.code
};
},
entityRoute(slug) {
return `/collections/${this.typeSingular}/${slug}`;
}
}
});
// CONCATENATED MODULE: ./src/components/entity/EntityTable.vue?vue&type=script&lang=js&
/* harmony default export */ var entity_EntityTablevue_type_script_lang_js_ = (EntityTablevue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(3);
// CONCATENATED MODULE: ./src/components/entity/EntityTable.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
entity_EntityTablevue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
"2da6cb10"
)
/* harmony default export */ var EntityTable = __webpack_exports__["default"] = (component.exports);
/***/ })
};;
//# sourceMappingURL=101.js.map