@europeana/portal
Version:
Europeana Portal
200 lines (168 loc) • 5.56 kB
JavaScript
exports.ids = [14];
exports.modules = {
/***/ 231:
/***/ (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/PaginationNavInput.vue?vue&type=template&id=2367e688&
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('nav',{directives:[{name:"show",rawName:"v-show",value:(_vm.showPagination),expression:"showPagination"}],staticClass:"pagination-nav-input",attrs:{"aria-hidden":"false","aria-label":_vm.$t('pagination.label'),"data-qa":"pagination navigation"}},[_vm._ssrNode("<ul class=\"pl-0 d-flex justify-content-center\">","</ul>",[_vm._ssrNode("<li data-qa=\"prev button\""+(_vm._ssrClass("page-item btn-prev pl-0",{ 'disabled' : _vm.prevDisabled }))+">","</li>",[_c('SmartLink',{staticClass:"page-link",attrs:{"destination":_vm.prevUrl,"aria-label":_vm.$t('actions.previous'),"disabled":_vm.prevDisabled,"aria-hidden":_vm.prevDisabled}},[_c('span',{staticClass:"icon-arrow-down"}),_vm._v("\n "+_vm._s(_vm.$t('actions.previous'))+"\n ")])],1),_vm._ssrNode(" "),_vm._ssrNode("<li class=\"page-item page-input\">","</li>",[_c('b-form-input',{attrs:{"aria-label":_vm.$t('pageNumber'),"lazy":true,"max":_vm.totalPages,"min":1,"number":true,"data-qa":"pagination input","type":"number"},model:{value:(_vm.page),callback:function ($$v) {_vm.page=$$v},expression:"page"}}),_vm._ssrNode(_vm._ssrEscape(" "+_vm._s(_vm.$t('of'))+" "+_vm._s(_vm.totalPages)+"\n "))],2),_vm._ssrNode(" "),_vm._ssrNode("<li data-qa=\"next button\""+(_vm._ssrClass("page-item btn-next pr-0",{ 'disabled' : _vm.nextDisabled }))+">","</li>",[_c('SmartLink',{staticClass:"page-link",attrs:{"destination":_vm.nextUrl,"aria-label":_vm.$t('actions.next'),"disabled":_vm.nextDisabled,"aria-hidden":_vm.nextDisabled}},[_vm._v("\n "+_vm._s(_vm.$t('actions.next'))+"\n "),_c('span',{staticClass:"icon-arrow-down"})])],1)],2)])}
var staticRenderFns = []
// CONCATENATED MODULE: ./src/components/generic/PaginationNavInput.vue?vue&type=template&id=2367e688&
// EXTERNAL MODULE: ./src/components/generic/SmartLink.vue + 3 modules
var SmartLink = __webpack_require__(26);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/generic/PaginationNavInput.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var PaginationNavInputvue_type_script_lang_js_ = ({
name: 'PaginationNavInput',
components: {
SmartLink: SmartLink["a" /* default */]
},
props: {
perPage: {
type: Number,
default: 24
},
totalResults: {
type: Number,
default: 0
},
maxResults: {
type: Number,
default: null
}
},
data() {
var _this$$route, _this$$route$query;
return {
page: Number((_this$$route = this.$route) === null || _this$$route === void 0 ? void 0 : (_this$$route$query = _this$$route.query) === null || _this$$route$query === void 0 ? void 0 : _this$$route$query.page) || 1
};
},
computed: {
showPagination() {
return this.totalResults > this.perPage;
},
totalPages() {
const atLeastOne = Math.max(this.totalResults, 1);
return Math.ceil(Math.min(atLeastOne, this.maxResults || atLeastOne) / this.perPage);
},
prevDisabled() {
return this.page <= 1;
},
prevUrl() {
return this.linkGen(this.page - 1);
},
nextUrl() {
return this.linkGen(this.page + 1);
},
nextDisabled() {
return this.page === this.totalPages;
}
},
watch: {
'$route.query.page'() {
var _this$$route2, _this$$route2$query;
this.page = Number((_this$$route2 = this.$route) === null || _this$$route2 === void 0 ? void 0 : (_this$$route2$query = _this$$route2.query) === null || _this$$route2$query === void 0 ? void 0 : _this$$route2$query.page) || 1;
},
page: 'changePaginationNav'
},
methods: {
changePaginationNav() {
const newRouteQuery = { ...this.$route.query,
page: this.page
};
const newRoute = {
path: this.$route.path,
query: newRouteQuery
};
this.$goto(newRoute);
},
linkGen(pageNo) {
return {
path: this.$route.path,
query: { ...this.$route.query,
page: pageNo
}
};
}
}
});
// CONCATENATED MODULE: ./src/components/generic/PaginationNavInput.vue?vue&type=script&lang=js&
/* harmony default export */ var generic_PaginationNavInputvue_type_script_lang_js_ = (PaginationNavInputvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(3);
// CONCATENATED MODULE: ./src/components/generic/PaginationNavInput.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
generic_PaginationNavInputvue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
"61415edc"
)
/* harmony default export */ var PaginationNavInput = __webpack_exports__["default"] = (component.exports);
/***/ })
};;
//# sourceMappingURL=14.js.map